From 88da8fc019b0231e384179aed89ea662c0906fe2 Mon Sep 17 00:00:00 2001 From: Natalia Portillo Date: Fri, 22 Jun 2018 08:08:38 +0100 Subject: [PATCH] Code cleanup. --- DiscImageChef.Checksums/Adler32Context.cs | 2 +- DiscImageChef.Checksums/CRC16Context.cs | 10 +- DiscImageChef.Checksums/CRC32Context.cs | 10 +- DiscImageChef.Checksums/CRC64Context.cs | 10 +- DiscImageChef.Checksums/FletcherContext.cs | 4 +- DiscImageChef.Checksums/MD5Context.cs | 8 +- DiscImageChef.Checksums/RIPEMD160Context.cs | 8 +- DiscImageChef.Checksums/ReedSolomon.cs | 119 +- DiscImageChef.Checksums/SHA1Context.cs | 8 +- DiscImageChef.Checksums/SHA256Context.cs | 6 +- DiscImageChef.Checksums/SHA384Context.cs | 6 +- DiscImageChef.Checksums/SHA512Context.cs | 6 +- DiscImageChef.Checksums/SpamSumContext.cs | 13 +- DiscImageChef.CommonTypes/MediaType.cs | 350 +-- .../MediaTypeFromSCSI.cs | 18 +- DiscImageChef.Compression/TeleDiskLzh.cs | 30 +- DiscImageChef.Console/DicConsole.cs | 12 +- DiscImageChef.Core/Benchmark.cs | 159 +- DiscImageChef.Core/Checksum.cs | 75 +- DiscImageChef.Core/DataFile.cs | 5 +- DiscImageChef.Core/Delegates.cs | 2 +- .../Devices/Dumping/CompactDisc.cs | 13 +- DiscImageChef.Core/Devices/Dumping/MMC.cs | 2 +- DiscImageChef.Core/Devices/Dumping/NVMe.cs | 17 +- .../Devices/Dumping/ResumeSupport.cs | 9 +- DiscImageChef.Core/Devices/Dumping/SBC.cs | 50 +- DiscImageChef.Core/Devices/Dumping/SSC.cs | 95 +- DiscImageChef.Core/Devices/Dumping/XGD.cs | 45 +- DiscImageChef.Core/Devices/Reader.cs | 30 +- DiscImageChef.Core/Devices/ReaderATA.cs | 181 +- DiscImageChef.Core/Devices/ReaderSCSI.cs | 71 +- DiscImageChef.Core/Devices/Report/ATA.cs | 79 +- DiscImageChef.Core/Devices/Report/ATAPI.cs | 237 +- DiscImageChef.Core/Devices/Report/FireWire.cs | 8 +- DiscImageChef.Core/Devices/Report/PCMCIA.cs | 14 +- .../Devices/Report/SCSI/General.cs | 215 +- DiscImageChef.Core/Devices/Report/SCSI/MMC.cs | 337 +-- DiscImageChef.Core/Devices/Report/SCSI/SSC.cs | 61 +- .../Devices/Report/SecureDigital.cs | 24 +- DiscImageChef.Core/Devices/Report/USB.cs | 8 +- DiscImageChef.Core/Devices/Scanning/ATA.cs | 107 +- DiscImageChef.Core/Devices/Scanning/SCSI.cs | 101 +- .../Devices/Scanning/SecureDigital.cs | 82 +- DiscImageChef.Core/ImageFormat.cs | 4 +- DiscImageChef.Core/ImageInfo.cs | 45 +- DiscImageChef.Core/Logging/IBGLog.cs | 119 +- DiscImageChef.Core/Logging/MHDDLog.cs | 71 +- DiscImageChef.Core/Options.cs | 2 +- DiscImageChef.Core/Partitions.cs | 23 +- DiscImageChef.Core/PrintScsiModePages.cs | 25 +- DiscImageChef.Core/Remote.cs | 5 +- DiscImageChef.Core/Sidecar/AudioMedia.cs | 15 +- DiscImageChef.Core/Sidecar/BlockMedia.cs | 61 +- DiscImageChef.Core/Sidecar/BlockTape.cs | 90 +- DiscImageChef.Core/Sidecar/Events.cs | 12 +- DiscImageChef.Core/Sidecar/Helpers.cs | 48 +- DiscImageChef.Core/Sidecar/LinearMedia.cs | 9 +- DiscImageChef.Core/Sidecar/OpticalDisc.cs | 39 +- DiscImageChef.Core/Sidecar/Sidecar.cs | 2 +- DiscImageChef.Core/Statistics.cs | 35 +- DiscImageChef.Decoders/ATA/Identify.cs | 227 +- DiscImageChef.Decoders/ATA/Registers.cs | 10 +- DiscImageChef.Decoders/Blu-ray/BCA.cs | 10 +- DiscImageChef.Decoders/Blu-ray/Cartridge.cs | 29 +- DiscImageChef.Decoders/Blu-ray/DDS.cs | 46 +- DiscImageChef.Decoders/Blu-ray/Spare.cs | 14 +- DiscImageChef.Decoders/CD/ATIP.cs | 45 +- DiscImageChef.Decoders/CD/CDTextOnLeadIn.cs | 26 +- DiscImageChef.Decoders/CD/FullTOC.cs | 114 +- DiscImageChef.Decoders/CD/PMA.cs | 58 +- DiscImageChef.Decoders/CD/Sector.cs | 2 +- DiscImageChef.Decoders/CD/Session.cs | 18 +- DiscImageChef.Decoders/CD/TOC.cs | 18 +- DiscImageChef.Decoders/DVD/CSS&CPRM.cs | 16 +- DiscImageChef.Decoders/DVD/Cartridge.cs | 28 +- DiscImageChef.Decoders/DVD/DDS.cs | 45 +- DiscImageChef.Decoders/DVD/Enums.cs | 22 +- DiscImageChef.Decoders/DVD/PFI.cs | 362 +-- DiscImageChef.Decoders/DVD/Spare.cs | 6 +- DiscImageChef.Decoders/Floppy/Amiga.cs | 12 +- DiscImageChef.Decoders/Floppy/Apple2.cs | 129 +- DiscImageChef.Decoders/Floppy/AppleSony.cs | 97 +- DiscImageChef.Decoders/Floppy/Commodore.cs | 3 +- DiscImageChef.Decoders/Floppy/Enums.cs | 6 +- DiscImageChef.Decoders/Floppy/ISO.cs | 18 +- .../Floppy/Perpendicular.cs | 27 +- DiscImageChef.Decoders/Floppy/System34.cs | 27 +- DiscImageChef.Decoders/Floppy/System3740.cs | 18 +- DiscImageChef.Decoders/LisaTag.cs | 12 +- DiscImageChef.Decoders/MMC/CID.cs | 24 +- DiscImageChef.Decoders/MMC/CSD.cs | 155 +- DiscImageChef.Decoders/MMC/ExtendedCSD.cs | 273 +- DiscImageChef.Decoders/MMC/OCR.cs | 34 +- DiscImageChef.Decoders/MMC/VendorString.cs | 2 +- DiscImageChef.Decoders/PCMCIA/CIS.cs | 46 +- DiscImageChef.Decoders/PCMCIA/Enums.cs | 24 +- DiscImageChef.Decoders/PCMCIA/Types.cs | 4 +- DiscImageChef.Decoders/PCMCIA/VendorCode.cs | 250 +- .../SCSI/DiscStructureCapabilities.cs | 4 +- DiscImageChef.Decoders/SCSI/EVPD.cs | 440 +-- DiscImageChef.Decoders/SCSI/Inquiry.cs | 143 +- DiscImageChef.Decoders/SCSI/MMC/AACS.cs | 44 +- DiscImageChef.Decoders/SCSI/MMC/CPRM.cs | 6 +- .../SCSI/MMC/DiscInformation.cs | 49 +- DiscImageChef.Decoders/SCSI/MMC/Enums.cs | 26 +- DiscImageChef.Decoders/SCSI/MMC/Features.cs | 639 ++--- DiscImageChef.Decoders/SCSI/MMC/Hybrid.cs | 24 +- .../SCSI/MMC/WriteProtect.cs | 24 +- DiscImageChef.Decoders/SCSI/Modes/00_SFF.cs | 2 +- DiscImageChef.Decoders/SCSI/Modes/01.cs | 44 +- DiscImageChef.Decoders/SCSI/Modes/01_MMC.cs | 33 +- DiscImageChef.Decoders/SCSI/Modes/02.cs | 34 +- DiscImageChef.Decoders/SCSI/Modes/03.cs | 36 +- DiscImageChef.Decoders/SCSI/Modes/04.cs | 22 +- DiscImageChef.Decoders/SCSI/Modes/05.cs | 66 +- DiscImageChef.Decoders/SCSI/Modes/06.cs | 6 +- DiscImageChef.Decoders/SCSI/Modes/07.cs | 10 +- DiscImageChef.Decoders/SCSI/Modes/07_MMC.cs | 29 +- DiscImageChef.Decoders/SCSI/Modes/08.cs | 38 +- DiscImageChef.Decoders/SCSI/Modes/0A.cs | 50 +- DiscImageChef.Decoders/SCSI/Modes/0B.cs | 14 +- DiscImageChef.Decoders/SCSI/Modes/0D.cs | 12 +- DiscImageChef.Decoders/SCSI/Modes/0E.cs | 34 +- DiscImageChef.Decoders/SCSI/Modes/0F.cs | 12 +- DiscImageChef.Decoders/SCSI/Modes/10.cs | 8 +- DiscImageChef.Decoders/SCSI/Modes/10_SSC.cs | 51 +- DiscImageChef.Decoders/SCSI/Modes/11.cs | 33 +- DiscImageChef.Decoders/SCSI/Modes/12_13_14.cs | 4 +- DiscImageChef.Decoders/SCSI/Modes/1A.cs | 28 +- DiscImageChef.Decoders/SCSI/Modes/1B.cs | 10 +- DiscImageChef.Decoders/SCSI/Modes/1C.cs | 40 +- DiscImageChef.Decoders/SCSI/Modes/1C_SFF.cs | 4 +- DiscImageChef.Decoders/SCSI/Modes/1D.cs | 12 +- .../SCSI/Modes/21_Certance.cs | 20 +- .../SCSI/Modes/22_Certance.cs | 26 +- DiscImageChef.Decoders/SCSI/Modes/24_IBM.cs | 10 +- DiscImageChef.Decoders/SCSI/Modes/2A.cs | 102 +- DiscImageChef.Decoders/SCSI/Modes/2F_IBM.cs | 22 +- DiscImageChef.Decoders/SCSI/Modes/3B_HP.cs | 10 +- DiscImageChef.Decoders/SCSI/Modes/3C_HP.cs | 38 +- DiscImageChef.Decoders/SCSI/Modes/3D_HP.cs | 6 +- DiscImageChef.Decoders/SCSI/Modes/3D_IBM.cs | 6 +- .../SCSI/Modes/3E_Fujitsu.cs | 10 +- DiscImageChef.Decoders/SCSI/Modes/3E_HP.cs | 6 +- DiscImageChef.Decoders/SCSI/Modes/Headers.cs | 14 +- DiscImageChef.Decoders/SCSI/Modes/Mode10.cs | 113 +- DiscImageChef.Decoders/SCSI/Modes/Mode6.cs | 64 +- DiscImageChef.Decoders/SCSI/Modes/Structs.cs | 20 +- .../SCSI/SSC/BlockLimits.cs | 2 +- .../SCSI/SSC/DensitySupport.cs | 102 +- DiscImageChef.Decoders/SCSI/Sense.cs | 97 +- DiscImageChef.Decoders/SCSI/VendorString.cs | 1596 +++++------ DiscImageChef.Decoders/SecureDigital/CID.cs | 21 +- DiscImageChef.Decoders/SecureDigital/CSD.cs | 138 +- DiscImageChef.Decoders/SecureDigital/OCR.cs | 26 +- DiscImageChef.Decoders/SecureDigital/SCR.cs | 44 +- .../SecureDigital/VendorString.cs | 2 +- DiscImageChef.Decoders/Sega/CD.cs | 66 +- DiscImageChef.Decoders/Sega/Dreamcast.cs | 44 +- DiscImageChef.Decoders/Sega/Saturn.cs | 32 +- DiscImageChef.Decoders/Xbox/DMI.cs | 35 +- DiscImageChef.Decoders/Xbox/SS.cs | 76 +- DiscImageChef.Devices/Command.cs | 112 +- .../Device/AtaCommands/Ata28.cs | 120 +- .../Device/AtaCommands/Ata48.cs | 100 +- .../Device/AtaCommands/AtaCHS.cs | 53 +- .../Device/AtaCommands/Atapi.cs | 5 +- .../Device/AtaCommands/Cfa.cs | 42 +- .../Device/AtaCommands/MCPT.cs | 11 +- .../Device/AtaCommands/Smart.cs | 78 +- DiscImageChef.Devices/Device/Commands.cs | 37 +- DiscImageChef.Devices/Device/List.cs | 4 +- .../Device/MmcCommands/MMC.cs | 76 +- .../Device/MmcCommands/SecureDigital.cs | 27 +- .../Device/ScsiCommands/Adaptec.cs | 4 +- .../Device/ScsiCommands/ArchiveCorp.cs | 6 +- .../Device/ScsiCommands/Certance.cs | 2 +- .../Device/ScsiCommands/Fujitsu.cs | 24 +- .../Device/ScsiCommands/HL-DT-ST.cs | 22 +- .../Device/ScsiCommands/HP.cs | 16 +- .../Device/ScsiCommands/Kreon.cs | 28 +- .../Device/ScsiCommands/MMC.cs | 191 +- .../Device/ScsiCommands/NEC.cs | 4 +- .../Device/ScsiCommands/Pioneer.cs | 51 +- .../Device/ScsiCommands/Plasmon.cs | 19 +- .../Device/ScsiCommands/Plextor.cs | 114 +- .../Device/ScsiCommands/SBC.cs | 143 +- .../Device/ScsiCommands/SMC.cs | 40 +- .../Device/ScsiCommands/SPC.cs | 164 +- .../Device/ScsiCommands/SSC.cs | 225 +- .../Device/ScsiCommands/SyQuest.cs | 23 +- DiscImageChef.Devices/Device/Variables.cs | 6 +- DiscImageChef.Devices/Enums.cs | 16 +- DiscImageChef.Devices/FreeBSD/Command.cs | 275 +- DiscImageChef.Devices/FreeBSD/Enums.cs | 52 +- DiscImageChef.Devices/FreeBSD/ListDevices.cs | 30 +- DiscImageChef.Devices/FreeBSD/Structs.cs | 242 +- DiscImageChef.Devices/Linux/ListDevices.cs | 17 +- DiscImageChef.Devices/Linux/Structs.cs | 49 +- DiscImageChef.Devices/Windows/Command.cs | 277 +- DiscImageChef.Devices/Windows/Enums.cs | 76 +- DiscImageChef.Devices/Windows/Extern.cs | 103 +- DiscImageChef.Devices/Windows/ListDevices.cs | 44 +- DiscImageChef.Devices/Windows/Structs.cs | 103 +- DiscImageChef.Devices/Windows/Usb.cs | 355 +-- DiscImageChef.Devices/Windows/UsbFunctions.cs | 38 +- DiscImageChef.DiscImages/Alcohol120.cs | 165 +- DiscImageChef.DiscImages/Anex86.cs | 22 +- DiscImageChef.DiscImages/Apple2MG.cs | 48 +- DiscImageChef.DiscImages/AppleDOS.cs | 11 +- DiscImageChef.DiscImages/AppleNIB.cs | 29 +- DiscImageChef.DiscImages/Apridisk.cs | 36 +- DiscImageChef.DiscImages/BLU.cs | 24 +- DiscImageChef.DiscImages/BlindWrite4.cs | 102 +- DiscImageChef.DiscImages/BlindWrite5.cs | 202 +- DiscImageChef.DiscImages/CDRDAO.cs | 181 +- DiscImageChef.DiscImages/CDRWin.cs | 171 +- DiscImageChef.DiscImages/CHD.cs | 68 +- DiscImageChef.DiscImages/CPCDSK.cs | 43 +- DiscImageChef.DiscImages/CisCopy.cs | 12 +- DiscImageChef.DiscImages/CloneCD.cs | 99 +- DiscImageChef.DiscImages/CopyQM.cs | 16 +- DiscImageChef.DiscImages/D88.cs | 16 +- DiscImageChef.DiscImages/DART.cs | 24 +- DiscImageChef.DiscImages/DIM.cs | 24 +- DiscImageChef.DiscImages/DiscFerret.cs | 14 +- DiscImageChef.DiscImages/DiscImageChef.cs | 310 ++- DiscImageChef.DiscImages/DiscJuggler.cs | 170 +- DiscImageChef.DiscImages/DiskCopy42.cs | 68 +- DiscImageChef.DiscImages/DriDiskCopy.cs | 31 +- DiscImageChef.DiscImages/GDI.cs | 58 +- DiscImageChef.DiscImages/HDCopy.cs | 36 +- DiscImageChef.DiscImages/IMD.cs | 34 +- DiscImageChef.DiscImages/IMediaImage.cs | 4 +- DiscImageChef.DiscImages/KryoFlux.cs | 20 +- DiscImageChef.DiscImages/MaxiDisk.cs | 23 +- DiscImageChef.DiscImages/NDIF.cs | 31 +- DiscImageChef.DiscImages/NHDr0.cs | 24 +- DiscImageChef.DiscImages/Nero.cs | 135 +- DiscImageChef.DiscImages/Parallels.cs | 36 +- DiscImageChef.DiscImages/PartClone.cs | 22 +- DiscImageChef.DiscImages/Partimage.cs | 36 +- DiscImageChef.DiscImages/QCOW.cs | 56 +- DiscImageChef.DiscImages/QCOW2.cs | 66 +- DiscImageChef.DiscImages/QED.cs | 44 +- DiscImageChef.DiscImages/RayDIM.cs | 30 +- DiscImageChef.DiscImages/RsIde.cs | 19 +- DiscImageChef.DiscImages/SaveDskF.cs | 32 +- DiscImageChef.DiscImages/SuperCardPro.cs | 28 +- DiscImageChef.DiscImages/T98.cs | 14 +- DiscImageChef.DiscImages/TeleDisk.cs | 82 +- DiscImageChef.DiscImages/UDIF.cs | 50 +- DiscImageChef.DiscImages/UkvFdi.cs | 24 +- DiscImageChef.DiscImages/VDI.cs | 54 +- DiscImageChef.DiscImages/VHD.cs | 54 +- DiscImageChef.DiscImages/VHDX.cs | 48 +- DiscImageChef.DiscImages/VMware.cs | 50 +- DiscImageChef.DiscImages/Virtual98.cs | 16 +- DiscImageChef.DiscImages/ZZZRawImage.cs | 70 +- DiscImageChef.Filesystems/AODOS.cs | 46 +- DiscImageChef.Filesystems/APFS.cs | 26 +- DiscImageChef.Filesystems/Acorn.cs | 274 +- DiscImageChef.Filesystems/AmigaDOS.cs | 44 +- .../AppleDOS/AppleDOS.cs | 2 +- DiscImageChef.Filesystems/AppleDOS/Dir.cs | 12 +- DiscImageChef.Filesystems/AppleDOS/File.cs | 29 +- DiscImageChef.Filesystems/AppleDOS/Info.cs | 14 +- DiscImageChef.Filesystems/AppleDOS/Structs.cs | 39 +- DiscImageChef.Filesystems/AppleDOS/Super.cs | 4 +- DiscImageChef.Filesystems/AppleDOS/Xattr.cs | 6 +- DiscImageChef.Filesystems/AppleHFS.cs | 73 +- DiscImageChef.Filesystems/AppleHFSPlus.cs | 38 +- .../AppleMFS/AppleMFS.cs | 2 +- DiscImageChef.Filesystems/AppleMFS/Consts.cs | 8 +- DiscImageChef.Filesystems/AppleMFS/Dir.cs | 34 +- DiscImageChef.Filesystems/AppleMFS/File.cs | 76 +- DiscImageChef.Filesystems/AppleMFS/Info.cs | 66 +- DiscImageChef.Filesystems/AppleMFS/Structs.cs | 36 +- DiscImageChef.Filesystems/AppleMFS/Super.cs | 77 +- DiscImageChef.Filesystems/AppleMFS/Xattr.cs | 19 +- DiscImageChef.Filesystems/AtheOS.cs | 57 +- DiscImageChef.Filesystems/BFS.cs | 53 +- DiscImageChef.Filesystems/BTRFS.cs | 185 +- DiscImageChef.Filesystems/CBM.cs | 59 +- DiscImageChef.Filesystems/CPM/CPM.cs | 6 +- DiscImageChef.Filesystems/CPM/Dir.cs | 24 +- DiscImageChef.Filesystems/CPM/File.cs | 4 +- DiscImageChef.Filesystems/CPM/Info.cs | 448 ++-- DiscImageChef.Filesystems/CPM/Structs.cs | 93 +- DiscImageChef.Filesystems/CPM/Super.cs | 52 +- DiscImageChef.Filesystems/CPM/Xattr.cs | 3 +- DiscImageChef.Filesystems/Cram.cs | 40 +- DiscImageChef.Filesystems/ECMA67.cs | 46 +- DiscImageChef.Filesystems/EFS.cs | 39 +- DiscImageChef.Filesystems/F2FS.cs | 127 +- DiscImageChef.Filesystems/FATX.cs | 12 +- DiscImageChef.Filesystems/FFS.cs | 210 +- DiscImageChef.Filesystems/Fossil.cs | 30 +- DiscImageChef.Filesystems/HAMMER.cs | 48 +- DiscImageChef.Filesystems/HPFS.cs | 89 +- DiscImageChef.Filesystems/IFilesystem.cs | 1 - .../ISO9660/Consts/AAIP.cs | 2 +- .../ISO9660/Consts/Amiga.cs | 30 +- .../ISO9660/Consts/Apple.cs | 14 +- .../ISO9660/Consts/CDi.cs | 8 +- .../ISO9660/Consts/ElTorito.cs | 28 +- .../ISO9660/Consts/ISO.cs | 34 +- .../ISO9660/Consts/RRIP.cs | 80 +- .../ISO9660/Consts/SUSP.cs | 12 +- .../ISO9660/Consts/XA.cs | 20 +- .../ISO9660/Consts/Ziso.cs | 8 +- DiscImageChef.Filesystems/ISO9660/ISO9660.cs | 6 +- DiscImageChef.Filesystems/ISO9660/Info.cs | 83 +- .../ISO9660/Structs/Amiga.cs | 12 +- .../ISO9660/Structs/Apple.cs | 47 +- .../ISO9660/Structs/CDi.cs | 120 +- .../ISO9660/Structs/Common.cs | 22 +- .../ISO9660/Structs/ElTorito.cs | 59 +- .../ISO9660/Structs/HighSierra.cs | 123 +- .../ISO9660/Structs/ISO.cs | 182 +- .../ISO9660/Structs/Joliet.cs | 10 +- .../ISO9660/Structs/RRIP.cs | 88 +- .../ISO9660/Structs/SUSP.cs | 48 +- .../ISO9660/Structs/XA.cs | 11 +- .../ISO9660/Structs/Ziso.cs | 20 +- DiscImageChef.Filesystems/JFS.cs | 139 +- DiscImageChef.Filesystems/LIF.cs | 44 +- DiscImageChef.Filesystems/LisaFS/Consts.cs | 2 +- DiscImageChef.Filesystems/LisaFS/Dir.cs | 95 +- DiscImageChef.Filesystems/LisaFS/Extent.cs | 116 +- DiscImageChef.Filesystems/LisaFS/File.cs | 92 +- DiscImageChef.Filesystems/LisaFS/Info.cs | 212 +- DiscImageChef.Filesystems/LisaFS/LisaFS.cs | 2 +- DiscImageChef.Filesystems/LisaFS/Structs.cs | 2 +- DiscImageChef.Filesystems/LisaFS/Super.cs | 23 +- DiscImageChef.Filesystems/Locus.cs | 183 +- DiscImageChef.Filesystems/MicroDOS.cs | 47 +- DiscImageChef.Filesystems/MinixFS.cs | 75 +- DiscImageChef.Filesystems/NILFS2.cs | 111 +- DiscImageChef.Filesystems/NTFS.cs | 10 +- DiscImageChef.Filesystems/Nintendo.cs | 185 +- DiscImageChef.Filesystems/ODS.cs | 56 +- DiscImageChef.Filesystems/Opera.cs | 49 +- DiscImageChef.Filesystems/PCEngine.cs | 16 +- DiscImageChef.Filesystems/PCFX.cs | 26 +- DiscImageChef.Filesystems/PFS.cs | 23 +- DiscImageChef.Filesystems/ProDOS.cs | 28 +- DiscImageChef.Filesystems/QNX4.cs | 74 +- DiscImageChef.Filesystems/QNX6.cs | 137 +- DiscImageChef.Filesystems/RBF.cs | 6 +- DiscImageChef.Filesystems/RT11.cs | 58 +- DiscImageChef.Filesystems/ReFS.cs | 8 +- DiscImageChef.Filesystems/Reiser.cs | 61 +- DiscImageChef.Filesystems/Reiser4.cs | 29 +- DiscImageChef.Filesystems/SFS.cs | 56 +- DiscImageChef.Filesystems/SolarFS.cs | 71 +- DiscImageChef.Filesystems/Squash.cs | 60 +- DiscImageChef.Filesystems/Structs.cs | 4 +- DiscImageChef.Filesystems/Symbian.cs | 5 +- DiscImageChef.Filesystems/SysV.cs | 334 +-- DiscImageChef.Filesystems/UCSDPascal/File.cs | 13 +- DiscImageChef.Filesystems/UCSDPascal/Info.cs | 16 +- DiscImageChef.Filesystems/UCSDPascal/Super.cs | 30 +- .../UCSDPascal/UCSDPascal.cs | 2 +- DiscImageChef.Filesystems/UDF.cs | 215 +- DiscImageChef.Filesystems/UNICOS.cs | 83 +- DiscImageChef.Filesystems/UNIXBFS.cs | 42 +- DiscImageChef.Filesystems/VMfs.cs | 55 +- DiscImageChef.Filesystems/VxFS.cs | 46 +- DiscImageChef.Filesystems/XFS.cs | 129 +- DiscImageChef.Filesystems/Xia.cs | 61 +- DiscImageChef.Filesystems/ZFS.cs | 177 +- DiscImageChef.Filesystems/dump.cs | 131 +- DiscImageChef.Filesystems/exFAT.cs | 86 +- DiscImageChef.Filesystems/ext2FS.cs | 129 +- DiscImageChef.Filesystems/extFS.cs | 51 +- DiscImageChef.Filters/AppleDouble.cs | 94 +- DiscImageChef.Filters/AppleSingle.cs | 116 +- DiscImageChef.Filters/BZip2.cs | 52 +- DiscImageChef.Filters/Filters.cs | 2 +- DiscImageChef.Filters/ForcedSeekStream.cs | 24 +- DiscImageChef.Filters/GZip.cs | 44 +- DiscImageChef.Filters/LZip.cs | 36 +- DiscImageChef.Filters/MacBinary.cs | 102 +- DiscImageChef.Filters/OffsetStream.cs | 58 +- DiscImageChef.Filters/PCExchange.cs | 61 +- DiscImageChef.Filters/XZ.cs | 140 +- DiscImageChef.Filters/ZZZNoFilter.cs | 34 +- .../BigEndianBitConverter.cs | 27 +- DiscImageChef.Helpers/CHS.cs | 2 +- DiscImageChef.Helpers/CompareBytes.cs | 8 +- DiscImageChef.Helpers/CountBits.cs | 2 +- DiscImageChef.Helpers/DateHandlers.cs | 53 +- DiscImageChef.Helpers/Extents/ExtentsByte.cs | 4 +- DiscImageChef.Helpers/Extents/ExtentsInt.cs | 4 +- DiscImageChef.Helpers/Extents/ExtentsLong.cs | 4 +- DiscImageChef.Helpers/Extents/ExtentsSByte.cs | 4 +- DiscImageChef.Helpers/Extents/ExtentsShort.cs | 4 +- DiscImageChef.Helpers/Extents/ExtentsUInt.cs | 4 +- DiscImageChef.Helpers/Extents/ExtentsULong.cs | 4 +- .../Extents/ExtentsUShort.cs | 4 +- DiscImageChef.Helpers/PrintHex.cs | 4 +- DiscImageChef.Helpers/StringHandlers.cs | 12 +- DiscImageChef.Helpers/Swapping.cs | 2 +- DiscImageChef.Interop/DetectOS.cs | 4 +- DiscImageChef.Metadata/DeviceReport.cs | 928 +++---- DiscImageChef.Metadata/Dimensions.cs | 621 ++--- DiscImageChef.Metadata/ExtentsConverter.cs | 2 +- DiscImageChef.Metadata/MediaType.cs | 870 +++--- DiscImageChef.Metadata/Resume.cs | 8 +- DiscImageChef.Metadata/Statistics.cs | 36 +- DiscImageChef.Partitions/Acorn.cs | 97 +- DiscImageChef.Partitions/AppleMap.cs | 111 +- DiscImageChef.Partitions/Apricot.cs | 165 +- DiscImageChef.Partitions/Atari.cs | 20 +- DiscImageChef.Partitions/DEC.cs | 20 +- DiscImageChef.Partitions/DragonFlyBSD.cs | 53 +- DiscImageChef.Partitions/GPT.cs | 116 +- DiscImageChef.Partitions/MBR.cs | 268 +- DiscImageChef.Partitions/NeXT.cs | 89 +- DiscImageChef.Partitions/PC98.cs | 82 +- DiscImageChef.Partitions/Plan9.cs | 14 +- DiscImageChef.Partitions/RDB.cs | 42 +- DiscImageChef.Partitions/RioKarma.cs | 16 +- DiscImageChef.Partitions/UNIX.cs | 1598 +++++------ DiscImageChef.Partitions/VTOC.cs | 369 +-- DiscImageChef.Partitions/XENIX.cs | 25 +- DiscImageChef.Partitions/Xbox.cs | 167 +- DiscImageChef.Server/App_Start/Ata.cs | 379 ++- DiscImageChef.Server/App_Start/ScsiEvpd.cs | 30 +- DiscImageChef.Server/App_Start/ScsiInquiry.cs | 32 +- .../App_Start/ScsiMmcFeatures.cs | 8 +- DiscImageChef.Server/App_Start/ScsiMmcMode.cs | 7 +- .../App_Start/ScsiModeSense.cs | 20 +- DiscImageChef.Server/App_Start/TestedMedia.cs | 51 +- DiscImageChef.Server/Changelog.aspx | 16 +- .../Controllers/UploadReportController.cs | 8 +- .../Controllers/UploadStatsController.cs | 187 +- DiscImageChef.Server/DONATING.aspx | 16 +- DiscImageChef.Server/Default.aspx | 22 +- DiscImageChef.Server/Statistics.aspx | 281 +- DiscImageChef.Server/Statistics.aspx.cs | 8 +- DiscImageChef.Server/TODO.aspx | 16 +- DiscImageChef.Server/ViewReport.aspx | 339 ++- DiscImageChef.Server/ViewReport.aspx.cs | 115 +- DiscImageChef.Tests.Devices/ATA/Ata48.cs | 91 +- DiscImageChef.Tests.Devices/ATA/Atapi.cs | 6 +- DiscImageChef.Tests.Devices/ATA/Cfa.cs | 36 +- DiscImageChef.Tests.Devices/ATA/MCPT.cs | 6 +- DiscImageChef.Tests.Devices/ATA/Smart.cs | 32 +- .../DecodeATARegisters.cs | 21 +- DiscImageChef.Tests.Devices/Device.cs | 50 +- DiscImageChef.Tests.Devices/Main.cs | 8 +- DiscImageChef.Tests.Devices/SCSI/Adaptec.cs | 56 +- .../SCSI/ArchiveCorp.cs | 28 +- DiscImageChef.Tests.Devices/SCSI/Certance.cs | 12 +- DiscImageChef.Tests.Devices/SCSI/Fujitsu.cs | 18 +- DiscImageChef.Tests.Devices/SCSI/HL-DT-ST.cs | 18 +- DiscImageChef.Tests.Devices/SCSI/HP.cs | 28 +- DiscImageChef.Tests.Devices/SCSI/Kreon.cs | 34 +- DiscImageChef.Tests.Devices/SCSI/MMC.cs | 253 +- DiscImageChef.Tests.Devices/SCSI/NEC.cs | 18 +- DiscImageChef.Tests.Devices/SCSI/Pioneer.cs | 90 +- DiscImageChef.Tests.Devices/SCSI/Plasmon.cs | 44 +- DiscImageChef.Tests.Devices/SCSI/Plextor.cs | 180 +- DiscImageChef.Tests.Devices/SCSI/SBC.cs | 231 +- DiscImageChef.Tests.Devices/SCSI/SMC.cs | 40 +- DiscImageChef.Tests.Devices/SCSI/SPC.cs | 150 +- DiscImageChef.Tests.Devices/SCSI/SSC.cs | 291 +- DiscImageChef.Tests.Devices/SCSI/SyQuest.cs | 89 +- .../SecureDigital/MultiMediaCard.cs | 80 +- .../SecureDigital/SecureDigital.cs | 80 +- DiscImageChef.Tests/Checksums/Adler32.cs | 24 +- DiscImageChef.Tests/Checksums/CRC16.cs | 24 +- DiscImageChef.Tests/Checksums/CRC32.cs | 24 +- DiscImageChef.Tests/Checksums/CRC64.cs | 24 +- DiscImageChef.Tests/Checksums/MD5.cs | 24 +- DiscImageChef.Tests/Checksums/RIPEMD160.cs | 24 +- DiscImageChef.Tests/Checksums/SHA1.cs | 24 +- DiscImageChef.Tests/Checksums/SHA256.cs | 24 +- DiscImageChef.Tests/Checksums/SHA384.cs | 24 +- DiscImageChef.Tests/Checksums/SHA512.cs | 24 +- DiscImageChef.Tests/Checksums/SpamSum.cs | 24 +- DiscImageChef.Tests/Devices/IomegaJaz.cs | 10 +- DiscImageChef.Tests/Devices/LS120.cs | 10 +- DiscImageChef.Tests/Devices/PocketZip.cs | 10 +- DiscImageChef.Tests/Filesystems/ADFS.cs | 26 +- DiscImageChef.Tests/Filesystems/AFFS.cs | 82 +- DiscImageChef.Tests/Filesystems/AFFS2.cs | 20 +- DiscImageChef.Tests/Filesystems/AFS.cs | 42 +- DiscImageChef.Tests/Filesystems/AOFS.cs | 82 +- DiscImageChef.Tests/Filesystems/Atheos.cs | 22 +- DiscImageChef.Tests/Filesystems/BeFS.cs | 90 +- DiscImageChef.Tests/Filesystems/COHERENT.cs | 42 +- DiscImageChef.Tests/Filesystems/DTFS.cs | 42 +- DiscImageChef.Tests/Filesystems/EAFS.cs | 42 +- DiscImageChef.Tests/Filesystems/F2FS.cs | 22 +- DiscImageChef.Tests/Filesystems/FAT12.cs | 8 +- DiscImageChef.Tests/Filesystems/FAT32.cs | 4 +- DiscImageChef.Tests/Filesystems/HAMMER.cs | 20 +- DiscImageChef.Tests/Filesystems/HFS.cs | 12 +- DiscImageChef.Tests/Filesystems/HFSPlus.cs | 72 +- DiscImageChef.Tests/Filesystems/HFSX.cs | 72 +- DiscImageChef.Tests/Filesystems/HPOFS.cs | 4 +- DiscImageChef.Tests/Filesystems/HTFS.cs | 42 +- DiscImageChef.Tests/Filesystems/ISO9660.cs | 28 +- DiscImageChef.Tests/Filesystems/JFS2.cs | 2 +- DiscImageChef.Tests/Filesystems/LFS.cs | 1 + DiscImageChef.Tests/Filesystems/LisaFS.cs | 26 +- DiscImageChef.Tests/Filesystems/Locus.cs | 26 +- DiscImageChef.Tests/Filesystems/MFS.cs | 22 +- DiscImageChef.Tests/Filesystems/MINIX.cs | 102 +- DiscImageChef.Tests/Filesystems/NILFS2.cs | 22 +- DiscImageChef.Tests/Filesystems/NTFS.cs | 48 +- DiscImageChef.Tests/Filesystems/NWFS386.cs | 1 + DiscImageChef.Tests/Filesystems/OCFS2.cs | 1 + DiscImageChef.Tests/Filesystems/PFS3.cs | 24 +- DiscImageChef.Tests/Filesystems/ProDOS.cs | 20 +- DiscImageChef.Tests/Filesystems/QNX4.cs | 38 +- DiscImageChef.Tests/Filesystems/ReFS.cs | 2 +- DiscImageChef.Tests/Filesystems/Reiser3.cs | 18 +- DiscImageChef.Tests/Filesystems/Reiser4.cs | 22 +- DiscImageChef.Tests/Filesystems/SFS.cs | 66 +- DiscImageChef.Tests/Filesystems/SysV.cs | 62 +- DiscImageChef.Tests/Filesystems/UDF.cs | 8 +- DiscImageChef.Tests/Filesystems/UFS.cs | 148 +- DiscImageChef.Tests/Filesystems/UNIXBFS.cs | 58 +- DiscImageChef.Tests/Filesystems/XENIX.cs | 42 +- DiscImageChef.Tests/Filesystems/XFS.cs | 22 +- DiscImageChef.Tests/Filesystems/Xia.cs | 22 +- DiscImageChef.Tests/Filesystems/ZFS.cs | 22 +- DiscImageChef.Tests/Filesystems/btrfs.cs | 22 +- DiscImageChef.Tests/Filesystems/exFAT.cs | 60 +- DiscImageChef.Tests/Filesystems/ext2.cs | 20 +- .../Filters/AppleDoubleDave.cs | 4 +- .../Filters/AppleDoubleNetatalk.cs | 4 +- .../Filters/AppleDoubleProDos.cs | 6 +- DiscImageChef.Tests/Images/2MG.cs | 2 +- DiscImageChef.Tests/Images/Anex86.cs | 2 +- DiscImageChef.Tests/Images/CisCopy.cs | 2 +- DiscImageChef.Tests/Images/CopyQM.cs | 2 +- DiscImageChef.Tests/Images/D88.cs | 2 +- DiscImageChef.Tests/Images/DART.cs | 2 +- DiscImageChef.Tests/Images/DiskCopy42.cs | 2 +- DiscImageChef.Tests/Partitions/Acorn.cs | 72 +- DiscImageChef.Tests/Partitions/AppleMap.cs | 2368 ++++++++--------- DiscImageChef.Tests/Partitions/Atari.cs | 338 +-- DiscImageChef.Tests/Partitions/BSD.cs | 422 +-- DiscImageChef.Tests/Partitions/GPT.cs | 142 +- DiscImageChef.Tests/Partitions/MBR.cs | 1944 +++++++------- DiscImageChef.Tests/Partitions/MINIX.cs | 68 +- DiscImageChef.Tests/Partitions/PC98.cs | 352 +-- DiscImageChef.Tests/Partitions/RDB.cs | 226 +- DiscImageChef.Tests/Partitions/SGI.cs | 194 +- DiscImageChef.Tests/Partitions/Sun.cs | 114 +- DiscImageChef.Tests/Partitions/VTOC.cs | 174 +- DiscImageChef.Tests/Program.cs | 4 +- DiscImageChef/Commands/Analyze.cs | 26 +- DiscImageChef/Commands/Benchmark.cs | 4 +- DiscImageChef/Commands/Checksum.cs | 60 +- DiscImageChef/Commands/Compare.cs | 31 +- DiscImageChef/Commands/Configure.cs | 26 +- DiscImageChef/Commands/ConvertImage.cs | 45 +- DiscImageChef/Commands/CreateSidecar.cs | 9 +- DiscImageChef/Commands/Decode.cs | 61 +- DiscImageChef/Commands/DeviceInfo.cs | 12 +- DiscImageChef/Commands/DeviceReport.cs | 23 +- DiscImageChef/Commands/DumpMedia.cs | 19 +- DiscImageChef/Commands/Entropy.cs | 8 +- DiscImageChef/Commands/ExtractFiles.cs | 25 +- DiscImageChef/Commands/ListDevices.cs | 2 +- DiscImageChef/Commands/ListEncodings.cs | 19 +- DiscImageChef/Commands/ListOptions.cs | 4 +- DiscImageChef/Commands/Ls.cs | 18 +- DiscImageChef/Commands/MediaInfo.cs | 18 +- DiscImageChef/Commands/MediaScan.cs | 27 +- DiscImageChef/Commands/PrintHex.cs | 20 +- DiscImageChef/Commands/Verify.cs | 84 +- DiscImageChef/Main.cs | 4 +- DiscImageChef/Options.cs | 6 +- DiscImageChef/Progress.cs | 2 +- 581 files changed, 22423 insertions(+), 20839 deletions(-) diff --git a/DiscImageChef.Checksums/Adler32Context.cs b/DiscImageChef.Checksums/Adler32Context.cs index 1723bcd4e..0e58f602c 100644 --- a/DiscImageChef.Checksums/Adler32Context.cs +++ b/DiscImageChef.Checksums/Adler32Context.cs @@ -81,7 +81,7 @@ namespace DiscImageChef.Checksums /// public byte[] Final() { - uint finalSum = (uint)((sum2 << 16) | sum1); + uint finalSum = (uint)((sum2 << 16) | sum1); BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian; return BigEndianBitConverter.GetBytes(finalSum); } diff --git a/DiscImageChef.Checksums/CRC16Context.cs b/DiscImageChef.Checksums/CRC16Context.cs index 228089c72..858e03eb9 100644 --- a/DiscImageChef.Checksums/CRC16Context.cs +++ b/DiscImageChef.Checksums/CRC16Context.cs @@ -62,7 +62,7 @@ namespace DiscImageChef.Checksums for(int i = 0; i < 256; i++) { ushort entry = (ushort)i; - for(int j = 0; j < 8; j++) + for(int j = 0; j < 8; j++) if((entry & 1) == 1) entry = (ushort)((entry >> 1) ^ CRC16_IBM_POLY); else @@ -84,7 +84,7 @@ namespace DiscImageChef.Checksums for(int i = 0; i < 256; i++) { ushort entry = (ushort)i; - for(int j = 0; j < 8; j++) + for(int j = 0; j < 8; j++) if((entry & 1) == 1) entry = (ushort)((entry >> 1) ^ polynomial); else @@ -130,7 +130,7 @@ namespace DiscImageChef.Checksums StringBuilder crc16Output = new StringBuilder(); BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian; - for(int i = 0; i < BigEndianBitConverter.GetBytes((ushort)(hashInt ^ finalSeed)).Length; i++) + for(int i = 0; i < BigEndianBitConverter.GetBytes((ushort)(hashInt ^ finalSeed)).Length; i++) crc16Output.Append(BigEndianBitConverter.GetBytes((ushort)(hashInt ^ finalSeed))[i].ToString("x2")); return crc16Output.ToString(); @@ -171,7 +171,7 @@ namespace DiscImageChef.Checksums for(int i = 0; i < 256; i++) { ushort entry = (ushort)i; - for(int j = 0; j < 8; j++) + for(int j = 0; j < 8; j++) if((entry & 1) == 1) entry = (ushort)((entry >> 1) ^ polynomial); else @@ -224,7 +224,7 @@ namespace DiscImageChef.Checksums for(int i = 0; i < 256; i++) { ushort entry = (ushort)i; - for(int j = 0; j < 8; j++) + for(int j = 0; j < 8; j++) if((entry & 1) == 1) entry = (ushort)((entry >> 1) ^ polynomial); else diff --git a/DiscImageChef.Checksums/CRC32Context.cs b/DiscImageChef.Checksums/CRC32Context.cs index 62458157d..8bf6157f3 100644 --- a/DiscImageChef.Checksums/CRC32Context.cs +++ b/DiscImageChef.Checksums/CRC32Context.cs @@ -62,7 +62,7 @@ namespace DiscImageChef.Checksums for(int i = 0; i < 256; i++) { uint entry = (uint)i; - for(int j = 0; j < 8; j++) + for(int j = 0; j < 8; j++) if((entry & 1) == 1) entry = (entry >> 1) ^ CRC32_ISO_POLY; else @@ -84,7 +84,7 @@ namespace DiscImageChef.Checksums for(int i = 0; i < 256; i++) { uint entry = (uint)i; - for(int j = 0; j < 8; j++) + for(int j = 0; j < 8; j++) if((entry & 1) == 1) entry = (entry >> 1) ^ polynomial; else @@ -130,7 +130,7 @@ namespace DiscImageChef.Checksums StringBuilder crc32Output = new StringBuilder(); BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian; - for(int i = 0; i < BigEndianBitConverter.GetBytes(hashInt ^ finalSeed).Length; i++) + for(int i = 0; i < BigEndianBitConverter.GetBytes(hashInt ^ finalSeed).Length; i++) crc32Output.Append(BigEndianBitConverter.GetBytes(hashInt ^ finalSeed)[i].ToString("x2")); return crc32Output.ToString(); @@ -171,7 +171,7 @@ namespace DiscImageChef.Checksums for(int i = 0; i < 256; i++) { uint entry = (uint)i; - for(int j = 0; j < 8; j++) + for(int j = 0; j < 8; j++) if((entry & 1) == 1) entry = (entry >> 1) ^ polynomial; else @@ -223,7 +223,7 @@ namespace DiscImageChef.Checksums for(int i = 0; i < 256; i++) { uint entry = (uint)i; - for(int j = 0; j < 8; j++) + for(int j = 0; j < 8; j++) if((entry & 1) == 1) entry = (entry >> 1) ^ polynomial; else diff --git a/DiscImageChef.Checksums/CRC64Context.cs b/DiscImageChef.Checksums/CRC64Context.cs index 0ec97e9b9..15b73a5f5 100644 --- a/DiscImageChef.Checksums/CRC64Context.cs +++ b/DiscImageChef.Checksums/CRC64Context.cs @@ -44,7 +44,7 @@ namespace DiscImageChef.Checksums public const ulong CRC64_ECMA_POLY = 0xC96C5795D7870F42; public const ulong CRC64_ECMA_SEED = 0xFFFFFFFFFFFFFFFF; - readonly ulong finalSeed; + readonly ulong finalSeed; readonly ulong[] table; ulong hashInt; @@ -59,7 +59,7 @@ namespace DiscImageChef.Checksums for(int i = 0; i < 256; i++) { ulong entry = (ulong)i; - for(int j = 0; j < 8; j++) + for(int j = 0; j < 8; j++) if((entry & 1) == 1) entry = (entry >> 1) ^ CRC64_ECMA_POLY; else @@ -82,7 +82,7 @@ namespace DiscImageChef.Checksums for(int i = 0; i < 256; i++) { ulong entry = (ulong)i; - for(int j = 0; j < 8; j++) + for(int j = 0; j < 8; j++) if((entry & 1) == 1) entry = (entry >> 1) ^ polynomial; else @@ -171,7 +171,7 @@ namespace DiscImageChef.Checksums for(int i = 0; i < 256; i++) { ulong entry = (ulong)i; - for(int j = 0; j < 8; j++) + for(int j = 0; j < 8; j++) if((entry & 1) == 1) entry = (entry >> 1) ^ polynomial; else @@ -223,7 +223,7 @@ namespace DiscImageChef.Checksums for(int i = 0; i < 256; i++) { ulong entry = (ulong)i; - for(int j = 0; j < 8; j++) + for(int j = 0; j < 8; j++) if((entry & 1) == 1) entry = (entry >> 1) ^ polynomial; else diff --git a/DiscImageChef.Checksums/FletcherContext.cs b/DiscImageChef.Checksums/FletcherContext.cs index 21ceaba92..d89477829 100644 --- a/DiscImageChef.Checksums/FletcherContext.cs +++ b/DiscImageChef.Checksums/FletcherContext.cs @@ -83,7 +83,7 @@ namespace DiscImageChef.Checksums /// public byte[] Final() { - uint finalSum = (uint)((sum2 << 16) | sum1); + uint finalSum = (uint)((sum2 << 16) | sum1); BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian; return BigEndianBitConverter.GetBytes(finalSum); } @@ -230,7 +230,7 @@ namespace DiscImageChef.Checksums /// public byte[] Final() { - ushort finalSum = (ushort)((sum2 << 8) | sum1); + ushort finalSum = (ushort)((sum2 << 8) | sum1); BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian; return BigEndianBitConverter.GetBytes(finalSum); } diff --git a/DiscImageChef.Checksums/MD5Context.cs b/DiscImageChef.Checksums/MD5Context.cs index 0ef155507..ca48fa3d7 100644 --- a/DiscImageChef.Checksums/MD5Context.cs +++ b/DiscImageChef.Checksums/MD5Context.cs @@ -114,8 +114,8 @@ namespace DiscImageChef.Checksums { MD5 localMd5Provider = MD5.Create(); FileStream fileStream = new FileStream(filename, FileMode.Open); - hash = localMd5Provider.ComputeHash(fileStream); - StringBuilder md5Output = new StringBuilder(); + hash = localMd5Provider.ComputeHash(fileStream); + StringBuilder md5Output = new StringBuilder(); foreach(byte h in hash) md5Output.Append(h.ToString("x2")); @@ -132,8 +132,8 @@ namespace DiscImageChef.Checksums /// Byte array of the hash value. public static string Data(byte[] data, uint len, out byte[] hash) { - MD5 localMd5Provider = MD5.Create(); - hash = localMd5Provider.ComputeHash(data, 0, (int)len); + MD5 localMd5Provider = MD5.Create(); + hash = localMd5Provider.ComputeHash(data, 0, (int)len); StringBuilder md5Output = new StringBuilder(); foreach(byte h in hash) md5Output.Append(h.ToString("x2")); diff --git a/DiscImageChef.Checksums/RIPEMD160Context.cs b/DiscImageChef.Checksums/RIPEMD160Context.cs index 0c4004610..55d668228 100644 --- a/DiscImageChef.Checksums/RIPEMD160Context.cs +++ b/DiscImageChef.Checksums/RIPEMD160Context.cs @@ -114,8 +114,8 @@ namespace DiscImageChef.Checksums { RIPEMD160 localRipemd160Provider = RIPEMD160.Create(); FileStream fileStream = new FileStream(filename, FileMode.Open); - hash = localRipemd160Provider.ComputeHash(fileStream); - StringBuilder ripemd160Output = new StringBuilder(); + hash = localRipemd160Provider.ComputeHash(fileStream); + StringBuilder ripemd160Output = new StringBuilder(); foreach(byte h in hash) ripemd160Output.Append(h.ToString("x2")); @@ -133,8 +133,8 @@ namespace DiscImageChef.Checksums public static string Data(byte[] data, uint len, out byte[] hash) { RIPEMD160 localRipemd160Provider = RIPEMD160.Create(); - hash = localRipemd160Provider.ComputeHash(data, 0, (int)len); - StringBuilder ripemd160Output = new StringBuilder(); + hash = localRipemd160Provider.ComputeHash(data, 0, (int)len); + StringBuilder ripemd160Output = new StringBuilder(); foreach(byte h in hash) ripemd160Output.Append(h.ToString("x2")); diff --git a/DiscImageChef.Checksums/ReedSolomon.cs b/DiscImageChef.Checksums/ReedSolomon.cs index ca53d866d..b4ce0a2f6 100644 --- a/DiscImageChef.Checksums/ReedSolomon.cs +++ b/DiscImageChef.Checksums/ReedSolomon.cs @@ -88,7 +88,7 @@ namespace DiscImageChef.Checksums /// int[] index_of; bool initialized; - int mm, kk, nn; + int mm, kk, nn; /// /// Primitive polynomials - see Lin & Costello, Error Control Coding Appendix A, and Lee & Messerschmitt, Digital /// Communication p. 453. @@ -150,10 +150,10 @@ namespace DiscImageChef.Checksums default: throw new ArgumentOutOfRangeException(nameof(m), "m must be between 2 and 16 inclusive"); } - mm = m; - kk = k; - nn = n; - a0 = n; + mm = m; + kk = k; + nn = n; + a0 = n; alpha_to = new int[n + 1]; index_of = new int[n + 1]; @@ -170,7 +170,7 @@ namespace DiscImageChef.Checksums while(x >= nn) { x -= nn; - x = (x >> mm) + (x & nn); + x = (x >> mm) + (x & nn); } return x; @@ -237,11 +237,11 @@ namespace DiscImageChef.Checksums alpha_to[mm] = 0; for(i = 0; i < mm; i++) { - alpha_to[i] = mask; + 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 */ - mask <<= 1; /* single left-shift */ + mask <<= 1; /* single left-shift */ } index_of[alpha_to[mm]] = mm; @@ -254,11 +254,11 @@ namespace DiscImageChef.Checksums 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; + else alpha_to[i] = alpha_to[i - 1] << 1; index_of[alpha_to[i]] = i; } - index_of[0] = a0; + index_of[0] = a0; alpha_to[nn] = 0; } @@ -289,11 +289,14 @@ namespace DiscImageChef.Checksums * (@**(B0+i-1) + x) */ for(int 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]]; } @@ -322,15 +325,19 @@ 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 */ int feedback = index_of[data[i] ^ bb[nn - kk - 1]]; if(feedback != a0) { /* feedback term is non-zero */ for(int 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)]; } @@ -372,26 +379,29 @@ namespace DiscImageChef.Checksums if(!initialized) throw new UnauthorizedAccessException("Trying to calculate RS without initializing!"); erasPos = new int[nn - kk]; - int i, j; - int q, tmp; - int[] recd = new int[nn]; + int i, j; + int q, tmp; + int[] recd = new int[nn]; int[] lambda = new int[nn - kk + 1]; /* Err+Eras Locator poly */ - int[] s = new int[nn - kk + 1]; /* syndrome poly */ - int[] b = new int[nn - kk + 1]; - int[] t = new int[nn - kk + 1]; - int[] omega = new int[nn - kk + 1]; - int[] root = new int[nn - kk]; - int[] reg = new int[nn - kk + 1]; - int[] loc = new int[nn - kk]; - int count; + int[] s = new int[nn - kk + 1]; /* syndrome poly */ + int[] b = new int[nn - kk + 1]; + int[] t = new int[nn - kk + 1]; + int[] omega = new int[nn - kk + 1]; + int[] root = new int[nn - kk]; + int[] reg = new int[nn - kk + 1]; + int[] loc = new int[nn - kk]; + int count; /* 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) * namely @**(B0+i), i = 0, ... ,(NN-KK-1) */ @@ -400,7 +410,8 @@ namespace DiscImageChef.Checksums { tmp = 0; for(j = 0; j < nn; j++) - if(recd[j] != a0) /* recd[j] in index form */ tmp ^= alpha_to[Modnn(recd[j] + (B0 + i - 1) * j)]; + if(recd[j] != a0) /* recd[j] in index form */ + tmp ^= alpha_to[Modnn(recd[j] + (B0 + i - 1) * j)]; synError |= tmp; /* set flag if non-zero syndrome => * error */ @@ -426,7 +437,7 @@ namespace DiscImageChef.Checksums } } -#if DEBUG + #if DEBUG /* find roots of the erasure location polynomial */ for(i = 1; i <= noEras; i++) reg[i] = index_of[lambda[i]]; @@ -437,16 +448,17 @@ namespace DiscImageChef.Checksums for(j = 1; j <= noEras; j++) if(reg[j] != a0) { - reg[j] = Modnn(reg[j] + j); - q ^= alpha_to[reg[j]]; + reg[j] = Modnn(reg[j] + j); + q ^= alpha_to[reg[j]]; } if(q != 0) continue; + /* store root and error location * number indices */ root[count] = i; - loc[count] = nn - i; + loc[count] = nn - i; count++; } @@ -461,7 +473,7 @@ namespace DiscImageChef.Checksums for(i = 0; i < count; i++) DicConsole.DebugWriteLine("Reed Solomon", "{0} ", loc[i]); DicConsole.DebugWriteLine("Reed Solomon", "\n"); -#endif + #endif } for(i = 0; i < nn - kk + 1; i++) b[i] = index_of[lambda[i]]; @@ -470,7 +482,7 @@ namespace DiscImageChef.Checksums * Begin Berlekamp-Massey algorithm to determine error+erasure * locator polynomial */ - int r = noEras; + int r = noEras; int el = noEras; while(++r <= nn - kk) { @@ -478,7 +490,8 @@ namespace DiscImageChef.Checksums /* Compute discrepancy at the r-th step in poly-form */ int discrR = 0; for(i = 0; i < r; i++) - if(lambda[i] != 0 && s[r - i] != a0) discrR ^= alpha_to[Modnn(index_of[lambda[i]] + s[r - i])]; + if(lambda[i] != 0 && s[r - i] != a0) + discrR ^= alpha_to[Modnn(index_of[lambda[i]] + s[r - i])]; discrR = index_of[discrR]; /* Index form */ if(discrR == a0) @@ -492,8 +505,10 @@ namespace DiscImageChef.Checksums /* 7 lines below: T(x) <-- lambda(x) - discr_r*x*b(x) */ t[0] = lambda[0]; for(i = 0; i < nn - kk; i++) - if(b[i] != a0) t[i + 1] = lambda[i + 1] ^ alpha_to[Modnn(discrR + b[i])]; - else t[i + 1] = lambda[i + 1]; + if(b[i] != a0) + t[i + 1] = lambda[i + 1] ^ alpha_to[Modnn(discrR + b[i])]; + else + t[i + 1] = lambda[i + 1]; if(2 * el <= r + noEras - 1) { @@ -523,6 +538,7 @@ namespace DiscImageChef.Checksums lambda[i] = index_of[lambda[i]]; if(lambda[i] != a0) degLambda = i; } + /* * Find roots of the error+erasure locator polynomial. By Chien * Search @@ -530,32 +546,34 @@ 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; for(j = degLambda; j > 0; j--) if(reg[j] != a0) { - reg[j] = Modnn(reg[j] + j); - q ^= alpha_to[reg[j]]; + reg[j] = Modnn(reg[j] + j); + q ^= alpha_to[reg[j]]; } if(q != 0) continue; + /* store root (index-form) and error location number */ root[count] = i; - loc[count] = nn - i; + loc[count] = nn - i; count++; } -#if DEBUG + #if DEBUG DicConsole.DebugWriteLine("Reed Solomon", "\n Final error positions:\t"); for(i = 0; i < count; i++) DicConsole.DebugWriteLine("Reed Solomon", "{0} ", loc[i]); DicConsole.DebugWriteLine("Reed Solomon", "\n"); -#endif + #endif if(degLambda != count) return -1; + /* * Compute err+eras evaluator poly omega(x) = s(x)*lambda(x) (modulo * x**(NN-KK)). in index form. Also find deg(omega). @@ -564,9 +582,10 @@ namespace DiscImageChef.Checksums for(i = 0; i < nn - kk; i++) { tmp = 0; - j = degLambda < i ? degLambda : i; + j = degLambda < i ? degLambda : 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) degOmega = i; omega[i] = index_of[tmp]; @@ -581,20 +600,24 @@ namespace DiscImageChef.Checksums for(j = count - 1; j >= 0; j--) { int num1 = 0; - for(i = degOmega; i >= 0; i--) if(omega[i] != a0) num1 ^= alpha_to[Modnn(omega[i] + i * root[j])]; + for(i = degOmega; i >= 0; i--) + if(omega[i] != a0) + num1 ^= alpha_to[Modnn(omega[i] + i * root[j])]; int num2 = alpha_to[Modnn(root[j] * (B0 - 1) + nn)]; - int den = 0; + int den = 0; /* lambda[i+1] for i even is the formal derivative lambda_pr of lambda[i] */ for(i = Min(degLambda, 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"); return -1; } + /* Apply error to data */ if(num1 != 0) data[loc[j]] ^= alpha_to[Modnn(index_of[num1] + index_of[num2] + nn - index_of[den])]; } diff --git a/DiscImageChef.Checksums/SHA1Context.cs b/DiscImageChef.Checksums/SHA1Context.cs index c232d36cb..f56d0d7cc 100644 --- a/DiscImageChef.Checksums/SHA1Context.cs +++ b/DiscImageChef.Checksums/SHA1Context.cs @@ -114,8 +114,8 @@ namespace DiscImageChef.Checksums { SHA1 localSha1Provider = SHA1.Create(); FileStream fileStream = new FileStream(filename, FileMode.Open); - hash = localSha1Provider.ComputeHash(fileStream); - StringBuilder sha1Output = new StringBuilder(); + hash = localSha1Provider.ComputeHash(fileStream); + StringBuilder sha1Output = new StringBuilder(); foreach(byte h in hash) sha1Output.Append(h.ToString("x2")); @@ -132,8 +132,8 @@ namespace DiscImageChef.Checksums /// Byte array of the hash value. public static string Data(byte[] data, uint len, out byte[] hash) { - SHA1 localSha1Provider = SHA1.Create(); - hash = localSha1Provider.ComputeHash(data, 0, (int)len); + SHA1 localSha1Provider = SHA1.Create(); + hash = localSha1Provider.ComputeHash(data, 0, (int)len); StringBuilder sha1Output = new StringBuilder(); foreach(byte h in hash) sha1Output.Append(h.ToString("x2")); diff --git a/DiscImageChef.Checksums/SHA256Context.cs b/DiscImageChef.Checksums/SHA256Context.cs index f2e614212..dc2d3e0ae 100644 --- a/DiscImageChef.Checksums/SHA256Context.cs +++ b/DiscImageChef.Checksums/SHA256Context.cs @@ -114,8 +114,8 @@ namespace DiscImageChef.Checksums { SHA256 localSha256Provider = SHA256.Create(); FileStream fileStream = new FileStream(filename, FileMode.Open); - hash = localSha256Provider.ComputeHash(fileStream); - StringBuilder sha256Output = new StringBuilder(); + hash = localSha256Provider.ComputeHash(fileStream); + StringBuilder sha256Output = new StringBuilder(); foreach(byte h in hash) sha256Output.Append(h.ToString("x2")); @@ -133,7 +133,7 @@ namespace DiscImageChef.Checksums public static string Data(byte[] data, uint len, out byte[] hash) { SHA256 localSha256Provider = SHA256.Create(); - hash = localSha256Provider.ComputeHash(data, 0, (int)len); + hash = localSha256Provider.ComputeHash(data, 0, (int)len); StringBuilder sha256Output = new StringBuilder(); foreach(byte h in hash) sha256Output.Append(h.ToString("x2")); diff --git a/DiscImageChef.Checksums/SHA384Context.cs b/DiscImageChef.Checksums/SHA384Context.cs index 7e669c53f..b3b75c6a3 100644 --- a/DiscImageChef.Checksums/SHA384Context.cs +++ b/DiscImageChef.Checksums/SHA384Context.cs @@ -114,8 +114,8 @@ namespace DiscImageChef.Checksums { SHA384 localSha384Provider = SHA384.Create(); FileStream fileStream = new FileStream(filename, FileMode.Open); - hash = localSha384Provider.ComputeHash(fileStream); - StringBuilder sha384Output = new StringBuilder(); + hash = localSha384Provider.ComputeHash(fileStream); + StringBuilder sha384Output = new StringBuilder(); foreach(byte h in hash) sha384Output.Append(h.ToString("x2")); @@ -133,7 +133,7 @@ namespace DiscImageChef.Checksums public static string Data(byte[] data, uint len, out byte[] hash) { SHA384 localSha384Provider = SHA384.Create(); - hash = localSha384Provider.ComputeHash(data, 0, (int)len); + hash = localSha384Provider.ComputeHash(data, 0, (int)len); StringBuilder sha384Output = new StringBuilder(); foreach(byte h in hash) sha384Output.Append(h.ToString("x2")); diff --git a/DiscImageChef.Checksums/SHA512Context.cs b/DiscImageChef.Checksums/SHA512Context.cs index 2a9a4dfb2..3769a7977 100644 --- a/DiscImageChef.Checksums/SHA512Context.cs +++ b/DiscImageChef.Checksums/SHA512Context.cs @@ -114,8 +114,8 @@ namespace DiscImageChef.Checksums { SHA512 localSha512Provider = SHA512.Create(); FileStream fileStream = new FileStream(filename, FileMode.Open); - hash = localSha512Provider.ComputeHash(fileStream); - StringBuilder sha512Output = new StringBuilder(); + hash = localSha512Provider.ComputeHash(fileStream); + StringBuilder sha512Output = new StringBuilder(); foreach(byte h in hash) sha512Output.Append(h.ToString("x2")); @@ -133,7 +133,7 @@ namespace DiscImageChef.Checksums public static string Data(byte[] data, uint len, out byte[] hash) { SHA512 localSha512Provider = SHA512.Create(); - hash = localSha512Provider.ComputeHash(data, 0, (int)len); + hash = localSha512Provider.ComputeHash(data, 0, (int)len); StringBuilder sha512Output = new StringBuilder(); foreach(byte h in hash) sha512Output.Append(h.ToString("x2")); diff --git a/DiscImageChef.Checksums/SpamSumContext.cs b/DiscImageChef.Checksums/SpamSumContext.cs index 2ea280ba3..c38cc2318 100644 --- a/DiscImageChef.Checksums/SpamSumContext.cs +++ b/DiscImageChef.Checksums/SpamSumContext.cs @@ -72,8 +72,7 @@ namespace DiscImageChef.Checksums /// public SpamSumContext() { - self = - new FuzzyState {Bh = new BlockhashContext[NUM_BLOCKHASHES]}; + self = new FuzzyState {Bh = new BlockhashContext[NUM_BLOCKHASHES]}; for(int i = 0; i < NUM_BLOCKHASHES; i++) self.Bh[i].Digest = new byte[SPAMSUM_LENGTH]; self.Bhstart = 0; @@ -211,7 +210,7 @@ namespace DiscImageChef.Checksums void fuzzy_engine_step(byte c) { - uint i; + uint i; /* At each character we update the rolling hash and the normal hashes. * When the rolling hash hits a reset value then we emit a normal hash * as a element of the signature and reset the normal hash. */ @@ -260,11 +259,11 @@ namespace DiscImageChef.Checksums // CLAUNIA: Flags seems to never be used in ssdeep, so I just removed it for code simplicity uint FuzzyDigest(out byte[] result) { - StringBuilder sb = new StringBuilder(); - uint bi = self.Bhstart; - uint h = roll_sum(); + StringBuilder sb = new StringBuilder(); + uint bi = self.Bhstart; + uint h = roll_sum(); int remain = (int)(FUZZY_MAX_RESULT - 1); /* Exclude terminating '\0'. */ - result = new byte[FUZZY_MAX_RESULT]; + result = new byte[FUZZY_MAX_RESULT]; /* Verify that our elimination was not overeager. */ if(!(bi == 0 || (ulong)SSDEEP_BS(bi) / 2 * SPAMSUM_LENGTH < self.TotalSize)) throw new Exception("Assertion failed"); diff --git a/DiscImageChef.CommonTypes/MediaType.cs b/DiscImageChef.CommonTypes/MediaType.cs index f0d7b6632..36afd3bcf 100644 --- a/DiscImageChef.CommonTypes/MediaType.cs +++ b/DiscImageChef.CommonTypes/MediaType.cs @@ -58,9 +58,9 @@ namespace DiscImageChef.CommonTypes /// Generic hard disk GENERIC_HDD = 2, /// Microdrive type hard disk - Microdrive = 3, + Microdrive = 3, /// Zoned hard disk - Zone_HDD = 4, + Zone_HDD = 4, /// USB flash drives FlashDrive = 5, #endregion Generics, types 0 to 9 @@ -194,7 +194,7 @@ namespace DiscImageChef.CommonTypes /// Pioneer LaserDisc data LDROM = 81, LDROM2 = 82, - LVROM = 83, + LVROM = 83, MegaLD = 84, #endregion LaserDisc based, types 80 to 89 @@ -203,7 +203,7 @@ namespace DiscImageChef.CommonTypes HiMD = 90, /// Sony MiniDisc MD = 91, - MDData = 92, + MDData = 92, MDData2 = 93, #endregion MiniDisc based, types 90 to 99 @@ -217,7 +217,7 @@ namespace DiscImageChef.CommonTypes #endregion Plasmon UDO, types 100 to 109 #region Sony game media, types 110 to 129 - PlayStationMemoryCard = 110, + PlayStationMemoryCard = 110, PlayStationMemoryCard2 = 111, /// Sony PlayStation game CD PS1CD = 112, @@ -521,46 +521,46 @@ namespace DiscImageChef.CommonTypes #region OnStream ADR, types 310 to 319 ADR2120 = 310, - ADR260 = 311, - ADR30 = 312, - ADR50 = 313, + ADR260 = 311, + ADR30 = 312, + ADR50 = 313, #endregion OnStream ADR, types 310 to 319 #region Advanced Intelligent Tape, types 320 to 339 - AIT1 = 320, + AIT1 = 320, AIT1Turbo = 321, - AIT2 = 322, + AIT2 = 322, AIT2Turbo = 323, - AIT3 = 324, - AIT3Ex = 325, + AIT3 = 324, + AIT3Ex = 325, AIT3Turbo = 326, - AIT4 = 327, - AIT5 = 328, + AIT4 = 327, + AIT5 = 328, AITETurbo = 329, - SAIT1 = 330, - SAIT2 = 331, + SAIT1 = 330, + SAIT2 = 331, #endregion Advanced Intelligent Tape, types 320 to 339 #region Iomega, types 340 to 359 - Bernoulli = 340, + Bernoulli = 340, Bernoulli2 = 341, - Ditto = 342, - DittoMax = 343, - Jaz = 344, - Jaz2 = 345, - PocketZip = 346, - REV120 = 347, - REV35 = 348, - REV70 = 349, - ZIP100 = 350, - ZIP250 = 351, - ZIP750 = 352, + Ditto = 342, + DittoMax = 343, + Jaz = 344, + Jaz2 = 345, + PocketZip = 346, + REV120 = 347, + REV35 = 348, + REV70 = 349, + ZIP100 = 350, + ZIP250 = 351, + ZIP750 = 352, #endregion Iomega, types 340 to 359 #region Audio or video media, types 360 to 369 CompactCassette = 360, - Data8 = 361, - MiniDV = 362, + Data8 = 361, + MiniDV = 362, /// D/CAS-25: Digital data on Compact Cassette form factor, special magnetic media, 9-track Dcas25 = 363, /// D/CAS-85: Digital data on Compact Cassette form factor, special magnetic media, 17-track @@ -570,96 +570,96 @@ namespace DiscImageChef.CommonTypes #endregion Audio media, types 360 to 369 #region CompactFlash Association, types 370 to 379 - CFast = 370, - CompactFlash = 371, + CFast = 370, + CompactFlash = 371, CompactFlashType2 = 372, #endregion CompactFlash Association, types 370 to 379 #region Digital Audio Tape / Digital Data Storage, types 380 to 389 DigitalAudioTape = 380, - DAT160 = 381, - DAT320 = 382, - DAT72 = 383, - DDS1 = 384, - DDS2 = 385, - DDS3 = 386, - DDS4 = 387, + DAT160 = 381, + DAT320 = 382, + DAT72 = 383, + DDS1 = 384, + DDS2 = 385, + DDS3 = 386, + DDS4 = 387, #endregion Digital Audio Tape / Digital Data Storage, types 380 to 389 #region DEC, types 390 to 399 - CompactTapeI = 390, + CompactTapeI = 390, CompactTapeII = 391, - DECtapeII = 392, - DLTtapeIII = 393, - DLTtapeIIIxt = 394, - DLTtapeIV = 395, - DLTtapeS4 = 396, - SDLT1 = 397, - SDLT2 = 398, - VStapeI = 399, + DECtapeII = 392, + DLTtapeIII = 393, + DLTtapeIIIxt = 394, + DLTtapeIV = 395, + DLTtapeS4 = 396, + SDLT1 = 397, + SDLT2 = 398, + VStapeI = 399, #endregion DEC, types 390 to 399 #region Exatape, types 400 to 419 - Exatape15m = 400, - Exatape22m = 401, + Exatape15m = 400, + Exatape22m = 401, Exatape22mAME = 402, - Exatape28m = 403, - Exatape40m = 404, - Exatape45m = 405, - Exatape54m = 406, - Exatape75m = 407, - Exatape76m = 408, - Exatape80m = 409, - Exatape106m = 410, + Exatape28m = 403, + Exatape40m = 404, + Exatape45m = 405, + Exatape54m = 406, + Exatape75m = 407, + Exatape76m = 408, + Exatape80m = 409, + Exatape106m = 410, Exatape160mXL = 411, - Exatape112m = 412, - Exatape125m = 413, - Exatape150m = 414, - Exatape170m = 415, - Exatape225m = 416, + Exatape112m = 412, + Exatape125m = 413, + Exatape150m = 414, + Exatape170m = 415, + Exatape225m = 416, #endregion Exatape, types 400 to 419 #region PCMCIA / ExpressCard, types 420 to 429 ExpressCard34 = 420, ExpressCard54 = 421, - PCCardTypeI = 422, - PCCardTypeII = 423, + PCCardTypeI = 422, + PCCardTypeII = 423, PCCardTypeIII = 424, - PCCardTypeIV = 425, + PCCardTypeIV = 425, #endregion PCMCIA / ExpressCard, types 420 to 429 #region SyQuest, types 430 to 449 - EZ135 = 430, - EZ230 = 431, - Quest = 432, - SparQ = 433, - SQ100 = 434, - SQ200 = 435, - SQ300 = 436, - SQ310 = 437, - SQ327 = 438, - SQ400 = 439, - SQ800 = 440, + EZ135 = 430, + EZ230 = 431, + Quest = 432, + SparQ = 433, + SQ100 = 434, + SQ200 = 435, + SQ300 = 436, + SQ310 = 437, + SQ327 = 438, + SQ400 = 439, + SQ800 = 440, SQ1500 = 441, SQ2000 = 442, - SyJet = 443, + SyJet = 443, #endregion SyQuest, types 430 to 449 #region Nintendo, types 450 to 469 - FamicomGamePak = 450, + FamicomGamePak = 450, GameBoyAdvanceGamePak = 451, - GameBoyGamePak = 452, + GameBoyGamePak = 452, /// Nintendo GameCube Optical Disc GOD = 453, - N64DD = 454, - N64GamePak = 455, - NESGamePak = 456, + N64DD = 454, + N64GamePak = 455, + NESGamePak = 456, Nintendo3DSGameCard = 457, - NintendoDiskCard = 458, - NintendoDSGameCard = 459, + NintendoDiskCard = 458, + NintendoDSGameCard = 459, NintendoDSiGameCard = 460, - SNESGamePak = 461, - SNESGamePakUS = 462, + SNESGamePak = 461, + SNESGamePakUS = 462, /// Nintendo Wii Optical Disc WOD = 463, /// Nintendo Wii U Optical Disc @@ -668,101 +668,101 @@ namespace DiscImageChef.CommonTypes #endregion Nintendo, types 450 to 469 #region IBM Tapes, types 470 to 479 - IBM3470 = 470, - IBM3480 = 471, - IBM3490 = 472, + IBM3470 = 470, + IBM3480 = 471, + IBM3490 = 472, IBM3490E = 473, - IBM3592 = 474, + IBM3592 = 474, #endregion IBM Tapes, types 470 to 479 #region LTO Ultrium, types 480 to 509 - LTO = 480, - LTO2 = 481, - LTO3 = 482, + LTO = 480, + LTO2 = 481, + LTO3 = 482, LTO3WORM = 483, - LTO4 = 484, + LTO4 = 484, LTO4WORM = 485, - LTO5 = 486, + LTO5 = 486, LTO5WORM = 487, - LTO6 = 488, + LTO6 = 488, LTO6WORM = 489, - LTO7 = 490, + LTO7 = 490, LTO7WORM = 491, #endregion LTO Ultrium, types 480 to 509 #region MemoryStick, types 510 to 519 - MemoryStick = 510, - MemoryStickDuo = 511, - MemoryStickMicro = 512, - MemoryStickPro = 513, + MemoryStick = 510, + MemoryStickDuo = 511, + MemoryStickMicro = 512, + MemoryStickPro = 513, MemoryStickProDuo = 514, #endregion MemoryStick, types 510 to 519 #region SecureDigital, types 520 to 529 - microSD = 520, - miniSD = 521, + microSD = 520, + miniSD = 521, SecureDigital = 522, #endregion SecureDigital, types 520 to 529 #region MultiMediaCard, types 530 to 539 - MMC = 530, - MMCmicro = 531, - RSMMC = 532, - MMCplus = 533, + MMC = 530, + MMCmicro = 531, + RSMMC = 532, + MMCplus = 533, MMCmobile = 534, #endregion MultiMediaCard, types 530 to 539 #region SLR, types 540 to 569 - MLR1 = 540, - MLR1SL = 541, - MLR3 = 542, - SLR1 = 543, - SLR2 = 544, - SLR3 = 545, - SLR32 = 546, - SLR32SL = 547, - SLR4 = 548, - SLR5 = 549, - SLR5SL = 550, - SLR6 = 551, - SLRtape7 = 552, - SLRtape7SL = 553, - SLRtape24 = 554, + MLR1 = 540, + MLR1SL = 541, + MLR3 = 542, + SLR1 = 543, + SLR2 = 544, + SLR3 = 545, + SLR32 = 546, + SLR32SL = 547, + SLR4 = 548, + SLR5 = 549, + SLR5SL = 550, + SLR6 = 551, + SLRtape7 = 552, + SLRtape7SL = 553, + SLRtape24 = 554, SLRtape24SL = 555, - SLRtape40 = 556, - SLRtape50 = 557, - SLRtape60 = 558, - SLRtape75 = 559, - SLRtape100 = 560, - SLRtape140 = 561, + SLRtape40 = 556, + SLRtape50 = 557, + SLRtape60 = 558, + SLRtape75 = 559, + SLRtape100 = 560, + SLRtape140 = 561, #endregion SLR, types 540 to 569 #region QIC, types 570 to 589 - QIC11 = 570, - QIC120 = 571, + QIC11 = 570, + QIC120 = 571, QIC1350 = 572, - QIC150 = 573, - QIC24 = 574, + QIC150 = 573, + QIC24 = 574, QIC3010 = 575, QIC3020 = 576, QIC3080 = 577, QIC3095 = 578, - QIC320 = 579, - QIC40 = 580, - QIC525 = 581, - QIC80 = 582, + QIC320 = 579, + QIC40 = 580, + QIC525 = 581, + QIC80 = 582, #endregion QIC, types 570 to 589 #region StorageTek tapes, types 590 to 609 STK4480 = 590, STK4490 = 591, STK9490 = 592, - T9840A = 593, - T9840B = 594, - T9840C = 595, - T9840D = 596, - T9940A = 597, - T9940B = 598, + T9840A = 593, + T9840B = 594, + T9840C = 595, + T9840D = 596, + T9940A = 597, + T9940B = 598, T10000A = 599, T10000B = 600, T10000C = 601, @@ -770,13 +770,13 @@ namespace DiscImageChef.CommonTypes #endregion StorageTek tapes, types 590 to 609 #region Travan, types 610 to 619 - Travan = 610, + Travan = 610, Travan1Ex = 611, - Travan3 = 612, + Travan3 = 612, Travan3Ex = 613, - Travan4 = 614, - Travan5 = 615, - Travan7 = 616, + Travan4 = 614, + Travan5 = 615, + Travan7 = 616, #endregion Travan, types 610 to 619 #region VXA, types 620 to 629 @@ -840,43 +840,43 @@ namespace DiscImageChef.CommonTypes #region Other floppy standards, types 660 to 689 CompactFloppy = 660, - DemiDiskette = 661, + DemiDiskette = 661, /// 3.5", 652 tracks, 2 sides, 512 bytes/sector, Floptical, ECMA-207, ISO 14169 Floptical = 662, - HiFD = 663, - QuickDisk = 664, - UHD144 = 665, - VideoFloppy = 666, - Wafer = 667, + HiFD = 663, + QuickDisk = 664, + UHD144 = 665, + VideoFloppy = 666, + Wafer = 667, ZXMicrodrive = 668, #endregion Other floppy standards, types 660 to 669 #region Miscellaneous, types 670 to 689 - BeeCard = 670, - Borsu = 671, - DataStore = 672, - DIR = 673, - DST = 674, - DTF = 675, - DTF2 = 676, + BeeCard = 670, + Borsu = 671, + DataStore = 672, + DIR = 673, + DST = 674, + DTF = 675, + DTF2 = 676, Flextra3020 = 677, Flextra3225 = 678, - HiTC1 = 679, - HiTC2 = 680, - LT1 = 681, - MiniCard = 872, - Orb = 683, - Orb5 = 684, - SmartMedia = 685, - xD = 686, - XQD = 687, - DataPlay = 688, + HiTC1 = 679, + HiTC2 = 680, + LT1 = 681, + MiniCard = 872, + Orb = 683, + Orb5 = 684, + SmartMedia = 685, + xD = 686, + XQD = 687, + DataPlay = 688, #endregion Miscellaneous, types 670 to 689 #region Apple Hard Disks, types 690 to 699 - AppleProfile = 690, - AppleWidget = 691, - AppleHD20 = 692, + AppleProfile = 690, + AppleWidget = 691, + AppleHD20 = 692, PriamDataTower = 693, #endregion Apple Hard Disks, types 690 to 699 @@ -1022,7 +1022,7 @@ namespace DiscImageChef.CommonTypes LS120 = 730, LS240 = 731, FD32MB = 732, - RDX = 733, + RDX = 733, /// Imation 320Gb RDX RDX320 = 734, #endregion Imation, types 730 to 739 diff --git a/DiscImageChef.CommonTypes/MediaTypeFromSCSI.cs b/DiscImageChef.CommonTypes/MediaTypeFromSCSI.cs index 74502b4d8..3d729a5e3 100644 --- a/DiscImageChef.CommonTypes/MediaTypeFromSCSI.cs +++ b/DiscImageChef.CommonTypes/MediaTypeFromSCSI.cs @@ -49,7 +49,7 @@ namespace DiscImageChef.CommonTypes /// Size in bytes of each block /// public static MediaType Get(byte scsiPeripheralType, string vendor, string model, byte mediumType, - byte densityCode, ulong blocks, uint blockSize) + byte densityCode, ulong blocks, uint blockSize) { switch(scsiPeripheralType) { @@ -113,7 +113,7 @@ namespace DiscImageChef.CommonTypes if(blocks == 1440) return MediaType.DOS_35_DS_DD_9; } else if(blockSize == 1024) - if(blocks == 1232) + if(blocks == 1232) return MediaType.NEC_35_HD_8; return MediaType.Unknown; @@ -197,7 +197,7 @@ namespace DiscImageChef.CommonTypes case 603466: case 637041: return MediaType.ECMA_184; case 936921: - case 948770: return MediaType.ECMA_195; + 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; @@ -212,7 +212,7 @@ namespace DiscImageChef.CommonTypes case 310352: // Found in real media case 318988: case 320332: - case 321100: return MediaType.ECMA_239; + case 321100: return MediaType.ECMA_239; case 605846: return MediaType.GigaMo; case 1063146: return MediaType.GigaMo2; case 1128134: return MediaType.ECMA_280; @@ -315,7 +315,7 @@ namespace DiscImageChef.CommonTypes case 603466: case 637041: return MediaType.ECMA_184; case 936921: - case 948770: return MediaType.ECMA_195; + 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; @@ -329,7 +329,7 @@ namespace DiscImageChef.CommonTypes case 310352: // Found in real media case 318988: case 320332: - case 321100: return MediaType.ECMA_239; + case 321100: return MediaType.ECMA_239; case 605846: return MediaType.GigaMo; case 1063146: return MediaType.GigaMo2; case 1128134: return MediaType.ECMA_280; @@ -1412,7 +1412,7 @@ namespace DiscImageChef.CommonTypes case 1298496: return MediaType.PD650; case 1644581: case 1647371: return MediaType.ECMA_195_512; - default: return MediaType.UnknownMO; + default: return MediaType.UnknownMO; } } case 1024: @@ -1424,7 +1424,7 @@ namespace DiscImageChef.CommonTypes case 603466: case 637041: return MediaType.ECMA_184; case 936921: - case 948770: return MediaType.ECMA_195; + 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; @@ -1438,7 +1438,7 @@ namespace DiscImageChef.CommonTypes case 310352: // Found in real media case 318988: case 320332: - case 321100: return MediaType.ECMA_239; + case 321100: return MediaType.ECMA_239; case 605846: return MediaType.GigaMo; case 1063146: return MediaType.GigaMo2; case 1128134: return MediaType.ECMA_280; diff --git a/DiscImageChef.Compression/TeleDiskLzh.cs b/DiscImageChef.Compression/TeleDiskLzh.cs index ab6ecd40d..5a305869d 100644 --- a/DiscImageChef.Compression/TeleDiskLzh.cs +++ b/DiscImageChef.Compression/TeleDiskLzh.cs @@ -161,7 +161,7 @@ namespace DiscImageChef.Compression buf = new byte[len]; int count; // was an unsigned long, seems unnecessary for(count = 0; count < len;) - if(tdctl.Bufcnt == 0) + if(tdctl.Bufcnt == 0) { if((c = DecodeChar()) < 0) return count; // fatal error @@ -178,7 +178,7 @@ namespace DiscImageChef.Compression if((pos = DecodePosition()) < 0) return count; // fatal error tdctl.Bufpos = (ushort)((tdctl.R - pos - 1) & (N - 1)); - tdctl.Bufcnt = (ushort)(c - 255 + THRESHOLD); + tdctl.Bufcnt = (ushort)(c - 255 + THRESHOLD); tdctl.Bufndx = 0; } } @@ -259,9 +259,9 @@ namespace DiscImageChef.Compression for(i = 0; i < N_CHAR; i++) { - freq[i] = 1; - son[i] = (short)(i + T); - prnt[i + T] = (short)i; + freq[i] = 1; + son[i] = (short)(i + T); + prnt[i + T] = (short)i; } i = 0; @@ -287,7 +287,7 @@ namespace DiscImageChef.Compression /* halven cumulative freq for leaf nodes */ short j = 0; - for(i = 0; i < T; i++) + for(i = 0; i < T; i++) if(son[i] >= T) { freq[j] = (ushort)((freq[i] + 1) / 2); @@ -298,9 +298,9 @@ namespace DiscImageChef.Compression /* make a tree : first, connect children nodes */ for(i = 0, j = N_CHAR; j < T; i += 2, j++) { - k = (short)(i + 1); + k = (short)(i + 1); ushort f = freq[j] = (ushort)(freq[i] + freq[k]); - for(k = (short)(j - 1); f < freq[k]; k--) { } + for(k = (short)(j - 1); f < freq[k]; k--) { } k++; ushort l = (ushort)((j - k) * 2); @@ -312,7 +312,7 @@ namespace DiscImageChef.Compression } /* connect parent nodes */ - for(i = 0; i < T; i++) + for(i = 0; i < T; i++) if((k = son[i]) >= T) prnt[k] = i; else @@ -339,16 +339,16 @@ namespace DiscImageChef.Compression freq[c] = freq[l]; freq[l] = (ushort)k; - int i = son[c]; - prnt[i] = (short)l; + int i = son[c]; + prnt[i] = (short)l; if(i < T) prnt[i + 1] = (short)l; - int j = son[l]; + int j = son[l]; son[l] = (short)i; - prnt[j] = (short)c; + prnt[j] = (short)c; if(j < T) prnt[j + 1] = (short)c; - son[c] = (short)j; + son[c] = (short)j; c = l; } @@ -380,7 +380,7 @@ namespace DiscImageChef.Compression short DecodePosition() { - short bit; + short bit; /* decode upper 6 bits from given table */ if((bit = (short)GetByte()) < 0) return -1; diff --git a/DiscImageChef.Console/DicConsole.cs b/DiscImageChef.Console/DicConsole.cs index c821e5865..3c0c82be8 100644 --- a/DiscImageChef.Console/DicConsole.cs +++ b/DiscImageChef.Console/DicConsole.cs @@ -54,15 +54,15 @@ namespace DiscImageChef.Console /// public static class DicConsole { - public static event WriteLineHandler WriteLineEvent; - public static event ErrorWriteLineHandler ErrorWriteLineEvent; + public static event WriteLineHandler WriteLineEvent; + public static event ErrorWriteLineHandler ErrorWriteLineEvent; public static event VerboseWriteLineHandler VerboseWriteLineEvent; - public static event DebugWriteLineHandler DebugWriteLineEvent; + public static event DebugWriteLineHandler DebugWriteLineEvent; - public static event WriteHandler WriteEvent; - public static event ErrorWriteHandler ErrorWriteEvent; + public static event WriteHandler WriteEvent; + public static event ErrorWriteHandler ErrorWriteEvent; public static event VerboseWriteHandler VerboseWriteEvent; - public static event DebugWriteHandler DebugWriteEvent; + public static event DebugWriteHandler DebugWriteEvent; public static void WriteLine(string format, params object[] arg) { diff --git a/DiscImageChef.Core/Benchmark.cs b/DiscImageChef.Core/Benchmark.cs index 78103a4b0..babf0ff5c 100644 --- a/DiscImageChef.Core/Benchmark.cs +++ b/DiscImageChef.Core/Benchmark.cs @@ -111,14 +111,14 @@ namespace DiscImageChef.Core EndProgress(); end = DateTime.Now; - results.FillTime = (end - start).TotalSeconds; + results.FillTime = (end - start).TotalSeconds; results.FillSpeed = bufferSize / 1048576.0 / (end - start).TotalSeconds; ms.Seek(0, SeekOrigin.Begin); - long mem = GC.GetTotalMemory(false); + long mem = GC.GetTotalMemory(false); if(mem > results.MaxMemory) results.MaxMemory = mem; if(mem < results.MinMemory) results.MinMemory = mem; - start = DateTime.Now; + start = DateTime.Now; InitProgress(); for(int i = 0; i < bufferSize / blockSize; i++) { @@ -128,21 +128,21 @@ namespace DiscImageChef.Core } EndProgress(); - end = DateTime.Now; - mem = GC.GetTotalMemory(false); + end = DateTime.Now; + mem = GC.GetTotalMemory(false); if(mem > results.MaxMemory) results.MaxMemory = mem; if(mem < results.MinMemory) results.MinMemory = mem; - results.ReadTime = (end - start).TotalSeconds; + results.ReadTime = (end - start).TotalSeconds; results.ReadSpeed = bufferSize / 1048576.0 / (end - start).TotalSeconds; #region Adler32 IChecksum ctx = new Adler32Context(); ms.Seek(0, SeekOrigin.Begin); - mem = GC.GetTotalMemory(false); + mem = GC.GetTotalMemory(false); if(mem > results.MaxMemory) results.MaxMemory = mem; if(mem < results.MinMemory) results.MinMemory = mem; - start = DateTime.Now; + start = DateTime.Now; InitProgress(); for(int i = 0; i < bufferSize / blockSize; i++) { @@ -154,27 +154,27 @@ namespace DiscImageChef.Core EndProgress(); ctx.End(); - end = DateTime.Now; - mem = GC.GetTotalMemory(false); + end = DateTime.Now; + mem = GC.GetTotalMemory(false); if(mem > results.MaxMemory) results.MaxMemory = mem; if(mem < results.MinMemory) results.MinMemory = mem; results.Entries.Add("Adler32", new BenchmarkEntry { - TimeSpan = (end - start).TotalSeconds, + TimeSpan = (end - start).TotalSeconds, Speed = bufferSize / 1048576.0 / (end - start).TotalSeconds }); results.SeparateTime += (end - start).TotalSeconds; #endregion Adler32 - + #region Fletcher16 ctx = new Fletcher16Context(); ms.Seek(0, SeekOrigin.Begin); - mem = GC.GetTotalMemory(false); + mem = GC.GetTotalMemory(false); if(mem > results.MaxMemory) results.MaxMemory = mem; if(mem < results.MinMemory) results.MinMemory = mem; - start = DateTime.Now; + start = DateTime.Now; InitProgress(); for(int i = 0; i < bufferSize / blockSize; i++) { @@ -186,15 +186,15 @@ namespace DiscImageChef.Core EndProgress(); ctx.End(); - end = DateTime.Now; - mem = GC.GetTotalMemory(false); + end = DateTime.Now; + mem = GC.GetTotalMemory(false); if(mem > results.MaxMemory) results.MaxMemory = mem; if(mem < results.MinMemory) results.MinMemory = mem; results.Entries.Add("Fletcher16", new BenchmarkEntry { - TimeSpan = (end - start).TotalSeconds, + TimeSpan = (end - start).TotalSeconds, Speed = bufferSize / 1048576.0 / (end - start).TotalSeconds }); results.SeparateTime += (end - start).TotalSeconds; @@ -203,10 +203,10 @@ namespace DiscImageChef.Core #region Fletcher32 ctx = new Fletcher32Context(); ms.Seek(0, SeekOrigin.Begin); - mem = GC.GetTotalMemory(false); + mem = GC.GetTotalMemory(false); if(mem > results.MaxMemory) results.MaxMemory = mem; if(mem < results.MinMemory) results.MinMemory = mem; - start = DateTime.Now; + start = DateTime.Now; InitProgress(); for(int i = 0; i < bufferSize / blockSize; i++) { @@ -218,15 +218,15 @@ namespace DiscImageChef.Core EndProgress(); ctx.End(); - end = DateTime.Now; - mem = GC.GetTotalMemory(false); + end = DateTime.Now; + mem = GC.GetTotalMemory(false); if(mem > results.MaxMemory) results.MaxMemory = mem; if(mem < results.MinMemory) results.MinMemory = mem; results.Entries.Add("Fletcher32", new BenchmarkEntry { - TimeSpan = (end - start).TotalSeconds, + TimeSpan = (end - start).TotalSeconds, Speed = bufferSize / 1048576.0 / (end - start).TotalSeconds }); results.SeparateTime += (end - start).TotalSeconds; @@ -235,10 +235,10 @@ namespace DiscImageChef.Core #region CRC16 ctx = new Crc16Context(); ms.Seek(0, SeekOrigin.Begin); - mem = GC.GetTotalMemory(false); + mem = GC.GetTotalMemory(false); if(mem > results.MaxMemory) results.MaxMemory = mem; if(mem < results.MinMemory) results.MinMemory = mem; - start = DateTime.Now; + start = DateTime.Now; InitProgress(); for(int i = 0; i < bufferSize / blockSize; i++) { @@ -250,15 +250,15 @@ namespace DiscImageChef.Core EndProgress(); ctx.End(); - end = DateTime.Now; - mem = GC.GetTotalMemory(false); + end = DateTime.Now; + mem = GC.GetTotalMemory(false); if(mem > results.MaxMemory) results.MaxMemory = mem; if(mem < results.MinMemory) results.MinMemory = mem; results.Entries.Add("CRC16", new BenchmarkEntry { - TimeSpan = (end - start).TotalSeconds, + TimeSpan = (end - start).TotalSeconds, Speed = bufferSize / 1048576.0 / (end - start).TotalSeconds }); results.SeparateTime += (end - start).TotalSeconds; @@ -267,10 +267,10 @@ namespace DiscImageChef.Core #region CRC32 ctx = new Crc32Context(); ms.Seek(0, SeekOrigin.Begin); - mem = GC.GetTotalMemory(false); + mem = GC.GetTotalMemory(false); if(mem > results.MaxMemory) results.MaxMemory = mem; if(mem < results.MinMemory) results.MinMemory = mem; - start = DateTime.Now; + start = DateTime.Now; InitProgress(); for(int i = 0; i < bufferSize / blockSize; i++) { @@ -282,15 +282,15 @@ namespace DiscImageChef.Core EndProgress(); ctx.End(); - end = DateTime.Now; - mem = GC.GetTotalMemory(false); + end = DateTime.Now; + mem = GC.GetTotalMemory(false); if(mem > results.MaxMemory) results.MaxMemory = mem; if(mem < results.MinMemory) results.MinMemory = mem; results.Entries.Add("CRC32", new BenchmarkEntry { - TimeSpan = (end - start).TotalSeconds, + TimeSpan = (end - start).TotalSeconds, Speed = bufferSize / 1048576.0 / (end - start).TotalSeconds }); results.SeparateTime += (end - start).TotalSeconds; @@ -299,10 +299,10 @@ namespace DiscImageChef.Core #region CRC64 ctx = new Crc64Context(); ms.Seek(0, SeekOrigin.Begin); - mem = GC.GetTotalMemory(false); + mem = GC.GetTotalMemory(false); if(mem > results.MaxMemory) results.MaxMemory = mem; if(mem < results.MinMemory) results.MinMemory = mem; - start = DateTime.Now; + start = DateTime.Now; InitProgress(); for(int i = 0; i < bufferSize / blockSize; i++) { @@ -314,15 +314,15 @@ namespace DiscImageChef.Core EndProgress(); ctx.End(); - end = DateTime.Now; - mem = GC.GetTotalMemory(false); + end = DateTime.Now; + mem = GC.GetTotalMemory(false); if(mem > results.MaxMemory) results.MaxMemory = mem; if(mem < results.MinMemory) results.MinMemory = mem; results.Entries.Add("CRC64", new BenchmarkEntry { - TimeSpan = (end - start).TotalSeconds, + TimeSpan = (end - start).TotalSeconds, Speed = bufferSize / 1048576.0 / (end - start).TotalSeconds }); results.SeparateTime += (end - start).TotalSeconds; @@ -331,10 +331,10 @@ namespace DiscImageChef.Core #region MD5 ctx = new Md5Context(); ms.Seek(0, SeekOrigin.Begin); - mem = GC.GetTotalMemory(false); + mem = GC.GetTotalMemory(false); if(mem > results.MaxMemory) results.MaxMemory = mem; if(mem < results.MinMemory) results.MinMemory = mem; - start = DateTime.Now; + start = DateTime.Now; InitProgress(); for(int i = 0; i < bufferSize / blockSize; i++) { @@ -346,15 +346,15 @@ namespace DiscImageChef.Core EndProgress(); ctx.End(); - end = DateTime.Now; - mem = GC.GetTotalMemory(false); + end = DateTime.Now; + mem = GC.GetTotalMemory(false); if(mem > results.MaxMemory) results.MaxMemory = mem; if(mem < results.MinMemory) results.MinMemory = mem; results.Entries.Add("MD5", new BenchmarkEntry { - TimeSpan = (end - start).TotalSeconds, + TimeSpan = (end - start).TotalSeconds, Speed = bufferSize / 1048576.0 / (end - start).TotalSeconds }); results.SeparateTime += (end - start).TotalSeconds; @@ -363,10 +363,10 @@ namespace DiscImageChef.Core #region RIPEMD160 ctx = new Ripemd160Context(); ms.Seek(0, SeekOrigin.Begin); - mem = GC.GetTotalMemory(false); + mem = GC.GetTotalMemory(false); if(mem > results.MaxMemory) results.MaxMemory = mem; if(mem < results.MinMemory) results.MinMemory = mem; - start = DateTime.Now; + start = DateTime.Now; InitProgress(); for(int i = 0; i < bufferSize / blockSize; i++) { @@ -378,15 +378,15 @@ namespace DiscImageChef.Core EndProgress(); ctx.End(); - end = DateTime.Now; - mem = GC.GetTotalMemory(false); + end = DateTime.Now; + mem = GC.GetTotalMemory(false); if(mem > results.MaxMemory) results.MaxMemory = mem; if(mem < results.MinMemory) results.MinMemory = mem; results.Entries.Add("RIPEMD160", new BenchmarkEntry { - TimeSpan = (end - start).TotalSeconds, + TimeSpan = (end - start).TotalSeconds, Speed = bufferSize / 1048576.0 / (end - start).TotalSeconds }); results.SeparateTime += (end - start).TotalSeconds; @@ -395,10 +395,10 @@ namespace DiscImageChef.Core #region SHA1 ctx = new Sha1Context(); ms.Seek(0, SeekOrigin.Begin); - mem = GC.GetTotalMemory(false); + mem = GC.GetTotalMemory(false); if(mem > results.MaxMemory) results.MaxMemory = mem; if(mem < results.MinMemory) results.MinMemory = mem; - start = DateTime.Now; + start = DateTime.Now; InitProgress(); for(int i = 0; i < bufferSize / blockSize; i++) { @@ -410,15 +410,15 @@ namespace DiscImageChef.Core EndProgress(); ctx.End(); - end = DateTime.Now; - mem = GC.GetTotalMemory(false); + end = DateTime.Now; + mem = GC.GetTotalMemory(false); if(mem > results.MaxMemory) results.MaxMemory = mem; if(mem < results.MinMemory) results.MinMemory = mem; results.Entries.Add("SHA1", new BenchmarkEntry { - TimeSpan = (end - start).TotalSeconds, + TimeSpan = (end - start).TotalSeconds, Speed = bufferSize / 1048576.0 / (end - start).TotalSeconds }); results.SeparateTime += (end - start).TotalSeconds; @@ -427,10 +427,10 @@ namespace DiscImageChef.Core #region SHA256 ctx = new Sha256Context(); ms.Seek(0, SeekOrigin.Begin); - mem = GC.GetTotalMemory(false); + mem = GC.GetTotalMemory(false); if(mem > results.MaxMemory) results.MaxMemory = mem; if(mem < results.MinMemory) results.MinMemory = mem; - start = DateTime.Now; + start = DateTime.Now; InitProgress(); for(int i = 0; i < bufferSize / blockSize; i++) { @@ -442,15 +442,15 @@ namespace DiscImageChef.Core EndProgress(); ctx.End(); - end = DateTime.Now; - mem = GC.GetTotalMemory(false); + end = DateTime.Now; + mem = GC.GetTotalMemory(false); if(mem > results.MaxMemory) results.MaxMemory = mem; if(mem < results.MinMemory) results.MinMemory = mem; results.Entries.Add("SHA256", new BenchmarkEntry { - TimeSpan = (end - start).TotalSeconds, + TimeSpan = (end - start).TotalSeconds, Speed = bufferSize / 1048576.0 / (end - start).TotalSeconds }); results.SeparateTime += (end - start).TotalSeconds; @@ -459,10 +459,10 @@ namespace DiscImageChef.Core #region SHA384 ctx = new Sha384Context(); ms.Seek(0, SeekOrigin.Begin); - mem = GC.GetTotalMemory(false); + mem = GC.GetTotalMemory(false); if(mem > results.MaxMemory) results.MaxMemory = mem; if(mem < results.MinMemory) results.MinMemory = mem; - start = DateTime.Now; + start = DateTime.Now; InitProgress(); for(int i = 0; i < bufferSize / blockSize; i++) { @@ -474,15 +474,15 @@ namespace DiscImageChef.Core EndProgress(); ctx.End(); - end = DateTime.Now; - mem = GC.GetTotalMemory(false); + end = DateTime.Now; + mem = GC.GetTotalMemory(false); if(mem > results.MaxMemory) results.MaxMemory = mem; if(mem < results.MinMemory) results.MinMemory = mem; results.Entries.Add("SHA384", new BenchmarkEntry { - TimeSpan = (end - start).TotalSeconds, + TimeSpan = (end - start).TotalSeconds, Speed = bufferSize / 1048576.0 / (end - start).TotalSeconds }); results.SeparateTime += (end - start).TotalSeconds; @@ -491,10 +491,10 @@ namespace DiscImageChef.Core #region SHA512 ctx = new Sha512Context(); ms.Seek(0, SeekOrigin.Begin); - mem = GC.GetTotalMemory(false); + mem = GC.GetTotalMemory(false); if(mem > results.MaxMemory) results.MaxMemory = mem; if(mem < results.MinMemory) results.MinMemory = mem; - start = DateTime.Now; + start = DateTime.Now; InitProgress(); for(int i = 0; i < bufferSize / blockSize; i++) { @@ -506,15 +506,15 @@ namespace DiscImageChef.Core EndProgress(); ctx.End(); - end = DateTime.Now; - mem = GC.GetTotalMemory(false); + end = DateTime.Now; + mem = GC.GetTotalMemory(false); if(mem > results.MaxMemory) results.MaxMemory = mem; if(mem < results.MinMemory) results.MinMemory = mem; results.Entries.Add("SHA512", new BenchmarkEntry { - TimeSpan = (end - start).TotalSeconds, + TimeSpan = (end - start).TotalSeconds, Speed = bufferSize / 1048576.0 / (end - start).TotalSeconds }); results.SeparateTime += (end - start).TotalSeconds; @@ -523,10 +523,10 @@ namespace DiscImageChef.Core #region SpamSum ctx = new SpamSumContext(); ms.Seek(0, SeekOrigin.Begin); - mem = GC.GetTotalMemory(false); + mem = GC.GetTotalMemory(false); if(mem > results.MaxMemory) results.MaxMemory = mem; if(mem < results.MinMemory) results.MinMemory = mem; - start = DateTime.Now; + start = DateTime.Now; InitProgress(); for(int i = 0; i < bufferSize / blockSize; i++) { @@ -538,15 +538,15 @@ namespace DiscImageChef.Core EndProgress(); ctx.End(); - end = DateTime.Now; - mem = GC.GetTotalMemory(false); + end = DateTime.Now; + mem = GC.GetTotalMemory(false); if(mem > results.MaxMemory) results.MaxMemory = mem; if(mem < results.MinMemory) results.MinMemory = mem; results.Entries.Add("SpamSum", new BenchmarkEntry { - TimeSpan = (end - start).TotalSeconds, + TimeSpan = (end - start).TotalSeconds, Speed = bufferSize / 1048576.0 / (end - start).TotalSeconds }); results.SeparateTime += (end - start).TotalSeconds; @@ -555,10 +555,10 @@ namespace DiscImageChef.Core #region Entropy ulong[] entTable = new ulong[256]; ms.Seek(0, SeekOrigin.Begin); - mem = GC.GetTotalMemory(false); + mem = GC.GetTotalMemory(false); if(mem > results.MaxMemory) results.MaxMemory = mem; if(mem < results.MinMemory) results.MinMemory = mem; - start = DateTime.Now; + start = DateTime.Now; InitProgress(); for(int i = 0; i < bufferSize / blockSize; i++) { @@ -570,15 +570,16 @@ namespace DiscImageChef.Core EndProgress(); - end = DateTime.Now; - mem = GC.GetTotalMemory(false); + end = DateTime.Now; + mem = GC.GetTotalMemory(false); if(mem > results.MaxMemory) results.MaxMemory = mem; if(mem < results.MinMemory) results.MinMemory = mem; - results.EntropyTime = (end - start).TotalSeconds; + results.EntropyTime = (end - start).TotalSeconds; results.EntropySpeed = bufferSize / 1048576.0 / (end - start).TotalSeconds; #endregion Entropy -/* + + /* #region Multitasking start = DateTime.Now; Checksum allChecksums = new Checksum(); @@ -604,7 +605,7 @@ namespace DiscImageChef.Core results.TotalTime = (end - start).TotalSeconds; results.TotalSpeed = bufferSize / 1048576.0 / results.TotalTime; #endregion -*/ + */ results.SeparateSpeed = bufferSize / 1048576.0 / results.SeparateTime; return results; diff --git a/DiscImageChef.Core/Checksum.cs b/DiscImageChef.Core/Checksum.cs index e6f5f8ea0..e46cd92f2 100644 --- a/DiscImageChef.Core/Checksum.cs +++ b/DiscImageChef.Core/Checksum.cs @@ -54,7 +54,8 @@ namespace DiscImageChef.Core SpamSum = 1024, Fletcher16 = 2048, Fletcher32 = 4096, - All = Adler32 | Crc16 | Crc32 | Crc64 | Md5 | Ripemd160 | Sha1 | Sha256 | Sha384 | Sha512 | SpamSum | Fletcher16 | Fletcher32 + All = Adler32 | Crc16 | Crc32 | Crc64 | Md5 | Ripemd160 | Sha1 | Sha256 | Sha384 | Sha512 | SpamSum | + Fletcher16 | Fletcher32 } /// @@ -75,6 +76,12 @@ namespace DiscImageChef.Core HashPacket crc64Pkt; Thread crc64Thread; EnableChecksum enabled; + IChecksum f16Ctx; + HashPacket f16Pkt; + Thread f16Thread; + IChecksum f32Ctx; + HashPacket f32Pkt; + Thread f32Thread; IChecksum md5Ctx; HashPacket md5Pkt; Thread md5Thread; @@ -96,12 +103,6 @@ namespace DiscImageChef.Core HashPacket spamsumPkt; Thread spamsumThread; IChecksum ssctx; - HashPacket f16Pkt; - Thread f16Thread; - IChecksum f16Ctx; - HashPacket f32Pkt; - Thread f32Thread; - IChecksum f32Ctx; public Checksum(EnableChecksum enabled = EnableChecksum.All) { @@ -196,8 +197,8 @@ namespace DiscImageChef.Core sha384Thread = new Thread(UpdateHash); sha512Thread = new Thread(UpdateHash); spamsumThread = new Thread(UpdateHash); - f16Thread = new Thread(UpdateHash); - f32Thread = new Thread(UpdateHash); + f16Thread = new Thread(UpdateHash); + f32Thread = new Thread(UpdateHash); } public void Update(byte[] data) @@ -280,9 +281,10 @@ namespace DiscImageChef.Core f32Thread.Start(f32Pkt); } - while(adlerThread.IsAlive || crc16Thread.IsAlive || crc32Thread.IsAlive || crc64Thread.IsAlive || - md5Thread.IsAlive || ripemd160Thread.IsAlive || sha1Thread.IsAlive || sha256Thread.IsAlive || - sha384Thread.IsAlive || sha512Thread.IsAlive || spamsumThread.IsAlive || f16Thread.IsAlive || f32Thread.IsAlive) { } + while(adlerThread.IsAlive || crc16Thread.IsAlive || crc32Thread.IsAlive || crc64Thread.IsAlive || + md5Thread.IsAlive || ripemd160Thread.IsAlive || sha1Thread.IsAlive || sha256Thread.IsAlive || + sha384Thread.IsAlive || sha512Thread.IsAlive || spamsumThread.IsAlive || f16Thread.IsAlive || + f32Thread.IsAlive) { } if(enabled.HasFlag(EnableChecksum.SpamSum)) adlerThread = new Thread(UpdateHash); if(enabled.HasFlag(EnableChecksum.SpamSum)) crc16Thread = new Thread(UpdateHash); @@ -295,8 +297,8 @@ namespace DiscImageChef.Core if(enabled.HasFlag(EnableChecksum.SpamSum)) sha384Thread = new Thread(UpdateHash); if(enabled.HasFlag(EnableChecksum.SpamSum)) sha512Thread = new Thread(UpdateHash); if(enabled.HasFlag(EnableChecksum.SpamSum)) spamsumThread = new Thread(UpdateHash); - if(enabled.HasFlag(EnableChecksum.SpamSum)) f16Thread = new Thread(UpdateHash); - if(enabled.HasFlag(EnableChecksum.SpamSum)) f32Thread = new Thread(UpdateHash); + if(enabled.HasFlag(EnableChecksum.SpamSum)) f16Thread = new Thread(UpdateHash); + if(enabled.HasFlag(EnableChecksum.SpamSum)) f32Thread = new Thread(UpdateHash); } public List End() @@ -398,8 +400,8 @@ namespace DiscImageChef.Core IChecksum sha384CtxData = null; IChecksum sha512CtxData = null; IChecksum ssctxData = null; - IChecksum f16CtxData = null; - IChecksum f32CtxData = null; + IChecksum f16CtxData = null; + IChecksum f32CtxData = null; Thread adlerThreadData = new Thread(UpdateHash); Thread crc16ThreadData = new Thread(UpdateHash); @@ -412,104 +414,105 @@ namespace DiscImageChef.Core Thread sha384ThreadData = new Thread(UpdateHash); Thread sha512ThreadData = new Thread(UpdateHash); Thread spamsumThreadData = new Thread(UpdateHash); - Thread f16ThreadData = new Thread(UpdateHash); - Thread f32ThreadData = new Thread(UpdateHash); + Thread f16ThreadData = new Thread(UpdateHash); + Thread f32ThreadData = new Thread(UpdateHash); if(enabled.HasFlag(EnableChecksum.SpamSum)) { - adler32CtxData = new Adler32Context(); + adler32CtxData = new Adler32Context(); HashPacket adlerPktData = new HashPacket {Context = adler32CtxData, Data = data}; adlerThreadData.Start(adlerPktData); } if(enabled.HasFlag(EnableChecksum.SpamSum)) { - crc16CtxData = new Crc16Context(); + crc16CtxData = new Crc16Context(); HashPacket crc16PktData = new HashPacket {Context = crc16CtxData, Data = data}; crc16ThreadData.Start(crc16PktData); } if(enabled.HasFlag(EnableChecksum.SpamSum)) { - crc32CtxData = new Crc32Context(); + crc32CtxData = new Crc32Context(); HashPacket crc32PktData = new HashPacket {Context = crc32CtxData, Data = data}; crc32ThreadData.Start(crc32PktData); } if(enabled.HasFlag(EnableChecksum.SpamSum)) { - crc64CtxData = new Crc64Context(); + crc64CtxData = new Crc64Context(); HashPacket crc64PktData = new HashPacket {Context = crc64CtxData, Data = data}; crc64ThreadData.Start(crc64PktData); } if(enabled.HasFlag(EnableChecksum.SpamSum)) { - md5CtxData = new Md5Context(); + md5CtxData = new Md5Context(); HashPacket md5PktData = new HashPacket {Context = md5CtxData, Data = data}; md5ThreadData.Start(md5PktData); } if(enabled.HasFlag(EnableChecksum.SpamSum)) { - ripemd160CtxData = new Ripemd160Context(); + ripemd160CtxData = new Ripemd160Context(); HashPacket ripemd160PktData = new HashPacket {Context = ripemd160CtxData, Data = data}; ripemd160ThreadData.Start(ripemd160PktData); } if(enabled.HasFlag(EnableChecksum.SpamSum)) { - sha1CtxData = new Sha1Context(); + sha1CtxData = new Sha1Context(); HashPacket sha1PktData = new HashPacket {Context = sha1CtxData, Data = data}; sha1ThreadData.Start(sha1PktData); } if(enabled.HasFlag(EnableChecksum.SpamSum)) { - sha256CtxData = new Sha256Context(); + sha256CtxData = new Sha256Context(); HashPacket sha256PktData = new HashPacket {Context = sha256CtxData, Data = data}; sha256ThreadData.Start(sha256PktData); } if(enabled.HasFlag(EnableChecksum.SpamSum)) { - sha384CtxData = new Sha384Context(); + sha384CtxData = new Sha384Context(); HashPacket sha384PktData = new HashPacket {Context = sha384CtxData, Data = data}; sha384ThreadData.Start(sha384PktData); } if(enabled.HasFlag(EnableChecksum.SpamSum)) { - sha512CtxData = new Sha512Context(); + sha512CtxData = new Sha512Context(); HashPacket sha512PktData = new HashPacket {Context = sha512CtxData, Data = data}; sha512ThreadData.Start(sha512PktData); } if(enabled.HasFlag(EnableChecksum.SpamSum)) { - ssctxData = new SpamSumContext(); + ssctxData = new SpamSumContext(); HashPacket spamsumPktData = new HashPacket {Context = ssctxData, Data = data}; spamsumThreadData.Start(spamsumPktData); } if(enabled.HasFlag(EnableChecksum.Fletcher16)) { - f16CtxData = new Fletcher16Context(); + f16CtxData = new Fletcher16Context(); HashPacket f16PktData = new HashPacket {Context = f16CtxData, Data = data}; f16ThreadData.Start(f16PktData); } if(enabled.HasFlag(EnableChecksum.Fletcher32)) { - f32CtxData = new Fletcher32Context(); + f32CtxData = new Fletcher32Context(); HashPacket f32PktData = new HashPacket {Context = f32CtxData, Data = data}; f32ThreadData.Start(f32PktData); } - - while(adlerThreadData.IsAlive || crc16ThreadData.IsAlive || crc32ThreadData.IsAlive || - crc64ThreadData.IsAlive || md5ThreadData.IsAlive || ripemd160ThreadData.IsAlive || - sha1ThreadData.IsAlive || sha256ThreadData.IsAlive || sha384ThreadData.IsAlive || - sha512ThreadData.IsAlive || spamsumThreadData.IsAlive || f16ThreadData.IsAlive || f32ThreadData.IsAlive) { } + + while(adlerThreadData.IsAlive || crc16ThreadData.IsAlive || crc32ThreadData.IsAlive || + crc64ThreadData.IsAlive || md5ThreadData.IsAlive || ripemd160ThreadData.IsAlive || + sha1ThreadData.IsAlive || sha256ThreadData.IsAlive || sha384ThreadData.IsAlive || + sha512ThreadData.IsAlive || spamsumThreadData.IsAlive || f16ThreadData.IsAlive || + f32ThreadData.IsAlive) { } List dataChecksums = new List(); ChecksumType chk; diff --git a/DiscImageChef.Core/DataFile.cs b/DiscImageChef.Core/DataFile.cs index d63ed6c96..3947fe13f 100644 --- a/DiscImageChef.Core/DataFile.cs +++ b/DiscImageChef.Core/DataFile.cs @@ -180,12 +180,13 @@ namespace DiscImageChef.Core /// What is the data about? /// If set to true overwrites the file, does nothing otherwise public static void WriteTo(string who, string filename, byte[] data, string whatWriting = null, - bool overwrite = false) + bool overwrite = false) { if(string.IsNullOrEmpty(filename)) return; if(File.Exists(filename)) - if(overwrite) File.Delete(filename); + if(overwrite) + File.Delete(filename); else { DicConsole.ErrorWriteLine("Not overwriting file {0}", filename); diff --git a/DiscImageChef.Core/Delegates.cs b/DiscImageChef.Core/Delegates.cs index 1c96e2944..bff038f23 100644 --- a/DiscImageChef.Core/Delegates.cs +++ b/DiscImageChef.Core/Delegates.cs @@ -81,7 +81,7 @@ namespace DiscImageChef.Core /// Updates two progress indicators with text /// public delegate void UpdateTwoProgressHandler(string text, long current, long maximum, string text2, long current2, - long maximum2); + long maximum2); /// /// Pulses a progress indicator with indeterminate boundaries diff --git a/DiscImageChef.Core/Devices/Dumping/CompactDisc.cs b/DiscImageChef.Core/Devices/Dumping/CompactDisc.cs index 4050266d3..66bd43321 100644 --- a/DiscImageChef.Core/Devices/Dumping/CompactDisc.cs +++ b/DiscImageChef.Core/Devices/Dumping/CompactDisc.cs @@ -814,9 +814,9 @@ namespace DiscImageChef.Core.Devices.Dumping // If a subchannel is supported, check if output plugin allows us to write it. if(supportedSubchannel != MmcSubchannel.None) { - dev.ReadCd(out readBuffer, out senseBuf, 0, blockSize, 1, MmcSectorTypes.AllTypes, false, false, - true, MmcHeaderCodes.AllHeaders, true, true, MmcErrorField.None, supportedSubchannel, - dev.Timeout, out _); + dev.ReadCd(out readBuffer, out senseBuf, 0, blockSize, 1, MmcSectorTypes.AllTypes, false, false, true, + MmcHeaderCodes.AllHeaders, true, true, MmcErrorField.None, supportedSubchannel, dev.Timeout, + out _); byte[] tmpBuf = new byte[subSize]; Array.Copy(readBuffer, SECTOR_SIZE, tmpBuf, 0, subSize); @@ -1031,14 +1031,11 @@ namespace DiscImageChef.Core.Devices.Dumping DicConsole.Write("\rTrimming sector {0}", badSector); double cmdDuration = 0; - + if(readcd) - { sense = dev.ReadCd(out readBuffer, out senseBuf, (uint)badSector, blockSize, 1, MmcSectorTypes.AllTypes, false, false, true, MmcHeaderCodes.AllHeaders, true, - true, MmcErrorField.None, supportedSubchannel, dev.Timeout, - out cmdDuration); - } + true, MmcErrorField.None, supportedSubchannel, dev.Timeout, out cmdDuration); else if(read16) sense = dev.Read16(out readBuffer, out senseBuf, 0, false, true, false, badSector, blockSize, 0, blocksToRead, false, dev.Timeout, out cmdDuration); diff --git a/DiscImageChef.Core/Devices/Dumping/MMC.cs b/DiscImageChef.Core/Devices/Dumping/MMC.cs index 25b03bc49..ee28b274d 100644 --- a/DiscImageChef.Core/Devices/Dumping/MMC.cs +++ b/DiscImageChef.Core/Devices/Dumping/MMC.cs @@ -203,7 +203,7 @@ namespace DiscImageChef.Core.Devices.Dumping } Reader scsiReader = new Reader(dev, dev.Timeout, null, dumpRaw); - ulong blocks = scsiReader.GetDeviceBlocks(); + ulong blocks = scsiReader.GetDeviceBlocks(); dumpLog.WriteLine("Device reports disc has {0} blocks", blocks); Dictionary mediaTags = new Dictionary(); diff --git a/DiscImageChef.Core/Devices/Dumping/NVMe.cs b/DiscImageChef.Core/Devices/Dumping/NVMe.cs index da2e07b7f..eeb945ece 100644 --- a/DiscImageChef.Core/Devices/Dumping/NVMe.cs +++ b/DiscImageChef.Core/Devices/Dumping/NVMe.cs @@ -43,14 +43,15 @@ namespace DiscImageChef.Core.Devices.Dumping { public static class NvMe { - public static void Dump(Device dev, string devicePath, IWritableImage outputPlugin, ushort retryPasses, - bool force, bool dumpRaw, bool persistent, bool stopOnError, - ref Resume resume, - ref - DumpLog dumpLog, Encoding encoding, string outputPrefix, - string outputPath, - Dictionary - formatOptions, CICMMetadataType preSidecar, uint skip, bool nometadata, bool notrim) + public static void Dump(Device dev, string devicePath, + IWritableImage outputPlugin, ushort retryPasses, + bool force, bool dumpRaw, + bool persistent, bool stopOnError, ref Resume resume, + ref DumpLog dumpLog, Encoding encoding, + string outputPrefix, string outputPath, + Dictionary formatOptions, CICMMetadataType preSidecar, + uint skip, + bool nometadata, bool notrim) { throw new NotImplementedException("NVMe devices not yet supported."); } diff --git a/DiscImageChef.Core/Devices/Dumping/ResumeSupport.cs b/DiscImageChef.Core/Devices/Dumping/ResumeSupport.cs index 0e8db09f8..2dc60926f 100644 --- a/DiscImageChef.Core/Devices/Dumping/ResumeSupport.cs +++ b/DiscImageChef.Core/Devices/Dumping/ResumeSupport.cs @@ -63,11 +63,10 @@ namespace DiscImageChef.Core.Devices.Dumping /// If the provided resume does not correspond with the current in /// progress dump /// - internal static void Process(bool isLba, bool removable, ulong blocks, - string manufacturer, string model, - string serial, PlatformID platform, ref Resume resume, - ref DumpHardwareType currentTry, - ref ExtentsULong extents) + internal static void Process(bool isLba, bool removable, ulong blocks, + string manufacturer, string model, + string serial, PlatformID platform, ref Resume resume, + ref DumpHardwareType currentTry, ref ExtentsULong extents) { if(resume != null) { diff --git a/DiscImageChef.Core/Devices/Dumping/SBC.cs b/DiscImageChef.Core/Devices/Dumping/SBC.cs index 89e3b132b..2ef552b42 100644 --- a/DiscImageChef.Core/Devices/Dumping/SBC.cs +++ b/DiscImageChef.Core/Devices/Dumping/SBC.cs @@ -107,8 +107,8 @@ namespace DiscImageChef.Core.Devices.Dumping dumpLog.WriteLine("Initializing reader."); Reader scsiReader = new Reader(dev, dev.Timeout, null, dumpRaw); - ulong blocks = scsiReader.GetDeviceBlocks(); - uint blockSize = scsiReader.LogicalBlockSize; + ulong blocks = scsiReader.GetDeviceBlocks(); + uint blockSize = scsiReader.LogicalBlockSize; if(scsiReader.FindReadCommand()) { dumpLog.WriteLine("ERROR: Cannot find correct read command: {0}.", scsiReader.ErrorMessage); @@ -131,8 +131,8 @@ namespace DiscImageChef.Core.Devices.Dumping return; } - uint blocksToRead = scsiReader.BlocksToRead; - uint logicalBlockSize = blockSize; + uint blocksToRead = scsiReader.BlocksToRead; + uint logicalBlockSize = blockSize; uint physicalBlockSize = scsiReader.PhysicalBlockSize; if(blocks == 0) @@ -460,45 +460,39 @@ namespace DiscImageChef.Core.Devices.Dumping if(persistent) { Modes.ModePage_01_MMC pgMmc; - Modes.ModePage_01 pg; - + Modes.ModePage_01 pg; + sense = dev.ModeSense6(out readBuffer, out _, false, ScsiModeSensePageControl.Current, 0x01, dev.Timeout, out _); if(sense) { - sense = dev.ModeSense10(out readBuffer, out _, false, ScsiModeSensePageControl.Current, - 0x01, dev.Timeout, out _); + sense = dev.ModeSense10(out readBuffer, out _, false, ScsiModeSensePageControl.Current, 0x01, + dev.Timeout, out _); if(!sense) { - Modes.DecodedMode? dcMode10 = - Modes.DecodeMode10(readBuffer, dev.ScsiType); - + Modes.DecodedMode? dcMode10 = Modes.DecodeMode10(readBuffer, dev.ScsiType); + if(dcMode10.HasValue) - { foreach(Modes.ModePage modePage in dcMode10.Value.Pages) - if(modePage.Page == 0x01 && modePage.Subpage == 0x00) currentModePage = modePage; - } + if(modePage.Page == 0x01 && modePage.Subpage == 0x00) + currentModePage = modePage; } } else { - Modes.DecodedMode? dcMode6 = - Modes.DecodeMode6(readBuffer, dev.ScsiType); + Modes.DecodedMode? dcMode6 = Modes.DecodeMode6(readBuffer, dev.ScsiType); if(dcMode6.HasValue) - { foreach(Modes.ModePage modePage in dcMode6.Value.Pages) if(modePage.Page == 0x01 && modePage.Subpage == 0x00) currentModePage = modePage; - } } if(currentModePage == null) { if(dev.ScsiType == PeripheralDeviceTypes.MultiMediaDevice) { - pgMmc = new Modes.ModePage_01_MMC {PS = false, ReadRetryCount = 32, Parameter = 0x00}; currentModePage = new Modes.ModePage { @@ -522,21 +516,19 @@ namespace DiscImageChef.Core.Devices.Dumping DCR = false, ReadRetryCount = 32 }; - - currentModePage = - new Modes.ModePage - { - Page = 0x01, - Subpage = 0x00, - PageResponse = Modes.EncodeModePage_01(pg) - } ; + + currentModePage = new Modes.ModePage + { + Page = 0x01, + Subpage = 0x00, + PageResponse = Modes.EncodeModePage_01(pg) + }; } } if(dev.ScsiType == PeripheralDeviceTypes.MultiMediaDevice) { - pgMmc = - new Modes.ModePage_01_MMC {PS = false, ReadRetryCount = 255, Parameter = 0x20}; + pgMmc = new Modes.ModePage_01_MMC {PS = false, ReadRetryCount = 255, Parameter = 0x20}; Modes.DecodedMode md = new Modes.DecodedMode { Header = new Modes.ModeHeader(), diff --git a/DiscImageChef.Core/Devices/Dumping/SSC.cs b/DiscImageChef.Core/Devices/Dumping/SSC.cs index a237a76cc..eb4e704a2 100644 --- a/DiscImageChef.Core/Devices/Dumping/SSC.cs +++ b/DiscImageChef.Core/Devices/Dumping/SSC.cs @@ -58,9 +58,9 @@ namespace DiscImageChef.Core.Devices.Dumping /// Prefix for output data files /// Information for dump resuming /// Dump logger - internal static void Dump(Device dev, string outputPrefix, string devicePath, ref Resume resume, - ref DumpLog dumpLog, - CICMMetadataType preSidecar) + internal static void Dump(Device dev, string outputPrefix, string devicePath, + ref Resume resume, + ref DumpLog dumpLog, CICMMetadataType preSidecar) { FixedSense? fxSense; bool aborted; @@ -107,13 +107,13 @@ namespace DiscImageChef.Core.Devices.Dumping fxSense = Sense.DecodeFixed(senseBuf, out strSense); } while(fxSense.HasValue && fxSense.Value.ASC == 0x00 && - (fxSense.Value.ASCQ == 0x1A || fxSense.Value.ASCQ != 0x04)); + (fxSense.Value.ASCQ == 0x1A || fxSense.Value.ASCQ != 0x04)); dev.RequestSense(out senseBuf, dev.Timeout, out duration); fxSense = Sense.DecodeFixed(senseBuf, out strSense); // And yet, did not rewind! - if(fxSense.HasValue && + if(fxSense.HasValue && (fxSense.Value.ASC == 0x00 && fxSense.Value.ASCQ != 0x04 || fxSense.Value.ASC != 0x00)) { DicConsole.WriteLine(); @@ -138,7 +138,7 @@ namespace DiscImageChef.Core.Devices.Dumping // Anyway, <=SCSI-1 tapes do not support partitions fxSense = Sense.DecodeFixed(senseBuf, out strSense); - if(fxSense.HasValue && (fxSense.Value.ASC == 0x20 && fxSense.Value.ASCQ != 0x00 || + if(fxSense.HasValue && (fxSense.Value.ASC == 0x20 && fxSense.Value.ASCQ != 0x00 || fxSense.Value.ASC != 0x20 && fxSense.Value.SenseKey != SenseKeys.IllegalRequest)) { @@ -180,7 +180,7 @@ namespace DiscImageChef.Core.Devices.Dumping fxSense = Sense.DecodeFixed(senseBuf, out strSense); } while(fxSense.HasValue && fxSense.Value.ASC == 0x00 && - (fxSense.Value.ASCQ == 0x1A || fxSense.Value.ASCQ == 0x19)); + (fxSense.Value.ASCQ == 0x1A || fxSense.Value.ASCQ == 0x19)); // And yet, did not rewind! if(fxSense.HasValue && (fxSense.Value.ASC == 0x00 && fxSense.Value.ASCQ != 0x04 || @@ -220,8 +220,8 @@ namespace DiscImageChef.Core.Devices.Dumping } } - sidecar.BlockMedia = new BlockMediaType[1]; - sidecar.BlockMedia[0] = new BlockMediaType {SCSI = new SCSIType()}; + sidecar.BlockMedia = new BlockMediaType[1]; + sidecar.BlockMedia[0] = new BlockMediaType {SCSI = new SCSIType()}; byte scsiMediumTypeTape = 0; byte scsiDensityCodeTape = 0; @@ -237,7 +237,7 @@ namespace DiscImageChef.Core.Devices.Dumping if(!sense && !dev.Error) if(Modes.DecodeMode10(cmdBuf, dev.ScsiType).HasValue) { - decMode = Modes.DecodeMode10(cmdBuf, dev.ScsiType); + decMode = Modes.DecodeMode10(cmdBuf, dev.ScsiType); sidecar.BlockMedia[0].SCSI.ModeSense10 = new DumpType { Image = outputPrefix + ".modesense10.bin", @@ -258,7 +258,7 @@ namespace DiscImageChef.Core.Devices.Dumping if(!sense && !dev.Error) if(Modes.DecodeMode6(cmdBuf, dev.ScsiType).HasValue) { - decMode = Modes.DecodeMode6(cmdBuf, dev.ScsiType); + decMode = Modes.DecodeMode6(cmdBuf, dev.ScsiType); sidecar.BlockMedia[0].SCSI.ModeSense = new DumpType { Image = outputPrefix + ".modesense.bin", @@ -274,7 +274,7 @@ namespace DiscImageChef.Core.Devices.Dumping scsiMediumTypeTape = (byte)decMode.Value.Header.MediumType; if(decMode.Value.Header.BlockDescriptors != null && decMode.Value.Header.BlockDescriptors.Length >= 1) scsiDensityCodeTape = (byte)decMode.Value.Header.BlockDescriptors[0].Density; - blockSize = decMode.Value.Header.BlockDescriptors[0].BlockLength; + blockSize = decMode.Value.Header.BlockDescriptors[0].BlockLength; dumpLog.WriteLine("Device reports {0} blocks ({1} bytes).", blocks, blocks * blockSize); } else blockSize = 1; @@ -328,8 +328,8 @@ namespace DiscImageChef.Core.Devices.Dumping 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(); @@ -382,9 +382,9 @@ namespace DiscImageChef.Core.Devices.Dumping DicConsole.WriteLine(); DataFile dumpFile = new DataFile(outputPrefix + ".bin"); Checksum dataChk = new Checksum(); - start = DateTime.UtcNow; - MhddLog mhddLog = new MhddLog(outputPrefix + ".mhddlog.bin", dev, blocks, blockSize, 1); - IbgLog ibgLog = new IbgLog(outputPrefix + ".ibg", 0x0008); + start = DateTime.UtcNow; + MhddLog mhddLog = new MhddLog(outputPrefix + ".mhddlog.bin", dev, blocks, blockSize, 1); + IbgLog ibgLog = new IbgLog(outputPrefix + ".ibg", 0x0008); TapeFileType currentTapeFile = new TapeFileType { @@ -399,7 +399,7 @@ namespace DiscImageChef.Core.Devices.Dumping StartBlock = (long)currentBlock, BlockSize = blockSize }; - Checksum fileChk = new Checksum(); + Checksum fileChk = new Checksum(); TapePartitionType currentTapePartition = new TapePartitionType { Image = new ImageType @@ -454,9 +454,9 @@ namespace DiscImageChef.Core.Devices.Dumping StartBlock = (long)currentBlock, BlockSize = blockSize }; - currentFileSize = 0; - fileChk = new Checksum(); - files = new List(); + currentFileSize = 0; + fileChk = new Checksum(); + files = new List(); currentTapePartition = new TapePartitionType { Image = new ImageType @@ -524,37 +524,33 @@ namespace DiscImageChef.Core.Devices.Dumping continue; } - if(fxSense.Value.SenseKey == SenseKeys.BlankCheck) + switch(fxSense.Value.SenseKey) { - if(currentBlock == 0) - { + case SenseKeys.BlankCheck when currentBlock == 0: DicConsole.WriteLine(); DicConsole.ErrorWriteLine("Cannot dump a blank tape..."); dumpFile.Close(); dumpLog.WriteLine("Cannot dump a blank tape..."); return; - } - // 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)) - { + case SenseKeys.BlankCheck when fxSense.Value.ASC == 0x00 && + (fxSense.Value.ASCQ == 0x02 || fxSense.Value.ASCQ == 0x05 || + fxSense.Value.EOM): // TODO: Detect end of partition endOfMedia = true; dumpLog.WriteLine("Found end-of-tape/partition..."); continue; - } - - DicConsole.WriteLine(); - DicConsole.WriteLine("Blank block found, end of tape?"); - endOfMedia = true; - dumpLog.WriteLine("Blank block found, end of tape?..."); - continue; + case SenseKeys.BlankCheck: + DicConsole.WriteLine(); + DicConsole.WriteLine("Blank block found, end of tape?"); + endOfMedia = true; + dumpLog.WriteLine("Blank block found, end of tape?..."); + continue; } if((fxSense.Value.SenseKey == SenseKeys.NoSense || fxSense.Value.SenseKey == SenseKeys.RecoveredError) && - (fxSense.Value.ASCQ == 0x02 || fxSense.Value.ASCQ == 0x05 || fxSense.Value.EOM)) + (fxSense.Value.ASCQ == 0x02 || fxSense.Value.ASCQ == 0x05 || fxSense.Value.EOM)) { // TODO: Detect end of partition endOfMedia = true; @@ -564,7 +560,7 @@ namespace DiscImageChef.Core.Devices.Dumping if((fxSense.Value.SenseKey == SenseKeys.NoSense || fxSense.Value.SenseKey == SenseKeys.RecoveredError) && - (fxSense.Value.ASCQ == 0x01 || fxSense.Value.Filemark)) + (fxSense.Value.ASCQ == 0x01 || fxSense.Value.Filemark)) { currentTapeFile.Checksums = fileChk.End().ToArray(); currentTapeFile.EndBlock = (long)(currentBlock - 1); @@ -614,7 +610,7 @@ namespace DiscImageChef.Core.Devices.Dumping partitionChk.Update(cmdBuf); DateTime chkEnd = DateTime.UtcNow; double chkDuration = (chkEnd - chkStart).TotalMilliseconds; - totalChkDuration += chkDuration; + totalChkDuration += chkDuration; if(currentBlock % 10 == 0) { @@ -633,10 +629,9 @@ namespace DiscImageChef.Core.Devices.Dumping end = DateTime.UtcNow; mhddLog.Close(); ibgLog.Close(dev, blocks, blockSize, (end - start).TotalSeconds, currentSpeed * 1024, - blockSize * (double)(blocks + 1) / - 1024 / (totalDuration / 1000), devicePath); - dumpLog.WriteLine("Dump finished in {0} seconds.", - (end - start).TotalSeconds); + 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.", @@ -660,13 +655,13 @@ namespace DiscImageChef.Core.Devices.Dumping format = "Raw disk image (sector by sector copy)", Value = outputPrefix + ".bin" }; - 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].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].Manufacturer = dev.Manufacturer; sidecar.BlockMedia[0].DumpHardwareArray[0].Model = dev.Model; sidecar.BlockMedia[0].DumpHardwareArray[0].Revision = dev.Revision; diff --git a/DiscImageChef.Core/Devices/Dumping/XGD.cs b/DiscImageChef.Core/Devices/Dumping/XGD.cs index 972f717a1..b84ed11f6 100644 --- a/DiscImageChef.Core/Devices/Dumping/XGD.cs +++ b/DiscImageChef.Core/Devices/Dumping/XGD.cs @@ -149,7 +149,8 @@ namespace DiscImageChef.Core.Devices.Dumping return; } - ulong totalSize = (ulong)((readBuffer[0] << 24) + (readBuffer[1] << 16) + (readBuffer[2] << 8) + readBuffer[3]); + ulong 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 _); @@ -164,7 +165,8 @@ namespace DiscImageChef.Core.Devices.Dumping Array.Copy(readBuffer, 4, tmpBuf, 0, readBuffer.Length - 4); mediaTags.Add(MediaTagType.DVD_PFI, tmpBuf); DicConsole.DebugWriteLine("Dump-media command", "Video partition total size: {0} sectors", totalSize); - ulong l0Video = PFI.Decode(readBuffer).Value.Layer0EndPSN - PFI.Decode(readBuffer).Value.DataAreaStartPSN + 1; + ulong l0Video = PFI.Decode(readBuffer).Value.Layer0EndPSN - PFI.Decode(readBuffer).Value.DataAreaStartPSN + + 1; ulong l1Video = totalSize - l0Video + 1; dumpLog.WriteLine("Reading Disc Manufacturing Information."); sense = dev.ReadDiscStructure(out readBuffer, out senseBuf, MmcDiscStructureMediaType.Dvd, 0, 0, @@ -200,8 +202,8 @@ namespace DiscImageChef.Core.Devices.Dumping return; } - ulong gameSize = (ulong)((readBuffer[0] << 24) + (readBuffer[1] << 16) + (readBuffer[2] << 8) + readBuffer[3]) + - 1; + ulong 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 @@ -237,9 +239,10 @@ namespace DiscImageChef.Core.Devices.Dumping DicConsole.DebugWriteLine("Dump-media command", "Unlocked total size: {0} sectors", totalSize); ulong blocks = totalSize + 1; - ulong middleZone = totalSize - (PFI.Decode(readBuffer).Value.Layer0EndPSN - - PFI.Decode(readBuffer).Value.DataAreaStartPSN + - 1) - gameSize + 1; + ulong middleZone = + totalSize - (PFI.Decode(readBuffer).Value.Layer0EndPSN - + PFI.Decode(readBuffer).Value.DataAreaStartPSN + + 1) - gameSize + 1; tmpBuf = new byte[readBuffer.Length - 4]; Array.Copy(readBuffer, 4, tmpBuf, 0, readBuffer.Length - 4); @@ -259,7 +262,7 @@ namespace DiscImageChef.Core.Devices.Dumping Array.Copy(readBuffer, 4, tmpBuf, 0, readBuffer.Length - 4); mediaTags.Add(MediaTagType.Xbox_DMI, tmpBuf); - totalSize = l0Video + l1Video + middleZone * 2 + gameSize; + totalSize = l0Video + l1Video + middleZone * 2 + gameSize; ulong layerBreak = l0Video + middleZone + gameSize / 2; DicConsole.WriteLine("Video layer 0 size: {0} sectors", l0Video); @@ -705,24 +708,23 @@ namespace DiscImageChef.Core.Devices.Dumping if(persistent) { Modes.ModePage_01_MMC pgMmc; - + sense = dev.ModeSense6(out readBuffer, out _, false, ScsiModeSensePageControl.Current, 0x01, dev.Timeout, out _); if(sense) { - sense = dev.ModeSense10(out readBuffer, out _, false, ScsiModeSensePageControl.Current, - 0x01, dev.Timeout, out _); + sense = dev.ModeSense10(out readBuffer, out _, false, ScsiModeSensePageControl.Current, 0x01, + dev.Timeout, out _); if(!sense) { Modes.DecodedMode? dcMode10 = Modes.DecodeMode10(readBuffer, PeripheralDeviceTypes.MultiMediaDevice); - + if(dcMode10.HasValue) - { foreach(Modes.ModePage modePage in dcMode10.Value.Pages) - if(modePage.Page == 0x01 && modePage.Subpage == 0x00) currentModePage = modePage; - } + if(modePage.Page == 0x01 && modePage.Subpage == 0x00) + currentModePage = modePage; } } else @@ -731,18 +733,14 @@ namespace DiscImageChef.Core.Devices.Dumping Modes.DecodeMode6(readBuffer, PeripheralDeviceTypes.MultiMediaDevice); if(dcMode6.HasValue) - { foreach(Modes.ModePage modePage in dcMode6.Value.Pages) if(modePage.Page == 0x01 && modePage.Subpage == 0x00) currentModePage = modePage; - } } if(currentModePage == null) { - - pgMmc = - new Modes.ModePage_01_MMC {PS = false, ReadRetryCount = 0x20, Parameter = 0x00}; + pgMmc = new Modes.ModePage_01_MMC {PS = false, ReadRetryCount = 0x20, Parameter = 0x00}; currentModePage = new Modes.ModePage { Page = 0x01, @@ -750,9 +748,8 @@ namespace DiscImageChef.Core.Devices.Dumping PageResponse = Modes.EncodeModePage_01_MMC(pgMmc) }; } - - pgMmc = - new Modes.ModePage_01_MMC {PS = false, ReadRetryCount = 255, Parameter = 0x20}; + + pgMmc = new Modes.ModePage_01_MMC {PS = false, ReadRetryCount = 255, Parameter = 0x20}; Modes.DecodedMode md = new Modes.DecodedMode { Header = new Modes.ModeHeader(), @@ -782,7 +779,7 @@ namespace DiscImageChef.Core.Devices.Dumping } else runningPersistent = true; } - + repeatRetry: ulong[] tmpArray = resume.BadBlocks.ToArray(); foreach(ulong badSector in tmpArray) diff --git a/DiscImageChef.Core/Devices/Reader.cs b/DiscImageChef.Core/Devices/Reader.cs index 5f25ad640..a76a81954 100644 --- a/DiscImageChef.Core/Devices/Reader.cs +++ b/DiscImageChef.Core/Devices/Reader.cs @@ -42,34 +42,34 @@ namespace DiscImageChef.Core.Devices partial class Reader { Device dev; - uint timeout; + uint timeout; internal Reader(Device dev, uint timeout, byte[] identification, bool raw = false) { - this.dev = dev; + this.dev = dev; this.timeout = timeout; BlocksToRead = 64; - CanReadRaw = raw; + CanReadRaw = raw; switch(dev.Type) { case DeviceType.ATA: Identify.IdentifyDevice? ataIdNullable = Identify.Decode(identification); - if(ataIdNullable.HasValue) ataId = ataIdNullable.Value; + if(ataIdNullable.HasValue) ataId = ataIdNullable.Value; break; case DeviceType.NVMe: throw new NotImplementedException("NVMe devices not yet supported."); } } - internal string ErrorMessage { get; private set; } - internal ulong Blocks { get; private set; } - internal uint BlocksToRead { get; private set; } - internal uint LogicalBlockSize { get; private set; } - internal uint PhysicalBlockSize { get; private set; } - internal uint LongBlockSize { get; private set; } - internal bool CanReadRaw { get; private set; } - internal bool CanSeek => ataSeek || seek6 || seek10; - internal bool CanSeekLba => ataSeekLba || seek6 || seek10; + internal string ErrorMessage { get; private set; } + internal ulong Blocks { get; private set; } + internal uint BlocksToRead { get; private set; } + internal uint LogicalBlockSize { get; private set; } + internal uint PhysicalBlockSize { get; private set; } + internal uint LongBlockSize { get; private set; } + internal bool CanReadRaw { get; private set; } + internal bool CanSeek => ataSeek || seek6 || seek10; + internal bool CanSeekLba => ataSeekLba || seek6 || seek10; internal ulong GetDeviceBlocks() { @@ -141,7 +141,7 @@ namespace DiscImageChef.Core.Devices case DeviceType.ATAPI: case DeviceType.SCSI: return ScsiReadBlocks(out buffer, block, count, out duration); default: - buffer = null; + buffer = null; duration = 0d; return true; } @@ -153,7 +153,7 @@ namespace DiscImageChef.Core.Devices { case DeviceType.ATA: return AtaReadChs(out buffer, cylinder, head, sector, out duration); default: - buffer = null; + buffer = null; duration = 0d; return true; } diff --git a/DiscImageChef.Core/Devices/ReaderATA.cs b/DiscImageChef.Core/Devices/ReaderATA.cs index c3768ff82..23aa16646 100644 --- a/DiscImageChef.Core/Devices/ReaderATA.cs +++ b/DiscImageChef.Core/Devices/ReaderATA.cs @@ -40,23 +40,23 @@ namespace DiscImageChef.Core.Devices partial class Reader { Identify.IdentifyDevice ataId; - bool ataRead; - bool ataReadDma; - bool ataReadDmaLba; - bool ataReadDmaLba48; - bool ataReadDmaRetry; - bool ataReadDmaRetryLba; - bool ataReadLba; - bool ataReadLba48; - bool ataReadRetry; - bool ataReadRetryLba; - bool ataSeek; - bool ataSeekLba; + bool ataRead; + bool ataReadDma; + bool ataReadDmaLba; + bool ataReadDmaLba48; + bool ataReadDmaRetry; + bool ataReadDmaRetryLba; + bool ataReadLba; + bool ataReadLba48; + bool ataReadRetry; + bool ataReadRetryLba; + bool ataSeek; + bool ataSeekLba; - internal bool IsLba { get; private set; } + internal bool IsLba { get; private set; } internal ushort Cylinders { get; private set; } - internal byte Heads { get; private set; } - internal byte Sectors { get; private set; } + internal byte Heads { get; private set; } + internal byte Sectors { get; private set; } (uint, byte, byte) GetDeviceChs() { @@ -65,19 +65,20 @@ namespace DiscImageChef.Core.Devices if(ataId.CurrentCylinders > 0 && ataId.CurrentHeads > 0 && ataId.CurrentSectorsPerTrack > 0) { Cylinders = ataId.CurrentCylinders; - Heads = (byte)ataId.CurrentHeads; - Sectors = (byte)ataId.CurrentSectorsPerTrack; - Blocks = (ulong)(Cylinders * Heads * Sectors); + Heads = (byte)ataId.CurrentHeads; + Sectors = (byte)ataId.CurrentSectorsPerTrack; + Blocks = (ulong)(Cylinders * Heads * Sectors); } if(ataId.CurrentCylinders != 0 && ataId.CurrentHeads != 0 && ataId.CurrentSectorsPerTrack != 0 || - ataId.Cylinders <= 0 || ataId.Heads <= 0 || + ataId.Cylinders <= 0 || + ataId.Heads <= 0 || ataId.SectorsPerTrack <= 0) return (Cylinders, Heads, Sectors); Cylinders = ataId.Cylinders; - Heads = (byte)ataId.Heads; - Sectors = (byte)ataId.SectorsPerTrack; - Blocks = (ulong)(Cylinders * Heads * Sectors); + Heads = (byte)ataId.Heads; + Sectors = (byte)ataId.SectorsPerTrack; + Blocks = (ulong)(Cylinders * Heads * Sectors); return (Cylinders, Heads, Sectors); } @@ -89,13 +90,13 @@ namespace DiscImageChef.Core.Devices if(ataId.Capabilities.HasFlag(Identify.CapabilitiesBit.LBASupport)) { Blocks = ataId.LBASectors; - IsLba = true; + IsLba = true; } if(!ataId.CommandSet2.HasFlag(Identify.CommandSetBit2.LBA48)) return Blocks; Blocks = ataId.LBA48Sectors; - IsLba = true; + IsLba = true; return Blocks; } @@ -104,31 +105,31 @@ namespace DiscImageChef.Core.Devices { bool sense = dev.Read(out byte[] cmdBuf, out AtaErrorRegistersChs errorChs, false, 0, 0, 1, 1, timeout, out _); - ataRead = !sense && (errorChs.Status & 0x27) == 0 && errorChs.Error == 0 && cmdBuf.Length > 0; - sense = dev.Read(out cmdBuf, out errorChs, true, 0, 0, 1, 1, timeout, out _); - ataReadRetry = !sense && (errorChs.Status & 0x27) == 0 && errorChs.Error == 0 && cmdBuf.Length > 0; - sense = dev.ReadDma(out cmdBuf, out errorChs, false, 0, 0, 1, 1, timeout, out _); - ataReadDma = !sense && (errorChs.Status & 0x27) == 0 && errorChs.Error == 0 && cmdBuf.Length > 0; - sense = dev.ReadDma(out cmdBuf, out errorChs, true, 0, 0, 1, 1, timeout, out _); + ataRead = !sense && (errorChs.Status & 0x27) == 0 && errorChs.Error == 0 && cmdBuf.Length > 0; + sense = dev.Read(out cmdBuf, out errorChs, true, 0, 0, 1, 1, timeout, out _); + ataReadRetry = !sense && (errorChs.Status & 0x27) == 0 && errorChs.Error == 0 && cmdBuf.Length > 0; + sense = dev.ReadDma(out cmdBuf, out errorChs, false, 0, 0, 1, 1, timeout, out _); + ataReadDma = !sense && (errorChs.Status & 0x27) == 0 && errorChs.Error == 0 && cmdBuf.Length > 0; + sense = dev.ReadDma(out cmdBuf, out errorChs, true, 0, 0, 1, 1, timeout, out _); ataReadDmaRetry = !sense && (errorChs.Status & 0x27) == 0 && errorChs.Error == 0 && cmdBuf.Length > 0; - sense = dev.Read(out cmdBuf, out AtaErrorRegistersLba28 errorLba, false, 0, 1, timeout, out _); - ataReadLba = !sense && (errorLba.Status & 0x27) == 0 && errorLba.Error == 0 && cmdBuf.Length > 0; - sense = dev.Read(out cmdBuf, out errorLba, true, 0, 1, timeout, out _); - ataReadRetryLba = !sense && (errorLba.Status & 0x27) == 0 && errorLba.Error == 0 && cmdBuf.Length > 0; - sense = dev.ReadDma(out cmdBuf, out errorLba, false, 0, 1, timeout, out _); - ataReadDmaLba = !sense && (errorLba.Status & 0x27) == 0 && errorLba.Error == 0 && cmdBuf.Length > 0; - sense = dev.ReadDma(out cmdBuf, out errorLba, true, 0, 1, timeout, out _); + sense = dev.Read(out cmdBuf, out AtaErrorRegistersLba28 errorLba, false, 0, 1, timeout, out _); + ataReadLba = !sense && (errorLba.Status & 0x27) == 0 && errorLba.Error == 0 && cmdBuf.Length > 0; + sense = dev.Read(out cmdBuf, out errorLba, true, 0, 1, timeout, out _); + ataReadRetryLba = !sense && (errorLba.Status & 0x27) == 0 && errorLba.Error == 0 && cmdBuf.Length > 0; + sense = dev.ReadDma(out cmdBuf, out errorLba, false, 0, 1, timeout, out _); + ataReadDmaLba = !sense && (errorLba.Status & 0x27) == 0 && errorLba.Error == 0 && cmdBuf.Length > 0; + sense = dev.ReadDma(out cmdBuf, out errorLba, true, 0, 1, timeout, out _); ataReadDmaRetryLba = !sense && (errorLba.Status & 0x27) == 0 && errorLba.Error == 0 && cmdBuf.Length > 0; - sense = dev.Read(out cmdBuf, out AtaErrorRegistersLba48 errorLba48, 0, 1, timeout, out _); - ataReadLba48 = !sense && (errorLba48.Status & 0x27) == 0 && errorLba48.Error == 0 && cmdBuf.Length > 0; - sense = dev.ReadDma(out cmdBuf, out errorLba48, 0, 1, timeout, out _); + sense = dev.Read(out cmdBuf, out AtaErrorRegistersLba48 errorLba48, 0, 1, timeout, out _); + ataReadLba48 = !sense && (errorLba48.Status & 0x27) == 0 && errorLba48.Error == 0 && cmdBuf.Length > 0; + sense = dev.ReadDma(out cmdBuf, out errorLba48, 0, 1, timeout, out _); ataReadDmaLba48 = !sense && (errorLba48.Status & 0x27) == 0 && errorLba48.Error == 0 && cmdBuf.Length > 0; - sense = dev.Seek(out errorChs, 0, 0, 1, timeout, out _); - ataSeek = !sense && (errorChs.Status & 0x27) == 0 && errorChs.Error == 0; - sense = dev.Seek(out errorLba, 0, timeout, out _); + sense = dev.Seek(out errorChs, 0, 0, 1, timeout, out _); + ataSeek = !sense && (errorChs.Status & 0x27) == 0 && errorChs.Error == 0; + sense = dev.Seek(out errorLba, 0, timeout, out _); ataSeekLba = !sense && (errorLba.Status & 0x27) == 0 && errorChs.Error == 0; if(IsLba) @@ -178,17 +179,19 @@ namespace DiscImageChef.Core.Devices if((ataId.PhysLogSectorSize & 0x8000) == 0x0000 && (ataId.PhysLogSectorSize & 0x4000) == 0x4000) { if((ataId.PhysLogSectorSize & 0x1000) == 0x1000) - if(ataId.LogicalSectorWords <= 255 || ataId.LogicalAlignment == 0xFFFF) LogicalBlockSize = 512; - else LogicalBlockSize = ataId.LogicalSectorWords * 2; + if(ataId.LogicalSectorWords <= 255 || ataId.LogicalAlignment == 0xFFFF) + LogicalBlockSize = 512; + else + LogicalBlockSize = ataId.LogicalSectorWords * 2; else LogicalBlockSize = 512; if((ataId.PhysLogSectorSize & 0x2000) == 0x2000) - PhysicalBlockSize = LogicalBlockSize * (uint)Math.Pow(2, ataId.PhysLogSectorSize & 0xF); + PhysicalBlockSize = LogicalBlockSize * (uint)Math.Pow(2, ataId.PhysLogSectorSize & 0xF); else PhysicalBlockSize = LogicalBlockSize; } else { - LogicalBlockSize = 512; + LogicalBlockSize = 512; PhysicalBlockSize = 512; } @@ -212,8 +215,8 @@ namespace DiscImageChef.Core.Devices while(IsLba) { - byte[] cmdBuf; - bool sense; + byte[] cmdBuf; + bool sense; AtaErrorRegistersLba48 errorLba48; if(ataReadDmaLba48) { @@ -264,54 +267,56 @@ namespace DiscImageChef.Core.Devices bool AtaReadBlocks(out byte[] buffer, ulong block, uint count, out double duration) { - bool error = true; - bool sense; + bool error = true; + bool sense; AtaErrorRegistersLba28 errorLba; AtaErrorRegistersLba48 errorLba48; - byte status = 0, errorByte = 0; - buffer = null; + byte status = 0, errorByte = 0; + buffer = null; duration = 0; if(ataReadDmaLba48) { - sense = dev.ReadDma(out buffer, out errorLba48, block, (byte)count, timeout, out duration); - error = !(!sense && (errorLba48.Status & 0x27) == 0 && errorLba48.Error == 0 && buffer.Length > 0); - status = errorLba48.Status; + sense = dev.ReadDma(out buffer, out errorLba48, block, (byte)count, timeout, out duration); + error = !(!sense && (errorLba48.Status & 0x27) == 0 && errorLba48.Error == 0 && buffer.Length > 0); + status = errorLba48.Status; errorByte = errorLba48.Error; } else if(ataReadLba48) { - sense = dev.Read(out buffer, out errorLba48, block, (byte)count, timeout, out duration); - error = !(!sense && (errorLba48.Status & 0x27) == 0 && errorLba48.Error == 0 && buffer.Length > 0); - status = errorLba48.Status; + sense = dev.Read(out buffer, out errorLba48, block, (byte)count, timeout, out duration); + error = !(!sense && (errorLba48.Status & 0x27) == 0 && errorLba48.Error == 0 && buffer.Length > 0); + status = errorLba48.Status; errorByte = errorLba48.Error; } else if(ataReadDmaRetryLba) { - sense = dev.ReadDma(out buffer, out errorLba, true, (uint)block, (byte)count, timeout, out duration); - error = !(!sense && (errorLba.Status & 0x27) == 0 && errorLba.Error == 0 && buffer.Length > 0); - status = errorLba.Status; + sense = dev.ReadDma(out buffer, out errorLba, true, (uint)block, (byte)count, timeout, + out duration); + error = !(!sense && (errorLba.Status & 0x27) == 0 && errorLba.Error == 0 && buffer.Length > 0); + status = errorLba.Status; errorByte = errorLba.Error; } else if(ataReadDmaLba) { - sense = dev.ReadDma(out buffer, out errorLba, false, (uint)block, (byte)count, timeout, out duration); - error = !(!sense && (errorLba.Status & 0x27) == 0 && errorLba.Error == 0 && buffer.Length > 0); - status = errorLba.Status; + sense = dev.ReadDma(out buffer, out errorLba, false, (uint)block, (byte)count, timeout, + out duration); + error = !(!sense && (errorLba.Status & 0x27) == 0 && errorLba.Error == 0 && buffer.Length > 0); + status = errorLba.Status; errorByte = errorLba.Error; } else if(ataReadRetryLba) { - sense = dev.Read(out buffer, out errorLba, true, (uint)block, (byte)count, timeout, out duration); - error = !(!sense && (errorLba.Status & 0x27) == 0 && errorLba.Error == 0 && buffer.Length > 0); - status = errorLba.Status; + sense = dev.Read(out buffer, out errorLba, true, (uint)block, (byte)count, timeout, out duration); + error = !(!sense && (errorLba.Status & 0x27) == 0 && errorLba.Error == 0 && buffer.Length > 0); + status = errorLba.Status; errorByte = errorLba.Error; } else if(ataReadLba) { - sense = dev.Read(out buffer, out errorLba, false, (uint)block, (byte)count, timeout, out duration); - error = !(!sense && (errorLba.Status & 0x27) == 0 && errorLba.Error == 0 && buffer.Length > 0); - status = errorLba.Status; + sense = dev.Read(out buffer, out errorLba, false, (uint)block, (byte)count, timeout, out duration); + error = !(!sense && (errorLba.Status & 0x27) == 0 && errorLba.Error == 0 && buffer.Length > 0); + status = errorLba.Status; errorByte = errorLba.Error; } @@ -322,39 +327,41 @@ namespace DiscImageChef.Core.Devices bool AtaReadChs(out byte[] buffer, ushort cylinder, byte head, byte sectir, out double duration) { - bool error = true; - bool sense; + bool error = true; + bool sense; AtaErrorRegistersChs errorChs; - byte status = 0, errorByte = 0; - buffer = null; + byte status = 0, errorByte = 0; + buffer = null; duration = 0; if(ataReadDmaRetry) { - sense = dev.ReadDma(out buffer, out errorChs, true, cylinder, head, sectir, 1, timeout, out duration); - error = !(!sense && (errorChs.Status & 0x27) == 0 && errorChs.Error == 0 && buffer.Length > 0); - status = errorChs.Status; + sense = dev.ReadDma(out buffer, out errorChs, true, cylinder, head, sectir, 1, timeout, + out duration); + error = !(!sense && (errorChs.Status & 0x27) == 0 && errorChs.Error == 0 && buffer.Length > 0); + status = errorChs.Status; errorByte = errorChs.Error; } else if(ataReadDma) { - sense = dev.ReadDma(out buffer, out errorChs, false, cylinder, head, sectir, 1, timeout, out duration); - error = !(!sense && (errorChs.Status & 0x27) == 0 && errorChs.Error == 0 && buffer.Length > 0); - status = errorChs.Status; + sense = dev.ReadDma(out buffer, out errorChs, false, cylinder, head, sectir, 1, timeout, + out duration); + error = !(!sense && (errorChs.Status & 0x27) == 0 && errorChs.Error == 0 && buffer.Length > 0); + status = errorChs.Status; errorByte = errorChs.Error; } else if(ataReadRetry) { - sense = dev.Read(out buffer, out errorChs, true, cylinder, head, sectir, 1, timeout, out duration); - error = !(!sense && (errorChs.Status & 0x27) == 0 && errorChs.Error == 0 && buffer.Length > 0); - status = errorChs.Status; + sense = dev.Read(out buffer, out errorChs, true, cylinder, head, sectir, 1, timeout, out duration); + error = !(!sense && (errorChs.Status & 0x27) == 0 && errorChs.Error == 0 && buffer.Length > 0); + status = errorChs.Status; errorByte = errorChs.Error; } else if(ataRead) { - sense = dev.Read(out buffer, out errorChs, false, cylinder, head, sectir, 1, timeout, out duration); - error = !(!sense && (errorChs.Status & 0x27) == 0 && errorChs.Error == 0 && buffer.Length > 0); - status = errorChs.Status; + sense = dev.Read(out buffer, out errorChs, false, cylinder, head, sectir, 1, timeout, out duration); + error = !(!sense && (errorChs.Status & 0x27) == 0 && errorChs.Error == 0 && buffer.Length > 0); + status = errorChs.Status; errorByte = errorChs.Error; } diff --git a/DiscImageChef.Core/Devices/ReaderSCSI.cs b/DiscImageChef.Core/Devices/ReaderSCSI.cs index 260deb143..c53a17618 100644 --- a/DiscImageChef.Core/Devices/ReaderSCSI.cs +++ b/DiscImageChef.Core/Devices/ReaderSCSI.cs @@ -128,7 +128,7 @@ namespace DiscImageChef.Core.Devices decSense = Sense.DecodeFixed(senseBuf); if(decSense.HasValue) if(decSense.Value.SenseKey == SenseKeys.IllegalRequest && decSense.Value.ASC == 0x24 && - decSense.Value.ASCQ == 0x00) + decSense.Value.ASCQ == 0x00) { CanReadRaw = true; if(decSense.Value.InformationValid && decSense.Value.ILI) @@ -156,9 +156,9 @@ namespace DiscImageChef.Core.Devices testSense = dev.ReadLong16(out _, out senseBuf, false, 0, testSize, timeout, out _); if(!testSense && !dev.Error) { - readLong16 = true; + readLong16 = true; LongBlockSize = testSize; - CanReadRaw = true; + CanReadRaw = true; break; } @@ -166,9 +166,9 @@ namespace DiscImageChef.Core.Devices out _); if(testSense || dev.Error) continue; - readLong10 = true; + readLong10 = true; LongBlockSize = testSize; - CanReadRaw = true; + CanReadRaw = true; break; } else if(LogicalBlockSize == 1024) @@ -184,9 +184,9 @@ namespace DiscImageChef.Core.Devices testSense = dev.ReadLong16(out _, out senseBuf, false, 0, testSize, timeout, out _); if(!testSense && !dev.Error) { - readLong16 = true; + readLong16 = true; LongBlockSize = testSize; - CanReadRaw = true; + CanReadRaw = true; break; } @@ -194,9 +194,9 @@ namespace DiscImageChef.Core.Devices out _); if(testSense || dev.Error) continue; - readLong10 = true; + readLong10 = true; LongBlockSize = testSize; - CanReadRaw = true; + CanReadRaw = true; break; } else if(LogicalBlockSize == 2048) @@ -204,18 +204,18 @@ namespace DiscImageChef.Core.Devices testSense = dev.ReadLong16(out _, out senseBuf, false, 0, 2380, timeout, out _); if(!testSense && !dev.Error) { - readLong16 = true; + readLong16 = true; LongBlockSize = 2380; - CanReadRaw = true; + CanReadRaw = true; } else { testSense = dev.ReadLong10(out _, out senseBuf, false, false, 0, 2380, timeout, out _); if(!testSense && !dev.Error) { - readLong10 = true; + readLong10 = true; LongBlockSize = 2380; - CanReadRaw = true; + CanReadRaw = true; } } } @@ -224,18 +224,18 @@ namespace DiscImageChef.Core.Devices testSense = dev.ReadLong16(out _, out senseBuf, false, 0, 4760, timeout, out _); if(!testSense && !dev.Error) { - readLong16 = true; + readLong16 = true; LongBlockSize = 4760; - CanReadRaw = true; + CanReadRaw = true; } else { testSense = dev.ReadLong10(out _, out senseBuf, false, false, 0, 4760, timeout, out _); if(!testSense && !dev.Error) { - readLong10 = true; + readLong10 = true; LongBlockSize = 4760; - CanReadRaw = true; + CanReadRaw = true; } } } @@ -244,18 +244,18 @@ namespace DiscImageChef.Core.Devices testSense = dev.ReadLong16(out _, out senseBuf, false, 0, 9424, timeout, out _); if(!testSense && !dev.Error) { - readLong16 = true; + readLong16 = true; LongBlockSize = 9424; - CanReadRaw = true; + CanReadRaw = true; } else { testSense = dev.ReadLong10(out _, out senseBuf, false, false, 0, 9424, timeout, out _); if(!testSense && !dev.Error) { - readLong10 = true; + readLong10 = true; LongBlockSize = 9424; - CanReadRaw = true; + CanReadRaw = true; } } } @@ -268,7 +268,7 @@ namespace DiscImageChef.Core.Devices decSense = Sense.DecodeFixed(senseBuf); if(decSense.HasValue) if(decSense.Value.SenseKey == SenseKeys.IllegalRequest && decSense.Value.ASC == 0x24 && - decSense.Value.ASCQ == 0x00) + decSense.Value.ASCQ == 0x00) { CanReadRaw = true; if(decSense.Value.InformationValid && decSense.Value.ILI) @@ -287,7 +287,8 @@ namespace DiscImageChef.Core.Devices decSense = Sense.DecodeFixed(senseBuf); if(decSense.HasValue) if(decSense.Value.SenseKey == SenseKeys.IllegalRequest && - decSense.Value.ASC == 0x24 && decSense.Value.ASCQ == 0x00) + decSense.Value.ASC == 0x24 && + decSense.Value.ASCQ == 0x00) { CanReadRaw = true; if(decSense.Value.InformationValid && decSense.Value.ILI) @@ -307,9 +308,9 @@ namespace DiscImageChef.Core.Devices testSense = dev.SyQuestReadLong6(out _, out senseBuf, 0, 262, timeout, out _); if(!testSense && !dev.Error) { - syqReadLong6 = true; + syqReadLong6 = true; LongBlockSize = 262; - CanReadRaw = true; + CanReadRaw = true; } } } @@ -328,7 +329,7 @@ namespace DiscImageChef.Core.Devices if(hldtstReadRaw || plextorReadRaw) { - CanReadRaw = true; + CanReadRaw = true; LongBlockSize = 2064; } @@ -338,9 +339,9 @@ namespace DiscImageChef.Core.Devices testSense = dev.ReadLong10(out _, out senseBuf, false, false, 0, 37856, timeout, out _); if(!testSense && !dev.Error) { - readLongDvd = true; + readLongDvd = true; LongBlockSize = 37856; - CanReadRaw = true; + CanReadRaw = true; } } } @@ -371,8 +372,8 @@ namespace DiscImageChef.Core.Devices sense = dev.ReadCapacity(out byte[] cmdBuf, out byte[] senseBuf, timeout, out _); if(!sense) { - Blocks = (ulong)((cmdBuf[0] << 24) + (cmdBuf[1] << 16) + (cmdBuf[2] << 8) + cmdBuf[3]); - LogicalBlockSize = (uint)((cmdBuf[5] << 24) + (cmdBuf[5] << 16) + (cmdBuf[6] << 8) + cmdBuf[7]); + Blocks = (ulong)((cmdBuf[0] << 24) + (cmdBuf[1] << 16) + (cmdBuf[2] << 8) + cmdBuf[3]); + LogicalBlockSize = (uint)((cmdBuf[5] << 24) + (cmdBuf[5] << 16) + (cmdBuf[6] << 8) + cmdBuf[7]); } if(sense || Blocks == 0xFFFFFFFF) @@ -393,13 +394,13 @@ namespace DiscImageChef.Core.Devices Array.Copy(cmdBuf, 0, temp, 0, 8); Array.Reverse(temp); - Blocks = BitConverter.ToUInt64(temp, 0); + Blocks = BitConverter.ToUInt64(temp, 0); LogicalBlockSize = (uint)((cmdBuf[5] << 24) + (cmdBuf[5] << 16) + (cmdBuf[6] << 8) + cmdBuf[7]); } } PhysicalBlockSize = LogicalBlockSize; - LongBlockSize = LogicalBlockSize; + LongBlockSize = LogicalBlockSize; return false; } @@ -445,9 +446,9 @@ namespace DiscImageChef.Core.Devices bool ScsiReadBlocks(out byte[] buffer, ulong block, uint count, out double duration) { - bool sense; + bool sense; byte[] senseBuf; - buffer = null; + buffer = null; duration = 0; if(CanReadRaw) @@ -498,7 +499,7 @@ namespace DiscImageChef.Core.Devices bool sense = true; duration = 0; - if(seek6) sense = dev.Seek6(out _, (uint)block, timeout, out duration); + if(seek6) sense = dev.Seek6(out _, (uint)block, timeout, out duration); else if(seek10) sense = dev.Seek10(out _, (uint)block, timeout, out duration); return sense; diff --git a/DiscImageChef.Core/Devices/Report/ATA.cs b/DiscImageChef.Core/Devices/Report/ATA.cs index d1f06a804..7ad2270f7 100644 --- a/DiscImageChef.Core/Devices/Report/ATA.cs +++ b/DiscImageChef.Core/Devices/Report/ATA.cs @@ -666,7 +666,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) { mediaTest.SolidStateDevice = true; @@ -685,14 +685,13 @@ namespace DiscImageChef.Core.Devices.Report if((ataId.PhysLogSectorSize & 0x8000) == 0x0000 && (ataId.PhysLogSectorSize & 0x4000) == 0x4000) { if((ataId.PhysLogSectorSize & 0x1000) == 0x1000) - if(ataId.LogicalSectorWords <= 255 || ataId.LogicalAlignment == 0xFFFF) + 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) + if((ataId.PhysLogSectorSize & 0x2000) == 0x2000) physicalsectorsize = (uint)(logicalsectorsize * ((1 << ataId.PhysLogSectorSize) & 0xF)); else physicalsectorsize = logicalsectorsize; @@ -724,7 +723,7 @@ namespace DiscImageChef.Core.Devices.Report mediaTest.LongBlockSizeSpecified = true; } - if(ataId.UnformattedBPS > logicalsectorsize && + if(ataId.UnformattedBPS > logicalsectorsize && (!mediaTest.LongBlockSizeSpecified || mediaTest.LongBlockSize == 516)) { mediaTest.LongBlockSize = ataId.UnformattedBPS; @@ -779,8 +778,7 @@ namespace DiscImageChef.Core.Devices.Report "_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 _); + sense = dev.Read(out readBuf, out errorChs, true, 0, 0, 1, 1, TIMEOUT, out _); mediaTest.SupportsReadRetry = !sense && (errorChs.Status & 0x01) != 0x01 && errorChs.Error == 0 && readBuf.Length > 0; DicConsole.DebugWriteLine("ATA Report", @@ -791,8 +789,7 @@ namespace DiscImageChef.Core.Devices.Report "_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 _); + sense = dev.ReadDma(out readBuf, out errorChs, false, 0, 0, 1, 1, TIMEOUT, out _); mediaTest.SupportsReadDma = !sense && (errorChs.Status & 0x01) != 0x01 && errorChs.Error == 0 && readBuf.Length > 0; DicConsole.DebugWriteLine("ATA Report", @@ -803,8 +800,7 @@ namespace DiscImageChef.Core.Devices.Report "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 _); + sense = dev.ReadDma(out readBuf, out errorChs, true, 0, 0, 1, 1, TIMEOUT, out _); mediaTest.SupportsReadDmaRetry = !sense && (errorChs.Status & 0x01) != 0x01 && errorChs.Error == 0 && readBuf.Length > 0; @@ -822,8 +818,7 @@ namespace DiscImageChef.Core.Devices.Report sense, errorChs.Status, errorChs.Error); DicConsole.WriteLine("Trying READ SECTOR(S) in LBA mode..."); - sense = dev.Read(out readBuf, out AtaErrorRegistersLba28 errorLba, false, 0, - 1, TIMEOUT, out _); + sense = dev.Read(out readBuf, out AtaErrorRegistersLba28 errorLba, false, 0, 1, TIMEOUT, out _); mediaTest.SupportsReadLba = !sense && (errorLba.Status & 0x01) != 0x01 && errorLba.Error == 0 && readBuf.Length > 0; DicConsole.DebugWriteLine("ATA Report", @@ -834,8 +829,7 @@ namespace DiscImageChef.Core.Devices.Report "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 _); + sense = dev.Read(out readBuf, out errorLba, true, 0, 1, TIMEOUT, out _); mediaTest.SupportsReadRetryLba = !sense && (errorLba.Status & 0x01) != 0x01 && errorLba.Error == 0 && readBuf.Length > 0; @@ -847,8 +841,7 @@ namespace DiscImageChef.Core.Devices.Report "_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 _); + sense = dev.ReadDma(out readBuf, out errorLba, false, 0, 1, TIMEOUT, out _); mediaTest.SupportsReadDmaLba = !sense && (errorLba.Status & 0x01) != 0x01 && errorLba.Error == 0 && readBuf.Length > 0; DicConsole.DebugWriteLine("ATA Report", @@ -859,8 +852,7 @@ namespace DiscImageChef.Core.Devices.Report "read results", readBuf); DicConsole.WriteLine("Trying READ DMA RETRY in LBA mode..."); - sense = - dev.ReadDma(out readBuf, out errorLba, true, 0, 1, TIMEOUT, out _); + sense = dev.ReadDma(out readBuf, out errorLba, true, 0, 1, TIMEOUT, out _); mediaTest.SupportsReadDmaRetryLba = !sense && (errorLba.Status & 0x01) != 0x01 && errorLba.Error == 0 && readBuf.Length > 0; DicConsole.DebugWriteLine("ATA Report", @@ -877,8 +869,7 @@ namespace DiscImageChef.Core.Devices.Report sense, errorChs.Status, errorChs.Error); DicConsole.WriteLine("Trying READ SECTOR(S) in LBA48 mode..."); - sense = - dev.Read(out readBuf, out AtaErrorRegistersLba48 errorLba48, 0, 1, TIMEOUT, out _); + sense = dev.Read(out readBuf, out AtaErrorRegistersLba48 errorLba48, 0, 1, TIMEOUT, out _); mediaTest.SupportsReadLba48 = !sense && (errorLba48.Status & 0x01) != 0x01 && errorLba48.Error == 0 && readBuf.Length > 0; @@ -890,7 +881,7 @@ namespace DiscImageChef.Core.Devices.Report "_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 _); + sense = dev.ReadDma(out readBuf, out errorLba48, 0, 1, TIMEOUT, out _); mediaTest.SupportsReadDmaLba48 = !sense && (errorLba48.Status & 0x01) != 0x01 && errorLba48.Error == 0 && readBuf.Length > 0; @@ -918,7 +909,7 @@ namespace DiscImageChef.Core.Devices.Report mediaTest.LongBlockSizeSpecified = true; } - if(ataId.UnformattedBPS > logicalsectorsize && + if(ataId.UnformattedBPS > logicalsectorsize && (!mediaTest.LongBlockSizeSpecified || mediaTest.LongBlockSize == 516)) { mediaTest.LongBlockSize = ataId.UnformattedBPS; @@ -1044,7 +1035,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) { report.ATA.ReadCapabilities.SolidStateDevice = true; @@ -1063,14 +1054,13 @@ namespace DiscImageChef.Core.Devices.Report if((ataId.PhysLogSectorSize & 0x8000) == 0x0000 && (ataId.PhysLogSectorSize & 0x4000) == 0x4000) { if((ataId.PhysLogSectorSize & 0x1000) == 0x1000) - if(ataId.LogicalSectorWords <= 255 || ataId.LogicalAlignment == 0xFFFF) + 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) + if((ataId.PhysLogSectorSize & 0x2000) == 0x2000) physicalsectorsize = logicalsectorsize * (uint)Math.Pow(2, ataId.PhysLogSectorSize & 0xF); else physicalsectorsize = logicalsectorsize; } @@ -1157,8 +1147,7 @@ namespace DiscImageChef.Core.Devices.Report "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 _); + sense = dev.Read(out readBuf, out errorChs, true, 0, 0, 1, 1, TIMEOUT, out _); report.ATA.ReadCapabilities.SupportsReadRetry = !sense && (errorChs.Status & 0x01) != 0x01 && errorChs.Error == 0 && readBuf.Length > 0; DicConsole.DebugWriteLine("ATA Report", @@ -1169,8 +1158,7 @@ namespace DiscImageChef.Core.Devices.Report "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 _); + sense = dev.ReadDma(out readBuf, out errorChs, false, 0, 0, 1, 1, TIMEOUT, out _); report.ATA.ReadCapabilities.SupportsReadDma = !sense && (errorChs.Status & 0x01) != 0x01 && errorChs.Error == 0 && readBuf.Length > 0; DicConsole.DebugWriteLine("ATA Report", @@ -1181,8 +1169,7 @@ namespace DiscImageChef.Core.Devices.Report readBuf); DicConsole.WriteLine("Trying READ DMA RETRY in CHS mode..."); - sense = - dev.ReadDma(out readBuf, out errorChs, true, 0, 0, 1, 1, TIMEOUT, out _); + sense = dev.ReadDma(out readBuf, out errorChs, true, 0, 0, 1, 1, TIMEOUT, out _); report.ATA.ReadCapabilities.SupportsReadDmaRetry = !sense && (errorChs.Status & 0x01) != 0x01 && errorChs.Error == 0 && readBuf.Length > 0; DicConsole.DebugWriteLine("ATA Report", @@ -1193,15 +1180,14 @@ namespace DiscImageChef.Core.Devices.Report "read results", readBuf); DicConsole.WriteLine("Trying SEEK in CHS mode..."); - sense = dev.Seek(out errorChs, 0, 0, 1, TIMEOUT, out _); + sense = dev.Seek(out errorChs, 0, 0, 1, TIMEOUT, out _); 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 AtaErrorRegistersLba28 errorLba, false, 0, 1, TIMEOUT, out _); + sense = dev.Read(out readBuf, out AtaErrorRegistersLba28 errorLba, false, 0, 1, TIMEOUT, out _); report.ATA.ReadCapabilities.SupportsReadLba = !sense && (errorLba.Status & 0x01) != 0x01 && errorLba.Error == 0 && readBuf.Length > 0; DicConsole.DebugWriteLine("ATA Report", @@ -1212,8 +1198,7 @@ namespace DiscImageChef.Core.Devices.Report readBuf); DicConsole.WriteLine("Trying READ SECTOR(S) RETRY in LBA mode..."); - sense = - dev.Read(out readBuf, out errorLba, true, 0, 1, TIMEOUT, out _); + sense = dev.Read(out readBuf, out errorLba, true, 0, 1, TIMEOUT, out _); report.ATA.ReadCapabilities.SupportsReadRetryLba = !sense && (errorLba.Status & 0x01) != 0x01 && errorLba.Error == 0 && readBuf.Length > 0; DicConsole.DebugWriteLine("ATA Report", @@ -1224,8 +1209,7 @@ namespace DiscImageChef.Core.Devices.Report "read results", readBuf); DicConsole.WriteLine("Trying READ DMA in LBA mode..."); - sense = - dev.ReadDma(out readBuf, out errorLba, false, 0, 1, TIMEOUT, out _); + sense = dev.ReadDma(out readBuf, out errorLba, false, 0, 1, TIMEOUT, out _); report.ATA.ReadCapabilities.SupportsReadDmaLba = !sense && (errorLba.Status & 0x01) != 0x01 && errorLba.Error == 0 && readBuf.Length > 0; DicConsole.DebugWriteLine("ATA Report", @@ -1236,8 +1220,7 @@ namespace DiscImageChef.Core.Devices.Report readBuf); DicConsole.WriteLine("Trying READ DMA RETRY in LBA mode..."); - sense = - dev.ReadDma(out readBuf, out errorLba, true, 0, 1, TIMEOUT, out _); + sense = dev.ReadDma(out readBuf, out errorLba, true, 0, 1, TIMEOUT, out _); report.ATA.ReadCapabilities.SupportsReadDmaRetryLba = !sense && (errorLba.Status & 0x01) != 0x01 && errorLba.Error == 0 && readBuf.Length > 0; DicConsole.DebugWriteLine("ATA Report", @@ -1248,15 +1231,14 @@ namespace DiscImageChef.Core.Devices.Report "read results", readBuf); DicConsole.WriteLine("Trying SEEK in LBA mode..."); - sense = dev.Seek(out errorLba, 0, TIMEOUT, out _); + sense = dev.Seek(out errorLba, 0, TIMEOUT, out _); 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 AtaErrorRegistersLba48 errorLba48, 0, 1, TIMEOUT, out _); + sense = dev.Read(out readBuf, out AtaErrorRegistersLba48 errorLba48, 0, 1, TIMEOUT, out _); report.ATA.ReadCapabilities.SupportsReadLba48 = !sense && (errorLba48.Status & 0x01) != 0x01 && errorLba48.Error == 0 && readBuf.Length > 0; DicConsole.DebugWriteLine("ATA Report", @@ -1267,8 +1249,7 @@ namespace DiscImageChef.Core.Devices.Report "read results", readBuf); DicConsole.WriteLine("Trying READ DMA in LBA48 mode..."); - sense = - dev.ReadDma(out readBuf, out errorLba48, 0, 1, TIMEOUT, out _); + sense = dev.ReadDma(out readBuf, out errorLba48, 0, 1, TIMEOUT, out _); report.ATA.ReadCapabilities.SupportsReadDmaLba48 = !sense && (errorLba48.Status & 0x01) != 0x01 && errorLba48.Error == 0 && readBuf.Length > 0; DicConsole.DebugWriteLine("ATA Report", diff --git a/DiscImageChef.Core/Devices/Report/ATAPI.cs b/DiscImageChef.Core/Devices/Report/ATAPI.cs index e3a3a9099..a408af1e0 100644 --- a/DiscImageChef.Core/Devices/Report/ATAPI.cs +++ b/DiscImageChef.Core/Devices/Report/ATAPI.cs @@ -69,400 +69,479 @@ namespace DiscImageChef.Core.Devices.Report if(!string.IsNullOrWhiteSpace(atapiId.AdditionalPID)) { - report.ATAPI.AdditionalPID = atapiId.AdditionalPID; + report.ATAPI.AdditionalPID = atapiId.AdditionalPID; report.ATAPI.AdditionalPIDSpecified = true; } + if(atapiId.APIOSupported != 0) { - report.ATAPI.APIOSupported = atapiId.APIOSupported; + report.ATAPI.APIOSupported = atapiId.APIOSupported; report.ATAPI.APIOSupportedSpecified = true; } + if(atapiId.ATAPIByteCount != 0) { - report.ATAPI.ATAPIByteCount = atapiId.ATAPIByteCount; + report.ATAPI.ATAPIByteCount = atapiId.ATAPIByteCount; report.ATAPI.ATAPIByteCountSpecified = true; } + if(atapiId.BufferType != 0) { - report.ATAPI.BufferType = atapiId.BufferType; + report.ATAPI.BufferType = atapiId.BufferType; report.ATAPI.BufferTypeSpecified = true; } + if(atapiId.BufferSize != 0) { - report.ATAPI.BufferSize = atapiId.BufferSize; + report.ATAPI.BufferSize = atapiId.BufferSize; report.ATAPI.BufferSizeSpecified = true; } + if(atapiId.Capabilities != 0) { - report.ATAPI.Capabilities = atapiId.Capabilities; + report.ATAPI.Capabilities = atapiId.Capabilities; report.ATAPI.CapabilitiesSpecified = true; } + if(atapiId.Capabilities2 != 0) { - report.ATAPI.Capabilities2 = atapiId.Capabilities2; + report.ATAPI.Capabilities2 = atapiId.Capabilities2; report.ATAPI.Capabilities2Specified = true; } + if(atapiId.Capabilities3 != 0) { - report.ATAPI.Capabilities3 = atapiId.Capabilities3; + report.ATAPI.Capabilities3 = atapiId.Capabilities3; report.ATAPI.Capabilities3Specified = true; } + if(atapiId.CFAPowerMode != 0) { - report.ATAPI.CFAPowerMode = atapiId.CFAPowerMode; + report.ATAPI.CFAPowerMode = atapiId.CFAPowerMode; report.ATAPI.CFAPowerModeSpecified = true; } + if(atapiId.CommandSet != 0) { - report.ATAPI.CommandSet = atapiId.CommandSet; + report.ATAPI.CommandSet = atapiId.CommandSet; report.ATAPI.CommandSetSpecified = true; } + if(atapiId.CommandSet2 != 0) { - report.ATAPI.CommandSet2 = atapiId.CommandSet2; + report.ATAPI.CommandSet2 = atapiId.CommandSet2; report.ATAPI.CommandSet2Specified = true; } + if(atapiId.CommandSet3 != 0) { - report.ATAPI.CommandSet3 = atapiId.CommandSet3; + report.ATAPI.CommandSet3 = atapiId.CommandSet3; report.ATAPI.CommandSet3Specified = true; } + if(atapiId.CommandSet4 != 0) { - report.ATAPI.CommandSet4 = atapiId.CommandSet4; + report.ATAPI.CommandSet4 = atapiId.CommandSet4; report.ATAPI.CommandSet4Specified = true; } + if(atapiId.CommandSet5 != 0) { - report.ATAPI.CommandSet5 = atapiId.CommandSet5; + report.ATAPI.CommandSet5 = atapiId.CommandSet5; report.ATAPI.CommandSet5Specified = true; } + if(atapiId.CurrentAAM != 0) { - report.ATAPI.CurrentAAM = atapiId.CurrentAAM; + report.ATAPI.CurrentAAM = atapiId.CurrentAAM; report.ATAPI.CurrentAAMSpecified = true; } + if(atapiId.CurrentAPM != 0) { - report.ATAPI.CurrentAPM = atapiId.CurrentAPM; + report.ATAPI.CurrentAPM = atapiId.CurrentAPM; report.ATAPI.CurrentAPMSpecified = true; } + if(atapiId.DataSetMgmt != 0) { - report.ATAPI.DataSetMgmt = atapiId.DataSetMgmt; + report.ATAPI.DataSetMgmt = atapiId.DataSetMgmt; report.ATAPI.DataSetMgmtSpecified = true; } + if(atapiId.DataSetMgmtSize != 0) { - report.ATAPI.DataSetMgmtSize = atapiId.DataSetMgmtSize; + report.ATAPI.DataSetMgmtSize = atapiId.DataSetMgmtSize; report.ATAPI.DataSetMgmtSizeSpecified = true; } + if(atapiId.DeviceFormFactor != 0) { - report.ATAPI.DeviceFormFactor = atapiId.DeviceFormFactor; + report.ATAPI.DeviceFormFactor = atapiId.DeviceFormFactor; report.ATAPI.DeviceFormFactorSpecified = true; } + if(atapiId.DMAActive != 0) { - report.ATAPI.DMAActive = atapiId.DMAActive; + report.ATAPI.DMAActive = atapiId.DMAActive; report.ATAPI.DMAActiveSpecified = true; } + if(atapiId.DMASupported != 0) { - report.ATAPI.DMASupported = atapiId.DMASupported; + report.ATAPI.DMASupported = atapiId.DMASupported; report.ATAPI.DMASupportedSpecified = true; } + if(atapiId.DMATransferTimingMode != 0) { - report.ATAPI.DMATransferTimingMode = atapiId.DMATransferTimingMode; + report.ATAPI.DMATransferTimingMode = atapiId.DMATransferTimingMode; report.ATAPI.DMATransferTimingModeSpecified = true; } + if(atapiId.EnhancedSecurityEraseTime != 0) { - report.ATAPI.EnhancedSecurityEraseTime = atapiId.EnhancedSecurityEraseTime; + report.ATAPI.EnhancedSecurityEraseTime = atapiId.EnhancedSecurityEraseTime; report.ATAPI.EnhancedSecurityEraseTimeSpecified = true; } + if(atapiId.EnabledCommandSet != 0) { - report.ATAPI.EnabledCommandSet = atapiId.EnabledCommandSet; + report.ATAPI.EnabledCommandSet = atapiId.EnabledCommandSet; report.ATAPI.EnabledCommandSetSpecified = true; } + if(atapiId.EnabledCommandSet2 != 0) { - report.ATAPI.EnabledCommandSet2 = atapiId.EnabledCommandSet2; + report.ATAPI.EnabledCommandSet2 = atapiId.EnabledCommandSet2; report.ATAPI.EnabledCommandSet2Specified = true; } + if(atapiId.EnabledCommandSet3 != 0) { - report.ATAPI.EnabledCommandSet3 = atapiId.EnabledCommandSet3; + report.ATAPI.EnabledCommandSet3 = atapiId.EnabledCommandSet3; report.ATAPI.EnabledCommandSet3Specified = true; } + if(atapiId.EnabledCommandSet4 != 0) { - report.ATAPI.EnabledCommandSet4 = atapiId.EnabledCommandSet4; + report.ATAPI.EnabledCommandSet4 = atapiId.EnabledCommandSet4; report.ATAPI.EnabledCommandSet4Specified = true; } + if(atapiId.EnabledSATAFeatures != 0) { - report.ATAPI.EnabledSATAFeatures = atapiId.EnabledSATAFeatures; + report.ATAPI.EnabledSATAFeatures = atapiId.EnabledSATAFeatures; report.ATAPI.EnabledSATAFeaturesSpecified = true; } + if(atapiId.ExtendedUserSectors != 0) { - report.ATAPI.ExtendedUserSectors = atapiId.ExtendedUserSectors; + report.ATAPI.ExtendedUserSectors = atapiId.ExtendedUserSectors; report.ATAPI.ExtendedUserSectorsSpecified = true; } + if(atapiId.FreeFallSensitivity != 0) { - report.ATAPI.FreeFallSensitivity = atapiId.FreeFallSensitivity; + report.ATAPI.FreeFallSensitivity = atapiId.FreeFallSensitivity; report.ATAPI.FreeFallSensitivitySpecified = true; } + if(!string.IsNullOrWhiteSpace(atapiId.FirmwareRevision)) { - report.ATAPI.FirmwareRevision = atapiId.FirmwareRevision; + report.ATAPI.FirmwareRevision = atapiId.FirmwareRevision; report.ATAPI.FirmwareRevisionSpecified = true; } + if(atapiId.GeneralConfiguration != 0) { - report.ATAPI.GeneralConfiguration = atapiId.GeneralConfiguration; + report.ATAPI.GeneralConfiguration = atapiId.GeneralConfiguration; report.ATAPI.GeneralConfigurationSpecified = true; } + if(atapiId.HardwareResetResult != 0) { - report.ATAPI.HardwareResetResult = atapiId.HardwareResetResult; + report.ATAPI.HardwareResetResult = atapiId.HardwareResetResult; report.ATAPI.HardwareResetResultSpecified = true; } + if(atapiId.InterseekDelay != 0) { - report.ATAPI.InterseekDelay = atapiId.InterseekDelay; + report.ATAPI.InterseekDelay = atapiId.InterseekDelay; report.ATAPI.InterseekDelaySpecified = true; } + if(atapiId.MajorVersion != 0) { - report.ATAPI.MajorVersion = atapiId.MajorVersion; + report.ATAPI.MajorVersion = atapiId.MajorVersion; report.ATAPI.MajorVersionSpecified = true; } + if(atapiId.MasterPasswordRevisionCode != 0) { - report.ATAPI.MasterPasswordRevisionCode = atapiId.MasterPasswordRevisionCode; + report.ATAPI.MasterPasswordRevisionCode = atapiId.MasterPasswordRevisionCode; report.ATAPI.MasterPasswordRevisionCodeSpecified = true; } + if(atapiId.MaxDownloadMicroMode3 != 0) { - report.ATAPI.MaxDownloadMicroMode3 = atapiId.MaxDownloadMicroMode3; + report.ATAPI.MaxDownloadMicroMode3 = atapiId.MaxDownloadMicroMode3; report.ATAPI.MaxDownloadMicroMode3Specified = true; } + if(atapiId.MaxQueueDepth != 0) { - report.ATAPI.MaxQueueDepth = atapiId.MaxQueueDepth; + report.ATAPI.MaxQueueDepth = atapiId.MaxQueueDepth; report.ATAPI.MaxQueueDepthSpecified = true; } + if(atapiId.MDMAActive != 0) { - report.ATAPI.MDMAActive = atapiId.MDMAActive; + report.ATAPI.MDMAActive = atapiId.MDMAActive; report.ATAPI.MDMAActiveSpecified = true; } + if(atapiId.MDMASupported != 0) { - report.ATAPI.MDMASupported = atapiId.MDMASupported; + report.ATAPI.MDMASupported = atapiId.MDMASupported; report.ATAPI.MDMASupportedSpecified = true; } + if(atapiId.MinDownloadMicroMode3 != 0) { - report.ATAPI.MinDownloadMicroMode3 = atapiId.MinDownloadMicroMode3; + report.ATAPI.MinDownloadMicroMode3 = atapiId.MinDownloadMicroMode3; report.ATAPI.MinDownloadMicroMode3Specified = true; } + if(atapiId.MinMDMACycleTime != 0) { - report.ATAPI.MinMDMACycleTime = atapiId.MinMDMACycleTime; + report.ATAPI.MinMDMACycleTime = atapiId.MinMDMACycleTime; report.ATAPI.MinMDMACycleTimeSpecified = true; } + if(atapiId.MinorVersion != 0) { - report.ATAPI.MinorVersion = atapiId.MinorVersion; + report.ATAPI.MinorVersion = atapiId.MinorVersion; report.ATAPI.MinorVersionSpecified = true; } + if(atapiId.MinPIOCycleTimeNoFlow != 0) { - report.ATAPI.MinPIOCycleTimeNoFlow = atapiId.MinPIOCycleTimeNoFlow; + report.ATAPI.MinPIOCycleTimeNoFlow = atapiId.MinPIOCycleTimeNoFlow; report.ATAPI.MinPIOCycleTimeNoFlowSpecified = true; } + if(atapiId.MinPIOCycleTimeFlow != 0) { - report.ATAPI.MinPIOCycleTimeFlow = atapiId.MinPIOCycleTimeFlow; + report.ATAPI.MinPIOCycleTimeFlow = atapiId.MinPIOCycleTimeFlow; report.ATAPI.MinPIOCycleTimeFlowSpecified = true; } + if(!string.IsNullOrWhiteSpace(atapiId.Model)) { - report.ATAPI.Model = atapiId.Model; + report.ATAPI.Model = atapiId.Model; report.ATAPI.ModelSpecified = true; } + if(atapiId.MultipleMaxSectors != 0) { - report.ATAPI.MultipleMaxSectors = atapiId.MultipleMaxSectors; + report.ATAPI.MultipleMaxSectors = atapiId.MultipleMaxSectors; report.ATAPI.MultipleMaxSectorsSpecified = true; } + if(atapiId.MultipleSectorNumber != 0) { - report.ATAPI.MultipleSectorNumber = atapiId.MultipleSectorNumber; + report.ATAPI.MultipleSectorNumber = atapiId.MultipleSectorNumber; report.ATAPI.MultipleSectorNumberSpecified = true; } + if(atapiId.NVCacheCaps != 0) { - report.ATAPI.NVCacheCaps = atapiId.NVCacheCaps; + report.ATAPI.NVCacheCaps = atapiId.NVCacheCaps; report.ATAPI.NVCacheCapsSpecified = true; } + if(atapiId.NVCacheSize != 0) { - report.ATAPI.NVCacheSize = atapiId.NVCacheSize; + report.ATAPI.NVCacheSize = atapiId.NVCacheSize; report.ATAPI.NVCacheSizeSpecified = true; } + if(atapiId.NVCacheWriteSpeed != 0) { - report.ATAPI.NVCacheWriteSpeed = atapiId.NVCacheWriteSpeed; + report.ATAPI.NVCacheWriteSpeed = atapiId.NVCacheWriteSpeed; report.ATAPI.NVCacheWriteSpeedSpecified = true; } + if(atapiId.NVEstimatedSpinUp != 0) { - report.ATAPI.NVEstimatedSpinUp = atapiId.NVEstimatedSpinUp; + report.ATAPI.NVEstimatedSpinUp = atapiId.NVEstimatedSpinUp; report.ATAPI.NVEstimatedSpinUpSpecified = true; } + if(atapiId.PacketBusRelease != 0) { - report.ATAPI.PacketBusRelease = atapiId.PacketBusRelease; + report.ATAPI.PacketBusRelease = atapiId.PacketBusRelease; report.ATAPI.PacketBusReleaseSpecified = true; } + if(atapiId.PIOTransferTimingMode != 0) { - report.ATAPI.PIOTransferTimingMode = atapiId.PIOTransferTimingMode; + report.ATAPI.PIOTransferTimingMode = atapiId.PIOTransferTimingMode; report.ATAPI.PIOTransferTimingModeSpecified = true; } + if(atapiId.RecommendedAAM != 0) { - report.ATAPI.RecommendedAAM = atapiId.RecommendedAAM; + report.ATAPI.RecommendedAAM = atapiId.RecommendedAAM; report.ATAPI.RecommendedAAMSpecified = true; } + if(atapiId.RecMDMACycleTime != 0) { - report.ATAPI.RecommendedMDMACycleTime = atapiId.RecMDMACycleTime; + report.ATAPI.RecommendedMDMACycleTime = atapiId.RecMDMACycleTime; report.ATAPI.RecommendedMDMACycleTimeSpecified = true; } + if(atapiId.RemovableStatusSet != 0) { - report.ATAPI.RemovableStatusSet = atapiId.RemovableStatusSet; + report.ATAPI.RemovableStatusSet = atapiId.RemovableStatusSet; report.ATAPI.RemovableStatusSetSpecified = true; } + if(atapiId.SATACapabilities != 0) { - report.ATAPI.SATACapabilities = atapiId.SATACapabilities; + report.ATAPI.SATACapabilities = atapiId.SATACapabilities; report.ATAPI.SATACapabilitiesSpecified = true; } + if(atapiId.SATACapabilities2 != 0) { - report.ATAPI.SATACapabilities2 = atapiId.SATACapabilities2; + report.ATAPI.SATACapabilities2 = atapiId.SATACapabilities2; report.ATAPI.SATACapabilities2Specified = true; } + if(atapiId.SATAFeatures != 0) { - report.ATAPI.SATAFeatures = atapiId.SATAFeatures; + report.ATAPI.SATAFeatures = atapiId.SATAFeatures; report.ATAPI.SATAFeaturesSpecified = true; } + if(atapiId.SCTCommandTransport != 0) { - report.ATAPI.SCTCommandTransport = atapiId.SCTCommandTransport; + report.ATAPI.SCTCommandTransport = atapiId.SCTCommandTransport; report.ATAPI.SCTCommandTransportSpecified = true; } + if(atapiId.SectorsPerCard != 0) { - report.ATAPI.SectorsPerCard = atapiId.SectorsPerCard; + report.ATAPI.SectorsPerCard = atapiId.SectorsPerCard; report.ATAPI.SectorsPerCardSpecified = true; } + if(atapiId.SecurityEraseTime != 0) { - report.ATAPI.SecurityEraseTime = atapiId.SecurityEraseTime; + report.ATAPI.SecurityEraseTime = atapiId.SecurityEraseTime; report.ATAPI.SecurityEraseTimeSpecified = true; } + if(atapiId.SecurityStatus != 0) { - report.ATAPI.SecurityStatus = atapiId.SecurityStatus; + report.ATAPI.SecurityStatus = atapiId.SecurityStatus; report.ATAPI.SecurityStatusSpecified = true; } + if(atapiId.ServiceBusyClear != 0) { - report.ATAPI.ServiceBusyClear = atapiId.ServiceBusyClear; + report.ATAPI.ServiceBusyClear = atapiId.ServiceBusyClear; report.ATAPI.ServiceBusyClearSpecified = true; } + if(atapiId.SpecificConfiguration != 0) { - report.ATAPI.SpecificConfiguration = atapiId.SpecificConfiguration; + report.ATAPI.SpecificConfiguration = atapiId.SpecificConfiguration; report.ATAPI.SpecificConfigurationSpecified = true; } + if(atapiId.StreamAccessLatency != 0) { - report.ATAPI.StreamAccessLatency = atapiId.StreamAccessLatency; + report.ATAPI.StreamAccessLatency = atapiId.StreamAccessLatency; report.ATAPI.StreamAccessLatencySpecified = true; } + if(atapiId.StreamMinReqSize != 0) { - report.ATAPI.StreamMinReqSize = atapiId.StreamMinReqSize; + report.ATAPI.StreamMinReqSize = atapiId.StreamMinReqSize; report.ATAPI.StreamMinReqSizeSpecified = true; } + if(atapiId.StreamPerformanceGranularity != 0) { - report.ATAPI.StreamPerformanceGranularity = atapiId.StreamPerformanceGranularity; + report.ATAPI.StreamPerformanceGranularity = atapiId.StreamPerformanceGranularity; report.ATAPI.StreamPerformanceGranularitySpecified = true; } + if(atapiId.StreamTransferTimeDMA != 0) { - report.ATAPI.StreamTransferTimeDMA = atapiId.StreamTransferTimeDMA; + report.ATAPI.StreamTransferTimeDMA = atapiId.StreamTransferTimeDMA; report.ATAPI.StreamTransferTimeDMASpecified = true; } + if(atapiId.StreamTransferTimePIO != 0) { - report.ATAPI.StreamTransferTimePIO = atapiId.StreamTransferTimePIO; + report.ATAPI.StreamTransferTimePIO = atapiId.StreamTransferTimePIO; report.ATAPI.StreamTransferTimePIOSpecified = true; } + if(atapiId.TransportMajorVersion != 0) { - report.ATAPI.TransportMajorVersion = atapiId.TransportMajorVersion; + report.ATAPI.TransportMajorVersion = atapiId.TransportMajorVersion; report.ATAPI.TransportMajorVersionSpecified = true; } + if(atapiId.TransportMinorVersion != 0) { - report.ATAPI.TransportMinorVersion = atapiId.TransportMinorVersion; + report.ATAPI.TransportMinorVersion = atapiId.TransportMinorVersion; report.ATAPI.TransportMinorVersionSpecified = true; } + if(atapiId.TrustedComputing != 0) { - report.ATAPI.TrustedComputing = atapiId.TrustedComputing; + report.ATAPI.TrustedComputing = atapiId.TrustedComputing; report.ATAPI.TrustedComputingSpecified = true; } + if(atapiId.UDMAActive != 0) { - report.ATAPI.UDMAActive = atapiId.UDMAActive; + report.ATAPI.UDMAActive = atapiId.UDMAActive; report.ATAPI.UDMAActiveSpecified = true; } + if(atapiId.UDMASupported != 0) { - report.ATAPI.UDMASupported = atapiId.UDMASupported; + report.ATAPI.UDMASupported = atapiId.UDMASupported; report.ATAPI.UDMASupportedSpecified = true; } + if(atapiId.WRVMode != 0) { - report.ATAPI.WRVMode = atapiId.WRVMode; + report.ATAPI.WRVMode = atapiId.WRVMode; report.ATAPI.WRVModeSpecified = true; } + if(atapiId.WRVSectorCountMode3 != 0) { - report.ATAPI.WRVSectorCountMode3 = atapiId.WRVSectorCountMode3; + report.ATAPI.WRVSectorCountMode3 = atapiId.WRVSectorCountMode3; report.ATAPI.WRVSectorCountMode3Specified = true; } + if(atapiId.WRVSectorCountMode2 != 0) { - report.ATAPI.WRVSectorCountMode2 = atapiId.WRVSectorCountMode2; + report.ATAPI.WRVSectorCountMode2 = atapiId.WRVSectorCountMode2; report.ATAPI.WRVSectorCountMode2Specified = true; } } + if(debug) report.ATAPI.Identify = buffer; } } diff --git a/DiscImageChef.Core/Devices/Report/FireWire.cs b/DiscImageChef.Core/Devices/Report/FireWire.cs index e9c525149..a1ac9f8dd 100644 --- a/DiscImageChef.Core/Devices/Report/FireWire.cs +++ b/DiscImageChef.Core/Devices/Report/FireWire.cs @@ -65,9 +65,9 @@ namespace DiscImageChef.Core.Devices.Report report.FireWire = new firewireType { Manufacturer = dev.FireWireVendorName, - Product = dev.FireWireModelName, - ProductID = dev.FireWireModel, - VendorID = dev.FireWireVendor + Product = dev.FireWireModelName, + ProductID = dev.FireWireModel, + VendorID = dev.FireWireVendor }; pressedKey = new ConsoleKeyInfo(); @@ -79,7 +79,7 @@ namespace DiscImageChef.Core.Devices.Report } report.FireWire.RemovableMedia = pressedKey.Key == ConsoleKey.Y; - removable = report.FireWire.RemovableMedia; + removable = report.FireWire.RemovableMedia; } } } \ No newline at end of file diff --git a/DiscImageChef.Core/Devices/Report/PCMCIA.cs b/DiscImageChef.Core/Devices/Report/PCMCIA.cs index 9fbe79e86..e2539627b 100644 --- a/DiscImageChef.Core/Devices/Report/PCMCIA.cs +++ b/DiscImageChef.Core/Devices/Report/PCMCIA.cs @@ -60,22 +60,24 @@ namespace DiscImageChef.Core.Devices.Report if(manfid != null) { - report.PCMCIA.ManufacturerCode = manfid.ManufacturerID; - report.PCMCIA.CardCode = manfid.CardID; + report.PCMCIA.ManufacturerCode = manfid.ManufacturerID; + report.PCMCIA.CardCode = manfid.CardID; report.PCMCIA.ManufacturerCodeSpecified = true; - report.PCMCIA.CardCodeSpecified = true; + report.PCMCIA.CardCodeSpecified = true; } + break; case TupleCodes.CISTPL_VERS_1: Level1VersionTuple vers = CIS.DecodeLevel1VersionTuple(tuple); if(vers != null) { - report.PCMCIA.Manufacturer = vers.Manufacturer; - report.PCMCIA.ProductName = vers.Product; - report.PCMCIA.Compliance = $"{vers.MajorVersion}.{vers.MinorVersion}"; + report.PCMCIA.Manufacturer = vers.Manufacturer; + report.PCMCIA.ProductName = vers.Product; + report.PCMCIA.Compliance = $"{vers.MajorVersion}.{vers.MinorVersion}"; report.PCMCIA.AdditionalInformation = vers.AdditionalInformation; } + break; } } diff --git a/DiscImageChef.Core/Devices/Report/SCSI/General.cs b/DiscImageChef.Core/Devices/Report/SCSI/General.cs index 4d0394ba9..6aaae2777 100644 --- a/DiscImageChef.Core/Devices/Report/SCSI/General.cs +++ b/DiscImageChef.Core/Devices/Report/SCSI/General.cs @@ -59,8 +59,8 @@ namespace DiscImageChef.Core.Devices.Report.SCSI { if(report == null) return; - bool sense; - const uint TIMEOUT = 5; + bool sense; + const uint TIMEOUT = 5; ConsoleKeyInfo pressedKey; if(dev.IsUsb) Usb.Report(dev, ref report, debug, ref removable); @@ -98,29 +98,34 @@ namespace DiscImageChef.Core.Devices.Report.SCSI if(inq.DeviceTypeModifier != 0) { - report.SCSI.Inquiry.DeviceTypeModifier = inq.DeviceTypeModifier; + report.SCSI.Inquiry.DeviceTypeModifier = inq.DeviceTypeModifier; report.SCSI.Inquiry.DeviceTypeModifierSpecified = true; } + if(inq.ISOVersion != 0) { - report.SCSI.Inquiry.ISOVersion = inq.ISOVersion; + report.SCSI.Inquiry.ISOVersion = inq.ISOVersion; report.SCSI.Inquiry.ISOVersionSpecified = true; } + if(inq.ECMAVersion != 0) { - report.SCSI.Inquiry.ECMAVersion = inq.ECMAVersion; + report.SCSI.Inquiry.ECMAVersion = inq.ECMAVersion; report.SCSI.Inquiry.ECMAVersionSpecified = true; } + if(inq.ANSIVersion != 0) { - report.SCSI.Inquiry.ANSIVersion = inq.ANSIVersion; + report.SCSI.Inquiry.ANSIVersion = inq.ANSIVersion; report.SCSI.Inquiry.ANSIVersionSpecified = true; } + if(inq.ResponseDataFormat != 0) { - report.SCSI.Inquiry.ResponseDataFormat = inq.ResponseDataFormat; + report.SCSI.Inquiry.ResponseDataFormat = inq.ResponseDataFormat; report.SCSI.Inquiry.ResponseDataFormatSpecified = true; } + if(!string.IsNullOrWhiteSpace(StringHandlers.CToString(inq.VendorIdentification))) { report.SCSI.Inquiry.VendorIdentification = @@ -128,6 +133,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI if(!string.IsNullOrWhiteSpace(report.SCSI.Inquiry.VendorIdentification)) report.SCSI.Inquiry.VendorIdentificationSpecified = true; } + if(!string.IsNullOrWhiteSpace(StringHandlers.CToString(inq.ProductIdentification))) { report.SCSI.Inquiry.ProductIdentification = @@ -135,6 +141,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI if(!string.IsNullOrWhiteSpace(report.SCSI.Inquiry.ProductIdentification)) report.SCSI.Inquiry.ProductIdentificationSpecified = true; } + if(!string.IsNullOrWhiteSpace(StringHandlers.CToString(inq.ProductRevisionLevel))) { report.SCSI.Inquiry.ProductRevisionLevel = @@ -142,6 +149,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI if(!string.IsNullOrWhiteSpace(report.SCSI.Inquiry.ProductRevisionLevel)) report.SCSI.Inquiry.ProductRevisionLevelSpecified = true; } + if(inq.VersionDescriptors != null) { versionDescriptors.AddRange(inq.VersionDescriptors.Where(descriptor => descriptor != 0)); @@ -150,37 +158,37 @@ namespace DiscImageChef.Core.Devices.Report.SCSI report.SCSI.Inquiry.VersionDescriptors = versionDescriptors.ToArray(); } - report.SCSI.Inquiry.PeripheralQualifier = (PeripheralQualifiers)inq.PeripheralQualifier; - report.SCSI.Inquiry.PeripheralDeviceType = (PeripheralDeviceTypes)inq.PeripheralDeviceType; + report.SCSI.Inquiry.PeripheralQualifier = (PeripheralQualifiers)inq.PeripheralQualifier; + report.SCSI.Inquiry.PeripheralDeviceType = (PeripheralDeviceTypes)inq.PeripheralDeviceType; report.SCSI.Inquiry.AsymmetricalLUNAccess = (TGPSValues)inq.TPGS; - report.SCSI.Inquiry.SPIClocking = (SPIClocking)inq.Clocking; + report.SCSI.Inquiry.SPIClocking = (SPIClocking)inq.Clocking; report.SCSI.Inquiry.AccessControlCoordinator = inq.ACC; - report.SCSI.Inquiry.ACKRequests = inq.ACKREQQ; - report.SCSI.Inquiry.AERCSupported = inq.AERC; - report.SCSI.Inquiry.Address16 = inq.Addr16; - report.SCSI.Inquiry.Address32 = inq.Addr32; - report.SCSI.Inquiry.BasicQueueing = inq.BQue; - report.SCSI.Inquiry.EnclosureServices = inq.EncServ; - report.SCSI.Inquiry.HierarchicalLUN = inq.HiSup; - report.SCSI.Inquiry.IUS = inq.IUS; - report.SCSI.Inquiry.LinkedCommands = inq.Linked; - report.SCSI.Inquiry.MediumChanger = inq.MChngr; - report.SCSI.Inquiry.MultiPortDevice = inq.MultiP; - report.SCSI.Inquiry.NormalACA = inq.NormACA; - report.SCSI.Inquiry.Protection = inq.Protect; - report.SCSI.Inquiry.QAS = inq.QAS; - report.SCSI.Inquiry.RelativeAddressing = inq.RelAddr; - report.SCSI.Inquiry.Removable = inq.RMB; - report.SCSI.Inquiry.TaggedCommandQueue = inq.CmdQue; - report.SCSI.Inquiry.TerminateTaskSupported = inq.TrmTsk; - report.SCSI.Inquiry.ThirdPartyCopy = inq.ThreePC; - report.SCSI.Inquiry.TranferDisable = inq.TranDis; - report.SCSI.Inquiry.SoftReset = inq.SftRe; - report.SCSI.Inquiry.StorageArrayController = inq.SCCS; - report.SCSI.Inquiry.SyncTransfer = inq.Sync; - report.SCSI.Inquiry.WideBus16 = inq.WBus16; - report.SCSI.Inquiry.WideBus32 = inq.WBus32; + report.SCSI.Inquiry.ACKRequests = inq.ACKREQQ; + report.SCSI.Inquiry.AERCSupported = inq.AERC; + report.SCSI.Inquiry.Address16 = inq.Addr16; + report.SCSI.Inquiry.Address32 = inq.Addr32; + report.SCSI.Inquiry.BasicQueueing = inq.BQue; + report.SCSI.Inquiry.EnclosureServices = inq.EncServ; + report.SCSI.Inquiry.HierarchicalLUN = inq.HiSup; + report.SCSI.Inquiry.IUS = inq.IUS; + report.SCSI.Inquiry.LinkedCommands = inq.Linked; + report.SCSI.Inquiry.MediumChanger = inq.MChngr; + report.SCSI.Inquiry.MultiPortDevice = inq.MultiP; + report.SCSI.Inquiry.NormalACA = inq.NormACA; + report.SCSI.Inquiry.Protection = inq.Protect; + report.SCSI.Inquiry.QAS = inq.QAS; + report.SCSI.Inquiry.RelativeAddressing = inq.RelAddr; + report.SCSI.Inquiry.Removable = inq.RMB; + report.SCSI.Inquiry.TaggedCommandQueue = inq.CmdQue; + report.SCSI.Inquiry.TerminateTaskSupported = inq.TrmTsk; + report.SCSI.Inquiry.ThirdPartyCopy = inq.ThreePC; + report.SCSI.Inquiry.TranferDisable = inq.TranDis; + report.SCSI.Inquiry.SoftReset = inq.SftRe; + report.SCSI.Inquiry.StorageArrayController = inq.SCCS; + report.SCSI.Inquiry.SyncTransfer = inq.Sync; + report.SCSI.Inquiry.WideBus16 = inq.WBus16; + report.SCSI.Inquiry.WideBus32 = inq.WBus32; if(debug) report.SCSI.Inquiry.Data = buffer; } @@ -227,7 +235,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI System.Console.ReadKey(true); } - Modes.DecodedMode? decMode = null; + Modes.DecodedMode? decMode = null; PeripheralDeviceTypes devType = dev.ScsiType; DicConsole.WriteLine("Querying all mode pages and subpages using SCSI MODE SENSE (10)..."); @@ -240,16 +248,16 @@ namespace DiscImageChef.Core.Devices.Report.SCSI ScsiModeSensePageControl.Default, 0x3F, 0x00, TIMEOUT, out _); if(!sense && !dev.Error) { - report.SCSI.SupportsModeSense10 = true; + report.SCSI.SupportsModeSense10 = true; report.SCSI.SupportsModeSubpages = false; - decMode = Modes.DecodeMode10(mode10Buffer, devType); + decMode = Modes.DecodeMode10(mode10Buffer, devType); } } else { - report.SCSI.SupportsModeSense10 = true; + report.SCSI.SupportsModeSense10 = true; report.SCSI.SupportsModeSubpages = true; - decMode = Modes.DecodeMode10(mode10Buffer, devType); + decMode = Modes.DecodeMode10(mode10Buffer, devType); } DicConsole.WriteLine("Querying all mode pages and subpages using SCSI MODE SENSE (6)..."); @@ -274,7 +282,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI Modes.ModePage_2A? cdromMode = null; - if(debug && report.SCSI.SupportsModeSense6) report.SCSI.ModeSense6Data = mode6Buffer; + if(debug && report.SCSI.SupportsModeSense6) report.SCSI.ModeSense6Data = mode6Buffer; if(debug && report.SCSI.SupportsModeSense10) report.SCSI.ModeSense10Data = mode10Buffer; if(decMode.HasValue) @@ -282,19 +290,19 @@ namespace DiscImageChef.Core.Devices.Report.SCSI report.SCSI.ModeSense = new modeType { BlankCheckEnabled = decMode.Value.Header.EBC, - DPOandFUA = decMode.Value.Header.DPOFUA, - WriteProtected = decMode.Value.Header.WriteProtected + DPOandFUA = decMode.Value.Header.DPOFUA, + WriteProtected = decMode.Value.Header.WriteProtected }; if(decMode.Value.Header.BufferedMode > 0) { - report.SCSI.ModeSense.BufferedMode = decMode.Value.Header.BufferedMode; + report.SCSI.ModeSense.BufferedMode = decMode.Value.Header.BufferedMode; report.SCSI.ModeSense.BufferedModeSpecified = true; } if(decMode.Value.Header.Speed > 0) { - report.SCSI.ModeSense.Speed = decMode.Value.Header.Speed; + report.SCSI.ModeSense.Speed = decMode.Value.Header.Speed; report.SCSI.ModeSense.SpeedSpecified = true; } @@ -305,9 +313,9 @@ namespace DiscImageChef.Core.Devices.Report.SCSI { modePageType modePage = new modePageType { - page = page.Page, + page = page.Page, subpage = page.Subpage, - value = page.PageResponse + value = page.PageResponse }; modePages.Add(modePage); @@ -357,8 +365,8 @@ namespace DiscImageChef.Core.Devices.Report.SCSI mediaTest.Model = System.Console.ReadLine(); mediaTest.ManufacturerSpecified = true; - mediaTest.ModelSpecified = true; - mediaTest.MediaIsRecognized = true; + mediaTest.ModelSpecified = true; + mediaTest.MediaIsRecognized = true; sense = dev.ScsiTestUnitReady(out senseBuffer, TIMEOUT, out _); if(sense) @@ -401,7 +409,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI if(mediaTest.MediaIsRecognized) { - mediaTest.SupportsReadCapacitySpecified = true; + mediaTest.SupportsReadCapacitySpecified = true; mediaTest.SupportsReadCapacity16Specified = true; DicConsole.WriteLine("Querying SCSI READ CAPACITY..."); @@ -414,7 +422,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI 1; mediaTest.BlockSize = (uint)((buffer[4] << 24) + (buffer[5] << 16) + (buffer[6] << 8) + buffer[7]); - mediaTest.BlocksSpecified = true; + mediaTest.BlocksSpecified = true; mediaTest.BlockSizeSpecified = true; } @@ -429,7 +437,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI mediaTest.Blocks = BitConverter.ToUInt64(temp, 0) + 1; mediaTest.BlockSize = (uint)((buffer[8] << 24) + (buffer[9] << 16) + (buffer[10] << 8) + buffer[11]); - mediaTest.BlocksSpecified = true; + mediaTest.BlocksSpecified = true; mediaTest.BlockSizeSpecified = true; } @@ -441,7 +449,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI if(!sense && !dev.Error) { report.SCSI.SupportsModeSense10 = true; - decMode = Modes.DecodeMode10(buffer, dev.ScsiType); + decMode = Modes.DecodeMode10(buffer, dev.ScsiType); if(debug) mediaTest.ModeSense10Data = buffer; } @@ -450,26 +458,27 @@ namespace DiscImageChef.Core.Devices.Report.SCSI if(!sense && !dev.Error) { report.SCSI.SupportsModeSense6 = true; - if(!decMode.HasValue) decMode = Modes.DecodeMode6(buffer, dev.ScsiType); + if(!decMode.HasValue) decMode = Modes.DecodeMode6(buffer, dev.ScsiType); if(debug) mediaTest.ModeSense6Data = buffer; } if(decMode.HasValue) { - mediaTest.MediumType = (byte)decMode.Value.Header.MediumType; + mediaTest.MediumType = (byte)decMode.Value.Header.MediumType; mediaTest.MediumTypeSpecified = true; - if(decMode.Value.Header.BlockDescriptors != null && + if(decMode.Value.Header.BlockDescriptors != null && decMode.Value.Header.BlockDescriptors.Length > 0) { - mediaTest.Density = (byte)decMode.Value.Header.BlockDescriptors[0].Density; + mediaTest.Density = + (byte)decMode.Value.Header.BlockDescriptors[0].Density; mediaTest.DensitySpecified = true; } } - mediaTest.SupportsReadSpecified = true; - mediaTest.SupportsRead10Specified = true; - mediaTest.SupportsRead12Specified = true; - mediaTest.SupportsRead16Specified = true; + mediaTest.SupportsReadSpecified = true; + mediaTest.SupportsRead10Specified = true; + mediaTest.SupportsRead12Specified = true; + mediaTest.SupportsRead16Specified = true; mediaTest.SupportsReadLongSpecified = true; DicConsole.WriteLine("Trying SCSI READ (6)..."); @@ -520,7 +529,8 @@ namespace DiscImageChef.Core.Devices.Report.SCSI FixedSense? decSense = Sense.DecodeFixed(senseBuffer); if(decSense.HasValue) if(decSense.Value.SenseKey == 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) @@ -549,8 +559,8 @@ namespace DiscImageChef.Core.Devices.Report.SCSI testSize, TIMEOUT, out _); if(sense || dev.Error) continue; - mediaTest.SupportsReadLong = true; - mediaTest.LongBlockSize = testSize; + mediaTest.SupportsReadLong = true; + mediaTest.LongBlockSize = testSize; mediaTest.LongBlockSizeSpecified = true; break; } @@ -568,8 +578,8 @@ namespace DiscImageChef.Core.Devices.Report.SCSI (ushort)i, TIMEOUT, out _); if(sense || dev.Error) continue; - mediaTest.SupportsReadLong = true; - mediaTest.LongBlockSize = testSize; + mediaTest.SupportsReadLong = true; + mediaTest.LongBlockSize = testSize; mediaTest.LongBlockSizeSpecified = true; break; } @@ -579,8 +589,8 @@ namespace DiscImageChef.Core.Devices.Report.SCSI TIMEOUT, out _); if(!sense && !dev.Error) { - mediaTest.SupportsReadLong = true; - mediaTest.LongBlockSize = 2380; + mediaTest.SupportsReadLong = true; + mediaTest.LongBlockSize = 2380; mediaTest.LongBlockSizeSpecified = true; } } @@ -590,8 +600,8 @@ namespace DiscImageChef.Core.Devices.Report.SCSI TIMEOUT, out _); if(!sense && !dev.Error) { - mediaTest.SupportsReadLong = true; - mediaTest.LongBlockSize = 4760; + mediaTest.SupportsReadLong = true; + mediaTest.LongBlockSize = 4760; mediaTest.LongBlockSizeSpecified = true; } } @@ -601,8 +611,8 @@ namespace DiscImageChef.Core.Devices.Report.SCSI TIMEOUT, out _); if(!sense && !dev.Error) { - mediaTest.SupportsReadLong = true; - mediaTest.LongBlockSize = 9424; + mediaTest.SupportsReadLong = true; + mediaTest.LongBlockSize = 9424; mediaTest.LongBlockSizeSpecified = true; } } @@ -613,7 +623,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI 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): "); + .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(); } @@ -627,7 +637,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI TIMEOUT, out _); if(!sense) { - mediaTest.LongBlockSize = i; + mediaTest.LongBlockSize = i; mediaTest.LongBlockSizeSpecified = true; break; } @@ -663,11 +673,11 @@ namespace DiscImageChef.Core.Devices.Report.SCSI } else { - report.SCSI.ReadCapabilities = new testedMediaType(); - report.SCSI.ReadCapabilitiesSpecified = true; + report.SCSI.ReadCapabilities = new testedMediaType(); + report.SCSI.ReadCapabilitiesSpecified = true; report.SCSI.ReadCapabilities.MediaIsRecognized = true; - report.SCSI.ReadCapabilities.SupportsReadCapacitySpecified = true; + report.SCSI.ReadCapabilities.SupportsReadCapacitySpecified = true; report.SCSI.ReadCapabilities.SupportsReadCapacity16Specified = true; DicConsole.WriteLine("Querying SCSI READ CAPACITY..."); @@ -679,7 +689,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI (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.BlocksSpecified = true; report.SCSI.ReadCapabilities.BlockSizeSpecified = true; } @@ -694,7 +704,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI 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.BlocksSpecified = true; + report.SCSI.ReadCapabilities.BlocksSpecified = true; report.SCSI.ReadCapabilities.BlockSizeSpecified = true; } @@ -706,7 +716,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI if(!sense && !dev.Error) { report.SCSI.SupportsModeSense10 = true; - decMode = Modes.DecodeMode10(buffer, dev.ScsiType); + decMode = Modes.DecodeMode10(buffer, dev.ScsiType); if(debug) report.SCSI.ReadCapabilities.ModeSense10Data = buffer; } @@ -715,15 +725,16 @@ namespace DiscImageChef.Core.Devices.Report.SCSI if(!sense && !dev.Error) { report.SCSI.SupportsModeSense6 = true; - if(!decMode.HasValue) decMode = Modes.DecodeMode6(buffer, dev.ScsiType); + if(!decMode.HasValue) + decMode = 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.MediumType = (byte)decMode.Value.Header.MediumType; report.SCSI.ReadCapabilities.MediumTypeSpecified = true; - if(decMode.Value.Header.BlockDescriptors != null && + if(decMode.Value.Header.BlockDescriptors != null && decMode.Value.Header.BlockDescriptors.Length > 0) { report.SCSI.ReadCapabilities.Density = @@ -732,10 +743,10 @@ namespace DiscImageChef.Core.Devices.Report.SCSI } } - report.SCSI.ReadCapabilities.SupportsReadSpecified = true; - report.SCSI.ReadCapabilities.SupportsRead10Specified = true; - report.SCSI.ReadCapabilities.SupportsRead12Specified = true; - report.SCSI.ReadCapabilities.SupportsRead16Specified = true; + report.SCSI.ReadCapabilities.SupportsReadSpecified = true; + report.SCSI.ReadCapabilities.SupportsRead10Specified = true; + report.SCSI.ReadCapabilities.SupportsRead12Specified = true; + report.SCSI.ReadCapabilities.SupportsRead16Specified = true; report.SCSI.ReadCapabilities.SupportsReadLongSpecified = true; DicConsole.WriteLine("Trying SCSI READ (6)..."); @@ -790,7 +801,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI FixedSense? decSense = Sense.DecodeFixed(senseBuffer); if(decSense.HasValue) if(decSense.Value.SenseKey == SenseKeys.IllegalRequest && decSense.Value.ASC == 0x24 && - decSense.Value.ASCQ == 0x00) + decSense.Value.ASCQ == 0x00) { report.SCSI.ReadCapabilities.SupportsReadLong = true; if(decSense.Value.InformationValid && decSense.Value.ILI) @@ -820,8 +831,8 @@ namespace DiscImageChef.Core.Devices.Report.SCSI TIMEOUT, out _); if(sense || dev.Error) continue; - report.SCSI.ReadCapabilities.SupportsReadLong = true; - report.SCSI.ReadCapabilities.LongBlockSize = testSize; + report.SCSI.ReadCapabilities.SupportsReadLong = true; + report.SCSI.ReadCapabilities.LongBlockSize = testSize; report.SCSI.ReadCapabilities.LongBlockSizeSpecified = true; break; } @@ -839,8 +850,8 @@ namespace DiscImageChef.Core.Devices.Report.SCSI TIMEOUT, out _); if(sense || dev.Error) continue; - report.SCSI.ReadCapabilities.SupportsReadLong = true; - report.SCSI.ReadCapabilities.LongBlockSize = testSize; + report.SCSI.ReadCapabilities.SupportsReadLong = true; + report.SCSI.ReadCapabilities.LongBlockSize = testSize; report.SCSI.ReadCapabilities.LongBlockSizeSpecified = true; break; } @@ -850,8 +861,8 @@ namespace DiscImageChef.Core.Devices.Report.SCSI out _); if(!sense && !dev.Error) { - report.SCSI.ReadCapabilities.SupportsReadLong = true; - report.SCSI.ReadCapabilities.LongBlockSize = 2380; + report.SCSI.ReadCapabilities.SupportsReadLong = true; + report.SCSI.ReadCapabilities.LongBlockSize = 2380; report.SCSI.ReadCapabilities.LongBlockSizeSpecified = true; } } @@ -861,8 +872,8 @@ namespace DiscImageChef.Core.Devices.Report.SCSI out _); if(!sense && !dev.Error) { - report.SCSI.ReadCapabilities.SupportsReadLong = true; - report.SCSI.ReadCapabilities.LongBlockSize = 4760; + report.SCSI.ReadCapabilities.SupportsReadLong = true; + report.SCSI.ReadCapabilities.LongBlockSize = 4760; report.SCSI.ReadCapabilities.LongBlockSizeSpecified = true; } } @@ -872,8 +883,8 @@ namespace DiscImageChef.Core.Devices.Report.SCSI out _); if(!sense && !dev.Error) { - report.SCSI.ReadCapabilities.SupportsReadLong = true; - report.SCSI.ReadCapabilities.LongBlockSize = 9424; + report.SCSI.ReadCapabilities.SupportsReadLong = true; + report.SCSI.ReadCapabilities.LongBlockSize = 9424; report.SCSI.ReadCapabilities.LongBlockSizeSpecified = true; } } @@ -885,7 +896,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI 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): "); + .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(); } @@ -906,7 +917,8 @@ namespace DiscImageChef.Core.Devices.Report.SCSI bingo.Write(buffer, 0, buffer.Length); bingo.Close(); } - report.SCSI.ReadCapabilities.LongBlockSize = i; + + report.SCSI.ReadCapabilities.LongBlockSize = i; report.SCSI.ReadCapabilities.LongBlockSizeSpecified = true; break; } @@ -918,7 +930,8 @@ namespace DiscImageChef.Core.Devices.Report.SCSI } } - if(debug && report.SCSI.ReadCapabilities.SupportsReadLong && + if(debug && + report.SCSI.ReadCapabilities.SupportsReadLong && report.SCSI.ReadCapabilities.LongBlockSizeSpecified && report.SCSI.ReadCapabilities.LongBlockSize != report.SCSI.ReadCapabilities.BlockSize) { diff --git a/DiscImageChef.Core/Devices/Report/SCSI/MMC.cs b/DiscImageChef.Core/Devices/Report/SCSI/MMC.cs index 3da306ada..af40bf1bc 100644 --- a/DiscImageChef.Core/Devices/Report/SCSI/MMC.cs +++ b/DiscImageChef.Core/Devices/Report/SCSI/MMC.cs @@ -59,7 +59,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI { if(report == null) return; - bool sense; + bool sense; const uint TIMEOUT = 5; List mediaTypes = new List(); @@ -70,41 +70,49 @@ namespace DiscImageChef.Core.Devices.Report.SCSI report.SCSI.MultiMediaDevice.ModeSense2A = new mmcModeType(); if(cdromMode.Value.BufferSize != 0) { - report.SCSI.MultiMediaDevice.ModeSense2A.BufferSize = cdromMode.Value.BufferSize; + report.SCSI.MultiMediaDevice.ModeSense2A.BufferSize = cdromMode.Value.BufferSize; report.SCSI.MultiMediaDevice.ModeSense2A.BufferSizeSpecified = true; } + if(cdromMode.Value.CurrentSpeed != 0) { - report.SCSI.MultiMediaDevice.ModeSense2A.CurrentSpeed = cdromMode.Value.CurrentSpeed; + report.SCSI.MultiMediaDevice.ModeSense2A.CurrentSpeed = cdromMode.Value.CurrentSpeed; report.SCSI.MultiMediaDevice.ModeSense2A.CurrentSpeedSpecified = true; } + if(cdromMode.Value.CurrentWriteSpeed != 0) { - report.SCSI.MultiMediaDevice.ModeSense2A.CurrentWriteSpeed = cdromMode.Value.CurrentWriteSpeed; + report.SCSI.MultiMediaDevice.ModeSense2A.CurrentWriteSpeed = + cdromMode.Value.CurrentWriteSpeed; report.SCSI.MultiMediaDevice.ModeSense2A.CurrentWriteSpeedSpecified = true; } + if(cdromMode.Value.CurrentWriteSpeedSelected != 0) { report.SCSI.MultiMediaDevice.ModeSense2A.CurrentWriteSpeedSelected = cdromMode.Value.CurrentWriteSpeedSelected; report.SCSI.MultiMediaDevice.ModeSense2A.CurrentWriteSpeedSelectedSpecified = true; } + if(cdromMode.Value.MaximumSpeed != 0) { - report.SCSI.MultiMediaDevice.ModeSense2A.MaximumSpeed = cdromMode.Value.MaximumSpeed; + report.SCSI.MultiMediaDevice.ModeSense2A.MaximumSpeed = cdromMode.Value.MaximumSpeed; report.SCSI.MultiMediaDevice.ModeSense2A.MaximumSpeedSpecified = true; } + if(cdromMode.Value.MaxWriteSpeed != 0) { - report.SCSI.MultiMediaDevice.ModeSense2A.MaximumWriteSpeed = cdromMode.Value.MaxWriteSpeed; + report.SCSI.MultiMediaDevice.ModeSense2A.MaximumWriteSpeed = cdromMode.Value.MaxWriteSpeed; report.SCSI.MultiMediaDevice.ModeSense2A.MaximumWriteSpeedSpecified = true; } + if(cdromMode.Value.RotationControlSelected != 0) { report.SCSI.MultiMediaDevice.ModeSense2A.RotationControlSelected = cdromMode.Value.RotationControlSelected; report.SCSI.MultiMediaDevice.ModeSense2A.RotationControlSelectedSpecified = true; } + if(cdromMode.Value.SupportedVolumeLevels != 0) { report.SCSI.MultiMediaDevice.ModeSense2A.SupportedVolumeLevels = @@ -112,49 +120,49 @@ namespace DiscImageChef.Core.Devices.Report.SCSI report.SCSI.MultiMediaDevice.ModeSense2A.SupportedVolumeLevelsSpecified = true; } - report.SCSI.MultiMediaDevice.ModeSense2A.AccurateCDDA = cdromMode.Value.AccurateCDDA; - report.SCSI.MultiMediaDevice.ModeSense2A.BCK = cdromMode.Value.BCK; + report.SCSI.MultiMediaDevice.ModeSense2A.AccurateCDDA = cdromMode.Value.AccurateCDDA; + report.SCSI.MultiMediaDevice.ModeSense2A.BCK = cdromMode.Value.BCK; report.SCSI.MultiMediaDevice.ModeSense2A.BufferUnderRunProtection = cdromMode.Value.BUF; - report.SCSI.MultiMediaDevice.ModeSense2A.CanEject = cdromMode.Value.Eject; - report.SCSI.MultiMediaDevice.ModeSense2A.CanLockMedia = cdromMode.Value.Lock; - report.SCSI.MultiMediaDevice.ModeSense2A.CDDACommand = cdromMode.Value.CDDACommand; - report.SCSI.MultiMediaDevice.ModeSense2A.CompositeAudioVideo = cdromMode.Value.Composite; - report.SCSI.MultiMediaDevice.ModeSense2A.CSSandCPPMSupported = cdromMode.Value.CMRSupported == 1; + report.SCSI.MultiMediaDevice.ModeSense2A.CanEject = cdromMode.Value.Eject; + report.SCSI.MultiMediaDevice.ModeSense2A.CanLockMedia = cdromMode.Value.Lock; + report.SCSI.MultiMediaDevice.ModeSense2A.CDDACommand = cdromMode.Value.CDDACommand; + report.SCSI.MultiMediaDevice.ModeSense2A.CompositeAudioVideo = cdromMode.Value.Composite; + report.SCSI.MultiMediaDevice.ModeSense2A.CSSandCPPMSupported = cdromMode.Value.CMRSupported == 1; report.SCSI.MultiMediaDevice.ModeSense2A.DeterministicSlotChanger = cdromMode.Value.SDP; - report.SCSI.MultiMediaDevice.ModeSense2A.DigitalPort1 = cdromMode.Value.DigitalPort1; - report.SCSI.MultiMediaDevice.ModeSense2A.DigitalPort2 = cdromMode.Value.DigitalPort2; - report.SCSI.MultiMediaDevice.ModeSense2A.LeadInPW = cdromMode.Value.LeadInPW; - report.SCSI.MultiMediaDevice.ModeSense2A.LoadingMechanismType = cdromMode.Value.LoadingMechanism; - report.SCSI.MultiMediaDevice.ModeSense2A.LockStatus = cdromMode.Value.LockState; - report.SCSI.MultiMediaDevice.ModeSense2A.LSBF = cdromMode.Value.LSBF; - report.SCSI.MultiMediaDevice.ModeSense2A.PlaysAudio = cdromMode.Value.AudioPlay; - report.SCSI.MultiMediaDevice.ModeSense2A.PreventJumperStatus = cdromMode.Value.PreventJumper; - report.SCSI.MultiMediaDevice.ModeSense2A.RCK = cdromMode.Value.RCK; - report.SCSI.MultiMediaDevice.ModeSense2A.ReadsBarcode = cdromMode.Value.ReadBarcode; - 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.DigitalPort1 = cdromMode.Value.DigitalPort1; + report.SCSI.MultiMediaDevice.ModeSense2A.DigitalPort2 = cdromMode.Value.DigitalPort2; + report.SCSI.MultiMediaDevice.ModeSense2A.LeadInPW = cdromMode.Value.LeadInPW; + report.SCSI.MultiMediaDevice.ModeSense2A.LoadingMechanismType = cdromMode.Value.LoadingMechanism; + report.SCSI.MultiMediaDevice.ModeSense2A.LockStatus = cdromMode.Value.LockState; + report.SCSI.MultiMediaDevice.ModeSense2A.LSBF = cdromMode.Value.LSBF; + report.SCSI.MultiMediaDevice.ModeSense2A.PlaysAudio = cdromMode.Value.AudioPlay; + report.SCSI.MultiMediaDevice.ModeSense2A.PreventJumperStatus = cdromMode.Value.PreventJumper; + report.SCSI.MultiMediaDevice.ModeSense2A.RCK = cdromMode.Value.RCK; + report.SCSI.MultiMediaDevice.ModeSense2A.ReadsBarcode = cdromMode.Value.ReadBarcode; + 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.ReadsDVDR = cdromMode.Value.ReadDVDR; - report.SCSI.MultiMediaDevice.ModeSense2A.ReadsDVDRAM = cdromMode.Value.ReadDVDRAM; - report.SCSI.MultiMediaDevice.ModeSense2A.ReadsDVDROM = cdromMode.Value.ReadDVDROM; - report.SCSI.MultiMediaDevice.ModeSense2A.ReadsISRC = cdromMode.Value.ISRC; - report.SCSI.MultiMediaDevice.ModeSense2A.ReadsMode2Form2 = cdromMode.Value.Mode2Form2; - report.SCSI.MultiMediaDevice.ModeSense2A.ReadsMode2Form1 = cdromMode.Value.Mode2Form1; - report.SCSI.MultiMediaDevice.ModeSense2A.ReadsPacketCDR = cdromMode.Value.Method2; - report.SCSI.MultiMediaDevice.ModeSense2A.ReadsSubchannel = cdromMode.Value.Subchannel; - report.SCSI.MultiMediaDevice.ModeSense2A.ReadsUPC = cdromMode.Value.UPC; - report.SCSI.MultiMediaDevice.ModeSense2A.ReturnsC2Pointers = cdromMode.Value.C2Pointer; - report.SCSI.MultiMediaDevice.ModeSense2A.SeparateChannelMute = cdromMode.Value.SeparateChannelMute; + report.SCSI.MultiMediaDevice.ModeSense2A.ReadsDVDR = cdromMode.Value.ReadDVDR; + report.SCSI.MultiMediaDevice.ModeSense2A.ReadsDVDRAM = cdromMode.Value.ReadDVDRAM; + report.SCSI.MultiMediaDevice.ModeSense2A.ReadsDVDROM = cdromMode.Value.ReadDVDROM; + report.SCSI.MultiMediaDevice.ModeSense2A.ReadsISRC = cdromMode.Value.ISRC; + report.SCSI.MultiMediaDevice.ModeSense2A.ReadsMode2Form2 = cdromMode.Value.Mode2Form2; + report.SCSI.MultiMediaDevice.ModeSense2A.ReadsMode2Form1 = cdromMode.Value.Mode2Form1; + report.SCSI.MultiMediaDevice.ModeSense2A.ReadsPacketCDR = cdromMode.Value.Method2; + report.SCSI.MultiMediaDevice.ModeSense2A.ReadsSubchannel = cdromMode.Value.Subchannel; + report.SCSI.MultiMediaDevice.ModeSense2A.ReadsUPC = cdromMode.Value.UPC; + report.SCSI.MultiMediaDevice.ModeSense2A.ReturnsC2Pointers = cdromMode.Value.C2Pointer; + report.SCSI.MultiMediaDevice.ModeSense2A.SeparateChannelMute = cdromMode.Value.SeparateChannelMute; report.SCSI.MultiMediaDevice.ModeSense2A.SeparateChannelVolume = cdromMode.Value.SeparateChannelVolume; - report.SCSI.MultiMediaDevice.ModeSense2A.SSS = cdromMode.Value.SSS; - report.SCSI.MultiMediaDevice.ModeSense2A.SupportsMultiSession = cdromMode.Value.MultiSession; - report.SCSI.MultiMediaDevice.ModeSense2A.TestWrite = cdromMode.Value.TestWrite; - report.SCSI.MultiMediaDevice.ModeSense2A.WritesCDR = cdromMode.Value.WriteCDR; - 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.SSS = cdromMode.Value.SSS; + report.SCSI.MultiMediaDevice.ModeSense2A.SupportsMultiSession = cdromMode.Value.MultiSession; + report.SCSI.MultiMediaDevice.ModeSense2A.TestWrite = cdromMode.Value.TestWrite; + report.SCSI.MultiMediaDevice.ModeSense2A.WritesCDR = cdromMode.Value.WriteCDR; + 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; @@ -196,6 +204,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI report.SCSI.MultiMediaDevice.Features.PhysicalInterfaceStandard = PhysicalInterfaces.Unspecified; } + report.SCSI.MultiMediaDevice.Features.SupportsDeviceBusyEvent = ftr0001.Value.DBE; } } @@ -208,11 +217,16 @@ namespace DiscImageChef.Core.Devices.Report.SCSI 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.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; @@ -223,8 +237,8 @@ namespace DiscImageChef.Core.Devices.Report.SCSI { 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.SupportsPWP = ftr0004.Value.SPWP; + report.SCSI.MultiMediaDevice.Features.SupportsSWPP = ftr0004.Value.SSWPP; } } break; @@ -239,12 +253,14 @@ namespace DiscImageChef.Core.Devices.Report.SCSI 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; } } @@ -258,8 +274,8 @@ namespace DiscImageChef.Core.Devices.Report.SCSI Feature_001E? ftr001E = 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.SupportsDAP = ftr001E.Value.DAP; + report.SCSI.MultiMediaDevice.Features.SupportsC2 = ftr001E.Value.C2; report.SCSI.MultiMediaDevice.Features.CanReadLeadInCDText = ftr001E.Value.CDText; } } @@ -270,9 +286,9 @@ namespace DiscImageChef.Core.Devices.Report.SCSI Feature_001F? ftr001F = Features.Decode_001F(desc.Data); if(ftr001F.HasValue) { - report.SCSI.MultiMediaDevice.Features.DVDMultiRead = ftr001F.Value.MULTI110; + 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.CanReadAllDualR = ftr001F.Value.DualR; } } break; @@ -288,10 +304,10 @@ namespace DiscImageChef.Core.Devices.Report.SCSI 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.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; @@ -307,9 +323,9 @@ namespace DiscImageChef.Core.Devices.Report.SCSI Feature_0028? ftr0028 = Features.Decode_0028(desc.Data); if(ftr0028.HasValue) { - report.SCSI.MultiMediaDevice.Features.CanReadDVDPlusMRW = ftr0028.Value.DVDPRead; + 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.CanWriteCDMRW = ftr0028.Value.Write; } } break; @@ -340,7 +356,8 @@ namespace DiscImageChef.Core.Devices.Report.SCSI ftr002D.Value.RWRaw; report.SCSI.MultiMediaDevice.Features.CanWritePackedSubchannelInTAO = ftr002D.Value.RWPack; - report.SCSI.MultiMediaDevice.Features.CanTestWriteInTAO = ftr002D.Value.TestWrite; + report.SCSI.MultiMediaDevice.Features.CanTestWriteInTAO = + ftr002D.Value.TestWrite; report.SCSI.MultiMediaDevice.Features.CanOverwriteTAOTrack = ftr002D.Value.CDRW; report.SCSI.MultiMediaDevice.Features.CanWriteRWSubchannelInTAO = ftr002D.Value.RWSubchannel; @@ -354,10 +371,13 @@ namespace DiscImageChef.Core.Devices.Report.SCSI if(ftr002E.HasValue) { report.SCSI.MultiMediaDevice.Features.BufferUnderrunFreeInSAO = ftr002E.Value.BUF; - report.SCSI.MultiMediaDevice.Features.CanWriteRawMultiSession = ftr002E.Value.RAWMS; + 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.CanTestWriteInSAO = + ftr002E.Value.TestWrite; + report.SCSI.MultiMediaDevice.Features.CanOverwriteSAOTrack = + ftr002E.Value.CDRW; report.SCSI.MultiMediaDevice.Features.CanWriteRWSubchannelInSAO = ftr002E.Value.RW; } } @@ -369,8 +389,9 @@ namespace DiscImageChef.Core.Devices.Report.SCSI 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.CanWriteDVDRDL = ftr002F.Value.RDL; + report.SCSI.MultiMediaDevice.Features.CanTestWriteDVD = + ftr002F.Value.TestWrite; report.SCSI.MultiMediaDevice.Features.CanWriteDVDRW = ftr002F.Value.DVDRW; } } @@ -417,13 +438,13 @@ namespace DiscImageChef.Core.Devices.Report.SCSI Feature_0040? ftr0040 = 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.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; } } @@ -434,11 +455,11 @@ namespace DiscImageChef.Core.Devices.Report.SCSI Feature_0041? ftr0041 = 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.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.CanWriteBDR = ftr0041.Value.R; + report.SCSI.MultiMediaDevice.Features.CanWriteOldBDR = ftr0041.Value.OldR; } } break; @@ -448,7 +469,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI Feature_0050? ftr0050 = Features.Decode_0050(desc.Data); if(ftr0050.HasValue) { - report.SCSI.MultiMediaDevice.Features.CanReadHDDVDR = ftr0050.Value.HDDVDR; + report.SCSI.MultiMediaDevice.Features.CanReadHDDVDR = ftr0050.Value.HDDVDR; report.SCSI.MultiMediaDevice.Features.CanReadHDDVDRAM = ftr0050.Value.HDDVDRAM; } } @@ -459,7 +480,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI Feature_0051? ftr0051 = Features.Decode_0051(desc.Data); if(ftr0051.HasValue) { - report.SCSI.MultiMediaDevice.Features.CanWriteHDDVDR = ftr0051.Value.HDDVDR; + report.SCSI.MultiMediaDevice.Features.CanWriteHDDVDR = ftr0051.Value.HDDVDR; report.SCSI.MultiMediaDevice.Features.CanWriteHDDVDRAM = ftr0051.Value.HDDVDRAM; } } @@ -491,13 +512,14 @@ namespace DiscImageChef.Core.Devices.Report.SCSI Feature_0103? ftr0103 = Features.Decode_0103(desc.Data); if(ftr0103.HasValue) { - report.SCSI.MultiMediaDevice.Features.CanAudioScan = ftr0103.Value.Scan; + report.SCSI.MultiMediaDevice.Features.CanAudioScan = ftr0103.Value.Scan; report.SCSI.MultiMediaDevice.Features.CanMuteSeparateChannels = ftr0103.Value.SCM; - report.SCSI.MultiMediaDevice.Features.SupportsSeparateVolume = ftr0103.Value.SV; + 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.VolumeLevels = + ftr0103.Value.VolumeLevels; } } } @@ -513,7 +535,8 @@ namespace DiscImageChef.Core.Devices.Report.SCSI if(ftr0106.Value.CSSVersion > 0) { report.SCSI.MultiMediaDevice.Features.CSSVersionSpecified = true; - report.SCSI.MultiMediaDevice.Features.CSSVersion = ftr0106.Value.CSSVersion; + report.SCSI.MultiMediaDevice.Features.CSSVersion = + ftr0106.Value.CSSVersion; } } break; @@ -531,7 +554,8 @@ namespace DiscImageChef.Core.Devices.Report.SCSI if(ftr010B.Value.CPRMVersion > 0) { report.SCSI.MultiMediaDevice.Features.CPRMVersionSpecified = true; - report.SCSI.MultiMediaDevice.Features.CPRMVersion = ftr010B.Value.CPRMVersion; + report.SCSI.MultiMediaDevice.Features.CPRMVersion = + ftr010B.Value.CPRMVersion; } } break; @@ -546,23 +570,23 @@ namespace DiscImageChef.Core.Devices.Report.SCSI temp[2] = (byte)((ftr010C.Value.Year & 0xFF00) >> 8); temp[3] = (byte)(ftr010C.Value.Year & 0xFF); string syear = Encoding.ASCII.GetString(temp); - temp = new byte[2]; + temp = new byte[2]; temp[0] = (byte)((ftr010C.Value.Month & 0xFF00) >> 8); temp[1] = (byte)(ftr010C.Value.Month & 0xFF); string smonth = Encoding.ASCII.GetString(temp); - temp = new byte[2]; + temp = new byte[2]; temp[0] = (byte)((ftr010C.Value.Day & 0xFF00) >> 8); temp[1] = (byte)(ftr010C.Value.Day & 0xFF); string sday = Encoding.ASCII.GetString(temp); - temp = new byte[2]; + temp = new byte[2]; temp[0] = (byte)((ftr010C.Value.Hour & 0xFF00) >> 8); temp[1] = (byte)(ftr010C.Value.Hour & 0xFF); string shour = Encoding.ASCII.GetString(temp); - temp = new byte[2]; + temp = new byte[2]; temp[0] = (byte)((ftr010C.Value.Minute & 0xFF00) >> 8); temp[1] = (byte)(ftr010C.Value.Minute & 0xFF); string sminute = Encoding.ASCII.GetString(temp); - temp = new byte[2]; + temp = new byte[2]; temp[0] = (byte)((ftr010C.Value.Second & 0xFF00) >> 8); temp[1] = (byte)(ftr010C.Value.Second & 0xFF); string ssecond = Encoding.ASCII.GetString(temp); @@ -576,12 +600,12 @@ namespace DiscImageChef.Core.Devices.Report.SCSI report.SCSI.MultiMediaDevice.Features.FirmwareDateSpecified = true; } -#pragma warning disable RECS0022 // A catch clause that catches System.Exception and has an empty body + #pragma warning disable RECS0022 // A catch clause that catches System.Exception and has an empty body catch { // ignored } -#pragma warning restore RECS0022 // A catch clause that catches System.Exception and has an empty body + #pragma warning restore RECS0022 // A catch clause that catches System.Exception and has an empty body } } break; @@ -596,7 +620,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI 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.SupportsBusEncryption = ftr010D.Value.BEC; report.SCSI.MultiMediaDevice.Features.CanGenerateBindingNonce = ftr010D.Value.BNG; if(ftr010D.Value.BindNonceBlocks > 0) @@ -609,13 +633,14 @@ namespace DiscImageChef.Core.Devices.Report.SCSI if(ftr010D.Value.AGIDs > 0) { report.SCSI.MultiMediaDevice.Features.AGIDsSpecified = true; - report.SCSI.MultiMediaDevice.Features.AGIDs = ftr010D.Value.AGIDs; + 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; + report.SCSI.MultiMediaDevice.Features.AACSVersion = + ftr010D.Value.AACSVersion; } } } @@ -635,12 +660,12 @@ 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 || + 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) { @@ -660,7 +685,8 @@ namespace DiscImageChef.Core.Devices.Report.SCSI } 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) { @@ -669,11 +695,11 @@ namespace DiscImageChef.Core.Devices.Report.SCSI 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 || + 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.CanReadDVDPlusRW || report.SCSI.MultiMediaDevice.Features.CanReadDVDPlusRWDL) { if(!mediaTypes.Contains("DVD-ROM")) mediaTypes.Add("DVD-ROM"); @@ -686,7 +712,8 @@ namespace DiscImageChef.Core.Devices.Report.SCSI } 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) @@ -697,15 +724,16 @@ namespace DiscImageChef.Core.Devices.Report.SCSI } 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"); } bool tryPlextor = false, tryHldtst = false, tryPioneer = false, tryNec = false; tryPlextor |= dev.Manufacturer.ToLowerInvariant() == "plextor"; - tryHldtst |= dev.Manufacturer.ToLowerInvariant() == "hl-dt-st"; + tryHldtst |= dev.Manufacturer.ToLowerInvariant() == "hl-dt-st"; tryPioneer |= dev.Manufacturer.ToLowerInvariant() == "pioneer"; - tryNec |= dev.Manufacturer.ToLowerInvariant() == "nec"; + tryNec |= dev.Manufacturer.ToLowerInvariant() == "nec"; // Very old CD drives do not contain mode page 2Ah neither GET CONFIGURATION, so just try all CDs on them // Also don't get confident, some drives didn't know CD-RW but are able to read them @@ -796,7 +824,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI if(mediaTest.MediaIsRecognized) { - mediaTest.SupportsReadCapacitySpecified = true; + mediaTest.SupportsReadCapacitySpecified = true; mediaTest.SupportsReadCapacity16Specified = true; DicConsole.WriteLine("Querying SCSI READ CAPACITY..."); @@ -808,7 +836,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI (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.BlocksSpecified = true; mediaTest.BlockSizeSpecified = true; } @@ -823,7 +851,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI mediaTest.Blocks = BitConverter.ToUInt64(temp, 0) + 1; mediaTest.BlockSize = (uint)((buffer[5] << 24) + (buffer[5] << 16) + (buffer[6] << 8) + buffer[7]); - mediaTest.BlocksSpecified = true; + mediaTest.BlocksSpecified = true; mediaTest.BlockSizeSpecified = true; } @@ -835,34 +863,35 @@ namespace DiscImageChef.Core.Devices.Report.SCSI if(!sense && !dev.Error) { report.SCSI.SupportsModeSense10 = true; - decMode = Modes.DecodeMode10(buffer, dev.ScsiType); + decMode = Modes.DecodeMode10(buffer, dev.ScsiType); if(debug) mediaTest.ModeSense10Data = buffer; } + DicConsole.WriteLine("Querying SCSI MODE SENSE..."); sense = dev.ModeSense(out buffer, out senseBuffer, TIMEOUT, out _); if(!sense && !dev.Error) { report.SCSI.SupportsModeSense6 = true; - if(!decMode.HasValue) decMode = Modes.DecodeMode6(buffer, dev.ScsiType); + if(!decMode.HasValue) decMode = Modes.DecodeMode6(buffer, dev.ScsiType); if(debug) mediaTest.ModeSense6Data = buffer; } if(decMode.HasValue) { - mediaTest.MediumType = (byte)decMode.Value.Header.MediumType; + mediaTest.MediumType = (byte)decMode.Value.Header.MediumType; mediaTest.MediumTypeSpecified = true; - if(decMode.Value.Header.BlockDescriptors != null && + if(decMode.Value.Header.BlockDescriptors != null && decMode.Value.Header.BlockDescriptors.Length > 0) { - mediaTest.Density = (byte)decMode.Value.Header.BlockDescriptors[0].Density; + mediaTest.Density = (byte)decMode.Value.Header.BlockDescriptors[0].Density; mediaTest.DensitySpecified = true; } } - if(mediaType.StartsWith("CD-", StringComparison.Ordinal) || + if(mediaType.StartsWith("CD-", StringComparison.Ordinal) || mediaType.StartsWith("DDCD-", StringComparison.Ordinal) || mediaType == "Audio CD") { - mediaTest.CanReadTOCSpecified = true; + mediaTest.CanReadTOCSpecified = true; mediaTest.CanReadFullTOCSpecified = true; DicConsole.WriteLine("Querying CD TOC..."); mediaTest.CanReadTOC = @@ -882,11 +911,11 @@ namespace DiscImageChef.Core.Devices.Report.SCSI mediaType + ".bin", "read results", buffer); } - if(mediaType.StartsWith("CD-R", StringComparison.Ordinal) || + if(mediaType.StartsWith("CD-R", StringComparison.Ordinal) || mediaType.StartsWith("DDCD-R", StringComparison.Ordinal)) { mediaTest.CanReadATIPSpecified = true; - mediaTest.CanReadPMASpecified = true; + mediaTest.CanReadPMASpecified = true; DicConsole.WriteLine("Querying CD ATIP..."); mediaTest.CanReadATIP = !dev.ReadAtip(out buffer, out senseBuffer, TIMEOUT, out _); DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}", !mediaTest.CanReadATIP); @@ -903,7 +932,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI mediaType + ".bin", "read results", buffer); } - if(mediaType.StartsWith("DVD-", StringComparison.Ordinal) || + if(mediaType.StartsWith("DVD-", StringComparison.Ordinal) || mediaType.StartsWith("HD DVD-", StringComparison.Ordinal)) { mediaTest.CanReadPFISpecified = true; @@ -984,7 +1013,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI break; case "DVD-RAM": case "HD DVD-RAM": - mediaTest.CanReadDDSSpecified = true; + mediaTest.CanReadDDSSpecified = true; mediaTest.CanReadSpareAreaInformationSpecified = true; mediaTest.CanReadDDS = !dev.ReadDiscStructure(out buffer, out senseBuffer, MmcDiscStructureMediaType.Dvd, @@ -1009,7 +1038,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI if(mediaType.StartsWith("BD-R", StringComparison.Ordinal) && mediaType != "BD-ROM") { - mediaTest.CanReadDDSSpecified = true; + mediaTest.CanReadDDSSpecified = true; mediaTest.CanReadSpareAreaInformationSpecified = true; DicConsole.WriteLine("Querying BD DDS..."); mediaTest.CanReadDDS = @@ -1049,7 +1078,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI if(mediaType == "DVD-R" || mediaType == "DVD-RW" || mediaType == "HD DVD-R") { - mediaTest.CanReadMediaIDSpecified = true; + mediaTest.CanReadMediaIDSpecified = true; mediaTest.CanReadRecordablePFISpecified = true; DicConsole.WriteLine("Querying DVD Media ID..."); mediaTest.CanReadMediaID = @@ -1075,7 +1104,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI if(mediaType.StartsWith("DVD+R", StringComparison.Ordinal) || mediaType == "DVD+MRW") { mediaTest.CanReadADIPSpecified = true; - mediaTest.CanReadDCBSpecified = true; + mediaTest.CanReadDCBSpecified = true; DicConsole.WriteLine("Querying DVD ADIP..."); mediaTest.CanReadADIP = !dev.ReadDiscStructure(out buffer, out senseBuffer, MmcDiscStructureMediaType.Dvd, 0, 0, @@ -1128,7 +1157,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI if(mediaType.StartsWith("BD-R", StringComparison.Ordinal)) { mediaTest.CanReadDiscInformationSpecified = true; - mediaTest.CanReadPACSpecified = true; + mediaTest.CanReadPACSpecified = true; DicConsole.WriteLine("Querying BD Disc Information..."); mediaTest.CanReadDiscInformation = !dev.ReadDiscStructure(out buffer, out senseBuffer, MmcDiscStructureMediaType.Bd, 0, 0, @@ -1149,7 +1178,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI mediaType + ".bin", "read results", buffer); } - mediaTest.SupportsReadSpecified = true; + mediaTest.SupportsReadSpecified = true; mediaTest.SupportsRead10Specified = true; mediaTest.SupportsRead12Specified = true; mediaTest.SupportsRead16Specified = true; @@ -1193,7 +1222,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI 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): "); + .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(); } @@ -1201,22 +1230,22 @@ namespace DiscImageChef.Core.Devices.Report.SCSI tryPlextor |= pressedKey.Key == ConsoleKey.Y; } - if(mediaType.StartsWith("CD-", StringComparison.Ordinal) || + if(mediaType.StartsWith("CD-", StringComparison.Ordinal) || mediaType.StartsWith("DDCD-", StringComparison.Ordinal) || mediaType == "Audio CD") { - mediaTest.CanReadC2PointersSpecified = true; - mediaTest.CanReadCorrectedSubchannelSpecified = true; + mediaTest.CanReadC2PointersSpecified = true; + mediaTest.CanReadCorrectedSubchannelSpecified = true; mediaTest.CanReadCorrectedSubchannelWithC2Specified = true; - mediaTest.CanReadLeadInSpecified = true; - mediaTest.CanReadLeadOutSpecified = true; - mediaTest.CanReadPQSubchannelSpecified = true; - mediaTest.CanReadPQSubchannelWithC2Specified = true; - mediaTest.CanReadRWSubchannelSpecified = true; - mediaTest.CanReadRWSubchannelWithC2Specified = true; - mediaTest.SupportsReadCdMsfSpecified = true; - mediaTest.SupportsReadCdSpecified = true; - mediaTest.SupportsReadCdMsfRawSpecified = true; - mediaTest.SupportsReadCdRawSpecified = true; + mediaTest.CanReadLeadInSpecified = true; + mediaTest.CanReadLeadOutSpecified = true; + mediaTest.CanReadPQSubchannelSpecified = true; + mediaTest.CanReadPQSubchannelWithC2Specified = true; + mediaTest.CanReadRWSubchannelSpecified = true; + mediaTest.CanReadRWSubchannelWithC2Specified = true; + mediaTest.SupportsReadCdMsfSpecified = true; + mediaTest.SupportsReadCdSpecified = true; + mediaTest.SupportsReadCdMsfRawSpecified = true; + mediaTest.SupportsReadCdRawSpecified = true; if(mediaType == "Audio CD") { @@ -1687,7 +1716,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI 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): "); + .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(); } @@ -1701,7 +1730,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI 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): "); + .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(); } @@ -1727,7 +1756,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI if(tryPioneer) { - mediaTest.SupportsPioneerReadCDDASpecified = true; + mediaTest.SupportsPioneerReadCDDASpecified = true; mediaTest.SupportsPioneerReadCDDAMSFSpecified = true; DicConsole.WriteLine("Trying Pioneer READ CD-DA..."); mediaTest.SupportsPioneerReadCDDA = @@ -1773,12 +1802,13 @@ namespace DiscImageChef.Core.Devices.Report.SCSI FixedSense? decSense = Sense.DecodeFixed(senseBuffer); if(decSense.HasValue) if(decSense.Value.SenseKey == SenseKeys.IllegalRequest && decSense.Value.ASC == 0x24 && - decSense.Value.ASCQ == 0x00) + 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; } } @@ -1791,7 +1821,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI 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): "); + .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(); } @@ -1805,8 +1835,8 @@ namespace DiscImageChef.Core.Devices.Report.SCSI sense = dev.ReadLong10(out buffer, out senseBuffer, false, false, 0, 37856, TIMEOUT, out _); if(!sense && !dev.Error) { - mediaTest.SupportsReadLong = true; - mediaTest.LongBlockSize = 37856; + mediaTest.SupportsReadLong = true; + mediaTest.LongBlockSize = 37856; mediaTest.LongBlockSizeSpecified = true; } } @@ -1847,7 +1877,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI 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): "); + .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(); } @@ -1868,7 +1898,8 @@ namespace DiscImageChef.Core.Devices.Report.SCSI bingo.Write(buffer, 0, buffer.Length); bingo.Close(); } - mediaTest.LongBlockSize = i; + + mediaTest.LongBlockSize = i; mediaTest.LongBlockSizeSpecified = true; break; } diff --git a/DiscImageChef.Core/Devices/Report/SCSI/SSC.cs b/DiscImageChef.Core/Devices/Report/SCSI/SSC.cs index a4b5ec8e0..ba8dc6aff 100644 --- a/DiscImageChef.Core/Devices/Report/SCSI/SSC.cs +++ b/DiscImageChef.Core/Devices/Report/SCSI/SSC.cs @@ -56,8 +56,8 @@ namespace DiscImageChef.Core.Devices.Report.SCSI { if(report == null) return; - bool sense; - const uint TIMEOUT = 5; + bool sense; + const uint TIMEOUT = 5; ConsoleKeyInfo pressedKey; report.SCSI.SequentialDevice = new sscType(); @@ -71,17 +71,19 @@ namespace DiscImageChef.Core.Devices.Report.SCSI if(decBl.Value.granularity > 0) { report.SCSI.SequentialDevice.BlockSizeGranularitySpecified = true; - report.SCSI.SequentialDevice.BlockSizeGranularity = decBl.Value.granularity; + report.SCSI.SequentialDevice.BlockSizeGranularity = decBl.Value.granularity; } + if(decBl.Value.maxBlockLen > 0) { report.SCSI.SequentialDevice.MaxBlockLengthSpecified = true; - report.SCSI.SequentialDevice.MaxBlockLength = decBl.Value.maxBlockLen; + report.SCSI.SequentialDevice.MaxBlockLength = decBl.Value.maxBlockLen; } + if(decBl.Value.minBlockLen > 0) { report.SCSI.SequentialDevice.MinBlockLengthSpecified = true; - report.SCSI.SequentialDevice.MinBlockLength = decBl.Value.minBlockLen; + report.SCSI.SequentialDevice.MinBlockLength = decBl.Value.minBlockLen; } } } @@ -98,7 +100,8 @@ namespace DiscImageChef.Core.Devices.Report.SCSI 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].Capacity = + dsh.Value.descriptors[i].capacity; report.SCSI.SequentialDevice.SupportedDensities[i].DefaultDensity = dsh.Value.descriptors[i].defaultDensity; report.SCSI.SequentialDevice.SupportedDensities[i].Description = @@ -112,8 +115,8 @@ namespace DiscImageChef.Core.Devices.Report.SCSI 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].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; } } @@ -228,7 +231,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI if(!sense && !dev.Error) { report.SCSI.SupportsModeSense10 = true; - decMode = Modes.DecodeMode10(buffer, dev.ScsiType); + decMode = Modes.DecodeMode10(buffer, dev.ScsiType); if(debug) seqTest.ModeSense10Data = buffer; } @@ -237,18 +240,18 @@ namespace DiscImageChef.Core.Devices.Report.SCSI if(!sense && !dev.Error) { report.SCSI.SupportsModeSense6 = true; - if(!decMode.HasValue) decMode = Modes.DecodeMode6(buffer, dev.ScsiType); + if(!decMode.HasValue) decMode = Modes.DecodeMode6(buffer, dev.ScsiType); if(debug) seqTest.ModeSense6Data = buffer; } if(decMode.HasValue) { - seqTest.MediumType = (byte)decMode.Value.Header.MediumType; + seqTest.MediumType = (byte)decMode.Value.Header.MediumType; seqTest.MediumTypeSpecified = true; - if(decMode.Value.Header.BlockDescriptors != null && + if(decMode.Value.Header.BlockDescriptors != null && decMode.Value.Header.BlockDescriptors.Length > 0) { - seqTest.Density = (byte)decMode.Value.Header.BlockDescriptors[0].Density; + seqTest.Density = (byte)decMode.Value.Header.BlockDescriptors[0].Density; seqTest.DensitySpecified = true; } } @@ -264,18 +267,18 @@ namespace DiscImageChef.Core.Devices.Report.SCSI seqTest.SupportedDensities = new SupportedDensity[dsh.Value.descriptors.Length]; for(int i = 0; i < dsh.Value.descriptors.Length; i++) { - seqTest.SupportedDensities[i].BitsPerMm = dsh.Value.descriptors[i].bpmm; - seqTest.SupportedDensities[i].Capacity = dsh.Value.descriptors[i].capacity; + seqTest.SupportedDensities[i].BitsPerMm = dsh.Value.descriptors[i].bpmm; + seqTest.SupportedDensities[i].Capacity = dsh.Value.descriptors[i].capacity; seqTest.SupportedDensities[i].DefaultDensity = dsh.Value.descriptors[i].defaultDensity; - seqTest.SupportedDensities[i].Description = dsh.Value.descriptors[i].description; - seqTest.SupportedDensities[i].Duplicate = dsh.Value.descriptors[i].duplicate; - seqTest.SupportedDensities[i].Name = dsh.Value.descriptors[i].name; - seqTest.SupportedDensities[i].Organization = dsh.Value.descriptors[i].organization; - seqTest.SupportedDensities[i].PrimaryCode = dsh.Value.descriptors[i].primaryCode; - seqTest.SupportedDensities[i].SecondaryCode = dsh.Value.descriptors[i].secondaryCode; - seqTest.SupportedDensities[i].Tracks = dsh.Value.descriptors[i].tracks; - seqTest.SupportedDensities[i].Width = dsh.Value.descriptors[i].width; - seqTest.SupportedDensities[i].Writable = dsh.Value.descriptors[i].writable; + seqTest.SupportedDensities[i].Description = dsh.Value.descriptors[i].description; + seqTest.SupportedDensities[i].Duplicate = dsh.Value.descriptors[i].duplicate; + seqTest.SupportedDensities[i].Name = dsh.Value.descriptors[i].name; + seqTest.SupportedDensities[i].Organization = dsh.Value.descriptors[i].organization; + seqTest.SupportedDensities[i].PrimaryCode = dsh.Value.descriptors[i].primaryCode; + seqTest.SupportedDensities[i].SecondaryCode = dsh.Value.descriptors[i].secondaryCode; + seqTest.SupportedDensities[i].Tracks = dsh.Value.descriptors[i].tracks; + seqTest.SupportedDensities[i].Width = dsh.Value.descriptors[i].width; + seqTest.SupportedDensities[i].Writable = dsh.Value.descriptors[i].writable; } } } @@ -290,12 +293,12 @@ namespace DiscImageChef.Core.Devices.Report.SCSI seqTest.SupportedMediaTypes = new SupportedMedia[mtsh.Value.descriptors.Length]; for(int i = 0; i < mtsh.Value.descriptors.Length; i++) { - seqTest.SupportedMediaTypes[i].Description = mtsh.Value.descriptors[i].description; - seqTest.SupportedMediaTypes[i].Length = mtsh.Value.descriptors[i].length; - seqTest.SupportedMediaTypes[i].MediumType = mtsh.Value.descriptors[i].mediumType; - seqTest.SupportedMediaTypes[i].Name = mtsh.Value.descriptors[i].name; + seqTest.SupportedMediaTypes[i].Description = mtsh.Value.descriptors[i].description; + seqTest.SupportedMediaTypes[i].Length = mtsh.Value.descriptors[i].length; + seqTest.SupportedMediaTypes[i].MediumType = mtsh.Value.descriptors[i].mediumType; + seqTest.SupportedMediaTypes[i].Name = mtsh.Value.descriptors[i].name; seqTest.SupportedMediaTypes[i].Organization = mtsh.Value.descriptors[i].organization; - seqTest.SupportedMediaTypes[i].Width = mtsh.Value.descriptors[i].width; + seqTest.SupportedMediaTypes[i].Width = mtsh.Value.descriptors[i].width; if(mtsh.Value.descriptors[i].densityCodes == null) continue; seqTest.SupportedMediaTypes[i].DensityCodes = diff --git a/DiscImageChef.Core/Devices/Report/SecureDigital.cs b/DiscImageChef.Core/Devices/Report/SecureDigital.cs index 32fe44b44..0cf09f6b8 100644 --- a/DiscImageChef.Core/Devices/Report/SecureDigital.cs +++ b/DiscImageChef.Core/Devices/Report/SecureDigital.cs @@ -71,21 +71,21 @@ namespace DiscImageChef.Core.Devices.Report { case DeviceType.SecureDigital: // Clear serial number and manufacturing date - cid[9] = 0; - cid[10] = 0; - cid[11] = 0; - cid[12] = 0; - cid[13] = 0; - cid[14] = 0; + cid[9] = 0; + cid[10] = 0; + cid[11] = 0; + cid[12] = 0; + cid[13] = 0; + cid[14] = 0; report.SecureDigital.CID = cid; break; case DeviceType.MMC: // Clear serial number and manufacturing date - cid[10] = 0; - cid[11] = 0; - cid[12] = 0; - cid[13] = 0; - cid[14] = 0; + cid[10] = 0; + cid[11] = 0; + cid[12] = 0; + cid[13] = 0; + cid[14] = 0; report.MultiMediaCard.CID = cid; break; } @@ -134,6 +134,7 @@ namespace DiscImageChef.Core.Devices.Report report.MultiMediaCard.ExtendedCSD = ecsd; } else DicConsole.WriteLine("Could not read Extended CSD..."); + break; } case DeviceType.SecureDigital: @@ -157,6 +158,7 @@ namespace DiscImageChef.Core.Devices.Report report.SecureDigital.SCR = scr; } else DicConsole.WriteLine("Could not read SCR..."); + break; } } diff --git a/DiscImageChef.Core/Devices/Report/USB.cs b/DiscImageChef.Core/Devices/Report/USB.cs index 7e1f7cfb5..0816c1b55 100644 --- a/DiscImageChef.Core/Devices/Report/USB.cs +++ b/DiscImageChef.Core/Devices/Report/USB.cs @@ -66,9 +66,9 @@ namespace DiscImageChef.Core.Devices.Report report.USB = new usbType { Manufacturer = dev.UsbManufacturerString, - Product = dev.UsbProductString, - ProductID = dev.UsbProductId, - VendorID = dev.UsbVendorId + Product = dev.UsbProductString, + ProductID = dev.UsbProductId, + VendorID = dev.UsbVendorId }; pressedKey = new ConsoleKeyInfo(); @@ -80,7 +80,7 @@ namespace DiscImageChef.Core.Devices.Report } report.USB.RemovableMedia = pressedKey.Key == ConsoleKey.Y; - removable = report.USB.RemovableMedia; + removable = report.USB.RemovableMedia; if(debug) report.USB.Descriptors = dev.UsbDescriptors; } } diff --git a/DiscImageChef.Core/Devices/Scanning/ATA.cs b/DiscImageChef.Core/Devices/Scanning/ATA.cs index 04942b321..0bd928703 100644 --- a/DiscImageChef.Core/Devices/Scanning/ATA.cs +++ b/DiscImageChef.Core/Devices/Scanning/ATA.cs @@ -55,11 +55,11 @@ namespace DiscImageChef.Core.Devices.Scanning public static ScanResults Scan(string mhddLogPath, string ibgLogPath, string devicePath, Device dev) { ScanResults results = new ScanResults(); - bool aborted; - bool sense; + bool aborted; + bool sense; results.Blocks = 0; const ushort ATA_PROFILE = 0x0001; - const uint TIMEOUT = 5; + const uint TIMEOUT = 5; sense = dev.AtaIdentify(out byte[] cmdBuf, out _); if(!sense && Identify.Decode(cmdBuf).HasValue) @@ -73,6 +73,7 @@ namespace DiscImageChef.Core.Devices.Scanning DicConsole.ErrorWriteLine(ataReader.ErrorMessage); return results; } + // Check block sizes if(ataReader.GetBlockSize()) { @@ -88,46 +89,46 @@ namespace DiscImageChef.Core.Devices.Scanning return results; } - uint blocksToRead = ataReader.BlocksToRead; - ushort cylinders = ataReader.Cylinders; - byte heads = ataReader.Heads; - byte sectors = ataReader.Sectors; + uint blocksToRead = ataReader.BlocksToRead; + ushort cylinders = ataReader.Cylinders; + byte heads = ataReader.Heads; + byte sectors = ataReader.Sectors; - results.A = 0; // <3ms - results.B = 0; // >=3ms, <10ms - results.C = 0; // >=10ms, <50ms - results.D = 0; // >=50ms, <150ms - results.E = 0; // >=150ms, <500ms - results.F = 0; // >=500ms + results.A = 0; // <3ms + results.B = 0; // >=3ms, <10ms + results.C = 0; // >=10ms, <50ms + results.D = 0; // >=50ms, <150ms + results.E = 0; // >=150ms, <500ms + results.F = 0; // >=500ms results.Errored = 0; DateTime start; DateTime end; results.ProcessingTime = 0; double currentSpeed = 0; - results.MaxSpeed = double.MinValue; - results.MinSpeed = double.MaxValue; + results.MaxSpeed = double.MinValue; + results.MinSpeed = double.MaxValue; results.UnreadableSectors = new List(); - results.SeekMax = double.MinValue; - results.SeekMin = double.MaxValue; - results.SeekTotal = 0; + results.SeekMax = double.MinValue; + results.SeekMin = double.MaxValue; + results.SeekTotal = 0; const int SEEK_TIMES = 1000; double seekCur; Random rnd = new Random(); - aborted = false; + aborted = false; System.Console.CancelKeyPress += (sender, e) => e.Cancel = aborted = true; MhddLog mhddLog; - IbgLog ibgLog; - double duration; + IbgLog ibgLog; + double duration; if(ataReader.IsLba) { DicConsole.WriteLine("Reading {0} sectors at a time.", blocksToRead); mhddLog = new MhddLog(mhddLogPath, dev, results.Blocks, blockSize, blocksToRead); - ibgLog = new IbgLog(ibgLogPath, ATA_PROFILE); + ibgLog = new IbgLog(ibgLogPath, ATA_PROFILE); start = DateTime.UtcNow; for(ulong i = 0; i < results.Blocks; i += blocksToRead) @@ -136,10 +137,10 @@ namespace DiscImageChef.Core.Devices.Scanning if(results.Blocks - i < blocksToRead) blocksToRead = (byte)(results.Blocks - i); -#pragma warning disable RECS0018 // Comparison of floating point numbers with equality operator + #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; -#pragma warning restore RECS0018 // Comparison of floating point numbers with equality operator + #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); @@ -148,12 +149,12 @@ namespace DiscImageChef.Core.Devices.Scanning if(!error) { - if(duration >= 500) results.F += 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; + 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); @@ -168,7 +169,8 @@ namespace DiscImageChef.Core.Devices.Scanning ibgLog.Write(i, 0); } - double newSpeed = (double)blockSize * blocksToRead / 1048576 / (duration / 1000); + double newSpeed = + (double)blockSize * blocksToRead / 1048576 / (duration / 1000); if(!double.IsInfinity(newSpeed)) currentSpeed = newSpeed; } @@ -176,7 +178,8 @@ namespace DiscImageChef.Core.Devices.Scanning DicConsole.WriteLine(); mhddLog.Close(); ibgLog.Close(dev, results.Blocks, blockSize, (end - start).TotalSeconds, currentSpeed * 1024, - blockSize * (double)(results.Blocks + 1) / 1024 / (results.ProcessingTime / 1000), + blockSize * (double)(results.Blocks + 1) / 1024 / + (results.ProcessingTime / 1000), devicePath); if(ataReader.CanSeekLba) @@ -190,10 +193,10 @@ namespace DiscImageChef.Core.Devices.Scanning ataReader.Seek(seekPos, out seekCur); -#pragma warning disable RECS0018 // Comparison of floating point numbers with equality operator + #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; -#pragma warning restore RECS0018 // Comparison of floating point numbers with equality operator + #pragma warning restore RECS0018 // Comparison of floating point numbers with equality operator results.SeekTotal += seekCur; GC.Collect(); @@ -202,11 +205,11 @@ namespace DiscImageChef.Core.Devices.Scanning else { mhddLog = new MhddLog(mhddLogPath, dev, results.Blocks, blockSize, blocksToRead); - ibgLog = new IbgLog(ibgLogPath, ATA_PROFILE); + ibgLog = new IbgLog(ibgLogPath, ATA_PROFILE); ulong currentBlock = 0; results.Blocks = (ulong)(cylinders * heads * sectors); - start = DateTime.UtcNow; + start = DateTime.UtcNow; for(ushort cy = 0; cy < cylinders; cy++) { for(byte hd = 0; hd < heads; hd++) @@ -215,12 +218,12 @@ namespace DiscImageChef.Core.Devices.Scanning { if(aborted) break; -#pragma warning disable RECS0018 // Comparison of floating point numbers with equality operator + #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; -#pragma warning restore RECS0018 // Comparison of floating point numbers with equality operator + #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); @@ -229,12 +232,12 @@ namespace DiscImageChef.Core.Devices.Scanning if(!error) { - if(duration >= 500) results.F += 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; + 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); @@ -248,7 +251,8 @@ namespace DiscImageChef.Core.Devices.Scanning ibgLog.Write(currentBlock, 0); } - double newSpeed = blockSize / (double)1048576 / (duration / 1000); + double newSpeed = + blockSize / (double)1048576 / (duration / 1000); if(!double.IsInfinity(newSpeed)) currentSpeed = newSpeed; currentBlock++; @@ -260,7 +264,8 @@ namespace DiscImageChef.Core.Devices.Scanning DicConsole.WriteLine(); mhddLog.Close(); ibgLog.Close(dev, results.Blocks, blockSize, (end - start).TotalSeconds, currentSpeed * 1024, - blockSize * (double)(results.Blocks + 1) / 1024 / (results.ProcessingTime / 1000), + blockSize * (double)(results.Blocks + 1) / 1024 / + (results.ProcessingTime / 1000), devicePath); if(ataReader.CanSeek) @@ -269,18 +274,18 @@ namespace DiscImageChef.Core.Devices.Scanning if(aborted) break; ushort seekCy = (ushort)rnd.Next(cylinders); - byte seekHd = (byte)rnd.Next(heads); - byte seekSc = (byte)rnd.Next(sectors); + byte seekHd = (byte)rnd.Next(heads); + byte seekSc = (byte)rnd.Next(sectors); 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 + #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; -#pragma warning restore RECS0018 // Comparison of floating point numbers with equality operator + #pragma warning restore RECS0018 // Comparison of floating point numbers with equality operator results.SeekTotal += seekCur; GC.Collect(); @@ -290,9 +295,9 @@ namespace DiscImageChef.Core.Devices.Scanning DicConsole.WriteLine(); results.ProcessingTime /= 1000; - results.TotalTime = (end - start).TotalSeconds; - results.AvgSpeed = blockSize * (double)(results.Blocks + 1) / 1048576 / results.ProcessingTime; - results.SeekTimes = SEEK_TIMES; + results.TotalTime = (end - start).TotalSeconds; + results.AvgSpeed = blockSize * (double)(results.Blocks + 1) / 1048576 / results.ProcessingTime; + results.SeekTimes = SEEK_TIMES; return results; } diff --git a/DiscImageChef.Core/Devices/Scanning/SCSI.cs b/DiscImageChef.Core/Devices/Scanning/SCSI.cs index 7ad0348e4..3aa1216db 100644 --- a/DiscImageChef.Core/Devices/Scanning/SCSI.cs +++ b/DiscImageChef.Core/Devices/Scanning/SCSI.cs @@ -50,13 +50,13 @@ namespace DiscImageChef.Core.Devices.Scanning public static ScanResults Scan(string mhddLogPath, string ibgLogPath, string devicePath, Device dev) { ScanResults results = new ScanResults(); - bool aborted; - MhddLog mhddLog; - IbgLog ibgLog; - byte[] senseBuf; - bool sense = false; + bool aborted; + MhddLog mhddLog; + IbgLog ibgLog; + byte[] senseBuf; + bool sense = false; results.Blocks = 0; - uint blockSize = 0; + uint blockSize = 0; ushort currentProfile = 0x0001; if(dev.IsRemovable) @@ -150,7 +150,7 @@ namespace DiscImageChef.Core.Devices.Scanning case PeripheralDeviceTypes.OpticalDevice: case PeripheralDeviceTypes.SimplifiedDevice: case PeripheralDeviceTypes.WriteOnceDevice: - scsiReader = new Reader(dev, dev.Timeout, null); + scsiReader = new Reader(dev, dev.Timeout, null); results.Blocks = scsiReader.GetDeviceBlocks(); if(scsiReader.FindReadCommand()) { @@ -166,6 +166,7 @@ namespace DiscImageChef.Core.Devices.Scanning DicConsole.WriteLine("Media has {0} blocks of {1} bytes/each. (for a total of {2} bytes)", results.Blocks, blockSize, results.Blocks * (ulong)blockSize); } + break; case PeripheralDeviceTypes.SequentialAccess: DicConsole.WriteLine("Scanning will never be supported on SCSI Streaming Devices."); @@ -179,8 +180,8 @@ namespace DiscImageChef.Core.Devices.Scanning return results; } - bool compactDisc = true; - FullTOC.CDFullTOC? toc = null; + bool compactDisc = true; + FullTOC.CDFullTOC? toc = null; if(dev.ScsiType == PeripheralDeviceTypes.MultiMediaDevice) { @@ -212,7 +213,7 @@ namespace DiscImageChef.Core.Devices.Scanning currentProfile = 0x0008; // 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 _); + bool tocSense = dev.ReadRawToc(out cmdBuf, out senseBuf, 1, dev.Timeout, out _); if(!tocSense) toc = FullTOC.Decode(cmdBuf); } } @@ -220,23 +221,23 @@ namespace DiscImageChef.Core.Devices.Scanning uint blocksToRead = 64; - results.A = 0; // <3ms - results.B = 0; // >=3ms, <10ms - results.C = 0; // >=10ms, <50ms - results.D = 0; // >=50ms, <150ms - results.E = 0; // >=150ms, <500ms - results.F = 0; // >=500ms + results.A = 0; // <3ms + results.B = 0; // >=3ms, <10ms + results.C = 0; // >=10ms, <50ms + results.D = 0; // >=50ms, <150ms + results.E = 0; // >=150ms, <500ms + results.F = 0; // >=500ms results.Errored = 0; DateTime start; DateTime end; results.ProcessingTime = 0; - results.TotalTime = 0; + results.TotalTime = 0; double currentSpeed = 0; - results.MaxSpeed = double.MinValue; - results.MinSpeed = double.MaxValue; + results.MaxSpeed = double.MinValue; + results.MinSpeed = double.MaxValue; results.UnreadableSectors = new List(); - aborted = false; + aborted = false; System.Console.CancelKeyPress += (sender, e) => e.Cancel = aborted = true; if(compactDisc) @@ -277,7 +278,7 @@ namespace DiscImageChef.Core.Devices.Scanning DicConsole.WriteLine("Reading {0} sectors at a time.", blocksToRead); mhddLog = new MhddLog(mhddLogPath, dev, results.Blocks, blockSize, blocksToRead); - ibgLog = new IbgLog(ibgLogPath, currentProfile); + ibgLog = new IbgLog(ibgLogPath, currentProfile); for(ulong i = 0; i < results.Blocks; i += blocksToRead) { @@ -287,10 +288,10 @@ namespace DiscImageChef.Core.Devices.Scanning if(results.Blocks - i < blocksToRead) blocksToRead = (uint)(results.Blocks - i); -#pragma warning disable RECS0018 // Comparison of floating point numbers with equality operator + #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; -#pragma warning restore RECS0018 // Comparison of floating point numbers with equality operator + #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); @@ -304,12 +305,12 @@ namespace DiscImageChef.Core.Devices.Scanning if(!sense) { - if(cmdDuration >= 500) results.F += 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; + 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); @@ -347,7 +348,8 @@ namespace DiscImageChef.Core.Devices.Scanning } } - double newSpeed = (double)blockSize * blocksToRead / 1048576 / (cmdDuration / 1000); + double newSpeed = + (double)blockSize * blocksToRead / 1048576 / (cmdDuration / 1000); if(!double.IsInfinity(newSpeed)) currentSpeed = newSpeed; } @@ -355,7 +357,8 @@ namespace DiscImageChef.Core.Devices.Scanning DicConsole.WriteLine(); mhddLog.Close(); ibgLog.Close(dev, results.Blocks, blockSize, (end - start).TotalSeconds, currentSpeed * 1024, - blockSize * (double)(results.Blocks + 1) / 1024 / (results.ProcessingTime / 1000), + blockSize * (double)(results.Blocks + 1) / 1024 / + (results.ProcessingTime / 1000), devicePath); } else @@ -365,7 +368,7 @@ namespace DiscImageChef.Core.Devices.Scanning DicConsole.WriteLine("Reading {0} sectors at a time.", blocksToRead); mhddLog = new MhddLog(mhddLogPath, dev, results.Blocks, blockSize, blocksToRead); - ibgLog = new IbgLog(ibgLogPath, currentProfile); + ibgLog = new IbgLog(ibgLogPath, currentProfile); for(ulong i = 0; i < results.Blocks; i += blocksToRead) { @@ -373,24 +376,24 @@ namespace DiscImageChef.Core.Devices.Scanning if(results.Blocks - i < blocksToRead) blocksToRead = (uint)(results.Blocks - i); -#pragma warning disable RECS0018 // Comparison of floating point numbers with equality operator + #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; -#pragma warning restore RECS0018 // Comparison of floating point numbers with equality operator + #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); - sense = scsiReader.ReadBlocks(out _, i, blocksToRead, out double cmdDuration); + sense = scsiReader.ReadBlocks(out _, i, blocksToRead, out double cmdDuration); results.ProcessingTime += cmdDuration; if(!sense && !dev.Error) { - if(cmdDuration >= 500) results.F += 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; + 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); @@ -405,7 +408,8 @@ namespace DiscImageChef.Core.Devices.Scanning ibgLog.Write(i, 0); } - double newSpeed = (double)blockSize * blocksToRead / 1048576 / (cmdDuration / 1000); + double newSpeed = + (double)blockSize * blocksToRead / 1048576 / (cmdDuration / 1000); if(!double.IsInfinity(newSpeed)) currentSpeed = newSpeed; } @@ -413,12 +417,13 @@ namespace DiscImageChef.Core.Devices.Scanning DicConsole.WriteLine(); mhddLog.Close(); ibgLog.Close(dev, results.Blocks, blockSize, (end - start).TotalSeconds, currentSpeed * 1024, - blockSize * (double)(results.Blocks + 1) / 1024 / (results.ProcessingTime / 1000), + blockSize * (double)(results.Blocks + 1) / 1024 / + (results.ProcessingTime / 1000), devicePath); } - results.SeekMax = double.MinValue; - results.SeekMin = double.MaxValue; + results.SeekMax = double.MinValue; + results.SeekMin = double.MaxValue; results.SeekTotal = 0; const int SEEK_TIMES = 1000; @@ -436,10 +441,10 @@ namespace DiscImageChef.Core.Devices.Scanning if(scsiReader.CanSeek) scsiReader.Seek(seekPos, out seekCur); else scsiReader.ReadBlock(out _, seekPos, out seekCur); -#pragma warning disable RECS0018 // Comparison of floating point numbers with equality operator + #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; -#pragma warning restore RECS0018 // Comparison of floating point numbers with equality operator + #pragma warning restore RECS0018 // Comparison of floating point numbers with equality operator results.SeekTotal += seekCur; GC.Collect(); @@ -448,9 +453,9 @@ namespace DiscImageChef.Core.Devices.Scanning DicConsole.WriteLine(); results.ProcessingTime /= 1000; - results.TotalTime = (end - start).TotalSeconds; - results.AvgSpeed = blockSize * (double)(results.Blocks + 1) / 1048576 / results.ProcessingTime; - results.SeekTimes = SEEK_TIMES; + results.TotalTime = (end - start).TotalSeconds; + results.AvgSpeed = blockSize * (double)(results.Blocks + 1) / 1048576 / results.ProcessingTime; + results.SeekTimes = SEEK_TIMES; return results; } diff --git a/DiscImageChef.Core/Devices/Scanning/SecureDigital.cs b/DiscImageChef.Core/Devices/Scanning/SecureDigital.cs index 4a7873b7b..00041905e 100644 --- a/DiscImageChef.Core/Devices/Scanning/SecureDigital.cs +++ b/DiscImageChef.Core/Devices/Scanning/SecureDigital.cs @@ -47,16 +47,16 @@ namespace DiscImageChef.Core.Devices.Scanning public static ScanResults Scan(string mhddLogPath, string ibgLogPath, string devicePath, Device dev) { ScanResults results = new ScanResults(); - bool aborted; - byte[] cmdBuf; - bool sense; + bool aborted; + byte[] cmdBuf; + bool sense; results.Blocks = 0; - const uint TIMEOUT = 5; - double duration; - const ushort SD_PROFILE = 0x0001; - uint blocksToRead = 128; - uint blockSize = 512; - bool byteAddressed = true; + const uint TIMEOUT = 5; + double duration; + const ushort SD_PROFILE = 0x0001; + uint blocksToRead = 128; + uint blockSize = 512; + bool byteAddressed = true; switch(dev.Type) { @@ -66,9 +66,9 @@ namespace DiscImageChef.Core.Devices.Scanning if(!sense) { ExtendedCSD ecsd = Decoders.MMC.Decoders.DecodeExtendedCSD(cmdBuf); - blocksToRead = ecsd.OptimalReadSize; + blocksToRead = ecsd.OptimalReadSize; results.Blocks = ecsd.SectorCount; - blockSize = (uint)(ecsd.SectorSize == 1 ? 4096 : 512); + blockSize = (uint)(ecsd.SectorSize == 1 ? 4096 : 512); // Supposing it's high-capacity MMC if it has Extended CSD... byteAddressed = false; } @@ -80,9 +80,10 @@ namespace DiscImageChef.Core.Devices.Scanning { CSD csd = Decoders.MMC.Decoders.DecodeCSD(cmdBuf); results.Blocks = (ulong)((csd.Size + 1) * Math.Pow(2, csd.SizeMultiplier + 2)); - blockSize = (uint)Math.Pow(2, csd.ReadBlockLength); + blockSize = (uint)Math.Pow(2, csd.ReadBlockLength); } } + break; } case DeviceType.SecureDigital: @@ -98,6 +99,7 @@ namespace DiscImageChef.Core.Devices.Scanning // Structure >=1 for SDHC/SDXC, so that's block addressed byteAddressed = csd.Structure == 0; } + break; } } @@ -123,34 +125,34 @@ namespace DiscImageChef.Core.Devices.Scanning return results; } - results.A = 0; // <3ms - results.B = 0; // >=3ms, <10ms - results.C = 0; // >=10ms, <50ms - results.D = 0; // >=50ms, <150ms - results.E = 0; // >=150ms, <500ms - results.F = 0; // >=500ms + results.A = 0; // <3ms + results.B = 0; // >=3ms, <10ms + results.C = 0; // >=10ms, <50ms + results.D = 0; // >=50ms, <150ms + results.E = 0; // >=150ms, <500ms + results.F = 0; // >=500ms results.Errored = 0; DateTime start; DateTime end; results.ProcessingTime = 0; double currentSpeed = 0; - results.MaxSpeed = double.MinValue; - results.MinSpeed = double.MaxValue; + results.MaxSpeed = double.MinValue; + results.MinSpeed = double.MaxValue; results.UnreadableSectors = new List(); - results.SeekMax = double.MinValue; - results.SeekMin = double.MaxValue; - results.SeekTotal = 0; + results.SeekMax = double.MinValue; + results.SeekMin = double.MaxValue; + results.SeekTotal = 0; const int SEEK_TIMES = 1000; Random rnd = new Random(); - aborted = false; + aborted = false; System.Console.CancelKeyPress += (sender, e) => e.Cancel = aborted = true; DicConsole.WriteLine("Reading {0} sectors at a time.", blocksToRead); MhddLog mhddLog = new MhddLog(mhddLogPath, dev, results.Blocks, blockSize, blocksToRead); - IbgLog ibgLog = new IbgLog(ibgLogPath, SD_PROFILE); + IbgLog ibgLog = new IbgLog(ibgLogPath, SD_PROFILE); start = DateTime.UtcNow; for(ulong i = 0; i < results.Blocks; i += blocksToRead) @@ -159,10 +161,10 @@ namespace DiscImageChef.Core.Devices.Scanning if(results.Blocks - i < blocksToRead) blocksToRead = (byte)(results.Blocks - i); -#pragma warning disable RECS0018 // Comparison of floating point numbers with equality operator + #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; -#pragma warning restore RECS0018 // Comparison of floating point numbers with equality operator + #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); @@ -171,12 +173,12 @@ namespace DiscImageChef.Core.Devices.Scanning if(!error) { - if(duration >= 500) results.F += 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; + 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); @@ -191,7 +193,8 @@ namespace DiscImageChef.Core.Devices.Scanning ibgLog.Write(i, 0); } - double newSpeed = (double)blockSize * blocksToRead / 1048576 / (duration / 1000); + double newSpeed = + (double)blockSize * blocksToRead / 1048576 / (duration / 1000); if(!double.IsInfinity(newSpeed)) currentSpeed = newSpeed; } @@ -199,7 +202,8 @@ namespace DiscImageChef.Core.Devices.Scanning DicConsole.WriteLine(); mhddLog.Close(); ibgLog.Close(dev, results.Blocks, blockSize, (end - start).TotalSeconds, currentSpeed * 1024, - blockSize * (double)(results.Blocks + 1) / 1024 / (results.ProcessingTime / 1000), devicePath); + blockSize * (double)(results.Blocks + 1) / 1024 / + (results.ProcessingTime / 1000), devicePath); for(int i = 0; i < SEEK_TIMES; i++) { @@ -212,10 +216,10 @@ namespace DiscImageChef.Core.Devices.Scanning dev.Read(out cmdBuf, out _, seekPos, blockSize, blocksToRead, byteAddressed, TIMEOUT, out double seekCur); -#pragma warning disable RECS0018 // Comparison of floating point numbers with equality operator + #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; -#pragma warning restore RECS0018 // Comparison of floating point numbers with equality operator + #pragma warning restore RECS0018 // Comparison of floating point numbers with equality operator results.SeekTotal += seekCur; GC.Collect(); @@ -224,9 +228,9 @@ namespace DiscImageChef.Core.Devices.Scanning DicConsole.WriteLine(); results.ProcessingTime /= 1000; - results.TotalTime = (end - start).TotalSeconds; - results.AvgSpeed = blockSize * (double)(results.Blocks + 1) / 1048576 / results.ProcessingTime; - results.SeekTimes = SEEK_TIMES; + results.TotalTime = (end - start).TotalSeconds; + results.AvgSpeed = blockSize * (double)(results.Blocks + 1) / 1048576 / results.ProcessingTime; + results.SeekTimes = SEEK_TIMES; return results; } diff --git a/DiscImageChef.Core/ImageFormat.cs b/DiscImageChef.Core/ImageFormat.cs index b8fc73d31..74f9e1024 100644 --- a/DiscImageChef.Core/ImageFormat.cs +++ b/DiscImageChef.Core/ImageFormat.cs @@ -67,7 +67,7 @@ namespace DiscImageChef.Core imageFormat = imageplugin; break; } -#pragma warning disable RECS0022 // A catch clause that catches System.Exception and has an empty body + #pragma warning disable RECS0022 // A catch clause that catches System.Exception and has an empty body catch { // ignored @@ -89,7 +89,7 @@ namespace DiscImageChef.Core imageFormat = imageplugin; break; } -#pragma warning disable RECS0022 // A catch clause that catches System.Exception and has an empty body + #pragma warning disable RECS0022 // A catch clause that catches System.Exception and has an empty body catch { // ignored diff --git a/DiscImageChef.Core/ImageInfo.cs b/DiscImageChef.Core/ImageInfo.cs index a240c93e4..f1521940c 100644 --- a/DiscImageChef.Core/ImageInfo.cs +++ b/DiscImageChef.Core/ImageInfo.cs @@ -63,7 +63,7 @@ namespace DiscImageChef.Core DicConsole.WriteLine("Was created with {0} version {1}", imageFormat.Info.Application, imageFormat.Info.ApplicationVersion); else if(!string.IsNullOrWhiteSpace(imageFormat.Info.Application)) - DicConsole.WriteLine("Was created with {0}", imageFormat.Info.Application); + DicConsole.WriteLine("Was created with {0}", imageFormat.Info.Application); DicConsole.WriteLine("Image without headers is {0} bytes long", imageFormat.Info.ImageSize); DicConsole.WriteLine("Contains a media of {0} sectors with a maximum sector size of {1} bytes (if all sectors are of the same size this would be {2} bytes)", imageFormat.Info.Sectors, imageFormat.Info.SectorSize, @@ -214,7 +214,7 @@ namespace DiscImageChef.Core Array.Copy(toc, 0, tmp, 2, toc.Length); tmp[0] = (byte)((toc.Length & 0xFF00) >> 8); tmp[1] = (byte)(toc.Length & 0xFF); - toc = tmp; + toc = tmp; } DicConsole.WriteLine("CompactDisc Table of Contents contained in image:"); @@ -233,8 +233,8 @@ namespace DiscImageChef.Core byte[] tmp = new byte[pma.Length + 2]; Array.Copy(pma, 0, tmp, 2, pma.Length); tmp[0] = (byte)((pma.Length & 0xFF00) >> 8); - tmp[1] = (byte)(pma.Length & 0xFF); - pma = tmp; + tmp[1] = (byte)(pma.Length & 0xFF); + pma = tmp; } DicConsole.WriteLine("CompactDisc Power Management Area contained in image:"); @@ -253,10 +253,10 @@ namespace DiscImageChef.Core byte[] tmp = new byte[atip.Length + 4]; Array.Copy(atip, 0, tmp, 4, atip.Length); tmp[0] = (byte)((atip.Length & 0xFF000000) >> 24); - tmp[1] = (byte)((atip.Length & 0xFF0000) >> 16); - tmp[2] = (byte)((atip.Length & 0xFF00) >> 8); - tmp[3] = (byte)(atip.Length & 0xFF); - atip = tmp; + tmp[1] = (byte)((atip.Length & 0xFF0000) >> 16); + tmp[2] = (byte)((atip.Length & 0xFF00) >> 8); + tmp[3] = (byte)(atip.Length & 0xFF); + atip = tmp; } DicConsole.WriteLine("CompactDisc Absolute Time In Pregroove (ATIP) contained in image:"); @@ -277,7 +277,7 @@ namespace DiscImageChef.Core tmp[0] = (byte)((cdtext.Length & 0xFF000000) >> 24); tmp[1] = (byte)((cdtext.Length & 0xFF0000) >> 16); tmp[2] = (byte)((cdtext.Length & 0xFF00) >> 8); - tmp[3] = (byte)(cdtext.Length & 0xFF); + tmp[3] = (byte)(cdtext.Length & 0xFF); cdtext = tmp; } @@ -547,10 +547,13 @@ namespace DiscImageChef.Core if(imageFormat.Sessions != null && imageFormat.Sessions.Count > 0) { DicConsole.WriteLine("Image sessions:"); - DicConsole.WriteLine("{0,-9}{1,-13}{2,-12}{3,-12}{4,-12}", "Session", "First track", "Last track", "Start", "End"); + DicConsole.WriteLine("{0,-9}{1,-13}{2,-12}{3,-12}{4,-12}", "Session", "First track", "Last track", + "Start", "End"); DicConsole.WriteLine("========================================================="); foreach(Session session in imageFormat.Sessions) - DicConsole.WriteLine("{0,-9}{1,-13}{2,-12}{3,-12}{4,-12}", session.SessionSequence, session.StartTrack, session.EndTrack, session.StartSector, session.EndSector); + DicConsole.WriteLine("{0,-9}{1,-13}{2,-12}{3,-12}{4,-12}", session.SessionSequence, + session.StartTrack, session.EndTrack, session.StartSector, + session.EndSector); DicConsole.WriteLine(); } } @@ -564,10 +567,15 @@ namespace DiscImageChef.Core if(imageFormat.Tracks != null && imageFormat.Tracks.Count > 0) { DicConsole.WriteLine("Image tracks:"); - DicConsole.WriteLine("{0,-7}{1,-17}{2,-6}{3,-8}{4,-12}{5,-8}{6,-12}{7,-12}", "Track", "Type", "Bps", "Raw bps", "Subchannel", "Pregap", "Start", "End"); - DicConsole.WriteLine("================================================================================="); + DicConsole.WriteLine("{0,-7}{1,-17}{2,-6}{3,-8}{4,-12}{5,-8}{6,-12}{7,-12}", "Track", "Type", "Bps", + "Raw bps", "Subchannel", "Pregap", "Start", "End"); + DicConsole + .WriteLine("================================================================================="); foreach(Track track in imageFormat.Tracks) - DicConsole.WriteLine("{0,-7}{1,-17}{2,-6}{3,-8}{4,-12}{5,-8}{6,-12}{7,-12}", track.TrackSequence, track.TrackType, track.TrackBytesPerSector, track.TrackRawBytesPerSector, track.TrackSubchannelType, track.TrackPregap, track.TrackStartSector, track.TrackEndSector); + DicConsole.WriteLine("{0,-7}{1,-17}{2,-6}{3,-8}{4,-12}{5,-8}{6,-12}{7,-12}", + track.TrackSequence, track.TrackType, track.TrackBytesPerSector, + track.TrackRawBytesPerSector, track.TrackSubchannelType, track.TrackPregap, + track.TrackStartSector, track.TrackEndSector); DicConsole.WriteLine(); } } @@ -596,10 +604,9 @@ namespace DiscImageChef.Core foreach(DumpHardwareType dump in imageFormat.DumpHardware) { - if(dump.Manufacturer?.Length > manufacturerLen) - manufacturerLen = dump.Manufacturer.Length; - if(dump.Model?.Length > modelLen) modelLen = dump.Model.Length; - if(dump.Serial?.Length > serialLen) serialLen = dump.Serial.Length; + if(dump.Manufacturer?.Length > manufacturerLen) manufacturerLen = dump.Manufacturer.Length; + if(dump.Model?.Length > modelLen) modelLen = dump.Model.Length; + if(dump.Serial?.Length > serialLen) serialLen = dump.Serial.Length; if(dump.Software?.Name?.Length > softwareLen) softwareLen = dump.Software.Name.Length; if(dump.Software?.Version?.Length > versionLen) @@ -625,7 +632,7 @@ namespace DiscImageChef.Core char[] separator = new char[manufacturerLen + modelLen + serialLen + softwareLen + versionLen + osLen + sectorLen + sectorLen]; for(int i = 0; i < separator.Length; i++) separator[i] = '='; - string format = + string format = $"{{0,-{manufacturerLen}}}{{1,-{modelLen}}}{{2,-{serialLen}}}{{3,-{softwareLen}}}{{4,-{versionLen}}}{{5,-{osLen}}}{{6,-{sectorLen}}}{{7,-{sectorLen}}}"; DicConsole.WriteLine("Dump hardware information:"); diff --git a/DiscImageChef.Core/Logging/IBGLog.cs b/DiscImageChef.Core/Logging/IBGLog.cs index df0050b4b..18384fa58 100644 --- a/DiscImageChef.Core/Logging/IBGLog.cs +++ b/DiscImageChef.Core/Logging/IBGLog.cs @@ -43,19 +43,19 @@ namespace DiscImageChef.Core.Logging /// class IbgLog { - CultureInfo ibgCulture; - DateTime ibgDatePoint; - double ibgDivider; - ulong ibgIntSector; - double ibgIntSpeed; - double ibgMaxSpeed; - string ibgMediaType; - int ibgSampleRate; + CultureInfo ibgCulture; + DateTime ibgDatePoint; + double ibgDivider; + ulong ibgIntSector; + double ibgIntSpeed; + double ibgMaxSpeed; + string ibgMediaType; + int ibgSampleRate; StringBuilder ibgSb; - int ibgSnaps; - bool ibgStartSet; - double ibgStartSpeed; - string logFile; + int ibgSnaps; + bool ibgStartSet; + double ibgStartSpeed; + string logFile; /// /// Initializes the IMGBurn log @@ -66,136 +66,136 @@ namespace DiscImageChef.Core.Logging { if(string.IsNullOrEmpty(outputFile)) return; - logFile = outputFile; - ibgSb = new StringBuilder(); + logFile = outputFile; + ibgSb = new StringBuilder(); ibgDatePoint = DateTime.Now; - ibgCulture = new CultureInfo("en-US"); - ibgStartSet = false; - ibgMaxSpeed = 0; - ibgIntSpeed = 0; - ibgSnaps = 0; + ibgCulture = new CultureInfo("en-US"); + ibgStartSet = false; + ibgMaxSpeed = 0; + ibgIntSpeed = 0; + ibgSnaps = 0; ibgIntSector = 0; switch(currentProfile) { case 0x0001: ibgMediaType = "HDD"; - ibgDivider = 1353; + ibgDivider = 1353; break; case 0x0005: ibgMediaType = "CD-MO"; - ibgDivider = 150; + ibgDivider = 150; break; case 0x0008: ibgMediaType = "CD-ROM"; - ibgDivider = 150; + ibgDivider = 150; break; case 0x0009: ibgMediaType = "CD-R"; - ibgDivider = 150; + ibgDivider = 150; break; case 0x000A: ibgMediaType = "CD-RW"; - ibgDivider = 150; + ibgDivider = 150; break; case 0x0010: ibgMediaType = "DVD-ROM"; - ibgDivider = 1353; + ibgDivider = 1353; break; case 0x0011: ibgMediaType = "DVD-R"; - ibgDivider = 1353; + ibgDivider = 1353; break; case 0x0012: ibgMediaType = "DVD-RAM"; - ibgDivider = 1353; + ibgDivider = 1353; break; case 0x0013: case 0x0014: ibgMediaType = "DVD-RW"; - ibgDivider = 1353; + ibgDivider = 1353; break; case 0x0015: case 0x0016: ibgMediaType = "DVD-R DL"; - ibgDivider = 1353; + ibgDivider = 1353; break; case 0x0017: ibgMediaType = "DVD-RW DL"; - ibgDivider = 1353; + ibgDivider = 1353; break; case 0x0018: ibgMediaType = "DVD-Download"; - ibgDivider = 1353; + ibgDivider = 1353; break; case 0x001A: ibgMediaType = "DVD+RW"; - ibgDivider = 1353; + ibgDivider = 1353; break; case 0x001B: ibgMediaType = "DVD+R"; - ibgDivider = 1353; + ibgDivider = 1353; break; case 0x0020: ibgMediaType = "DDCD-ROM"; - ibgDivider = 150; + ibgDivider = 150; break; case 0x0021: ibgMediaType = "DDCD-R"; - ibgDivider = 150; + ibgDivider = 150; break; case 0x0022: ibgMediaType = "DDCD-RW"; - ibgDivider = 150; + ibgDivider = 150; break; case 0x002A: ibgMediaType = "DVD+RW DL"; - ibgDivider = 1353; + ibgDivider = 1353; break; case 0x002B: ibgMediaType = "DVD+R DL"; - ibgDivider = 1353; + ibgDivider = 1353; break; case 0x0040: ibgMediaType = "BD-ROM"; - ibgDivider = 4500; + ibgDivider = 4500; break; case 0x0041: case 0x0042: ibgMediaType = "BD-R"; - ibgDivider = 4500; + ibgDivider = 4500; break; case 0x0043: ibgMediaType = "BD-RE"; - ibgDivider = 4500; + ibgDivider = 4500; break; case 0x0050: ibgMediaType = "HD DVD-ROM"; - ibgDivider = 4500; + ibgDivider = 4500; break; case 0x0051: ibgMediaType = "HD DVD-R"; - ibgDivider = 4500; + ibgDivider = 4500; break; case 0x0052: ibgMediaType = "HD DVD-RAM"; - ibgDivider = 4500; + ibgDivider = 4500; break; case 0x0053: ibgMediaType = "HD DVD-RW"; - ibgDivider = 4500; + ibgDivider = 4500; break; case 0x0058: ibgMediaType = "HD DVD-R DL"; - ibgDivider = 4500; + ibgDivider = 4500; break; case 0x005A: ibgMediaType = "HD DVD-RW DL"; - ibgDivider = 4500; + ibgDivider = 4500; break; default: ibgMediaType = "Unknown"; - ibgDivider = 1353; + ibgDivider = 1353; break; } } @@ -209,7 +209,7 @@ namespace DiscImageChef.Core.Logging { if(logFile == null) return; - ibgIntSpeed += currentSpeed; + ibgIntSpeed += currentSpeed; ibgSampleRate += (int)Math.Floor((DateTime.Now - ibgDatePoint).TotalMilliseconds); ibgSnaps++; @@ -218,18 +218,18 @@ namespace DiscImageChef.Core.Logging if(ibgIntSpeed > 0 && !ibgStartSet) { ibgStartSpeed = ibgIntSpeed / ibgSnaps / ibgDivider; - ibgStartSet = true; + 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; - ibgDatePoint = DateTime.Now; - ibgIntSpeed = 0; + ibgDatePoint = DateTime.Now; + ibgIntSpeed = 0; ibgSampleRate = 0; - ibgSnaps = 0; - ibgIntSector = sector; + ibgSnaps = 0; + ibgIntSector = sector; } /// @@ -242,18 +242,19 @@ namespace DiscImageChef.Core.Logging /// Speed at the end /// Average speed /// Device path - internal void Close(Device dev, ulong blocks, ulong blockSize, double totalSeconds, double currentSpeed, + internal void Close(Device dev, ulong blocks, ulong blockSize, double totalSeconds, + double currentSpeed, double averageSpeed, string devicePath) { if(logFile == null) return; - FileStream ibgFs = new FileStream(logFile, FileMode.Create); + FileStream ibgFs = new FileStream(logFile, FileMode.Create); StringBuilder ibgHeader = new StringBuilder(); - string ibgBusType; + string ibgBusType; - if(dev.IsUsb) ibgBusType = "USB"; + if(dev.IsUsb) ibgBusType = "USB"; else if(dev.IsFireWire) ibgBusType = "FireWire"; - else ibgBusType = dev.Type.ToString(); + else ibgBusType = dev.Type.ToString(); ibgHeader.AppendLine("IBGD"); ibgHeader.AppendLine(); diff --git a/DiscImageChef.Core/Logging/MHDDLog.cs b/DiscImageChef.Core/Logging/MHDDLog.cs index 19896ee2c..f7321dfd0 100644 --- a/DiscImageChef.Core/Logging/MHDDLog.cs +++ b/DiscImageChef.Core/Logging/MHDDLog.cs @@ -43,7 +43,7 @@ namespace DiscImageChef.Core.Logging /// class MhddLog { - string logFile; + string logFile; MemoryStream mhddFs; /// @@ -58,7 +58,7 @@ namespace DiscImageChef.Core.Logging { if(dev == null || string.IsNullOrEmpty(outputFile)) return; - mhddFs = new MemoryStream(); + mhddFs = new MemoryStream(); logFile = outputFile; string mode; @@ -86,51 +86,52 @@ namespace DiscImageChef.Core.Logging break; } - string device = $"DEVICE: {dev.Manufacturer} {dev.Model}"; - string fw = $"F/W: {dev.Revision}"; - string sn = $"S/N: {dev.Serial}"; - string sectors = string.Format(new CultureInfo("en-US"), "SECTORS: {0:n0}", blocks); + string device = $"DEVICE: {dev.Manufacturer} {dev.Model}"; + string fw = $"F/W: {dev.Revision}"; + string sn = $"S/N: {dev.Serial}"; + string sectors = string.Format(new CultureInfo("en-US"), "SECTORS: {0:n0}", blocks); string sectorsize = string.Format(new CultureInfo("en-US"), "SECTOR SIZE: {0:n0} bytes", blockSize); string scanblocksize = string.Format(new CultureInfo("en-US"), "SCAN BLOCK SIZE: {0:n0} sectors", blocksToRead); const string MHDD_VER = "VER:2 "; - byte[] deviceBytes = Encoding.ASCII.GetBytes(device); - byte[] modeBytes = Encoding.ASCII.GetBytes(mode); - byte[] fwBytes = Encoding.ASCII.GetBytes(fw); - byte[] snBytes = Encoding.ASCII.GetBytes(sn); - byte[] sectorsBytes = Encoding.ASCII.GetBytes(sectors); - byte[] sectorsizeBytes = Encoding.ASCII.GetBytes(sectorsize); + byte[] deviceBytes = Encoding.ASCII.GetBytes(device); + byte[] modeBytes = Encoding.ASCII.GetBytes(mode); + byte[] fwBytes = Encoding.ASCII.GetBytes(fw); + byte[] snBytes = Encoding.ASCII.GetBytes(sn); + byte[] sectorsBytes = Encoding.ASCII.GetBytes(sectors); + byte[] sectorsizeBytes = Encoding.ASCII.GetBytes(sectorsize); byte[] scanblocksizeBytes = Encoding.ASCII.GetBytes(scanblocksize); - byte[] verBytes = Encoding.ASCII.GetBytes(MHDD_VER); + byte[] verBytes = Encoding.ASCII.GetBytes(MHDD_VER); - uint pointer = (uint)(deviceBytes.Length + modeBytes.Length + fwBytes.Length + snBytes.Length + + 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 + verBytes.Length + 2 * 9 + // New lines + 4); // Pointer byte[] newLine = new byte[2]; newLine[0] = 0x0D; newLine[1] = 0x0A; mhddFs.Write(BitConverter.GetBytes(pointer), 0, 4); - mhddFs.Write(newLine, 0, 2); - mhddFs.Write(verBytes, 0, verBytes.Length); - mhddFs.Write(newLine, 0, 2); - mhddFs.Write(modeBytes, 0, modeBytes.Length); - mhddFs.Write(newLine, 0, 2); - mhddFs.Write(deviceBytes, 0, deviceBytes.Length); - mhddFs.Write(newLine, 0, 2); - mhddFs.Write(fwBytes, 0, fwBytes.Length); - mhddFs.Write(newLine, 0, 2); - mhddFs.Write(snBytes, 0, snBytes.Length); - mhddFs.Write(newLine, 0, 2); - mhddFs.Write(sectorsBytes, 0, sectorsBytes.Length); - mhddFs.Write(newLine, 0, 2); - mhddFs.Write(sectorsizeBytes, 0, sectorsizeBytes.Length); - mhddFs.Write(newLine, 0, 2); - mhddFs.Write(scanblocksizeBytes, 0, scanblocksizeBytes.Length); - mhddFs.Write(newLine, 0, 2); + mhddFs.Write(newLine, 0, 2); + mhddFs.Write(verBytes, 0, verBytes.Length); + mhddFs.Write(newLine, 0, 2); + mhddFs.Write(modeBytes, 0, modeBytes.Length); + mhddFs.Write(newLine, 0, 2); + mhddFs.Write(deviceBytes, 0, deviceBytes.Length); + mhddFs.Write(newLine, 0, 2); + mhddFs.Write(fwBytes, 0, fwBytes.Length); + mhddFs.Write(newLine, 0, 2); + mhddFs.Write(snBytes, 0, snBytes.Length); + mhddFs.Write(newLine, 0, 2); + mhddFs.Write(sectorsBytes, 0, sectorsBytes.Length); + mhddFs.Write(newLine, 0, 2); + mhddFs.Write(sectorsizeBytes, 0, sectorsizeBytes.Length); + mhddFs.Write(newLine, 0, 2); + mhddFs.Write(scanblocksizeBytes, 0, scanblocksizeBytes.Length); + mhddFs.Write(newLine, 0, 2); } /// @@ -142,10 +143,10 @@ namespace DiscImageChef.Core.Logging { if(logFile == null) return; - byte[] sectorBytes = BitConverter.GetBytes(sector); + byte[] sectorBytes = BitConverter.GetBytes(sector); byte[] durationBytes = BitConverter.GetBytes((ulong)(duration * 1000)); - mhddFs.Write(sectorBytes, 0, 8); + mhddFs.Write(sectorBytes, 0, 8); mhddFs.Write(durationBytes, 0, 8); } diff --git a/DiscImageChef.Core/Options.cs b/DiscImageChef.Core/Options.cs index 499008f74..a6ca4f2e1 100644 --- a/DiscImageChef.Core/Options.cs +++ b/DiscImageChef.Core/Options.cs @@ -46,7 +46,7 @@ namespace DiscImageChef.Core bool inValue = false; string name = null; string value; - StringBuilder sb = new StringBuilder(); + StringBuilder sb = new StringBuilder(); if(options == null) return parsed; diff --git a/DiscImageChef.Core/Partitions.cs b/DiscImageChef.Core/Partitions.cs index e9ed887c6..dff44e801 100644 --- a/DiscImageChef.Core/Partitions.cs +++ b/DiscImageChef.Core/Partitions.cs @@ -51,10 +51,10 @@ namespace DiscImageChef.Core /// List of found partitions public static List GetAll(IMediaImage image) { - PluginBase plugins = new PluginBase(); - List foundPartitions = new List(); - List childPartitions = new List(); - List checkedLocations = new List(); + PluginBase plugins = new PluginBase(); + List foundPartitions = new List(); + List childPartitions = new List(); + List checkedLocations = new List(); // Getting all partitions from device (e.g. tracks) if(image.Info.HasPartitions) @@ -98,8 +98,8 @@ namespace DiscImageChef.Core { DicConsole.DebugWriteLine("Partitions", "Trying {0} @ {1}", partitionPlugin.Name, foundPartitions[0].Start); - if(!partitionPlugin.GetInformation(image, out List partitions, foundPartitions[0].Start) - ) continue; + if(!partitionPlugin.GetInformation(image, out List partitions, foundPartitions[0].Start)) + continue; DicConsole.DebugWriteLine("Partitions", "Found {0} @ {1}", partitionPlugin.Name, foundPartitions[0].Start); @@ -115,8 +115,10 @@ namespace DiscImageChef.Core foundPartitions.RemoveAt(0); foreach(Partition child in childs) - if(checkedLocations.Contains(child.Start)) childPartitions.Add(child); - else foundPartitions.Add(child); + if(checkedLocations.Contains(child.Start)) + childPartitions.Add(child); + else + foundPartitions.Add(child); } else { @@ -124,7 +126,7 @@ namespace DiscImageChef.Core foundPartitions.RemoveAt(0); } - DicConsole.DebugWriteLine("Partitions", "Got {0} parents", foundPartitions.Count); + DicConsole.DebugWriteLine("Partitions", "Got {0} parents", foundPartitions.Count); DicConsole.DebugWriteLine("Partitions", "Got {0} partitions", childPartitions.Count); } @@ -139,7 +141,8 @@ namespace DiscImageChef.Core } Partition[] childArray = childPartitions - .OrderBy(part => part.Start).ThenBy(part => part.Length).ThenBy(part => part.Scheme).ToArray(); + .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; diff --git a/DiscImageChef.Core/PrintScsiModePages.cs b/DiscImageChef.Core/PrintScsiModePages.cs index 957f937ad..4fa940671 100644 --- a/DiscImageChef.Core/PrintScsiModePages.cs +++ b/DiscImageChef.Core/PrintScsiModePages.cs @@ -3,7 +3,7 @@ using DiscImageChef.Decoders.SCSI; namespace DiscImageChef.Core { - public class PrintScsiModePages + public static class PrintScsiModePages { public static void Print(Modes.DecodedMode decMode, PeripheralDeviceTypes devType, byte[] vendorId) { @@ -31,7 +31,7 @@ namespace DiscImageChef.Core } case 0x01: { - if(page.Subpage == 0) + if(page.Subpage == 0) DicConsole.WriteLine(devType == PeripheralDeviceTypes.MultiMediaDevice ? Modes.PrettifyModePage_01_MMC(page.PageResponse) : Modes.PrettifyModePage_01(page.PageResponse)); @@ -76,7 +76,7 @@ namespace DiscImageChef.Core } case 0x07: { - if(page.Subpage == 0) + if(page.Subpage == 0) DicConsole.WriteLine(devType == PeripheralDeviceTypes.MultiMediaDevice ? Modes.PrettifyModePage_07_MMC(page.PageResponse) : Modes.PrettifyModePage_07(page.PageResponse)); @@ -96,8 +96,7 @@ namespace DiscImageChef.Core if(page.Subpage == 0) DicConsole.WriteLine(Modes.PrettifyModePage_0A(page.PageResponse)); else if(page.Subpage == 1) DicConsole.WriteLine(Modes.PrettifyModePage_0A_S01(page.PageResponse)); - else - goto default; + else goto default; break; } @@ -131,7 +130,7 @@ namespace DiscImageChef.Core } case 0x10: { - if(page.Subpage == 0) + if(page.Subpage == 0) DicConsole.WriteLine(devType == PeripheralDeviceTypes.SequentialAccess ? Modes.PrettifyModePage_10_SSC(page.PageResponse) : Modes.PrettifyModePage_10(page.PageResponse)); @@ -160,8 +159,7 @@ namespace DiscImageChef.Core if(page.Subpage == 0) DicConsole.WriteLine(Modes.PrettifyModePage_1A(page.PageResponse)); else if(page.Subpage == 1) DicConsole.WriteLine(Modes.PrettifyModePage_1A_S01(page.PageResponse)); - else - goto default; + else goto default; break; } @@ -174,14 +172,13 @@ namespace DiscImageChef.Core } case 0x1C: { - if(page.Subpage == 0) + if(page.Subpage == 0) DicConsole.WriteLine(devType == PeripheralDeviceTypes.MultiMediaDevice ? Modes.PrettifyModePage_1C_SFF(page.PageResponse) : Modes.PrettifyModePage_1C(page.PageResponse)); else if(page.Subpage == 1) DicConsole.WriteLine(Modes.PrettifyModePage_1C_S01(page.PageResponse)); - else - goto default; + else goto default; break; } @@ -261,8 +258,7 @@ namespace DiscImageChef.Core DicConsole.WriteLine(Modes.PrettifyIBMModePage_3D(page.PageResponse)); else if(StringHandlers.CToString(vendorId).Trim() == "HP") DicConsole.WriteLine(Modes.PrettifyHPModePage_3D(page.PageResponse)); - else - goto default; + else goto default; break; } @@ -272,8 +268,7 @@ namespace DiscImageChef.Core DicConsole.WriteLine(Modes.PrettifyFujitsuModePage_3E(page.PageResponse)); else if(StringHandlers.CToString(vendorId).Trim() == "HP") DicConsole.WriteLine(Modes.PrettifyHPModePage_3E(page.PageResponse)); - else - goto default; + else goto default; break; } diff --git a/DiscImageChef.Core/Remote.cs b/DiscImageChef.Core/Remote.cs index c8e3e9c52..50456bb95 100644 --- a/DiscImageChef.Core/Remote.cs +++ b/DiscImageChef.Core/Remote.cs @@ -65,13 +65,12 @@ namespace DiscImageChef.Core XmlSerializer xmlSer = new XmlSerializer(typeof(DeviceReport)); xmlSer.Serialize(xmlStream, report); xmlStream.Seek(0, SeekOrigin.Begin); - WebRequest request = - WebRequest.Create("http://discimagechef.claunia.com/api/uploadreport"); + WebRequest request = WebRequest.Create("http://discimagechef.claunia.com/api/uploadreport"); ((HttpWebRequest)request).UserAgent = $"DiscImageChef {typeof(Version).Assembly.GetName().Version}"; request.Method = "POST"; request.ContentLength = xmlStream.Length; request.ContentType = "application/xml"; - Stream reqStream = request.GetRequestStream(); + Stream reqStream = request.GetRequestStream(); xmlStream.CopyTo(reqStream); reqStream.Close(); WebResponse response = request.GetResponse(); diff --git a/DiscImageChef.Core/Sidecar/AudioMedia.cs b/DiscImageChef.Core/Sidecar/AudioMedia.cs index ca0759fec..e0764c8b6 100644 --- a/DiscImageChef.Core/Sidecar/AudioMedia.cs +++ b/DiscImageChef.Core/Sidecar/AudioMedia.cs @@ -52,7 +52,8 @@ namespace DiscImageChef.Core /// Image plugins /// List of image checksums /// Metadata sidecar - static void AudioMedia(IMediaImage image, Guid filterId, string imagePath, FileInfo fi, PluginBase plugins, + static void AudioMedia(IMediaImage image, Guid filterId, string imagePath, + FileInfo fi, PluginBase plugins, List imgChecksums, ref CICMMetadataType sidecar, Encoding encoding) { sidecar.AudioMedia = new[] @@ -62,12 +63,12 @@ namespace DiscImageChef.Core Checksums = imgChecksums.ToArray(), Image = new ImageType { - format = image.Format, - offset = 0, + format = image.Format, + offset = 0, offsetSpecified = true, - Value = Path.GetFileName(imagePath) + Value = Path.GetFileName(imagePath) }, - Size = fi.Length, + Size = fi.Length, Sequence = new SequenceType {MediaTitle = image.Info.MediaTitle} } }; @@ -75,12 +76,12 @@ namespace DiscImageChef.Core if(image.Info.MediaSequence != 0 && image.Info.LastMediaSequence != 0) { sidecar.AudioMedia[0].Sequence.MediaSequence = image.Info.MediaSequence; - sidecar.AudioMedia[0].Sequence.TotalMedia = image.Info.LastMediaSequence; + sidecar.AudioMedia[0].Sequence.TotalMedia = image.Info.LastMediaSequence; } else { sidecar.AudioMedia[0].Sequence.MediaSequence = 1; - sidecar.AudioMedia[0].Sequence.TotalMedia = 1; + sidecar.AudioMedia[0].Sequence.TotalMedia = 1; } } } diff --git a/DiscImageChef.Core/Sidecar/BlockMedia.cs b/DiscImageChef.Core/Sidecar/BlockMedia.cs index 8241ab4ac..5c5475ca2 100644 --- a/DiscImageChef.Core/Sidecar/BlockMedia.cs +++ b/DiscImageChef.Core/Sidecar/BlockMedia.cs @@ -61,8 +61,8 @@ namespace DiscImageChef.Core /// Image plugins /// List of image checksums /// Metadata sidecar - static void BlockMedia(IMediaImage image, Guid filterId, string imagePath, - FileInfo fi, PluginBase plugins, + static void BlockMedia(IMediaImage image, Guid filterId, string imagePath, + FileInfo fi, PluginBase plugins, List imgChecksums, ref CICMMetadataType sidecar, Encoding encoding) { sidecar.BlockMedia = new[] @@ -70,7 +70,7 @@ namespace DiscImageChef.Core new BlockMediaType { Checksums = imgChecksums.ToArray(), - Image = new ImageType + Image = new ImageType { format = image.Format, offset = 0, @@ -119,7 +119,7 @@ namespace DiscImageChef.Core }; break; case MediaTagType.PCMCIA_CIS: - byte[] cis = image.ReadDiskTag(MediaTagType.PCMCIA_CIS); + byte[] cis = image.ReadDiskTag(MediaTagType.PCMCIA_CIS); sidecar.BlockMedia[0].PCMCIA = new PCMCIAType { CIS = new DumpType {Checksums = Checksum.GetChecksums(cis).ToArray(), Size = cis.Length} @@ -150,7 +150,7 @@ namespace DiscImageChef.Core { sidecar.BlockMedia[0].PCMCIA.Manufacturer = vers.Manufacturer; sidecar.BlockMedia[0].PCMCIA.ProductName = vers.Product; - sidecar.BlockMedia[0].PCMCIA.Compliance = + sidecar.BlockMedia[0].PCMCIA.Compliance = $"{vers.MajorVersion}.{vers.MinorVersion}"; sidecar.BlockMedia[0].PCMCIA.AdditionalInformation = vers.AdditionalInformation; @@ -236,7 +236,7 @@ namespace DiscImageChef.Core break; case MediaTagType.MMC_ExtendedCSD: if(sidecar.BlockMedia[0].MultiMediaCard == null) - sidecar.BlockMedia[0].MultiMediaCard = new MultiMediaCardType(); + sidecar.BlockMedia[0].MultiMediaCard = new MultiMediaCardType(); sidecar.BlockMedia[0].MultiMediaCard.ExtendedCSD = new DumpType { Checksums = @@ -245,8 +245,7 @@ namespace DiscImageChef.Core }; break; case MediaTagType.USB_Descriptors: - if(sidecar.BlockMedia[0].USB == null) - sidecar.BlockMedia[0].USB = new USBType(); + if(sidecar.BlockMedia[0].USB == null) sidecar.BlockMedia[0].USB = new USBType(); sidecar.BlockMedia[0].USB.Descriptors = new DumpType { Checksums = @@ -255,8 +254,7 @@ namespace DiscImageChef.Core }; break; case MediaTagType.SCSI_MODESENSE_6: - if(sidecar.BlockMedia[0].SCSI == null) - sidecar.BlockMedia[0].SCSI = new SCSIType(); + if(sidecar.BlockMedia[0].SCSI == null) sidecar.BlockMedia[0].SCSI = new SCSIType(); sidecar.BlockMedia[0].SCSI.ModeSense = new DumpType { Checksums = @@ -265,8 +263,7 @@ namespace DiscImageChef.Core }; break; case MediaTagType.SCSI_MODESENSE_10: - if(sidecar.BlockMedia[0].SCSI == null) - sidecar.BlockMedia[0].SCSI = new SCSIType(); + if(sidecar.BlockMedia[0].SCSI == null) sidecar.BlockMedia[0].SCSI = new SCSIType(); sidecar.BlockMedia[0].SCSI.ModeSense10 = new DumpType { Checksums = @@ -378,7 +375,7 @@ namespace DiscImageChef.Core else { sidecar.BlockMedia[0].FileSystemInformation[0] = - new PartitionType {StartSector = 0, EndSector = (int)(image.Info.Sectors - 1)}; + new PartitionType {StartSector = 0, EndSector = (int)(image.Info.Sectors - 1)}; Partition wholePart = new Partition { @@ -575,8 +572,8 @@ namespace DiscImageChef.Core try { scpImage.Open(scpFilter); } catch(NotImplementedException) { } - if(image.Info.Heads == 2 && scpImage.Header.heads == 0 || image.Info.Heads == 1 && - (scpImage.Header.heads == 1 || scpImage.Header.heads == 2)) + if(image.Info.Heads == 2 && scpImage.Header.heads == 0 || image.Info.Heads == 1 && + (scpImage.Header.heads == 1 || scpImage.Header.heads == 2)) if(scpImage.Header.end + 1 >= image.Info.Cylinders) { List scpBlockTrackTypes = new List(); @@ -589,7 +586,7 @@ namespace DiscImageChef.Core { Cylinder = t / image.Info.Heads, Head = t % image.Info.Heads, - Image = new ImageType + Image = new ImageType { format = scpImage.Format, Value = Path.GetFileName(scpFilePath), @@ -610,7 +607,7 @@ namespace DiscImageChef.Core if(scpImage.ScpTracks.TryGetValue(t, out SuperCardPro.TrackHeader scpTrack)) { byte[] trackContents = - new byte[scpTrack.Entries.Last().dataOffset + + new byte[scpTrack.Entries.Last().dataOffset + scpTrack.Entries.Last().trackLength - scpImage.Header.offsets[t] + 1]; scpStream.Position = scpImage.Header.offsets[t]; scpStream.Read(trackContents, 0, trackContents.Length); @@ -637,7 +634,7 @@ namespace DiscImageChef.Core #endregion #region KryoFlux - string kfFile = null; + string kfFile = null; string basename = Path.Combine(Path.GetDirectoryName(imagePath), Path.GetFileNameWithoutExtension(imagePath)); bool kfDir = false; @@ -651,10 +648,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) { @@ -666,7 +661,7 @@ namespace DiscImageChef.Core try { kfImage.Open(kfFilter); } catch(NotImplementedException) { } - if(kfImage.Info.Heads == image.Info.Heads) + if(kfImage.Info.Heads == image.Info.Heads) if(kfImage.Info.Cylinders >= image.Info.Cylinders) { List kfBlockTrackTypes = new List(); @@ -679,14 +674,14 @@ namespace DiscImageChef.Core { Cylinder = kvp.Key / image.Info.Heads, Head = kvp.Key % image.Info.Heads, - Image = new ImageType + Image = new ImageType { format = kfImage.Format, - Value = kfDir - ? Path - .Combine(Path.GetFileName(Path.GetDirectoryName(kvp.Value.GetBasePath())), - kvp.Value.GetFilename()) - : kvp.Value.GetFilename(), + Value = kfDir + ? Path + .Combine(Path.GetFileName(Path.GetDirectoryName(kvp.Value.GetBasePath())), + kvp.Value.GetFilename()) + : kvp.Value.GetFilename(), offset = 0 } }; @@ -703,7 +698,7 @@ namespace DiscImageChef.Core Stream kfStream = kvp.Value.GetDataForkStream(); byte[] trackContents = new byte[kfStream.Length]; - kfStream.Position = 0; + kfStream.Position = 0; kfStream.Read(trackContents, 0, trackContents.Length); kfBlockTrackType.Size = trackContents.Length; kfBlockTrackType.Checksums = Checksum.GetChecksums(trackContents).ToArray(); @@ -741,7 +736,7 @@ namespace DiscImageChef.Core try { dfiImage.Open(dfiFilter); } catch(NotImplementedException) { } - if(image.Info.Heads == dfiImage.Info.Heads) + if(image.Info.Heads == dfiImage.Info.Heads) if(dfiImage.Info.Cylinders >= image.Info.Cylinders) { List dfiBlockTrackTypes = new List(); @@ -771,8 +766,8 @@ namespace DiscImageChef.Core dfiImage.TrackLengths.TryGetValue(t, out long length)) { dfiBlockTrackType.Image.offset = offset; - byte[] trackContents = new byte[length]; - dfiStream.Position = offset; + byte[] trackContents = new byte[length]; + dfiStream.Position = offset; dfiStream.Read(trackContents, 0, trackContents.Length); dfiBlockTrackType.Size = trackContents.Length; dfiBlockTrackType.Checksums = Checksum.GetChecksums(trackContents).ToArray(); diff --git a/DiscImageChef.Core/Sidecar/BlockTape.cs b/DiscImageChef.Core/Sidecar/BlockTape.cs index 0a34cd3c1..01a881ba4 100644 --- a/DiscImageChef.Core/Sidecar/BlockTape.cs +++ b/DiscImageChef.Core/Sidecar/BlockTape.cs @@ -52,19 +52,25 @@ namespace DiscImageChef.Core { new BlockMediaType { - Image = new ImageType {format = "Directory", offsetSpecified = false, Value = folderName}, - Sequence = new SequenceType {MediaTitle = folderName, MediaSequence = 1, TotalMedia = 1}, + Image = new ImageType + { + format = "Directory", + offsetSpecified = false, + Value = folderName + }, + Sequence = + new SequenceType {MediaTitle = folderName, MediaSequence = 1, TotalMedia = 1}, PhysicalBlockSize = blockSize, - LogicalBlockSize = blockSize, + LogicalBlockSize = blockSize, TapeInformation = new[] { new TapePartitionType { Image = new ImageType { - format = "Directory", + format = "Directory", offsetSpecified = false, - Value = folderName + Value = folderName } } } @@ -72,32 +78,32 @@ namespace DiscImageChef.Core } }; - long currentBlock = 0; - long totalSize = 0; - Checksum tapeWorker = new Checksum(); - List tapeFiles = new List(); + long currentBlock = 0; + long totalSize = 0; + Checksum tapeWorker = new Checksum(); + List tapeFiles = new List(); for(int i = 0; i < files.Count; i++) { - FileStream fs = new FileStream(files[i], FileMode.Open, FileAccess.Read); - Checksum fileWorker = new Checksum(); + FileStream fs = new FileStream(files[i], FileMode.Open, FileAccess.Read); + Checksum fileWorker = new Checksum(); TapeFileType tapeFile = new TapeFileType { Image = new ImageType { format = "Raw disk image (sector by sector copy)", offset = 0, - Value = Path.GetFileName(files[i]) + Value = Path.GetFileName(files[i]) }, - Size = fs.Length, - BlockSize = blockSize, + Size = fs.Length, + BlockSize = blockSize, StartBlock = currentBlock, - Sequence = i + Sequence = i }; const uint SECTORS_TO_READ = 512; - long sectors = fs.Length / blockSize; - long doneSectors = 0; + long sectors = fs.Length / blockSize; + long doneSectors = 0; InitProgress2(); while(doneSectors < sectors) @@ -125,51 +131,51 @@ namespace DiscImageChef.Core tapeWorker.Update(sector); } - tapeFile.EndBlock = tapeFile.StartBlock + sectors - 1; - currentBlock += sectors; - totalSize += fs.Length; - tapeFile.Checksums = fileWorker.End().ToArray(); + tapeFile.EndBlock = tapeFile.StartBlock + sectors - 1; + currentBlock += sectors; + totalSize += fs.Length; + tapeFile.Checksums = fileWorker.End().ToArray(); tapeFiles.Add(tapeFile); EndProgress2(); } - sidecar.BlockMedia[0].Checksums = tapeWorker.End().ToArray(); - sidecar.BlockMedia[0].ContentChecksums = sidecar.BlockMedia[0].Checksums; - sidecar.BlockMedia[0].Size = totalSize; - sidecar.BlockMedia[0].LogicalBlocks = currentBlock; - sidecar.BlockMedia[0].TapeInformation[0].EndBlock = currentBlock - 1; - sidecar.BlockMedia[0].TapeInformation[0].Size = totalSize; + sidecar.BlockMedia[0].Checksums = tapeWorker.End().ToArray(); + sidecar.BlockMedia[0].ContentChecksums = sidecar.BlockMedia[0].Checksums; + sidecar.BlockMedia[0].Size = totalSize; + sidecar.BlockMedia[0].LogicalBlocks = currentBlock; + sidecar.BlockMedia[0].TapeInformation[0].EndBlock = currentBlock - 1; + sidecar.BlockMedia[0].TapeInformation[0].Size = totalSize; sidecar.BlockMedia[0].TapeInformation[0].Checksums = sidecar.BlockMedia[0].Checksums; - sidecar.BlockMedia[0].TapeInformation[0].File = tapeFiles.ToArray(); + sidecar.BlockMedia[0].TapeInformation[0].File = tapeFiles.ToArray(); // This is purely for convenience, as typically these kind of data represents QIC tapes if(blockSize == 512) { 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"; + 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"; + sidecar.BlockMedia[0].DiskType = "Unknown tape"; sidecar.BlockMedia[0].DiskSubType = "Unknown tape"; } } else { - sidecar.BlockMedia[0].DiskType = "Unknown tape"; + sidecar.BlockMedia[0].DiskType = "Unknown tape"; sidecar.BlockMedia[0].DiskSubType = "Unknown tape"; } diff --git a/DiscImageChef.Core/Sidecar/Events.cs b/DiscImageChef.Core/Sidecar/Events.cs index 7ae6104e9..d55ca70b2 100644 --- a/DiscImageChef.Core/Sidecar/Events.cs +++ b/DiscImageChef.Core/Sidecar/Events.cs @@ -34,13 +34,13 @@ namespace DiscImageChef.Core { public static partial class Sidecar { - public static event InitProgressHandler InitProgressEvent; - public static event UpdateProgressHandler UpdateProgressEvent; - public static event EndProgressHandler EndProgressEvent; - public static event InitProgressHandler2 InitProgressEvent2; + public static event InitProgressHandler InitProgressEvent; + public static event UpdateProgressHandler UpdateProgressEvent; + public static event EndProgressHandler EndProgressEvent; + public static event InitProgressHandler2 InitProgressEvent2; public static event UpdateProgressHandler2 UpdateProgressEvent2; - public static event EndProgressHandler2 EndProgressEvent2; - public static event UpdateStatusHandler UpdateStatusEvent; + public static event EndProgressHandler2 EndProgressEvent2; + public static event UpdateStatusHandler UpdateStatusEvent; public static void InitProgress() { diff --git a/DiscImageChef.Core/Sidecar/Helpers.cs b/DiscImageChef.Core/Sidecar/Helpers.cs index 444ccf70e..477c02451 100644 --- a/DiscImageChef.Core/Sidecar/Helpers.cs +++ b/DiscImageChef.Core/Sidecar/Helpers.cs @@ -44,19 +44,19 @@ namespace DiscImageChef.Core long m, s, f; if(lba >= -150) { - m = (lba + 150) / (75 * 60); - lba -= m * (75 * 60); - s = (lba + 150) / 75; - lba -= s * 75; - f = lba + 150; + m = (lba + 150) / (75 * 60); + lba -= m * (75 * 60); + s = (lba + 150) / 75; + lba -= s * 75; + f = lba + 150; } else { - m = (lba + 450150) / (75 * 60); - lba -= m * (75 * 60); - s = (lba + 450150) / 75; - lba -= s * 75; - f = lba + 450150; + m = (lba + 450150) / (75 * 60); + lba -= m * (75 * 60); + s = (lba + 450150) / 75; + lba -= s * 75; + f = lba + 450150; } return $"{m}:{s:D2}:{f:D2}"; @@ -72,23 +72,23 @@ namespace DiscImageChef.Core long h, m, s, f; if(lba >= -150) { - h = (lba + 150) / (75 * 60 * 60); - lba -= h * (75 * 60 * 60); - m = (lba + 150) / (75 * 60); - lba -= m * (75 * 60); - s = (lba + 150) / 75; - lba -= s * 75; - f = lba + 150; + h = (lba + 150) / (75 * 60 * 60); + lba -= h * (75 * 60 * 60); + m = (lba + 150) / (75 * 60); + lba -= m * (75 * 60); + s = (lba + 150) / 75; + lba -= s * 75; + f = lba + 150; } else { - h = (lba + 450150 * 2) / (75 * 60 * 60); - lba -= h * (75 * 60 * 60); - m = (lba + 450150 * 2) / (75 * 60); - lba -= m * (75 * 60); - s = (lba + 450150 * 2) / 75; - lba -= s * 75; - f = lba + 450150 * 2; + h = (lba + 450150 * 2) / (75 * 60 * 60); + lba -= h * (75 * 60 * 60); + m = (lba + 450150 * 2) / (75 * 60); + lba -= m * (75 * 60); + s = (lba + 450150 * 2) / 75; + lba -= s * 75; + f = lba + 450150 * 2; } return string.Format("{3}:{0:D2}:{1:D2}:{2:D2}", m, s, f, h); diff --git a/DiscImageChef.Core/Sidecar/LinearMedia.cs b/DiscImageChef.Core/Sidecar/LinearMedia.cs index 6a287f2fa..73e264e74 100644 --- a/DiscImageChef.Core/Sidecar/LinearMedia.cs +++ b/DiscImageChef.Core/Sidecar/LinearMedia.cs @@ -52,7 +52,8 @@ namespace DiscImageChef.Core /// Image plugins /// List of image checksums /// Metadata sidecar - static void LinearMedia(IMediaImage image, Guid filterId, string imagePath, FileInfo fi, PluginBase plugins, + static void LinearMedia(IMediaImage image, Guid filterId, string imagePath, + FileInfo fi, PluginBase plugins, List imgChecksums, ref CICMMetadataType sidecar, Encoding encoding) { sidecar.LinearMedia = new[] @@ -62,10 +63,10 @@ namespace DiscImageChef.Core Checksums = imgChecksums.ToArray(), Image = new ImageType { - format = image.Format, - offset = 0, + format = image.Format, + offset = 0, offsetSpecified = true, - Value = Path.GetFileName(imagePath) + Value = Path.GetFileName(imagePath) }, Size = fi.Length } diff --git a/DiscImageChef.Core/Sidecar/OpticalDisc.cs b/DiscImageChef.Core/Sidecar/OpticalDisc.cs index 73be5c7da..2aa196b38 100644 --- a/DiscImageChef.Core/Sidecar/OpticalDisc.cs +++ b/DiscImageChef.Core/Sidecar/OpticalDisc.cs @@ -61,8 +61,8 @@ namespace DiscImageChef.Core /// Image plugins /// List of image checksums /// Metadata sidecar - static void OpticalDisc(IMediaImage image, Guid filterId, string imagePath, - FileInfo fi, PluginBase plugins, + static void OpticalDisc(IMediaImage image, Guid filterId, string imagePath, + FileInfo fi, PluginBase plugins, List imgChecksums, ref CICMMetadataType sidecar, Encoding encoding) { sidecar.OpticalDisc = new[] @@ -70,7 +70,7 @@ namespace DiscImageChef.Core new OpticalDiscType { Checksums = imgChecksums.ToArray(), - Image = new ImageType + Image = new ImageType { format = image.Format, offset = 0, @@ -228,7 +228,7 @@ 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 == DVDSize.OneTwenty) @@ -294,11 +294,11 @@ namespace DiscImageChef.Core { new XboxSecuritySectorsType { - RequestNumber = 0, - RequestVersion = 1, + RequestNumber = 0, + RequestVersion = 1, SecuritySectors = new DumpType { - Image = Path.GetFileName(imagePath), + Image = Path.GetFileName(imagePath), Checksums = Checksum.GetChecksums(image.ReadDiskTag(MediaTagType.Xbox_SecuritySector)) .ToArray(), @@ -332,7 +332,7 @@ namespace DiscImageChef.Core try { - List sessions = image.Sessions; + List sessions = image.Sessions; sidecar.OpticalDisc[0].Sessions = sessions?.Count ?? 1; } catch { sidecar.OpticalDisc[0].Sessions = 1; } @@ -350,7 +350,7 @@ namespace DiscImageChef.Core sidecar.OpticalDisc[0].Dimensions = Dimensions.DimensionsFromMediaType(image.Info.MediaType); InitProgress(); - + UpdateStatus("Checking filesystems"); List partitions = Partitions.GetAll(image); Partitions.AddSchemesToStats(partitions); @@ -398,10 +398,10 @@ namespace DiscImageChef.Core break; } - xmlTrk.Sequence = + xmlTrk.Sequence = new TrackSequenceType {Session = trk.TrackSession, TrackNumber = (int)trk.TrackSequence}; - xmlTrk.StartSector = (long)trk.TrackStartSector; - xmlTrk.EndSector = (long)trk.TrackEndSector; + 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)) @@ -470,7 +470,7 @@ namespace DiscImageChef.Core (uint)xmlTrk.Sequence.TrackNumber); UpdateProgress2("Hashings sector {0} of {1}", (long)doneSectors, (long)(trk.TrackEndSector - trk.TrackStartSector + 1)); - doneSectors += sectors - doneSectors; + doneSectors += sectors - doneSectors; } trkChkWorker.Update(sector); @@ -539,7 +539,7 @@ namespace DiscImageChef.Core SectorTagType.CdSectorSubchannel); UpdateProgress2("Hashings subchannel sector {0} of {1}", (long)doneSectors, (long)(trk.TrackEndSector - trk.TrackStartSector + 1)); - doneSectors += sectors - doneSectors; + doneSectors += sectors - doneSectors; } subChkWorker.Update(sector); @@ -555,9 +555,10 @@ namespace DiscImageChef.Core // For fast debugging, skip checksum //skipChecksum: - List trkPartitions = - partitions.Where(p => p.Start >= trk.TrackStartSector && p.End <= trk.TrackEndSector).ToList(); - + List trkPartitions = partitions + .Where(p => p.Start >= trk.TrackStartSector && + p.End <= trk.TrackEndSector).ToList(); + xmlTrk.FileSystemInformation = new PartitionType[1]; if(trkPartitions.Count > 0) { @@ -672,7 +673,7 @@ namespace DiscImageChef.Core // 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 - + 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 @@ -699,7 +700,7 @@ namespace DiscImageChef.Core Model = image.Info.DriveModel, Firmware = image.Info.DriveFirmwareRevision, Serial = image.Info.DriveSerialNumber, - Software = new SoftwareType + Software = new SoftwareType { Name = image.Info.Application, Version = image.Info.ApplicationVersion diff --git a/DiscImageChef.Core/Sidecar/Sidecar.cs b/DiscImageChef.Core/Sidecar/Sidecar.cs index 84db40416..f7a95ad09 100644 --- a/DiscImageChef.Core/Sidecar/Sidecar.cs +++ b/DiscImageChef.Core/Sidecar/Sidecar.cs @@ -77,7 +77,7 @@ namespace DiscImageChef.Core position += 1048576; } - data = new byte[fi.Length - position]; + data = new byte[fi.Length - position]; fs.Read(data, 0, (int)(fi.Length - position)); UpdateProgress("Hashing image file byte {0} of {1}", position, fi.Length); diff --git a/DiscImageChef.Core/Statistics.cs b/DiscImageChef.Core/Statistics.cs index efeae07be..d99dc94ec 100644 --- a/DiscImageChef.Core/Statistics.cs +++ b/DiscImageChef.Core/Statistics.cs @@ -70,7 +70,7 @@ namespace DiscImageChef.Core { if(File.Exists(Path.Combine(Settings.Settings.StatsPath, "Statistics.xml"))) { - AllStats = new Stats(); + AllStats = new Stats(); CurrentStats = new Stats { OperatingSystems = @@ -87,12 +87,12 @@ namespace DiscImageChef.Core }; XmlSerializer xs = new XmlSerializer(AllStats.GetType()); StreamReader sr = new StreamReader(Path.Combine(Settings.Settings.StatsPath, "Statistics.xml")); - AllStats = (Stats)xs.Deserialize(sr); + AllStats = (Stats)xs.Deserialize(sr); sr.Close(); } else if(Settings.Settings.Current.Stats != null) { - AllStats = new Stats(); + AllStats = new Stats(); CurrentStats = new Stats { OperatingSystems = @@ -147,8 +147,7 @@ namespace DiscImageChef.Core version = DetectOS.GetVersion() }); } - else if(CurrentStats != null) - AllStats.OperatingSystems = CurrentStats.OperatingSystems; + else if(CurrentStats != null) AllStats.OperatingSystems = CurrentStats.OperatingSystems; if(AllStats.Versions != null) { @@ -167,8 +166,7 @@ namespace DiscImageChef.Core count++; AllStats.Versions.Add(new NameValueStats {name = Version.GetVersion(), Value = count}); } - else if(CurrentStats != null) - AllStats.Versions = CurrentStats.Versions; + else if(CurrentStats != null) AllStats.Versions = CurrentStats.Versions; FileStream fs = new FileStream(Path.Combine(Settings.Settings.StatsPath, "Statistics.xml"), FileMode.Create); @@ -223,14 +221,13 @@ namespace DiscImageChef.Core xs.Deserialize(fs); // Just to test validity of stats file fs.Seek(0, SeekOrigin.Begin); - WebRequest request = - WebRequest.Create("http://discimagechef.claunia.com/api/uploadstats"); + WebRequest request = WebRequest.Create("http://discimagechef.claunia.com/api/uploadstats"); ((HttpWebRequest)request).UserAgent = $"DiscImageChef {typeof(Version).Assembly.GetName().Version}"; request.Method = "POST"; request.ContentLength = fs.Length; request.ContentType = "application/xml"; - Stream reqStream = request.GetRequestStream(); + Stream reqStream = request.GetRequestStream(); fs.CopyTo(reqStream); reqStream.Close(); WebResponse response = request.GetResponse(); @@ -563,11 +560,9 @@ namespace DiscImageChef.Core 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 = AllStats.Devices.FirstOrDefault(ds => ds.Manufacturer == dev.Manufacturer && ds.Model == dev.Model && @@ -664,8 +659,8 @@ namespace DiscImageChef.Core /// Time for sequential running /// Maximum used memory /// Minimum used memory - 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) return; @@ -708,7 +703,7 @@ namespace DiscImageChef.Core if(Settings.Settings.Current.Stats == null || !Settings.Settings.Current.Stats.VerifyStats) return; if(CurrentStats.Verify == null) - CurrentStats.Verify = + CurrentStats.Verify = new VerifyStats {MediaImages = new VerifiedItems(), Sectors = new ScannedSectors()}; if(AllStats.Verify == null) @@ -749,8 +744,8 @@ namespace DiscImageChef.Core /// Total sectors /// Errored sectors /// Correct sectors - public static void AddMediaScan(long lessThan3Ms, long lessThan10Ms, long lessThan50Ms, long lessThan150Ms, - long lessThan500Ms, long moreThan500Ms, long total, long error, + public static void AddMediaScan(long lessThan3Ms, long lessThan10Ms, long lessThan50Ms, long lessThan150Ms, + long lessThan500Ms, long moreThan500Ms, long total, long error, long correct) { if(lessThan500Ms <= 0) throw new ArgumentOutOfRangeException(nameof(lessThan500Ms)); diff --git a/DiscImageChef.Decoders/ATA/Identify.cs b/DiscImageChef.Decoders/ATA/Identify.cs index e8c7d4d4f..d79bdc1a5 100644 --- a/DiscImageChef.Decoders/ATA/Identify.cs +++ b/DiscImageChef.Decoders/ATA/Identify.cs @@ -127,7 +127,8 @@ 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 @@ -153,12 +154,14 @@ 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 @@ -565,7 +568,8 @@ 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 @@ -591,7 +595,8 @@ 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 @@ -607,7 +612,8 @@ 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,7 +630,8 @@ 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 @@ -641,12 +648,14 @@ 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 @@ -759,7 +768,8 @@ 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 @@ -781,7 +791,8 @@ 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 @@ -1490,10 +1501,10 @@ namespace DiscImageChef.Decoders.ATA [Flags] public enum SCTCommandTransportBit : ushort { - Vendor15 = 0x8000, - Vendor14 = 0x4000, - Vendor13 = 0x2000, - Vendor12 = 0x1000, + Vendor15 = 0x8000, + Vendor14 = 0x4000, + Vendor13 = 0x2000, + Vendor12 = 0x1000, Reserved11 = 0x0800, Reserved10 = 0x0400, Reserved09 = 0x0200, @@ -1857,14 +1868,14 @@ namespace DiscImageChef.Decoders.ATA IdentifyDevice ATAID = (IdentifyDevice)Marshal.PtrToStructure(ptr, typeof(IdentifyDevice)); Marshal.FreeHGlobal(ptr); - ATAID.WWN = DescrambleWWN(ATAID.WWN); + ATAID.WWN = DescrambleWWN(ATAID.WWN); ATAID.WWNExtension = DescrambleWWN(ATAID.WWNExtension); - ATAID.SerialNumber = DescrambleATAString(IdentifyDeviceResponse, 10 * 2, 20); - ATAID.FirmwareRevision = DescrambleATAString(IdentifyDeviceResponse, 23 * 2, 8); - ATAID.Model = DescrambleATAString(IdentifyDeviceResponse, 27 * 2, 40); - ATAID.AdditionalPID = DescrambleATAString(IdentifyDeviceResponse, 170 * 2, 8); - ATAID.MediaSerial = DescrambleATAString(IdentifyDeviceResponse, 176 * 2, 40); + ATAID.SerialNumber = DescrambleATAString(IdentifyDeviceResponse, 10 * 2, 20); + ATAID.FirmwareRevision = DescrambleATAString(IdentifyDeviceResponse, 23 * 2, 8); + ATAID.Model = DescrambleATAString(IdentifyDeviceResponse, 27 * 2, 40); + ATAID.AdditionalPID = DescrambleATAString(IdentifyDeviceResponse, 170 * 2, 8); + ATAID.MediaSerial = DescrambleATAString(IdentifyDeviceResponse, 176 * 2, 40); ATAID.MediaManufacturer = DescrambleATAString(IdentifyDeviceResponse, 196 * 2, 20); return ATAID; @@ -1885,12 +1896,14 @@ namespace DiscImageChef.Decoders.ATA StringBuilder sb = new StringBuilder(); bool atapi = false; - bool cfa = false; + bool cfa = false; IdentifyDevice ATAID = IdentifyDeviceResponse.Value; if(ATAID.GeneralConfiguration.HasFlag(GeneralConfigurationBit.NonMagnetic)) - if((ushort)ATAID.GeneralConfiguration != 0x848A) atapi = true; - else cfa = true; + if((ushort)ATAID.GeneralConfiguration != 0x848A) + atapi = true; + else + cfa = true; if(atapi) sb.AppendLine("ATAPI device"); else if(cfa) sb.AppendLine("CompactFlash device"); @@ -1924,7 +1937,7 @@ namespace DiscImageChef.Decoders.ATA ata5 = false, ata6 = false, ata7 = false, - acs = false, + acs = false, acs2 = false, acs3 = false, acs4 = false; @@ -1957,7 +1970,7 @@ namespace DiscImageChef.Decoders.ATA ata5 |= ATAID.MajorVersion.HasFlag(MajorVersionBit.AtaAtapi5); ata6 |= ATAID.MajorVersion.HasFlag(MajorVersionBit.AtaAtapi6); ata7 |= ATAID.MajorVersion.HasFlag(MajorVersionBit.AtaAtapi7); - acs |= ATAID.MajorVersion.HasFlag(MajorVersionBit.Ata8ACS); + acs |= ATAID.MajorVersion.HasFlag(MajorVersionBit.Ata8ACS); acs2 |= ATAID.MajorVersion.HasFlag(MajorVersionBit.ACS2); acs3 |= ATAID.MajorVersion.HasFlag(MajorVersionBit.ACS3); acs4 |= ATAID.MajorVersion.HasFlag(MajorVersionBit.ACS4); @@ -1972,66 +1985,77 @@ namespace DiscImageChef.Decoders.ATA maxatalevel = 1; if(minatalevel > 1) minatalevel = 1; } + if(ata2) { sb.Append("ATA-2 "); maxatalevel = 2; if(minatalevel > 2) minatalevel = 2; } + if(ata3) { sb.Append("ATA-3 "); maxatalevel = 3; if(minatalevel > 3) minatalevel = 3; } + if(ata4) { sb.Append("ATA/ATAPI-4 "); maxatalevel = 4; if(minatalevel > 4) minatalevel = 4; } + if(ata5) { sb.Append("ATA/ATAPI-5 "); maxatalevel = 5; if(minatalevel > 5) minatalevel = 5; } + if(ata6) { sb.Append("ATA/ATAPI-6 "); maxatalevel = 6; if(minatalevel > 6) minatalevel = 6; } + if(ata7) { sb.Append("ATA/ATAPI-7 "); maxatalevel = 7; if(minatalevel > 7) minatalevel = 7; } + if(acs) { sb.Append("ATA8-ACS "); maxatalevel = 8; if(minatalevel > 8) minatalevel = 8; } + if(acs2) { sb.Append("ATA8-ACS2 "); maxatalevel = 9; if(minatalevel > 9) minatalevel = 9; } + if(acs3) { sb.Append("ATA8-ACS3 "); maxatalevel = 10; if(minatalevel > 10) minatalevel = 10; } + if(acs4) { sb.Append("ATA8-ACS4 "); maxatalevel = 11; if(minatalevel > 11) minatalevel = 11; } + sb.AppendLine(); sb.Append("Maximum ATA revision supported: "); @@ -2365,8 +2389,10 @@ namespace DiscImageChef.Decoders.ATA } 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; if(!atapi) @@ -2376,17 +2402,19 @@ namespace DiscImageChef.Decoders.ATA 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; if((ATAID.PhysLogSectorSize & 0x2000) == 0x2000) - physicalsectorsize = logicalsectorsize * (uint)Math.Pow(2, ATAID.PhysLogSectorSize & 0xF); + physicalsectorsize = logicalsectorsize * (uint)Math.Pow(2, ATAID.PhysLogSectorSize & 0xF); else physicalsectorsize = logicalsectorsize; } else { - logicalsectorsize = 512; + logicalsectorsize = 512; physicalsectorsize = 512; } @@ -2394,7 +2422,7 @@ namespace DiscImageChef.Decoders.ATA sb.AppendFormat("Logical sector size: {0} bytes", logicalsectorsize).AppendLine(); if(logicalsectorsize != physicalsectorsize && (ATAID.LogicalAlignment & 0x8000) == 0x0000 && - (ATAID.LogicalAlignment & 0x4000) == 0x4000) + (ATAID.LogicalAlignment & 0x4000) == 0x4000) sb.AppendFormat("Logical sector starts at offset {0} from physical sector", ATAID.LogicalAlignment & 0x3FFF).AppendLine(); @@ -2428,70 +2456,75 @@ 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, (ulong)ATAID.CurrentSectors * logicalsectorsize / 1000 / 1000, - (ulong)ATAID.CurrentSectors * 512 / 1024 / 1024).AppendLine(); + (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, currentSectors * logicalsectorsize / 1000 / 1000, - currentSectors * 512 / 1024 / 1024).AppendLine(); + currentSectors * 512 / 1024 / 1024).AppendLine(); } if(ATAID.Capabilities.HasFlag(CapabilitiesBit.LBASupport)) 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, (ulong)ATAID.LBASectors * logicalsectorsize / 1000 / 1000 / 1000 / 1000, - (ulong)ATAID.LBASectors * 512 / 1024 / 1024 / 1024 / 1024).AppendLine(); + (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, (ulong)ATAID.LBASectors * logicalsectorsize / 1000 / 1000 / 1000, - (ulong)ATAID.LBASectors * 512 / 1024 / 1024 / 1024).AppendLine(); + (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, (ulong)ATAID.LBASectors * logicalsectorsize / 1000 / 1000, - (ulong)ATAID.LBASectors * 512 / 1024 / 1024).AppendLine(); + (ulong)ATAID.LBASectors * 512 / 1024 / 1024).AppendLine(); if(ATAID.CommandSet2.HasFlag(CommandSetBit2.LBA48)) if(ATAID.CommandSet5.HasFlag(CommandSetBit5.ExtSectors)) 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, 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, 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, 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, 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, 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, ATAID.LBA48Sectors * logicalsectorsize / 1000 / 1000, ATAID.LBA48Sectors * logicalsectorsize / 1024 / 1024).AppendLine(); } @@ -2505,6 +2538,7 @@ namespace DiscImageChef.Decoders.ATA sb.AppendFormat("{0} bytes per unformatted sector", ATAID.UnformattedBPS).AppendLine(); } } + if((ushort)ATAID.SpecificConfiguration != 0x0000 && (ushort)ATAID.SpecificConfiguration != 0xFFFF) switch(ATAID.SpecificConfiguration) { @@ -2562,6 +2596,7 @@ namespace DiscImageChef.Decoders.ATA sb.AppendLine().Append("IORDY is supported"); 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.Capabilities2.HasFlag(CapabilitiesBit2.MustBeSet) && @@ -2623,36 +2658,43 @@ namespace DiscImageChef.Decoders.ATA sb.Append("DMA0 "); 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.DMASupported.HasFlag(TransferMode.Mode2)) { sb.Append("DMA2 "); 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.DMASupported.HasFlag(TransferMode.Mode4)) { sb.Append("DMA4 "); 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.DMASupported.HasFlag(TransferMode.Mode6)) { sb.Append("DMA6 "); if(ATAID.DMAActive.HasFlag(TransferMode.Mode6)) sb.Append("(active) "); } + if(ATAID.DMASupported.HasFlag(TransferMode.Mode7)) { sb.Append("DMA7 "); @@ -2666,36 +2708,43 @@ namespace DiscImageChef.Decoders.ATA sb.Append("MDMA0 "); 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.MDMASupported.HasFlag(TransferMode.Mode2)) { sb.Append("MDMA2 "); 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.MDMASupported.HasFlag(TransferMode.Mode4)) { sb.Append("MDMA4 "); 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.MDMASupported.HasFlag(TransferMode.Mode6)) { sb.Append("MDMA6 "); if(ATAID.MDMAActive.HasFlag(TransferMode.Mode6)) sb.Append("(active) "); } + if(ATAID.MDMASupported.HasFlag(TransferMode.Mode7)) { sb.Append("MDMA7 "); @@ -2708,36 +2757,43 @@ namespace DiscImageChef.Decoders.ATA sb.Append("UDMA0 "); 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.UDMASupported.HasFlag(TransferMode.Mode2)) { sb.Append("UDMA2 "); 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.UDMASupported.HasFlag(TransferMode.Mode4)) { sb.Append("UDMA4 "); 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.UDMASupported.HasFlag(TransferMode.Mode6)) { sb.Append("UDMA6 "); if(ATAID.UDMAActive.HasFlag(TransferMode.Mode6)) sb.Append("(active) "); } + if(ATAID.UDMASupported.HasFlag(TransferMode.Mode7)) { sb.Append("UDMA7 "); @@ -2876,66 +2932,79 @@ namespace DiscImageChef.Decoders.ATA sb.AppendLine().Append("NOP is supported"); 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.CommandSet.HasFlag(CommandSetBit.WriteBuffer)) { sb.AppendLine().Append("WRITE BUFFER is supported"); 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.CommandSet.HasFlag(CommandSetBit.DeviceReset)) { sb.AppendLine().Append("DEVICE RESET is supported"); 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.CommandSet.HasFlag(CommandSetBit.Release)) { sb.AppendLine().Append("Release is supported"); 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.CommandSet.HasFlag(CommandSetBit.WriteCache)) { sb.AppendLine().Append("Write cache is supported"); 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.CommandSet.HasFlag(CommandSetBit.PowerManagement)) { sb.AppendLine().Append("Power management is supported"); 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.CommandSet.HasFlag(CommandSetBit.SecurityMode)) { sb.AppendLine().Append("Security mode is supported"); if(ATAID.EnabledCommandSet.HasFlag(CommandSetBit.SecurityMode)) sb.Append(" and enabled"); } + if(ATAID.Capabilities.HasFlag(CapabilitiesBit.LBASupport)) sb.AppendLine().Append("28-bit LBA is supported"); @@ -2947,21 +3016,25 @@ namespace DiscImageChef.Decoders.ATA sb.AppendLine().Append("48-bit LBA is supported"); 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.CommandSet2.HasFlag(CommandSetBit2.FlushCacheExt)) { sb.AppendLine().Append("FLUSH CACHE EXT is supported"); 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.CommandSet2.HasFlag(CommandSetBit2.AAM)) { sb.AppendLine().Append("Automatic Acoustic Management is supported"); @@ -2969,17 +3042,20 @@ namespace DiscImageChef.Decoders.ATA 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.CommandSet2.HasFlag(CommandSetBit2.AddressOffsetReservedAreaBoot)) { sb.AppendLine().Append("Address Offset Reserved Area Boot is supported"); if(ATAID.EnabledCommandSet2.HasFlag(CommandSetBit2.AddressOffsetReservedAreaBoot)) sb.Append(" and enabled"); } + if(ATAID.CommandSet2.HasFlag(CommandSetBit2.SetFeaturesRequired)) sb.AppendLine().Append("SET FEATURES is required before spin-up"); if(ATAID.CommandSet2.HasFlag(CommandSetBit2.PowerUpInStandby)) @@ -2987,28 +3063,33 @@ namespace DiscImageChef.Decoders.ATA sb.AppendLine().Append("Power-up in standby is supported"); if(ATAID.EnabledCommandSet2.HasFlag(CommandSetBit2.PowerUpInStandby)) sb.Append(" and enabled"); } + if(ATAID.CommandSet2.HasFlag(CommandSetBit2.RemovableNotification)) { sb.AppendLine().Append("Removable Media Status Notification is supported"); if(ATAID.EnabledCommandSet2.HasFlag(CommandSetBit2.RemovableNotification)) sb.Append(" and enabled"); } + if(ATAID.CommandSet2.HasFlag(CommandSetBit2.APM)) { sb.AppendLine().Append("Advanced Power Management is supported"); if(ATAID.EnabledCommandSet2.HasFlag(CommandSetBit2.APM)) sb.AppendFormat(" and enabled with value {0}", ATAID.CurrentAPM); } + 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.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.CommandSet2.HasFlag(CommandSetBit2.DownloadMicrocode)) { sb.AppendLine().Append("DOWNLOAD MICROCODE is supported"); @@ -3033,16 +3114,19 @@ namespace DiscImageChef.Decoders.ATA sb.AppendLine().Append("S.M.A.R.T. self-testing is supported"); 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.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.CommandSet3.HasFlag(CommandSetBit3.WriteURG)) sb.AppendLine().Append("URG bit is supported in WRITE STREAM DMA EXT and WRITE STREAM EXT"); if(ATAID.CommandSet3.HasFlag(CommandSetBit3.ReadURG)) @@ -3054,26 +3138,31 @@ namespace DiscImageChef.Decoders.ATA sb.AppendLine().Append("WRITE DMA QUEUED FUA EXT is supported"); 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.CommandSet3.HasFlag(CommandSetBit3.GPL)) { sb.AppendLine().Append("General Purpose Logging is supported"); 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.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.CommandSet3.HasFlag(CommandSetBit3.MediaSerial)) { sb.AppendLine().Append("Media Serial is supported"); @@ -3089,42 +3178,50 @@ namespace DiscImageChef.Decoders.ATA sb.AppendLine().Append("DSN feature set is supported"); 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.CommandSet4.HasFlag(CommandSetBit4.ExtPowerCond)) { sb.AppendLine().Append("Extended Power Conditions are supported"); 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.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.CommandSet4.HasFlag(CommandSetBit4.SegmentedDownloadMicrocode)) { sb.AppendLine().Append("Segmented feature in DOWNLOAD MICROCODE is supported"); if(ATAID.EnabledCommandSet4.HasFlag(CommandSetBit4.SegmentedDownloadMicrocode)) sb.Append(" and enabled"); } + 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.CommandSet4.HasFlag(CommandSetBit4.WriteUnc)) { sb.AppendLine().Append("WRITE UNCORRECTABLE is supported"); if(ATAID.EnabledCommandSet4.HasFlag(CommandSetBit4.WriteUnc)) sb.Append(" and enabled"); } + if(ATAID.CommandSet4.HasFlag(CommandSetBit4.WRV)) { sb.AppendLine().Append("Write/Read/Verify is supported"); @@ -3134,12 +3231,14 @@ namespace DiscImageChef.Decoders.ATA if(ATAID.EnabledCommandSet4.HasFlag(CommandSetBit4.WRV)) sb.AppendLine().AppendFormat("Current Write/Read/Verify mode: {0}", ATAID.WRVMode); } + if(ATAID.CommandSet4.HasFlag(CommandSetBit4.DT1825)) { sb.AppendLine().Append("DT1825 is supported"); if(ATAID.EnabledCommandSet4.HasFlag(CommandSetBit4.DT1825)) sb.Append(" and enabled"); } } + if(ATAID.Capabilities3.HasFlag(CapabilitiesBit3.BlockErase)) sb.AppendLine().Append("BLOCK ERASE EXT is supported"); if(ATAID.Capabilities3.HasFlag(CapabilitiesBit3.Overwrite)) @@ -3171,6 +3270,7 @@ namespace DiscImageChef.Decoders.ATA if(ATAID.CommandSet5.HasFlag(CommandSetBit5.ReadZeroTrim)) sb.AppendLine().Append("Read after TRIM returns empty data"); } + if(ATAID.CommandSet5.HasFlag(CommandSetBit5.LongPhysSectorAligError)) sb.AppendLine().Append("Device supports Long Physical Sector Alignment Error Reporting Control"); if(ATAID.CommandSet5.HasFlag(CommandSetBit5.Encrypted)) @@ -3192,7 +3292,7 @@ namespace DiscImageChef.Decoders.ATA } if(!ata1 && maxatalevel >= 8) - if(ATAID.TrustedComputing.HasFlag(TrustedComputingBit.Set) && + if(ATAID.TrustedComputing.HasFlag(TrustedComputingBit.Set) && !ATAID.TrustedComputing.HasFlag(TrustedComputingBit.Clear) && ATAID.TrustedComputing.HasFlag(TrustedComputingBit.TrustedComputing)) sb.AppendLine().Append("Trusted Computing feature set is supported"); @@ -3216,21 +3316,25 @@ namespace DiscImageChef.Decoders.ATA if(ATAID.EnabledSATAFeatures.HasFlag(SATAFeaturesBit.NonZeroBufferOffset)) sb.Append(" and enabled"); } + 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.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.SATAFeatures.HasFlag(SATAFeaturesBit.InOrderData)) { sb.AppendLine().Append("In-order data delivery is supported"); if(ATAID.EnabledSATAFeatures.HasFlag(SATAFeaturesBit.InOrderData)) sb.Append(" and enabled"); } + if(!atapi) if(ATAID.SATAFeatures.HasFlag(SATAFeaturesBit.HardwareFeatureControl)) { @@ -3238,6 +3342,7 @@ namespace DiscImageChef.Decoders.ATA if(ATAID.EnabledSATAFeatures.HasFlag(SATAFeaturesBit.HardwareFeatureControl)) sb.Append(" and enabled"); } + if(atapi) if(ATAID.SATAFeatures.HasFlag(SATAFeaturesBit.AsyncNotification)) { @@ -3245,18 +3350,21 @@ namespace DiscImageChef.Decoders.ATA if(ATAID.EnabledSATAFeatures.HasFlag(SATAFeaturesBit.AsyncNotification)) sb.Append(" and enabled"); } + if(ATAID.SATAFeatures.HasFlag(SATAFeaturesBit.SettingsPreserve)) { sb.AppendLine().Append("Software Settings Preservation is supported"); if(ATAID.EnabledSATAFeatures.HasFlag(SATAFeaturesBit.SettingsPreserve)) sb.Append(" and enabled"); } + if(ATAID.SATAFeatures.HasFlag(SATAFeaturesBit.NCQAutoSense)) sb.AppendLine().Append("NCQ Autosense is supported"); if(ATAID.EnabledSATAFeatures.HasFlag(SATAFeaturesBit.EnabledSlumber)) sb.AppendLine().Append("Automatic Partial to Slumber transitions are enabled"); } } + if((ATAID.RemovableStatusSet & 0x03) > 0) sb.AppendLine().Append("Removable Media Status Notification feature set is supported"); @@ -3304,15 +3412,15 @@ namespace DiscImageChef.Decoders.ATA sb.AppendFormat("Master password revision code: {0}", ATAID.MasterPasswordRevisionCode).AppendLine(); } - if(ATAID.CommandSet3.HasFlag(CommandSetBit3.MustBeSet) && + if(ATAID.CommandSet3.HasFlag(CommandSetBit3.MustBeSet) && !ATAID.CommandSet3.HasFlag(CommandSetBit3.MustBeClear) && ATAID.CommandSet3.HasFlag(CommandSetBit3.Streaming)) { sb.AppendLine().AppendLine("Streaming:"); - sb.AppendFormat("Minimum request size is {0}", ATAID.StreamMinReqSize); - sb.AppendFormat("Streaming transfer time in PIO is {0}", ATAID.StreamTransferTimePIO); - sb.AppendFormat("Streaming transfer time in DMA is {0}", ATAID.StreamTransferTimeDMA); - sb.AppendFormat("Streaming access latency is {0}", ATAID.StreamAccessLatency); + sb.AppendFormat("Minimum request size is {0}", ATAID.StreamMinReqSize); + sb.AppendFormat("Streaming transfer time in PIO is {0}", ATAID.StreamTransferTimePIO); + sb.AppendFormat("Streaming transfer time in DMA is {0}", ATAID.StreamTransferTimeDMA); + sb.AppendFormat("Streaming access latency is {0}", ATAID.StreamAccessLatency); sb.AppendFormat("Streaming performance granularity is {0}", ATAID.StreamPerformanceGranularity); } @@ -3343,11 +3451,12 @@ namespace DiscImageChef.Decoders.ATA sb.AppendLine().AppendFormat("Version {0}", (ATAID.NVCacheCaps & 0x0F00) >> 8).AppendLine(); } + sb.AppendLine().AppendFormat("Non-Volatile Cache is {0} bytes", ATAID.NVCacheSize * logicalsectorsize) .AppendLine(); } -#if DEBUG + #if DEBUG sb.AppendLine(); if(ATAID.VendorWord9 != 0x0000 && ATAID.VendorWord9 != 0xFFFF) sb.AppendFormat("Word 9: 0x{0:X4}", ATAID.VendorWord9).AppendLine(); @@ -3397,13 +3506,13 @@ namespace DiscImageChef.Decoders.ATA for(int i = 0; i < ATAID.ReservedWords.Length; i++) if(ATAID.ReservedWords[i] != 0x0000 && ATAID.ReservedWords[i] != 0xFFFF) sb.AppendFormat("Word {1}: 0x{0:X4}", ATAID.ReservedWords[i], 236 + i).AppendLine(); -#endif + #endif return sb.ToString(); } static ulong DescrambleWWN(ulong WWN) { - byte[] qwb = BitConverter.GetBytes(WWN); + byte[] qwb = BitConverter.GetBytes(WWN); byte[] qword = new byte[8]; qword[7] = qwb[1]; @@ -3425,7 +3534,7 @@ namespace DiscImageChef.Decoders.ATA for(int i = 0; i < length; i += 2) { outbuf[i] = buffer[offset + i + 1]; - outbuf[i + 1] = buffer[offset + i]; + outbuf[i + 1] = buffer[offset + i]; } string outStr = StringHandlers.CToString(outbuf); diff --git a/DiscImageChef.Decoders/ATA/Registers.cs b/DiscImageChef.Decoders/ATA/Registers.cs index 56da0b6cb..e2121f17b 100644 --- a/DiscImageChef.Decoders/ATA/Registers.cs +++ b/DiscImageChef.Decoders/ATA/Registers.cs @@ -61,8 +61,8 @@ namespace DiscImageChef.Decoders.ATA public ushort LbaLow; public ushort LbaMid; public ushort LbaHigh; - public byte DeviceHead; - public byte Command; + public byte DeviceHead; + public byte Command; } public struct AtaErrorRegistersChs @@ -89,12 +89,12 @@ namespace DiscImageChef.Decoders.ATA public struct AtaErrorRegistersLba48 { - public byte Status; - public byte Error; + public byte Status; + public byte Error; public ushort SectorCount; public ushort LbaLow; public ushort LbaMid; public ushort LbaHigh; - public byte DeviceHead; + public byte DeviceHead; } } \ No newline at end of file diff --git a/DiscImageChef.Decoders/Blu-ray/BCA.cs b/DiscImageChef.Decoders/Blu-ray/BCA.cs index c45727c34..dc9170502 100644 --- a/DiscImageChef.Decoders/Blu-ray/BCA.cs +++ b/DiscImageChef.Decoders/Blu-ray/BCA.cs @@ -75,9 +75,9 @@ namespace DiscImageChef.Decoders.Bluray BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian; decoded.DataLength = BigEndianBitConverter.ToUInt16(BCAResponse, 0); - decoded.Reserved1 = BCAResponse[2]; - decoded.Reserved2 = BCAResponse[3]; - decoded.BCA = new byte[64]; + decoded.Reserved1 = BCAResponse[2]; + decoded.Reserved2 = BCAResponse[3]; + decoded.BCA = new byte[64]; Array.Copy(BCAResponse, 4, decoded.BCA, 0, 64); return decoded; @@ -91,10 +91,10 @@ namespace DiscImageChef.Decoders.Bluray StringBuilder sb = new StringBuilder(); -#if DEBUG + #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(); -#endif + #endif sb.AppendFormat("Blu-ray Burst Cutting Area in hex follows:"); sb.AppendLine(PrintHex.ByteArrayToHexArrayString(response.BCA, 80)); diff --git a/DiscImageChef.Decoders/Blu-ray/Cartridge.cs b/DiscImageChef.Decoders/Blu-ray/Cartridge.cs index a3a00dca8..374f8302c 100644 --- a/DiscImageChef.Decoders/Blu-ray/Cartridge.cs +++ b/DiscImageChef.Decoders/Blu-ray/Cartridge.cs @@ -77,16 +77,16 @@ namespace DiscImageChef.Decoders.Bluray BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian; decoded.DataLength = BigEndianBitConverter.ToUInt16(CSResponse, 0); - decoded.Reserved1 = CSResponse[2]; - decoded.Reserved2 = CSResponse[3]; - decoded.Cartridge = Convert.ToBoolean(CSResponse[4] & 0x80); - decoded.OUT = Convert.ToBoolean(CSResponse[4] & 0x40); - decoded.Reserved3 = (byte)((CSResponse[4] & 0x38) >> 3); - decoded.OUT = Convert.ToBoolean(CSResponse[4] & 0x04); - decoded.Reserved4 = (byte)(CSResponse[4] & 0x03); - decoded.Reserved5 = CSResponse[5]; - decoded.Reserved6 = CSResponse[6]; - decoded.Reserved7 = CSResponse[7]; + decoded.Reserved1 = CSResponse[2]; + decoded.Reserved2 = CSResponse[3]; + decoded.Cartridge = Convert.ToBoolean(CSResponse[4] & 0x80); + decoded.OUT = Convert.ToBoolean(CSResponse[4] & 0x40); + decoded.Reserved3 = (byte)((CSResponse[4] & 0x38) >> 3); + decoded.OUT = Convert.ToBoolean(CSResponse[4] & 0x04); + decoded.Reserved4 = (byte)(CSResponse[4] & 0x03); + decoded.Reserved5 = CSResponse[5]; + decoded.Reserved6 = CSResponse[6]; + decoded.Reserved7 = CSResponse[7]; return decoded; } @@ -99,7 +99,7 @@ namespace DiscImageChef.Decoders.Bluray StringBuilder sb = new StringBuilder(); -#if DEBUG + #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(); @@ -107,7 +107,7 @@ namespace DiscImageChef.Decoders.Bluray 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 + #endif if(response.Cartridge) { @@ -119,11 +119,12 @@ namespace DiscImageChef.Decoders.Bluray { sb.AppendLine("Media is not in a cartridge"); -#if DEBUG + #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"); -#endif + #endif } + return sb.ToString(); } diff --git a/DiscImageChef.Decoders/Blu-ray/DDS.cs b/DiscImageChef.Decoders/Blu-ray/DDS.cs index 1130de25c..741d3fb80 100644 --- a/DiscImageChef.Decoders/Blu-ray/DDS.cs +++ b/DiscImageChef.Decoders/Blu-ray/DDS.cs @@ -75,9 +75,9 @@ namespace DiscImageChef.Decoders.Bluray BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian; decoded.DataLength = BigEndianBitConverter.ToUInt16(DDSResponse, 0); - decoded.Reserved1 = DDSResponse[2]; - decoded.Reserved2 = DDSResponse[3]; - decoded.Signature = BigEndianBitConverter.ToUInt16(DDSResponse, 4); + decoded.Reserved1 = DDSResponse[2]; + decoded.Reserved2 = DDSResponse[3]; + decoded.Signature = BigEndianBitConverter.ToUInt16(DDSResponse, 4); if(decoded.Signature != DDSIdentifier) { DicConsole.DebugWriteLine("BD DDS decoder", "Found incorrect DDS signature (0x{0:X4})", @@ -85,26 +85,26 @@ namespace DiscImageChef.Decoders.Bluray return null; } - decoded.Format = DDSResponse[6]; - decoded.Reserved3 = DDSResponse[7]; - decoded.UpdateCount = BigEndianBitConverter.ToUInt32(DDSResponse, 8); - decoded.Reserved4 = BigEndianBitConverter.ToUInt64(DDSResponse, 12); - decoded.DriveAreaPSN = BigEndianBitConverter.ToUInt32(DDSResponse, 20); - decoded.Reserved5 = BigEndianBitConverter.ToUInt32(DDSResponse, 24); - decoded.DefectListPSN = BigEndianBitConverter.ToUInt32(DDSResponse, 28); - decoded.Reserved6 = BigEndianBitConverter.ToUInt32(DDSResponse, 32); - decoded.PSNofLSNZero = BigEndianBitConverter.ToUInt32(DDSResponse, 36); - decoded.LastUserAreaLSN = BigEndianBitConverter.ToUInt32(DDSResponse, 40); - decoded.ISA0 = BigEndianBitConverter.ToUInt32(DDSResponse, 44); - decoded.OSA = BigEndianBitConverter.ToUInt32(DDSResponse, 48); - decoded.ISA1 = BigEndianBitConverter.ToUInt32(DDSResponse, 52); - decoded.SpareAreaFullFlags = DDSResponse[56]; - decoded.Reserved7 = DDSResponse[57]; + decoded.Format = DDSResponse[6]; + decoded.Reserved3 = DDSResponse[7]; + decoded.UpdateCount = BigEndianBitConverter.ToUInt32(DDSResponse, 8); + decoded.Reserved4 = BigEndianBitConverter.ToUInt64(DDSResponse, 12); + decoded.DriveAreaPSN = BigEndianBitConverter.ToUInt32(DDSResponse, 20); + decoded.Reserved5 = BigEndianBitConverter.ToUInt32(DDSResponse, 24); + decoded.DefectListPSN = BigEndianBitConverter.ToUInt32(DDSResponse, 28); + decoded.Reserved6 = BigEndianBitConverter.ToUInt32(DDSResponse, 32); + decoded.PSNofLSNZero = BigEndianBitConverter.ToUInt32(DDSResponse, 36); + decoded.LastUserAreaLSN = BigEndianBitConverter.ToUInt32(DDSResponse, 40); + decoded.ISA0 = BigEndianBitConverter.ToUInt32(DDSResponse, 44); + decoded.OSA = BigEndianBitConverter.ToUInt32(DDSResponse, 48); + decoded.ISA1 = BigEndianBitConverter.ToUInt32(DDSResponse, 52); + decoded.SpareAreaFullFlags = DDSResponse[56]; + decoded.Reserved7 = DDSResponse[57]; decoded.DiscTypeSpecificField1 = DDSResponse[58]; - decoded.Reserved8 = DDSResponse[59]; + decoded.Reserved8 = DDSResponse[59]; decoded.DiscTypeSpecificField2 = BigEndianBitConverter.ToUInt32(DDSResponse, 60); - decoded.Reserved9 = BigEndianBitConverter.ToUInt32(DDSResponse, 64); - decoded.StatusBits = new byte[32]; + decoded.Reserved9 = BigEndianBitConverter.ToUInt32(DDSResponse, 64); + decoded.StatusBits = new byte[32]; Array.Copy(DDSResponse, 68, decoded.StatusBits, 0, 32); decoded.DiscTypeSpecificData = new byte[DDSResponse.Length - 100]; Array.Copy(DDSResponse, 100, decoded.DiscTypeSpecificData, 0, DDSResponse.Length - 100); @@ -137,7 +137,7 @@ namespace DiscImageChef.Decoders.Bluray sb.AppendFormat("Blu-ray DDS Disc Type Specific Data in hex follows:"); sb.AppendLine(PrintHex.ByteArrayToHexArrayString(response.DiscTypeSpecificData, 80)); -#if DEBUG + #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(); @@ -147,7 +147,7 @@ namespace DiscImageChef.Decoders.Bluray 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 + #endif return sb.ToString(); } diff --git a/DiscImageChef.Decoders/Blu-ray/Spare.cs b/DiscImageChef.Decoders/Blu-ray/Spare.cs index d658d4e6a..ef4e27e4d 100644 --- a/DiscImageChef.Decoders/Blu-ray/Spare.cs +++ b/DiscImageChef.Decoders/Blu-ray/Spare.cs @@ -75,11 +75,11 @@ namespace DiscImageChef.Decoders.Bluray BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian; - decoded.DataLength = BigEndianBitConverter.ToUInt16(SAIResponse, 0); - decoded.Reserved1 = SAIResponse[2]; - decoded.Reserved2 = SAIResponse[3]; - decoded.Reserved3 = BigEndianBitConverter.ToUInt32(SAIResponse, 4); - decoded.FreeSpareBlocks = BigEndianBitConverter.ToUInt32(SAIResponse, 8); + decoded.DataLength = BigEndianBitConverter.ToUInt16(SAIResponse, 0); + decoded.Reserved1 = SAIResponse[2]; + decoded.Reserved2 = SAIResponse[3]; + decoded.Reserved3 = BigEndianBitConverter.ToUInt32(SAIResponse, 4); + decoded.FreeSpareBlocks = BigEndianBitConverter.ToUInt32(SAIResponse, 8); decoded.AllocatedSpareBlocks = BigEndianBitConverter.ToUInt32(SAIResponse, 12); return decoded; @@ -93,11 +93,11 @@ namespace DiscImageChef.Decoders.Bluray StringBuilder sb = new StringBuilder(); -#if DEBUG + #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(); -#endif + #endif sb.AppendFormat("{0} free spare blocks", response.FreeSpareBlocks).AppendLine(); sb.AppendFormat("{0} allocated spare blocks", response.AllocatedSpareBlocks).AppendLine(); diff --git a/DiscImageChef.Decoders/CD/ATIP.cs b/DiscImageChef.Decoders/CD/ATIP.cs index a1ca82483..7808febb6 100644 --- a/DiscImageChef.Decoders/CD/ATIP.cs +++ b/DiscImageChef.Decoders/CD/ATIP.cs @@ -238,32 +238,32 @@ namespace DiscImageChef.Decoders.CD return null; } - decoded.DataLength = BigEndianBitConverter.ToUInt16(CDATIPResponse, 0); - decoded.Reserved1 = CDATIPResponse[2]; - decoded.Reserved2 = CDATIPResponse[3]; - decoded.ITWP = (byte)((CDATIPResponse[4] & 0xF0) >> 4); - decoded.DDCD = Convert.ToBoolean(CDATIPResponse[4] & 0x08); + decoded.DataLength = BigEndianBitConverter.ToUInt16(CDATIPResponse, 0); + decoded.Reserved1 = CDATIPResponse[2]; + decoded.Reserved2 = CDATIPResponse[3]; + decoded.ITWP = (byte)((CDATIPResponse[4] & 0xF0) >> 4); + decoded.DDCD = Convert.ToBoolean(CDATIPResponse[4] & 0x08); decoded.ReferenceSpeed = (byte)(CDATIPResponse[4] & 0x07); - decoded.AlwaysZero = Convert.ToBoolean(CDATIPResponse[5] & 0x80); - decoded.URU = Convert.ToBoolean(CDATIPResponse[5] & 0x40); - decoded.Reserved3 = (byte)(CDATIPResponse[5] & 0x3F); + decoded.AlwaysZero = Convert.ToBoolean(CDATIPResponse[5] & 0x80); + decoded.URU = Convert.ToBoolean(CDATIPResponse[5] & 0x40); + decoded.Reserved3 = (byte)(CDATIPResponse[5] & 0x3F); - decoded.AlwaysOne = Convert.ToBoolean(CDATIPResponse[6] & 0x80); - decoded.DiscType = Convert.ToBoolean(CDATIPResponse[6] & 0x40); + decoded.AlwaysOne = Convert.ToBoolean(CDATIPResponse[6] & 0x80); + decoded.DiscType = Convert.ToBoolean(CDATIPResponse[6] & 0x40); decoded.DiscSubType = (byte)((CDATIPResponse[6] & 0x38) >> 3); - decoded.A1Valid = Convert.ToBoolean(CDATIPResponse[6] & 0x04); - decoded.A2Valid = Convert.ToBoolean(CDATIPResponse[6] & 0x02); - decoded.A3Valid = Convert.ToBoolean(CDATIPResponse[6] & 0x01); + decoded.A1Valid = Convert.ToBoolean(CDATIPResponse[6] & 0x04); + decoded.A2Valid = Convert.ToBoolean(CDATIPResponse[6] & 0x02); + decoded.A3Valid = Convert.ToBoolean(CDATIPResponse[6] & 0x01); - decoded.Reserved4 = CDATIPResponse[7]; - decoded.LeadInStartMin = CDATIPResponse[8]; - decoded.LeadInStartSec = CDATIPResponse[9]; - decoded.LeadInStartFrame = CDATIPResponse[10]; - decoded.Reserved5 = CDATIPResponse[11]; - decoded.LeadOutStartMin = CDATIPResponse[12]; - decoded.LeadOutStartSec = CDATIPResponse[13]; + decoded.Reserved4 = CDATIPResponse[7]; + decoded.LeadInStartMin = CDATIPResponse[8]; + decoded.LeadInStartSec = CDATIPResponse[9]; + decoded.LeadInStartFrame = CDATIPResponse[10]; + decoded.Reserved5 = CDATIPResponse[11]; + decoded.LeadOutStartMin = CDATIPResponse[12]; + decoded.LeadOutStartSec = CDATIPResponse[13]; decoded.LeadOutStartFrame = CDATIPResponse[14]; - decoded.Reserved6 = CDATIPResponse[15]; + decoded.Reserved6 = CDATIPResponse[15]; decoded.A1Values = new byte[3]; decoded.A2Values = new byte[3]; @@ -356,6 +356,7 @@ namespace DiscImageChef.Decoders.CD sb.AppendFormat("Unknown CD-RW disc subtype: {0}", response.DiscSubType).AppendLine(); break; } + switch(response.ReferenceSpeed) { case 1: @@ -430,7 +431,7 @@ namespace DiscImageChef.Decoders.CD if(response.LeadInStartMin != 97) return sb.ToString(); int type = response.LeadInStartFrame % 10; - int frm = response.LeadInStartFrame - type; + int frm = response.LeadInStartFrame - type; if(response.DiscType) sb.AppendLine("Disc uses phase change"); else diff --git a/DiscImageChef.Decoders/CD/CDTextOnLeadIn.cs b/DiscImageChef.Decoders/CD/CDTextOnLeadIn.cs index 56a6fdcce..220232221 100644 --- a/DiscImageChef.Decoders/CD/CDTextOnLeadIn.cs +++ b/DiscImageChef.Decoders/CD/CDTextOnLeadIn.cs @@ -199,9 +199,9 @@ namespace DiscImageChef.Decoders.CD BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian; decoded.DataLength = BigEndianBitConverter.ToUInt16(CDTextResponse, 0); - decoded.Reserved1 = CDTextResponse[2]; - decoded.Reserved2 = CDTextResponse[3]; - decoded.DataPacks = new CDTextPack[(decoded.DataLength - 2) / 18]; + decoded.Reserved1 = CDTextResponse[2]; + decoded.Reserved2 = CDTextResponse[3]; + decoded.DataPacks = new CDTextPack[(decoded.DataLength - 2) / 18]; if(decoded.DataLength == 2) return null; @@ -215,13 +215,13 @@ namespace DiscImageChef.Decoders.CD for(int i = 0; i < (decoded.DataLength - 2) / 18; i++) { - decoded.DataPacks[i].HeaderID1 = CDTextResponse[0 + i * 18 + 4]; - decoded.DataPacks[i].HeaderID2 = CDTextResponse[1 + i * 18 + 4]; - decoded.DataPacks[i].HeaderID3 = CDTextResponse[2 + i * 18 + 4]; - decoded.DataPacks[i].DBCC = Convert.ToBoolean(CDTextResponse[3 + i * 18 + 4] & 0x80); - decoded.DataPacks[i].BlockNumber = (byte)((CDTextResponse[3 + i * 18 + 4] & 0x70) >> 4); + decoded.DataPacks[i].HeaderID1 = CDTextResponse[0 + i * 18 + 4]; + decoded.DataPacks[i].HeaderID2 = CDTextResponse[1 + i * 18 + 4]; + decoded.DataPacks[i].HeaderID3 = CDTextResponse[2 + i * 18 + 4]; + decoded.DataPacks[i].DBCC = Convert.ToBoolean(CDTextResponse[3 + i * 18 + 4] & 0x80); + decoded.DataPacks[i].BlockNumber = (byte)((CDTextResponse[3 + i * 18 + 4] & 0x70) >> 4); decoded.DataPacks[i].CharacterPosition = (byte)(CDTextResponse[3 + i * 18 + 4] & 0x0F); - decoded.DataPacks[i].TextDataField = new byte[12]; + decoded.DataPacks[i].TextDataField = new byte[12]; Array.Copy(CDTextResponse, 4 + i * 18 + 4, decoded.DataPacks[i].TextDataField, 0, 12); decoded.DataPacks[i].CRC = BigEndianBitConverter.ToUInt16(CDTextResponse, 16 + i * 18 + 4); } @@ -233,13 +233,13 @@ namespace DiscImageChef.Decoders.CD { if(CDTextResponse == null) return null; - CDText response = CDTextResponse.Value; - StringBuilder sb = new StringBuilder(); + CDText response = CDTextResponse.Value; + StringBuilder sb = new StringBuilder(); -#if DEBUG + #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(); -#endif + #endif foreach(CDTextPack descriptor in response.DataPacks) if((descriptor.HeaderID1 & 0x80) != 0x80) diff --git a/DiscImageChef.Decoders/CD/FullTOC.cs b/DiscImageChef.Decoders/CD/FullTOC.cs index 1db2d82e6..9ce165513 100644 --- a/DiscImageChef.Decoders/CD/FullTOC.cs +++ b/DiscImageChef.Decoders/CD/FullTOC.cs @@ -172,20 +172,20 @@ namespace DiscImageChef.Decoders.CD for(int i = 0; i < (decoded.DataLength - 2) / 11; i++) { - decoded.TrackDescriptors[i].SessionNumber = CDFullTOCResponse[0 + i * 11 + 4]; + decoded.TrackDescriptors[i].SessionNumber = CDFullTOCResponse[0 + i * 11 + 4]; decoded.TrackDescriptors[i].ADR = (byte)((CDFullTOCResponse[1 + i * 11 + 4] & 0xF0) >> 4); - decoded.TrackDescriptors[i].CONTROL = (byte)(CDFullTOCResponse[1 + i * 11 + 4] & 0x0F); - decoded.TrackDescriptors[i].TNO = CDFullTOCResponse[2 + i * 11 + 4]; - decoded.TrackDescriptors[i].POINT = CDFullTOCResponse[3 + i * 11 + 4]; - decoded.TrackDescriptors[i].Min = CDFullTOCResponse[4 + i * 11 + 4]; - decoded.TrackDescriptors[i].Sec = CDFullTOCResponse[5 + i * 11 + 4]; - decoded.TrackDescriptors[i].Frame = CDFullTOCResponse[6 + i * 11 + 4]; - decoded.TrackDescriptors[i].Zero = CDFullTOCResponse[7 + i * 11 + 4]; + decoded.TrackDescriptors[i].CONTROL = (byte)(CDFullTOCResponse[1 + i * 11 + 4] & 0x0F); + decoded.TrackDescriptors[i].TNO = CDFullTOCResponse[2 + i * 11 + 4]; + decoded.TrackDescriptors[i].POINT = CDFullTOCResponse[3 + i * 11 + 4]; + decoded.TrackDescriptors[i].Min = CDFullTOCResponse[4 + i * 11 + 4]; + decoded.TrackDescriptors[i].Sec = CDFullTOCResponse[5 + i * 11 + 4]; + decoded.TrackDescriptors[i].Frame = CDFullTOCResponse[6 + i * 11 + 4]; + decoded.TrackDescriptors[i].Zero = CDFullTOCResponse[7 + i * 11 + 4]; decoded.TrackDescriptors[i].HOUR = (byte)((CDFullTOCResponse[7 + i * 11 + 4] & 0xF0) >> 4); - decoded.TrackDescriptors[i].PHOUR = (byte)(CDFullTOCResponse[7 + i * 11 + 4] & 0x0F); - decoded.TrackDescriptors[i].PMIN = CDFullTOCResponse[8 + i * 11 + 4]; - decoded.TrackDescriptors[i].PSEC = CDFullTOCResponse[9 + i * 11 + 4]; - decoded.TrackDescriptors[i].PFRAME = CDFullTOCResponse[10 + i * 11 + 4]; + decoded.TrackDescriptors[i].PHOUR = (byte)(CDFullTOCResponse[7 + i * 11 + 4] & 0x0F); + decoded.TrackDescriptors[i].PMIN = CDFullTOCResponse[8 + i * 11 + 4]; + decoded.TrackDescriptors[i].PSEC = CDFullTOCResponse[9 + i * 11 + 4]; + decoded.TrackDescriptors[i].PFRAME = CDFullTOCResponse[10 + i * 11 + 4]; } return decoded; @@ -202,28 +202,26 @@ namespace DiscImageChef.Decoders.CD int lastSession = 0; sb.AppendFormat("First complete session number: {0}", response.FirstCompleteSession).AppendLine(); - sb.AppendFormat("Last complete session number: {0}", response.LastCompleteSession).AppendLine(); + sb.AppendFormat("Last complete session number: {0}", response.LastCompleteSession).AppendLine(); foreach(TrackDataDescriptor descriptor in response.TrackDescriptors) - if((descriptor.CONTROL & 0x08) == - 0x08 || - descriptor.ADR != 1 && descriptor.ADR != 5 && descriptor.ADR != 4 && - descriptor.ADR != 6 || + if((descriptor.CONTROL & 0x08) == 0x08 || + 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(); - 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(); + 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(); } else { @@ -378,7 +376,7 @@ namespace DiscImageChef.Decoders.CD } default: { - if(descriptor.POINT >= 0x01 && descriptor.POINT <= 0x63) + 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, @@ -426,18 +424,18 @@ namespace DiscImageChef.Decoders.CD } else { - sb.AppendFormat("ADR = {0}", descriptor.ADR).AppendLine(); + 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(); + 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; @@ -514,12 +512,12 @@ namespace DiscImageChef.Decoders.CD 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("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; } @@ -563,18 +561,18 @@ namespace DiscImageChef.Decoders.CD } else { - sb.AppendFormat("ADR = {0}", descriptor.ADR).AppendLine(); + 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(); + 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; diff --git a/DiscImageChef.Decoders/CD/PMA.cs b/DiscImageChef.Decoders/CD/PMA.cs index b79ba9378..be183582a 100644 --- a/DiscImageChef.Decoders/CD/PMA.cs +++ b/DiscImageChef.Decoders/CD/PMA.cs @@ -144,9 +144,9 @@ namespace DiscImageChef.Decoders.CD BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian; - decoded.DataLength = BigEndianBitConverter.ToUInt16(CDPMAResponse, 0); - decoded.Reserved1 = CDPMAResponse[2]; - decoded.Reserved2 = CDPMAResponse[3]; + decoded.DataLength = BigEndianBitConverter.ToUInt16(CDPMAResponse, 0); + decoded.Reserved1 = CDPMAResponse[2]; + decoded.Reserved2 = CDPMAResponse[3]; decoded.PMADescriptors = new CDPMADescriptors[(decoded.DataLength - 2) / 11]; if(decoded.DataLength + 2 != CDPMAResponse.Length) @@ -160,18 +160,18 @@ namespace DiscImageChef.Decoders.CD for(int i = 0; i < (decoded.DataLength - 2) / 11; i++) { decoded.PMADescriptors[i].Reserved = CDPMAResponse[0 + i * 11 + 4]; - decoded.PMADescriptors[i].ADR = (byte)((CDPMAResponse[1 + i * 11 + 4] & 0xF0) >> 4); - decoded.PMADescriptors[i].CONTROL = (byte)(CDPMAResponse[1 + i * 11 + 4] & 0x0F); - decoded.PMADescriptors[i].TNO = CDPMAResponse[2 + i * 11 + 4]; - decoded.PMADescriptors[i].POINT = CDPMAResponse[3 + i * 11 + 4]; - decoded.PMADescriptors[i].Min = CDPMAResponse[4 + i * 11 + 4]; - decoded.PMADescriptors[i].Sec = CDPMAResponse[5 + i * 11 + 4]; - decoded.PMADescriptors[i].Frame = CDPMAResponse[6 + i * 11 + 4]; - decoded.PMADescriptors[i].HOUR = (byte)((CDPMAResponse[7 + i * 11 + 4] & 0xF0) >> 4); - decoded.PMADescriptors[i].PHOUR = (byte)(CDPMAResponse[7 + i * 11 + 4] & 0x0F); - decoded.PMADescriptors[i].PMIN = CDPMAResponse[8 + i * 11 + 4]; - decoded.PMADescriptors[i].PSEC = CDPMAResponse[9 + i * 11 + 4]; - decoded.PMADescriptors[i].PFRAME = CDPMAResponse[10 + i * 11 + 4]; + decoded.PMADescriptors[i].ADR = (byte)((CDPMAResponse[1 + i * 11 + 4] & 0xF0) >> 4); + decoded.PMADescriptors[i].CONTROL = (byte)(CDPMAResponse[1 + i * 11 + 4] & 0x0F); + decoded.PMADescriptors[i].TNO = CDPMAResponse[2 + i * 11 + 4]; + decoded.PMADescriptors[i].POINT = CDPMAResponse[3 + i * 11 + 4]; + decoded.PMADescriptors[i].Min = CDPMAResponse[4 + i * 11 + 4]; + decoded.PMADescriptors[i].Sec = CDPMAResponse[5 + i * 11 + 4]; + decoded.PMADescriptors[i].Frame = CDPMAResponse[6 + i * 11 + 4]; + decoded.PMADescriptors[i].HOUR = (byte)((CDPMAResponse[7 + i * 11 + 4] & 0xF0) >> 4); + decoded.PMADescriptors[i].PHOUR = (byte)(CDPMAResponse[7 + i * 11 + 4] & 0x0F); + decoded.PMADescriptors[i].PMIN = CDPMAResponse[8 + i * 11 + 4]; + decoded.PMADescriptors[i].PSEC = CDPMAResponse[9 + i * 11 + 4]; + decoded.PMADescriptors[i].PFRAME = CDPMAResponse[10 + i * 11 + 4]; } return decoded; @@ -185,16 +185,16 @@ namespace DiscImageChef.Decoders.CD StringBuilder sb = new StringBuilder(); -#if DEBUG + #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(); -#endif + #endif foreach(CDPMADescriptors descriptor in response.PMADescriptors) { -#if DEBUG + #if DEBUG if(descriptor.Reserved != 0) sb.AppendFormat("Reserved = 0x{0:X2}", descriptor.Reserved).AppendLine(); -#endif + #endif switch(descriptor.ADR) { @@ -248,21 +248,21 @@ 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.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.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; diff --git a/DiscImageChef.Decoders/CD/Sector.cs b/DiscImageChef.Decoders/CD/Sector.cs index 9fa983ed8..830be1fd7 100644 --- a/DiscImageChef.Decoders/CD/Sector.cs +++ b/DiscImageChef.Decoders/CD/Sector.cs @@ -188,7 +188,7 @@ namespace DiscImageChef.Decoders.CD if(!SyncMark.SequenceEqual(sync)) return sector; - byte[] scrambled = new byte[sector.Length]; + byte[] scrambled = new byte[sector.Length]; for(int i = 0; i < 2352; i++) scrambled[i] = (byte)(sector[i] ^ ScrambleTable[i]); if(sector.Length <= 2352) return scrambled; diff --git a/DiscImageChef.Decoders/CD/Session.cs b/DiscImageChef.Decoders/CD/Session.cs index 66adebc7b..c8797e58f 100644 --- a/DiscImageChef.Decoders/CD/Session.cs +++ b/DiscImageChef.Decoders/CD/Session.cs @@ -119,10 +119,10 @@ namespace DiscImageChef.Decoders.CD BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian; - decoded.DataLength = BigEndianBitConverter.ToUInt16(CDSessionInfoResponse, 0); + decoded.DataLength = BigEndianBitConverter.ToUInt16(CDSessionInfoResponse, 0); decoded.FirstCompleteSession = CDSessionInfoResponse[2]; - decoded.LastCompleteSession = CDSessionInfoResponse[3]; - decoded.TrackDescriptors = new TrackDataDescriptor[(decoded.DataLength - 2) / 8]; + decoded.LastCompleteSession = CDSessionInfoResponse[3]; + decoded.TrackDescriptors = new TrackDataDescriptor[(decoded.DataLength - 2) / 8]; if(decoded.DataLength + 2 != CDSessionInfoResponse.Length) { @@ -134,11 +134,11 @@ namespace DiscImageChef.Decoders.CD for(int i = 0; i < (decoded.DataLength - 2) / 8; i++) { - decoded.TrackDescriptors[i].Reserved1 = CDSessionInfoResponse[0 + i * 8 + 4]; - decoded.TrackDescriptors[i].ADR = (byte)((CDSessionInfoResponse[1 + i * 8 + 4] & 0xF0) >> 4); - decoded.TrackDescriptors[i].CONTROL = (byte)(CDSessionInfoResponse[1 + i * 8 + 4] & 0x0F); + decoded.TrackDescriptors[i].Reserved1 = CDSessionInfoResponse[0 + i * 8 + 4]; + decoded.TrackDescriptors[i].ADR = (byte)((CDSessionInfoResponse[1 + i * 8 + 4] & 0xF0) >> 4); + 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].Reserved2 = CDSessionInfoResponse[3 + i * 8 + 4]; decoded.TrackDescriptors[i].TrackStartAddress = BigEndianBitConverter.ToUInt32(CDSessionInfoResponse, 4 + i * 8 + 4); } @@ -212,12 +212,12 @@ namespace DiscImageChef.Decoders.CD ? "Digital copy of track is permitted" : "Digital copy of track is prohibited"); -#if DEBUG + #if DEBUG if(descriptor.Reserved1 != 0) sb.AppendFormat("Reserved1 = 0x{0:X2}", descriptor.Reserved1).AppendLine(); if(descriptor.Reserved2 != 0) sb.AppendFormat("Reserved2 = 0x{0:X2}", descriptor.Reserved2).AppendLine(); -#endif + #endif sb.AppendLine(); } diff --git a/DiscImageChef.Decoders/CD/TOC.cs b/DiscImageChef.Decoders/CD/TOC.cs index c5a0191f2..2c31b2dba 100644 --- a/DiscImageChef.Decoders/CD/TOC.cs +++ b/DiscImageChef.Decoders/CD/TOC.cs @@ -121,9 +121,9 @@ namespace DiscImageChef.Decoders.CD BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian; - decoded.DataLength = BigEndianBitConverter.ToUInt16(CDTOCResponse, 0); - decoded.FirstTrack = CDTOCResponse[2]; - decoded.LastTrack = CDTOCResponse[3]; + decoded.DataLength = BigEndianBitConverter.ToUInt16(CDTOCResponse, 0); + decoded.FirstTrack = CDTOCResponse[2]; + decoded.LastTrack = CDTOCResponse[3]; decoded.TrackDescriptors = new CDTOCTrackDataDescriptor[(decoded.DataLength - 2) / 8]; if(decoded.DataLength + 2 != CDTOCResponse.Length) @@ -136,11 +136,11 @@ namespace DiscImageChef.Decoders.CD for(int i = 0; i < (decoded.DataLength - 2) / 8; i++) { - decoded.TrackDescriptors[i].Reserved1 = CDTOCResponse[0 + i * 8 + 4]; - decoded.TrackDescriptors[i].ADR = (byte)((CDTOCResponse[1 + i * 8 + 4] & 0xF0) >> 4); - decoded.TrackDescriptors[i].CONTROL = (byte)(CDTOCResponse[1 + i * 8 + 4] & 0x0F); + decoded.TrackDescriptors[i].Reserved1 = CDTOCResponse[0 + i * 8 + 4]; + decoded.TrackDescriptors[i].ADR = (byte)((CDTOCResponse[1 + i * 8 + 4] & 0xF0) >> 4); + 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].Reserved2 = CDTOCResponse[3 + i * 8 + 4]; decoded.TrackDescriptors[i].TrackStartAddress = BigEndianBitConverter.ToUInt32(CDTOCResponse, 4 + i * 8 + 4); } @@ -220,12 +220,12 @@ namespace DiscImageChef.Decoders.CD ? "Digital copy of track is permitted" : "Digital copy of track is prohibited"); -#if DEBUG + #if DEBUG if(descriptor.Reserved1 != 0) sb.AppendFormat("Reserved1 = 0x{0:X2}", descriptor.Reserved1).AppendLine(); if(descriptor.Reserved2 != 0) sb.AppendFormat("Reserved2 = 0x{0:X2}", descriptor.Reserved2).AppendLine(); -#endif + #endif sb.AppendLine(); } diff --git a/DiscImageChef.Decoders/DVD/CSS&CPRM.cs b/DiscImageChef.Decoders/DVD/CSS&CPRM.cs index 76613411f..7deb5936f 100644 --- a/DiscImageChef.Decoders/DVD/CSS&CPRM.cs +++ b/DiscImageChef.Decoders/DVD/CSS&CPRM.cs @@ -126,13 +126,13 @@ namespace DiscImageChef.Decoders.DVD return new LeadInCopyright { - DataLength = (ushort)((response[0] << 8) + response[1]), - Reserved1 = response[2], - Reserved2 = response[3], - CopyrightType = (CopyrightType)response[4], + DataLength = (ushort)((response[0] << 8) + response[1]), + Reserved1 = response[2], + Reserved2 = response[3], + CopyrightType = (CopyrightType)response[4], RegionInformation = response[5], - Reserved3 = response[6], - Reserved4 = response[7] + Reserved3 = response[6], + Reserved4 = response[7] }; } @@ -141,7 +141,7 @@ namespace DiscImageChef.Decoders.DVD if(cmi == null) return null; LeadInCopyright decoded = cmi.Value; - StringBuilder sb = new StringBuilder(); + StringBuilder sb = new StringBuilder(); switch(decoded.CopyrightType) { @@ -164,7 +164,7 @@ namespace DiscImageChef.Decoders.DVD if(decoded.CopyrightType == 0) return sb.ToString(); - if(decoded.RegionInformation == 0xFF) sb.AppendLine("Disc cannot be played in any region at all."); + 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 { diff --git a/DiscImageChef.Decoders/DVD/Cartridge.cs b/DiscImageChef.Decoders/DVD/Cartridge.cs index dec065023..be9317ef7 100644 --- a/DiscImageChef.Decoders/DVD/Cartridge.cs +++ b/DiscImageChef.Decoders/DVD/Cartridge.cs @@ -132,18 +132,18 @@ namespace DiscImageChef.Decoders.DVD return new MediumStatus { DataLength = (ushort)((response[0] << 8) + response[1]), - Reserved1 = response[2], - Reserved2 = response[3], - Cartridge = (response[4] & 0x80) == 0x80, - OUT = (response[4] & 0x40) == 0x40, - Reserved3 = (byte)((response[4] & 0x30) >> 4), - MSWI = (response[4] & 0x08) == 0x08, - CWP = (response[4] & 0x04) == 0x04, - PWP = (response[4] & 0x02) == 0x02, - Reserved4 = (response[4] & 0x01) == 0x01, - DiscType = response[5], - Reserved5 = response[6], - RAMSWI = response[7] + Reserved1 = response[2], + Reserved2 = response[3], + Cartridge = (response[4] & 0x80) == 0x80, + OUT = (response[4] & 0x40) == 0x40, + Reserved3 = (byte)((response[4] & 0x30) >> 4), + MSWI = (response[4] & 0x08) == 0x08, + CWP = (response[4] & 0x04) == 0x04, + PWP = (response[4] & 0x02) == 0x02, + Reserved4 = (response[4] & 0x01) == 0x01, + DiscType = response[5], + Reserved5 = response[6], + RAMSWI = response[7] }; } @@ -151,8 +151,8 @@ namespace DiscImageChef.Decoders.DVD { if(status == null) return null; - MediumStatus decoded = status.Value; - StringBuilder sb = new StringBuilder(); + MediumStatus decoded = status.Value; + StringBuilder sb = new StringBuilder(); if(decoded.PWP) sb.AppendLine("Disc surface is set to write protected status"); diff --git a/DiscImageChef.Decoders/DVD/DDS.cs b/DiscImageChef.Decoders/DVD/DDS.cs index 8599fba5f..da0d8dcdf 100644 --- a/DiscImageChef.Decoders/DVD/DDS.cs +++ b/DiscImageChef.Decoders/DVD/DDS.cs @@ -209,32 +209,34 @@ namespace DiscImageChef.Decoders.DVD if(dds.Identifier != 0x0A0A) return null; // Common to both DVD-RAM versions - dds.DataLength = (ushort)((response[0] << 8) + response[1]); - dds.Reserved1 = response[2]; - dds.Reserved2 = response[3]; - dds.Reserved3 = response[6]; - dds.InProcess |= (response[7] & 0x80) == 0x80; - dds.UserCertification |= (response[7] & 0x02) == 0x02; + dds.DataLength = (ushort)((response[0] << 8) + response[1]); + dds.Reserved1 = response[2]; + dds.Reserved2 = response[3]; + dds.Reserved3 = response[6]; + dds.InProcess |= (response[7] & 0x80) == 0x80; + dds.UserCertification |= (response[7] & 0x02) == 0x02; dds.ManufacturerCertification |= (response[7] & 0x01) == 0x01; - dds.UpdateCount = (uint)((response[8] << 24) + (response[9] << 16) + (response[10] << 8) + response[11]); - dds.Groups = (ushort)((response[12] << 8) + response[13]); + dds.UpdateCount = + (uint)((response[8] << 24) + (response[9] << 16) + (response[10] << 8) + response[11]); + dds.Groups = + (ushort)((response[12] << 8) + response[13]); // ECMA-272 if(dds.Groups == 24) { dds.PartialCertification |= (response[7] & 0x40) == 0x40; dds.FormattingOnlyAGroup |= (response[7] & 0x20) == 0x20; - dds.Reserved4 = (byte)((response[7] & 0x1C) >> 2); - dds.Reserved = new byte[6]; + dds.Reserved4 = (byte)((response[7] & 0x1C) >> 2); + dds.Reserved = new byte[6]; Array.Copy(response, 14, dds.Reserved, 0, 6); dds.GroupCertificationFlags = new GroupCertificationFlag[24]; for(int i = 0; i < 24; i++) { - dds.GroupCertificationFlags[i].InProcess |= (response[20 + i] & 0x80) == 0x80; + dds.GroupCertificationFlags[i].InProcess |= (response[20 + i] & 0x80) == 0x80; dds.GroupCertificationFlags[i].PartialCertification |= (response[20 + i] & 0x40) == 0x40; - dds.GroupCertificationFlags[i].Reserved1 = (byte)((response[20 + i] & 0x3C) >> 2); - dds.GroupCertificationFlags[i].UserCertification |= (response[20 + i] & 0x02) == 0x02; - dds.GroupCertificationFlags[i].Reserved2 |= (response[20 + i] & 0x01) == 0x01; + dds.GroupCertificationFlags[i].Reserved1 = (byte)((response[20 + i] & 0x3C) >> 2); + dds.GroupCertificationFlags[i].UserCertification |= (response[20 + i] & 0x02) == 0x02; + dds.GroupCertificationFlags[i].Reserved2 |= (response[20 + i] & 0x01) == 0x01; } } @@ -243,17 +245,17 @@ namespace DiscImageChef.Decoders.DVD { dds.Reserved4 = (byte)((response[7] & 0x7C) >> 2); - dds.Reserved = new byte[68]; + dds.Reserved = new byte[68]; Array.Copy(response, 16, dds.Reserved, 0, 68); - dds.Zones = (ushort)((response[14] << 8) + response[15]); + dds.Zones = (ushort)((response[14] << 8) + response[15]); dds.SpareAreaFirstPSN = (uint)((response[85] << 16) + (response[86] << 8) + response[87]); - dds.SpareAreaLastPSN = (uint)((response[89] << 16) + (response[90] << 8) + response[91]); - dds.LSN0Location = (uint)((response[93] << 16) + (response[94] << 8) + response[95]); - dds.StartLSNForZone = new uint[dds.Zones]; + dds.SpareAreaLastPSN = (uint)((response[89] << 16) + (response[90] << 8) + response[91]); + dds.LSN0Location = (uint)((response[93] << 16) + (response[94] << 8) + response[95]); + 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]); + (response[260 + i * 4 + 2] << 8) + response[260 + i * 4 + 3]); } return dds; @@ -264,7 +266,7 @@ namespace DiscImageChef.Decoders.DVD if(dds == null) return null; DiscDefinitionStructure decoded = dds.Value; - StringBuilder sb = new StringBuilder(); + StringBuilder sb = new StringBuilder(); if(decoded.InProcess) { @@ -290,6 +292,7 @@ namespace DiscImageChef.Decoders.DVD if(decoded.GroupCertificationFlags[i].PartialCertification) sb.AppendFormat("Group {0} is being certified partially", i).AppendLine(); } + if(decoded.GroupCertificationFlags[i].UserCertification) sb.AppendFormat("Group {0} has been certified by an user", i).AppendLine(); } diff --git a/DiscImageChef.Decoders/DVD/Enums.cs b/DiscImageChef.Decoders/DVD/Enums.cs index 3871b619c..ebc9cba8c 100644 --- a/DiscImageChef.Decoders/DVD/Enums.cs +++ b/DiscImageChef.Decoders/DVD/Enums.cs @@ -126,10 +126,10 @@ namespace DiscImageChef.Decoders.DVD [SuppressMessage("ReSharper", "InconsistentNaming")] public enum LayerTypeFieldMask : byte { - Embossed = 0x01, + Embossed = 0x01, Recordable = 0x02, Rewritable = 0x04, - Reserved = 0x08 + Reserved = 0x08 } [SuppressMessage("ReSharper", "InconsistentNaming")] @@ -255,21 +255,21 @@ namespace DiscImageChef.Decoders.DVD [SuppressMessage("ReSharper", "InconsistentNaming")] public enum DVDLayerStructure { - Unspecified = 0, + Unspecified = 0, InvertedStack = 1, - TwoP = 2, - Reserved = 3 + TwoP = 2, + Reserved = 3 } [SuppressMessage("ReSharper", "InconsistentNaming")] public enum DVDRecordingSpeed { - None = 0, - Two = 0, - Four = 0x10, - Six = 0x20, - Eight = 0x30, - Ten = 0x40, + None = 0, + Two = 0, + Four = 0x10, + Six = 0x20, + Eight = 0x30, + Ten = 0x40, Twelve = 0x50 } #endregion diff --git a/DiscImageChef.Decoders/DVD/PFI.cs b/DiscImageChef.Decoders/DVD/PFI.cs index de23ac7d6..384b703f5 100644 --- a/DiscImageChef.Decoders/DVD/PFI.cs +++ b/DiscImageChef.Decoders/DVD/PFI.cs @@ -1070,32 +1070,33 @@ namespace DiscImageChef.Decoders.DVD Array.Copy(response, 0, tmp2, 4, 2048); response = tmp2; } - + if(response.Length < 2052) return null; PhysicalFormatInformation pfi = new PhysicalFormatInformation(); - byte[] tmp; + byte[] tmp; pfi.DataLength = (ushort)((response[0] << 8) + response[1]); - pfi.Reserved1 = response[2]; - pfi.Reserved2 = response[3]; + pfi.Reserved1 = response[2]; + pfi.Reserved2 = response[3]; // Common - pfi.DiskCategory = (DiskCategory)((response[4] & 0xF0) >> 4); - pfi.PartVersion = (byte)(response[4] & 0x0F); - pfi.DiscSize = (DVDSize)((response[5] & 0xF0) >> 4); - pfi.MaximumRate = (MaximumRateField)(response[5] & 0x0F); - pfi.Reserved3 |= (response[6] & 0x80) == 0x80; - pfi.Layers = (byte)((response[6] & 0x60) >> 5); - pfi.TrackPath |= (response[6] & 0x08) == 0x08; - pfi.LayerType = (LayerTypeFieldMask)(response[6] & 0x07); - pfi.LinearDensity = (LinearDensityField)((response[7] & 0xF0) >> 4); - pfi.TrackDensity = (TrackDensityField)(response[7] & 0x0F); + pfi.DiskCategory = (DiskCategory)((response[4] & 0xF0) >> 4); + pfi.PartVersion = (byte)(response[4] & 0x0F); + pfi.DiscSize = (DVDSize)((response[5] & 0xF0) >> 4); + pfi.MaximumRate = (MaximumRateField)(response[5] & 0x0F); + pfi.Reserved3 |= (response[6] & 0x80) == 0x80; + pfi.Layers = (byte)((response[6] & 0x60) >> 5); + pfi.TrackPath |= (response[6] & 0x08) == 0x08; + 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.Layer0EndPSN = (uint)((response[16] << 24) + (response[17] << 16) + (response[18] << 8) + response[19]); + pfi.Layer0EndPSN = + (uint)((response[16] << 24) + (response[17] << 16) + (response[18] << 8) + response[19]); pfi.BCA |= (response[20] & 0x80) == 0x80; switch(pfi.DiskCategory) @@ -1110,97 +1111,98 @@ namespace DiscImageChef.Decoders.DVD if(pfi.PartVersion == 1) { - pfi.Velocity = response[52]; - pfi.ReadPower = response[53]; - pfi.PeakPower = response[54]; - pfi.BiasPower = response[55]; - pfi.FirstPulseStart = response[56]; - pfi.FirstPulseEnd = response[57]; - pfi.MultiPulseDuration = response[58]; - pfi.LastPulseStart = response[59]; - pfi.LastPulseEnd = response[60]; - pfi.BiasPowerDuration = response[61]; - pfi.PeakPowerGroove = response[62]; - pfi.BiasPowerGroove = response[63]; - pfi.FirstPulseStartGroove = response[64]; - pfi.FirstPulseEndGroove = response[65]; + pfi.Velocity = response[52]; + pfi.ReadPower = response[53]; + pfi.PeakPower = response[54]; + pfi.BiasPower = response[55]; + pfi.FirstPulseStart = response[56]; + pfi.FirstPulseEnd = response[57]; + pfi.MultiPulseDuration = response[58]; + pfi.LastPulseStart = response[59]; + pfi.LastPulseEnd = response[60]; + pfi.BiasPowerDuration = response[61]; + pfi.PeakPowerGroove = response[62]; + pfi.BiasPowerGroove = response[63]; + pfi.FirstPulseStartGroove = response[64]; + pfi.FirstPulseEndGroove = response[65]; pfi.MultiplePulseDurationGroove = response[66]; - pfi.LastPulseStartGroove = response[67]; - pfi.LastPulseEndGroove = response[68]; - pfi.BiasPowerDurationGroove = response[69]; + pfi.LastPulseStartGroove = response[67]; + pfi.LastPulseEndGroove = response[68]; + pfi.BiasPowerDurationGroove = response[69]; } else if(pfi.PartVersion == 6) { - pfi.Velocity = response[504]; - pfi.ReadPower = response[505]; + pfi.Velocity = response[504]; + pfi.ReadPower = response[505]; pfi.AdaptativeWritePulseControlFlag |= (response[506] & 0x80) == 0x80; - pfi.PeakPower = response[507]; - pfi.BiasPower1 = response[508]; - pfi.BiasPower2 = response[509]; - pfi.BiasPower3 = response[510]; - pfi.PeakPowerGroove = response[511]; - pfi.BiasPower1Groove = response[512]; - pfi.BiasPower2Groove = response[513]; - pfi.BiasPower3Groove = response[514]; - pfi.FirstPulseEnd = response[515]; - pfi.FirstPulseDuration = response[516]; - pfi.MultiPulseDuration = response[518]; - pfi.LastPulseStart = response[519]; - pfi.BiasPower2Duration = response[520]; - pfi.FirstPulseStart3TSpace3T = response[521]; - pfi.FirstPulseStart4TSpace3T = response[522]; - pfi.FirstPulseStart5TSpace3T = response[523]; - pfi.FirstPulseStartSpace3T = response[524]; - pfi.FirstPulseStart3TSpace4T = response[525]; - pfi.FirstPulseStart4TSpace4T = response[526]; - pfi.FirstPulseStart5TSpace4T = response[527]; - pfi.FirstPulseStartSpace4T = response[528]; - pfi.FirstPulseStart3TSpace5T = response[529]; - pfi.FirstPulseStart4TSpace5T = response[530]; - pfi.FirstPulseStart5TSpace5T = response[531]; - pfi.FirstPulseStartSpace5T = response[532]; - pfi.FirstPulseStart3TSpace = response[533]; - pfi.FirstPulseStart4TSpace = response[534]; - pfi.FirstPulseStart5TSpace = response[535]; - pfi.FirstPulseStartSpace = response[536]; - pfi.FirstPulse3TStartTSpace3T = response[537]; - pfi.FirstPulse4TStartTSpace3T = response[538]; - pfi.FirstPulse5TStartTSpace3T = response[539]; - pfi.FirstPulseStartTSpace3T = response[540]; - pfi.FirstPulse3TStartTSpace4T = response[541]; - pfi.FirstPulse4TStartTSpace4T = response[542]; - pfi.FirstPulse5TStartTSpace4T = response[543]; - pfi.FirstPulseStartTSpace4T = response[544]; - pfi.FirstPulse3TStartTSpace5T = response[545]; - pfi.FirstPulse4TStartTSpace5T = response[546]; - pfi.FirstPulse5TStartTSpace5T = response[547]; - pfi.FirstPulseStartTSpace5T = response[548]; - pfi.FirstPulse3TStartTSpace = response[549]; - pfi.FirstPulse4TStartTSpace = response[550]; - pfi.FirstPulse5TStartTSpace = response[551]; - pfi.FirstPulseStartTSpace = response[552]; - tmp = new byte[48]; + pfi.PeakPower = response[507]; + pfi.BiasPower1 = response[508]; + pfi.BiasPower2 = response[509]; + pfi.BiasPower3 = response[510]; + pfi.PeakPowerGroove = response[511]; + pfi.BiasPower1Groove = response[512]; + pfi.BiasPower2Groove = response[513]; + pfi.BiasPower3Groove = response[514]; + pfi.FirstPulseEnd = response[515]; + pfi.FirstPulseDuration = response[516]; + pfi.MultiPulseDuration = response[518]; + pfi.LastPulseStart = response[519]; + pfi.BiasPower2Duration = response[520]; + pfi.FirstPulseStart3TSpace3T = response[521]; + pfi.FirstPulseStart4TSpace3T = response[522]; + pfi.FirstPulseStart5TSpace3T = response[523]; + pfi.FirstPulseStartSpace3T = response[524]; + pfi.FirstPulseStart3TSpace4T = response[525]; + pfi.FirstPulseStart4TSpace4T = response[526]; + pfi.FirstPulseStart5TSpace4T = response[527]; + pfi.FirstPulseStartSpace4T = response[528]; + pfi.FirstPulseStart3TSpace5T = response[529]; + pfi.FirstPulseStart4TSpace5T = response[530]; + pfi.FirstPulseStart5TSpace5T = response[531]; + pfi.FirstPulseStartSpace5T = response[532]; + pfi.FirstPulseStart3TSpace = response[533]; + pfi.FirstPulseStart4TSpace = response[534]; + pfi.FirstPulseStart5TSpace = response[535]; + pfi.FirstPulseStartSpace = response[536]; + pfi.FirstPulse3TStartTSpace3T = response[537]; + pfi.FirstPulse4TStartTSpace3T = response[538]; + pfi.FirstPulse5TStartTSpace3T = response[539]; + pfi.FirstPulseStartTSpace3T = response[540]; + pfi.FirstPulse3TStartTSpace4T = response[541]; + pfi.FirstPulse4TStartTSpace4T = response[542]; + pfi.FirstPulse5TStartTSpace4T = response[543]; + pfi.FirstPulseStartTSpace4T = response[544]; + pfi.FirstPulse3TStartTSpace5T = response[545]; + pfi.FirstPulse4TStartTSpace5T = response[546]; + pfi.FirstPulse5TStartTSpace5T = response[547]; + pfi.FirstPulseStartTSpace5T = response[548]; + pfi.FirstPulse3TStartTSpace = response[549]; + pfi.FirstPulse4TStartTSpace = response[550]; + pfi.FirstPulse5TStartTSpace = response[551]; + pfi.FirstPulseStartTSpace = response[552]; + tmp = new byte[48]; Array.Copy(response, 553, tmp, 0, 48); pfi.DiskManufacturer = StringHandlers.SpacePaddedToString(tmp); - tmp = new byte[16]; + tmp = new byte[16]; Array.Copy(response, 601, tmp, 0, 16); pfi.DiskManufacturerSupplementary = StringHandlers.SpacePaddedToString(tmp); - pfi.WritePowerControlParams = new byte[2]; - pfi.WritePowerControlParams[0] = response[617]; - pfi.WritePowerControlParams[1] = response[618]; - pfi.PowerRatioLandThreshold = response[619]; - pfi.TargetAsymmetry = response[620]; - pfi.TemporaryPeakPower = response[621]; - pfi.TemporaryBiasPower1 = response[622]; - pfi.TemporaryBiasPower2 = response[623]; - pfi.TemporaryBiasPower3 = response[624]; - pfi.PowerRatioGrooveThreshold = response[625]; - pfi.PowerRatioLandThreshold6T = response[626]; - pfi.PowerRatioGrooveThreshold6T = response[627]; + pfi.WritePowerControlParams = new byte[2]; + pfi.WritePowerControlParams[0] = response[617]; + pfi.WritePowerControlParams[1] = response[618]; + pfi.PowerRatioLandThreshold = response[619]; + pfi.TargetAsymmetry = response[620]; + pfi.TemporaryPeakPower = response[621]; + pfi.TemporaryBiasPower1 = response[622]; + pfi.TemporaryBiasPower2 = response[623]; + pfi.TemporaryBiasPower3 = response[624]; + pfi.PowerRatioGrooveThreshold = response[625]; + pfi.PowerRatioLandThreshold6T = response[626]; + pfi.PowerRatioGrooveThreshold6T = response[627]; } + break; // DVD-R and DVD-RW - case DiskCategory.DVDR when pfi.PartVersion < 6: + case DiskCategory.DVDR when pfi.PartVersion < 6: case DiskCategory.DVDRW when pfi.PartVersion < 3: pfi.CurrentBorderOutSector = (uint)((response[36] << 24) + (response[37] << 16) + (response[38] << 8) + response[39]); @@ -1209,39 +1211,39 @@ namespace DiscImageChef.Decoders.DVD break; // DVD+RW case DiskCategory.DVDPRW: - pfi.RecordingVelocity = response[36]; + pfi.RecordingVelocity = response[36]; pfi.ReadPowerMaxVelocity = response[37]; - pfi.PIndMaxVelocity = response[38]; - pfi.PMaxVelocity = response[39]; - pfi.E1MaxVelocity = response[40]; - pfi.E2MaxVelocity = response[41]; - pfi.YTargetMaxVelocity = response[42]; + pfi.PIndMaxVelocity = response[38]; + pfi.PMaxVelocity = response[39]; + pfi.E1MaxVelocity = response[40]; + pfi.E2MaxVelocity = response[41]; + pfi.YTargetMaxVelocity = response[42]; pfi.ReadPowerRefVelocity = response[43]; - pfi.PIndRefVelocity = response[44]; - pfi.PRefVelocity = response[45]; - pfi.E1RefVelocity = response[46]; - pfi.E2RefVelocity = response[47]; - pfi.YTargetRefVelocity = response[48]; + pfi.PIndRefVelocity = response[44]; + pfi.PRefVelocity = response[45]; + pfi.E1RefVelocity = response[46]; + pfi.E2RefVelocity = response[47]; + pfi.YTargetRefVelocity = response[48]; pfi.ReadPowerMinVelocity = response[49]; - pfi.PIndMinVelocity = response[50]; - pfi.PMinVelocity = response[51]; - pfi.E1MinVelocity = response[52]; - pfi.E2MinVelocity = response[53]; - pfi.YTargetMinVelocity = response[54]; + pfi.PIndMinVelocity = response[50]; + pfi.PMinVelocity = response[51]; + pfi.E1MinVelocity = response[52]; + pfi.E2MinVelocity = response[53]; + pfi.YTargetMinVelocity = response[54]; break; } // DVD+R, DVD+RW, DVD+R DL and DVD+RW DL - if(pfi.DiskCategory == DiskCategory.DVDPR || pfi.DiskCategory == DiskCategory.DVDPRW || + 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]; - pfi.ExtendedInformation = response[22]; - tmp = new byte[8]; + pfi.VCPS |= (response[20] & 0x40) == 0x40; + pfi.ApplicationCode = response[21]; + pfi.ExtendedInformation = response[22]; + tmp = new byte[8]; Array.Copy(response, 23, tmp, 0, 8); pfi.DiskManufacturerID = StringHandlers.CToString(tmp); - tmp = new byte[3]; + tmp = new byte[3]; Array.Copy(response, 31, tmp, 0, 3); pfi.MediaTypeID = StringHandlers.CToString(tmp); pfi.ProductRevision = @@ -1253,39 +1255,39 @@ namespace DiscImageChef.Decoders.DVD { // DVD+RW case DiskCategory.DVDPRW when pfi.PartVersion == 2: - pfi.TopFirstPulseDuration = response[55]; - pfi.MultiPulseDuration = response[56]; - pfi.FirstPulseLeadTime = response[57]; + pfi.TopFirstPulseDuration = response[55]; + pfi.MultiPulseDuration = response[56]; + pfi.FirstPulseLeadTime = response[57]; pfi.EraseLeadTimeRefVelocity = response[58]; pfi.EraseLeadTimeUppVelocity = response[59]; break; // DVD+R and DVD+R DL case DiskCategory.DVDPR: case DiskCategory.DVDPRDL: - pfi.PrimaryVelocity = response[36]; - pfi.UpperVelocity = response[37]; - pfi.Wavelength = response[38]; - pfi.NormalizedPowerDependency = response[39]; - pfi.MaximumPowerAtPrimaryVelocity = response[40]; - pfi.PindAtPrimaryVelocity = response[41]; - pfi.BtargetAtPrimaryVelocity = response[42]; - pfi.MaximumPowerAtUpperVelocity = response[43]; - pfi.PindAtUpperVelocity = response[44]; - pfi.BtargetAtUpperVelocity = response[45]; - pfi.FirstPulseDuration4TPrimaryVelocity = response[46]; - pfi.FirstPulseDuration3TPrimaryVelocity = response[47]; - pfi.MultiPulseDurationPrimaryVelocity = response[48]; - pfi.LastPulseDurationPrimaryVelocity = response[49]; - pfi.FirstPulseLeadTime4TPrimaryVelocity = response[50]; - pfi.FirstPulseLeadTime3TPrimaryVelocity = response[51]; + pfi.PrimaryVelocity = response[36]; + pfi.UpperVelocity = response[37]; + pfi.Wavelength = response[38]; + pfi.NormalizedPowerDependency = response[39]; + pfi.MaximumPowerAtPrimaryVelocity = response[40]; + pfi.PindAtPrimaryVelocity = response[41]; + pfi.BtargetAtPrimaryVelocity = response[42]; + pfi.MaximumPowerAtUpperVelocity = response[43]; + pfi.PindAtUpperVelocity = response[44]; + pfi.BtargetAtUpperVelocity = response[45]; + pfi.FirstPulseDuration4TPrimaryVelocity = response[46]; + pfi.FirstPulseDuration3TPrimaryVelocity = response[47]; + pfi.MultiPulseDurationPrimaryVelocity = response[48]; + pfi.LastPulseDurationPrimaryVelocity = response[49]; + pfi.FirstPulseLeadTime4TPrimaryVelocity = response[50]; + pfi.FirstPulseLeadTime3TPrimaryVelocity = response[51]; pfi.FirstPulseLeadingEdgePrimaryVelocity = response[52]; - pfi.FirstPulseDuration4TUpperVelocity = response[53]; - pfi.FirstPulseDuration3TUpperVelocity = response[54]; - pfi.MultiPulseDurationUpperVelocity = response[55]; - pfi.LastPulseDurationUpperVelocity = response[56]; - pfi.FirstPulseLeadTime4TUpperVelocity = response[57]; - pfi.FirstPulseLeadTime3TUpperVelocity = response[58]; - pfi.FirstPulseLeadingEdgeUpperVelocity = response[59]; + pfi.FirstPulseDuration4TUpperVelocity = response[53]; + pfi.FirstPulseDuration3TUpperVelocity = response[54]; + pfi.MultiPulseDurationUpperVelocity = response[55]; + pfi.LastPulseDurationUpperVelocity = response[56]; + pfi.FirstPulseLeadTime4TUpperVelocity = response[57]; + pfi.FirstPulseLeadTime3TUpperVelocity = response[58]; + pfi.FirstPulseLeadingEdgeUpperVelocity = response[59]; break; } @@ -1297,48 +1299,48 @@ namespace DiscImageChef.Decoders.DVD break; // DVD+RW DL case DiskCategory.DVDPRWDL: - pfi.BasicPrimaryVelocity = response[36]; + pfi.BasicPrimaryVelocity = response[36]; pfi.MaxReadPowerPrimaryVelocity = response[37]; - pfi.PindPrimaryVelocity = response[38]; - pfi.PPrimaryVelocity = response[39]; - pfi.E1PrimaryVelocity = response[40]; - pfi.E2PrimaryVelocity = response[41]; - pfi.YtargetPrimaryVelocity = response[42]; - pfi.BOptimumPrimaryVelocity = response[43]; - pfi.TFirstPulseDuration = response[46]; - pfi.TMultiPulseDuration = response[47]; - pfi.FirstPulseLeadTimeAnyRun = response[48]; - pfi.FirstPulseLeadTimeRun3T = response[49]; - pfi.LastPulseLeadTimeAnyRun = response[50]; - pfi.LastPulseLeadTime3T = response[51]; - pfi.LastPulseLeadTime4T = response[52]; - pfi.ErasePulseLeadTimeAny = response[53]; - pfi.ErasePulseLeadTime3T = response[54]; - pfi.ErasePulseLeadTime4T = response[55]; + pfi.PindPrimaryVelocity = response[38]; + pfi.PPrimaryVelocity = response[39]; + pfi.E1PrimaryVelocity = response[40]; + pfi.E2PrimaryVelocity = response[41]; + pfi.YtargetPrimaryVelocity = response[42]; + pfi.BOptimumPrimaryVelocity = response[43]; + pfi.TFirstPulseDuration = response[46]; + pfi.TMultiPulseDuration = response[47]; + pfi.FirstPulseLeadTimeAnyRun = response[48]; + pfi.FirstPulseLeadTimeRun3T = response[49]; + pfi.LastPulseLeadTimeAnyRun = response[50]; + pfi.LastPulseLeadTime3T = response[51]; + pfi.LastPulseLeadTime4T = response[52]; + pfi.ErasePulseLeadTimeAny = response[53]; + pfi.ErasePulseLeadTime3T = response[54]; + pfi.ErasePulseLeadTime4T = response[55]; break; // DVD-R DL and DVD-RW DL - case DiskCategory.DVDR when pfi.PartVersion == 6: + case DiskCategory.DVDR when pfi.PartVersion == 6: case DiskCategory.DVDRW when pfi.PartVersion == 3: pfi.MaxRecordingSpeed = (DVDRecordingSpeed)response[21]; pfi.MinRecordingSpeed = (DVDRecordingSpeed)response[22]; - pfi.RecordingSpeed1 = (DVDRecordingSpeed)response[23]; - pfi.RecordingSpeed2 = (DVDRecordingSpeed)response[24]; - pfi.RecordingSpeed3 = (DVDRecordingSpeed)response[25]; - pfi.RecordingSpeed4 = (DVDRecordingSpeed)response[26]; - pfi.RecordingSpeed5 = (DVDRecordingSpeed)response[27]; - pfi.RecordingSpeed6 = (DVDRecordingSpeed)response[28]; - pfi.RecordingSpeed7 = (DVDRecordingSpeed)response[29]; - pfi.Class = response[30]; - pfi.ExtendedVersion = response[31]; + pfi.RecordingSpeed1 = (DVDRecordingSpeed)response[23]; + pfi.RecordingSpeed2 = (DVDRecordingSpeed)response[24]; + pfi.RecordingSpeed3 = (DVDRecordingSpeed)response[25]; + pfi.RecordingSpeed4 = (DVDRecordingSpeed)response[26]; + pfi.RecordingSpeed5 = (DVDRecordingSpeed)response[27]; + pfi.RecordingSpeed6 = (DVDRecordingSpeed)response[28]; + 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.PreRecordedControlDataInv |= (response[44] & 0x01) == 0x01; - pfi.PreRecordedLeadIn |= (response[44] & 0x02) == 0x02; - pfi.PreRecordedLeadOut |= (response[44] & 0x08) == 0x08; - pfi.ARCharLayer1 = (byte)(response[45] & 0x0F); - pfi.TrackPolarityLayer1 = (byte)((response[45] & 0xF0) >> 4); + pfi.PreRecordedControlDataInv |= (response[44] & 0x01) == 0x01; + pfi.PreRecordedLeadIn |= (response[44] & 0x02) == 0x02; + pfi.PreRecordedLeadOut |= (response[44] & 0x08) == 0x08; + pfi.ARCharLayer1 = (byte)(response[45] & 0x0F); + pfi.TrackPolarityLayer1 = (byte)((response[45] & 0xF0) >> 4); break; } @@ -1350,7 +1352,7 @@ namespace DiscImageChef.Decoders.DVD if(pfi == null) return null; PhysicalFormatInformation decoded = pfi.Value; - StringBuilder sb = new StringBuilder(); + StringBuilder sb = new StringBuilder(); string sizeString; switch(decoded.DiscSize) @@ -1541,7 +1543,7 @@ namespace DiscImageChef.Decoders.DVD } sb.AppendFormat("Disc has {0} layers", decoded.Layers + 1).AppendLine(); - if(decoded.TrackPath && decoded.Layers == 1) sb.AppendLine("Layers are in parallel 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) @@ -1602,7 +1604,8 @@ 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"); if(decoded.BCA) sb.AppendLine("Disc has a burst cutting area"); @@ -1632,8 +1635,9 @@ namespace DiscImageChef.Decoders.DVD sb.AppendFormat("Disc manufacturer supplementary information is {0}", decoded.DiskManufacturerSupplementary).AppendLine(); } + break; - case DiskCategory.DVDR when decoded.PartVersion < 6: + case DiskCategory.DVDR when decoded.PartVersion < 6: case DiskCategory.DVDRW when decoded.PartVersion < 3: sb.AppendFormat("Current Border-Out first sector is PSN {0:X}h", decoded.CurrentBorderOutSector) .AppendLine(); @@ -1652,7 +1656,7 @@ namespace DiscImageChef.Decoders.DVD break; } - if((decoded.DiskCategory != DiskCategory.DVDR || decoded.PartVersion < 6) && + if((decoded.DiskCategory != DiskCategory.DVDR || decoded.PartVersion < 6) && (decoded.DiskCategory != DiskCategory.DVDRW || decoded.PartVersion < 3)) return sb.ToString(); sb.AppendFormat("Current RMD in extra Border zone starts at PSN {0:X}h", decoded.CurrentRMDExtraBorderPSN) diff --git a/DiscImageChef.Decoders/DVD/Spare.cs b/DiscImageChef.Decoders/DVD/Spare.cs index d65031766..e911d4e70 100644 --- a/DiscImageChef.Decoders/DVD/Spare.cs +++ b/DiscImageChef.Decoders/DVD/Spare.cs @@ -97,8 +97,8 @@ namespace DiscImageChef.Decoders.DVD return new SpareAreaInformation { DataLength = (ushort)((response[0] << 8) + response[1]), - Reserved1 = response[2], - Reserved2 = response[3], + Reserved1 = response[2], + Reserved2 = response[3], UnusedPrimaryBlocks = (uint)((response[4] << 24) + (response[5] << 16) + (response[6] << 8) + response[7]), UnusedSupplementaryBlocks = @@ -113,7 +113,7 @@ namespace DiscImageChef.Decoders.DVD if(sai == null) return null; SpareAreaInformation decoded = sai.Value; - StringBuilder sb = new StringBuilder(); + StringBuilder sb = new StringBuilder(); sb.AppendFormat("{0} unused primary spare blocks", decoded.UnusedPrimaryBlocks).AppendLine(); sb.AppendFormat("{0} unused supplementary spare blocks", decoded.UnusedSupplementaryBlocks).AppendLine(); diff --git a/DiscImageChef.Decoders/Floppy/Amiga.cs b/DiscImageChef.Decoders/Floppy/Amiga.cs index 7a03444ca..b6afce43b 100644 --- a/DiscImageChef.Decoders/Floppy/Amiga.cs +++ b/DiscImageChef.Decoders/Floppy/Amiga.cs @@ -48,11 +48,13 @@ 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 /// @@ -72,7 +74,8 @@ 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 /// @@ -81,7 +84,8 @@ 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 951864525..29ff2e178 100644 --- a/DiscImageChef.Decoders/Floppy/Apple2.cs +++ b/DiscImageChef.Decoders/Floppy/Apple2.cs @@ -93,33 +93,39 @@ namespace DiscImageChef.Decoders.Floppy /// 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; /// /// Always 0xD5, 0xAA, 0x96 /// - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] public byte[] prologue; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] + public byte[] prologue; /// /// 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; /// /// 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; /// /// 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; } /// @@ -137,11 +143,13 @@ namespace DiscImageChef.Decoders.Floppy /// /// Always 0xDE, 0xAA, 0xEB /// - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] public byte[] epilogue; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] + public byte[] epilogue; /// /// Always 0xD5, 0xAA, 0xAD /// - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] public byte[] prologue; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] + public byte[] prologue; } static readonly byte[] ReadTable5and3 = @@ -225,11 +233,11 @@ namespace DiscImageChef.Decoders.Floppy if(data == null || data.Length != 410) return null; byte[] buffer = new byte[data.Length]; - byte carry = 0; + byte carry = 0; for(int i = 0; i < data.Length; i++) { - carry ^= ReadTable5and3[data[i]]; - buffer[i] = carry; + carry ^= ReadTable5and3[data[i]]; + buffer[i] = carry; } byte[] output = new byte[256]; @@ -237,14 +245,14 @@ namespace DiscImageChef.Decoders.Floppy { byte b1 = buffer[51 * 3 - i]; byte b2 = buffer[51 * 2 - i]; - byte b3 = buffer[51 - i]; - byte b4 = (byte)((((b1 & 2) << 1) | (b2 & 2) | ((b3 & 2) >> 1)) & 0xFF); - byte b5 = (byte)((((b1 & 1) << 2) | ((b2 & 1) << 1) | (b3 & 1)) & 0xFF); + byte b3 = buffer[51 - i]; + byte b4 = (byte)((((b1 & 2) << 1) | (b2 & 2) | ((b3 & 2) >> 1)) & 0xFF); + byte b5 = (byte)((((b1 & 1) << 2) | ((b2 & 1) << 1) | (b3 & 1)) & 0xFF); output[250 - 5 * i] = (byte)(((buffer[i + 51 * 3 + 1] << 3) | ((b1 >> 2) & 0x7)) & 0xFF); output[251 - 5 * i] = (byte)(((buffer[i + 51 * 4 + 1] << 3) | ((b2 >> 2) & 0x7)) & 0xFF); output[252 - 5 * i] = (byte)(((buffer[i + 51 * 5 + 1] << 3) | ((b3 >> 2) & 0x7)) & 0xFF); - 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[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); @@ -261,11 +269,11 @@ namespace DiscImageChef.Decoders.Floppy if(data == null || data.Length != 342) return null; byte[] buffer = new byte[data.Length]; - byte carry = 0; + byte carry = 0; for(int i = 0; i < data.Length; i++) { - carry ^= ReadTable6and2[data[i]]; - buffer[i] = carry; + carry ^= ReadTable6and2[data[i]]; + buffer[i] = carry; } byte[] output = new byte[256]; @@ -296,8 +304,10 @@ namespace DiscImageChef.Decoders.Floppy public static byte[] DecodeSector(RawSector sector) { if(sector.addressField.prologue[0] != 0xD5 || sector.addressField.prologue[1] != 0xAA) return null; + // Pre DOS 3.3 if(sector.addressField.prologue[2] == 0xB5) return Decode5and3(sector.dataField.data); + // DOS 3.3 return sector.addressField.prologue[2] == 0x96 ? Decode6and2(sector.dataField.data) : null; // Unknown @@ -336,11 +346,12 @@ namespace DiscImageChef.Decoders.Floppy addressField = new RawAddressField { prologue = new[] {data[position], data[position + 1], data[position + 2]}, - volume = new[] {data[position + 3], data[position + 4]}, - track = new[] {data[position + 5], data[position + 6]}, - sector = new[] {data[position + 7], data[position + 8]}, - checksum = new[] {data[position + 9], data[position + 10]}, - epilogue = new[] {data[position + 11], data[position + 12], data[position + 13]} + volume = new[] {data[position + 3], data[position + 4]}, + track = new[] {data[position + 5], data[position + 6]}, + sector = new[] {data[position + 7], data[position + 8]}, + checksum = new[] {data[position + 9], data[position + 10]}, + epilogue = new[] + {data[position + 11], data[position + 12], data[position + 13]} } }; @@ -361,9 +372,9 @@ namespace DiscImageChef.Decoders.Floppy sector.addressField.epilogue[2]); position += 14; - int syncCount = 0; - bool onSync = false; - MemoryStream gaps = new MemoryStream(); + int syncCount = 0; + bool onSync = false; + MemoryStream gaps = new MemoryStream(); while(data[position] == 0xFF) { @@ -379,17 +390,17 @@ namespace DiscImageChef.Decoders.Floppy // Prologue not found if(data[position] != 0xD5 || data[position + 1] != 0xAA) return null; - sector.innerGap = gaps.ToArray(); + 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", "Prologue found at {0}", position); - sector.dataField.prologue = new byte[3]; - sector.dataField.prologue[0] = data[position]; - sector.dataField.prologue[1] = data[position + 1]; - sector.dataField.prologue[2] = data[position + 2]; - position += 3; + sector.dataField.prologue = new byte[3]; + sector.dataField.prologue[0] = data[position]; + sector.dataField.prologue[1] = data[position + 1]; + sector.dataField.prologue[2] = data[position + 2]; + position += 3; gaps = new MemoryStream(); // Read data until epilogue is found @@ -405,14 +416,14 @@ namespace DiscImageChef.Decoders.Floppy sector.dataField.data = gaps.ToArray(); 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.checksum = data[position]; + sector.dataField.epilogue = new byte[3]; sector.dataField.epilogue[0] = data[position + 1]; sector.dataField.epilogue[1] = data[position + 2]; sector.dataField.epilogue[2] = data[position + 3]; position += 4; - gaps = new MemoryStream(); + gaps = new MemoryStream(); // Read gap, if any while(position < data.Length && data[position] == 0xFF) { @@ -430,7 +441,7 @@ namespace DiscImageChef.Decoders.Floppy sector.gap = gaps.ToArray(); // Return current position to be able to read separate sectors endOffset = position; - DicConsole.DebugWriteLine("Apple ][ GCR Decoder", "Got {0} bytes of gap", sector.gap.Length); + DicConsole.DebugWriteLine("Apple ][ GCR Decoder", "Got {0} bytes of gap", sector.gap.Length); DicConsole.DebugWriteLine("Apple ][ GCR Decoder", "Finished sector at {0}", position); return sector; } @@ -451,9 +462,9 @@ namespace DiscImageChef.Decoders.Floppy MemoryStream raw = new MemoryStream(); raw.Write(addressField.prologue, 0, addressField.prologue.Length); - raw.Write(addressField.volume, 0, addressField.volume.Length); - raw.Write(addressField.track, 0, addressField.track.Length); - raw.Write(addressField.sector, 0, addressField.sector.Length); + raw.Write(addressField.volume, 0, addressField.volume.Length); + raw.Write(addressField.track, 0, addressField.track.Length); + raw.Write(addressField.sector, 0, addressField.sector.Length); raw.Write(addressField.checksum, 0, addressField.checksum.Length); raw.Write(addressField.epilogue, 0, addressField.epilogue.Length); @@ -466,17 +477,17 @@ namespace DiscImageChef.Decoders.Floppy MemoryStream raw = new MemoryStream(); raw.Write(sector.addressField.prologue, 0, sector.addressField.prologue.Length); - raw.Write(sector.addressField.volume, 0, sector.addressField.volume.Length); - raw.Write(sector.addressField.track, 0, sector.addressField.track.Length); - raw.Write(sector.addressField.sector, 0, sector.addressField.sector.Length); + raw.Write(sector.addressField.volume, 0, sector.addressField.volume.Length); + raw.Write(sector.addressField.track, 0, sector.addressField.track.Length); + raw.Write(sector.addressField.sector, 0, sector.addressField.sector.Length); raw.Write(sector.addressField.checksum, 0, sector.addressField.checksum.Length); raw.Write(sector.addressField.epilogue, 0, sector.addressField.epilogue.Length); - raw.Write(sector.innerGap, 0, sector.innerGap.Length); - raw.Write(sector.dataField.prologue, 0, sector.dataField.prologue.Length); - raw.Write(sector.dataField.data, 0, sector.dataField.data.Length); + raw.Write(sector.innerGap, 0, sector.innerGap.Length); + raw.Write(sector.dataField.prologue, 0, sector.dataField.prologue.Length); + raw.Write(sector.dataField.data, 0, sector.dataField.data.Length); raw.WriteByte(sector.dataField.checksum); raw.Write(sector.dataField.epilogue, 0, sector.dataField.epilogue.Length); - raw.Write(sector.gap, 0, sector.gap.Length); + raw.Write(sector.gap, 0, sector.gap.Length); return raw.ToArray(); } @@ -488,13 +499,13 @@ namespace DiscImageChef.Decoders.Floppy public static RawTrack MarshalTrack(byte[] data, out int endOffset, int offset = 0) { - int position = offset; - bool firstSector = true; - bool onSync = false; - MemoryStream gaps = new MemoryStream(); - int count = 0; - List sectors = new List(); - byte[] trackNumber = new byte[2]; + int position = offset; + bool firstSector = true; + bool onSync = false; + MemoryStream gaps = new MemoryStream(); + int count = 0; + List sectors = new List(); + byte[] trackNumber = new byte[2]; endOffset = offset; while(position < data.Length && data[position] == 0xFF) @@ -511,15 +522,15 @@ namespace DiscImageChef.Decoders.Floppy while(position < data.Length) { - int oldPosition = position; - RawSector sector = MarshalSector(data, out position, position); + int oldPosition = position; + RawSector sector = MarshalSector(data, out position, position); if(sector == null) break; if(firstSector) { trackNumber[0] = sector.addressField.track[0]; trackNumber[1] = sector.addressField.track[1]; - firstSector = false; + firstSector = false; } if(sector.addressField.track[0] != trackNumber[0] || sector.addressField.track[1] != trackNumber[1]) @@ -562,8 +573,8 @@ namespace DiscImageChef.Decoders.Floppy public static List MarshalDisk(byte[] data, out int endOffset, int offset = 0) { endOffset = offset; - List tracks = new List(); - int position = offset; + List tracks = new List(); + int position = offset; RawTrack track = MarshalTrack(data, out position, position); while(track != null) diff --git a/DiscImageChef.Decoders/Floppy/AppleSony.cs b/DiscImageChef.Decoders/Floppy/AppleSony.cs index a463a306f..1481062d0 100644 --- a/DiscImageChef.Decoders/Floppy/AppleSony.cs +++ b/DiscImageChef.Decoders/Floppy/AppleSony.cs @@ -98,7 +98,8 @@ namespace DiscImageChef.Decoders.Floppy /// /// Always 0xDE, 0xAA /// - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)] public byte[] epilogue; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)] + public byte[] epilogue; /// /// Disk format /// @@ -106,7 +107,8 @@ 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 sector number /// @@ -129,19 +131,23 @@ namespace DiscImageChef.Decoders.Floppy /// /// Checksum /// - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)] public byte[] checksum; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)] + public byte[] checksum; /// /// Encoded data bytes. /// - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 698)] public byte[] data; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 698)] + public byte[] data; /// /// Always 0xDE, 0xAA /// - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)] public byte[] epilogue; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)] + public byte[] epilogue; /// /// Always 0xD5, 0xAA, 0xAD /// - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] public byte[] prologue; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] + public byte[] prologue; /// /// Spare, usually /// @@ -153,13 +159,13 @@ namespace DiscImageChef.Decoders.Floppy if(sector.addressField.prologue[0] != 0xD5 || sector.addressField.prologue[1] != 0xAA || sector.addressField.prologue[2] != 0x96) return null; - byte[] bf1 = new byte[175]; - byte[] bf2 = new byte[175]; - byte[] bf3 = new byte[175]; - byte[] nib_data = sector.dataField.data; - MemoryStream ms = new MemoryStream(); + byte[] bf1 = new byte[175]; + byte[] bf2 = new byte[175]; + byte[] bf3 = new byte[175]; + byte[] nib_data = sector.dataField.data; + MemoryStream ms = new MemoryStream(); - int j = 0; + int j = 0; byte w3 = 0; for(int i = 0; i <= 174; i++) { @@ -190,26 +196,29 @@ namespace DiscImageChef.Decoders.Floppy ck3++; ck1 &= 0xFF; } + ms.WriteByte(carry); - carry = (byte)((bf2[j] ^ ck3) & 0xFF); - ck2 += carry; + carry = (byte)((bf2[j] ^ ck3) & 0xFF); + ck2 += carry; if(ck3 > 0xFF) { ck2++; ck3 &= 0xFF; } + ms.WriteByte(carry); if(ms.Length == 524) break; - carry = (byte)((bf3[j] ^ ck2) & 0xFF); - ck1 += carry; + carry = (byte)((bf3[j] ^ ck2) & 0xFF); + ck1 += carry; if(ck2 > 0xFF) { ck1++; ck2 &= 0xFF; } + ms.WriteByte(carry); j++; } @@ -248,19 +257,19 @@ namespace DiscImageChef.Decoders.Floppy addressField = new RawAddressField { prologue = new[] {data[position], data[position + 1], data[position + 2]}, - track = data[position + 3], - sector = data[position + 4], - side = data[position + 5], - format = (AppleEncodedFormat)data[position + 6], + track = data[position + 3], + sector = data[position + 4], + side = data[position + 5], + format = (AppleEncodedFormat)data[position + 6], checksum = data[position + 7], epilogue = new[] {data[position + 8], data[position + 9]} } }; position += 10; - int syncCount = 0; - bool onSync = false; - MemoryStream gaps = new MemoryStream(); + int syncCount = 0; + bool onSync = false; + MemoryStream gaps = new MemoryStream(); while(data[position] == 0xFF) { @@ -281,7 +290,7 @@ namespace DiscImageChef.Decoders.Floppy sector.dataField = new RawDataField { prologue = new[] {data[position], data[position + 1], data[position + 2]}, - spare = data[position + 3] + spare = data[position + 3] }; position += 4; @@ -296,18 +305,18 @@ namespace DiscImageChef.Decoders.Floppy if(position + 7 > data.Length) return null; } - sector.dataField.data = gaps.ToArray(); - sector.dataField.checksum = new byte[4]; + sector.dataField.data = gaps.ToArray(); + sector.dataField.checksum = new byte[4]; sector.dataField.checksum[0] = data[position]; sector.dataField.checksum[1] = data[position + 2]; sector.dataField.checksum[2] = data[position + 3]; sector.dataField.checksum[3] = data[position + 4]; - sector.dataField.epilogue = new byte[2]; + sector.dataField.epilogue = new byte[2]; sector.dataField.epilogue[0] = data[position + 5]; sector.dataField.epilogue[1] = data[position + 6]; position += 7; - gaps = new MemoryStream(); + gaps = new MemoryStream(); // Read gap, if any while(position < data.Length && data[position] == 0xFF) { @@ -364,13 +373,13 @@ namespace DiscImageChef.Decoders.Floppy raw.WriteByte(sector.addressField.side); raw.WriteByte((byte)sector.addressField.format); raw.WriteByte(sector.addressField.checksum); - raw.Write(sector.innerGap, 0, sector.innerGap.Length); + raw.Write(sector.innerGap, 0, sector.innerGap.Length); raw.Write(sector.dataField.prologue, 0, sector.dataField.prologue.Length); raw.WriteByte(sector.dataField.spare); - raw.Write(sector.dataField.data, 0, sector.dataField.data.Length); + raw.Write(sector.dataField.data, 0, sector.dataField.data.Length); raw.Write(sector.dataField.checksum, 0, sector.dataField.checksum.Length); raw.Write(sector.dataField.epilogue, 0, sector.dataField.epilogue.Length); - raw.Write(sector.gap, 0, sector.gap.Length); + raw.Write(sector.gap, 0, sector.gap.Length); return raw.ToArray(); } @@ -382,14 +391,14 @@ namespace DiscImageChef.Decoders.Floppy public static RawTrack MarshalTrack(byte[] data, out int endOffset, int offset = 0) { - int position = offset; - bool firstSector = true; - bool onSync = false; - MemoryStream gaps = new MemoryStream(); - int count = 0; - List sectors = new List(); - byte trackNumber = 0; - byte sideNumber = 0; + int position = offset; + bool firstSector = true; + bool onSync = false; + MemoryStream gaps = new MemoryStream(); + int count = 0; + List sectors = new List(); + byte trackNumber = 0; + byte sideNumber = 0; endOffset = offset; while(position < data.Length && data[position] == 0xFF) @@ -406,14 +415,14 @@ namespace DiscImageChef.Decoders.Floppy while(position < data.Length) { - int oldPosition = position; - RawSector sector = MarshalSector(data, out position, position); + int oldPosition = position; + RawSector sector = MarshalSector(data, out position, position); if(sector == null) break; if(firstSector) { trackNumber = sector.addressField.track; - sideNumber = sector.addressField.side; + sideNumber = sector.addressField.side; firstSector = false; } @@ -452,8 +461,8 @@ namespace DiscImageChef.Decoders.Floppy public static List MarshalDisk(byte[] data, out int endOffset, int offset = 0) { endOffset = offset; - List tracks = new List(); - int position = offset; + List tracks = new List(); + int position = offset; RawTrack track = MarshalTrack(data, out position, position); while(track != null) diff --git a/DiscImageChef.Decoders/Floppy/Commodore.cs b/DiscImageChef.Decoders/Floppy/Commodore.cs index ec417a8d2..dd560f9a0 100644 --- a/DiscImageChef.Decoders/Floppy/Commodore.cs +++ b/DiscImageChef.Decoders/Floppy/Commodore.cs @@ -86,7 +86,8 @@ namespace DiscImageChef.Decoders.Floppy /// /// User data /// - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 256)] public byte data; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 256)] + public byte data; /// /// XOR of /// diff --git a/DiscImageChef.Decoders/Floppy/Enums.cs b/DiscImageChef.Decoders/Floppy/Enums.cs index 619064f22..1a4030ad3 100644 --- a/DiscImageChef.Decoders/Floppy/Enums.cs +++ b/DiscImageChef.Decoders/Floppy/Enums.cs @@ -77,9 +77,9 @@ namespace DiscImageChef.Decoders.Floppy [SuppressMessage("ReSharper", "InconsistentNaming")] public enum IBMIdType : byte { - IndexMark = 0xFC, - AddressMark = 0xFE, - DataMark = 0xFB, + IndexMark = 0xFC, + AddressMark = 0xFE, + DataMark = 0xFB, DeletedDataMark = 0xF8 } diff --git a/DiscImageChef.Decoders/Floppy/ISO.cs b/DiscImageChef.Decoders/Floppy/ISO.cs index bd1e30b7e..17bc76668 100644 --- a/DiscImageChef.Decoders/Floppy/ISO.cs +++ b/DiscImageChef.Decoders/Floppy/ISO.cs @@ -61,7 +61,8 @@ 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 /// @@ -84,7 +85,8 @@ 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 /// @@ -103,11 +105,13 @@ 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,11 +146,13 @@ 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 /// diff --git a/DiscImageChef.Decoders/Floppy/Perpendicular.cs b/DiscImageChef.Decoders/Floppy/Perpendicular.cs index 5ea3ae6cd..eb97e3e94 100644 --- a/DiscImageChef.Decoders/Floppy/Perpendicular.cs +++ b/DiscImageChef.Decoders/Floppy/Perpendicular.cs @@ -84,7 +84,8 @@ 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 /// @@ -104,15 +105,18 @@ 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,7 +124,8 @@ 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; } /// @@ -131,11 +136,13 @@ 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 /// @@ -170,11 +177,13 @@ 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 /// diff --git a/DiscImageChef.Decoders/Floppy/System34.cs b/DiscImageChef.Decoders/Floppy/System34.cs index bc9342b68..6338727ab 100644 --- a/DiscImageChef.Decoders/Floppy/System34.cs +++ b/DiscImageChef.Decoders/Floppy/System34.cs @@ -82,15 +82,18 @@ 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 /// @@ -98,7 +101,8 @@ 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,7 +117,8 @@ 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 /// @@ -132,11 +137,13 @@ 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 /// @@ -171,11 +178,13 @@ 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 /// diff --git a/DiscImageChef.Decoders/Floppy/System3740.cs b/DiscImageChef.Decoders/Floppy/System3740.cs index 41a884cf9..e84062751 100644 --- a/DiscImageChef.Decoders/Floppy/System3740.cs +++ b/DiscImageChef.Decoders/Floppy/System3740.cs @@ -80,11 +80,13 @@ 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 /// @@ -92,7 +94,8 @@ 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; } /// @@ -107,7 +110,8 @@ 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,7 +130,8 @@ 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 /// @@ -161,7 +166,8 @@ 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 /// diff --git a/DiscImageChef.Decoders/LisaTag.cs b/DiscImageChef.Decoders/LisaTag.cs index c09caf070..1a4156fb6 100644 --- a/DiscImageChef.Decoders/LisaTag.cs +++ b/DiscImageChef.Decoders/LisaTag.cs @@ -149,7 +149,7 @@ namespace DiscImageChef.Decoders tmp = BigEndianBitConverter.GetBytes((ushort)(UsedBytes & 0x7FFF)); Array.Copy(tmp, 0, tagBytes, 6, 2); if(ValidChk) tagBytes[6] += 0x80; - tmp = BigEndianBitConverter.GetBytes(AbsPage); + tmp = BigEndianBitConverter.GetBytes(AbsPage); Array.Copy(tmp, 1, tagBytes, 8, 3); tagBytes[11] = Checksum; tmp = BigEndianBitConverter.GetBytes(RelPage); @@ -276,7 +276,7 @@ namespace DiscImageChef.Decoders tmp = BigEndianBitConverter.GetBytes((ushort)(UsedBytes & 0x7FFF)); Array.Copy(tmp, 0, tagBytes, 6, 2); if(ValidChk) tagBytes[6] += 0x80; - tmp = BigEndianBitConverter.GetBytes(AbsPage); + tmp = BigEndianBitConverter.GetBytes(AbsPage); Array.Copy(tmp, 1, tagBytes, 8, 3); tagBytes[11] = Checksum; tmp = BigEndianBitConverter.GetBytes(RelPage); @@ -399,10 +399,10 @@ namespace DiscImageChef.Decoders snTag.Version = BigEndianBitConverter.ToUInt16(tag, 0); snTag.Kind = (byte)((tag[2] & 0xC0) >> 6); - snTag.Reserved = (byte)(tag[2] & 0x3F); + snTag.Reserved = (byte)(tag[2] & 0x3F); snTag.Volume = tag[3]; snTag.FileId = BigEndianBitConverter.ToInt16(tag, 4); - snTag.RelPage = BigEndianBitConverter.ToUInt16(tag, 6); + snTag.RelPage = BigEndianBitConverter.ToUInt16(tag, 6); snTag.NextBlock = (ushort)(BigEndianBitConverter.ToUInt16(tag, 8) & 0x7FF); snTag.PrevBlock = (ushort)(BigEndianBitConverter.ToUInt16(tag, 10) & 0x7FF); @@ -424,7 +424,7 @@ namespace DiscImageChef.Decoders phTag.Version = BigEndianBitConverter.ToUInt16(tag, 0); phTag.Kind = (byte)((tag[2] & 0xC0) >> 6); - phTag.Reserved = (byte)(tag[2] & 0x3F); + phTag.Reserved = (byte)(tag[2] & 0x3F); phTag.Volume = tag[3]; phTag.FileId = BigEndianBitConverter.ToInt16(tag, 4); phTag.ValidChk |= (tag[6] & 0x80) == 0x80; @@ -469,7 +469,7 @@ namespace DiscImageChef.Decoders pmTag.Version = BigEndianBitConverter.ToUInt16(tag, 0); pmTag.Kind = (byte)((tag[2] & 0xC0) >> 6); - pmTag.Reserved = (byte)(tag[2] & 0x3F); + pmTag.Reserved = (byte)(tag[2] & 0x3F); pmTag.Volume = tag[3]; pmTag.FileId = BigEndianBitConverter.ToInt16(tag, 4); pmTag.ValidChk |= (tag[6] & 0x80) == 0x80; diff --git a/DiscImageChef.Decoders/MMC/CID.cs b/DiscImageChef.Decoders/MMC/CID.cs index ec64f88d8..8399abff2 100644 --- a/DiscImageChef.Decoders/MMC/CID.cs +++ b/DiscImageChef.Decoders/MMC/CID.cs @@ -42,14 +42,14 @@ namespace DiscImageChef.Decoders.MMC [SuppressMessage("ReSharper", "UnassignedField.Global")] public class CID { - public byte Manufacturer; - public byte DeviceType; - public byte ApplicationID; + public byte Manufacturer; + public byte DeviceType; + public byte ApplicationID; public string ProductName; - public byte ProductRevision; - public uint ProductSerialNumber; - public byte ManufacturingDate; - public byte CRC; + public byte ProductRevision; + public uint ProductSerialNumber; + public byte ManufacturingDate; + public byte CRC; } [SuppressMessage("ReSharper", "InconsistentNaming")] @@ -81,12 +81,12 @@ namespace DiscImageChef.Decoders.MMC CID cid = new CID { - Manufacturer = response[0], - DeviceType = (byte)(response[1] & 0x03), - ProductRevision = response[9], + Manufacturer = response[0], + DeviceType = (byte)(response[1] & 0x03), + ProductRevision = response[9], ProductSerialNumber = BitConverter.ToUInt32(response, 10), - ManufacturingDate = response[14], - CRC = (byte)((response[15] & 0xFE) >> 1) + ManufacturingDate = response[14], + CRC = (byte)((response[15] & 0xFE) >> 1) }; byte[] tmp = new byte[6]; Array.Copy(response, 3, tmp, 0, 6); diff --git a/DiscImageChef.Decoders/MMC/CSD.cs b/DiscImageChef.Decoders/MMC/CSD.cs index dffe3928d..38f601877 100644 --- a/DiscImageChef.Decoders/MMC/CSD.cs +++ b/DiscImageChef.Decoders/MMC/CSD.cs @@ -42,39 +42,39 @@ namespace DiscImageChef.Decoders.MMC [SuppressMessage("ReSharper", "NotAccessedField.Global")] public class CSD { - public byte Structure; - public byte Version; - public byte TAAC; - public byte NSAC; - public byte Speed; + public byte Structure; + public byte Version; + public byte TAAC; + public byte NSAC; + public byte Speed; public ushort Classes; - public byte ReadBlockLength; - public bool ReadsPartialBlocks; - public bool WriteMisalignment; - public bool ReadMisalignment; - public bool DSRImplemented; + public byte ReadBlockLength; + public bool ReadsPartialBlocks; + public bool WriteMisalignment; + public bool ReadMisalignment; + public bool DSRImplemented; public ushort Size; - public byte ReadCurrentAtVddMin; - public byte ReadCurrentAtVddMax; - public byte WriteCurrentAtVddMin; - public byte WriteCurrentAtVddMax; - public byte SizeMultiplier; - public byte EraseGroupSize; - public byte EraseGroupSizeMultiplier; - public byte WriteProtectGroupSize; - public bool WriteProtectGroupEnable; - public byte DefaultECC; - public byte WriteSpeedFactor; - public byte WriteBlockLength; - public bool WritesPartialBlocks; - public bool ContentProtection; - public bool FileFormatGroup; - public bool Copy; - public bool PermanentWriteProtect; - public bool TemporaryWriteProtect; - public byte FileFormat; - public byte ECC; - public byte CRC; + public byte ReadCurrentAtVddMin; + public byte ReadCurrentAtVddMax; + public byte WriteCurrentAtVddMin; + public byte WriteCurrentAtVddMax; + public byte SizeMultiplier; + public byte EraseGroupSize; + public byte EraseGroupSizeMultiplier; + public byte WriteProtectGroupSize; + public bool WriteProtectGroupEnable; + public byte DefaultECC; + public byte WriteSpeedFactor; + public byte WriteBlockLength; + public bool WritesPartialBlocks; + public bool ContentProtection; + public bool FileFormatGroup; + public bool Copy; + public bool PermanentWriteProtect; + public bool TemporaryWriteProtect; + public byte FileFormat; + public byte ECC; + public byte CRC; } [SuppressMessage("ReSharper", "InconsistentNaming")] @@ -106,39 +106,40 @@ namespace DiscImageChef.Decoders.MMC return new CSD { - Structure = (byte)((response[0] & 0xC0) >> 6), - Version = (byte)((response[0] & 0x3C) >> 2), - TAAC = response[1], - NSAC = response[2], - Speed = response[3], - Classes = (ushort)((response[4] << 4) + ((response[5] & 0xF0) >> 4)), - ReadBlockLength = (byte)(response[5] & 0x0F), - ReadsPartialBlocks = (response[6] & 0x80) == 0x80, - WriteMisalignment = (response[6] & 0x40) == 0x40, - ReadMisalignment = (response[6] & 0x20) == 0x20, - DSRImplemented = (response[6] & 0x10) == 0x10, - Size = (ushort)(((response[6] & 0x03) << 10) + (response[7] << 2) + ((response[8] & 0xC0) >> 6)), - ReadCurrentAtVddMin = (byte)((response[8] & 0x38) >> 3), - ReadCurrentAtVddMax = (byte)(response[8] & 0x07), - WriteCurrentAtVddMin = (byte)((response[9] & 0xE0) >> 5), - WriteCurrentAtVddMax = (byte)((response[9] & 0x1C) >> 2), - SizeMultiplier = (byte)(((response[9] & 0x03) << 1) + ((response[10] & 0x80) >> 7)), - EraseGroupSize = (byte)((response[10] & 0x7C) >> 2), + Structure = (byte)((response[0] & 0xC0) >> 6), + Version = (byte)((response[0] & 0x3C) >> 2), + TAAC = response[1], + NSAC = response[2], + Speed = response[3], + Classes = (ushort)((response[4] << 4) + ((response[5] & 0xF0) >> 4)), + ReadBlockLength = (byte)(response[5] & 0x0F), + ReadsPartialBlocks = (response[6] & 0x80) == 0x80, + WriteMisalignment = (response[6] & 0x40) == 0x40, + ReadMisalignment = (response[6] & 0x20) == 0x20, + DSRImplemented = (response[6] & 0x10) == 0x10, + Size = + (ushort)(((response[6] & 0x03) << 10) + (response[7] << 2) + ((response[8] & 0xC0) >> 6)), + ReadCurrentAtVddMin = (byte)((response[8] & 0x38) >> 3), + ReadCurrentAtVddMax = (byte)(response[8] & 0x07), + WriteCurrentAtVddMin = (byte)((response[9] & 0xE0) >> 5), + WriteCurrentAtVddMax = (byte)((response[9] & 0x1C) >> 2), + SizeMultiplier = (byte)(((response[9] & 0x03) << 1) + ((response[10] & 0x80) >> 7)), + EraseGroupSize = (byte)((response[10] & 0x7C) >> 2), EraseGroupSizeMultiplier = (byte)(((response[10] & 0x03) << 3) + ((response[11] & 0xE0) >> 5)), - WriteProtectGroupSize = (byte)(response[11] & 0x1F), - WriteProtectGroupEnable = (response[12] & 0x80) == 0x80, - DefaultECC = (byte)((response[12] & 0x60) >> 5), - WriteSpeedFactor = (byte)((response[12] & 0x1C) >> 2), - WriteBlockLength = (byte)(((response[12] & 0x03) << 2) + ((response[13] & 0xC0) >> 6)), - WritesPartialBlocks = (response[13] & 0x20) == 0x20, - ContentProtection = (response[13] & 0x01) == 0x01, - FileFormatGroup = (response[14] & 0x80) == 0x80, - Copy = (response[14] & 0x40) == 0x40, - PermanentWriteProtect = (response[14] & 0x20) == 0x20, - TemporaryWriteProtect = (response[14] & 0x10) == 0x10, - FileFormat = (byte)((response[14] & 0x0C) >> 2), - ECC = (byte)(response[14] & 0x03), - CRC = (byte)((response[15] & 0xFE) >> 1) + WriteProtectGroupSize = (byte)(response[11] & 0x1F), + WriteProtectGroupEnable = (response[12] & 0x80) == 0x80, + DefaultECC = (byte)((response[12] & 0x60) >> 5), + WriteSpeedFactor = (byte)((response[12] & 0x1C) >> 2), + WriteBlockLength = (byte)(((response[12] & 0x03) << 2) + ((response[13] & 0xC0) >> 6)), + WritesPartialBlocks = (response[13] & 0x20) == 0x20, + ContentProtection = (response[13] & 0x01) == 0x01, + FileFormatGroup = (response[14] & 0x80) == 0x80, + Copy = (response[14] & 0x40) == 0x40, + PermanentWriteProtect = (response[14] & 0x20) == 0x20, + TemporaryWriteProtect = (response[14] & 0x10) == 0x10, + FileFormat = (byte)((response[14] & 0x0C) >> 2), + ECC = (byte)(response[14] & 0x03), + CRC = (byte)((response[15] & 0xFE) >> 1) }; } @@ -148,7 +149,7 @@ namespace DiscImageChef.Decoders.MMC double unitFactor = 0; double multiplier = 0; - string unit = ""; + string unit = ""; StringBuilder sb = new StringBuilder(); sb.AppendLine("MultiMediaCard Device Specific Data Register:"); @@ -171,35 +172,35 @@ namespace DiscImageChef.Decoders.MMC switch(csd.TAAC & 0x07) { case 0: - unit = "ns"; + unit = "ns"; unitFactor = 1; break; case 1: - unit = "ns"; + unit = "ns"; unitFactor = 10; break; case 2: - unit = "ns"; + unit = "ns"; unitFactor = 100; break; case 3: - unit = "μs"; + unit = "μs"; unitFactor = 1; break; case 4: - unit = "μs"; + unit = "μs"; unitFactor = 10; break; case 5: - unit = "μs"; + unit = "μs"; unitFactor = 100; break; case 6: - unit = "ms"; + unit = "ms"; unitFactor = 1; break; case 7: - unit = "ms"; + unit = "ms"; unitFactor = 10; break; } @@ -277,7 +278,7 @@ namespace DiscImageChef.Decoders.MMC unitFactor = 100; break; default: - unit = "unknown"; + unit = "unknown"; unitFactor = 0; break; } @@ -338,7 +339,9 @@ namespace DiscImageChef.Decoders.MMC 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 += $" {cl}"; + for(int cl = 0, mask = 1; cl <= 11; cl++, mask <<= 1) + if((csd.Classes & mask) == mask) + unit += $" {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"); @@ -358,7 +361,7 @@ 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(); + 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(); @@ -478,7 +481,7 @@ namespace DiscImageChef.Decoders.MMC // TODO: Check specification unitFactor = Convert.ToDouble(csd.EraseGroupSize); multiplier = Convert.ToDouble(csd.EraseGroupSizeMultiplier); - result = (unitFactor + 1) * (multiplier + 1); + result = (unitFactor + 1) * (multiplier + 1); sb.AppendFormat("\tDevice can erase a minimum of {0} blocks at a time", (int)result).AppendLine(); if(csd.WriteProtectGroupEnable) diff --git a/DiscImageChef.Decoders/MMC/ExtendedCSD.cs b/DiscImageChef.Decoders/MMC/ExtendedCSD.cs index 260c81e77..19b0e9250 100644 --- a/DiscImageChef.Decoders/MMC/ExtendedCSD.cs +++ b/DiscImageChef.Decoders/MMC/ExtendedCSD.cs @@ -44,7 +44,8 @@ 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; @@ -62,144 +63,152 @@ 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; - public byte DeviceLifeEstimationTypeB; - public byte DeviceLifeEstimationTypeA; - public byte PreEOLInformation; - public byte OptimalReadSize; - public byte OptimalWriteSize; - public byte OptimalTrimUnitSize; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] + public byte[] VendorHealthReport; + public byte DeviceLifeEstimationTypeB; + public byte DeviceLifeEstimationTypeA; + public byte PreEOLInformation; + public byte OptimalReadSize; + public byte OptimalWriteSize; + public byte OptimalTrimUnitSize; public ushort DeviceVersion; - public ulong FirmwareVersion; - public byte PowerClassDDR200; - public uint CacheSize; - public byte GenericCMD6Timeout; - public byte PowerOffNotificationTimeout; - public byte BackgroundOperationsStatus; - public uint CorrectlyProgrammedSectors; - public byte InitializationTimeAfterPartition; - public byte CacheFlushingPolicy; - public byte PowerClassDDR52; - public byte PowerClassDDR52_195; - public byte PowerClassDDR200_195; - public byte PowerClassDDR200_130; - public byte MinimumWritePerformanceDDR52; - public byte MinimumReadPerformanceDDR52; - public byte Reserved2; - public byte TRIMMultiplier; - public byte SecureFeatureSupport; - public byte SecureEraseMultiplier; - public byte SecureTRIMMultiplier; - public byte BootInformation; - public byte Reserved3; - public byte BootPartitionSize; - public byte AccessSize; - public byte HighCapacityEraseUnitSize; - public byte HighCapacityEraseTimeout; - public byte ReliableWriteSectorCount; - public byte HighCapacityWriteProtectGroupSize; - public byte SleepCurrentVcc; - public byte SleepCurrentVccq; - public byte ProductionStateAwarenessTimeout; - public byte SleepAwakeTimeout; - public byte SleepNotificationTimeout; - public uint SectorCount; - public byte SecureWriteProtectInformation; - public byte MinimumWritePerformance52; - public byte MinimumReadPerformance52; - public byte MinimumWritePerformance26; - public byte MinimumReadPerformance26; - public byte MinimumWritePerformance26_4; - public byte MinimumReadPerformance26_4; - public byte Reserved4; - public byte PowerClass26; - public byte PowerClass52; - public byte PowerClass26_195; - public byte PowerClass52_195; - public byte PartitionSwitchingTime; - public byte OutOfInterruptBusyTiming; - public byte DriverStrength; - public byte DeviceType; - public byte Reserved5; - public byte Structure; - public byte Reserved6; - public byte Revision; - public byte CommandSet; - public byte Reserved7; - public byte CommandSetRevision; - public byte Reserved8; - public byte PowerClass; - public byte Reserved9; - public byte HighSpeedInterfaceTiming; - public byte StrobeSupport; - public byte BusWidth; - public byte Reserved10; - public byte ErasedMemoryContent; - public byte Reserved11; - public byte PartitionConfiguration; - public byte BootConfigProtection; - public byte BootBusConditions; - public byte Reserved12; - public byte HighDensityEraseGroupDefinition; - public byte BootWriteProtectionStatus; - public byte BootAreaWriteProtectionRegister; - public byte Reserved13; - public byte UserAreaWriteProtectionRegister; - public byte Reserved14; - public byte FirmwareConfiguration; - public byte RPMBSize; - public byte WriteReliabilitySettingRegister; - public byte WriteReliabilityParameterRegister; - public byte StartSanitizeOperation; - public byte ManuallyStartBackgroundOperations; - public byte EnableBackgroundOperationsHandshake; - public byte HWResetFunction; - public byte HPIManagement; - public byte PartitioningSupport; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] public byte[] MaxEnhancedAreaSize; + public ulong FirmwareVersion; + public byte PowerClassDDR200; + public uint CacheSize; + public byte GenericCMD6Timeout; + public byte PowerOffNotificationTimeout; + public byte BackgroundOperationsStatus; + public uint CorrectlyProgrammedSectors; + public byte InitializationTimeAfterPartition; + public byte CacheFlushingPolicy; + public byte PowerClassDDR52; + public byte PowerClassDDR52_195; + public byte PowerClassDDR200_195; + public byte PowerClassDDR200_130; + public byte MinimumWritePerformanceDDR52; + public byte MinimumReadPerformanceDDR52; + public byte Reserved2; + public byte TRIMMultiplier; + public byte SecureFeatureSupport; + public byte SecureEraseMultiplier; + public byte SecureTRIMMultiplier; + public byte BootInformation; + public byte Reserved3; + public byte BootPartitionSize; + public byte AccessSize; + public byte HighCapacityEraseUnitSize; + public byte HighCapacityEraseTimeout; + public byte ReliableWriteSectorCount; + public byte HighCapacityWriteProtectGroupSize; + public byte SleepCurrentVcc; + public byte SleepCurrentVccq; + public byte ProductionStateAwarenessTimeout; + public byte SleepAwakeTimeout; + public byte SleepNotificationTimeout; + public uint SectorCount; + public byte SecureWriteProtectInformation; + public byte MinimumWritePerformance52; + public byte MinimumReadPerformance52; + public byte MinimumWritePerformance26; + public byte MinimumReadPerformance26; + public byte MinimumWritePerformance26_4; + public byte MinimumReadPerformance26_4; + public byte Reserved4; + public byte PowerClass26; + public byte PowerClass52; + public byte PowerClass26_195; + public byte PowerClass52_195; + public byte PartitionSwitchingTime; + public byte OutOfInterruptBusyTiming; + public byte DriverStrength; + public byte DeviceType; + public byte Reserved5; + public byte Structure; + public byte Reserved6; + public byte Revision; + public byte CommandSet; + public byte Reserved7; + public byte CommandSetRevision; + public byte Reserved8; + public byte PowerClass; + public byte Reserved9; + public byte HighSpeedInterfaceTiming; + public byte StrobeSupport; + public byte BusWidth; + public byte Reserved10; + public byte ErasedMemoryContent; + public byte Reserved11; + public byte PartitionConfiguration; + public byte BootConfigProtection; + public byte BootBusConditions; + public byte Reserved12; + public byte HighDensityEraseGroupDefinition; + public byte BootWriteProtectionStatus; + public byte BootAreaWriteProtectionRegister; + public byte Reserved13; + public byte UserAreaWriteProtectionRegister; + public byte Reserved14; + public byte FirmwareConfiguration; + public byte RPMBSize; + public byte WriteReliabilitySettingRegister; + public byte WriteReliabilityParameterRegister; + public byte StartSanitizeOperation; + public byte ManuallyStartBackgroundOperations; + public byte EnableBackgroundOperationsHandshake; + public byte HWResetFunction; + public byte HPIManagement; + public byte PartitioningSupport; + [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; - public uint EnhancedUserDataStartAddress; - public byte Reserved15; - public byte BadBlockManagementMode; - public byte ProductionStateAwareness; - public byte PackageCaseTemperatureControl; - public byte PeriodicWakeUp; - public byte SupportsProgramCxDInDDR; + [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; + public byte ProductionStateAwareness; + public byte PackageCaseTemperatureControl; + public byte PeriodicWakeUp; + public byte SupportsProgramCxDInDDR; public ushort Reserved16; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 64)] public byte[] VendorSpecific; - public byte NativeSectorSize; - public byte SectorSizeEmulation; - public byte SectorSize; - public byte InitializationTimeout; - public byte Class6CommandsControl; - public byte AddressedGroupToBeReleased; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 64)] + public byte[] VendorSpecific; + public byte NativeSectorSize; + public byte SectorSizeEmulation; + public byte SectorSize; + public byte InitializationTimeout; + public byte Class6CommandsControl; + public byte AddressedGroupToBeReleased; public ushort ExceptionEventsControl; public ushort ExceptionEventsStatus; public ushort ExtendedPartitionsAttribute; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 15)] public byte[] ContextConfiguration; - public byte PackedCommandStatus; - public byte PackedCommandFailureIndex; - public byte PowerOffNotification; - public byte CacheControl; - public byte CacheFlushing; - public byte BarrierControl; - public byte ModeConfig; - public byte ModeOperationCodes; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 15)] + public byte[] ContextConfiguration; + public byte PackedCommandStatus; + public byte PackedCommandFailureIndex; + public byte PowerOffNotification; + public byte CacheControl; + public byte CacheFlushing; + public byte BarrierControl; + public byte ModeConfig; + public byte ModeOperationCodes; public ushort Reserved17; - public byte FFUStatus; - public uint PreLoadingDataSize; - public uint MaxPreLoadingDataSize; - public byte ProductStateAwarenessEnablement; - public byte SecureRemovalType; - public byte CommandQueueModeEnable; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 15)] public byte[] Reserved18; + public byte FFUStatus; + public uint PreLoadingDataSize; + public uint MaxPreLoadingDataSize; + public byte ProductStateAwarenessEnablement; + public byte SecureRemovalType; + public byte CommandQueueModeEnable; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 15)] + public byte[] Reserved18; } [SuppressMessage("ReSharper", "InconsistentNaming")] @@ -213,8 +222,8 @@ namespace DiscImageChef.Decoders.MMC if(response.Length != 512) return null; - GCHandle handle = GCHandle.Alloc(response, GCHandleType.Pinned); - ExtendedCSD csd = (ExtendedCSD)Marshal.PtrToStructure(handle.AddrOfPinnedObject(), typeof(ExtendedCSD)); + GCHandle handle = GCHandle.Alloc(response, GCHandleType.Pinned); + ExtendedCSD csd = (ExtendedCSD)Marshal.PtrToStructure(handle.AddrOfPinnedObject(), typeof(ExtendedCSD)); handle.Free(); return csd; @@ -364,8 +373,8 @@ namespace DiscImageChef.Decoders.MMC 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(); + .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) { diff --git a/DiscImageChef.Decoders/MMC/OCR.cs b/DiscImageChef.Decoders/MMC/OCR.cs index f61fdf21c..c7d3775d2 100644 --- a/DiscImageChef.Decoders/MMC/OCR.cs +++ b/DiscImageChef.Decoders/MMC/OCR.cs @@ -72,25 +72,25 @@ namespace DiscImageChef.Decoders.MMC { return new OCR { - PowerUp = (response & 0x80000000) == 0x80000000, + PowerUp = (response & 0x80000000) == 0x80000000, AccessMode = (byte)((response & 0x60000000) >> 29), - ThreeFive = (response & 0x00800000) == 0x00800000, - ThreeFour = (response & 0x00400000) == 0x00400000, + ThreeFive = (response & 0x00800000) == 0x00800000, + ThreeFour = (response & 0x00400000) == 0x00400000, ThreeThree = (response & 0x00200000) == 0x00200000, - ThreeTwo = (response & 0x00100000) == 0x00100000, - ThreeOne = (response & 0x00080000) == 0x00080000, - ThreeZero = (response & 0x00040000) == 0x00040000, - TwoNine = (response & 0x00020000) == 0x00020000, - TwoEight = (response & 0x00010000) == 0x00010000, - TwoSeven = (response & 0x00008000) == 0x00008000, - TwoSix = (response & 0x00004000) == 0x00004000, - TwoFive = (response & 0x00002000) == 0x00002000, - TwoFour = (response & 0x00001000) == 0x00001000, - TwoThree = (response & 0x00000800) == 0x00000800, - TwoTwo = (response & 0x00000400) == 0x00000400, - TwoOne = (response & 0x00000200) == 0x00000200, - TwoZero = (response & 0x00000100) == 0x00000100, - OneSix = (response & 0x00000080) == 0x00000080 + ThreeTwo = (response & 0x00100000) == 0x00100000, + ThreeOne = (response & 0x00080000) == 0x00080000, + ThreeZero = (response & 0x00040000) == 0x00040000, + TwoNine = (response & 0x00020000) == 0x00020000, + TwoEight = (response & 0x00010000) == 0x00010000, + TwoSeven = (response & 0x00008000) == 0x00008000, + TwoSix = (response & 0x00004000) == 0x00004000, + TwoFive = (response & 0x00002000) == 0x00002000, + TwoFour = (response & 0x00001000) == 0x00001000, + TwoThree = (response & 0x00000800) == 0x00000800, + TwoTwo = (response & 0x00000400) == 0x00000400, + TwoOne = (response & 0x00000200) == 0x00000200, + TwoZero = (response & 0x00000100) == 0x00000100, + OneSix = (response & 0x00000080) == 0x00000080 }; } diff --git a/DiscImageChef.Decoders/MMC/VendorString.cs b/DiscImageChef.Decoders/MMC/VendorString.cs index 0c2d6cd40..f4b3adfbc 100644 --- a/DiscImageChef.Decoders/MMC/VendorString.cs +++ b/DiscImageChef.Decoders/MMC/VendorString.cs @@ -39,7 +39,7 @@ namespace DiscImageChef.Decoders.MMC switch(mmcVendorId) { case 0x15: return "Samsung"; - default: return $"Unknown manufacturer ID 0x{mmcVendorId:X2}"; + default: return $"Unknown manufacturer ID 0x{mmcVendorId:X2}"; } } } diff --git a/DiscImageChef.Decoders/PCMCIA/CIS.cs b/DiscImageChef.Decoders/PCMCIA/CIS.cs index 9bbf5aec6..c99381e95 100644 --- a/DiscImageChef.Decoders/PCMCIA/CIS.cs +++ b/DiscImageChef.Decoders/PCMCIA/CIS.cs @@ -46,8 +46,8 @@ namespace DiscImageChef.Decoders.PCMCIA // TODO: Handle links? Or are they removed in lower layers of the operating system drivers? public static Tuple[] GetTuples(byte[] data) { - List tuples = new List(); - int position = 0; + List tuples = new List(); + int position = 0; while(position < data.Length) { @@ -84,25 +84,25 @@ namespace DiscImageChef.Decoders.PCMCIA { if((data?.Length - 2) % 6 != 0) return null; - DeviceGeometryTuple tuple = new DeviceGeometryTuple(); + DeviceGeometryTuple tuple = new DeviceGeometryTuple(); List geometries = new List(); for(int position = 2; position < data.Length; position += 6) { DeviceGeometry geometry = new DeviceGeometry { - CardInterface = data[position], + CardInterface = data[position], EraseBlockSize = data[position + 1], - ReadBlockSize = data[position + 2], + ReadBlockSize = data[position + 2], WriteBlockSize = data[position + 3], - Partitions = data[position + 4], - Interleaving = data[position + 5] + Partitions = data[position + 4], + Interleaving = data[position + 5] }; geometries.Add(geometry); } - tuple.Code = (TupleCodes)data[0]; - tuple.Link = data[1]; + tuple.Code = (TupleCodes)data[0]; + tuple.Link = data[1]; tuple.Geometries = geometries.ToArray(); return tuple; @@ -128,7 +128,7 @@ namespace DiscImageChef.Decoders.PCMCIA (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(); + (1 << (geometry.Partitions - 1))).AppendLine(); } return sb.ToString(); @@ -159,10 +159,10 @@ namespace DiscImageChef.Decoders.PCMCIA return new ManufacturerIdentificationTuple { - Code = (TupleCodes)data[0], - Link = data[1], + Code = (TupleCodes)data[0], + Link = data[1], ManufacturerID = BitConverter.ToUInt16(data, 2), - CardID = BitConverter.ToUInt16(data, 4) + CardID = BitConverter.ToUInt16(data, 4) }; } @@ -201,15 +201,15 @@ namespace DiscImageChef.Decoders.PCMCIA if(data.Length < 4) return null; - List buffer = new List(); - List strings = null; - bool firstString = false; - bool secondString = false; + List buffer = new List(); + List strings = null; + bool firstString = false; + bool secondString = false; Level1VersionTuple tuple = new Level1VersionTuple { - Code = (TupleCodes)data[0], - Link = data[1], + Code = (TupleCodes)data[0], + Link = data[1], MajorVersion = data[2], MinorVersion = data[3] }; @@ -225,8 +225,8 @@ namespace DiscImageChef.Decoders.PCMCIA if(!firstString) { tuple.Manufacturer = StringHandlers.CToString(buffer.ToArray()); - buffer = new List(); - firstString = true; + buffer = new List(); + firstString = true; continue; } @@ -234,8 +234,8 @@ namespace DiscImageChef.Decoders.PCMCIA if(!secondString) { tuple.Product = StringHandlers.CToString(buffer.ToArray()); - buffer = new List(); - firstString = true; + buffer = new List(); + firstString = true; continue; } diff --git a/DiscImageChef.Decoders/PCMCIA/Enums.cs b/DiscImageChef.Decoders/PCMCIA/Enums.cs index 0e67fc562..aedf592b0 100644 --- a/DiscImageChef.Decoders/PCMCIA/Enums.cs +++ b/DiscImageChef.Decoders/PCMCIA/Enums.cs @@ -279,18 +279,18 @@ namespace DiscImageChef.Decoders.PCMCIA [SuppressMessage("ReSharper", "InconsistentNaming")] public enum FunctionCodes : byte { - MultiFunction = 0x00, - Memory = 0x01, - Serial = 0x02, - Parallel = 0x03, - FixedDisk = 0x04, - Video = 0x05, - Network = 0x06, - AIMS = 0x07, - SCSI = 0x08, - Security = 0x09, - Instrument = 0x0A, + MultiFunction = 0x00, + Memory = 0x01, + Serial = 0x02, + Parallel = 0x03, + FixedDisk = 0x04, + Video = 0x05, + Network = 0x06, + AIMS = 0x07, + SCSI = 0x08, + Security = 0x09, + Instrument = 0x0A, HighSpeedSerial = 0x0B, - VendorSpecific = 0xFE + VendorSpecific = 0xFE } } \ No newline at end of file diff --git a/DiscImageChef.Decoders/PCMCIA/Types.cs b/DiscImageChef.Decoders/PCMCIA/Types.cs index 3e7d93dfe..f3d31edc6 100644 --- a/DiscImageChef.Decoders/PCMCIA/Types.cs +++ b/DiscImageChef.Decoders/PCMCIA/Types.cs @@ -43,8 +43,8 @@ namespace DiscImageChef.Decoders.PCMCIA public class Tuple { public TupleCodes Code; - public byte Link; - public byte[] Data; + public byte Link; + public byte[] Data; } /// diff --git a/DiscImageChef.Decoders/PCMCIA/VendorCode.cs b/DiscImageChef.Decoders/PCMCIA/VendorCode.cs index 364b8a41f..5de2b3560 100644 --- a/DiscImageChef.Decoders/PCMCIA/VendorCode.cs +++ b/DiscImageChef.Decoders/PCMCIA/VendorCode.cs @@ -42,130 +42,130 @@ 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 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"; @@ -356,7 +356,7 @@ namespace DiscImageChef.Decoders.PCMCIA case 0xC020: return "NextCom K.K."; case 0xC250: return "EMTAC Technology Corporation"; case 0xD601: return "Elsa"; - default: return $"Unknown vendor id 0x{id:X4}"; + default: return $"Unknown vendor id 0x{id:X4}"; } } } diff --git a/DiscImageChef.Decoders/SCSI/DiscStructureCapabilities.cs b/DiscImageChef.Decoders/SCSI/DiscStructureCapabilities.cs index e54526626..7fd4c4868 100644 --- a/DiscImageChef.Decoders/SCSI/DiscStructureCapabilities.cs +++ b/DiscImageChef.Decoders/SCSI/DiscStructureCapabilities.cs @@ -72,8 +72,8 @@ namespace DiscImageChef.Decoders.SCSI Capability cap = new Capability { FormatCode = response[offset], - SDS = (response[offset + 1] & 0x80) == 0x80, - RDS = (response[offset + 1] & 0x40) == 0x40 + SDS = (response[offset + 1] & 0x80) == 0x80, + RDS = (response[offset + 1] & 0x40) == 0x40 }; caps.Add(cap); offset += 4; diff --git a/DiscImageChef.Decoders/SCSI/EVPD.cs b/DiscImageChef.Decoders/SCSI/EVPD.cs index cb0b0c1f5..953c96285 100644 --- a/DiscImageChef.Decoders/SCSI/EVPD.cs +++ b/DiscImageChef.Decoders/SCSI/EVPD.cs @@ -150,14 +150,14 @@ namespace DiscImageChef.Decoders.SCSI Page_81 decoded = new Page_81 { - PeripheralQualifier = (PeripheralQualifiers)((pageResponse[0] & 0xE0) >> 5), + PeripheralQualifier = (PeripheralQualifiers)((pageResponse[0] & 0xE0) >> 5), PeripheralDeviceType = (PeripheralDeviceTypes)(pageResponse[0] & 0x1F), - PageLength = (byte)(pageResponse[3] + 4), - Current = (ScsiDefinitions)(pageResponse[4] & 0x7F), - Default = (ScsiDefinitions)(pageResponse[5] & 0x7F) + PageLength = (byte)(pageResponse[3] + 4), + Current = (ScsiDefinitions)(pageResponse[4] & 0x7F), + Default = (ScsiDefinitions)(pageResponse[5] & 0x7F) }; - int position = 6; + int position = 6; List definitions = new List(); while(position < pageResponse.Length) @@ -182,11 +182,11 @@ 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 $"Unknown definition code {(byte)definition}"; + 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 $"Unknown definition code {(byte)definition}"; } } @@ -194,8 +194,8 @@ namespace DiscImageChef.Decoders.SCSI { if(!modePage.HasValue) return null; - Page_81 page = modePage.Value; - StringBuilder sb = new StringBuilder(); + Page_81 page = modePage.Value; + StringBuilder sb = new StringBuilder(); sb.AppendLine("SCSI Implemented operating definitions:"); @@ -385,12 +385,12 @@ namespace DiscImageChef.Decoders.SCSI Page_83 decoded = new Page_83 { - PeripheralQualifier = (PeripheralQualifiers)((pageResponse[0] & 0xE0) >> 5), + PeripheralQualifier = (PeripheralQualifiers)((pageResponse[0] & 0xE0) >> 5), PeripheralDeviceType = (PeripheralDeviceTypes)(pageResponse[0] & 0x1F), - PageLength = (byte)(pageResponse[3] + 4) + PageLength = (byte)(pageResponse[3] + 4) }; - int position = 4; + int position = 4; List descriptors = new List(); while(position < pageResponse.Length) @@ -398,11 +398,11 @@ namespace DiscImageChef.Decoders.SCSI IdentificatonDescriptor descriptor = new IdentificatonDescriptor { ProtocolIdentifier = (ProtocolIdentifiers)((pageResponse[position] & 0xF0) >> 4), - CodeSet = (IdentificationCodeSet)(pageResponse[position] & 0x0F), - PIV = (pageResponse[position + 1] & 0x80) == 0x80, - Association = (IdentificationAssociation)((pageResponse[position + 1] & 0x30) >> 4), - Type = (IdentificationTypes)(pageResponse[position + 1] & 0x0F), - Length = pageResponse[position + 3] + CodeSet = (IdentificationCodeSet)(pageResponse[position] & 0x0F), + PIV = (pageResponse[position + 1] & 0x80) == 0x80, + Association = (IdentificationAssociation)((pageResponse[position + 1] & 0x30) >> 4), + Type = (IdentificationTypes)(pageResponse[position + 1] & 0x0F), + Length = pageResponse[position + 3] }; descriptor.Binary = new byte[descriptor.Length]; if(descriptor.Length + position + 4 >= pageResponse.Length) @@ -439,8 +439,8 @@ namespace DiscImageChef.Decoders.SCSI { if(!modePage.HasValue) return null; - Page_83 page = modePage.Value; - StringBuilder sb = new StringBuilder(); + Page_83 page = modePage.Value; + StringBuilder sb = new StringBuilder(); sb.AppendLine("SCSI Device identification:"); @@ -642,69 +642,69 @@ namespace DiscImageChef.Decoders.SCSI { case ProtocolIdentifiers.ADT: sb - .AppendFormat("\tProtocol (Automation/Drive Interface Transport) specific descriptor with unknown format (hex): {0}", - PrintHex.ByteArrayToHexArrayString(descriptor.Binary, 40)) - .AppendLine(); + .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(); + .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(); + .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(); + .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(); + .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(); + .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(); + .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(); + .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(); + .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(); + .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(); + .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}", @@ -712,15 +712,15 @@ namespace DiscImageChef.Decoders.SCSI break; case ProtocolIdentifiers.UAS: sb - .AppendFormat("\tProtocol (UAS) specific descriptor: USB address {0} interface {1}", - descriptor.Binary[0] & 0x7F, descriptor.Binary[2]).AppendLine(); + .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(); + .AppendFormat("\tProtocol (unknown code {0}) specific descriptor with unknown format (hex): {1}", + (byte)descriptor.ProtocolIdentifier, + PrintHex.ByteArrayToHexArrayString(descriptor.Binary, 40)) + .AppendLine(); break; } } @@ -741,9 +741,9 @@ namespace DiscImageChef.Decoders.SCSI break; default: 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(); + .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; } @@ -802,12 +802,12 @@ namespace DiscImageChef.Decoders.SCSI Page_84 decoded = new Page_84 { - PeripheralQualifier = (PeripheralQualifiers)((pageResponse[0] & 0xE0) >> 5), + PeripheralQualifier = (PeripheralQualifiers)((pageResponse[0] & 0xE0) >> 5), PeripheralDeviceType = (PeripheralDeviceTypes)(pageResponse[0] & 0x1F), - PageLength = (byte)(pageResponse[3] + 4) + PageLength = (byte)(pageResponse[3] + 4) }; - int position = 4; + int position = 4; List identifiers = new List(); while(position < pageResponse.Length) @@ -832,8 +832,8 @@ namespace DiscImageChef.Decoders.SCSI { if(!modePage.HasValue) return null; - Page_84 page = modePage.Value; - StringBuilder sb = new StringBuilder(); + Page_84 page = modePage.Value; + StringBuilder sb = new StringBuilder(); sb.AppendLine("SCSI Software Interface Identifiers:"); @@ -859,13 +859,13 @@ namespace DiscImageChef.Decoders.SCSI #region EVPD Page 0x85: Management Network Addresses page public enum NetworkServiceTypes : byte { - Unspecified = 0, - StorageConf = 1, - Diagnostics = 2, - Status = 3, - Logging = 4, - CodeDownload = 5, - CopyService = 6, + Unspecified = 0, + StorageConf = 1, + Diagnostics = 2, + Status = 3, + Logging = 4, + CodeDownload = 5, + CopyService = 6, Administrative = 7 } @@ -927,12 +927,12 @@ namespace DiscImageChef.Decoders.SCSI Page_85 decoded = new Page_85 { - PeripheralQualifier = (PeripheralQualifiers)((pageResponse[0] & 0xE0) >> 5), + PeripheralQualifier = (PeripheralQualifiers)((pageResponse[0] & 0xE0) >> 5), PeripheralDeviceType = (PeripheralDeviceTypes)(pageResponse[0] & 0x1F), - PageLength = (ushort)((pageResponse[2] << 8) + pageResponse[3] + 4) + PageLength = (ushort)((pageResponse[2] << 8) + pageResponse[3] + 4) }; - int position = 4; + int position = 4; List descriptors = new List(); while(position < pageResponse.Length) @@ -940,8 +940,8 @@ namespace DiscImageChef.Decoders.SCSI NetworkDescriptor descriptor = new NetworkDescriptor { Association = (IdentificationAssociation)((pageResponse[position] & 0x60) >> 5), - Type = (NetworkServiceTypes)(pageResponse[position] & 0x1F), - Length = (ushort)((pageResponse[position + 2] << 8) + pageResponse[position + 3]) + Type = (NetworkServiceTypes)(pageResponse[position] & 0x1F), + Length = (ushort)((pageResponse[position + 2] << 8) + pageResponse[position + 3]) }; descriptor.Address = new byte[descriptor.Length]; Array.Copy(pageResponse, position + 4, descriptor.Address, 0, descriptor.Length); @@ -964,8 +964,8 @@ namespace DiscImageChef.Decoders.SCSI { if(!modePage.HasValue) return null; - Page_85 page = modePage.Value; - StringBuilder sb = new StringBuilder(); + Page_85 page = modePage.Value; + StringBuilder sb = new StringBuilder(); sb.AppendLine("SCSI Management Network Addresses:"); @@ -1183,36 +1183,36 @@ namespace DiscImageChef.Decoders.SCSI return new Page_86 { - PeripheralQualifier = (PeripheralQualifiers)((pageResponse[0] & 0xE0) >> 5), + PeripheralQualifier = (PeripheralQualifiers)((pageResponse[0] & 0xE0) >> 5), PeripheralDeviceType = (PeripheralDeviceTypes)(pageResponse[0] & 0x1F), - PageLength = (byte)(pageResponse[3] + 4), - ActivateMicrocode = (byte)((pageResponse[4] & 0xC0) >> 6), - SPT = (byte)((pageResponse[4] & 0x38) >> 3), - GRD_CHK = (pageResponse[4] & 0x04) == 0x04, - APP_CHK = (pageResponse[4] & 0x02) == 0x02, - REF_CHK = (pageResponse[4] & 0x01) == 0x01, - UASK_SUP = (pageResponse[5] & 0x20) == 0x20, - GROUP_SUP = (pageResponse[5] & 0x10) == 0x10, - PRIOR_SUP = (pageResponse[5] & 0x08) == 0x08, - HEADSUP = (pageResponse[5] & 0x04) == 0x04, - ORDSUP = (pageResponse[5] & 0x02) == 0x02, - SIMPSUP = (pageResponse[5] & 0x01) == 0x01, - WU_SUP = (pageResponse[6] & 0x08) == 0x08, - CRD_SUP = (pageResponse[6] & 0x04) == 0x04, - NV_SUP = (pageResponse[6] & 0x02) == 0x02, - V_SUP = (pageResponse[6] & 0x01) == 0x01, - NO_PI_CHK = (pageResponse[7] & 0x20) == 0x20, - P_I_I_SUP = (pageResponse[7] & 0x10) == 0x10, - LUICLR = (pageResponse[7] & 0x01) == 0x01, - R_SUP = (pageResponse[8] & 0x10) == 0x10, - HSSRELEF = (pageResponse[8] & 0x02) == 0x02, - CBCS = (pageResponse[8] & 0x01) == 0x01, - Nexus = (byte)(pageResponse[9] & 0x0F), - ExtendedTestMinutes = (ushort)((pageResponse[10] << 8) + pageResponse[11]), - POA_SUP = (pageResponse[12] & 0x80) == 0x80, - HRA_SUP = (pageResponse[12] & 0x40) == 0x40, - VSA_SUP = (pageResponse[12] & 0x20) == 0x20, - MaximumSenseLength = pageResponse[13] + PageLength = (byte)(pageResponse[3] + 4), + ActivateMicrocode = (byte)((pageResponse[4] & 0xC0) >> 6), + SPT = (byte)((pageResponse[4] & 0x38) >> 3), + GRD_CHK = (pageResponse[4] & 0x04) == 0x04, + APP_CHK = (pageResponse[4] & 0x02) == 0x02, + REF_CHK = (pageResponse[4] & 0x01) == 0x01, + UASK_SUP = (pageResponse[5] & 0x20) == 0x20, + GROUP_SUP = (pageResponse[5] & 0x10) == 0x10, + PRIOR_SUP = (pageResponse[5] & 0x08) == 0x08, + HEADSUP = (pageResponse[5] & 0x04) == 0x04, + ORDSUP = (pageResponse[5] & 0x02) == 0x02, + SIMPSUP = (pageResponse[5] & 0x01) == 0x01, + WU_SUP = (pageResponse[6] & 0x08) == 0x08, + CRD_SUP = (pageResponse[6] & 0x04) == 0x04, + NV_SUP = (pageResponse[6] & 0x02) == 0x02, + V_SUP = (pageResponse[6] & 0x01) == 0x01, + NO_PI_CHK = (pageResponse[7] & 0x20) == 0x20, + P_I_I_SUP = (pageResponse[7] & 0x10) == 0x10, + LUICLR = (pageResponse[7] & 0x01) == 0x01, + R_SUP = (pageResponse[8] & 0x10) == 0x10, + HSSRELEF = (pageResponse[8] & 0x02) == 0x02, + CBCS = (pageResponse[8] & 0x01) == 0x01, + Nexus = (byte)(pageResponse[9] & 0x0F), + ExtendedTestMinutes = (ushort)((pageResponse[10] << 8) + pageResponse[11]), + POA_SUP = (pageResponse[12] & 0x80) == 0x80, + HRA_SUP = (pageResponse[12] & 0x40) == 0x40, + VSA_SUP = (pageResponse[12] & 0x20) == 0x20, + MaximumSenseLength = pageResponse[13] }; } @@ -1225,8 +1225,8 @@ namespace DiscImageChef.Decoders.SCSI { if(!modePage.HasValue) return null; - Page_86 page = modePage.Value; - StringBuilder sb = new StringBuilder(); + Page_86 page = modePage.Value; + StringBuilder sb = new StringBuilder(); sb.AppendLine("SCSI Extended INQUIRY Data:"); @@ -1364,20 +1364,20 @@ namespace DiscImageChef.Decoders.SCSI Page_89 decoded = new Page_89 { - PeripheralQualifier = (PeripheralQualifiers)((pageResponse[0] & 0xE0) >> 5), - PeripheralDeviceType = (PeripheralDeviceTypes)(pageResponse[0] & 0x1F), - PageLength = (ushort)((pageResponse[2] << 8) + pageResponse[3] + 4), - VendorIdentification = new byte[8], + PeripheralQualifier = (PeripheralQualifiers)((pageResponse[0] & 0xE0) >> 5), + PeripheralDeviceType = (PeripheralDeviceTypes)(pageResponse[0] & 0x1F), + PageLength = (ushort)((pageResponse[2] << 8) + pageResponse[3] + 4), + VendorIdentification = new byte[8], ProductIdentification = new byte[16], - ProductRevisionLevel = new byte[4], - Signature = new byte[20], - IdentifyData = new byte[512] + ProductRevisionLevel = new byte[4], + Signature = new byte[20], + IdentifyData = new byte[512] }; - Array.Copy(pageResponse, 8, decoded.VendorIdentification, 0, 8); + Array.Copy(pageResponse, 8, decoded.VendorIdentification, 0, 8); Array.Copy(pageResponse, 8, decoded.ProductIdentification, 0, 16); - Array.Copy(pageResponse, 8, decoded.ProductRevisionLevel, 0, 4); - Array.Copy(pageResponse, 8, decoded.Signature, 0, 20); + Array.Copy(pageResponse, 8, decoded.ProductRevisionLevel, 0, 4); + Array.Copy(pageResponse, 8, decoded.Signature, 0, 20); decoded.CommandCode = pageResponse[56]; Array.Copy(pageResponse, 8, decoded.IdentifyData, 0, 512); @@ -1394,8 +1394,8 @@ namespace DiscImageChef.Decoders.SCSI { if(!modePage.HasValue) return null; - Page_89 page = modePage.Value; - StringBuilder sb = new StringBuilder(); + Page_89 page = modePage.Value; + StringBuilder sb = new StringBuilder(); sb.AppendLine("SCSI to ATA Translation Layer Data:"); @@ -1418,6 +1418,7 @@ namespace DiscImageChef.Decoders.SCSI sb.AppendFormat("\tDevice responded to ATA command {0:X2}h", page.CommandCode).AppendLine(); break; } + switch(page.Signature[0]) { case 0x00: @@ -1494,11 +1495,11 @@ namespace DiscImageChef.Decoders.SCSI Page_C0_Quantum decoded = new Page_C0_Quantum { - PeripheralQualifier = (PeripheralQualifiers)((pageResponse[0] & 0xE0) >> 5), - PeripheralDeviceType = (PeripheralDeviceTypes)(pageResponse[0] & 0x1F), - PageLength = (byte)(pageResponse[3] + 4), + PeripheralQualifier = (PeripheralQualifiers)((pageResponse[0] & 0xE0) >> 5), + PeripheralDeviceType = (PeripheralDeviceTypes)(pageResponse[0] & 0x1F), + PageLength = (byte)(pageResponse[3] + 4), ServoFirmwareChecksum = (ushort)((pageResponse[4] << 8) + pageResponse[5]), - ServoEEPROMChecksum = (ushort)((pageResponse[6] << 8) + pageResponse[7]), + ServoEEPROMChecksum = (ushort)((pageResponse[6] << 8) + pageResponse[7]), ReadWriteFirmwareChecksum = (uint)((pageResponse[8] << 24) + (pageResponse[9] << 16) + (pageResponse[10] << 8) + pageResponse[11]), @@ -1520,7 +1521,7 @@ namespace DiscImageChef.Decoders.SCSI if(!modePage.HasValue) return null; Page_C0_Quantum page = modePage.Value; - StringBuilder sb = new StringBuilder(); + StringBuilder sb = new StringBuilder(); sb.AppendLine("Quantum Firmware Build Information page:"); @@ -1575,19 +1576,19 @@ namespace DiscImageChef.Decoders.SCSI Page_C0_C1_Certance decoded = new Page_C0_C1_Certance { - PeripheralQualifier = (PeripheralQualifiers)((pageResponse[0] & 0xE0) >> 5), + PeripheralQualifier = (PeripheralQualifiers)((pageResponse[0] & 0xE0) >> 5), PeripheralDeviceType = (PeripheralDeviceTypes)(pageResponse[0] & 0x1F), - PageLength = (byte)(pageResponse[3] + 4), - Component = new byte[26], - Version = new byte[19], - Date = new byte[24], - Variant = new byte[23] + PageLength = (byte)(pageResponse[3] + 4), + Component = new byte[26], + Version = new byte[19], + Date = new byte[24], + Variant = new byte[23] }; - Array.Copy(pageResponse, 4, decoded.Component, 0, 26); - Array.Copy(pageResponse, 30, decoded.Version, 0, 19); - Array.Copy(pageResponse, 49, decoded.Date, 0, 24); - Array.Copy(pageResponse, 73, decoded.Variant, 0, 23); + Array.Copy(pageResponse, 4, decoded.Component, 0, 26); + Array.Copy(pageResponse, 30, decoded.Version, 0, 19); + Array.Copy(pageResponse, 49, decoded.Date, 0, 24); + Array.Copy(pageResponse, 73, decoded.Variant, 0, 23); return decoded; } @@ -1602,7 +1603,7 @@ namespace DiscImageChef.Decoders.SCSI if(!modePage.HasValue) return null; Page_C0_C1_Certance page = modePage.Value; - StringBuilder sb = new StringBuilder(); + StringBuilder sb = new StringBuilder(); sb.AppendLine("Certance Drive Component Revision Levels page:"); @@ -1654,10 +1655,10 @@ namespace DiscImageChef.Decoders.SCSI Page_C2_C3_C4_C5_C6_Certance decoded = new Page_C2_C3_C4_C5_C6_Certance { - PeripheralQualifier = (PeripheralQualifiers)((pageResponse[0] & 0xE0) >> 5), + PeripheralQualifier = (PeripheralQualifiers)((pageResponse[0] & 0xE0) >> 5), PeripheralDeviceType = (PeripheralDeviceTypes)(pageResponse[0] & 0x1F), - PageLength = (byte)(pageResponse[3] + 4), - SerialNumber = new byte[12] + PageLength = (byte)(pageResponse[3] + 4), + SerialNumber = new byte[12] }; Array.Copy(pageResponse, 4, decoded.SerialNumber, 0, 12); @@ -1675,7 +1676,7 @@ namespace DiscImageChef.Decoders.SCSI if(!modePage.HasValue) return null; Page_C2_C3_C4_C5_C6_Certance page = modePage.Value; - StringBuilder sb = new StringBuilder(); + StringBuilder sb = new StringBuilder(); sb.AppendLine("Certance Drive Component Serial Number page:"); @@ -1806,22 +1807,22 @@ namespace DiscImageChef.Decoders.SCSI Page_DF_Certance decoded = new Page_DF_Certance { - PeripheralQualifier = (PeripheralQualifiers)((pageResponse[0] & 0xE0) >> 5), + PeripheralQualifier = (PeripheralQualifiers)((pageResponse[0] & 0xE0) >> 5), PeripheralDeviceType = (PeripheralDeviceTypes)(pageResponse[0] & 0x1F), - PageLength = (byte)(pageResponse[3] + 4), - CmdFwd = (byte)((pageResponse[5] & 0xC0) >> 5), - Alerts = (pageResponse[5] & 0x20) == 0x20, - NoRemov = (pageResponse[5] & 0x08) == 0x08, - UnitRsvd = (pageResponse[5] & 0x04) == 0x04, - Clean = (pageResponse[5] & 0x01) == 0x01, - Threaded = (pageResponse[6] & 0x10) == 0x10, - Lun1Cmd = (pageResponse[6] & 0x08) == 0x08, - AutoloadMode = (byte)(pageResponse[6] & 0x07), - CartridgeType = pageResponse[8], - CartridgeFormat = pageResponse[9], - CartridgeCapacity = (ushort)((pageResponse[10] << 8) + pageResponse[11] + 4), - PortATransportType = pageResponse[12], - PortASelectionID = pageResponse[15], + PageLength = (byte)(pageResponse[3] + 4), + CmdFwd = (byte)((pageResponse[5] & 0xC0) >> 5), + Alerts = (pageResponse[5] & 0x20) == 0x20, + NoRemov = (pageResponse[5] & 0x08) == 0x08, + UnitRsvd = (pageResponse[5] & 0x04) == 0x04, + Clean = (pageResponse[5] & 0x01) == 0x01, + Threaded = (pageResponse[6] & 0x10) == 0x10, + Lun1Cmd = (pageResponse[6] & 0x08) == 0x08, + AutoloadMode = (byte)(pageResponse[6] & 0x07), + CartridgeType = pageResponse[8], + CartridgeFormat = pageResponse[9], + CartridgeCapacity = (ushort)((pageResponse[10] << 8) + pageResponse[11] + 4), + PortATransportType = pageResponse[12], + PortASelectionID = pageResponse[15], OperatingHours = (uint)((pageResponse[20] << 24) + (pageResponse[21] << 16) + (pageResponse[22] << 8) + pageResponse[23]), @@ -1846,7 +1847,7 @@ namespace DiscImageChef.Decoders.SCSI if(!modePage.HasValue) return null; Page_DF_Certance page = modePage.Value; - StringBuilder sb = new StringBuilder(); + StringBuilder sb = new StringBuilder(); sb.AppendLine("Certance drive status page:"); @@ -1999,15 +2000,15 @@ namespace DiscImageChef.Decoders.SCSI Page_C0_IBM decoded = new Page_C0_IBM { - PeripheralQualifier = (PeripheralQualifiers)((pageResponse[0] & 0xE0) >> 5), + PeripheralQualifier = (PeripheralQualifiers)((pageResponse[0] & 0xE0) >> 5), PeripheralDeviceType = (PeripheralDeviceTypes)(pageResponse[0] & 0x1F), - PageLength = (byte)(pageResponse[3] + 4), - CodeName = new byte[12], - Date = new byte[8] + PageLength = (byte)(pageResponse[3] + 4), + CodeName = new byte[12], + Date = new byte[8] }; - Array.Copy(pageResponse, 4, decoded.CodeName, 0, 12); - Array.Copy(pageResponse, 23, decoded.Date, 0, 8); + Array.Copy(pageResponse, 4, decoded.CodeName, 0, 12); + Array.Copy(pageResponse, 23, decoded.Date, 0, 8); return decoded; } @@ -2021,8 +2022,8 @@ namespace DiscImageChef.Decoders.SCSI { if(!modePage.HasValue) return null; - Page_C0_IBM page = modePage.Value; - StringBuilder sb = new StringBuilder(); + Page_C0_IBM page = modePage.Value; + StringBuilder sb = new StringBuilder(); sb.AppendLine("IBM Drive Component Revision Levels page:"); @@ -2070,15 +2071,15 @@ namespace DiscImageChef.Decoders.SCSI Page_C1_IBM decoded = new Page_C1_IBM { - PeripheralQualifier = (PeripheralQualifiers)((pageResponse[0] & 0xE0) >> 5), + PeripheralQualifier = (PeripheralQualifiers)((pageResponse[0] & 0xE0) >> 5), PeripheralDeviceType = (PeripheralDeviceTypes)(pageResponse[0] & 0x1F), - PageLength = (byte)(pageResponse[3] + 4), - ManufacturingSerial = new byte[12], - ReportedSerial = new byte[12] + PageLength = (byte)(pageResponse[3] + 4), + ManufacturingSerial = new byte[12], + ReportedSerial = new byte[12] }; - Array.Copy(pageResponse, 4, decoded.ManufacturingSerial, 0, 12); - Array.Copy(pageResponse, 16, decoded.ReportedSerial, 0, 12); + Array.Copy(pageResponse, 4, decoded.ManufacturingSerial, 0, 12); + Array.Copy(pageResponse, 16, decoded.ReportedSerial, 0, 12); return decoded; } @@ -2092,8 +2093,8 @@ namespace DiscImageChef.Decoders.SCSI { if(!modePage.HasValue) return null; - Page_C1_IBM page = modePage.Value; - StringBuilder sb = new StringBuilder(); + Page_C1_IBM page = modePage.Value; + StringBuilder sb = new StringBuilder(); sb.AppendLine("IBM Drive Serial Numbers page:"); @@ -2143,11 +2144,11 @@ namespace DiscImageChef.Decoders.SCSI Page_B0 decoded = new Page_B0 { - PeripheralQualifier = (PeripheralQualifiers)((pageResponse[0] & 0xE0) >> 5), + PeripheralQualifier = (PeripheralQualifiers)((pageResponse[0] & 0xE0) >> 5), PeripheralDeviceType = (PeripheralDeviceTypes)(pageResponse[0] & 0x1F), - PageLength = (ushort)((pageResponse[2] << 8) + pageResponse[3] + 4), - TSMC = (pageResponse[4] & 0x02) == 0x02, - WORM = (pageResponse[4] & 0x01) == 0x01 + PageLength = (ushort)((pageResponse[2] << 8) + pageResponse[3] + 4), + TSMC = (pageResponse[4] & 0x02) == 0x02, + WORM = (pageResponse[4] & 0x01) == 0x01 }; return decoded; @@ -2162,8 +2163,8 @@ namespace DiscImageChef.Decoders.SCSI { if(!modePage.HasValue) return null; - Page_B0 page = modePage.Value; - StringBuilder sb = new StringBuilder(); + Page_B0 page = modePage.Value; + StringBuilder sb = new StringBuilder(); sb.AppendLine("SCSI Sequential-access Device Capabilities:"); @@ -2226,8 +2227,8 @@ namespace DiscImageChef.Decoders.SCSI if(page.Length != page[3] + 4) return null; - byte[] element = new byte[page.Length - 4]; - StringBuilder sb = new StringBuilder(); + byte[] element = new byte[page.Length - 4]; + StringBuilder sb = new StringBuilder(); foreach(byte b in element) sb.AppendFormat("{0:X2}", b); return sb.ToString(); @@ -2275,23 +2276,23 @@ namespace DiscImageChef.Decoders.SCSI Page_C0_to_C5_HP decoded = new Page_C0_to_C5_HP { - PeripheralQualifier = (PeripheralQualifiers)((pageResponse[0] & 0xE0) >> 5), + PeripheralQualifier = (PeripheralQualifiers)((pageResponse[0] & 0xE0) >> 5), PeripheralDeviceType = (PeripheralDeviceTypes)(pageResponse[0] & 0x1F), - PageLength = (byte)(pageResponse[3] + 4), - PageCode = pageResponse[1] + PageLength = (byte)(pageResponse[3] + 4), + PageCode = pageResponse[1] }; if(pageResponse[3] == 92 && pageResponse.Length >= 96) { decoded.Component = new byte[26]; - decoded.Version = new byte[19]; - decoded.Date = new byte[24]; - decoded.Variant = new byte[23]; + decoded.Version = new byte[19]; + decoded.Date = new byte[24]; + decoded.Variant = new byte[23]; - Array.Copy(pageResponse, 4, decoded.Component, 0, 26); - Array.Copy(pageResponse, 30, decoded.Version, 0, 19); - Array.Copy(pageResponse, 49, decoded.Date, 0, 24); - Array.Copy(pageResponse, 73, decoded.Variant, 0, 23); + Array.Copy(pageResponse, 4, decoded.Component, 0, 26); + Array.Copy(pageResponse, 30, decoded.Version, 0, 19); + Array.Copy(pageResponse, 49, decoded.Date, 0, 24); + Array.Copy(pageResponse, 73, decoded.Variant, 0, 23); return decoded; } @@ -2301,38 +2302,39 @@ namespace DiscImageChef.Decoders.SCSI List array = new List(); const string fwRegExStr = @"Firmware Rev\s+=\s+(?\d+\.\d+)\s+Build date\s+=\s+(?(\w|\d|\s*.)*)\s*$"; - const string fwcRegExStr = @"FW_CONF\s+=\s+(?0x[0-9A-Fa-f]{8})\s*$"; + const string fwcRegExStr = @"FW_CONF\s+=\s+(?0x[0-9A-Fa-f]{8})\s*$"; const string servoRegExStr = @"Servo\s+Rev\s+=\s+(?\d+\.\d+)\s*$"; - Regex fwRegEx = new Regex(fwRegExStr); - Regex fwcRegEx = new Regex(fwcRegExStr); - Regex servoRegEx = new Regex(servoRegExStr); + Regex fwRegEx = new Regex(fwRegExStr); + Regex fwcRegEx = new Regex(fwcRegExStr); + Regex servoRegEx = new Regex(servoRegExStr); for(int pos = 5; pos < pageResponse.Length; pos++) if(pageResponse[pos] == 0x00) { - string str = StringHandlers.CToString(array.ToArray()); - Match fwMatch = fwRegEx.Match(str); - Match fwcMatch = fwcRegEx.Match(str); - Match servoMatch = servoRegEx.Match(str); + string str = StringHandlers.CToString(array.ToArray()); + Match fwMatch = fwRegEx.Match(str); + Match fwcMatch = fwcRegEx.Match(str); + Match servoMatch = servoRegEx.Match(str); if(str.ToLowerInvariant().StartsWith("copyright", StringComparison.Ordinal)) decoded.Copyright = Encoding.ASCII.GetBytes(str); else if(fwMatch.Success) { decoded.Component = Encoding.ASCII.GetBytes("Firmware"); - decoded.Version = Encoding.ASCII.GetBytes(fwMatch.Groups["fw"].Value); - decoded.Date = Encoding.ASCII.GetBytes(fwMatch.Groups["date"].Value); + decoded.Version = Encoding.ASCII.GetBytes(fwMatch.Groups["fw"].Value); + decoded.Date = Encoding.ASCII.GetBytes(fwMatch.Groups["date"].Value); } else if(fwcMatch.Success) decoded.Variant = Encoding.ASCII.GetBytes(fwMatch.Groups["value"].Value); else if(servoMatch.Success) { decoded.Component = Encoding.ASCII.GetBytes("Servo"); - decoded.Version = Encoding.ASCII.GetBytes(servoMatch.Groups["version"].Value); + decoded.Version = Encoding.ASCII.GetBytes(servoMatch.Groups["version"].Value); } array = new List(); } - else array.Add(pageResponse[pos]); + else + array.Add(pageResponse[pos]); return decoded; } @@ -2347,7 +2349,7 @@ namespace DiscImageChef.Decoders.SCSI if(!modePage.HasValue) return null; Page_C0_to_C5_HP page = modePage.Value; - StringBuilder sb = new StringBuilder(); + StringBuilder sb = new StringBuilder(); switch(page.PageCode) { @@ -2424,18 +2426,18 @@ namespace DiscImageChef.Decoders.SCSI Page_C0_Seagate decoded = new Page_C0_Seagate { - PeripheralQualifier = (PeripheralQualifiers)((pageResponse[0] & 0xE0) >> 5), + PeripheralQualifier = (PeripheralQualifiers)((pageResponse[0] & 0xE0) >> 5), PeripheralDeviceType = (PeripheralDeviceTypes)(pageResponse[0] & 0x1F), - PageLength = (byte)(pageResponse[3] + 4), - PageCode = pageResponse[1], - ControllerFirmware = new byte[4], - BootFirmware = new byte[4], - ServoFirmware = new byte[4] + PageLength = (byte)(pageResponse[3] + 4), + PageCode = pageResponse[1], + ControllerFirmware = new byte[4], + BootFirmware = new byte[4], + ServoFirmware = new byte[4] }; - Array.Copy(pageResponse, 4, decoded.ControllerFirmware, 0, 4); - Array.Copy(pageResponse, 8, decoded.BootFirmware, 0, 4); - Array.Copy(pageResponse, 12, decoded.ServoFirmware, 0, 4); + Array.Copy(pageResponse, 4, decoded.ControllerFirmware, 0, 4); + Array.Copy(pageResponse, 8, decoded.BootFirmware, 0, 4); + Array.Copy(pageResponse, 12, decoded.ServoFirmware, 0, 4); return decoded; } @@ -2450,7 +2452,7 @@ namespace DiscImageChef.Decoders.SCSI if(!modePage.HasValue) return null; Page_C0_Seagate page = modePage.Value; - StringBuilder sb = new StringBuilder(); + StringBuilder sb = new StringBuilder(); sb.AppendLine("Seagate Firmware Numbers page:"); diff --git a/DiscImageChef.Decoders/SCSI/Inquiry.cs b/DiscImageChef.Decoders/SCSI/Inquiry.cs index be526ae1f..a70d28ac8 100644 --- a/DiscImageChef.Decoders/SCSI/Inquiry.cs +++ b/DiscImageChef.Decoders/SCSI/Inquiry.cs @@ -79,88 +79,99 @@ namespace DiscImageChef.Decoders.SCSI if(SCSIInquiryResponse.Length >= 1) { - decoded.PeripheralQualifier = (byte)((SCSIInquiryResponse[0] & 0xE0) >> 5); + decoded.PeripheralQualifier = (byte)((SCSIInquiryResponse[0] & 0xE0) >> 5); decoded.PeripheralDeviceType = (byte)(SCSIInquiryResponse[0] & 0x1F); } + if(SCSIInquiryResponse.Length >= 2) { - decoded.RMB = Convert.ToBoolean(SCSIInquiryResponse[1] & 0x80); + decoded.RMB = Convert.ToBoolean(SCSIInquiryResponse[1] & 0x80); decoded.DeviceTypeModifier = (byte)(SCSIInquiryResponse[1] & 0x7F); } + if(SCSIInquiryResponse.Length >= 3) { - decoded.ISOVersion = (byte)((SCSIInquiryResponse[2] & 0xC0) >> 6); + decoded.ISOVersion = (byte)((SCSIInquiryResponse[2] & 0xC0) >> 6); decoded.ECMAVersion = (byte)((SCSIInquiryResponse[2] & 0x38) >> 3); decoded.ANSIVersion = (byte)(SCSIInquiryResponse[2] & 0x07); } + if(SCSIInquiryResponse.Length >= 4) { - decoded.AERC = Convert.ToBoolean(SCSIInquiryResponse[3] & 0x80); - decoded.TrmTsk = Convert.ToBoolean(SCSIInquiryResponse[3] & 0x40); - decoded.NormACA = Convert.ToBoolean(SCSIInquiryResponse[3] & 0x20); - decoded.HiSup = Convert.ToBoolean(SCSIInquiryResponse[3] & 0x10); + decoded.AERC = Convert.ToBoolean(SCSIInquiryResponse[3] & 0x80); + decoded.TrmTsk = Convert.ToBoolean(SCSIInquiryResponse[3] & 0x40); + decoded.NormACA = Convert.ToBoolean(SCSIInquiryResponse[3] & 0x20); + decoded.HiSup = Convert.ToBoolean(SCSIInquiryResponse[3] & 0x10); decoded.ResponseDataFormat = (byte)(SCSIInquiryResponse[3] & 0x07); } + if(SCSIInquiryResponse.Length >= 5) decoded.AdditionalLength = SCSIInquiryResponse[4]; if(SCSIInquiryResponse.Length >= 6) { - decoded.SCCS = Convert.ToBoolean(SCSIInquiryResponse[5] & 0x80); - decoded.ACC = Convert.ToBoolean(SCSIInquiryResponse[5] & 0x40); - decoded.TPGS = (byte)((SCSIInquiryResponse[5] & 0x30) >> 4); - decoded.ThreePC = Convert.ToBoolean(SCSIInquiryResponse[5] & 0x08); + decoded.SCCS = Convert.ToBoolean(SCSIInquiryResponse[5] & 0x80); + decoded.ACC = Convert.ToBoolean(SCSIInquiryResponse[5] & 0x40); + decoded.TPGS = (byte)((SCSIInquiryResponse[5] & 0x30) >> 4); + decoded.ThreePC = Convert.ToBoolean(SCSIInquiryResponse[5] & 0x08); decoded.Reserved2 = (byte)((SCSIInquiryResponse[5] & 0x06) >> 1); - decoded.Protect = Convert.ToBoolean(SCSIInquiryResponse[5] & 0x01); + decoded.Protect = Convert.ToBoolean(SCSIInquiryResponse[5] & 0x01); } + if(SCSIInquiryResponse.Length >= 7) { - decoded.BQue = Convert.ToBoolean(SCSIInquiryResponse[6] & 0x80); + decoded.BQue = Convert.ToBoolean(SCSIInquiryResponse[6] & 0x80); decoded.EncServ = Convert.ToBoolean(SCSIInquiryResponse[6] & 0x40); - decoded.VS1 = Convert.ToBoolean(SCSIInquiryResponse[6] & 0x20); - decoded.MultiP = Convert.ToBoolean(SCSIInquiryResponse[6] & 0x10); - decoded.MChngr = Convert.ToBoolean(SCSIInquiryResponse[6] & 0x08); + decoded.VS1 = Convert.ToBoolean(SCSIInquiryResponse[6] & 0x20); + decoded.MultiP = Convert.ToBoolean(SCSIInquiryResponse[6] & 0x10); + decoded.MChngr = Convert.ToBoolean(SCSIInquiryResponse[6] & 0x08); decoded.ACKREQQ = Convert.ToBoolean(SCSIInquiryResponse[6] & 0x04); - decoded.Addr32 = Convert.ToBoolean(SCSIInquiryResponse[6] & 0x02); - decoded.Addr16 = Convert.ToBoolean(SCSIInquiryResponse[6] & 0x01); + decoded.Addr32 = Convert.ToBoolean(SCSIInquiryResponse[6] & 0x02); + decoded.Addr16 = Convert.ToBoolean(SCSIInquiryResponse[6] & 0x01); } + if(SCSIInquiryResponse.Length >= 8) { decoded.RelAddr = Convert.ToBoolean(SCSIInquiryResponse[7] & 0x80); - decoded.WBus32 = Convert.ToBoolean(SCSIInquiryResponse[7] & 0x40); - decoded.WBus16 = Convert.ToBoolean(SCSIInquiryResponse[7] & 0x20); - decoded.Sync = Convert.ToBoolean(SCSIInquiryResponse[7] & 0x10); - decoded.Linked = Convert.ToBoolean(SCSIInquiryResponse[7] & 0x08); + decoded.WBus32 = Convert.ToBoolean(SCSIInquiryResponse[7] & 0x40); + decoded.WBus16 = Convert.ToBoolean(SCSIInquiryResponse[7] & 0x20); + decoded.Sync = Convert.ToBoolean(SCSIInquiryResponse[7] & 0x10); + decoded.Linked = Convert.ToBoolean(SCSIInquiryResponse[7] & 0x08); decoded.TranDis = Convert.ToBoolean(SCSIInquiryResponse[7] & 0x04); - decoded.CmdQue = Convert.ToBoolean(SCSIInquiryResponse[7] & 0x02); - decoded.SftRe = Convert.ToBoolean(SCSIInquiryResponse[7] & 0x01); + decoded.CmdQue = Convert.ToBoolean(SCSIInquiryResponse[7] & 0x02); + decoded.SftRe = Convert.ToBoolean(SCSIInquiryResponse[7] & 0x01); } + if(SCSIInquiryResponse.Length >= 16) { decoded.VendorIdentification = new byte[8]; Array.Copy(SCSIInquiryResponse, 8, decoded.VendorIdentification, 0, 8); } + if(SCSIInquiryResponse.Length >= 32) { decoded.ProductIdentification = new byte[16]; Array.Copy(SCSIInquiryResponse, 16, decoded.ProductIdentification, 0, 16); } + if(SCSIInquiryResponse.Length >= 36) { decoded.ProductRevisionLevel = new byte[4]; Array.Copy(SCSIInquiryResponse, 32, decoded.ProductRevisionLevel, 0, 4); } + if(SCSIInquiryResponse.Length >= 44) { // Seagate 1 - decoded.SeagatePresent = true; + decoded.SeagatePresent = true; decoded.Seagate_DriveSerialNumber = new byte[8]; Array.Copy(SCSIInquiryResponse, 36, decoded.Seagate_DriveSerialNumber, 0, 8); } + if(SCSIInquiryResponse.Length >= 46) { // Kreon decoded.KreonIdentifier = new byte[5]; Array.Copy(SCSIInquiryResponse, 36, decoded.KreonIdentifier, 0, 5); - decoded.KreonSpace = SCSIInquiryResponse[41]; + decoded.KreonSpace = SCSIInquiryResponse[41]; decoded.KreonVersion = new byte[5]; Array.Copy(SCSIInquiryResponse, 42, decoded.KreonVersion, 0, 5); @@ -168,63 +179,66 @@ namespace DiscImageChef.Decoders.SCSI decoded.KreonIdentifier.SequenceEqual(new byte[] {0x4B, 0x52, 0x45, 0x4F, 0x4E})) decoded.KreonPresent = true; } + if(SCSIInquiryResponse.Length >= 49) { // HP - decoded.HPPresent = true; - decoded.HP_WORM |= (SCSIInquiryResponse[40] & 0x01) == 0x01; - decoded.HP_WORMVersion = (byte)((SCSIInquiryResponse[40] & 0x7F) >> 1); - decoded.HP_OBDR = new byte[6]; + decoded.HPPresent = true; + decoded.HP_WORM |= (SCSIInquiryResponse[40] & 0x01) == 0x01; + decoded.HP_WORMVersion = (byte)((SCSIInquiryResponse[40] & 0x7F) >> 1); + decoded.HP_OBDR = new byte[6]; Array.Copy(SCSIInquiryResponse, 43, decoded.HP_OBDR, 0, 6); } + if(SCSIInquiryResponse.Length >= 56) { decoded.VendorSpecific = new byte[20]; Array.Copy(SCSIInquiryResponse, 36, decoded.VendorSpecific, 0, 20); // Quantum - decoded.QuantumPresent = true; - decoded.Qt_ProductFamily = (byte)((SCSIInquiryResponse[36] & 0xF0) >> 4); - decoded.Qt_ReleasedFirmware = (byte)(SCSIInquiryResponse[36] & 0x0F); - decoded.Qt_FirmwareMajorVersion = SCSIInquiryResponse[37]; - decoded.Qt_FirmwareMinorVersion = SCSIInquiryResponse[38]; - decoded.Qt_EEPROMFormatMajorVersion = SCSIInquiryResponse[39]; - decoded.Qt_EEPROMFormatMinorVersion = SCSIInquiryResponse[40]; - decoded.Qt_FirmwarePersonality = SCSIInquiryResponse[41]; - decoded.Qt_FirmwareSubPersonality = SCSIInquiryResponse[42]; - decoded.Qt_TapeDirectoryFormatVersion = SCSIInquiryResponse[43]; - decoded.Qt_ControllerHardwareVersion = SCSIInquiryResponse[44]; - decoded.Qt_DriveEEPROMVersion = SCSIInquiryResponse[45]; - decoded.Qt_DriveHardwareVersion = SCSIInquiryResponse[46]; - decoded.Qt_MediaLoaderFirmwareVersion = SCSIInquiryResponse[47]; - decoded.Qt_MediaLoaderHardwareVersion = SCSIInquiryResponse[48]; + decoded.QuantumPresent = true; + decoded.Qt_ProductFamily = (byte)((SCSIInquiryResponse[36] & 0xF0) >> 4); + decoded.Qt_ReleasedFirmware = (byte)(SCSIInquiryResponse[36] & 0x0F); + decoded.Qt_FirmwareMajorVersion = SCSIInquiryResponse[37]; + decoded.Qt_FirmwareMinorVersion = SCSIInquiryResponse[38]; + decoded.Qt_EEPROMFormatMajorVersion = SCSIInquiryResponse[39]; + decoded.Qt_EEPROMFormatMinorVersion = SCSIInquiryResponse[40]; + decoded.Qt_FirmwarePersonality = SCSIInquiryResponse[41]; + decoded.Qt_FirmwareSubPersonality = SCSIInquiryResponse[42]; + decoded.Qt_TapeDirectoryFormatVersion = SCSIInquiryResponse[43]; + decoded.Qt_ControllerHardwareVersion = SCSIInquiryResponse[44]; + decoded.Qt_DriveEEPROMVersion = SCSIInquiryResponse[45]; + decoded.Qt_DriveHardwareVersion = SCSIInquiryResponse[46]; + decoded.Qt_MediaLoaderFirmwareVersion = SCSIInquiryResponse[47]; + decoded.Qt_MediaLoaderHardwareVersion = SCSIInquiryResponse[48]; decoded.Qt_MediaLoaderMechanicalVersion = SCSIInquiryResponse[49]; - decoded.Qt_MediaLoaderPresent = SCSIInquiryResponse[50] > 0; - decoded.Qt_LibraryPresent = SCSIInquiryResponse[51] > 0; - decoded.Qt_ModuleRevision = new byte[4]; + decoded.Qt_MediaLoaderPresent = SCSIInquiryResponse[50] > 0; + decoded.Qt_LibraryPresent = SCSIInquiryResponse[51] > 0; + decoded.Qt_ModuleRevision = new byte[4]; Array.Copy(SCSIInquiryResponse, 52, decoded.Qt_ModuleRevision, 0, 4); // IBM - decoded.IBMPresent = true; - decoded.IBM_AutDis |= (SCSIInquiryResponse[36] & 0x01) == 0x01; - decoded.IBM_PerformanceLimit = SCSIInquiryResponse[37]; - decoded.IBM_OEMSpecific = SCSIInquiryResponse[41]; + decoded.IBMPresent = true; + decoded.IBM_AutDis |= (SCSIInquiryResponse[36] & 0x01) == 0x01; + decoded.IBM_PerformanceLimit = SCSIInquiryResponse[37]; + decoded.IBM_OEMSpecific = SCSIInquiryResponse[41]; } if(SCSIInquiryResponse.Length >= 57) { decoded.Reserved3 = (byte)((SCSIInquiryResponse[56] & 0xF0) >> 4); - decoded.Clocking = (byte)((SCSIInquiryResponse[56] & 0x0C) >> 2); - decoded.QAS = Convert.ToBoolean(SCSIInquiryResponse[56] & 0x02); - decoded.IUS = Convert.ToBoolean(SCSIInquiryResponse[56] & 0x01); + decoded.Clocking = (byte)((SCSIInquiryResponse[56] & 0x0C) >> 2); + 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 >= 60) { int descriptorsNo; if(SCSIInquiryResponse.Length >= 74) descriptorsNo = 8; - else descriptorsNo = (SCSIInquiryResponse.Length - 58) / 2; + else descriptorsNo = (SCSIInquiryResponse.Length - 58) / 2; decoded.VersionDescriptors = new ushort[descriptorsNo]; for(int i = 0; i < descriptorsNo; i++) @@ -236,26 +250,31 @@ namespace DiscImageChef.Decoders.SCSI decoded.Reserved5 = new byte[SCSIInquiryResponse.Length - 74]; Array.Copy(SCSIInquiryResponse, 74, decoded.Reserved5, 0, SCSIInquiryResponse.Length - 74); } + if(SCSIInquiryResponse.Length >= 96) { decoded.Reserved5 = new byte[22]; Array.Copy(SCSIInquiryResponse, 74, decoded.Reserved5, 0, 22); } + if(SCSIInquiryResponse.Length > 96) { decoded.VendorSpecific2 = new byte[SCSIInquiryResponse.Length - 96]; Array.Copy(SCSIInquiryResponse, 96, decoded.VendorSpecific2, 0, SCSIInquiryResponse.Length - 96); } + if(SCSIInquiryResponse.Length >= 144) { // Seagate 2 - decoded.Seagate2Present = true; + decoded.Seagate2Present = true; decoded.Seagate_Copyright = new byte[48]; Array.Copy(SCSIInquiryResponse, 96, decoded.Seagate_Copyright, 0, 48); } + if(SCSIInquiryResponse.Length < 148) return decoded; + // Seagate 2 - decoded.Seagate3Present = true; + decoded.Seagate3Present = true; decoded.Seagate_ServoPROMPartNo = new byte[4]; Array.Copy(SCSIInquiryResponse, 144, decoded.Seagate_ServoPROMPartNo, 0, 4); @@ -457,9 +476,9 @@ namespace DiscImageChef.Decoders.SCSI 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 DEBUG if(response.VS1) sb.AppendLine("Vendor specific bit 5 on byte 6 of INQUIRY response is set"); -#endif + #endif switch((TGPSValues)response.TPGS) { @@ -2027,7 +2046,7 @@ namespace DiscImageChef.Decoders.SCSI StringHandlers.CToString(response.KreonVersion)).AppendLine(); #endregion Kreon vendor prettifying -#if DEBUG + #if DEBUG if(response.DeviceTypeModifier != 0) sb.AppendFormat("Vendor's device type modifier = 0x{0:X2}", response.DeviceTypeModifier).AppendLine(); if(response.Reserved2 != 0) @@ -2068,7 +2087,7 @@ namespace DiscImageChef.Decoders.SCSI sb.AppendLine("============================================================"); sb.AppendLine(PrintHex.ByteArrayToHexArrayString(response.VendorSpecific2, 60)); sb.AppendLine("============================================================"); -#endif + #endif return sb.ToString(); } diff --git a/DiscImageChef.Decoders/SCSI/MMC/AACS.cs b/DiscImageChef.Decoders/SCSI/MMC/AACS.cs index d1820d7c8..b20b78b18 100644 --- a/DiscImageChef.Decoders/SCSI/MMC/AACS.cs +++ b/DiscImageChef.Decoders/SCSI/MMC/AACS.cs @@ -232,8 +232,8 @@ namespace DiscImageChef.Decoders.SCSI.MMC decoded.VolumeIdentifier = new byte[AACSVIResponse.Length - 4]; decoded.DataLength = BigEndianBitConverter.ToUInt16(AACSVIResponse, 0); - decoded.Reserved1 = AACSVIResponse[2]; - decoded.Reserved2 = AACSVIResponse[3]; + decoded.Reserved1 = AACSVIResponse[2]; + decoded.Reserved2 = AACSVIResponse[3]; Array.Copy(AACSVIResponse, 4, decoded.VolumeIdentifier, 0, AACSVIResponse.Length - 4); return decoded; @@ -247,10 +247,10 @@ namespace DiscImageChef.Decoders.SCSI.MMC StringBuilder sb = new StringBuilder(); -#if DEBUG + #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(); -#endif + #endif sb.AppendFormat("AACS Volume Identifier in hex follows:"); sb.AppendLine(PrintHex.ByteArrayToHexArrayString(response.VolumeIdentifier, 80)); @@ -274,8 +274,8 @@ namespace DiscImageChef.Decoders.SCSI.MMC decoded.MediaSerialNumber = new byte[AACSMSNResponse.Length - 4]; decoded.DataLength = BigEndianBitConverter.ToUInt16(AACSMSNResponse, 0); - decoded.Reserved1 = AACSMSNResponse[2]; - decoded.Reserved2 = AACSMSNResponse[3]; + decoded.Reserved1 = AACSMSNResponse[2]; + decoded.Reserved2 = AACSMSNResponse[3]; Array.Copy(AACSMSNResponse, 4, decoded.MediaSerialNumber, 0, AACSMSNResponse.Length - 4); return decoded; @@ -289,10 +289,10 @@ namespace DiscImageChef.Decoders.SCSI.MMC StringBuilder sb = new StringBuilder(); -#if DEBUG + #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(); -#endif + #endif sb.AppendFormat("AACS Media Serial Number in hex follows:"); sb.AppendLine(PrintHex.ByteArrayToHexArrayString(response.MediaSerialNumber, 80)); @@ -316,8 +316,8 @@ namespace DiscImageChef.Decoders.SCSI.MMC decoded.MediaIdentifier = new byte[AACSMIResponse.Length - 4]; decoded.DataLength = BigEndianBitConverter.ToUInt16(AACSMIResponse, 0); - decoded.Reserved1 = AACSMIResponse[2]; - decoded.Reserved2 = AACSMIResponse[3]; + decoded.Reserved1 = AACSMIResponse[2]; + decoded.Reserved2 = AACSMIResponse[3]; Array.Copy(AACSMIResponse, 4, decoded.MediaIdentifier, 0, AACSMIResponse.Length - 4); return decoded; @@ -331,10 +331,10 @@ namespace DiscImageChef.Decoders.SCSI.MMC StringBuilder sb = new StringBuilder(); -#if DEBUG + #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(); -#endif + #endif sb.AppendFormat("AACS Media Identifier in hex follows:"); sb.AppendLine(PrintHex.ByteArrayToHexArrayString(response.MediaIdentifier, 80)); @@ -358,7 +358,7 @@ namespace DiscImageChef.Decoders.SCSI.MMC decoded.MediaKeyBlockPacks = new byte[AACSMKBResponse.Length - 4]; decoded.DataLength = BigEndianBitConverter.ToUInt16(AACSMKBResponse, 0); - decoded.Reserved = AACSMKBResponse[2]; + decoded.Reserved = AACSMKBResponse[2]; decoded.TotalPacks = AACSMKBResponse[3]; Array.Copy(AACSMKBResponse, 4, decoded.MediaKeyBlockPacks, 0, AACSMKBResponse.Length - 4); @@ -373,9 +373,9 @@ namespace DiscImageChef.Decoders.SCSI.MMC StringBuilder sb = new StringBuilder(); -#if DEBUG + #if DEBUG if(response.Reserved != 0) sb.AppendFormat("Reserved = 0x{0:X2}", response.Reserved).AppendLine(); -#endif + #endif sb.AppendFormat("Total number of media key blocks available to transfer {0}", response.TotalPacks) .AppendLine(); sb.AppendFormat("AACS Media Key Blocks in hex follows:"); @@ -401,8 +401,8 @@ namespace DiscImageChef.Decoders.SCSI.MMC decoded.DataKeys = new byte[AACSDKResponse.Length - 4]; decoded.DataLength = BigEndianBitConverter.ToUInt16(AACSDKResponse, 0); - decoded.Reserved1 = AACSDKResponse[2]; - decoded.Reserved2 = AACSDKResponse[3]; + decoded.Reserved1 = AACSDKResponse[2]; + decoded.Reserved2 = AACSDKResponse[3]; Array.Copy(AACSDKResponse, 4, decoded.DataKeys, 0, AACSDKResponse.Length - 4); return decoded; @@ -416,10 +416,10 @@ namespace DiscImageChef.Decoders.SCSI.MMC StringBuilder sb = new StringBuilder(); -#if DEBUG + #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(); -#endif + #endif sb.AppendFormat("AACS Data Keys in hex follows:"); sb.AppendLine(PrintHex.ByteArrayToHexArrayString(response.DataKeys, 80)); @@ -440,8 +440,8 @@ namespace DiscImageChef.Decoders.SCSI.MMC BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian; - decoded.DataLength = BigEndianBitConverter.ToUInt16(AACSLBAExtsResponse, 0); - decoded.Reserved = AACSLBAExtsResponse[2]; + decoded.DataLength = BigEndianBitConverter.ToUInt16(AACSLBAExtsResponse, 0); + decoded.Reserved = AACSLBAExtsResponse[2]; decoded.MaxLBAExtents = AACSLBAExtsResponse[3]; if((AACSLBAExtsResponse.Length - 4) % 16 != 0) return decoded; @@ -452,7 +452,7 @@ namespace DiscImageChef.Decoders.SCSI.MMC { decoded.Extents[i].Reserved = new byte[8]; Array.Copy(AACSLBAExtsResponse, 0 + i * 16 + 4, decoded.Extents[i].Reserved, 0, 8); - decoded.Extents[i].StartLBA = BigEndianBitConverter.ToUInt32(AACSLBAExtsResponse, 8 + i * 16 + 4); + decoded.Extents[i].StartLBA = BigEndianBitConverter.ToUInt32(AACSLBAExtsResponse, 8 + i * 16 + 4); decoded.Extents[i].LBACount = BigEndianBitConverter.ToUInt32(AACSLBAExtsResponse, 12 + i * 16 + 4); } diff --git a/DiscImageChef.Decoders/SCSI/MMC/CPRM.cs b/DiscImageChef.Decoders/SCSI/MMC/CPRM.cs index e7b7f68d5..0d2d0d66e 100644 --- a/DiscImageChef.Decoders/SCSI/MMC/CPRM.cs +++ b/DiscImageChef.Decoders/SCSI/MMC/CPRM.cs @@ -92,7 +92,7 @@ namespace DiscImageChef.Decoders.SCSI.MMC decoded.MKBPackData = new byte[CPRMMKBResponse.Length - 4]; decoded.DataLength = BigEndianBitConverter.ToUInt16(CPRMMKBResponse, 0); - decoded.Reserved = CPRMMKBResponse[2]; + decoded.Reserved = CPRMMKBResponse[2]; decoded.TotalPacks = CPRMMKBResponse[3]; Array.Copy(CPRMMKBResponse, 4, decoded.MKBPackData, 0, CPRMMKBResponse.Length - 4); @@ -107,9 +107,9 @@ namespace DiscImageChef.Decoders.SCSI.MMC StringBuilder sb = new StringBuilder(); -#if DEBUG + #if DEBUG if(response.Reserved != 0) sb.AppendFormat("Reserved = 0x{0:X2}", response.Reserved).AppendLine(); -#endif + #endif 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:"); diff --git a/DiscImageChef.Decoders/SCSI/MMC/DiscInformation.cs b/DiscImageChef.Decoders/SCSI/MMC/DiscInformation.cs index cb2dcdd09..9cc4cf13f 100644 --- a/DiscImageChef.Decoders/SCSI/MMC/DiscInformation.cs +++ b/DiscImageChef.Decoders/SCSI/MMC/DiscInformation.cs @@ -289,22 +289,22 @@ namespace DiscImageChef.Decoders.SCSI.MMC if(decoded.DataLength + 2 != response.Length) return null; - decoded.DataType = (byte)((response[2] & 0xE0) >> 5); - decoded.Erasable |= (response[2] & 0x10) == 0x10; - decoded.LastSessionStatus = (byte)((response[2] & 0x0C) >> 2); - decoded.DiscStatus = (byte)(response[2] & 0x03); - decoded.FirstTrackNumber = response[3]; - decoded.Sessions = (ushort)((response[9] << 8) + response[4]); - decoded.FirstTrackLastSession = (ushort)((response[10] << 8) + response[5]); - decoded.LastTrackLastSession = (ushort)((response[11] << 8) + response[6]); + decoded.DataType = (byte)((response[2] & 0xE0) >> 5); + decoded.Erasable |= (response[2] & 0x10) == 0x10; + decoded.LastSessionStatus = (byte)((response[2] & 0x0C) >> 2); + decoded.DiscStatus = (byte)(response[2] & 0x03); + decoded.FirstTrackNumber = response[3]; + decoded.Sessions = (ushort)((response[9] << 8) + response[4]); + decoded.FirstTrackLastSession = (ushort)((response[10] << 8) + response[5]); + decoded.LastTrackLastSession = (ushort)((response[11] << 8) + response[6]); - decoded.DID_V |= (response[7] & 0x80) == 0x80; - decoded.DBC_V |= (response[7] & 0x40) == 0x40; - decoded.URU |= (response[7] & 0x20) == 0x20; - decoded.DAC_V |= (response[7] & 0x10) == 0x10; - decoded.Reserved |= (response[7] & 0x08) == 0x08; - decoded.Dbit |= (response[7] & 0x04) == 0x04; - decoded.BGFormatStatus = (byte)(response[7] & 0x03); + decoded.DID_V |= (response[7] & 0x80) == 0x80; + decoded.DBC_V |= (response[7] & 0x40) == 0x40; + decoded.URU |= (response[7] & 0x20) == 0x20; + decoded.DAC_V |= (response[7] & 0x10) == 0x10; + decoded.Reserved |= (response[7] & 0x08) == 0x08; + 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]); @@ -319,14 +319,14 @@ namespace DiscImageChef.Decoders.SCSI.MMC decoded.DiscBarcode = BitConverter.ToUInt64(temp, 0); decoded.DiscApplicationCode = response[32]; - decoded.OPCTablesNumber = response[33]; + decoded.OPCTablesNumber = response[33]; if(decoded.OPCTablesNumber <= 0 || response.Length != decoded.OPCTablesNumber * 8 + 34) return decoded; decoded.OPCTables = new OPCTable[decoded.OPCTablesNumber]; for(int i = 0; i < decoded.OPCTablesNumber; i++) { - decoded.OPCTables[i].Speed = (ushort)((response[34 + i * 8 + 0] << 16) + response[34 + i * 8 + 1]); + decoded.OPCTables[i].Speed = (ushort)((response[34 + i * 8 + 0] << 16) + response[34 + i * 8 + 1]); decoded.OPCTables[i].OPCValues = new byte[6]; Array.Copy(response, 34 + i * 8 + 2, decoded.OPCTables[i].OPCValues, 0, 6); } @@ -415,11 +415,12 @@ namespace DiscImageChef.Decoders.SCSI.MMC 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) + (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 & 0xFF00) >> 8, decoded.LastPossibleLeadOutStartLBA & 0xFF).AppendLine(); sb.AppendLine(decoded.URU ? "Disc is defined for unrestricted use" : "Disc is defined for restricted use"); @@ -449,11 +450,11 @@ namespace DiscImageChef.Decoders.SCSI.MMC if(decoded.DataLength + 2 != response.Length) return null; - decoded.DataType = (byte)((response[2] & 0xE0) >> 5); - decoded.MaxTracks = (ushort)((response[4] << 8) + response[5]); - decoded.AssignedTracks = (ushort)((response[6] << 8) + response[7]); - decoded.MaxAppendableTracks = (ushort)((response[8] << 8) + response[9]); - decoded.AppendableTracks = (ushort)((response[10] << 8) + response[11]); + decoded.DataType = (byte)((response[2] & 0xE0) >> 5); + decoded.MaxTracks = (ushort)((response[4] << 8) + response[5]); + decoded.AssignedTracks = (ushort)((response[6] << 8) + response[7]); + decoded.MaxAppendableTracks = (ushort)((response[8] << 8) + response[9]); + decoded.AppendableTracks = (ushort)((response[10] << 8) + response[11]); return decoded; } diff --git a/DiscImageChef.Decoders/SCSI/MMC/Enums.cs b/DiscImageChef.Decoders/SCSI/MMC/Enums.cs index 2c64d2c90..de9b25a38 100644 --- a/DiscImageChef.Decoders/SCSI/MMC/Enums.cs +++ b/DiscImageChef.Decoders/SCSI/MMC/Enums.cs @@ -38,9 +38,9 @@ namespace DiscImageChef.Decoders.SCSI.MMC [SuppressMessage("ReSharper", "MemberCanBeInternal")] public enum FormatLayerTypeCodes : ushort { - CDLayer = 0x0008, - DVDLayer = 0x0010, - BDLayer = 0x0040, + CDLayer = 0x0008, + DVDLayer = 0x0010, + BDLayer = 0x0040, HDDVDLayer = 0x0050 } @@ -48,30 +48,30 @@ namespace DiscImageChef.Decoders.SCSI.MMC [SuppressMessage("ReSharper", "MemberCanBeInternal")] public enum SessionStatusCodes : byte { - Empty = 0x00, - Incomplete = 0x01, + Empty = 0x00, + Incomplete = 0x01, ReservedOrDamaged = 0x02, - Complete = 0x03 + Complete = 0x03 } [SuppressMessage("ReSharper", "InconsistentNaming")] [SuppressMessage("ReSharper", "MemberCanBeInternal")] public enum DiscStatusCodes : byte { - Empty = 0x00, + Empty = 0x00, Incomplete = 0x01, - Finalized = 0x02, - Others = 0x03 + Finalized = 0x02, + Others = 0x03 } [SuppressMessage("ReSharper", "InconsistentNaming")] [SuppressMessage("ReSharper", "MemberCanBeInternal")] public enum BGFormatStatusCodes : byte { - NoFormattable = 0x00, + NoFormattable = 0x00, IncompleteBackgroundFormat = 0x01, BackgroundFormatInProgress = 0x02, - FormatComplete = 0x03 + FormatComplete = 0x03 } [SuppressMessage("ReSharper", "InconsistentNaming")] @@ -82,8 +82,8 @@ namespace DiscImageChef.Decoders.SCSI.MMC /// Also valid for CD-DA, DVD and BD /// CDROM = 0x00, - CDi = 0x10, - CDROMXA = 0x20, + CDi = 0x10, + 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 8011b6057..a333c7ba2 100644 --- a/DiscImageChef.Decoders/SCSI/MMC/Features.cs +++ b/DiscImageChef.Decoders/SCSI/MMC/Features.cs @@ -499,7 +499,7 @@ namespace DiscImageChef.Decoders.SCSI.MMC public struct Profile { public ProfileNumber Number; - public bool Current; + public bool Current; } /// @@ -2357,11 +2357,11 @@ namespace DiscImageChef.Decoders.SCSI.MMC Feature_0000 decoded = new Feature_0000(); - decoded.Current |= (feature[2] & 0x01) == 0x01; + decoded.Current |= (feature[2] & 0x01) == 0x01; decoded.Persistent |= (feature[2] & 0x02) == 0x02; - decoded.Version = (byte)((feature[2] & 0x3C) >> 2); + decoded.Version = (byte)((feature[2] & 0x3C) >> 2); - int offset = 4; + int offset = 4; List listProfiles = new List(); while(offset < feature.Length) { @@ -2390,9 +2390,9 @@ namespace DiscImageChef.Decoders.SCSI.MMC Feature_0001 decoded = new Feature_0001(); - decoded.Current |= (feature[2] & 0x01) == 0x01; + decoded.Current |= (feature[2] & 0x01) == 0x01; decoded.Persistent |= (feature[2] & 0x02) == 0x02; - decoded.Version = (byte)((feature[2] & 0x3C) >> 2); + decoded.Version = (byte)((feature[2] & 0x3C) >> 2); decoded.PhysicalInterfaceStandard = (PhysicalInterfaces)((feature[4] << 24) + (feature[5] << 16) + (feature[6] << 8) + feature[7]); @@ -2418,9 +2418,9 @@ namespace DiscImageChef.Decoders.SCSI.MMC Feature_0002 decoded = new Feature_0002(); - decoded.Current |= (feature[2] & 0x01) == 0x01; + decoded.Current |= (feature[2] & 0x01) == 0x01; decoded.Persistent |= (feature[2] & 0x02) == 0x02; - decoded.Version = (byte)((feature[2] & 0x3C) >> 2); + decoded.Version = (byte)((feature[2] & 0x3C) >> 2); decoded.Async |= (feature[4] & 0x01) == 0x01; @@ -2443,14 +2443,14 @@ namespace DiscImageChef.Decoders.SCSI.MMC Feature_0003 decoded = new Feature_0003(); - decoded.Current |= (feature[2] & 0x01) == 0x01; + decoded.Current |= (feature[2] & 0x01) == 0x01; decoded.Persistent |= (feature[2] & 0x02) == 0x02; - decoded.Version = (byte)((feature[2] & 0x3C) >> 2); + decoded.Version = (byte)((feature[2] & 0x3C) >> 2); - decoded.LoadingMechanismType = (byte)((feature[4] & 0xE0) >> 5); - decoded.Eject |= (feature[4] & 0x08) == 0x08; - decoded.PreventJumper |= (feature[4] & 0x04) == 0x04; - decoded.Lock |= (feature[4] & 0x01) == 0x01; + decoded.LoadingMechanismType = (byte)((feature[4] & 0xE0) >> 5); + decoded.Eject |= (feature[4] & 0x08) == 0x08; + decoded.PreventJumper |= (feature[4] & 0x04) == 0x04; + decoded.Lock |= (feature[4] & 0x01) == 0x01; if(decoded.Version < 2) return decoded; @@ -2474,11 +2474,11 @@ namespace DiscImageChef.Decoders.SCSI.MMC Feature_0004 decoded = new Feature_0004(); - decoded.Current |= (feature[2] & 0x01) == 0x01; + decoded.Current |= (feature[2] & 0x01) == 0x01; decoded.Persistent |= (feature[2] & 0x02) == 0x02; - decoded.Version = (byte)((feature[2] & 0x3C) >> 2); + decoded.Version = (byte)((feature[2] & 0x3C) >> 2); - decoded.SPWP |= (feature[4] & 0x02) == 0x02; + decoded.SPWP |= (feature[4] & 0x02) == 0x02; decoded.SSWPP |= (feature[4] & 0x01) == 0x01; if(decoded.Version >= 1) decoded.WDCB |= (feature[4] & 0x04) == 0x04; @@ -2502,12 +2502,14 @@ namespace DiscImageChef.Decoders.SCSI.MMC Feature_0010 decoded = new Feature_0010(); - decoded.Current |= (feature[2] & 0x01) == 0x01; + decoded.Current |= (feature[2] & 0x01) == 0x01; decoded.Persistent |= (feature[2] & 0x02) == 0x02; - decoded.Version = (byte)((feature[2] & 0x3C) >> 2); + decoded.Version = (byte)((feature[2] & 0x3C) >> 2); - decoded.LogicalBlockSize = (uint)((feature[4] << 24) + (feature[5] << 16) + (feature[6] << 8) + feature[7]); - decoded.Blocking = (ushort)((feature[8] << 8) + feature[9]); + 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; return decoded; @@ -2527,9 +2529,9 @@ namespace DiscImageChef.Decoders.SCSI.MMC Feature_001D decoded = new Feature_001D(); - decoded.Current |= (feature[2] & 0x01) == 0x01; + decoded.Current |= (feature[2] & 0x01) == 0x01; decoded.Persistent |= (feature[2] & 0x02) == 0x02; - decoded.Version = (byte)((feature[2] & 0x3C) >> 2); + decoded.Version = (byte)((feature[2] & 0x3C) >> 2); return decoded; } @@ -2548,13 +2550,13 @@ namespace DiscImageChef.Decoders.SCSI.MMC Feature_001E decoded = new Feature_001E(); - decoded.Current |= (feature[2] & 0x01) == 0x01; + decoded.Current |= (feature[2] & 0x01) == 0x01; decoded.Persistent |= (feature[2] & 0x02) == 0x02; - decoded.Version = (byte)((feature[2] & 0x3C) >> 2); + decoded.Version = (byte)((feature[2] & 0x3C) >> 2); if(decoded.Version >= 1) { - decoded.C2 |= (feature[4] & 0x02) == 0x02; + decoded.C2 |= (feature[4] & 0x02) == 0x02; decoded.CDText |= (feature[4] & 0x01) == 0x01; } @@ -2577,14 +2579,14 @@ namespace DiscImageChef.Decoders.SCSI.MMC Feature_001F decoded = new Feature_001F(); - decoded.Current |= (feature[2] & 0x01) == 0x01; + decoded.Current |= (feature[2] & 0x01) == 0x01; decoded.Persistent |= (feature[2] & 0x02) == 0x02; - decoded.Version = (byte)((feature[2] & 0x3C) >> 2); + decoded.Version = (byte)((feature[2] & 0x3C) >> 2); if(decoded.Version >= 2 && feature.Length >= 8) { decoded.MULTI110 |= (feature[4] & 0x01) == 0x01; - decoded.DualR |= (feature[6] & 0x01) == 0x01; + decoded.DualR |= (feature[6] & 0x01) == 0x01; } // TODO: Check this @@ -2607,17 +2609,17 @@ namespace DiscImageChef.Decoders.SCSI.MMC Feature_0020 decoded = new Feature_0020(); - decoded.Current |= (feature[2] & 0x01) == 0x01; + decoded.Current |= (feature[2] & 0x01) == 0x01; decoded.Persistent |= (feature[2] & 0x02) == 0x02; - decoded.Version = (byte)((feature[2] & 0x3C) >> 2); + decoded.Version = (byte)((feature[2] & 0x3C) >> 2); if(decoded.Version < 1) return decoded; 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.Blocking = (ushort)((feature[12] << 8) + feature[13]); - decoded.PP |= (feature[14] & 0x01) == 0x01; + decoded.Blocking = (ushort)((feature[12] << 8) + feature[13]); + decoded.PP |= (feature[14] & 0x01) == 0x01; return decoded; } @@ -2636,15 +2638,15 @@ namespace DiscImageChef.Decoders.SCSI.MMC Feature_0021 decoded = new Feature_0021(); - decoded.Current |= (feature[2] & 0x01) == 0x01; + decoded.Current |= (feature[2] & 0x01) == 0x01; decoded.Persistent |= (feature[2] & 0x02) == 0x02; - decoded.Version = (byte)((feature[2] & 0x3C) >> 2); + decoded.Version = (byte)((feature[2] & 0x3C) >> 2); if(decoded.Version >= 1) { - decoded.DataTypeSupported = (ushort)((feature[4] << 8) + feature[5]); - decoded.BUF |= (feature[6] & 0x01) == 0x01; - decoded.LinkSizes = new byte[feature[7]]; + 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]); } @@ -2670,9 +2672,9 @@ namespace DiscImageChef.Decoders.SCSI.MMC Feature_0022 decoded = new Feature_0022(); - decoded.Current |= (feature[2] & 0x01) == 0x01; + decoded.Current |= (feature[2] & 0x01) == 0x01; decoded.Persistent |= (feature[2] & 0x02) == 0x02; - decoded.Version = (byte)((feature[2] & 0x3C) >> 2); + decoded.Version = (byte)((feature[2] & 0x3C) >> 2); return decoded; } @@ -2691,17 +2693,17 @@ namespace DiscImageChef.Decoders.SCSI.MMC Feature_0023 decoded = new Feature_0023(); - decoded.Current |= (feature[2] & 0x01) == 0x01; + decoded.Current |= (feature[2] & 0x01) == 0x01; decoded.Persistent |= (feature[2] & 0x02) == 0x02; - decoded.Version = (byte)((feature[2] & 0x3C) >> 2); + decoded.Version = (byte)((feature[2] & 0x3C) >> 2); if(decoded.Version >= 1 && feature.Length >= 12) { decoded.RENoSA |= (feature[4] & 0x08) == 0x08; decoded.Expand |= (feature[4] & 0x04) == 0x04; - decoded.QCert |= (feature[4] & 0x02) == 0x02; - decoded.Cert |= (feature[4] & 0x01) == 0x01; - decoded.RRM |= (feature[8] & 0x01) == 0x01; + decoded.QCert |= (feature[4] & 0x02) == 0x02; + decoded.Cert |= (feature[4] & 0x01) == 0x01; + decoded.RRM |= (feature[8] & 0x01) == 0x01; } if(decoded.Version >= 2 && feature.Length >= 12) decoded.FRF |= (feature[4] & 0x80) == 0x80; @@ -2723,9 +2725,9 @@ namespace DiscImageChef.Decoders.SCSI.MMC Feature_0024 decoded = new Feature_0024(); - decoded.Current |= (feature[2] & 0x01) == 0x01; + decoded.Current |= (feature[2] & 0x01) == 0x01; decoded.Persistent |= (feature[2] & 0x02) == 0x02; - decoded.Version = (byte)((feature[2] & 0x3C) >> 2); + decoded.Version = (byte)((feature[2] & 0x3C) >> 2); if(decoded.Version >= 1 && feature.Length >= 8) decoded.SSA |= (feature[4] & 0x80) == 0x80; @@ -2746,12 +2748,14 @@ namespace DiscImageChef.Decoders.SCSI.MMC Feature_0025 decoded = new Feature_0025(); - decoded.Current |= (feature[2] & 0x01) == 0x01; + decoded.Current |= (feature[2] & 0x01) == 0x01; decoded.Persistent |= (feature[2] & 0x02) == 0x02; - decoded.Version = (byte)((feature[2] & 0x3C) >> 2); + decoded.Version = (byte)((feature[2] & 0x3C) >> 2); - decoded.LogicalBlockSize = (uint)((feature[4] << 24) + (feature[5] << 16) + (feature[6] << 8) + feature[7]); - decoded.Blocking = (ushort)((feature[8] << 8) + feature[9]); + 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; return decoded; @@ -2771,9 +2775,9 @@ namespace DiscImageChef.Decoders.SCSI.MMC Feature_0026 decoded = new Feature_0026(); - decoded.Current |= (feature[2] & 0x01) == 0x01; + decoded.Current |= (feature[2] & 0x01) == 0x01; decoded.Persistent |= (feature[2] & 0x02) == 0x02; - decoded.Version = (byte)((feature[2] & 0x3C) >> 2); + decoded.Version = (byte)((feature[2] & 0x3C) >> 2); return decoded; } @@ -2792,9 +2796,9 @@ namespace DiscImageChef.Decoders.SCSI.MMC Feature_0027 decoded = new Feature_0027(); - decoded.Current |= (feature[2] & 0x01) == 0x01; + decoded.Current |= (feature[2] & 0x01) == 0x01; decoded.Persistent |= (feature[2] & 0x02) == 0x02; - decoded.Version = (byte)((feature[2] & 0x3C) >> 2); + decoded.Version = (byte)((feature[2] & 0x3C) >> 2); return decoded; } @@ -2813,16 +2817,16 @@ namespace DiscImageChef.Decoders.SCSI.MMC Feature_0028 decoded = new Feature_0028(); - decoded.Current |= (feature[2] & 0x01) == 0x01; + decoded.Current |= (feature[2] & 0x01) == 0x01; decoded.Persistent |= (feature[2] & 0x02) == 0x02; - decoded.Version = (byte)((feature[2] & 0x3C) >> 2); + decoded.Version = (byte)((feature[2] & 0x3C) >> 2); decoded.Write |= (feature[4] & 0x01) == 0x01; if(decoded.Version < 1) return decoded; decoded.DVDPWrite |= (feature[4] & 0x04) == 0x04; - decoded.DVDPRead |= (feature[4] & 0x02) == 0x02; + decoded.DVDPRead |= (feature[4] & 0x02) == 0x02; return decoded; } @@ -2841,13 +2845,13 @@ namespace DiscImageChef.Decoders.SCSI.MMC Feature_0029 decoded = new Feature_0029(); - decoded.Current |= (feature[2] & 0x01) == 0x01; + decoded.Current |= (feature[2] & 0x01) == 0x01; decoded.Persistent |= (feature[2] & 0x02) == 0x02; - decoded.Version = (byte)((feature[2] & 0x3C) >> 2); + decoded.Version = (byte)((feature[2] & 0x3C) >> 2); - decoded.DRTDM |= (feature[4] & 0x01) == 0x01; - decoded.DBICacheZones = feature[5]; - decoded.Entries = (ushort)((feature[6] << 8) + feature[7]); + decoded.DRTDM |= (feature[4] & 0x01) == 0x01; + decoded.DBICacheZones = feature[5]; + decoded.Entries = (ushort)((feature[6] << 8) + feature[7]); return decoded; } @@ -2866,11 +2870,11 @@ namespace DiscImageChef.Decoders.SCSI.MMC Feature_002A decoded = new Feature_002A(); - decoded.Current |= (feature[2] & 0x01) == 0x01; + decoded.Current |= (feature[2] & 0x01) == 0x01; decoded.Persistent |= (feature[2] & 0x02) == 0x02; - decoded.Version = (byte)((feature[2] & 0x3C) >> 2); + decoded.Version = (byte)((feature[2] & 0x3C) >> 2); - decoded.Write |= (feature[4] & 0x01) == 0x01; + decoded.Write |= (feature[4] & 0x01) == 0x01; decoded.CloseOnly |= (feature[5] & 0x01) == 0x01; if(decoded.Version >= 1) decoded.QuickStart |= (feature[5] & 0x02) == 0x02; @@ -2892,9 +2896,9 @@ namespace DiscImageChef.Decoders.SCSI.MMC Feature_002B decoded = new Feature_002B(); - decoded.Current |= (feature[2] & 0x01) == 0x01; + decoded.Current |= (feature[2] & 0x01) == 0x01; decoded.Persistent |= (feature[2] & 0x02) == 0x02; - decoded.Version = (byte)((feature[2] & 0x3C) >> 2); + decoded.Version = (byte)((feature[2] & 0x3C) >> 2); decoded.Write |= (feature[4] & 0x01) == 0x01; @@ -2915,14 +2919,14 @@ namespace DiscImageChef.Decoders.SCSI.MMC Feature_002C decoded = new Feature_002C(); - decoded.Current |= (feature[2] & 0x01) == 0x01; + decoded.Current |= (feature[2] & 0x01) == 0x01; decoded.Persistent |= (feature[2] & 0x02) == 0x02; - decoded.Version = (byte)((feature[2] & 0x3C) >> 2); + decoded.Version = (byte)((feature[2] & 0x3C) >> 2); - decoded.DSDG |= (feature[4] & 0x08) == 0x08; - decoded.DSDR |= (feature[4] & 0x04) == 0x04; + decoded.DSDG |= (feature[4] & 0x08) == 0x08; + decoded.DSDR |= (feature[4] & 0x04) == 0x04; decoded.Intermediate |= (feature[4] & 0x02) == 0x02; - decoded.Blank |= (feature[4] & 0x01) == 0x01; + decoded.Blank |= (feature[4] & 0x01) == 0x01; return decoded; } @@ -2941,19 +2945,19 @@ namespace DiscImageChef.Decoders.SCSI.MMC Feature_002D decoded = new Feature_002D(); - decoded.Current |= (feature[2] & 0x01) == 0x01; + decoded.Current |= (feature[2] & 0x01) == 0x01; decoded.Persistent |= (feature[2] & 0x02) == 0x02; - decoded.Version = (byte)((feature[2] & 0x3C) >> 2); + decoded.Version = (byte)((feature[2] & 0x3C) >> 2); - decoded.TestWrite |= (feature[4] & 0x04) == 0x04; - decoded.CDRW |= (feature[4] & 0x02) == 0x02; - decoded.RWSubchannel |= (feature[4] & 0x01) == 0x01; - decoded.DataTypeSupported = (ushort)((feature[6] << 8) + feature[7]); + decoded.TestWrite |= (feature[4] & 0x04) == 0x04; + decoded.CDRW |= (feature[4] & 0x02) == 0x02; + decoded.RWSubchannel |= (feature[4] & 0x01) == 0x01; + decoded.DataTypeSupported = (ushort)((feature[6] << 8) + feature[7]); if(decoded.Version < 2) return decoded; - decoded.BUF |= (feature[4] & 0x40) == 0x40; - decoded.RWRaw |= (feature[4] & 0x10) == 0x10; + decoded.BUF |= (feature[4] & 0x40) == 0x40; + decoded.RWRaw |= (feature[4] & 0x10) == 0x10; decoded.RWPack |= (feature[4] & 0x08) == 0x08; return decoded; @@ -2973,17 +2977,17 @@ namespace DiscImageChef.Decoders.SCSI.MMC Feature_002E decoded = new Feature_002E(); - decoded.Current |= (feature[2] & 0x01) == 0x01; + decoded.Current |= (feature[2] & 0x01) == 0x01; decoded.Persistent |= (feature[2] & 0x02) == 0x02; - decoded.Version = (byte)((feature[2] & 0x3C) >> 2); + decoded.Version = (byte)((feature[2] & 0x3C) >> 2); - decoded.SAO |= (feature[4] & 0x20) == 0x20; - decoded.RAWMS |= (feature[4] & 0x10) == 0x10; - decoded.RAW |= (feature[4] & 0x08) == 0x08; - decoded.TestWrite |= (feature[4] & 0x04) == 0x04; - decoded.CDRW |= (feature[4] & 0x02) == 0x02; - decoded.RW |= (feature[4] & 0x01) == 0x01; - decoded.MaxCueSheet = (uint)((feature[5] << 16) + (feature[6] << 8) + feature[7]); + decoded.SAO |= (feature[4] & 0x20) == 0x20; + decoded.RAWMS |= (feature[4] & 0x10) == 0x10; + decoded.RAW |= (feature[4] & 0x08) == 0x08; + decoded.TestWrite |= (feature[4] & 0x04) == 0x04; + decoded.CDRW |= (feature[4] & 0x02) == 0x02; + decoded.RW |= (feature[4] & 0x01) == 0x01; + decoded.MaxCueSheet = (uint)((feature[5] << 16) + (feature[6] << 8) + feature[7]); if(decoded.Version >= 1) decoded.BUF |= (feature[4] & 0x40) == 0x40; @@ -3004,11 +3008,11 @@ namespace DiscImageChef.Decoders.SCSI.MMC Feature_002F decoded = new Feature_002F(); - decoded.Current |= (feature[2] & 0x01) == 0x01; + decoded.Current |= (feature[2] & 0x01) == 0x01; decoded.Persistent |= (feature[2] & 0x02) == 0x02; - decoded.Version = (byte)((feature[2] & 0x3C) >> 2); + decoded.Version = (byte)((feature[2] & 0x3C) >> 2); - decoded.BUF |= (feature[4] & 0x40) == 0x40; + decoded.BUF |= (feature[4] & 0x40) == 0x40; decoded.TestWrite |= (feature[4] & 0x04) == 0x04; if(decoded.Version >= 1) decoded.DVDRW |= (feature[4] & 0x02) == 0x02; @@ -3032,9 +3036,9 @@ namespace DiscImageChef.Decoders.SCSI.MMC Feature_0030 decoded = new Feature_0030(); - decoded.Current |= (feature[2] & 0x01) == 0x01; + decoded.Current |= (feature[2] & 0x01) == 0x01; decoded.Persistent |= (feature[2] & 0x02) == 0x02; - decoded.Version = (byte)((feature[2] & 0x3C) >> 2); + decoded.Version = (byte)((feature[2] & 0x3C) >> 2); return decoded; } @@ -3053,9 +3057,9 @@ namespace DiscImageChef.Decoders.SCSI.MMC Feature_0031 decoded = new Feature_0031(); - decoded.Current |= (feature[2] & 0x01) == 0x01; + decoded.Current |= (feature[2] & 0x01) == 0x01; decoded.Persistent |= (feature[2] & 0x02) == 0x02; - decoded.Version = (byte)((feature[2] & 0x3C) >> 2); + decoded.Version = (byte)((feature[2] & 0x3C) >> 2); decoded.TestWrite |= (feature[4] & 0x04) == 0x04; @@ -3076,12 +3080,12 @@ namespace DiscImageChef.Decoders.SCSI.MMC Feature_0032 decoded = new Feature_0032(); - decoded.Current |= (feature[2] & 0x01) == 0x01; + decoded.Current |= (feature[2] & 0x01) == 0x01; decoded.Persistent |= (feature[2] & 0x02) == 0x02; - decoded.Version = (byte)((feature[2] & 0x3C) >> 2); + decoded.Version = (byte)((feature[2] & 0x3C) >> 2); decoded.Intermediate |= (feature[4] & 0x02) == 0x02; - decoded.Blank |= (feature[4] & 0x01) == 0x01; + decoded.Blank |= (feature[4] & 0x01) == 0x01; return decoded; } @@ -3100,9 +3104,9 @@ namespace DiscImageChef.Decoders.SCSI.MMC Feature_0033 decoded = new Feature_0033(); - decoded.Current |= (feature[2] & 0x01) == 0x01; + decoded.Current |= (feature[2] & 0x01) == 0x01; decoded.Persistent |= (feature[2] & 0x02) == 0x02; - decoded.Version = (byte)((feature[2] & 0x3C) >> 2); + decoded.Version = (byte)((feature[2] & 0x3C) >> 2); if(feature[7] <= 0 || feature.Length <= feature[7] + 8) return decoded; @@ -3126,9 +3130,9 @@ namespace DiscImageChef.Decoders.SCSI.MMC Feature_0035 decoded = new Feature_0035(); - decoded.Current |= (feature[2] & 0x01) == 0x01; + decoded.Current |= (feature[2] & 0x01) == 0x01; decoded.Persistent |= (feature[2] & 0x02) == 0x02; - decoded.Version = (byte)((feature[2] & 0x3C) >> 2); + decoded.Version = (byte)((feature[2] & 0x3C) >> 2); return decoded; } @@ -3147,9 +3151,9 @@ namespace DiscImageChef.Decoders.SCSI.MMC Feature_0037 decoded = new Feature_0037(); - decoded.Current |= (feature[2] & 0x01) == 0x01; + decoded.Current |= (feature[2] & 0x01) == 0x01; decoded.Persistent |= (feature[2] & 0x02) == 0x02; - decoded.Version = (byte)((feature[2] & 0x3C) >> 2); + decoded.Version = (byte)((feature[2] & 0x3C) >> 2); decoded.SubtypeSupport = feature[5]; @@ -3170,9 +3174,9 @@ namespace DiscImageChef.Decoders.SCSI.MMC Feature_0038 decoded = new Feature_0038(); - decoded.Current |= (feature[2] & 0x01) == 0x01; + decoded.Current |= (feature[2] & 0x01) == 0x01; decoded.Persistent |= (feature[2] & 0x02) == 0x02; - decoded.Version = (byte)((feature[2] & 0x3C) >> 2); + decoded.Version = (byte)((feature[2] & 0x3C) >> 2); return decoded; } @@ -3191,13 +3195,13 @@ namespace DiscImageChef.Decoders.SCSI.MMC Feature_003A decoded = new Feature_003A(); - decoded.Current |= (feature[2] & 0x01) == 0x01; + decoded.Current |= (feature[2] & 0x01) == 0x01; decoded.Persistent |= (feature[2] & 0x02) == 0x02; - decoded.Version = (byte)((feature[2] & 0x3C) >> 2); + decoded.Version = (byte)((feature[2] & 0x3C) >> 2); - decoded.Write |= (feature[4] & 0x01) == 0x01; + decoded.Write |= (feature[4] & 0x01) == 0x01; decoded.QuickStart |= (feature[5] & 0x02) == 0x02; - decoded.CloseOnly |= (feature[5] & 0x01) == 0x01; + decoded.CloseOnly |= (feature[5] & 0x01) == 0x01; return decoded; } @@ -3216,9 +3220,9 @@ namespace DiscImageChef.Decoders.SCSI.MMC Feature_003B decoded = new Feature_003B(); - decoded.Current |= (feature[2] & 0x01) == 0x01; + decoded.Current |= (feature[2] & 0x01) == 0x01; decoded.Persistent |= (feature[2] & 0x02) == 0x02; - decoded.Version = (byte)((feature[2] & 0x3C) >> 2); + decoded.Version = (byte)((feature[2] & 0x3C) >> 2); decoded.Write |= (feature[4] & 0x01) == 0x01; @@ -3239,20 +3243,20 @@ namespace DiscImageChef.Decoders.SCSI.MMC Feature_0040 decoded = new Feature_0040(); - decoded.Current |= (feature[2] & 0x01) == 0x01; + decoded.Current |= (feature[2] & 0x01) == 0x01; decoded.Persistent |= (feature[2] & 0x02) == 0x02; - decoded.Version = (byte)((feature[2] & 0x3C) >> 2); + decoded.Version = (byte)((feature[2] & 0x3C) >> 2); - decoded.OldRE |= (feature[9] & 0x01) == 0x01; - decoded.OldR |= (feature[17] & 0x01) == 0x01; + decoded.OldRE |= (feature[9] & 0x01) == 0x01; + decoded.OldR |= (feature[17] & 0x01) == 0x01; decoded.OldROM |= (feature[25] & 0x01) == 0x01; if(decoded.Version < 1) return decoded; - decoded.BCA |= (feature[4] & 0x01) == 0x01; - decoded.RE2 |= (feature[9] & 0x04) == 0x04; - decoded.RE1 |= (feature[9] & 0x02) == 0x02; - decoded.R |= (feature[17] & 0x02) == 0x02; + decoded.BCA |= (feature[4] & 0x01) == 0x01; + decoded.RE2 |= (feature[9] & 0x04) == 0x04; + decoded.RE1 |= (feature[9] & 0x02) == 0x02; + decoded.R |= (feature[17] & 0x02) == 0x02; decoded.ROM |= (feature[25] & 0x02) == 0x02; return decoded; @@ -3272,19 +3276,19 @@ namespace DiscImageChef.Decoders.SCSI.MMC Feature_0041 decoded = new Feature_0041(); - decoded.Current |= (feature[2] & 0x01) == 0x01; + decoded.Current |= (feature[2] & 0x01) == 0x01; decoded.Persistent |= (feature[2] & 0x02) == 0x02; - decoded.Version = (byte)((feature[2] & 0x3C) >> 2); + decoded.Version = (byte)((feature[2] & 0x3C) >> 2); - decoded.SVNR |= (feature[4] & 0x01) == 0x01; - decoded.OldRE |= (feature[9] & 0x01) == 0x01; - decoded.OldR |= (feature[17] & 0x01) == 0x01; + decoded.SVNR |= (feature[4] & 0x01) == 0x01; + decoded.OldRE |= (feature[9] & 0x01) == 0x01; + decoded.OldR |= (feature[17] & 0x01) == 0x01; if(decoded.Version < 1) return decoded; - decoded.RE2 |= (feature[9] & 0x04) == 0x04; - decoded.RE1 |= (feature[9] & 0x02) == 0x02; - decoded.R |= (feature[17] & 0x02) == 0x02; + decoded.RE2 |= (feature[9] & 0x04) == 0x04; + decoded.RE1 |= (feature[9] & 0x02) == 0x02; + decoded.R |= (feature[17] & 0x02) == 0x02; return decoded; } @@ -3303,9 +3307,9 @@ namespace DiscImageChef.Decoders.SCSI.MMC Feature_0042 decoded = new Feature_0042(); - decoded.Current |= (feature[2] & 0x01) == 0x01; + decoded.Current |= (feature[2] & 0x01) == 0x01; decoded.Persistent |= (feature[2] & 0x02) == 0x02; - decoded.Version = (byte)((feature[2] & 0x3C) >> 2); + decoded.Version = (byte)((feature[2] & 0x3C) >> 2); return decoded; } @@ -3324,11 +3328,11 @@ namespace DiscImageChef.Decoders.SCSI.MMC Feature_0050 decoded = new Feature_0050(); - decoded.Current |= (feature[2] & 0x01) == 0x01; + decoded.Current |= (feature[2] & 0x01) == 0x01; decoded.Persistent |= (feature[2] & 0x02) == 0x02; - decoded.Version = (byte)((feature[2] & 0x3C) >> 2); + decoded.Version = (byte)((feature[2] & 0x3C) >> 2); - decoded.HDDVDR |= (feature[4] & 0x01) == 0x01; + decoded.HDDVDR |= (feature[4] & 0x01) == 0x01; decoded.HDDVDRAM |= (feature[6] & 0x01) == 0x01; return decoded; @@ -3348,11 +3352,11 @@ namespace DiscImageChef.Decoders.SCSI.MMC Feature_0051 decoded = new Feature_0051(); - decoded.Current |= (feature[2] & 0x01) == 0x01; + decoded.Current |= (feature[2] & 0x01) == 0x01; decoded.Persistent |= (feature[2] & 0x02) == 0x02; - decoded.Version = (byte)((feature[2] & 0x3C) >> 2); + decoded.Version = (byte)((feature[2] & 0x3C) >> 2); - decoded.HDDVDR |= (feature[4] & 0x01) == 0x01; + decoded.HDDVDR |= (feature[4] & 0x01) == 0x01; decoded.HDDVDRAM |= (feature[6] & 0x01) == 0x01; return decoded; @@ -3372,9 +3376,9 @@ namespace DiscImageChef.Decoders.SCSI.MMC Feature_0080 decoded = new Feature_0080(); - decoded.Current |= (feature[2] & 0x01) == 0x01; + decoded.Current |= (feature[2] & 0x01) == 0x01; decoded.Persistent |= (feature[2] & 0x02) == 0x02; - decoded.Version = (byte)((feature[2] & 0x3C) >> 2); + decoded.Version = (byte)((feature[2] & 0x3C) >> 2); decoded.RI |= (feature[4] & 0x01) == 0x01; @@ -3395,9 +3399,9 @@ namespace DiscImageChef.Decoders.SCSI.MMC Feature_0100 decoded = new Feature_0100(); - decoded.Current |= (feature[2] & 0x01) == 0x01; + decoded.Current |= (feature[2] & 0x01) == 0x01; decoded.Persistent |= (feature[2] & 0x02) == 0x02; - decoded.Version = (byte)((feature[2] & 0x3C) >> 2); + decoded.Version = (byte)((feature[2] & 0x3C) >> 2); return decoded; } @@ -3416,9 +3420,9 @@ namespace DiscImageChef.Decoders.SCSI.MMC Feature_0101 decoded = new Feature_0101(); - decoded.Current |= (feature[2] & 0x01) == 0x01; + decoded.Current |= (feature[2] & 0x01) == 0x01; decoded.Persistent |= (feature[2] & 0x02) == 0x02; - decoded.Version = (byte)((feature[2] & 0x3C) >> 2); + decoded.Version = (byte)((feature[2] & 0x3C) >> 2); decoded.PP |= (feature[4] & 0x01) == 0x01; @@ -3439,13 +3443,13 @@ namespace DiscImageChef.Decoders.SCSI.MMC Feature_0102 decoded = new Feature_0102(); - decoded.Current |= (feature[2] & 0x01) == 0x01; + decoded.Current |= (feature[2] & 0x01) == 0x01; decoded.Persistent |= (feature[2] & 0x02) == 0x02; - decoded.Version = (byte)((feature[2] & 0x3C) >> 2); + decoded.Version = (byte)((feature[2] & 0x3C) >> 2); - decoded.SCC |= (feature[4] & 0x10) == 0x10; - decoded.SDP |= (feature[4] & 0x04) == 0x04; - decoded.HighestSlotNumber = (byte)(feature[7] & 0x1F); + decoded.SCC |= (feature[4] & 0x10) == 0x10; + decoded.SDP |= (feature[4] & 0x04) == 0x04; + decoded.HighestSlotNumber = (byte)(feature[7] & 0x1F); return decoded; } @@ -3464,14 +3468,14 @@ namespace DiscImageChef.Decoders.SCSI.MMC Feature_0103 decoded = new Feature_0103(); - decoded.Current |= (feature[2] & 0x01) == 0x01; + decoded.Current |= (feature[2] & 0x01) == 0x01; decoded.Persistent |= (feature[2] & 0x02) == 0x02; - decoded.Version = (byte)((feature[2] & 0x3C) >> 2); + decoded.Version = (byte)((feature[2] & 0x3C) >> 2); - decoded.Scan |= (feature[4] & 0x04) == 0x04; - decoded.SCM |= (feature[4] & 0x02) == 0x02; - decoded.SV |= (feature[4] & 0x01) == 0x01; - decoded.VolumeLevels = (ushort)((feature[6] << 8) + feature[7]); + decoded.Scan |= (feature[4] & 0x04) == 0x04; + decoded.SCM |= (feature[4] & 0x02) == 0x02; + decoded.SV |= (feature[4] & 0x01) == 0x01; + decoded.VolumeLevels = (ushort)((feature[6] << 8) + feature[7]); return decoded; } @@ -3490,9 +3494,9 @@ namespace DiscImageChef.Decoders.SCSI.MMC Feature_0104 decoded = new Feature_0104(); - decoded.Current |= (feature[2] & 0x01) == 0x01; + decoded.Current |= (feature[2] & 0x01) == 0x01; decoded.Persistent |= (feature[2] & 0x02) == 0x02; - decoded.Version = (byte)((feature[2] & 0x3C) >> 2); + decoded.Version = (byte)((feature[2] & 0x3C) >> 2); if(decoded.Version >= 1 && feature.Length >= 8) decoded.M5 |= (feature[4] & 0x01) == 0x01; @@ -3513,14 +3517,14 @@ namespace DiscImageChef.Decoders.SCSI.MMC Feature_0105 decoded = new Feature_0105(); - decoded.Current |= (feature[2] & 0x01) == 0x01; + decoded.Current |= (feature[2] & 0x01) == 0x01; decoded.Persistent |= (feature[2] & 0x02) == 0x02; - decoded.Version = (byte)((feature[2] & 0x3C) >> 2); + decoded.Version = (byte)((feature[2] & 0x3C) >> 2); if(decoded.Version < 1 || feature.Length < 8) return decoded; - decoded.Group3 |= (feature[4] & 0x01) == 0x01; - decoded.UnitLength = (ushort)((feature[6] << 8) + feature[7]); + decoded.Group3 |= (feature[4] & 0x01) == 0x01; + decoded.UnitLength = (ushort)((feature[6] << 8) + feature[7]); return decoded; } @@ -3539,9 +3543,9 @@ namespace DiscImageChef.Decoders.SCSI.MMC Feature_0106 decoded = new Feature_0106(); - decoded.Current |= (feature[2] & 0x01) == 0x01; + decoded.Current |= (feature[2] & 0x01) == 0x01; decoded.Persistent |= (feature[2] & 0x02) == 0x02; - decoded.Version = (byte)((feature[2] & 0x3C) >> 2); + decoded.Version = (byte)((feature[2] & 0x3C) >> 2); decoded.CSSVersion = feature[7]; @@ -3562,22 +3566,22 @@ namespace DiscImageChef.Decoders.SCSI.MMC Feature_0107 decoded = new Feature_0107(); - decoded.Current |= (feature[2] & 0x01) == 0x01; + decoded.Current |= (feature[2] & 0x01) == 0x01; decoded.Persistent |= (feature[2] & 0x02) == 0x02; - decoded.Version = (byte)((feature[2] & 0x3C) >> 2); + decoded.Version = (byte)((feature[2] & 0x3C) >> 2); if(decoded.Version >= 3 && feature.Length >= 8) { decoded.RBCB |= (feature[4] & 0x10) == 0x10; - decoded.SCS |= (feature[4] & 0x08) == 0x08; + decoded.SCS |= (feature[4] & 0x08) == 0x08; decoded.MP2A |= (feature[4] & 0x04) == 0x04; decoded.WSPD |= (feature[4] & 0x02) == 0x02; - decoded.SW |= (feature[4] & 0x01) == 0x01; + decoded.SW |= (feature[4] & 0x01) == 0x01; } if(decoded.Version < 5 || feature.Length < 8) return decoded; - decoded.SMP |= (feature[4] & 0x20) == 0x20; + decoded.SMP |= (feature[4] & 0x20) == 0x20; decoded.RBCB |= (feature[4] & 0x10) == 0x10; return decoded; @@ -3597,9 +3601,9 @@ namespace DiscImageChef.Decoders.SCSI.MMC Feature_0108 decoded = new Feature_0108(); - decoded.Current |= (feature[2] & 0x01) == 0x01; + decoded.Current |= (feature[2] & 0x01) == 0x01; decoded.Persistent |= (feature[2] & 0x02) == 0x02; - decoded.Version = (byte)((feature[2] & 0x3C) >> 2); + decoded.Version = (byte)((feature[2] & 0x3C) >> 2); byte[] serial = new byte[feature.Length]; Array.Copy(feature, 4, serial, 0, feature.Length - 4); @@ -3622,9 +3626,9 @@ namespace DiscImageChef.Decoders.SCSI.MMC Feature_0109 decoded = new Feature_0109(); - decoded.Current |= (feature[2] & 0x01) == 0x01; + decoded.Current |= (feature[2] & 0x01) == 0x01; decoded.Persistent |= (feature[2] & 0x02) == 0x02; - decoded.Version = (byte)((feature[2] & 0x3C) >> 2); + decoded.Version = (byte)((feature[2] & 0x3C) >> 2); return decoded; } @@ -3643,14 +3647,14 @@ namespace DiscImageChef.Decoders.SCSI.MMC Feature_010A decoded = new Feature_010A(); - decoded.Current |= (feature[2] & 0x01) == 0x01; + decoded.Current |= (feature[2] & 0x01) == 0x01; decoded.Persistent |= (feature[2] & 0x02) == 0x02; - decoded.Version = (byte)((feature[2] & 0x3C) >> 2); + decoded.Version = (byte)((feature[2] & 0x3C) >> 2); 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]); + (feature[2 + 4 + i * 4] << 8) + feature[3 + 4 + i * 4]); return decoded; } @@ -3669,9 +3673,9 @@ namespace DiscImageChef.Decoders.SCSI.MMC Feature_010B decoded = new Feature_010B(); - decoded.Current |= (feature[2] & 0x01) == 0x01; + decoded.Current |= (feature[2] & 0x01) == 0x01; decoded.Persistent |= (feature[2] & 0x02) == 0x02; - decoded.Version = (byte)((feature[2] & 0x3C) >> 2); + decoded.Version = (byte)((feature[2] & 0x3C) >> 2); decoded.CPRMVersion = feature[7]; @@ -3692,17 +3696,17 @@ namespace DiscImageChef.Decoders.SCSI.MMC Feature_010C decoded = new Feature_010C(); - decoded.Current |= (feature[2] & 0x01) == 0x01; + decoded.Current |= (feature[2] & 0x01) == 0x01; decoded.Persistent |= (feature[2] & 0x02) == 0x02; - decoded.Version = (byte)((feature[2] & 0x3C) >> 2); + decoded.Version = (byte)((feature[2] & 0x3C) >> 2); - decoded.Century = (ushort)((feature[4] << 8) + feature[5]); - decoded.Year = (ushort)((feature[6] << 8) + feature[7]); - decoded.Month = (ushort)((feature[8] << 8) + feature[9]); - decoded.Day = (ushort)((feature[10] << 8) + feature[11]); - decoded.Hour = (ushort)((feature[12] << 8) + feature[13]); - decoded.Minute = (ushort)((feature[14] << 8) + feature[15]); - decoded.Second = (ushort)((feature[16] << 8) + feature[17]); + decoded.Century = (ushort)((feature[4] << 8) + feature[5]); + decoded.Year = (ushort)((feature[6] << 8) + feature[7]); + decoded.Month = (ushort)((feature[8] << 8) + feature[9]); + decoded.Day = (ushort)((feature[10] << 8) + feature[11]); + decoded.Hour = (ushort)((feature[12] << 8) + feature[13]); + decoded.Minute = (ushort)((feature[14] << 8) + feature[15]); + decoded.Second = (ushort)((feature[16] << 8) + feature[17]); return decoded; } @@ -3721,14 +3725,14 @@ namespace DiscImageChef.Decoders.SCSI.MMC Feature_010D decoded = new Feature_010D(); - decoded.Current |= (feature[2] & 0x01) == 0x01; + decoded.Current |= (feature[2] & 0x01) == 0x01; decoded.Persistent |= (feature[2] & 0x02) == 0x02; - decoded.Version = (byte)((feature[2] & 0x3C) >> 2); + decoded.Version = (byte)((feature[2] & 0x3C) >> 2); - decoded.BNG |= (feature[4] & 0x01) == 0x01; - decoded.BindNonceBlocks = feature[5]; - decoded.AGIDs = (byte)(feature[6] & 0x0F); - decoded.AACSVersion = feature[7]; + decoded.BNG |= (feature[4] & 0x01) == 0x01; + decoded.BindNonceBlocks = feature[5]; + decoded.AGIDs = (byte)(feature[6] & 0x0F); + decoded.AACSVersion = feature[7]; if(decoded.Version < 2) return decoded; @@ -3754,9 +3758,9 @@ namespace DiscImageChef.Decoders.SCSI.MMC Feature_010E decoded = new Feature_010E(); - decoded.Current |= (feature[2] & 0x01) == 0x01; + decoded.Current |= (feature[2] & 0x01) == 0x01; decoded.Persistent |= (feature[2] & 0x02) == 0x02; - decoded.Version = (byte)((feature[2] & 0x3C) >> 2); + decoded.Version = (byte)((feature[2] & 0x3C) >> 2); decoded.MaxScrambleExtent = feature[4]; @@ -3777,9 +3781,9 @@ namespace DiscImageChef.Decoders.SCSI.MMC Feature_0110 decoded = new Feature_0110(); - decoded.Current |= (feature[2] & 0x01) == 0x01; + decoded.Current |= (feature[2] & 0x01) == 0x01; decoded.Persistent |= (feature[2] & 0x02) == 0x02; - decoded.Version = (byte)((feature[2] & 0x3C) >> 2); + decoded.Version = (byte)((feature[2] & 0x3C) >> 2); return decoded; } @@ -3798,9 +3802,9 @@ namespace DiscImageChef.Decoders.SCSI.MMC Feature_0113 decoded = new Feature_0113(); - decoded.Current |= (feature[2] & 0x01) == 0x01; + decoded.Current |= (feature[2] & 0x01) == 0x01; decoded.Persistent |= (feature[2] & 0x02) == 0x02; - decoded.Version = (byte)((feature[2] & 0x3C) >> 2); + decoded.Version = (byte)((feature[2] & 0x3C) >> 2); return decoded; } @@ -3819,14 +3823,14 @@ namespace DiscImageChef.Decoders.SCSI.MMC Feature_0142 decoded = new Feature_0142(); - decoded.Current |= (feature[2] & 0x01) == 0x01; + decoded.Current |= (feature[2] & 0x01) == 0x01; decoded.Persistent |= (feature[2] & 0x02) == 0x02; - decoded.Version = (byte)((feature[2] & 0x3C) >> 2); + decoded.Version = (byte)((feature[2] & 0x3C) >> 2); - decoded.PSAU |= (feature[4] & 0x80) == 0x80; - decoded.LOSPB |= (feature[4] & 0x40) == 0x40; - decoded.ME |= (feature[4] & 0x01) == 0x01; - decoded.Profiles = new ushort[feature[5]]; + decoded.PSAU |= (feature[4] & 0x80) == 0x80; + decoded.LOSPB |= (feature[4] & 0x40) == 0x40; + decoded.ME |= (feature[4] & 0x01) == 0x01; + decoded.Profiles = new ushort[feature[5]]; if(feature[5] * 2 + 6 != feature.Length) return decoded; for(int i = 0; i < feature[5]; i++) @@ -3839,8 +3843,8 @@ namespace DiscImageChef.Decoders.SCSI.MMC { if(!feature.HasValue) return null; - Feature_0000 ftr = feature.Value; - StringBuilder sb = new StringBuilder(); + Feature_0000 ftr = feature.Value; + StringBuilder sb = new StringBuilder(); sb.AppendLine("MMC Supported Profiles:"); if(ftr.Profiles == null) return sb.ToString(); @@ -3982,8 +3986,8 @@ namespace DiscImageChef.Decoders.SCSI.MMC { if(!feature.HasValue) return null; - Feature_0001 ftr = feature.Value; - StringBuilder sb = new StringBuilder(); + Feature_0001 ftr = feature.Value; + StringBuilder sb = new StringBuilder(); sb.AppendLine("MMC Core Feature:"); sb.Append("\tDrive uses "); @@ -4036,8 +4040,8 @@ namespace DiscImageChef.Decoders.SCSI.MMC { if(!feature.HasValue) return null; - Feature_0002 ftr = feature.Value; - StringBuilder sb = new StringBuilder(); + Feature_0002 ftr = feature.Value; + StringBuilder sb = new StringBuilder(); sb.AppendLine("MMC Morphing:"); @@ -4054,8 +4058,8 @@ namespace DiscImageChef.Decoders.SCSI.MMC { if(!feature.HasValue) return null; - Feature_0003 ftr = feature.Value; - StringBuilder sb = new StringBuilder(); + Feature_0003 ftr = feature.Value; + StringBuilder sb = new StringBuilder(); sb.AppendLine("MMC Removable Medium:"); @@ -4095,8 +4099,8 @@ namespace DiscImageChef.Decoders.SCSI.MMC { if(!feature.HasValue) return null; - Feature_0004 ftr = feature.Value; - StringBuilder sb = new StringBuilder(); + Feature_0004 ftr = feature.Value; + StringBuilder sb = new StringBuilder(); sb.AppendLine("MMC Write Protect:"); @@ -4112,8 +4116,8 @@ namespace DiscImageChef.Decoders.SCSI.MMC { if(!feature.HasValue) return null; - Feature_0010 ftr = feature.Value; - StringBuilder sb = new StringBuilder(); + Feature_0010 ftr = feature.Value; + StringBuilder sb = new StringBuilder(); sb.Append("MMC Random Readable"); if(ftr.Current) sb.Append(" (current)"); @@ -4139,8 +4143,8 @@ namespace DiscImageChef.Decoders.SCSI.MMC { if(!feature.HasValue) return null; - Feature_001E ftr = feature.Value; - StringBuilder sb = new StringBuilder(); + Feature_001E ftr = feature.Value; + StringBuilder sb = new StringBuilder(); sb.Append("MMC CD Read"); if(ftr.Current) sb.Append(" (current)"); @@ -4157,8 +4161,8 @@ namespace DiscImageChef.Decoders.SCSI.MMC { if(!feature.HasValue) return null; - Feature_001F ftr = feature.Value; - StringBuilder sb = new StringBuilder(); + Feature_001F ftr = feature.Value; + StringBuilder sb = new StringBuilder(); sb.Append("MMC DVD Read"); if(ftr.Current) sb.Append(" (current)"); @@ -4176,8 +4180,8 @@ namespace DiscImageChef.Decoders.SCSI.MMC { if(!feature.HasValue) return null; - Feature_0020 ftr = feature.Value; - StringBuilder sb = new StringBuilder(); + Feature_0020 ftr = feature.Value; + StringBuilder sb = new StringBuilder(); sb.Append("MMC Random Writable:"); if(ftr.Current) sb.Append(" (current)"); @@ -4197,8 +4201,8 @@ namespace DiscImageChef.Decoders.SCSI.MMC { if(!feature.HasValue) return null; - Feature_0021 ftr = feature.Value; - StringBuilder sb = new StringBuilder(); + Feature_0021 ftr = feature.Value; + StringBuilder sb = new StringBuilder(); sb.AppendLine("MMC Incremental Streaming Writable:"); @@ -4240,8 +4244,8 @@ namespace DiscImageChef.Decoders.SCSI.MMC { if(!feature.HasValue) return null; - Feature_0023 ftr = feature.Value; - StringBuilder sb = new StringBuilder(); + Feature_0023 ftr = feature.Value; + StringBuilder sb = new StringBuilder(); sb.AppendLine("MMC Formattable:"); sb.AppendLine("\tDrive can format media into logical blocks"); @@ -4260,8 +4264,8 @@ namespace DiscImageChef.Decoders.SCSI.MMC { if(!feature.HasValue) return null; - Feature_0024 ftr = feature.Value; - StringBuilder sb = new StringBuilder(); + 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"); @@ -4274,8 +4278,8 @@ namespace DiscImageChef.Decoders.SCSI.MMC { if(!feature.HasValue) return null; - Feature_0025 ftr = feature.Value; - StringBuilder sb = new StringBuilder(); + Feature_0025 ftr = feature.Value; + StringBuilder sb = new StringBuilder(); sb.Append("MMC Write Once"); if(ftr.Current) sb.Append(" (current)"); @@ -4301,8 +4305,8 @@ namespace DiscImageChef.Decoders.SCSI.MMC { if(!feature.HasValue) return null; - Feature_0027 ftr = feature.Value; - StringBuilder sb = new StringBuilder(); + Feature_0027 ftr = feature.Value; + StringBuilder sb = new StringBuilder(); sb.Append("Drive can write High-Speed CD-RW"); if(ftr.Current) sb.AppendLine(" (current)"); @@ -4315,12 +4319,12 @@ namespace DiscImageChef.Decoders.SCSI.MMC { if(!feature.HasValue) return null; - Feature_0028 ftr = feature.Value; - StringBuilder sb = new StringBuilder(); + 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.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"); @@ -4335,8 +4339,8 @@ namespace DiscImageChef.Decoders.SCSI.MMC { if(!feature.HasValue) return null; - Feature_0029 ftr = feature.Value; - StringBuilder sb = new StringBuilder(); + Feature_0029 ftr = feature.Value; + StringBuilder sb = new StringBuilder(); sb.AppendLine("MMC Enhanced Defect Reporting Feature:"); @@ -4353,8 +4357,8 @@ namespace DiscImageChef.Decoders.SCSI.MMC { if(!feature.HasValue) return null; - Feature_002A ftr = feature.Value; - StringBuilder sb = new StringBuilder(); + Feature_002A ftr = feature.Value; + StringBuilder sb = new StringBuilder(); if(ftr.Write) { @@ -4380,8 +4384,8 @@ namespace DiscImageChef.Decoders.SCSI.MMC { if(!feature.HasValue) return null; - Feature_002B ftr = feature.Value; - StringBuilder sb = new StringBuilder(); + Feature_002B ftr = feature.Value; + StringBuilder sb = new StringBuilder(); if(ftr.Write) { @@ -4403,8 +4407,8 @@ namespace DiscImageChef.Decoders.SCSI.MMC { if(!feature.HasValue) return null; - Feature_002C ftr = feature.Value; - StringBuilder sb = new StringBuilder(); + Feature_002C ftr = feature.Value; + StringBuilder sb = new StringBuilder(); sb.Append("MMC Rigid Restricted Overwrite"); sb.AppendLine(ftr.Current ? " (current):" : ":"); @@ -4422,8 +4426,8 @@ namespace DiscImageChef.Decoders.SCSI.MMC { if(!feature.HasValue) return null; - Feature_002D ftr = feature.Value; - StringBuilder sb = new StringBuilder(); + Feature_002D ftr = feature.Value; + StringBuilder sb = new StringBuilder(); sb.AppendLine("Drive can write CDs in Track at Once Mode:"); @@ -4466,10 +4470,10 @@ namespace DiscImageChef.Decoders.SCSI.MMC { if(!feature.HasValue) return null; - Feature_002E ftr = feature.Value; - StringBuilder sb = new StringBuilder(); + 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:"); + 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:"); @@ -4492,8 +4496,8 @@ namespace DiscImageChef.Decoders.SCSI.MMC { if(!feature.HasValue) return null; - Feature_002F ftr = feature.Value; - StringBuilder sb = new StringBuilder(); + 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"); @@ -4515,8 +4519,8 @@ namespace DiscImageChef.Decoders.SCSI.MMC { if(!feature.HasValue) return null; - Feature_0031 ftr = feature.Value; - StringBuilder sb = new StringBuilder(); + Feature_0031 ftr = feature.Value; + StringBuilder sb = new StringBuilder(); sb.AppendLine("Drive supports writing DDCD-R"); @@ -4529,8 +4533,8 @@ namespace DiscImageChef.Decoders.SCSI.MMC { if(!feature.HasValue) return null; - Feature_0032 ftr = feature.Value; - StringBuilder sb = new StringBuilder(); + Feature_0032 ftr = feature.Value; + StringBuilder sb = new StringBuilder(); sb.AppendLine("Drive supports writing DDCD-RW"); @@ -4544,8 +4548,8 @@ namespace DiscImageChef.Decoders.SCSI.MMC { if(!feature.HasValue) return null; - Feature_0033 ftr = feature.Value; - StringBuilder sb = new StringBuilder(); + Feature_0033 ftr = feature.Value; + StringBuilder sb = new StringBuilder(); sb.AppendLine("MMC Layer Jump Recording:"); @@ -4566,8 +4570,8 @@ namespace DiscImageChef.Decoders.SCSI.MMC { if(!feature.HasValue) return null; - Feature_0037 ftr = feature.Value; - StringBuilder sb = new StringBuilder(); + Feature_0037 ftr = feature.Value; + StringBuilder sb = new StringBuilder(); sb.AppendLine("Drive can write CD-RW"); if(ftr.SubtypeSupport <= 0) return sb.ToString(); @@ -4595,8 +4599,8 @@ namespace DiscImageChef.Decoders.SCSI.MMC { if(!feature.HasValue) return null; - Feature_003A ftr = feature.Value; - StringBuilder sb = new StringBuilder(); + Feature_003A ftr = feature.Value; + StringBuilder sb = new StringBuilder(); if(ftr.Write) { @@ -4622,8 +4626,8 @@ namespace DiscImageChef.Decoders.SCSI.MMC { if(!feature.HasValue) return null; - Feature_003B ftr = feature.Value; - StringBuilder sb = new StringBuilder(); + Feature_003B ftr = feature.Value; + StringBuilder sb = new StringBuilder(); if(ftr.Write) { @@ -4645,8 +4649,8 @@ namespace DiscImageChef.Decoders.SCSI.MMC { if(!feature.HasValue) return null; - Feature_0040 ftr = feature.Value; - StringBuilder sb = new StringBuilder(); + Feature_0040 ftr = feature.Value; + StringBuilder sb = new StringBuilder(); sb.Append("MMC BD Read"); sb.AppendLine(ftr.Current ? " (current):" : ":"); @@ -4668,8 +4672,8 @@ namespace DiscImageChef.Decoders.SCSI.MMC { if(!feature.HasValue) return null; - Feature_0041 ftr = feature.Value; - StringBuilder sb = new StringBuilder(); + Feature_0041 ftr = feature.Value; + StringBuilder sb = new StringBuilder(); sb.Append("MMC BD Write"); sb.AppendLine(ftr.Current ? " (current):" : ":"); @@ -4696,8 +4700,8 @@ namespace DiscImageChef.Decoders.SCSI.MMC { if(!feature.HasValue) return null; - Feature_0050 ftr = feature.Value; - StringBuilder sb = new StringBuilder(); + 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"); @@ -4714,8 +4718,8 @@ namespace DiscImageChef.Decoders.SCSI.MMC { if(!feature.HasValue) return null; - Feature_0051 ftr = feature.Value; - StringBuilder sb = new StringBuilder(); + 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"); @@ -4732,8 +4736,8 @@ namespace DiscImageChef.Decoders.SCSI.MMC { if(!feature.HasValue) return null; - Feature_0080 ftr = feature.Value; - StringBuilder sb = new StringBuilder(); + Feature_0080 ftr = feature.Value; + StringBuilder sb = new StringBuilder(); sb.Append("Drive is able to access Hybrid discs"); if(ftr.Current) sb.AppendLine(" (current)"); @@ -4754,8 +4758,8 @@ namespace DiscImageChef.Decoders.SCSI.MMC { if(!feature.HasValue) return null; - Feature_0101 ftr = feature.Value; - StringBuilder sb = new StringBuilder(); + 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"); @@ -4767,8 +4771,8 @@ namespace DiscImageChef.Decoders.SCSI.MMC { if(!feature.HasValue) return null; - Feature_0102 ftr = feature.Value; - StringBuilder sb = new StringBuilder(); + Feature_0102 ftr = feature.Value; + StringBuilder sb = new StringBuilder(); sb.AppendLine("MMC Embedded Changer:"); @@ -4784,8 +4788,8 @@ namespace DiscImageChef.Decoders.SCSI.MMC { if(!feature.HasValue) return null; - Feature_0103 ftr = feature.Value; - StringBuilder sb = new StringBuilder(); + Feature_0103 ftr = feature.Value; + StringBuilder sb = new StringBuilder(); sb.AppendLine("Drive has an analogue audio output"); @@ -4802,8 +4806,8 @@ namespace DiscImageChef.Decoders.SCSI.MMC { if(!feature.HasValue) return null; - Feature_0104 ftr = feature.Value; - StringBuilder sb = new StringBuilder(); + Feature_0104 ftr = feature.Value; + StringBuilder sb = new StringBuilder(); sb.AppendLine("Drive supports Microcode Upgrade"); if(ftr.M5) @@ -4816,8 +4820,8 @@ namespace DiscImageChef.Decoders.SCSI.MMC { if(!feature.HasValue) return null; - Feature_0105 ftr = feature.Value; - StringBuilder sb = new StringBuilder(); + Feature_0105 ftr = feature.Value; + StringBuilder sb = new StringBuilder(); sb.AppendLine("Drive supports Timeout & Protect mode page 1Dh"); @@ -4834,8 +4838,8 @@ namespace DiscImageChef.Decoders.SCSI.MMC { if(!feature.HasValue) return null; - Feature_0106 ftr = feature.Value; - StringBuilder sb = new StringBuilder(); + 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"); @@ -4848,8 +4852,8 @@ namespace DiscImageChef.Decoders.SCSI.MMC { if(!feature.HasValue) return null; - Feature_0107 ftr = feature.Value; - StringBuilder sb = new StringBuilder(); + Feature_0107 ftr = feature.Value; + StringBuilder sb = new StringBuilder(); sb.AppendLine("MMC Real Time Streaming:"); @@ -4869,8 +4873,8 @@ namespace DiscImageChef.Decoders.SCSI.MMC { if(!feature.HasValue) return null; - Feature_0108 ftr = feature.Value; - StringBuilder sb = new StringBuilder(); + Feature_0108 ftr = feature.Value; + StringBuilder sb = new StringBuilder(); sb.AppendFormat("Drive serial number: {0}", ftr.Serial).AppendLine(); @@ -4886,8 +4890,8 @@ namespace DiscImageChef.Decoders.SCSI.MMC { if(!feature.HasValue) return null; - Feature_010A ftr = feature.Value; - StringBuilder sb = new StringBuilder(); + Feature_010A ftr = feature.Value; + StringBuilder sb = new StringBuilder(); if(ftr.DCBs == null) return sb.ToString(); @@ -4900,8 +4904,8 @@ namespace DiscImageChef.Decoders.SCSI.MMC { if(!feature.HasValue) return null; - Feature_010B ftr = feature.Value; - StringBuilder sb = new StringBuilder(); + 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"); @@ -4914,8 +4918,8 @@ namespace DiscImageChef.Decoders.SCSI.MMC { if(!feature.HasValue) return null; - Feature_010C ftr = feature.Value; - StringBuilder sb = new StringBuilder(); + Feature_010C ftr = feature.Value; + StringBuilder sb = new StringBuilder(); byte[] temp = new byte[4]; temp[0] = (byte)((ftr.Century & 0xFF00) >> 8); @@ -4923,23 +4927,23 @@ namespace DiscImageChef.Decoders.SCSI.MMC temp[2] = (byte)((ftr.Year & 0xFF00) >> 8); temp[3] = (byte)(ftr.Year & 0xFF); string syear = Encoding.ASCII.GetString(temp); - temp = new byte[2]; + temp = new byte[2]; temp[0] = (byte)((ftr.Month & 0xFF00) >> 8); temp[1] = (byte)(ftr.Month & 0xFF); string smonth = Encoding.ASCII.GetString(temp); - temp = new byte[2]; + temp = new byte[2]; temp[0] = (byte)((ftr.Day & 0xFF00) >> 8); temp[1] = (byte)(ftr.Day & 0xFF); string sday = Encoding.ASCII.GetString(temp); - temp = new byte[2]; + temp = new byte[2]; temp[0] = (byte)((ftr.Hour & 0xFF00) >> 8); temp[1] = (byte)(ftr.Hour & 0xFF); string shour = Encoding.ASCII.GetString(temp); - temp = new byte[2]; + temp = new byte[2]; temp[0] = (byte)((ftr.Minute & 0xFF00) >> 8); temp[1] = (byte)(ftr.Minute & 0xFF); string sminute = Encoding.ASCII.GetString(temp); - temp = new byte[2]; + temp = new byte[2]; temp[0] = (byte)((ftr.Second & 0xFF00) >> 8); temp[1] = (byte)(ftr.Second & 0xFF); string ssecond = Encoding.ASCII.GetString(temp); @@ -4951,12 +4955,12 @@ namespace DiscImageChef.Decoders.SCSI.MMC 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 + #pragma warning disable RECS0022 // A catch clause that catches System.Exception and has an empty body catch { // ignored } -#pragma warning restore RECS0022 // A catch clause that catches System.Exception and has an empty body + #pragma warning restore RECS0022 // A catch clause that catches System.Exception and has an empty body return sb.ToString(); } @@ -4965,8 +4969,8 @@ namespace DiscImageChef.Decoders.SCSI.MMC { if(!feature.HasValue) return null; - Feature_010D ftr = feature.Value; - StringBuilder sb = new StringBuilder(); + 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"); @@ -4983,6 +4987,7 @@ namespace DiscImageChef.Decoders.SCSI.MMC 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(); return sb.ToString(); @@ -4992,8 +4997,8 @@ namespace DiscImageChef.Decoders.SCSI.MMC { if(!feature.HasValue) return null; - Feature_010E ftr = feature.Value; - StringBuilder sb = new StringBuilder(); + Feature_010E ftr = feature.Value; + StringBuilder sb = new StringBuilder(); sb.Append("Drive supports DVD-Download"); if(ftr.Current) sb.AppendLine(" (current)"); @@ -5010,8 +5015,8 @@ namespace DiscImageChef.Decoders.SCSI.MMC { if(!feature.HasValue) return null; - Feature_0110 ftr = feature.Value; - StringBuilder sb = new StringBuilder(); + Feature_0110 ftr = feature.Value; + StringBuilder sb = new StringBuilder(); sb.AppendLine(ftr.Current ? "Drive and currently inserted media support VCPS" : "Drive supports VCPS"); @@ -5022,8 +5027,8 @@ namespace DiscImageChef.Decoders.SCSI.MMC { if(!feature.HasValue) return null; - Feature_0113 ftr = feature.Value; - StringBuilder sb = new StringBuilder(); + Feature_0113 ftr = feature.Value; + StringBuilder sb = new StringBuilder(); sb.AppendLine(ftr.Current ? "Drive and currently inserted media support SecurDisc" @@ -5036,8 +5041,8 @@ namespace DiscImageChef.Decoders.SCSI.MMC { if(!feature.HasValue) return null; - Feature_0142 ftr = feature.Value; - StringBuilder sb = new StringBuilder(); + Feature_0142 ftr = feature.Value; + StringBuilder sb = new StringBuilder(); sb.AppendLine("Drive supports the Trusted Computing Group Optical Security Subsystem Class"); @@ -5348,10 +5353,10 @@ namespace DiscImageChef.Decoders.SCSI.MMC { SeparatedFeatures dec = new SeparatedFeatures { - DataLength = (uint)((response[0] << 24) + (response[1] << 16) + (response[2] << 8) + response[4]), - CurrentProfile = (ushort)((response[6] << 8) + response[7]) + DataLength = (uint)((response[0] << 24) + (response[1] << 16) + (response[2] << 8) + response[4]), + CurrentProfile = (ushort)((response[6] << 8) + response[7]) }; - uint offset = 8; + uint offset = 8; List descLst = new List(); while(offset + 4 < response.Length) @@ -5387,8 +5392,8 @@ namespace DiscImageChef.Decoders.SCSI.MMC [SuppressMessage("ReSharper", "NotAccessedField.Global")] public struct SeparatedFeatures { - public uint DataLength; - public ushort CurrentProfile; + public uint DataLength; + public ushort CurrentProfile; public FeatureDescriptor[] Descriptors; } } diff --git a/DiscImageChef.Decoders/SCSI/MMC/Hybrid.cs b/DiscImageChef.Decoders/SCSI/MMC/Hybrid.cs index 2756e9e01..0535b4513 100644 --- a/DiscImageChef.Decoders/SCSI/MMC/Hybrid.cs +++ b/DiscImageChef.Decoders/SCSI/MMC/Hybrid.cs @@ -116,14 +116,14 @@ namespace DiscImageChef.Decoders.SCSI.MMC BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian; - decoded.DataLength = BigEndianBitConverter.ToUInt16(FormatLayersResponse, 0); - decoded.Reserved1 = FormatLayersResponse[2]; - decoded.Reserved2 = FormatLayersResponse[3]; - decoded.NumberOfLayers = FormatLayersResponse[4]; - decoded.Reserved3 = (byte)((FormatLayersResponse[5] & 0xC0) >> 6); + decoded.DataLength = BigEndianBitConverter.ToUInt16(FormatLayersResponse, 0); + decoded.Reserved1 = FormatLayersResponse[2]; + decoded.Reserved2 = FormatLayersResponse[3]; + decoded.NumberOfLayers = FormatLayersResponse[4]; + decoded.Reserved3 = (byte)((FormatLayersResponse[5] & 0xC0) >> 6); decoded.DefaultFormatLayer = (byte)((FormatLayersResponse[5] & 0x30) >> 4); - decoded.Reserved4 = (byte)((FormatLayersResponse[5] & 0x0C) >> 2); - decoded.OnlineFormatLayer = (byte)(FormatLayersResponse[5] & 0x03); + decoded.Reserved4 = (byte)((FormatLayersResponse[5] & 0x0C) >> 2); + decoded.OnlineFormatLayer = (byte)(FormatLayersResponse[5] & 0x03); decoded.FormatLayers = new ushort[(FormatLayersResponse.Length - 6) / 2]; @@ -150,28 +150,28 @@ namespace DiscImageChef.Decoders.SCSI.MMC { 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."); + 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."); + 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."); + 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."); + if(response.OnlineFormatLayer == i) sb.AppendLine("This is the layer actually in use."); break; } default: @@ -179,7 +179,7 @@ namespace DiscImageChef.Decoders.SCSI.MMC 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."); + if(response.OnlineFormatLayer == i) sb.AppendLine("This is the layer actually in use."); break; } } diff --git a/DiscImageChef.Decoders/SCSI/MMC/WriteProtect.cs b/DiscImageChef.Decoders/SCSI/MMC/WriteProtect.cs index 1ad0fedb8..ad3307389 100644 --- a/DiscImageChef.Decoders/SCSI/MMC/WriteProtect.cs +++ b/DiscImageChef.Decoders/SCSI/MMC/WriteProtect.cs @@ -125,16 +125,16 @@ namespace DiscImageChef.Decoders.SCSI.MMC BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian; decoded.DataLength = BigEndianBitConverter.ToUInt16(WPSResponse, 0); - decoded.Reserved1 = WPSResponse[2]; - decoded.Reserved2 = WPSResponse[3]; - decoded.Reserved3 = (byte)((WPSResponse[4] & 0xF0) >> 4); - decoded.MSWI = Convert.ToBoolean(WPSResponse[4] & 0x08); - decoded.CWP = Convert.ToBoolean(WPSResponse[4] & 0x04); - decoded.PWP = Convert.ToBoolean(WPSResponse[4] & 0x02); - decoded.SWPP = Convert.ToBoolean(WPSResponse[4] & 0x01); - decoded.Reserved4 = WPSResponse[5]; - decoded.Reserved5 = WPSResponse[6]; - decoded.Reserved6 = WPSResponse[7]; + decoded.Reserved1 = WPSResponse[2]; + decoded.Reserved2 = WPSResponse[3]; + decoded.Reserved3 = (byte)((WPSResponse[4] & 0xF0) >> 4); + decoded.MSWI = Convert.ToBoolean(WPSResponse[4] & 0x08); + decoded.CWP = Convert.ToBoolean(WPSResponse[4] & 0x04); + decoded.PWP = Convert.ToBoolean(WPSResponse[4] & 0x02); + decoded.SWPP = Convert.ToBoolean(WPSResponse[4] & 0x01); + decoded.Reserved4 = WPSResponse[5]; + decoded.Reserved5 = WPSResponse[6]; + decoded.Reserved6 = WPSResponse[7]; return decoded; } @@ -152,14 +152,14 @@ namespace DiscImageChef.Decoders.SCSI.MMC 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 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(); -#endif + #endif return sb.ToString(); } diff --git a/DiscImageChef.Decoders/SCSI/Modes/00_SFF.cs b/DiscImageChef.Decoders/SCSI/Modes/00_SFF.cs index d03542e64..8844dcdbf 100644 --- a/DiscImageChef.Decoders/SCSI/Modes/00_SFF.cs +++ b/DiscImageChef.Decoders/SCSI/Modes/00_SFF.cs @@ -103,7 +103,7 @@ namespace DiscImageChef.Decoders.SCSI if(!modePage.HasValue) return null; ModePage_00_SFF page = modePage.Value; - StringBuilder sb = new StringBuilder(); + StringBuilder sb = new StringBuilder(); sb.AppendLine("SCSI Drive Operation Mode page:"); diff --git a/DiscImageChef.Decoders/SCSI/Modes/01.cs b/DiscImageChef.Decoders/SCSI/Modes/01.cs index 4b84e6f4f..8cffdf546 100644 --- a/DiscImageChef.Decoders/SCSI/Modes/01.cs +++ b/DiscImageChef.Decoders/SCSI/Modes/01.cs @@ -127,26 +127,26 @@ namespace DiscImageChef.Decoders.SCSI ModePage_01 decoded = new ModePage_01(); - decoded.PS |= (pageResponse[0] & 0x80) == 0x80; + decoded.PS |= (pageResponse[0] & 0x80) == 0x80; decoded.AWRE |= (pageResponse[2] & 0x80) == 0x80; decoded.ARRE |= (pageResponse[2] & 0x40) == 0x40; - decoded.TB |= (pageResponse[2] & 0x20) == 0x20; - decoded.RC |= (pageResponse[2] & 0x10) == 0x10; - decoded.EER |= (pageResponse[2] & 0x08) == 0x08; - decoded.PER |= (pageResponse[2] & 0x04) == 0x04; - decoded.DTE |= (pageResponse[2] & 0x02) == 0x02; - decoded.DCR |= (pageResponse[2] & 0x01) == 0x01; + decoded.TB |= (pageResponse[2] & 0x20) == 0x20; + decoded.RC |= (pageResponse[2] & 0x10) == 0x10; + decoded.EER |= (pageResponse[2] & 0x08) == 0x08; + decoded.PER |= (pageResponse[2] & 0x04) == 0x04; + decoded.DTE |= (pageResponse[2] & 0x02) == 0x02; + decoded.DCR |= (pageResponse[2] & 0x01) == 0x01; - decoded.ReadRetryCount = pageResponse[3]; - decoded.CorrectionSpan = pageResponse[4]; - decoded.HeadOffsetCount = (sbyte)pageResponse[5]; + decoded.ReadRetryCount = pageResponse[3]; + decoded.CorrectionSpan = pageResponse[4]; + decoded.HeadOffsetCount = (sbyte)pageResponse[5]; decoded.DataStrobeOffsetCount = (sbyte)pageResponse[6]; if(pageResponse.Length < 12) return decoded; - decoded.WriteRetryCount = pageResponse[8]; - decoded.RecoveryTimeLimit = (ushort)((pageResponse[10] << 8) + pageResponse[11]); - decoded.LBPERE |= (pageResponse[7] & 0x80) == 0x80; + decoded.WriteRetryCount = pageResponse[8]; + decoded.RecoveryTimeLimit = (ushort)((pageResponse[10] << 8) + pageResponse[11]); + decoded.LBPERE |= (pageResponse[7] & 0x80) == 0x80; return decoded; } @@ -160,8 +160,8 @@ namespace DiscImageChef.Decoders.SCSI { if(!modePage.HasValue) return null; - ModePage_01 page = modePage.Value; - StringBuilder sb = new StringBuilder(); + ModePage_01 page = modePage.Value; + StringBuilder sb = new StringBuilder(); sb.AppendLine("SCSI Read-write error recovery page:"); @@ -197,15 +197,15 @@ namespace DiscImageChef.Decoders.SCSI pg[0] = 0x01; pg[1] = 6; - if(page.PS) pg[0] += 0x80; + 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.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; diff --git a/DiscImageChef.Decoders/SCSI/Modes/01_MMC.cs b/DiscImageChef.Decoders/SCSI/Modes/01_MMC.cs index fc750aae1..3230f2e05 100644 --- a/DiscImageChef.Decoders/SCSI/Modes/01_MMC.cs +++ b/DiscImageChef.Decoders/SCSI/Modes/01_MMC.cs @@ -83,13 +83,13 @@ namespace DiscImageChef.Decoders.SCSI ModePage_01_MMC decoded = new ModePage_01_MMC(); - decoded.PS |= (pageResponse[0] & 0x80) == 0x80; - decoded.Parameter = pageResponse[2]; - decoded.ReadRetryCount = pageResponse[3]; + decoded.PS |= (pageResponse[0] & 0x80) == 0x80; + decoded.Parameter = pageResponse[2]; + decoded.ReadRetryCount = pageResponse[3]; if(pageResponse.Length < 12) return decoded; - decoded.WriteRetryCount = pageResponse[8]; + decoded.WriteRetryCount = pageResponse[8]; decoded.RecoveryTimeLimit = (ushort)((pageResponse[10] << 8) + pageResponse[11]); return decoded; @@ -105,7 +105,7 @@ namespace DiscImageChef.Decoders.SCSI if(!modePage.HasValue) return null; ModePage_01_MMC page = modePage.Value; - StringBuilder sb = new StringBuilder(); + StringBuilder sb = new StringBuilder(); sb.AppendLine("SCSI Read error recovery page for MultiMedia Devices:"); @@ -113,17 +113,18 @@ namespace DiscImageChef.Decoders.SCSI if(page.ReadRetryCount > 0) sb.AppendFormat("\tDrive will repeat read operations {0} times", page.ReadRetryCount).AppendLine(); - string AllUsed = "\tAll available recovery procedures will be used.\n"; - string CIRCRetriesUsed = "\tOnly retries and CIRC are used.\n"; - string RetriesUsed = "\tOnly retries are used.\n"; + string AllUsed = "\tAll available recovery procedures will be used.\n"; + string CIRCRetriesUsed = "\tOnly retries and CIRC are used.\n"; + string RetriesUsed = "\tOnly retries are used.\n"; string RecoveredNotReported = "\tRecovered errors will not be reported.\n"; - string RecoveredReported = "\tRecovered errors will be reported.\n"; - string RecoveredAbort = "\tRecovered errors will be reported and aborted with CHECK CONDITION.\n"; - string UnrecECCAbort = "\tUnrecovered ECC errors will return CHECK CONDITION."; - string UnrecCIRCAbort = "\tUnrecovered CIRC errors will return CHECK CONDITION."; - 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 RecoveredReported = "\tRecovered errors will be reported.\n"; + string RecoveredAbort = "\tRecovered errors will be reported and aborted with CHECK CONDITION.\n"; + string UnrecECCAbort = "\tUnrecovered ECC errors will return CHECK CONDITION."; + string UnrecCIRCAbort = "\tUnrecovered CIRC errors will return CHECK CONDITION."; + 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."; @@ -209,7 +210,7 @@ namespace DiscImageChef.Decoders.SCSI // This is from a newer version of SCSI unknown what happen for drives expecting an 8 byte page - pg[8] = page.WriteRetryCount; + pg[8] = page.WriteRetryCount; pg[10] = (byte)((page.RecoveryTimeLimit & 0xFF00) << 8); pg[11] = (byte)(page.RecoveryTimeLimit & 0xFF); diff --git a/DiscImageChef.Decoders/SCSI/Modes/02.cs b/DiscImageChef.Decoders/SCSI/Modes/02.cs index 84e2d7380..071e3e611 100644 --- a/DiscImageChef.Decoders/SCSI/Modes/02.cs +++ b/DiscImageChef.Decoders/SCSI/Modes/02.cs @@ -112,20 +112,20 @@ namespace DiscImageChef.Decoders.SCSI ModePage_02 decoded = new ModePage_02(); - decoded.PS |= (pageResponse[0] & 0x80) == 0x80; - decoded.BufferFullRatio = pageResponse[2]; - decoded.BufferEmptyRatio = pageResponse[3]; - decoded.BusInactivityLimit = (ushort)((pageResponse[4] << 8) + pageResponse[5]); - decoded.DisconnectTimeLimit = (ushort)((pageResponse[6] << 8) + pageResponse[7]); - decoded.ConnectTimeLimit = (ushort)((pageResponse[8] << 8) + pageResponse[9]); - decoded.MaxBurstSize = (ushort)((pageResponse[10] << 8) + pageResponse[11]); + decoded.PS |= (pageResponse[0] & 0x80) == 0x80; + decoded.BufferFullRatio = pageResponse[2]; + decoded.BufferEmptyRatio = pageResponse[3]; + decoded.BusInactivityLimit = (ushort)((pageResponse[4] << 8) + pageResponse[5]); + decoded.DisconnectTimeLimit = (ushort)((pageResponse[6] << 8) + pageResponse[7]); + decoded.ConnectTimeLimit = (ushort)((pageResponse[8] << 8) + pageResponse[9]); + decoded.MaxBurstSize = (ushort)((pageResponse[10] << 8) + pageResponse[11]); if(pageResponse.Length >= 13) { - decoded.EMDP |= (pageResponse[12] & 0x80) == 0x80; - decoded.DIMM |= (pageResponse[12] & 0x08) == 0x08; - decoded.FairArbitration = (byte)((pageResponse[12] & 0x70) >> 4); - decoded.DTDC = (byte)(pageResponse[12] & 0x07); + decoded.EMDP |= (pageResponse[12] & 0x80) == 0x80; + decoded.DIMM |= (pageResponse[12] & 0x08) == 0x08; + decoded.FairArbitration = (byte)((pageResponse[12] & 0x70) >> 4); + decoded.DTDC = (byte)(pageResponse[12] & 0x07); } if(pageResponse.Length >= 16) decoded.FirstBurstSize = (ushort)((pageResponse[14] << 8) + pageResponse[15]); @@ -142,8 +142,8 @@ namespace DiscImageChef.Decoders.SCSI { if(!modePage.HasValue) return null; - ModePage_02 page = modePage.Value; - StringBuilder sb = new StringBuilder(); + ModePage_02 page = modePage.Value; + StringBuilder sb = new StringBuilder(); sb.AppendLine("SCSI Disconnect-Reconnect mode page:"); @@ -162,15 +162,15 @@ namespace DiscImageChef.Decoders.SCSI 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(); + .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(); 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(); + .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"); diff --git a/DiscImageChef.Decoders/SCSI/Modes/03.cs b/DiscImageChef.Decoders/SCSI/Modes/03.cs index f6e0549a3..2128d9701 100644 --- a/DiscImageChef.Decoders/SCSI/Modes/03.cs +++ b/DiscImageChef.Decoders/SCSI/Modes/03.cs @@ -119,20 +119,20 @@ namespace DiscImageChef.Decoders.SCSI ModePage_03 decoded = new ModePage_03(); - decoded.PS |= (pageResponse[0] & 0x80) == 0x80; - decoded.TracksPerZone = (ushort)((pageResponse[2] << 8) + pageResponse[3]); - decoded.AltSectorsPerZone = (ushort)((pageResponse[4] << 8) + pageResponse[5]); - decoded.AltTracksPerZone = (ushort)((pageResponse[6] << 8) + pageResponse[7]); - decoded.AltTracksPerLun = (ushort)((pageResponse[8] << 8) + pageResponse[9]); - decoded.SectorsPerTrack = (ushort)((pageResponse[10] << 8) + pageResponse[11]); - decoded.BytesPerSector = (ushort)((pageResponse[12] << 8) + pageResponse[13]); - decoded.Interleave = (ushort)((pageResponse[14] << 8) + pageResponse[15]); - decoded.TrackSkew = (ushort)((pageResponse[16] << 8) + pageResponse[17]); - decoded.CylinderSkew = (ushort)((pageResponse[18] << 8) + pageResponse[19]); - decoded.SSEC |= (pageResponse[20] & 0x80) == 0x80; - decoded.HSEC |= (pageResponse[20] & 0x40) == 0x40; - decoded.RMB |= (pageResponse[20] & 0x20) == 0x20; - decoded.SURF |= (pageResponse[20] & 0x10) == 0x10; + decoded.PS |= (pageResponse[0] & 0x80) == 0x80; + decoded.TracksPerZone = (ushort)((pageResponse[2] << 8) + pageResponse[3]); + decoded.AltSectorsPerZone = (ushort)((pageResponse[4] << 8) + pageResponse[5]); + decoded.AltTracksPerZone = (ushort)((pageResponse[6] << 8) + pageResponse[7]); + decoded.AltTracksPerLun = (ushort)((pageResponse[8] << 8) + pageResponse[9]); + decoded.SectorsPerTrack = (ushort)((pageResponse[10] << 8) + pageResponse[11]); + decoded.BytesPerSector = (ushort)((pageResponse[12] << 8) + pageResponse[13]); + decoded.Interleave = (ushort)((pageResponse[14] << 8) + pageResponse[15]); + decoded.TrackSkew = (ushort)((pageResponse[16] << 8) + pageResponse[17]); + decoded.CylinderSkew = (ushort)((pageResponse[18] << 8) + pageResponse[19]); + decoded.SSEC |= (pageResponse[20] & 0x80) == 0x80; + decoded.HSEC |= (pageResponse[20] & 0x40) == 0x40; + decoded.RMB |= (pageResponse[20] & 0x20) == 0x20; + decoded.SURF |= (pageResponse[20] & 0x10) == 0x10; return decoded; } @@ -146,16 +146,16 @@ namespace DiscImageChef.Decoders.SCSI { if(!modePage.HasValue) return null; - ModePage_03 page = modePage.Value; - StringBuilder sb = new StringBuilder(); + ModePage_03 page = modePage.Value; + StringBuilder sb = new StringBuilder(); sb.AppendLine("SCSI Format device page:"); 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(); + .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) diff --git a/DiscImageChef.Decoders/SCSI/Modes/04.cs b/DiscImageChef.Decoders/SCSI/Modes/04.cs index 60bec2dbc..8834ed481 100644 --- a/DiscImageChef.Decoders/SCSI/Modes/04.cs +++ b/DiscImageChef.Decoders/SCSI/Modes/04.cs @@ -102,14 +102,16 @@ namespace DiscImageChef.Decoders.SCSI ModePage_04 decoded = new ModePage_04(); - decoded.PS |= (pageResponse[0] & 0x80) == 0x80; - decoded.Cylinders = (uint)((pageResponse[2] << 16) + (pageResponse[3] << 8) + pageResponse[4]); - decoded.Heads = pageResponse[5]; - decoded.WritePrecompCylinder = (uint)((pageResponse[6] << 16) + (pageResponse[7] << 8) + pageResponse[8]); - decoded.WriteReduceCylinder = (uint)((pageResponse[9] << 16) + (pageResponse[10] << 8) + pageResponse[11]); - decoded.DriveStepRate = (ushort)((pageResponse[12] << 8) + pageResponse[13]); - decoded.LandingCylinder = (pageResponse[14] << 16) + (pageResponse[15] << 8) + pageResponse[16]; - decoded.RPL = (byte)(pageResponse[17] & 0x03); + decoded.PS |= (pageResponse[0] & 0x80) == 0x80; + decoded.Cylinders = (uint)((pageResponse[2] << 16) + (pageResponse[3] << 8) + pageResponse[4]); + decoded.Heads = pageResponse[5]; + decoded.WritePrecompCylinder = (uint)((pageResponse[6] << 16) + (pageResponse[7] << 8) + pageResponse[8]); + decoded.WriteReduceCylinder = + (uint)((pageResponse[9] << 16) + (pageResponse[10] << 8) + pageResponse[11]); + decoded.DriveStepRate = + (ushort)((pageResponse[12] << 8) + pageResponse[13]); + decoded.LandingCylinder = (pageResponse[14] << 16) + (pageResponse[15] << 8) + pageResponse[16]; + decoded.RPL = (byte)(pageResponse[17] & 0x03); decoded.RotationalOffset = pageResponse[18]; if(pageResponse.Length >= 22) @@ -127,8 +129,8 @@ namespace DiscImageChef.Decoders.SCSI { if(!modePage.HasValue) return null; - ModePage_04 page = modePage.Value; - StringBuilder sb = new StringBuilder(); + ModePage_04 page = modePage.Value; + StringBuilder sb = new StringBuilder(); sb.AppendLine("SCSI Rigid disk drive geometry page:"); diff --git a/DiscImageChef.Decoders/SCSI/Modes/05.cs b/DiscImageChef.Decoders/SCSI/Modes/05.cs index 3e7badb81..d4207a637 100644 --- a/DiscImageChef.Decoders/SCSI/Modes/05.cs +++ b/DiscImageChef.Decoders/SCSI/Modes/05.cs @@ -167,31 +167,31 @@ namespace DiscImageChef.Decoders.SCSI ModePage_05 decoded = new ModePage_05(); - decoded.PS |= (pageResponse[0] & 0x80) == 0x80; - decoded.TransferRate = (ushort)((pageResponse[2] << 8) + pageResponse[3]); - decoded.Heads = pageResponse[4]; - decoded.SectorsPerTrack = pageResponse[5]; - decoded.BytesPerSector = (ushort)((pageResponse[6] << 8) + pageResponse[7]); - decoded.Cylinders = (ushort)((pageResponse[8] << 8) + pageResponse[9]); - decoded.WritePrecompCylinder = (ushort)((pageResponse[10] << 8) + pageResponse[11]); - decoded.WriteReduceCylinder = (ushort)((pageResponse[12] << 8) + pageResponse[13]); - decoded.DriveStepRate = (ushort)((pageResponse[14] << 8) + pageResponse[15]); - decoded.DriveStepPulse = pageResponse[16]; - decoded.HeadSettleDelay = (ushort)((pageResponse[17] << 8) + pageResponse[18]); - decoded.MotorOnDelay = pageResponse[19]; - decoded.MotorOffDelay = pageResponse[20]; - decoded.TRDY |= (pageResponse[21] & 0x80) == 0x80; - decoded.SSN |= (pageResponse[21] & 0x40) == 0x40; - decoded.MO |= (pageResponse[21] & 0x20) == 0x20; - decoded.SPC = (byte)(pageResponse[22] & 0x0F); - decoded.WriteCompensation = pageResponse[23]; - decoded.HeadLoadDelay = pageResponse[24]; - decoded.HeadUnloadDelay = pageResponse[25]; - decoded.Pin34 = (byte)((pageResponse[26] & 0xF0) >> 4); - decoded.Pin2 = (byte)(pageResponse[26] & 0x0F); - decoded.Pin4 = (byte)((pageResponse[27] & 0xF0) >> 4); - decoded.Pin1 = (byte)(pageResponse[27] & 0x0F); - decoded.MediumRotationRate = (ushort)((pageResponse[28] << 8) + pageResponse[29]); + decoded.PS |= (pageResponse[0] & 0x80) == 0x80; + decoded.TransferRate = (ushort)((pageResponse[2] << 8) + pageResponse[3]); + decoded.Heads = pageResponse[4]; + decoded.SectorsPerTrack = pageResponse[5]; + decoded.BytesPerSector = (ushort)((pageResponse[6] << 8) + pageResponse[7]); + decoded.Cylinders = (ushort)((pageResponse[8] << 8) + pageResponse[9]); + decoded.WritePrecompCylinder = (ushort)((pageResponse[10] << 8) + pageResponse[11]); + decoded.WriteReduceCylinder = (ushort)((pageResponse[12] << 8) + pageResponse[13]); + decoded.DriveStepRate = (ushort)((pageResponse[14] << 8) + pageResponse[15]); + decoded.DriveStepPulse = pageResponse[16]; + decoded.HeadSettleDelay = (ushort)((pageResponse[17] << 8) + pageResponse[18]); + decoded.MotorOnDelay = pageResponse[19]; + decoded.MotorOffDelay = pageResponse[20]; + decoded.TRDY |= (pageResponse[21] & 0x80) == 0x80; + decoded.SSN |= (pageResponse[21] & 0x40) == 0x40; + decoded.MO |= (pageResponse[21] & 0x20) == 0x20; + decoded.SPC = (byte)(pageResponse[22] & 0x0F); + decoded.WriteCompensation = pageResponse[23]; + decoded.HeadLoadDelay = pageResponse[24]; + decoded.HeadUnloadDelay = pageResponse[25]; + decoded.Pin34 = (byte)((pageResponse[26] & 0xF0) >> 4); + decoded.Pin2 = (byte)(pageResponse[26] & 0x0F); + decoded.Pin4 = (byte)((pageResponse[27] & 0xF0) >> 4); + decoded.Pin1 = (byte)(pageResponse[27] & 0x0F); + decoded.MediumRotationRate = (ushort)((pageResponse[28] << 8) + pageResponse[29]); return decoded; } @@ -205,8 +205,8 @@ namespace DiscImageChef.Decoders.SCSI { if(!modePage.HasValue) return null; - ModePage_05 page = modePage.Value; - StringBuilder sb = new StringBuilder(); + ModePage_05 page = modePage.Value; + StringBuilder sb = new StringBuilder(); sb.AppendLine("SCSI Flexible disk page:"); @@ -232,17 +232,17 @@ namespace DiscImageChef.Decoders.SCSI 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(); + .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(); + .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(); + .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"); diff --git a/DiscImageChef.Decoders/SCSI/Modes/06.cs b/DiscImageChef.Decoders/SCSI/Modes/06.cs index 2de55c080..12f642441 100644 --- a/DiscImageChef.Decoders/SCSI/Modes/06.cs +++ b/DiscImageChef.Decoders/SCSI/Modes/06.cs @@ -70,7 +70,7 @@ namespace DiscImageChef.Decoders.SCSI ModePage_06 decoded = new ModePage_06(); - decoded.PS |= (pageResponse[0] & 0x80) == 0x80; + decoded.PS |= (pageResponse[0] & 0x80) == 0x80; decoded.RUBR |= (pageResponse[2] & 0x01) == 0x01; return decoded; @@ -85,8 +85,8 @@ namespace DiscImageChef.Decoders.SCSI { if(!modePage.HasValue) return null; - ModePage_06 page = modePage.Value; - StringBuilder sb = new StringBuilder(); + ModePage_06 page = modePage.Value; + StringBuilder sb = new StringBuilder(); sb.AppendLine("SCSI optical memory:"); diff --git a/DiscImageChef.Decoders/SCSI/Modes/07.cs b/DiscImageChef.Decoders/SCSI/Modes/07.cs index 7ca4d38f7..b61426d12 100644 --- a/DiscImageChef.Decoders/SCSI/Modes/07.cs +++ b/DiscImageChef.Decoders/SCSI/Modes/07.cs @@ -95,14 +95,14 @@ namespace DiscImageChef.Decoders.SCSI ModePage_07 decoded = new ModePage_07(); - decoded.PS |= (pageResponse[0] & 0x80) == 0x80; + decoded.PS |= (pageResponse[0] & 0x80) == 0x80; decoded.EER |= (pageResponse[2] & 0x08) == 0x08; decoded.PER |= (pageResponse[2] & 0x04) == 0x04; decoded.DTE |= (pageResponse[2] & 0x02) == 0x02; decoded.DCR |= (pageResponse[2] & 0x01) == 0x01; - decoded.VerifyRetryCount = pageResponse[3]; - decoded.CorrectionSpan = pageResponse[4]; + decoded.VerifyRetryCount = pageResponse[3]; + decoded.CorrectionSpan = pageResponse[4]; decoded.RecoveryTimeLimit = (ushort)((pageResponse[10] << 8) + pageResponse[11]); return decoded; @@ -117,8 +117,8 @@ namespace DiscImageChef.Decoders.SCSI { if(!modePage.HasValue) return null; - ModePage_07 page = modePage.Value; - StringBuilder sb = new StringBuilder(); + ModePage_07 page = modePage.Value; + StringBuilder sb = new StringBuilder(); sb.AppendLine("SCSI Verify error recovery page:"); diff --git a/DiscImageChef.Decoders/SCSI/Modes/07_MMC.cs b/DiscImageChef.Decoders/SCSI/Modes/07_MMC.cs index 8a3e802b8..0f3c6e46d 100644 --- a/DiscImageChef.Decoders/SCSI/Modes/07_MMC.cs +++ b/DiscImageChef.Decoders/SCSI/Modes/07_MMC.cs @@ -74,9 +74,9 @@ namespace DiscImageChef.Decoders.SCSI ModePage_07_MMC decoded = new ModePage_07_MMC(); - decoded.PS |= (pageResponse[0] & 0x80) == 0x80; - decoded.Parameter = pageResponse[2]; - decoded.VerifyRetryCount = pageResponse[3]; + decoded.PS |= (pageResponse[0] & 0x80) == 0x80; + decoded.Parameter = pageResponse[2]; + decoded.VerifyRetryCount = pageResponse[3]; return decoded; } @@ -91,7 +91,7 @@ namespace DiscImageChef.Decoders.SCSI if(!modePage.HasValue) return null; ModePage_07_MMC page = modePage.Value; - StringBuilder sb = new StringBuilder(); + StringBuilder sb = new StringBuilder(); sb.AppendLine("SCSI Verify error recovery page for MultiMedia Devices:"); @@ -99,17 +99,18 @@ namespace DiscImageChef.Decoders.SCSI if(page.VerifyRetryCount > 0) sb.AppendFormat("\tDrive will repeat verify operations {0} times", page.VerifyRetryCount).AppendLine(); - string AllUsed = "\tAll available recovery procedures will be used.\n"; - string CIRCRetriesUsed = "\tOnly retries and CIRC are used.\n"; - string RetriesUsed = "\tOnly retries are used.\n"; + string AllUsed = "\tAll available recovery procedures will be used.\n"; + string CIRCRetriesUsed = "\tOnly retries and CIRC are used.\n"; + string RetriesUsed = "\tOnly retries are used.\n"; string RecoveredNotReported = "\tRecovered errors will not be reported.\n"; - string RecoveredReported = "\tRecovered errors will be reported.\n"; - string RecoveredAbort = "\tRecovered errors will be reported and aborted with CHECK CONDITION.\n"; - string UnrecECCAbort = "\tUnrecovered ECC errors will return CHECK CONDITION."; - string UnrecCIRCAbort = "\tUnrecovered CIRC errors will return CHECK CONDITION."; - 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 RecoveredReported = "\tRecovered errors will be reported.\n"; + string RecoveredAbort = "\tRecovered errors will be reported and aborted with CHECK CONDITION.\n"; + string UnrecECCAbort = "\tUnrecovered ECC errors will return CHECK CONDITION."; + string UnrecCIRCAbort = "\tUnrecovered CIRC errors will return CHECK CONDITION."; + 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."; diff --git a/DiscImageChef.Decoders/SCSI/Modes/08.cs b/DiscImageChef.Decoders/SCSI/Modes/08.cs index 84d5afca7..55ef31d99 100644 --- a/DiscImageChef.Decoders/SCSI/Modes/08.cs +++ b/DiscImageChef.Decoders/SCSI/Modes/08.cs @@ -150,32 +150,32 @@ namespace DiscImageChef.Decoders.SCSI ModePage_08 decoded = new ModePage_08(); - decoded.PS |= (pageResponse[0] & 0x80) == 0x80; + decoded.PS |= (pageResponse[0] & 0x80) == 0x80; decoded.WCE |= (pageResponse[2] & 0x04) == 0x04; - decoded.MF |= (pageResponse[2] & 0x02) == 0x02; + decoded.MF |= (pageResponse[2] & 0x02) == 0x02; decoded.RCD |= (pageResponse[2] & 0x01) == 0x01; decoded.DemandReadRetentionPrio = (byte)((pageResponse[3] & 0xF0) >> 4); - decoded.WriteRetentionPriority = (byte)(pageResponse[3] & 0x0F); - decoded.DisablePreFetch = (ushort)((pageResponse[4] << 8) + pageResponse[5]); - decoded.MinimumPreFetch = (ushort)((pageResponse[6] << 8) + pageResponse[7]); - decoded.MaximumPreFetch = (ushort)((pageResponse[8] << 8) + pageResponse[9]); - decoded.MaximumPreFetchCeiling = (ushort)((pageResponse[10] << 8) + pageResponse[11]); + decoded.WriteRetentionPriority = (byte)(pageResponse[3] & 0x0F); + decoded.DisablePreFetch = (ushort)((pageResponse[4] << 8) + pageResponse[5]); + decoded.MinimumPreFetch = (ushort)((pageResponse[6] << 8) + pageResponse[7]); + decoded.MaximumPreFetch = (ushort)((pageResponse[8] << 8) + pageResponse[9]); + decoded.MaximumPreFetchCeiling = (ushort)((pageResponse[10] << 8) + pageResponse[11]); if(pageResponse.Length < 20) return decoded; - decoded.IC |= (pageResponse[2] & 0x80) == 0x80; + decoded.IC |= (pageResponse[2] & 0x80) == 0x80; decoded.ABPF |= (pageResponse[2] & 0x40) == 0x40; - decoded.CAP |= (pageResponse[2] & 0x20) == 0x20; + decoded.CAP |= (pageResponse[2] & 0x20) == 0x20; decoded.Disc |= (pageResponse[2] & 0x10) == 0x10; decoded.Size |= (pageResponse[2] & 0x08) == 0x08; - decoded.FSW |= (pageResponse[12] & 0x80) == 0x80; + decoded.FSW |= (pageResponse[12] & 0x80) == 0x80; decoded.LBCSS |= (pageResponse[12] & 0x40) == 0x40; - decoded.DRA |= (pageResponse[12] & 0x20) == 0x20; + decoded.DRA |= (pageResponse[12] & 0x20) == 0x20; - decoded.CacheSegments = pageResponse[13]; - decoded.CacheSegmentSize = (ushort)((pageResponse[14] << 8) + pageResponse[15]); + decoded.CacheSegments = pageResponse[13]; + decoded.CacheSegmentSize = (ushort)((pageResponse[14] << 8) + pageResponse[15]); decoded.NonCacheSegmentSize = (uint)((pageResponse[17] << 16) + (pageResponse[18] << 8) + pageResponse[19]); decoded.NV_DIS |= (pageResponse[12] & 0x01) == 0x01; @@ -192,8 +192,8 @@ namespace DiscImageChef.Decoders.SCSI { if(!modePage.HasValue) return null; - ModePage_08 page = modePage.Value; - StringBuilder sb = new StringBuilder(); + ModePage_08 page = modePage.Value; + StringBuilder sb = new StringBuilder(); sb.AppendLine("SCSI Caching mode page:"); @@ -254,8 +254,8 @@ namespace DiscImageChef.Decoders.SCSI .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(); + .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"); @@ -286,8 +286,8 @@ 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(); + .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"); diff --git a/DiscImageChef.Decoders/SCSI/Modes/0A.cs b/DiscImageChef.Decoders/SCSI/Modes/0A.cs index 1c3064f3f..3040b4d09 100644 --- a/DiscImageChef.Decoders/SCSI/Modes/0A.cs +++ b/DiscImageChef.Decoders/SCSI/Modes/0A.cs @@ -177,17 +177,17 @@ namespace DiscImageChef.Decoders.SCSI ModePage_0A decoded = new ModePage_0A(); - decoded.PS |= (pageResponse[0] & 0x80) == 0x80; + decoded.PS |= (pageResponse[0] & 0x80) == 0x80; decoded.RLEC |= (pageResponse[2] & 0x01) == 0x01; decoded.QueueAlgorithm = (byte)((pageResponse[3] & 0xF0) >> 4); - decoded.QErr = (byte)((pageResponse[3] & 0x06) >> 1); + decoded.QErr = (byte)((pageResponse[3] & 0x06) >> 1); - decoded.DQue |= (pageResponse[3] & 0x01) == 0x01; - decoded.EECA |= (pageResponse[4] & 0x80) == 0x80; - decoded.RAENP |= (pageResponse[4] & 0x04) == 0x04; + decoded.DQue |= (pageResponse[3] & 0x01) == 0x01; + decoded.EECA |= (pageResponse[4] & 0x80) == 0x80; + decoded.RAENP |= (pageResponse[4] & 0x04) == 0x04; decoded.UAAENP |= (pageResponse[4] & 0x02) == 0x02; - decoded.EAENP |= (pageResponse[4] & 0x01) == 0x01; + decoded.EAENP |= (pageResponse[4] & 0x01) == 0x01; decoded.ReadyAENHoldOffPeriod = (ushort)((pageResponse[6] << 8) + pageResponse[7]); @@ -195,30 +195,30 @@ namespace DiscImageChef.Decoders.SCSI // SPC-1 decoded.GLTSD |= (pageResponse[2] & 0x02) == 0x02; - decoded.RAC |= (pageResponse[4] & 0x40) == 0x40; - decoded.SWP |= (pageResponse[4] & 0x08) == 0x08; + decoded.RAC |= (pageResponse[4] & 0x40) == 0x40; + decoded.SWP |= (pageResponse[4] & 0x08) == 0x08; decoded.BusyTimeoutPeriod = (ushort)((pageResponse[8] << 8) + pageResponse[9]); // SPC-2 - decoded.TST = (byte)((pageResponse[2] & 0xE0) >> 5); - decoded.TAS |= (pageResponse[4] & 0x80) == 0x80; - decoded.AutoloadMode = (byte)(pageResponse[5] & 0x07); - decoded.BusyTimeoutPeriod = (ushort)((pageResponse[10] << 8) + pageResponse[11]); + decoded.TST = (byte)((pageResponse[2] & 0xE0) >> 5); + decoded.TAS |= (pageResponse[4] & 0x80) == 0x80; + decoded.AutoloadMode = (byte)(pageResponse[5] & 0x07); + decoded.BusyTimeoutPeriod = (ushort)((pageResponse[10] << 8) + pageResponse[11]); // SPC-3 - decoded.TMF_ONLY |= (pageResponse[2] & 0x10) == 0x10; - decoded.D_SENSE |= (pageResponse[2] & 0x04) == 0x04; - decoded.UA_INTLCK_CTRL = (byte)((pageResponse[4] & 0x30) >> 4); - decoded.TAS |= (pageResponse[5] & 0x40) == 0x40; - decoded.ATO |= (pageResponse[5] & 0x80) == 0x80; + decoded.TMF_ONLY |= (pageResponse[2] & 0x10) == 0x10; + decoded.D_SENSE |= (pageResponse[2] & 0x04) == 0x04; + decoded.UA_INTLCK_CTRL = (byte)((pageResponse[4] & 0x30) >> 4); + decoded.TAS |= (pageResponse[5] & 0x40) == 0x40; + decoded.ATO |= (pageResponse[5] & 0x80) == 0x80; // SPC-5 decoded.DPICZ |= (pageResponse[2] & 0x08) == 0x08; - decoded.NUAR |= (pageResponse[3] & 0x08) == 0x08; + decoded.NUAR |= (pageResponse[3] & 0x08) == 0x08; decoded.ATMPE |= (pageResponse[5] & 0x20) == 0x20; - decoded.RWWP |= (pageResponse[5] & 0x10) == 0x10; - decoded.SBLP |= (pageResponse[5] & 0x08) == 0x08; + decoded.RWWP |= (pageResponse[5] & 0x10) == 0x10; + decoded.SBLP |= (pageResponse[5] & 0x08) == 0x08; return decoded; } @@ -232,8 +232,8 @@ namespace DiscImageChef.Decoders.SCSI { if(!modePage.HasValue) return null; - ModePage_0A page = modePage.Value; - StringBuilder sb = new StringBuilder(); + ModePage_0A page = modePage.Value; + StringBuilder sb = new StringBuilder(); sb.AppendLine("SCSI Control mode page:"); @@ -412,8 +412,8 @@ namespace DiscImageChef.Decoders.SCSI decoded.PS |= (pageResponse[0] & 0x80) == 0x80; decoded.IALUAE |= (pageResponse[4] & 0x01) == 0x01; - decoded.SCSIP |= (pageResponse[4] & 0x02) == 0x02; - decoded.TCMOS |= (pageResponse[4] & 0x04) == 0x04; + decoded.SCSIP |= (pageResponse[4] & 0x02) == 0x02; + decoded.TCMOS |= (pageResponse[4] & 0x04) == 0x04; decoded.InitialPriority = (byte)(pageResponse[5] & 0x0F); @@ -430,7 +430,7 @@ namespace DiscImageChef.Decoders.SCSI if(!modePage.HasValue) return null; ModePage_0A_S01 page = modePage.Value; - StringBuilder sb = new StringBuilder(); + StringBuilder sb = new StringBuilder(); sb.AppendLine("SCSI Control extension page:"); diff --git a/DiscImageChef.Decoders/SCSI/Modes/0B.cs b/DiscImageChef.Decoders/SCSI/Modes/0B.cs index 0673c674b..b5b753ba8 100644 --- a/DiscImageChef.Decoders/SCSI/Modes/0B.cs +++ b/DiscImageChef.Decoders/SCSI/Modes/0B.cs @@ -70,11 +70,11 @@ namespace DiscImageChef.Decoders.SCSI ModePage_0B decoded = new ModePage_0B(); - decoded.PS |= (pageResponse[0] & 0x80) == 0x80; - decoded.MediumType1 = (MediumTypes)pageResponse[4]; - decoded.MediumType2 = (MediumTypes)pageResponse[5]; - decoded.MediumType3 = (MediumTypes)pageResponse[6]; - decoded.MediumType4 = (MediumTypes)pageResponse[7]; + decoded.PS |= (pageResponse[0] & 0x80) == 0x80; + decoded.MediumType1 = (MediumTypes)pageResponse[4]; + decoded.MediumType2 = (MediumTypes)pageResponse[5]; + decoded.MediumType3 = (MediumTypes)pageResponse[6]; + decoded.MediumType4 = (MediumTypes)pageResponse[7]; return decoded; } @@ -88,8 +88,8 @@ namespace DiscImageChef.Decoders.SCSI { if(!modePage.HasValue) return null; - ModePage_0B page = modePage.Value; - StringBuilder sb = new StringBuilder(); + ModePage_0B page = modePage.Value; + StringBuilder sb = new StringBuilder(); sb.AppendLine("SCSI Medium types supported page:"); diff --git a/DiscImageChef.Decoders/SCSI/Modes/0D.cs b/DiscImageChef.Decoders/SCSI/Modes/0D.cs index 9a52eadf4..edae3552e 100644 --- a/DiscImageChef.Decoders/SCSI/Modes/0D.cs +++ b/DiscImageChef.Decoders/SCSI/Modes/0D.cs @@ -78,10 +78,10 @@ namespace DiscImageChef.Decoders.SCSI ModePage_0D decoded = new ModePage_0D(); - decoded.PS |= (pageResponse[0] & 0x80) == 0x80; - decoded.InactivityTimerMultiplier = (byte)(pageResponse[3] & 0xF); - decoded.SecondsPerMinute = (ushort)((pageResponse[4] << 8) + pageResponse[5]); - decoded.FramesPerSecond = (ushort)((pageResponse[6] << 8) + pageResponse[7]); + decoded.PS |= (pageResponse[0] & 0x80) == 0x80; + decoded.InactivityTimerMultiplier = (byte)(pageResponse[3] & 0xF); + decoded.SecondsPerMinute = (ushort)((pageResponse[4] << 8) + pageResponse[5]); + decoded.FramesPerSecond = (ushort)((pageResponse[6] << 8) + pageResponse[7]); return decoded; } @@ -95,8 +95,8 @@ namespace DiscImageChef.Decoders.SCSI { if(!modePage.HasValue) return null; - ModePage_0D page = modePage.Value; - StringBuilder sb = new StringBuilder(); + ModePage_0D page = modePage.Value; + StringBuilder sb = new StringBuilder(); sb.AppendLine("SCSI CD-ROM parameters page:"); diff --git a/DiscImageChef.Decoders/SCSI/Modes/0E.cs b/DiscImageChef.Decoders/SCSI/Modes/0E.cs index 404a5712c..2c27c014a 100644 --- a/DiscImageChef.Decoders/SCSI/Modes/0E.cs +++ b/DiscImageChef.Decoders/SCSI/Modes/0E.cs @@ -118,20 +118,20 @@ namespace DiscImageChef.Decoders.SCSI ModePage_0E decoded = new ModePage_0E(); - decoded.PS |= (pageResponse[0] & 0x80) == 0x80; - decoded.Immed |= (pageResponse[2] & 0x04) == 0x04; - decoded.SOTC |= (pageResponse[2] & 0x02) == 0x02; - decoded.APRVal |= (pageResponse[5] & 0x80) == 0x80; - decoded.LBAFormat = (byte)(pageResponse[5] & 0x0F); - decoded.BlocksPerSecondOfAudio = (ushort)((pageResponse[6] << 8) + pageResponse[7]); - decoded.OutputPort0ChannelSelection = (byte)(pageResponse[8] & 0x0F); - decoded.OutputPort0Volume = pageResponse[9]; - decoded.OutputPort1ChannelSelection = (byte)(pageResponse[10] & 0x0F); - decoded.OutputPort1Volume = pageResponse[11]; - decoded.OutputPort2ChannelSelection = (byte)(pageResponse[12] & 0x0F); - decoded.OutputPort2Volume = pageResponse[13]; - decoded.OutputPort3ChannelSelection = (byte)(pageResponse[14] & 0x0F); - decoded.OutputPort3Volume = pageResponse[15]; + decoded.PS |= (pageResponse[0] & 0x80) == 0x80; + decoded.Immed |= (pageResponse[2] & 0x04) == 0x04; + decoded.SOTC |= (pageResponse[2] & 0x02) == 0x02; + decoded.APRVal |= (pageResponse[5] & 0x80) == 0x80; + decoded.LBAFormat = (byte)(pageResponse[5] & 0x0F); + decoded.BlocksPerSecondOfAudio = (ushort)((pageResponse[6] << 8) + pageResponse[7]); + decoded.OutputPort0ChannelSelection = (byte)(pageResponse[8] & 0x0F); + decoded.OutputPort0Volume = pageResponse[9]; + decoded.OutputPort1ChannelSelection = (byte)(pageResponse[10] & 0x0F); + decoded.OutputPort1Volume = pageResponse[11]; + decoded.OutputPort2ChannelSelection = (byte)(pageResponse[12] & 0x0F); + decoded.OutputPort2Volume = pageResponse[13]; + decoded.OutputPort3ChannelSelection = (byte)(pageResponse[14] & 0x0F); + decoded.OutputPort3Volume = pageResponse[15]; return decoded; } @@ -145,8 +145,8 @@ namespace DiscImageChef.Decoders.SCSI { if(!modePage.HasValue) return null; - ModePage_0E page = modePage.Value; - StringBuilder sb = new StringBuilder(); + ModePage_0E page = modePage.Value; + StringBuilder sb = new StringBuilder(); sb.AppendLine("SCSI CD-ROM audio control parameters page:"); @@ -160,7 +160,7 @@ namespace DiscImageChef.Decoders.SCSI { double blocks; if(page.LBAFormat == 8) blocks = page.BlocksPerSecondOfAudio * (1 / 256); - else blocks = page.BlocksPerSecondOfAudio; + else blocks = page.BlocksPerSecondOfAudio; sb.AppendFormat("\tThere are {0} blocks per each second of audio", blocks).AppendLine(); } diff --git a/DiscImageChef.Decoders/SCSI/Modes/0F.cs b/DiscImageChef.Decoders/SCSI/Modes/0F.cs index b46f4caa5..52ac20b5a 100644 --- a/DiscImageChef.Decoders/SCSI/Modes/0F.cs +++ b/DiscImageChef.Decoders/SCSI/Modes/0F.cs @@ -95,12 +95,12 @@ namespace DiscImageChef.Decoders.SCSI decoded.DCE |= (pageResponse[2] & 0x80) == 0x80; decoded.DCC |= (pageResponse[2] & 0x40) == 0x40; decoded.DDE |= (pageResponse[3] & 0x80) == 0x80; - decoded.RED = (byte)((pageResponse[3] & 0x60) >> 5); + 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]); + (pageResponse[6] << 8) + pageResponse[7]); + decoded.DecompressionAlgo = (uint)((pageResponse[8] << 24) + (pageResponse[9] << 16) + + (pageResponse[10] << 8) + pageResponse[11]); return decoded; } @@ -114,8 +114,8 @@ namespace DiscImageChef.Decoders.SCSI { if(!modePage.HasValue) return null; - ModePage_0F page = modePage.Value; - StringBuilder sb = new StringBuilder(); + ModePage_0F page = modePage.Value; + StringBuilder sb = new StringBuilder(); sb.AppendLine("SCSI Data compression page:"); diff --git a/DiscImageChef.Decoders/SCSI/Modes/10.cs b/DiscImageChef.Decoders/SCSI/Modes/10.cs index d0821049f..812a943ed 100644 --- a/DiscImageChef.Decoders/SCSI/Modes/10.cs +++ b/DiscImageChef.Decoders/SCSI/Modes/10.cs @@ -92,9 +92,9 @@ namespace DiscImageChef.Decoders.SCSI 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]); + (pageResponse[14] << 8) + pageResponse[15]); decoded.MaxRebuildRead = (uint)((pageResponse[16] << 24) + (pageResponse[17] << 16) + - (pageResponse[18] << 8) + pageResponse[19]); + (pageResponse[18] << 8) + pageResponse[19]); decoded.RebuildDelay = (ushort)((pageResponse[22] << 8) + pageResponse[23]); return decoded; @@ -109,8 +109,8 @@ namespace DiscImageChef.Decoders.SCSI { if(!modePage.HasValue) return null; - ModePage_10 page = modePage.Value; - StringBuilder sb = new StringBuilder(); + ModePage_10 page = modePage.Value; + StringBuilder sb = new StringBuilder(); sb.AppendLine("SCSI XOR control mode page:"); diff --git a/DiscImageChef.Decoders/SCSI/Modes/10_SSC.cs b/DiscImageChef.Decoders/SCSI/Modes/10_SSC.cs index 4b1f1328e..4403711b0 100644 --- a/DiscImageChef.Decoders/SCSI/Modes/10_SSC.cs +++ b/DiscImageChef.Decoders/SCSI/Modes/10_SSC.cs @@ -176,39 +176,39 @@ namespace DiscImageChef.Decoders.SCSI ModePage_10_SSC decoded = new ModePage_10_SSC(); - decoded.PS |= (pageResponse[0] & 0x80) == 0x80; - decoded.CAP |= (pageResponse[2] & 0x40) == 0x40; - decoded.CAF |= (pageResponse[2] & 0x20) == 0x20; - decoded.ActiveFormat = (byte)(pageResponse[2] & 0x1F); - decoded.ActivePartition = pageResponse[3]; - decoded.WriteBufferFullRatio = pageResponse[4]; - decoded.ReadBufferEmptyRatio = pageResponse[5]; - decoded.WriteDelayTime = (ushort)((pageResponse[6] << 8) + pageResponse[7]); - decoded.DBR |= (pageResponse[8] & 0x80) == 0x80; - decoded.BIS |= (pageResponse[8] & 0x40) == 0x40; - decoded.RSmk |= (pageResponse[8] & 0x20) == 0x20; - decoded.AVC |= (pageResponse[8] & 0x10) == 0x10; - decoded.RBO |= (pageResponse[8] & 0x02) == 0x02; - decoded.REW |= (pageResponse[8] & 0x01) == 0x01; - decoded.EEG |= (pageResponse[10] & 0x10) == 0x10; - decoded.SEW |= (pageResponse[10] & 0x08) == 0x08; - decoded.SOCF = (byte)((pageResponse[8] & 0x0C) >> 2); + decoded.PS |= (pageResponse[0] & 0x80) == 0x80; + decoded.CAP |= (pageResponse[2] & 0x40) == 0x40; + decoded.CAF |= (pageResponse[2] & 0x20) == 0x20; + decoded.ActiveFormat = (byte)(pageResponse[2] & 0x1F); + decoded.ActivePartition = pageResponse[3]; + decoded.WriteBufferFullRatio = pageResponse[4]; + decoded.ReadBufferEmptyRatio = pageResponse[5]; + decoded.WriteDelayTime = (ushort)((pageResponse[6] << 8) + pageResponse[7]); + decoded.DBR |= (pageResponse[8] & 0x80) == 0x80; + decoded.BIS |= (pageResponse[8] & 0x40) == 0x40; + decoded.RSmk |= (pageResponse[8] & 0x20) == 0x20; + decoded.AVC |= (pageResponse[8] & 0x10) == 0x10; + decoded.RBO |= (pageResponse[8] & 0x02) == 0x02; + decoded.REW |= (pageResponse[8] & 0x01) == 0x01; + 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.SelectedCompression = pageResponse[14]; - decoded.SWP |= (pageResponse[10] & 0x04) == 0x04; + decoded.SWP |= (pageResponse[10] & 0x04) == 0x04; decoded.ASOCWP |= (pageResponse[15] & 0x04) == 0x04; decoded.PERSWP |= (pageResponse[15] & 0x02) == 0x02; - decoded.PRMWP |= (pageResponse[15] & 0x01) == 0x01; + decoded.PRMWP |= (pageResponse[15] & 0x01) == 0x01; decoded.BAML |= (pageResponse[10] & 0x02) == 0x02; - decoded.BAM |= (pageResponse[10] & 0x01) == 0x01; + decoded.BAM |= (pageResponse[10] & 0x01) == 0x01; decoded.RewindOnReset = (byte)((pageResponse[15] & 0x18) >> 3); - decoded.OIR |= (pageResponse[15] & 0x20) == 0x20; - decoded.WTRE = (byte)((pageResponse[15] & 0xC0) >> 6); + decoded.OIR |= (pageResponse[15] & 0x20) == 0x20; + decoded.WTRE = (byte)((pageResponse[15] & 0xC0) >> 6); return decoded; } @@ -223,7 +223,7 @@ namespace DiscImageChef.Decoders.SCSI if(!modePage.HasValue) return null; ModePage_10_SSC page = modePage.Value; - StringBuilder sb = new StringBuilder(); + StringBuilder sb = new StringBuilder(); sb.AppendLine("SCSI Device configuration page:"); @@ -236,8 +236,8 @@ namespace DiscImageChef.Decoders.SCSI 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(); + .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"); @@ -245,6 +245,7 @@ namespace DiscImageChef.Decoders.SCSI ? "\tRecovered buffer data comes in LIFO order" : "\tRecovered buffer data comes in FIFO order"); } + if(page.BIS) sb.AppendLine("\tMedium supports block IDs"); if(page.RSmk) sb.AppendLine("\tDrive reports setmarks"); switch(page.SOCF) diff --git a/DiscImageChef.Decoders/SCSI/Modes/11.cs b/DiscImageChef.Decoders/SCSI/Modes/11.cs index bec32a979..46630e133 100644 --- a/DiscImageChef.Decoders/SCSI/Modes/11.cs +++ b/DiscImageChef.Decoders/SCSI/Modes/11.cs @@ -144,22 +144,22 @@ namespace DiscImageChef.Decoders.SCSI decoded.PS |= (pageResponse[0] & 0x80) == 0x80; - decoded.MaxAdditionalPartitions = pageResponse[2]; - decoded.AdditionalPartitionsDefined = pageResponse[3]; - decoded.FDP |= (pageResponse[4] & 0x80) == 0x80; - decoded.SDP |= (pageResponse[4] & 0x40) == 0x40; - decoded.IDP |= (pageResponse[4] & 0x20) == 0x20; - decoded.PSUM = (PartitionSizeUnitOfMeasures)((pageResponse[4] & 0x18) >> 3); - decoded.POFM |= (pageResponse[4] & 0x04) == 0x04; - decoded.CLEAR |= (pageResponse[4] & 0x02) == 0x02; - decoded.ADDP |= (pageResponse[4] & 0x01) == 0x01; - decoded.PartitionUnits = (byte)(pageResponse[6] & 0x0F); - decoded.MediumFormatRecognition = (MediumFormatRecognitionValues)pageResponse[5]; - decoded.PartitionSizes = new ushort[(pageResponse.Length - 8) / 2]; + decoded.MaxAdditionalPartitions = pageResponse[2]; + decoded.AdditionalPartitionsDefined = pageResponse[3]; + decoded.FDP |= (pageResponse[4] & 0x80) == 0x80; + decoded.SDP |= (pageResponse[4] & 0x40) == 0x40; + decoded.IDP |= (pageResponse[4] & 0x20) == 0x20; + decoded.PSUM = (PartitionSizeUnitOfMeasures)((pageResponse[4] & 0x18) >> 3); + decoded.POFM |= (pageResponse[4] & 0x04) == 0x04; + decoded.CLEAR |= (pageResponse[4] & 0x02) == 0x02; + decoded.ADDP |= (pageResponse[4] & 0x01) == 0x01; + decoded.PartitionUnits = (byte)(pageResponse[6] & 0x0F); + decoded.MediumFormatRecognition = (MediumFormatRecognitionValues)pageResponse[5]; + decoded.PartitionSizes = new ushort[(pageResponse.Length - 8) / 2]; for(int i = 8; i < pageResponse.Length; i += 2) { - decoded.PartitionSizes[(i - 8) / 2] = (ushort)(pageResponse[i] << 8); + decoded.PartitionSizes[(i - 8) / 2] = (ushort)(pageResponse[i] << 8); decoded.PartitionSizes[(i - 8) / 2] += pageResponse[i + 1]; } @@ -175,8 +175,8 @@ namespace DiscImageChef.Decoders.SCSI { if(!modePage.HasValue) return null; - ModePage_11 page = modePage.Value; - StringBuilder sb = new StringBuilder(); + ModePage_11 page = modePage.Value; + StringBuilder sb = new StringBuilder(); sb.AppendLine("SCSI medium partition page:"); @@ -251,7 +251,8 @@ namespace DiscImageChef.Decoders.SCSI if(page.PartitionSizes[i] == 0) 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(); diff --git a/DiscImageChef.Decoders/SCSI/Modes/12_13_14.cs b/DiscImageChef.Decoders/SCSI/Modes/12_13_14.cs index c9a2bd369..2c29baa36 100644 --- a/DiscImageChef.Decoders/SCSI/Modes/12_13_14.cs +++ b/DiscImageChef.Decoders/SCSI/Modes/12_13_14.cs @@ -78,7 +78,7 @@ namespace DiscImageChef.Decoders.SCSI for(int i = 2; i < pageResponse.Length; i += 2) { - decoded.PartitionSizes[(i - 2) / 2] = (ushort)(pageResponse[i] << 8); + decoded.PartitionSizes[(i - 2) / 2] = (ushort)(pageResponse[i] << 8); decoded.PartitionSizes[(i - 2) / 2] += pageResponse[i + 1]; } @@ -95,7 +95,7 @@ namespace DiscImageChef.Decoders.SCSI if(!modePage.HasValue) return null; ModePage_12_13_14 page = modePage.Value; - StringBuilder sb = new StringBuilder(); + StringBuilder sb = new StringBuilder(); sb.AppendLine("SCSI medium partition page (extra):"); diff --git a/DiscImageChef.Decoders/SCSI/Modes/1A.cs b/DiscImageChef.Decoders/SCSI/Modes/1A.cs index a50bc5d73..7ba240082 100644 --- a/DiscImageChef.Decoders/SCSI/Modes/1A.cs +++ b/DiscImageChef.Decoders/SCSI/Modes/1A.cs @@ -118,7 +118,7 @@ namespace DiscImageChef.Decoders.SCSI decoded.PS |= (pageResponse[0] & 0x80) == 0x80; decoded.Standby |= (pageResponse[3] & 0x01) == 0x01; - decoded.Idle |= (pageResponse[3] & 0x02) == 0x02; + decoded.Idle |= (pageResponse[3] & 0x02) == 0x02; decoded.IdleTimer = (uint)((pageResponse[4] << 24) + (pageResponse[5] << 16) + (pageResponse[6] << 8) + pageResponse[7]); @@ -127,19 +127,19 @@ namespace DiscImageChef.Decoders.SCSI 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.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]); + (pageResponse[22] << 8) + pageResponse[23]); - decoded.CCF_Idle = (byte)((pageResponse[39] & 0xC0) >> 6); + decoded.CCF_Idle = (byte)((pageResponse[39] & 0xC0) >> 6); decoded.CCF_Standby = (byte)((pageResponse[39] & 0x30) >> 4); decoded.CCF_Stopped = (byte)((pageResponse[39] & 0x0C) >> 2); @@ -155,8 +155,8 @@ namespace DiscImageChef.Decoders.SCSI { if(!modePage.HasValue) return null; - ModePage_1A page = modePage.Value; - StringBuilder sb = new StringBuilder(); + ModePage_1A page = modePage.Value; + StringBuilder sb = new StringBuilder(); sb.AppendLine("SCSI Power condition page:"); @@ -171,7 +171,7 @@ namespace DiscImageChef.Decoders.SCSI } else sb.AppendLine("\tDrive will not enter standy mode"); - if(page.Idle && page.IdleTimer > 0 || page.Idle_B && page.IdleTimer_B > 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) @@ -235,9 +235,9 @@ namespace DiscImageChef.Decoders.SCSI ModePage_1A_S01 decoded = new ModePage_1A_S01(); - decoded.PS |= (pageResponse[0] & 0x80) == 0x80; - decoded.ActiveLevel = (byte)(pageResponse[6] & 0x03); - decoded.PowerConsumptionIdentifier = pageResponse[7]; + decoded.PS |= (pageResponse[0] & 0x80) == 0x80; + decoded.ActiveLevel = (byte)(pageResponse[6] & 0x03); + decoded.PowerConsumptionIdentifier = pageResponse[7]; return decoded; } @@ -252,7 +252,7 @@ namespace DiscImageChef.Decoders.SCSI if(!modePage.HasValue) return null; ModePage_1A_S01 page = modePage.Value; - StringBuilder sb = new StringBuilder(); + StringBuilder sb = new StringBuilder(); sb.AppendLine("SCSI Power Consumption page:"); diff --git a/DiscImageChef.Decoders/SCSI/Modes/1B.cs b/DiscImageChef.Decoders/SCSI/Modes/1B.cs index 5eace4e96..f21049302 100644 --- a/DiscImageChef.Decoders/SCSI/Modes/1B.cs +++ b/DiscImageChef.Decoders/SCSI/Modes/1B.cs @@ -86,11 +86,11 @@ namespace DiscImageChef.Decoders.SCSI ModePage_1B decoded = new ModePage_1B(); - decoded.PS |= (pageResponse[0] & 0x80) == 0x80; + decoded.PS |= (pageResponse[0] & 0x80) == 0x80; decoded.SFLP |= (pageResponse[2] & 0x80) == 0x80; decoded.SRFP |= (pageResponse[2] & 0x40) == 0x40; - decoded.NCD |= (pageResponse[3] & 0x80) == 0x80; - decoded.SML |= (pageResponse[3] & 0x40) == 0x40; + decoded.NCD |= (pageResponse[3] & 0x80) == 0x80; + decoded.SML |= (pageResponse[3] & 0x40) == 0x40; decoded.TLUN = (byte)(pageResponse[3] & 0x07); @@ -106,8 +106,8 @@ namespace DiscImageChef.Decoders.SCSI { if(!modePage.HasValue) return null; - ModePage_1B page = modePage.Value; - StringBuilder sb = new StringBuilder(); + ModePage_1B page = modePage.Value; + StringBuilder sb = new StringBuilder(); sb.AppendLine("SCSI Removable Block Access Capabilities page:"); diff --git a/DiscImageChef.Decoders/SCSI/Modes/1C.cs b/DiscImageChef.Decoders/SCSI/Modes/1C.cs index b8def2bcf..56ad338cf 100644 --- a/DiscImageChef.Decoders/SCSI/Modes/1C.cs +++ b/DiscImageChef.Decoders/SCSI/Modes/1C.cs @@ -110,9 +110,9 @@ namespace DiscImageChef.Decoders.SCSI decoded.PS |= (pageResponse[0] & 0x80) == 0x80; - decoded.Perf |= (pageResponse[2] & 0x80) == 0x80; + decoded.Perf |= (pageResponse[2] & 0x80) == 0x80; decoded.DExcpt |= (pageResponse[2] & 0x08) == 0x08; - decoded.Test |= (pageResponse[2] & 0x04) == 0x04; + decoded.Test |= (pageResponse[2] & 0x04) == 0x04; decoded.LogErr |= (pageResponse[2] & 0x01) == 0x01; decoded.MRIE = (byte)(pageResponse[3] & 0x0F); @@ -120,14 +120,14 @@ namespace DiscImageChef.Decoders.SCSI decoded.IntervalTimer = (uint)((pageResponse[4] << 24) + (pageResponse[5] << 16) + (pageResponse[6] << 8) + pageResponse[7]); - decoded.EBF |= (pageResponse[2] & 0x20) == 0x20; + decoded.EBF |= (pageResponse[2] & 0x20) == 0x20; decoded.EWasc |= (pageResponse[2] & 0x10) == 0x10; 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; } @@ -141,8 +141,8 @@ namespace DiscImageChef.Decoders.SCSI { if(!modePage.HasValue) return null; - ModePage_1C page = modePage.Value; - StringBuilder sb = new StringBuilder(); + ModePage_1C page = modePage.Value; + StringBuilder sb = new StringBuilder(); sb.AppendLine("SCSI Informational exceptions control page:"); @@ -186,8 +186,10 @@ namespace DiscImageChef.Decoders.SCSI 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", @@ -266,14 +268,14 @@ namespace DiscImageChef.Decoders.SCSI decoded.PS |= (pageResponse[0] & 0x80) == 0x80; decoded.S_L_Full |= (pageResponse[4] & 0x04) == 0x04; - decoded.LOWIR |= (pageResponse[4] & 0x02) == 0x02; - decoded.En_Bms |= (pageResponse[4] & 0x01) == 0x01; - decoded.En_Ps |= (pageResponse[5] & 0x01) == 0x01; + decoded.LOWIR |= (pageResponse[4] & 0x02) == 0x02; + decoded.En_Bms |= (pageResponse[4] & 0x01) == 0x01; + decoded.En_Ps |= (pageResponse[5] & 0x01) == 0x01; - decoded.BackgroundScanInterval = (ushort)((pageResponse[6] << 8) + pageResponse[7]); - decoded.BackgroundPrescanTimeLimit = (ushort)((pageResponse[8] << 8) + pageResponse[9]); - decoded.MinIdleBeforeBgScan = (ushort)((pageResponse[10] << 8) + pageResponse[11]); - decoded.MaxTimeSuspendBgScan = (ushort)((pageResponse[12] << 8) + pageResponse[13]); + decoded.BackgroundScanInterval = (ushort)((pageResponse[6] << 8) + pageResponse[7]); + decoded.BackgroundPrescanTimeLimit = (ushort)((pageResponse[8] << 8) + pageResponse[9]); + decoded.MinIdleBeforeBgScan = (ushort)((pageResponse[10] << 8) + pageResponse[11]); + decoded.MaxTimeSuspendBgScan = (ushort)((pageResponse[12] << 8) + pageResponse[13]); return decoded; } @@ -288,7 +290,7 @@ namespace DiscImageChef.Decoders.SCSI if(!modePage.HasValue) return null; ModePage_1C_S01 page = modePage.Value; - StringBuilder sb = new StringBuilder(); + StringBuilder sb = new StringBuilder(); sb.AppendLine("SCSI Background Control page:"); @@ -313,8 +315,8 @@ namespace DiscImageChef.Decoders.SCSI 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(); + .AppendFormat("\tAt most {0} ms must be before suspending a background scan operation and processing received commands", + page.MaxTimeSuspendBgScan).AppendLine(); return sb.ToString(); } diff --git a/DiscImageChef.Decoders/SCSI/Modes/1C_SFF.cs b/DiscImageChef.Decoders/SCSI/Modes/1C_SFF.cs index c943ca902..eed8be82b 100644 --- a/DiscImageChef.Decoders/SCSI/Modes/1C_SFF.cs +++ b/DiscImageChef.Decoders/SCSI/Modes/1C_SFF.cs @@ -78,7 +78,7 @@ namespace DiscImageChef.Decoders.SCSI ModePage_1C_SFF decoded = new ModePage_1C_SFF(); - decoded.PS |= (pageResponse[0] & 0x80) == 0x80; + decoded.PS |= (pageResponse[0] & 0x80) == 0x80; decoded.DISP |= (pageResponse[2] & 0x02) == 0x02; decoded.SWPP |= (pageResponse[3] & 0x01) == 0x01; @@ -97,7 +97,7 @@ namespace DiscImageChef.Decoders.SCSI if(!modePage.HasValue) return null; ModePage_1C_SFF page = modePage.Value; - StringBuilder sb = new StringBuilder(); + StringBuilder sb = new StringBuilder(); sb.AppendLine("SCSI Timer & Protect page:"); diff --git a/DiscImageChef.Decoders/SCSI/Modes/1D.cs b/DiscImageChef.Decoders/SCSI/Modes/1D.cs index 4ddd99742..287add1cb 100644 --- a/DiscImageChef.Decoders/SCSI/Modes/1D.cs +++ b/DiscImageChef.Decoders/SCSI/Modes/1D.cs @@ -64,10 +64,10 @@ namespace DiscImageChef.Decoders.SCSI ModePage_1D decoded = new ModePage_1D(); - decoded.PS |= (pageResponse[0] & 0x80) == 0x80; - decoded.WORMM |= (pageResponse[2] & 0x01) == 0x01; - decoded.WormModeLabelRestrictions = pageResponse[4]; - decoded.WormModeFilemarkRestrictions = pageResponse[5]; + decoded.PS |= (pageResponse[0] & 0x80) == 0x80; + decoded.WORMM |= (pageResponse[2] & 0x01) == 0x01; + decoded.WormModeLabelRestrictions = pageResponse[4]; + decoded.WormModeFilemarkRestrictions = pageResponse[5]; return decoded; } @@ -81,8 +81,8 @@ namespace DiscImageChef.Decoders.SCSI { if(!modePage.HasValue) return null; - ModePage_1D page = modePage.Value; - StringBuilder sb = new StringBuilder(); + ModePage_1D page = modePage.Value; + StringBuilder sb = new StringBuilder(); sb.AppendLine("SCSI Medium Configuration Mode Page:"); diff --git a/DiscImageChef.Decoders/SCSI/Modes/21_Certance.cs b/DiscImageChef.Decoders/SCSI/Modes/21_Certance.cs index f9ba75d08..4e9d65226 100644 --- a/DiscImageChef.Decoders/SCSI/Modes/21_Certance.cs +++ b/DiscImageChef.Decoders/SCSI/Modes/21_Certance.cs @@ -69,15 +69,15 @@ namespace DiscImageChef.Decoders.SCSI Certance_ModePage_21 decoded = new Certance_ModePage_21(); - decoded.PS |= (pageResponse[0] & 0x80) == 0x80; - decoded.OperatingSystemsSupport = pageResponse[2]; - decoded.FirmwareTestControl2 = pageResponse[3]; - decoded.ExtendedPOSTMode = pageResponse[4]; - decoded.InquiryStringControl = pageResponse[5]; - decoded.FirmwareTestControl = pageResponse[6]; - decoded.DataCompressionControl = pageResponse[7]; - decoded.HostUnloadOverride |= (pageResponse[8] & 0x80) == 0x80; - decoded.AutoUnloadMode = (byte)(pageResponse[8] & 0x7F); + decoded.PS |= (pageResponse[0] & 0x80) == 0x80; + decoded.OperatingSystemsSupport = pageResponse[2]; + decoded.FirmwareTestControl2 = pageResponse[3]; + decoded.ExtendedPOSTMode = pageResponse[4]; + decoded.InquiryStringControl = pageResponse[5]; + decoded.FirmwareTestControl = pageResponse[6]; + decoded.DataCompressionControl = pageResponse[7]; + decoded.HostUnloadOverride |= (pageResponse[8] & 0x80) == 0x80; + decoded.AutoUnloadMode = (byte)(pageResponse[8] & 0x7F); return decoded; } @@ -92,7 +92,7 @@ namespace DiscImageChef.Decoders.SCSI if(!modePage.HasValue) return null; Certance_ModePage_21 page = modePage.Value; - StringBuilder sb = new StringBuilder(); + StringBuilder sb = new StringBuilder(); sb.AppendLine("Certance Drive Capabilities Control Mode Page:"); diff --git a/DiscImageChef.Decoders/SCSI/Modes/22_Certance.cs b/DiscImageChef.Decoders/SCSI/Modes/22_Certance.cs index db1f05687..25aff1f89 100644 --- a/DiscImageChef.Decoders/SCSI/Modes/22_Certance.cs +++ b/DiscImageChef.Decoders/SCSI/Modes/22_Certance.cs @@ -73,18 +73,18 @@ namespace DiscImageChef.Decoders.SCSI Certance_ModePage_22 decoded = new Certance_ModePage_22(); - decoded.PS |= (pageResponse[0] & 0x80) == 0x80; - decoded.BaudRate = pageResponse[2]; - decoded.CmdFwd = (byte)((pageResponse[3] & 0x18) >> 3); - decoded.StopBits |= (pageResponse[3] & 0x04) == 0x04; - decoded.CmdFwd = (byte)(pageResponse[3] & 0x03); - decoded.PortATransportType = pageResponse[4]; - decoded.PortAPresentSelectionID = pageResponse[7]; - decoded.NextSelectionID = pageResponse[12]; - decoded.JumperedSelectionID = pageResponse[13]; - decoded.TargetInitiatedBusControl = pageResponse[14]; - decoded.PortAEnabled |= (pageResponse[15] & 0x10) == 0x10; - decoded.PortAEnabledOnPower |= (pageResponse[15] & 0x04) == 0x04; + decoded.PS |= (pageResponse[0] & 0x80) == 0x80; + decoded.BaudRate = pageResponse[2]; + decoded.CmdFwd = (byte)((pageResponse[3] & 0x18) >> 3); + decoded.StopBits |= (pageResponse[3] & 0x04) == 0x04; + decoded.CmdFwd = (byte)(pageResponse[3] & 0x03); + decoded.PortATransportType = pageResponse[4]; + decoded.PortAPresentSelectionID = pageResponse[7]; + decoded.NextSelectionID = pageResponse[12]; + decoded.JumperedSelectionID = pageResponse[13]; + decoded.TargetInitiatedBusControl = pageResponse[14]; + decoded.PortAEnabled |= (pageResponse[15] & 0x10) == 0x10; + decoded.PortAEnabledOnPower |= (pageResponse[15] & 0x04) == 0x04; return decoded; } @@ -99,7 +99,7 @@ namespace DiscImageChef.Decoders.SCSI if(!modePage.HasValue) return null; Certance_ModePage_22 page = modePage.Value; - StringBuilder sb = new StringBuilder(); + StringBuilder sb = new StringBuilder(); sb.AppendLine("Certance Interface Control Mode Page:"); diff --git a/DiscImageChef.Decoders/SCSI/Modes/24_IBM.cs b/DiscImageChef.Decoders/SCSI/Modes/24_IBM.cs index 0f7f8c8f4..f0e88a843 100644 --- a/DiscImageChef.Decoders/SCSI/Modes/24_IBM.cs +++ b/DiscImageChef.Decoders/SCSI/Modes/24_IBM.cs @@ -65,9 +65,9 @@ namespace DiscImageChef.Decoders.SCSI IBM_ModePage_24 decoded = new IBM_ModePage_24(); - decoded.PS |= (pageResponse[0] & 0x80) == 0x80; - decoded.ModeControl = pageResponse[2]; - decoded.VelocitySetting = pageResponse[3]; + decoded.PS |= (pageResponse[0] & 0x80) == 0x80; + decoded.ModeControl = pageResponse[2]; + decoded.VelocitySetting = pageResponse[3]; decoded.EncryptionEnabled |= (pageResponse[7] & 0x08) == 0x08; decoded.EncryptionCapable |= (pageResponse[7] & 0x01) == 0x01; @@ -84,13 +84,13 @@ namespace DiscImageChef.Decoders.SCSI if(!modePage.HasValue) return null; IBM_ModePage_24 page = modePage.Value; - StringBuilder sb = new StringBuilder(); + StringBuilder sb = new StringBuilder(); sb.AppendLine("IBM Vendor-Specific Control Mode Page:"); if(page.PS) sb.AppendLine("\tParameters can be saved"); - sb.AppendFormat("\tVendor-specific mode control: {0}", page.ModeControl); + sb.AppendFormat("\tVendor-specific mode control: {0}", page.ModeControl); sb.AppendFormat("\tVendor-specific velocity setting: {0}", page.VelocitySetting); if(!page.EncryptionCapable) return sb.ToString(); diff --git a/DiscImageChef.Decoders/SCSI/Modes/2A.cs b/DiscImageChef.Decoders/SCSI/Modes/2A.cs index 0758a29e1..e1a732e3d 100644 --- a/DiscImageChef.Decoders/SCSI/Modes/2A.cs +++ b/DiscImageChef.Decoders/SCSI/Modes/2A.cs @@ -162,30 +162,30 @@ namespace DiscImageChef.Decoders.SCSI public bool RCK; public bool BCK; - public bool TestWrite; + public bool TestWrite; public ushort MaxWriteSpeed; public ushort CurrentWriteSpeed; public bool ReadBarcode; - public bool ReadDVDRAM; - public bool ReadDVDR; - public bool ReadDVDROM; - public bool WriteDVDRAM; - public bool WriteDVDR; - public bool LeadInPW; - public bool SCC; + public bool ReadDVDRAM; + public bool ReadDVDR; + public bool ReadDVDROM; + public bool WriteDVDRAM; + public bool WriteDVDR; + public bool LeadInPW; + public bool SCC; public ushort CMRSupported; - public bool BUF; - public byte RotationControlSelected; - public ushort CurrentWriteSpeedSelected; + public bool BUF; + public byte RotationControlSelected; + public ushort CurrentWriteSpeedSelected; public ModePage_2A_WriteDescriptor[] WriteSpeedPerformanceDescriptors; } public struct ModePage_2A_WriteDescriptor { - public byte RotationControl; + public byte RotationControl; public ushort WriteSpeed; } @@ -203,81 +203,81 @@ namespace DiscImageChef.Decoders.SCSI decoded.PS |= (pageResponse[0] & 0x80) == 0x80; - decoded.AudioPlay |= (pageResponse[4] & 0x01) == 0x01; - decoded.Mode2Form1 |= (pageResponse[4] & 0x10) == 0x10; - decoded.Mode2Form2 |= (pageResponse[4] & 0x20) == 0x20; + decoded.AudioPlay |= (pageResponse[4] & 0x01) == 0x01; + decoded.Mode2Form1 |= (pageResponse[4] & 0x10) == 0x10; + decoded.Mode2Form2 |= (pageResponse[4] & 0x20) == 0x20; decoded.MultiSession |= (pageResponse[4] & 0x40) == 0x40; - decoded.CDDACommand |= (pageResponse[5] & 0x01) == 0x01; - decoded.AccurateCDDA |= (pageResponse[5] & 0x02) == 0x02; - decoded.Subchannel |= (pageResponse[5] & 0x04) == 0x04; + decoded.CDDACommand |= (pageResponse[5] & 0x01) == 0x01; + decoded.AccurateCDDA |= (pageResponse[5] & 0x02) == 0x02; + decoded.Subchannel |= (pageResponse[5] & 0x04) == 0x04; decoded.DeinterlaveSubchannel |= (pageResponse[5] & 0x08) == 0x08; - decoded.C2Pointer |= (pageResponse[5] & 0x10) == 0x10; - decoded.UPC |= (pageResponse[5] & 0x20) == 0x20; - decoded.ISRC |= (pageResponse[5] & 0x40) == 0x40; + decoded.C2Pointer |= (pageResponse[5] & 0x10) == 0x10; + decoded.UPC |= (pageResponse[5] & 0x20) == 0x20; + decoded.ISRC |= (pageResponse[5] & 0x40) == 0x40; - decoded.LoadingMechanism = (byte)((pageResponse[6] & 0xE0) >> 5); - decoded.Lock |= (pageResponse[6] & 0x01) == 0x01; - decoded.LockState |= (pageResponse[6] & 0x02) == 0x02; - decoded.PreventJumper |= (pageResponse[6] & 0x04) == 0x04; - decoded.Eject |= (pageResponse[6] & 0x08) == 0x08; + decoded.LoadingMechanism = (byte)((pageResponse[6] & 0xE0) >> 5); + decoded.Lock |= (pageResponse[6] & 0x01) == 0x01; + decoded.LockState |= (pageResponse[6] & 0x02) == 0x02; + decoded.PreventJumper |= (pageResponse[6] & 0x04) == 0x04; + decoded.Eject |= (pageResponse[6] & 0x08) == 0x08; decoded.SeparateChannelVolume |= (pageResponse[7] & 0x01) == 0x01; - decoded.SeparateChannelMute |= (pageResponse[7] & 0x02) == 0x02; + decoded.SeparateChannelMute |= (pageResponse[7] & 0x02) == 0x02; - decoded.MaximumSpeed = (ushort)((pageResponse[8] << 8) + pageResponse[9]); + decoded.MaximumSpeed = (ushort)((pageResponse[8] << 8) + pageResponse[9]); decoded.SupportedVolumeLevels = (ushort)((pageResponse[10] << 8) + pageResponse[11]); - decoded.BufferSize = (ushort)((pageResponse[12] << 8) + pageResponse[13]); - decoded.CurrentSpeed = (ushort)((pageResponse[14] << 8) + pageResponse[15]); + decoded.BufferSize = (ushort)((pageResponse[12] << 8) + pageResponse[13]); + decoded.CurrentSpeed = (ushort)((pageResponse[14] << 8) + pageResponse[15]); if(pageResponse.Length < 20) return decoded; - decoded.Method2 |= (pageResponse[2] & 0x04) == 0x04; + decoded.Method2 |= (pageResponse[2] & 0x04) == 0x04; decoded.ReadCDRW |= (pageResponse[2] & 0x02) == 0x02; - decoded.ReadCDR |= (pageResponse[2] & 0x01) == 0x01; + decoded.ReadCDR |= (pageResponse[2] & 0x01) == 0x01; decoded.WriteCDRW |= (pageResponse[3] & 0x02) == 0x02; - decoded.WriteCDR |= (pageResponse[3] & 0x01) == 0x01; + decoded.WriteCDR |= (pageResponse[3] & 0x01) == 0x01; - decoded.Composite |= (pageResponse[4] & 0x02) == 0x02; + decoded.Composite |= (pageResponse[4] & 0x02) == 0x02; decoded.DigitalPort1 |= (pageResponse[4] & 0x04) == 0x04; decoded.DigitalPort2 |= (pageResponse[4] & 0x08) == 0x08; decoded.SDP |= (pageResponse[7] & 0x04) == 0x04; decoded.SSS |= (pageResponse[7] & 0x08) == 0x08; - decoded.Length = (byte)((pageResponse[17] & 0x30) >> 4); - decoded.LSBF |= (pageResponse[17] & 0x08) == 0x08; - decoded.RCK |= (pageResponse[17] & 0x04) == 0x04; - decoded.BCK |= (pageResponse[17] & 0x02) == 0x02; + decoded.Length = (byte)((pageResponse[17] & 0x30) >> 4); + decoded.LSBF |= (pageResponse[17] & 0x08) == 0x08; + decoded.RCK |= (pageResponse[17] & 0x04) == 0x04; + decoded.BCK |= (pageResponse[17] & 0x02) == 0x02; if(pageResponse.Length < 22) return decoded; - decoded.TestWrite |= (pageResponse[3] & 0x04) == 0x04; - decoded.MaxWriteSpeed = (ushort)((pageResponse[18] << 8) + pageResponse[19]); - decoded.CurrentWriteSpeed = (ushort)((pageResponse[20] << 8) + pageResponse[21]); + decoded.TestWrite |= (pageResponse[3] & 0x04) == 0x04; + decoded.MaxWriteSpeed = (ushort)((pageResponse[18] << 8) + pageResponse[19]); + decoded.CurrentWriteSpeed = (ushort)((pageResponse[20] << 8) + pageResponse[21]); decoded.ReadBarcode |= (pageResponse[5] & 0x80) == 0x80; if(pageResponse.Length < 26) return decoded; decoded.ReadDVDRAM |= (pageResponse[2] & 0x20) == 0x20; - decoded.ReadDVDR |= (pageResponse[2] & 0x10) == 0x10; + decoded.ReadDVDR |= (pageResponse[2] & 0x10) == 0x10; decoded.ReadDVDROM |= (pageResponse[2] & 0x08) == 0x08; decoded.WriteDVDRAM |= (pageResponse[3] & 0x20) == 0x20; - decoded.WriteDVDR |= (pageResponse[3] & 0x10) == 0x10; + decoded.WriteDVDR |= (pageResponse[3] & 0x10) == 0x10; decoded.LeadInPW |= (pageResponse[3] & 0x20) == 0x20; - decoded.SCC |= (pageResponse[3] & 0x10) == 0x10; + decoded.SCC |= (pageResponse[3] & 0x10) == 0x10; decoded.CMRSupported = (ushort)((pageResponse[22] << 8) + pageResponse[23]); if(pageResponse.Length < 32) return decoded; - decoded.BUF |= (pageResponse[4] & 0x80) == 0x80; - decoded.RotationControlSelected = (byte)(pageResponse[27] & 0x03); - decoded.CurrentWriteSpeedSelected = (ushort)((pageResponse[28] << 8) + pageResponse[29]); + decoded.BUF |= (pageResponse[4] & 0x80) == 0x80; + decoded.RotationControlSelected = (byte)(pageResponse[27] & 0x03); + decoded.CurrentWriteSpeedSelected = (ushort)((pageResponse[28] << 8) + pageResponse[29]); ushort descriptors = (ushort)((pageResponse.Length - 32) / 4); decoded.WriteSpeedPerformanceDescriptors = new ModePage_2A_WriteDescriptor[descriptors]; @@ -285,7 +285,8 @@ namespace DiscImageChef.Decoders.SCSI for(int i = 0; i < descriptors; i++) decoded.WriteSpeedPerformanceDescriptors[i] = new ModePage_2A_WriteDescriptor { - RotationControl = (byte)(pageResponse[1 + 32 + i * 4] & 0x07), + RotationControl = + (byte)(pageResponse[1 + 32 + i * 4] & 0x07), WriteSpeed = (ushort)((pageResponse[2 + 32 + i * 4] << 8) + pageResponse[3 + 32 + i * 4]) }; @@ -301,8 +302,8 @@ namespace DiscImageChef.Decoders.SCSI { if(!modePage.HasValue) return null; - ModePage_2A page = modePage.Value; - StringBuilder sb = new StringBuilder(); + ModePage_2A page = modePage.Value; + StringBuilder sb = new StringBuilder(); sb.AppendLine("SCSI CD-ROM capabilities page:"); @@ -356,6 +357,7 @@ namespace DiscImageChef.Decoders.SCSI sb.AppendLine(page.LockState ? "\tDrive is locked, media cannot be ejected, but if empty, can be inserted" : "\tDrive is not locked, media can be ejected and inserted"); + if(page.Eject) sb.AppendLine("\tDrive can eject media"); if(page.SeparateChannelMute) sb.AppendLine("\tEach channel can be muted independently"); diff --git a/DiscImageChef.Decoders/SCSI/Modes/2F_IBM.cs b/DiscImageChef.Decoders/SCSI/Modes/2F_IBM.cs index a34128dd9..f375e5c33 100644 --- a/DiscImageChef.Decoders/SCSI/Modes/2F_IBM.cs +++ b/DiscImageChef.Decoders/SCSI/Modes/2F_IBM.cs @@ -73,17 +73,17 @@ namespace DiscImageChef.Decoders.SCSI return new IBM_ModePage_2F { - PS = (pageResponse[0] & 0x80) == 0x80, - FenceBehaviour = pageResponse[2], - CleanBehaviour = pageResponse[3], - WORMEmulation = pageResponse[4], - SenseDataBehaviour = pageResponse[5], - CCDM = (pageResponse[6] & 0x04) == 0x04, - DDEOR = (pageResponse[6] & 0x02) == 0x02, - CLNCHK = (pageResponse[6] & 0x01) == 0x01, + PS = (pageResponse[0] & 0x80) == 0x80, + FenceBehaviour = pageResponse[2], + CleanBehaviour = pageResponse[3], + WORMEmulation = pageResponse[4], + SenseDataBehaviour = pageResponse[5], + CCDM = (pageResponse[6] & 0x04) == 0x04, + DDEOR = (pageResponse[6] & 0x02) == 0x02, + CLNCHK = (pageResponse[6] & 0x01) == 0x01, FirmwareUpdateBehaviour = pageResponse[7], - UOE_C = (byte)((pageResponse[8] & 0x30) >> 4), - UOE_F = (byte)((pageResponse[8] & 0x0C) >> 2) + UOE_C = (byte)((pageResponse[8] & 0x30) >> 4), + UOE_F = (byte)((pageResponse[8] & 0x0C) >> 2) }; } @@ -97,7 +97,7 @@ namespace DiscImageChef.Decoders.SCSI if(!modePage.HasValue) return null; IBM_ModePage_2F page = modePage.Value; - StringBuilder sb = new StringBuilder(); + StringBuilder sb = new StringBuilder(); sb.AppendLine("IBM Behaviour Configuration Mode Page:"); diff --git a/DiscImageChef.Decoders/SCSI/Modes/3B_HP.cs b/DiscImageChef.Decoders/SCSI/Modes/3B_HP.cs index 0ea4b412a..37f4dded2 100644 --- a/DiscImageChef.Decoders/SCSI/Modes/3B_HP.cs +++ b/DiscImageChef.Decoders/SCSI/Modes/3B_HP.cs @@ -48,7 +48,7 @@ namespace DiscImageChef.Decoders.SCSI /// Parameters can be saved /// public bool PS; - public byte MSN; + public byte MSN; public byte[] SerialNumber; } @@ -64,9 +64,9 @@ namespace DiscImageChef.Decoders.SCSI HP_ModePage_3B decoded = new HP_ModePage_3B(); - decoded.PS |= (pageResponse[0] & 0x80) == 0x80; - decoded.MSN = (byte)(pageResponse[2] & 0x03); - decoded.SerialNumber = new byte[10]; + decoded.PS |= (pageResponse[0] & 0x80) == 0x80; + decoded.MSN = (byte)(pageResponse[2] & 0x03); + decoded.SerialNumber = new byte[10]; Array.Copy(pageResponse, 6, decoded.SerialNumber, 0, 10); return decoded; @@ -82,7 +82,7 @@ namespace DiscImageChef.Decoders.SCSI if(!modePage.HasValue) return null; HP_ModePage_3B page = modePage.Value; - StringBuilder sb = new StringBuilder(); + StringBuilder sb = new StringBuilder(); sb.AppendLine("HP Serial Number Override Mode Page:"); diff --git a/DiscImageChef.Decoders/SCSI/Modes/3C_HP.cs b/DiscImageChef.Decoders/SCSI/Modes/3C_HP.cs index b1407154d..27e836d7a 100644 --- a/DiscImageChef.Decoders/SCSI/Modes/3C_HP.cs +++ b/DiscImageChef.Decoders/SCSI/Modes/3C_HP.cs @@ -48,18 +48,18 @@ namespace DiscImageChef.Decoders.SCSI /// Parameters can be saved /// public bool PS; - public bool LT; - public bool WT; - public bool PT; + public bool LT; + public bool WT; + public bool PT; public ushort CurrentPowerOn; - public uint PowerOnTime; - public bool UTC; - public bool NTP; - public uint WorldTime; - public byte LibraryHours; - public byte LibraryMinutes; - public byte LibrarySeconds; - public uint CumulativePowerOn; + public uint PowerOnTime; + public bool UTC; + public bool NTP; + public uint WorldTime; + public byte LibraryHours; + public byte LibraryMinutes; + public byte LibrarySeconds; + public uint CumulativePowerOn; } public static HP_ModePage_3C? DecodeHPModePage_3C(byte[] pageResponse) @@ -74,22 +74,22 @@ namespace DiscImageChef.Decoders.SCSI HP_ModePage_3C decoded = new HP_ModePage_3C(); - decoded.PS |= (pageResponse[0] & 0x80) == 0x80; - decoded.LT |= (pageResponse[2] & 0x04) == 0x04; - decoded.WT |= (pageResponse[2] & 0x02) == 0x02; - decoded.PT |= (pageResponse[2] & 0x01) == 0x01; - decoded.CurrentPowerOn = (ushort)((pageResponse[6] << 8) + pageResponse[7]); + decoded.PS |= (pageResponse[0] & 0x80) == 0x80; + decoded.LT |= (pageResponse[2] & 0x04) == 0x04; + 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.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.LibraryHours = pageResponse[23]; + 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]); + (pageResponse[34] << 8) + pageResponse[35]); return decoded; } @@ -104,7 +104,7 @@ namespace DiscImageChef.Decoders.SCSI if(!modePage.HasValue) return null; HP_ModePage_3C page = modePage.Value; - StringBuilder sb = new StringBuilder(); + StringBuilder sb = new StringBuilder(); sb.AppendLine("HP Device Time Mode Page:"); diff --git a/DiscImageChef.Decoders/SCSI/Modes/3D_HP.cs b/DiscImageChef.Decoders/SCSI/Modes/3D_HP.cs index 7239a3a9d..ee028706b 100644 --- a/DiscImageChef.Decoders/SCSI/Modes/3D_HP.cs +++ b/DiscImageChef.Decoders/SCSI/Modes/3D_HP.cs @@ -62,8 +62,8 @@ namespace DiscImageChef.Decoders.SCSI HP_ModePage_3D decoded = new HP_ModePage_3D(); - decoded.PS |= (pageResponse[0] & 0x80) == 0x80; - decoded.ResetBehaviour = (byte)(pageResponse[2] & 0x03); + decoded.PS |= (pageResponse[0] & 0x80) == 0x80; + decoded.ResetBehaviour = (byte)(pageResponse[2] & 0x03); return decoded; } @@ -78,7 +78,7 @@ namespace DiscImageChef.Decoders.SCSI if(!modePage.HasValue) return null; HP_ModePage_3D page = modePage.Value; - StringBuilder sb = new StringBuilder(); + StringBuilder sb = new StringBuilder(); sb.AppendLine("HP Extended Reset Mode Page:"); diff --git a/DiscImageChef.Decoders/SCSI/Modes/3D_IBM.cs b/DiscImageChef.Decoders/SCSI/Modes/3D_IBM.cs index 417401bed..fbd13328f 100644 --- a/DiscImageChef.Decoders/SCSI/Modes/3D_IBM.cs +++ b/DiscImageChef.Decoders/SCSI/Modes/3D_IBM.cs @@ -62,8 +62,8 @@ namespace DiscImageChef.Decoders.SCSI IBM_ModePage_3D decoded = new IBM_ModePage_3D(); - decoded.PS |= (pageResponse[0] & 0x80) == 0x80; - decoded.NumberOfWraps = (ushort)((pageResponse[3] << 8) + pageResponse[4]); + decoded.PS |= (pageResponse[0] & 0x80) == 0x80; + decoded.NumberOfWraps = (ushort)((pageResponse[3] << 8) + pageResponse[4]); return decoded; } @@ -78,7 +78,7 @@ namespace DiscImageChef.Decoders.SCSI if(!modePage.HasValue) return null; IBM_ModePage_3D page = modePage.Value; - StringBuilder sb = new StringBuilder(); + StringBuilder sb = new StringBuilder(); sb.AppendLine("IBM LEOT Mode Page:"); diff --git a/DiscImageChef.Decoders/SCSI/Modes/3E_Fujitsu.cs b/DiscImageChef.Decoders/SCSI/Modes/3E_Fujitsu.cs index 430cb7b7a..0feb3b92e 100644 --- a/DiscImageChef.Decoders/SCSI/Modes/3E_Fujitsu.cs +++ b/DiscImageChef.Decoders/SCSI/Modes/3E_Fujitsu.cs @@ -102,12 +102,12 @@ namespace DiscImageChef.Decoders.SCSI decoded.PS |= (pageResponse[0] & 0x80) == 0x80; decoded.audioVisualMode |= (pageResponse[2] & 0x80) == 0x80; - decoded.streamingMode |= (pageResponse[2] & 0x40) == 0x40; - decoded.Reserved1 = (byte)((pageResponse[2] & 0x3C) >> 2); - decoded.verifyMode = (Fujitsu_VerifyModes)(pageResponse[2] & 0x03); + decoded.streamingMode |= (pageResponse[2] & 0x40) == 0x40; + decoded.Reserved1 = (byte)((pageResponse[2] & 0x3C) >> 2); + decoded.verifyMode = (Fujitsu_VerifyModes)(pageResponse[2] & 0x03); decoded.Reserved2 = (byte)((pageResponse[3] & 0xE0) >> 5); - decoded.devType = (PeripheralDeviceTypes)(pageResponse[3] & 0x1F); + decoded.devType = (PeripheralDeviceTypes)(pageResponse[3] & 0x1F); decoded.Reserved3 = new byte[4]; Array.Copy(pageResponse, 4, decoded.Reserved3, 0, 4); @@ -125,7 +125,7 @@ namespace DiscImageChef.Decoders.SCSI if(!modePage.HasValue) return null; Fujitsu_ModePage_3E page = modePage.Value; - StringBuilder sb = new StringBuilder(); + StringBuilder sb = new StringBuilder(); sb.AppendLine("Fujitsu Verify Control Page:"); diff --git a/DiscImageChef.Decoders/SCSI/Modes/3E_HP.cs b/DiscImageChef.Decoders/SCSI/Modes/3E_HP.cs index 769275946..97118bd29 100644 --- a/DiscImageChef.Decoders/SCSI/Modes/3E_HP.cs +++ b/DiscImageChef.Decoders/SCSI/Modes/3E_HP.cs @@ -63,9 +63,9 @@ namespace DiscImageChef.Decoders.SCSI HP_ModePage_3E decoded = new HP_ModePage_3E(); - decoded.PS |= (pageResponse[0] & 0x80) == 0x80; + 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; } @@ -80,7 +80,7 @@ namespace DiscImageChef.Decoders.SCSI if(!modePage.HasValue) return null; HP_ModePage_3E page = modePage.Value; - StringBuilder sb = new StringBuilder(); + StringBuilder sb = new StringBuilder(); sb.AppendLine("HP CD-ROM Emulation/Disaster Recovery Mode Page:"); diff --git a/DiscImageChef.Decoders/SCSI/Modes/Headers.cs b/DiscImageChef.Decoders/SCSI/Modes/Headers.cs index 569a279c2..adaa112b1 100644 --- a/DiscImageChef.Decoders/SCSI/Modes/Headers.cs +++ b/DiscImageChef.Decoders/SCSI/Modes/Headers.cs @@ -74,16 +74,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: 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_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.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.RO_WORM: return "a combination of read-only and write-once optical"; // These magneto-opticals were never manufactured /* case MediumTypes.RO_RW: @@ -93,7 +93,7 @@ namespace DiscImageChef.Decoders.SCSI return "a combination of write-once and erasable optical"; */ case MediumTypes.DOW: return "a direct-overwrite optical"; - default: return $"Unknown medium type 0x{(byte)type:X2}"; + default: return $"Unknown medium type 0x{(byte)type:X2}"; } } @@ -1415,8 +1415,8 @@ namespace DiscImageChef.Decoders.SCSI if(descriptor.Blocks == 0) if(descriptor.BlockLength == 0) sb - .AppendFormat("\tAll remaining blocks conform to {0} and have a variable length", - density).AppendLine(); + .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(); diff --git a/DiscImageChef.Decoders/SCSI/Modes/Mode10.cs b/DiscImageChef.Decoders/SCSI/Modes/Mode10.cs index 59641ddb9..417c2b508 100644 --- a/DiscImageChef.Decoders/SCSI/Modes/Mode10.cs +++ b/DiscImageChef.Decoders/SCSI/Modes/Mode10.cs @@ -46,7 +46,7 @@ namespace DiscImageChef.Decoders.SCSI { if(modeResponse == null || modeResponse.Length < 8) return null; - ushort modeLength = (ushort)((modeResponse[0] << 8) + modeResponse[1]); + ushort modeLength = (ushort)((modeResponse[0] << 8) + modeResponse[1]); ushort blockDescLength = (ushort)((modeResponse[6] << 8) + modeResponse[7]); if(modeResponse.Length < modeLength) return null; @@ -65,15 +65,15 @@ namespace DiscImageChef.Decoders.SCSI header.BlockDescriptors[i] = new BlockDescriptor {Density = DensityType.Default}; byte[] temp = new byte[8]; - temp[0] = modeResponse[7 + i * 16 + 8]; - temp[1] = modeResponse[6 + i * 16 + 8]; - temp[2] = modeResponse[5 + i * 16 + 8]; - temp[3] = modeResponse[4 + i * 16 + 8]; - temp[4] = modeResponse[3 + i * 16 + 8]; - temp[5] = modeResponse[2 + i * 16 + 8]; - temp[6] = modeResponse[1 + i * 16 + 8]; - temp[7] = modeResponse[0 + i * 16 + 8]; - header.BlockDescriptors[i].Blocks = BitConverter.ToUInt64(temp, 0); + temp[0] = modeResponse[7 + i * 16 + 8]; + temp[1] = modeResponse[6 + i * 16 + 8]; + temp[2] = modeResponse[5 + i * 16 + 8]; + temp[3] = modeResponse[4 + i * 16 + 8]; + temp[4] = modeResponse[3 + i * 16 + 8]; + temp[5] = modeResponse[2 + i * 16 + 8]; + temp[6] = modeResponse[1 + i * 16 + 8]; + temp[7] = modeResponse[0 + i * 16 + 8]; + header.BlockDescriptors[i].Blocks = BitConverter.ToUInt64(temp, 0); header.BlockDescriptors[i].BlockLength += (uint)(modeResponse[15 + i * 16 + 8] << 24); header.BlockDescriptors[i].BlockLength += (uint)(modeResponse[14 + i * 16 + 8] << 16); header.BlockDescriptors[i].BlockLength += (uint)(modeResponse[13 + i * 16 + 8] << 8); @@ -92,12 +92,13 @@ namespace DiscImageChef.Decoders.SCSI header.BlockDescriptors[i].Density = (DensityType)modeResponse[0 + i * 8 + 8]; else { - header.BlockDescriptors[i].Density = DensityType.Default; - header.BlockDescriptors[i].Blocks += (ulong)(modeResponse[0 + i * 8 + 8] << 24); + header.BlockDescriptors[i].Density = DensityType.Default; + header.BlockDescriptors[i].Blocks += (ulong)(modeResponse[0 + i * 8 + 8] << 24); } - header.BlockDescriptors[i].Blocks += (ulong)(modeResponse[1 + i * 8 + 8] << 16); - header.BlockDescriptors[i].Blocks += (ulong)(modeResponse[2 + i * 8 + 8] << 8); - header.BlockDescriptors[i].Blocks += modeResponse[3 + i * 8 + 8]; + + header.BlockDescriptors[i].Blocks += (ulong)(modeResponse[1 + i * 8 + 8] << 16); + header.BlockDescriptors[i].Blocks += (ulong)(modeResponse[2 + i * 8 + 8] << 8); + header.BlockDescriptors[i].Blocks += modeResponse[3 + i * 8 + 8]; header.BlockDescriptors[i].BlockLength += (uint)(modeResponse[5 + i * 8 + 8] << 16); header.BlockDescriptors[i].BlockLength += (uint)(modeResponse[6 + i * 8 + 8] << 8); header.BlockDescriptors[i].BlockLength += modeResponse[7 + i * 8 + 8]; @@ -109,20 +110,20 @@ namespace DiscImageChef.Decoders.SCSI case PeripheralDeviceTypes.DirectAccess: case PeripheralDeviceTypes.MultiMediaDevice: header.WriteProtected = (modeResponse[3] & 0x80) == 0x80; - header.DPOFUA = (modeResponse[3] & 0x10) == 0x10; + header.DPOFUA = (modeResponse[3] & 0x10) == 0x10; break; case PeripheralDeviceTypes.SequentialAccess: - header.WriteProtected = (modeResponse[3] & 0x80) == 0x80; - header.Speed = (byte)(modeResponse[3] & 0x0F); - header.BufferedMode = (byte)((modeResponse[3] & 0x70) >> 4); + header.WriteProtected = (modeResponse[3] & 0x80) == 0x80; + header.Speed = (byte)(modeResponse[3] & 0x0F); + header.BufferedMode = (byte)((modeResponse[3] & 0x70) >> 4); break; case PeripheralDeviceTypes.PrinterDevice: header.BufferedMode = (byte)((modeResponse[3] & 0x70) >> 4); break; case PeripheralDeviceTypes.OpticalDevice: header.WriteProtected = (modeResponse[3] & 0x80) == 0x80; - header.EBC = (modeResponse[3] & 0x01) == 0x01; - header.DPOFUA = (modeResponse[3] & 0x10) == 0x10; + header.EBC = (modeResponse[3] & 0x01) == 0x01; + header.DPOFUA = (modeResponse[3] & 0x10) == 0x10; break; } @@ -140,13 +141,13 @@ namespace DiscImageChef.Decoders.SCSI if(!hdr.HasValue) return null; DecodedMode decoded = new DecodedMode {Header = hdr.Value}; - bool longlba = (modeResponse[4] & 0x01) == 0x01; - int offset; - int blkDrLength = 0; + bool longlba = (modeResponse[4] & 0x01) == 0x01; + int offset; + int blkDrLength = 0; if(decoded.Header.BlockDescriptors != null) blkDrLength = decoded.Header.BlockDescriptors.Length; if(longlba) offset = 8 + blkDrLength * 16; - else offset = 8 + blkDrLength * 8; + else offset = 8 + blkDrLength * 8; int length = modeResponse[0] << 8; length += modeResponse[1]; length += 2; @@ -157,17 +158,17 @@ namespace DiscImageChef.Decoders.SCSI while(offset < modeResponse.Length) { - bool isSubpage = (modeResponse[offset] & 0x40) == 0x40; - ModePage pg = new ModePage(); - byte pageNo = (byte)(modeResponse[offset] & 0x3F); + bool isSubpage = (modeResponse[offset] & 0x40) == 0x40; + ModePage pg = new ModePage(); + byte pageNo = (byte)(modeResponse[offset] & 0x3F); if(pageNo == 0) { pg.PageResponse = new byte[modeResponse.Length - offset]; Array.Copy(modeResponse, offset, pg.PageResponse, 0, pg.PageResponse.Length); - pg.Page = 0; - pg.Subpage = 0; - offset += pg.PageResponse.Length; + pg.Page = 0; + pg.Subpage = 0; + offset += pg.PageResponse.Length; } else { @@ -178,9 +179,9 @@ namespace DiscImageChef.Decoders.SCSI 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]; - offset += pg.PageResponse.Length; + pg.Page = (byte)(modeResponse[offset] & 0x3F); + pg.Subpage = modeResponse[offset + 1]; + offset += pg.PageResponse.Length; } else { @@ -189,9 +190,9 @@ namespace DiscImageChef.Decoders.SCSI 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; - offset += pg.PageResponse.Length; + pg.Page = (byte)(modeResponse[offset] & 0x3F); + pg.Subpage = 0; + offset += pg.PageResponse.Length; } } @@ -204,7 +205,7 @@ namespace DiscImageChef.Decoders.SCSI } public static byte[] EncodeModeHeader10(ModeHeader header, PeripheralDeviceTypes deviceType, - bool longLBA = false) + bool longLBA = false) { byte[] hdr; @@ -221,11 +222,11 @@ namespace DiscImageChef.Decoders.SCSI case PeripheralDeviceTypes.DirectAccess: case PeripheralDeviceTypes.MultiMediaDevice: if(header.WriteProtected) hdr[3] += 0x80; - if(header.DPOFUA) hdr[3] += 0x10; + if(header.DPOFUA) hdr[3] += 0x10; break; case PeripheralDeviceTypes.SequentialAccess: if(header.WriteProtected) hdr[3] += 0x80; - hdr[3] += (byte)(header.Speed & 0x0F); + hdr[3] += (byte)(header.Speed & 0x0F); hdr[3] += (byte)((header.BufferedMode << 4) & 0x70); break; case PeripheralDeviceTypes.PrinterDevice: @@ -233,8 +234,8 @@ namespace DiscImageChef.Decoders.SCSI break; case PeripheralDeviceTypes.OpticalDevice: if(header.WriteProtected) hdr[3] += 0x80; - if(header.EBC) hdr[3] += 0x01; - if(header.DPOFUA) hdr[3] += 0x10; + if(header.EBC) hdr[3] += 0x01; + if(header.DPOFUA) hdr[3] += 0x10; break; } @@ -246,30 +247,30 @@ namespace DiscImageChef.Decoders.SCSI for(int i = 0; i < header.BlockDescriptors.Length; i++) { byte[] temp = BitConverter.GetBytes(header.BlockDescriptors[i].Blocks); - hdr[7 + i * 16 + 8] = temp[0]; - hdr[6 + i * 16 + 8] = temp[1]; - hdr[5 + i * 16 + 8] = temp[2]; - hdr[4 + i * 16 + 8] = temp[3]; - hdr[3 + i * 16 + 8] = temp[4]; - hdr[2 + i * 16 + 8] = temp[5]; - hdr[1 + i * 16 + 8] = temp[6]; - hdr[0 + i * 16 + 8] = temp[7]; + hdr[7 + i * 16 + 8] = temp[0]; + hdr[6 + i * 16 + 8] = temp[1]; + hdr[5 + i * 16 + 8] = temp[2]; + hdr[4 + i * 16 + 8] = temp[3]; + hdr[3 + i * 16 + 8] = temp[4]; + hdr[2 + i * 16 + 8] = temp[5]; + hdr[1 + i * 16 + 8] = temp[6]; + hdr[0 + i * 16 + 8] = temp[7]; hdr[12 + i * 16 + 8] = (byte)((header.BlockDescriptors[i].BlockLength & 0xFF000000) >> 24); - hdr[13 + i * 16 + 8] = (byte)((header.BlockDescriptors[i].BlockLength & 0xFF0000) >> 16); - hdr[14 + i * 16 + 8] = (byte)((header.BlockDescriptors[i].BlockLength & 0xFF00) >> 8); + hdr[13 + i * 16 + 8] = (byte)((header.BlockDescriptors[i].BlockLength & 0xFF0000) >> 16); + hdr[14 + i * 16 + 8] = (byte)((header.BlockDescriptors[i].BlockLength & 0xFF00) >> 8); hdr[15 + i * 16 + 8] = (byte)(header.BlockDescriptors[i].BlockLength & 0xFF); } else for(int i = 0; i < header.BlockDescriptors.Length; i++) { if(deviceType != PeripheralDeviceTypes.DirectAccess) - hdr[0 + i * 8 + 8] = (byte)header.BlockDescriptors[i].Density; + hdr[0 + i * 8 + 8] = (byte)header.BlockDescriptors[i].Density; 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[2 + i * 8 + 8] = (byte)((header.BlockDescriptors[i].Blocks & 0xFF00) >> 8); hdr[3 + i * 8 + 8] = (byte)(header.BlockDescriptors[i].Blocks & 0xFF); hdr[5 + i * 8 + 8] = (byte)((header.BlockDescriptors[i].BlockLength & 0xFF0000) >> 16); - hdr[6 + i * 8 + 8] = (byte)((header.BlockDescriptors[i].BlockLength & 0xFF00) >> 8); + hdr[6 + i * 8 + 8] = (byte)((header.BlockDescriptors[i].BlockLength & 0xFF00) >> 8); hdr[7 + i * 8 + 8] = (byte)(header.BlockDescriptors[i].BlockLength & 0xFF); } @@ -278,7 +279,7 @@ namespace DiscImageChef.Decoders.SCSI public static byte[] EncodeMode10(DecodedMode mode, PeripheralDeviceTypes deviceType) { - int modeSize = 0; + int modeSize = 0; if(mode.Pages != null) modeSize += mode.Pages.Sum(page => page.PageResponse.Length); byte[] hdr = EncodeModeHeader10(mode.Header, deviceType); diff --git a/DiscImageChef.Decoders/SCSI/Modes/Mode6.cs b/DiscImageChef.Decoders/SCSI/Modes/Mode6.cs index 1a229cac6..9759e3400 100644 --- a/DiscImageChef.Decoders/SCSI/Modes/Mode6.cs +++ b/DiscImageChef.Decoders/SCSI/Modes/Mode6.cs @@ -54,10 +54,10 @@ namespace DiscImageChef.Decoders.SCSI header.BlockDescriptors = new BlockDescriptor[modeResponse[3] / 8]; for(int i = 0; i < header.BlockDescriptors.Length; i++) { - header.BlockDescriptors[i].Density = (DensityType)modeResponse[0 + i * 8 + 4]; - header.BlockDescriptors[i].Blocks += (ulong)(modeResponse[1 + i * 8 + 4] << 16); - header.BlockDescriptors[i].Blocks += (ulong)(modeResponse[2 + i * 8 + 4] << 8); - header.BlockDescriptors[i].Blocks += modeResponse[3 + i * 8 + 4]; + header.BlockDescriptors[i].Density = (DensityType)modeResponse[0 + i * 8 + 4]; + header.BlockDescriptors[i].Blocks += (ulong)(modeResponse[1 + i * 8 + 4] << 16); + header.BlockDescriptors[i].Blocks += (ulong)(modeResponse[2 + i * 8 + 4] << 8); + header.BlockDescriptors[i].Blocks += modeResponse[3 + i * 8 + 4]; header.BlockDescriptors[i].BlockLength += (uint)(modeResponse[5 + i * 8 + 4] << 16); header.BlockDescriptors[i].BlockLength += (uint)(modeResponse[6 + i * 8 + 4] << 8); header.BlockDescriptors[i].BlockLength += modeResponse[7 + i * 8 + 4]; @@ -69,20 +69,20 @@ namespace DiscImageChef.Decoders.SCSI case PeripheralDeviceTypes.DirectAccess: case PeripheralDeviceTypes.MultiMediaDevice: header.WriteProtected = (modeResponse[2] & 0x80) == 0x80; - header.DPOFUA = (modeResponse[2] & 0x10) == 0x10; + header.DPOFUA = (modeResponse[2] & 0x10) == 0x10; break; case PeripheralDeviceTypes.SequentialAccess: - header.WriteProtected = (modeResponse[2] & 0x80) == 0x80; - header.Speed = (byte)(modeResponse[2] & 0x0F); - header.BufferedMode = (byte)((modeResponse[2] & 0x70) >> 4); + header.WriteProtected = (modeResponse[2] & 0x80) == 0x80; + header.Speed = (byte)(modeResponse[2] & 0x0F); + header.BufferedMode = (byte)((modeResponse[2] & 0x70) >> 4); break; case PeripheralDeviceTypes.PrinterDevice: header.BufferedMode = (byte)((modeResponse[2] & 0x70) >> 4); break; case PeripheralDeviceTypes.OpticalDevice: header.WriteProtected = (modeResponse[2] & 0x80) == 0x80; - header.EBC = (modeResponse[2] & 0x01) == 0x01; - header.DPOFUA = (modeResponse[2] & 0x10) == 0x10; + header.EBC = (modeResponse[2] & 0x01) == 0x01; + header.DPOFUA = (modeResponse[2] & 0x10) == 0x10; break; } @@ -99,11 +99,11 @@ namespace DiscImageChef.Decoders.SCSI ModeHeader? hdr = DecodeModeHeader6(modeResponse, deviceType); if(!hdr.HasValue) return null; - DecodedMode decoded = new DecodedMode {Header = hdr.Value}; - int blkDrLength = 0; + DecodedMode decoded = new DecodedMode {Header = hdr.Value}; + int blkDrLength = 0; if(decoded.Header.BlockDescriptors != null) blkDrLength = decoded.Header.BlockDescriptors.Length; - int offset = 4 + blkDrLength * 8; + int offset = 4 + blkDrLength * 8; int length = modeResponse[0] + 1; if(length != modeResponse.Length) return decoded; @@ -112,17 +112,17 @@ namespace DiscImageChef.Decoders.SCSI while(offset < modeResponse.Length) { - bool isSubpage = (modeResponse[offset] & 0x40) == 0x40; - ModePage pg = new ModePage(); - byte pageNo = (byte)(modeResponse[offset] & 0x3F); + bool isSubpage = (modeResponse[offset] & 0x40) == 0x40; + ModePage pg = new ModePage(); + byte pageNo = (byte)(modeResponse[offset] & 0x3F); if(pageNo == 0) { pg.PageResponse = new byte[modeResponse.Length - offset]; Array.Copy(modeResponse, offset, pg.PageResponse, 0, pg.PageResponse.Length); - pg.Page = 0; - pg.Subpage = 0; - offset += pg.PageResponse.Length; + pg.Page = 0; + pg.Subpage = 0; + offset += pg.PageResponse.Length; } else { @@ -134,9 +134,9 @@ namespace DiscImageChef.Decoders.SCSI 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]; - offset += pg.PageResponse.Length; + pg.Page = (byte)(modeResponse[offset] & 0x3F); + pg.Subpage = modeResponse[offset + 1]; + offset += pg.PageResponse.Length; } else { @@ -146,9 +146,9 @@ namespace DiscImageChef.Decoders.SCSI 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; - offset += pg.PageResponse.Length; + pg.Page = (byte)(modeResponse[offset] & 0x3F); + pg.Subpage = 0; + offset += pg.PageResponse.Length; } } @@ -173,11 +173,11 @@ namespace DiscImageChef.Decoders.SCSI case PeripheralDeviceTypes.DirectAccess: case PeripheralDeviceTypes.MultiMediaDevice: if(header.WriteProtected) hdr[2] += 0x80; - if(header.DPOFUA) hdr[2] += 0x10; + if(header.DPOFUA) hdr[2] += 0x10; break; case PeripheralDeviceTypes.SequentialAccess: if(header.WriteProtected) hdr[2] += 0x80; - hdr[2] += (byte)(header.Speed & 0x0F); + hdr[2] += (byte)(header.Speed & 0x0F); hdr[2] += (byte)((header.BufferedMode << 4) & 0x70); break; case PeripheralDeviceTypes.PrinterDevice: @@ -185,8 +185,8 @@ namespace DiscImageChef.Decoders.SCSI break; case PeripheralDeviceTypes.OpticalDevice: if(header.WriteProtected) hdr[2] += 0x80; - if(header.EBC) hdr[2] += 0x01; - if(header.DPOFUA) hdr[2] += 0x10; + if(header.EBC) hdr[2] += 0x01; + if(header.DPOFUA) hdr[2] += 0x10; break; } @@ -198,10 +198,10 @@ namespace DiscImageChef.Decoders.SCSI { hdr[0 + i * 8 + 4] = (byte)header.BlockDescriptors[i].Density; hdr[1 + i * 8 + 4] = (byte)((header.BlockDescriptors[i].Blocks & 0xFF0000) >> 16); - hdr[2 + i * 8 + 4] = (byte)((header.BlockDescriptors[i].Blocks & 0xFF00) >> 8); + hdr[2 + i * 8 + 4] = (byte)((header.BlockDescriptors[i].Blocks & 0xFF00) >> 8); hdr[3 + i * 8 + 4] = (byte)(header.BlockDescriptors[i].Blocks & 0xFF); hdr[5 + i * 8 + 4] = (byte)((header.BlockDescriptors[i].BlockLength & 0xFF0000) >> 16); - hdr[6 + i * 8 + 4] = (byte)((header.BlockDescriptors[i].BlockLength & 0xFF00) >> 8); + hdr[6 + i * 8 + 4] = (byte)((header.BlockDescriptors[i].BlockLength & 0xFF00) >> 8); hdr[7 + i * 8 + 4] = (byte)(header.BlockDescriptors[i].BlockLength & 0xFF); } @@ -210,7 +210,7 @@ namespace DiscImageChef.Decoders.SCSI public static byte[] EncodeMode6(DecodedMode mode, PeripheralDeviceTypes deviceType) { - int modeSize = 0; + int modeSize = 0; if(mode.Pages != null) modeSize += mode.Pages.Sum(page => page.PageResponse.Length); byte[] hdr = EncodeModeHeader6(mode.Header, deviceType); diff --git a/DiscImageChef.Decoders/SCSI/Modes/Structs.cs b/DiscImageChef.Decoders/SCSI/Modes/Structs.cs index 966055c9d..82f114693 100644 --- a/DiscImageChef.Decoders/SCSI/Modes/Structs.cs +++ b/DiscImageChef.Decoders/SCSI/Modes/Structs.cs @@ -42,25 +42,25 @@ namespace DiscImageChef.Decoders.SCSI public struct BlockDescriptor { public DensityType Density; - public ulong Blocks; - public uint BlockLength; + public ulong Blocks; + public uint BlockLength; } public struct ModeHeader { - public MediumTypes MediumType; - public bool WriteProtected; + public MediumTypes MediumType; + public bool WriteProtected; public BlockDescriptor[] BlockDescriptors; - public byte Speed; - public byte BufferedMode; - public bool EBC; - public bool DPOFUA; + public byte Speed; + public byte BufferedMode; + public bool EBC; + public bool DPOFUA; } public struct ModePage { - public byte Page; - public byte Subpage; + public byte Page; + public byte Subpage; public byte[] PageResponse; } diff --git a/DiscImageChef.Decoders/SCSI/SSC/BlockLimits.cs b/DiscImageChef.Decoders/SCSI/SSC/BlockLimits.cs index 8ea720997..e195ce869 100644 --- a/DiscImageChef.Decoders/SCSI/SSC/BlockLimits.cs +++ b/DiscImageChef.Decoders/SCSI/SSC/BlockLimits.cs @@ -65,7 +65,7 @@ namespace DiscImageChef.Decoders.SCSI.SSC { granularity = (byte)(response[0] & 0x1F), maxBlockLen = (uint)((response[1] << 16) + (response[2] << 8) + response[3]), - minBlockLen = (ushort)((response[4] << 8) + response[5]) + minBlockLen = (ushort)((response[4] << 8) + response[5]) }; } diff --git a/DiscImageChef.Decoders/SCSI/SSC/DensitySupport.cs b/DiscImageChef.Decoders/SCSI/SSC/DensitySupport.cs index 3933a7adf..bb717da8e 100644 --- a/DiscImageChef.Decoders/SCSI/SSC/DensitySupport.cs +++ b/DiscImageChef.Decoders/SCSI/SSC/DensitySupport.cs @@ -45,32 +45,32 @@ namespace DiscImageChef.Decoders.SCSI.SSC { public struct DensitySupportHeader { - public ushort length; - public ushort reserved; + public ushort length; + public ushort reserved; public DensitySupportDescriptor[] descriptors; } public struct MediaTypeSupportHeader { - public ushort length; - public ushort reserved; + public ushort length; + public ushort reserved; public MediaTypeSupportDescriptor[] descriptors; } public struct DensitySupportDescriptor { - public byte primaryCode; - public byte secondaryCode; - public bool writable; - public bool duplicate; - public bool defaultDensity; - public byte reserved; - public bool lenvalid; + public byte primaryCode; + public byte secondaryCode; + public bool writable; + public bool duplicate; + public bool defaultDensity; + public byte reserved; + public bool lenvalid; public ushort len; - public uint bpmm; + public uint bpmm; public ushort width; public ushort tracks; - public uint capacity; + public uint capacity; public string organization; public string name; public string description; @@ -78,15 +78,15 @@ namespace DiscImageChef.Decoders.SCSI.SSC public struct MediaTypeSupportDescriptor { - public byte mediumType; - public byte reserved1; + public byte mediumType; + public byte reserved1; public ushort len; - public byte numberOfCodes; + public byte numberOfCodes; public byte[] densityCodes; public ushort width; public ushort length; - public byte reserved2; - public byte reserved3; + public byte reserved2; + public byte reserved3; public string organization; public string name; public string description; @@ -103,46 +103,52 @@ namespace DiscImageChef.Decoders.SCSI.SSC if(response.Length != responseLen) return null; List descriptors = new List(); - int offset = 4; + int offset = 4; while(offset < response.Length) { DensitySupportDescriptor descriptor = new DensitySupportDescriptor { - primaryCode = response[offset + 0], - secondaryCode = response[offset + 1], - writable = (response[offset + 2] & 0x80) == 0x80, - duplicate = (response[offset + 2] & 0x40) == 0x40, + primaryCode = response[offset + 0], + secondaryCode = response[offset + 1], + writable = (response[offset + 2] & 0x80) == 0x80, + duplicate = (response[offset + 2] & 0x40) == 0x40, defaultDensity = (response[offset + 2] & 0x20) == 0x20, - reserved = (byte)((response[offset + 2] & 0x1E) >> 1), - lenvalid = (response[offset + 2] & 0x01) == 0x01, - len = (ushort)((response[offset + 3] << 8) + response[offset + 4]), - bpmm = (uint)((response[offset + 5] << 16) + (response[offset + 6] << 8) + response[offset + 7]), - width = (ushort)((response[offset + 8] << 8) + response[offset + 9]), - tracks = (ushort)((response[offset + 10] << 8) + response[offset + 11]), + reserved = (byte)((response[offset + 2] & 0x1E) >> 1), + lenvalid = + (response[offset + 2] & + 0x01) == 0x01, + len = + (ushort)((response[offset + 3] << 8) + response[offset + 4]), + bpmm = + (uint)((response[offset + 5] << 16) + (response[offset + 6] << 8) + response[offset + 7]), + width = + (ushort)((response[offset + 8] << 8) + response[offset + 9]), + tracks = + (ushort)((response[offset + 10] << 8) + response[offset + 11]), capacity = (uint)((response[offset + 12] << 24) + (response[offset + 13] << 16) + - (response[offset + 14] << 8) + response[offset + 15]) + (response[offset + 14] << 8) + response[offset + 15]) }; byte[] tmp = new byte[8]; Array.Copy(response, offset + 16, tmp, 0, 8); descriptor.organization = StringHandlers.CToString(tmp).Trim(); - tmp = new byte[8]; + tmp = new byte[8]; Array.Copy(response, offset + 24, tmp, 0, 8); descriptor.name = StringHandlers.CToString(tmp).Trim(); - tmp = new byte[20]; + tmp = new byte[20]; Array.Copy(response, offset + 32, tmp, 0, 20); descriptor.description = StringHandlers.CToString(tmp).Trim(); if(descriptor.lenvalid) offset += descriptor.len + 5; - else offset += 52; + else offset += 52; descriptors.Add(descriptor); } DensitySupportHeader decoded = new DensitySupportHeader { - length = responseLen, - reserved = (ushort)((response[2] << 8) + response[3] + 2), + length = responseLen, + reserved = (ushort)((response[2] << 8) + response[3] + 2), descriptors = descriptors.ToArray() }; @@ -154,7 +160,7 @@ namespace DiscImageChef.Decoders.SCSI.SSC if(density == null) return null; DensitySupportHeader decoded = density.Value; - StringBuilder sb = new StringBuilder(); + StringBuilder sb = new StringBuilder(); foreach(DensitySupportDescriptor descriptor in decoded.descriptors) { @@ -192,32 +198,32 @@ namespace DiscImageChef.Decoders.SCSI.SSC if(response.Length != responseLen) return null; List descriptors = new List(); - int offset = 4; + int offset = 4; while(offset < response.Length) { MediaTypeSupportDescriptor descriptor = new MediaTypeSupportDescriptor { mediumType = response[offset + 0], - reserved1 = response[offset + 1], - len = (ushort)((response[offset + 2] << 8) + response[offset + 3]) + reserved1 = response[offset + 1], + len = (ushort)((response[offset + 2] << 8) + response[offset + 3]) }; 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); - descriptor.width = (ushort)((response[offset + 14] << 8) + response[offset + 15]); - descriptor.length = (ushort)((response[offset + 16] << 8) + response[offset + 17]); + descriptor.densityCodes = new byte[9]; + Array.Copy(response, offset + 5, descriptor.densityCodes, 0, 9); + descriptor.width = (ushort)((response[offset + 14] << 8) + response[offset + 15]); + descriptor.length = (ushort)((response[offset + 16] << 8) + response[offset + 17]); descriptor.reserved1 = response[offset + 18]; descriptor.reserved1 = response[offset + 19]; byte[] tmp = new byte[8]; Array.Copy(response, offset + 20, tmp, 0, 8); descriptor.organization = StringHandlers.CToString(tmp).Trim(); - tmp = new byte[8]; + tmp = new byte[8]; Array.Copy(response, offset + 28, tmp, 0, 8); descriptor.name = StringHandlers.CToString(tmp).Trim(); - tmp = new byte[20]; + tmp = new byte[20]; Array.Copy(response, offset + 36, tmp, 0, 20); descriptor.description = StringHandlers.CToString(tmp).Trim(); @@ -228,8 +234,8 @@ namespace DiscImageChef.Decoders.SCSI.SSC MediaTypeSupportHeader decoded = new MediaTypeSupportHeader { - length = responseLen, - reserved = (ushort)((response[2] << 8) + response[3] + 2), + length = responseLen, + reserved = (ushort)((response[2] << 8) + response[3] + 2), descriptors = descriptors.ToArray() }; @@ -241,7 +247,7 @@ namespace DiscImageChef.Decoders.SCSI.SSC if(mediumType == null) return null; MediaTypeSupportHeader decoded = mediumType.Value; - StringBuilder sb = new StringBuilder(); + StringBuilder sb = new StringBuilder(); foreach(MediaTypeSupportDescriptor descriptor in decoded.descriptors) { diff --git a/DiscImageChef.Decoders/SCSI/Sense.cs b/DiscImageChef.Decoders/SCSI/Sense.cs index 63f00449e..4495e1130 100644 --- a/DiscImageChef.Decoders/SCSI/Sense.cs +++ b/DiscImageChef.Decoders/SCSI/Sense.cs @@ -200,7 +200,7 @@ namespace DiscImageChef.Decoders.SCSI /// If set, is valid /// public bool SKSV; - public uint SenseKeySpecific; + public uint SenseKeySpecific; public byte[] AdditionalSense; } @@ -234,9 +234,9 @@ namespace DiscImageChef.Decoders.SCSI public struct AnotherProgressIndicationSenseDescriptor { public SenseKeys SenseKey; - public byte ASC; - public byte ASCQ; - public ushort Progress; + public byte ASC; + public byte ASCQ; + public ushort Progress; } [SuppressMessage("ReSharper", "MemberCanBePrivate.Global")] @@ -257,10 +257,10 @@ namespace DiscImageChef.Decoders.SCSI switch(sense[0] & 0x0F) { - case 0: return SenseType.ExtendedSenseFixedCurrent; - case 1: return SenseType.ExtendedSenseFixedPast; - case 2: return SenseType.ExtendedSenseDescriptorCurrent; - case 3: return SenseType.ExtendedSenseDescriptorPast; + case 0: return SenseType.ExtendedSenseFixedCurrent; + case 1: return SenseType.ExtendedSenseFixedPast; + case 2: return SenseType.ExtendedSenseDescriptorCurrent; + case 3: return SenseType.ExtendedSenseDescriptorPast; default: return SenseType.Unknown; } } @@ -271,10 +271,10 @@ namespace DiscImageChef.Decoders.SCSI StandardSense decoded = new StandardSense(); decoded.AddressValid |= (sense[0] & 0x80) == 0x80; - decoded.ErrorClass = (byte)((sense[0] & 0x70) >> 4); - decoded.ErrorType = (byte)(sense[0] & 0x0F); - decoded.Private = (byte)((sense[1] & 0x80) >> 4); - decoded.LBA = (uint)(((sense[1] & 0x0F) << 16) + (sense[2] << 8) + sense[3]); + decoded.ErrorClass = (byte)((sense[0] & 0x70) >> 4); + decoded.ErrorType = (byte)(sense[0] & 0x0F); + decoded.Private = (byte)((sense[1] & 0x80) >> 4); + decoded.LBA = (uint)(((sense[1] & 0x0F) << 16) + (sense[2] << 8) + sense[3]); return decoded; } @@ -294,12 +294,12 @@ namespace DiscImageChef.Decoders.SCSI FixedSense decoded = new FixedSense { InformationValid = (sense[0] & 0x80) == 0x80, - SegmentNumber = sense[1], - Filemark = (sense[2] & 0x80) == 0x80, - EOM = (sense[2] & 0x40) == 0x40, - ILI = (sense[2] & 0x20) == 0x20, - SenseKey = (SenseKeys)(sense[2] & 0x0F), - Information = (uint)((sense[3] << 24) + (sense[4] << 16) + (sense[5] << 8) + sense[6]), + SegmentNumber = sense[1], + Filemark = (sense[2] & 0x80) == 0x80, + EOM = (sense[2] & 0x40) == 0x40, + ILI = (sense[2] & 0x20) == 0x20, + SenseKey = (SenseKeys)(sense[2] & 0x0F), + Information = (uint)((sense[3] << 24) + (sense[4] << 16) + (sense[5] << 8) + sense[6]), AdditionalLength = sense[7] }; @@ -308,8 +308,8 @@ namespace DiscImageChef.Decoders.SCSI if(sense.Length >= 14) { - decoded.ASC = sense[12]; - decoded.ASCQ = sense[13]; + decoded.ASC = sense[12]; + decoded.ASCQ = sense[13]; senseDescription = GetSenseDescription(decoded.ASC, decoded.ASCQ); } @@ -340,10 +340,10 @@ namespace DiscImageChef.Decoders.SCSI DescriptorSense decoded = new DescriptorSense { - SenseKey = (SenseKeys)(sense[1] & 0x0F), - ASC = sense[2], - ASCQ = sense[3], - Overflow = (sense[4] & 0x80) == 0x80, + SenseKey = (SenseKeys)(sense[1] & 0x0F), + ASC = sense[2], + ASCQ = sense[3], + Overflow = (sense[4] & 0x80) == 0x80, Descriptors = new Dictionary() }; @@ -354,7 +354,7 @@ namespace DiscImageChef.Decoders.SCSI if(offset + 2 < sense.Length) { byte descType = sense[offset]; - int descLen = sense[offset + 1] + 1; + int descLen = sense[offset + 1] + 1; byte[] desc = new byte[descLen]; Array.Copy(sense, offset, desc, 0, descLen); @@ -363,7 +363,8 @@ namespace DiscImageChef.Decoders.SCSI offset += descLen; } - else break; + else + break; return decoded; } @@ -554,8 +555,8 @@ namespace DiscImageChef.Decoders.SCSI return new AnotherProgressIndicationSenseDescriptor { SenseKey = (SenseKeys)descriptor[2], - ASC = descriptor[3], - ASCQ = descriptor[4], + ASC = descriptor[3], + ASCQ = descriptor[4], Progress = (ushort)((descriptor[6] << 8) + descriptor[7]) }; } @@ -589,13 +590,13 @@ namespace DiscImageChef.Decoders.SCSI { return new AtaErrorRegistersLba48 { - Error = descriptor[3], - SectorCount = (ushort)((descriptor[4] << 8) + descriptor[5]), - LbaLow = (ushort)((descriptor[6] << 8) + descriptor[7]), - LbaMid = (ushort)((descriptor[8] << 8) + descriptor[9]), - LbaHigh = (ushort)((descriptor[10] << 8) + descriptor[11]), - DeviceHead = descriptor[12], - Status = descriptor[13] + Error = descriptor[3], + SectorCount = (ushort)((descriptor[4] << 8) + descriptor[5]), + LbaLow = (ushort)((descriptor[6] << 8) + descriptor[7]), + LbaMid = (ushort)((descriptor[8] << 8) + descriptor[9]), + LbaHigh = (ushort)((descriptor[10] << 8) + descriptor[11]), + DeviceHead = descriptor[12], + Status = descriptor[13] }; } @@ -624,21 +625,21 @@ 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.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.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.Completed: return "COMPLETED"; + case SenseKeys.UnitAttention: return "UNIT ATTENTION"; case SenseKeys.VolumeOverflow: return "VOLUME OVERFLOW"; - default: return "UNKNOWN"; + default: return "UNKNOWN"; } } @@ -1460,7 +1461,7 @@ namespace DiscImageChef.Decoders.SCSI switch(ASCQ) { case 0x00: return "RAM FAILURE"; - default: return $"DIAGNOSTIC FAILURE ON COMPONENT {ASCQ:X2}h"; + default: return $"DIAGNOSTIC FAILURE ON COMPONENT {ASCQ:X2}h"; } case 0x41: switch(ASCQ) diff --git a/DiscImageChef.Decoders/SCSI/VendorString.cs b/DiscImageChef.Decoders/SCSI/VendorString.cs index 8b063957b..6605e7635 100644 --- a/DiscImageChef.Decoders/SCSI/VendorString.cs +++ b/DiscImageChef.Decoders/SCSI/VendorString.cs @@ -38,805 +38,805 @@ 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 "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 "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; } } } diff --git a/DiscImageChef.Decoders/SecureDigital/CID.cs b/DiscImageChef.Decoders/SecureDigital/CID.cs index 257e441b9..a5e6025a7 100644 --- a/DiscImageChef.Decoders/SecureDigital/CID.cs +++ b/DiscImageChef.Decoders/SecureDigital/CID.cs @@ -41,13 +41,13 @@ namespace DiscImageChef.Decoders.SecureDigital [SuppressMessage("ReSharper", "MemberCanBePrivate.Global")] public class CID { - public byte Manufacturer; + public byte Manufacturer; public string ApplicationID; public string ProductName; - public byte ProductRevision; - public uint ProductSerialNumber; + public byte ProductRevision; + public uint ProductSerialNumber; public ushort ManufacturingDate; - public byte CRC; + public byte CRC; } [SuppressMessage("ReSharper", "InconsistentNaming")] @@ -79,16 +79,16 @@ namespace DiscImageChef.Decoders.SecureDigital CID cid = new CID { - Manufacturer = response[0], - ProductRevision = response[8], + Manufacturer = response[0], + ProductRevision = response[8], ProductSerialNumber = BitConverter.ToUInt32(response, 9), - ManufacturingDate = (ushort)(((response[13] & 0x0F) << 4) + response[14]), - CRC = (byte)((response[15] & 0xFE) >> 1) + ManufacturingDate = (ushort)(((response[13] & 0x0F) << 4) + response[14]), + CRC = (byte)((response[15] & 0xFE) >> 1) }; byte[] tmp = new byte[2]; Array.Copy(response, 1, tmp, 0, 2); cid.ApplicationID = StringHandlers.CToString(tmp); - tmp = new byte[5]; + tmp = new byte[5]; Array.Copy(response, 3, tmp, 0, 5); cid.ProductName = StringHandlers.CToString(tmp); @@ -109,7 +109,8 @@ namespace DiscImageChef.Decoders.SecureDigital 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(); + (cid.ManufacturingDate & 0xFF) + 2000) + .AppendLine(); sb.AppendFormat("\tCID CRC: 0x{0:X2}", cid.CRC).AppendLine(); return sb.ToString(); diff --git a/DiscImageChef.Decoders/SecureDigital/CSD.cs b/DiscImageChef.Decoders/SecureDigital/CSD.cs index 2f76c0e39..cc7e5cd0d 100644 --- a/DiscImageChef.Decoders/SecureDigital/CSD.cs +++ b/DiscImageChef.Decoders/SecureDigital/CSD.cs @@ -41,35 +41,35 @@ namespace DiscImageChef.Decoders.SecureDigital [SuppressMessage("ReSharper", "MemberCanBePrivate.Global")] public class CSD { - public byte Structure; - public byte TAAC; - public byte NSAC; - public byte Speed; + public byte Structure; + public byte TAAC; + public byte NSAC; + public byte Speed; public ushort Classes; - public byte ReadBlockLength; - public bool ReadsPartialBlocks; - public bool WriteMisalignment; - public bool ReadMisalignment; - public bool DSRImplemented; - public uint Size; - public byte ReadCurrentAtVddMin; - public byte ReadCurrentAtVddMax; - public byte WriteCurrentAtVddMin; - public byte WriteCurrentAtVddMax; - public byte SizeMultiplier; - public bool EraseBlockEnable; - public byte EraseSectorSize; - public byte WriteProtectGroupSize; - public bool WriteProtectGroupEnable; - public byte WriteSpeedFactor; - public byte WriteBlockLength; - public bool WritesPartialBlocks; - public bool FileFormatGroup; - public bool Copy; - public bool PermanentWriteProtect; - public bool TemporaryWriteProtect; - public byte FileFormat; - public byte CRC; + public byte ReadBlockLength; + public bool ReadsPartialBlocks; + public bool WriteMisalignment; + public bool ReadMisalignment; + public bool DSRImplemented; + public uint Size; + public byte ReadCurrentAtVddMin; + public byte ReadCurrentAtVddMax; + public byte WriteCurrentAtVddMin; + public byte WriteCurrentAtVddMax; + public byte SizeMultiplier; + public bool EraseBlockEnable; + public byte EraseSectorSize; + public byte WriteProtectGroupSize; + public bool WriteProtectGroupEnable; + public byte WriteSpeedFactor; + public byte WriteBlockLength; + public bool WritesPartialBlocks; + public bool FileFormatGroup; + public bool Copy; + public bool PermanentWriteProtect; + public bool TemporaryWriteProtect; + public byte FileFormat; + public byte CRC; } [SuppressMessage("ReSharper", "InconsistentNaming")] @@ -100,39 +100,40 @@ namespace DiscImageChef.Decoders.SecureDigital CSD csd = new CSD { - Structure = (byte)((response[0] & 0xC0) >> 6), - TAAC = response[1], - NSAC = response[2], - Speed = response[3], - Classes = (ushort)((response[4] << 4) + ((response[5] & 0xF0) >> 4)), - ReadBlockLength = (byte)(response[5] & 0x0F), - ReadsPartialBlocks = (response[6] & 0x80) == 0x80, - WriteMisalignment = (response[6] & 0x40) == 0x40, - ReadMisalignment = (response[6] & 0x20) == 0x20, - DSRImplemented = (response[6] & 0x10) == 0x10, - EraseBlockEnable = (response[10] & 0x40) == 0x40, - EraseSectorSize = (byte)(((response[10] & 0x3F) << 1) + ((response[11] & 0x80) >> 7)), - WriteProtectGroupSize = (byte)(response[11] & 0x7F), - WriteProtectGroupEnable = (response[12] & 0x80) == 0x80, - WriteSpeedFactor = (byte)((response[12] & 0x1C) >> 2), - WriteBlockLength = (byte)(((response[12] & 0x03) << 2) + ((response[13] & 0xC0) >> 6)), - WritesPartialBlocks = (response[13] & 0x20) == 0x20, - FileFormatGroup = (response[14] & 0x80) == 0x80, - Copy = (response[14] & 0x40) == 0x40, - PermanentWriteProtect = (response[14] & 0x20) == 0x20, - TemporaryWriteProtect = (response[14] & 0x10) == 0x10, - FileFormat = (byte)((response[14] & 0x0C) >> 2), - CRC = (byte)((response[15] & 0xFE) >> 1) + Structure = (byte)((response[0] & 0xC0) >> 6), + TAAC = response[1], + NSAC = response[2], + Speed = response[3], + Classes = (ushort)((response[4] << 4) + ((response[5] & 0xF0) >> 4)), + ReadBlockLength = (byte)(response[5] & 0x0F), + ReadsPartialBlocks = (response[6] & 0x80) == 0x80, + WriteMisalignment = (response[6] & 0x40) == 0x40, + ReadMisalignment = (response[6] & 0x20) == 0x20, + DSRImplemented = (response[6] & 0x10) == 0x10, + EraseBlockEnable = (response[10] & 0x40) == 0x40, + EraseSectorSize = (byte)(((response[10] & 0x3F) << 1) + ((response[11] & 0x80) >> 7)), + WriteProtectGroupSize = (byte)(response[11] & 0x7F), + WriteProtectGroupEnable = (response[12] & 0x80) == 0x80, + WriteSpeedFactor = (byte)((response[12] & 0x1C) >> 2), + WriteBlockLength = (byte)(((response[12] & 0x03) << 2) + ((response[13] & 0xC0) >> 6)), + WritesPartialBlocks = (response[13] & 0x20) == 0x20, + FileFormatGroup = (response[14] & 0x80) == 0x80, + Copy = (response[14] & 0x40) == 0x40, + PermanentWriteProtect = (response[14] & 0x20) == 0x20, + TemporaryWriteProtect = (response[14] & 0x10) == 0x10, + FileFormat = (byte)((response[14] & 0x0C) >> 2), + CRC = (byte)((response[15] & 0xFE) >> 1) }; if(csd.Structure == 0) { - csd.Size = (ushort)(((response[6] & 0x03) << 10) + (response[7] << 2) + ((response[8] & 0xC0) >> 6)); - csd.ReadCurrentAtVddMin = (byte)((response[8] & 0x38) >> 3); - csd.ReadCurrentAtVddMax = (byte)(response[8] & 0x07); + csd.Size = + (ushort)(((response[6] & 0x03) << 10) + (response[7] << 2) + ((response[8] & 0xC0) >> 6)); + csd.ReadCurrentAtVddMin = (byte)((response[8] & 0x38) >> 3); + csd.ReadCurrentAtVddMax = (byte)(response[8] & 0x07); csd.WriteCurrentAtVddMin = (byte)((response[9] & 0xE0) >> 5); csd.WriteCurrentAtVddMax = (byte)((response[9] & 0x1C) >> 2); - csd.SizeMultiplier = (byte)(((response[9] & 0x03) << 1) + ((response[10] & 0x80) >> 7)); + csd.SizeMultiplier = (byte)(((response[9] & 0x03) << 1) + ((response[10] & 0x80) >> 7)); } else csd.Size = (uint)(((response[7] & 0x3F) << 16) + (response[8] << 8) + response[9]); @@ -145,7 +146,7 @@ namespace DiscImageChef.Decoders.SecureDigital double unitFactor = 0; double multiplier = 0; - string unit = ""; + string unit = ""; StringBuilder sb = new StringBuilder(); sb.AppendLine("SecureDigital Device Specific Data Register:"); @@ -162,35 +163,35 @@ namespace DiscImageChef.Decoders.SecureDigital switch(csd.TAAC & 0x07) { case 0: - unit = "ns"; + unit = "ns"; unitFactor = 1; break; case 1: - unit = "ns"; + unit = "ns"; unitFactor = 10; break; case 2: - unit = "ns"; + unit = "ns"; unitFactor = 100; break; case 3: - unit = "μs"; + unit = "μs"; unitFactor = 1; break; case 4: - unit = "μs"; + unit = "μs"; unitFactor = 10; break; case 5: - unit = "μs"; + unit = "μs"; unitFactor = 100; break; case 6: - unit = "ms"; + unit = "ms"; unitFactor = 1; break; case 7: - unit = "ms"; + unit = "ms"; unitFactor = 10; break; } @@ -268,7 +269,7 @@ namespace DiscImageChef.Decoders.SecureDigital unitFactor = 100; break; default: - unit = "unknown"; + unit = "unknown"; unitFactor = 0; break; } @@ -329,7 +330,9 @@ namespace DiscImageChef.Decoders.SecureDigital 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 += $" {cl}"; + for(int cl = 0, mask = 1; cl <= 11; cl++, mask <<= 1) + if((csd.Classes & mask) == mask) + unit += $" {cl}"; sb.AppendFormat("\tDevice support command classes {0}", unit).AppendLine(); sb.AppendFormat("\tRead block length is {0} bytes", Math.Pow(2, csd.ReadBlockLength)).AppendLine(); @@ -347,7 +350,8 @@ 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(); + 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(); diff --git a/DiscImageChef.Decoders/SecureDigital/OCR.cs b/DiscImageChef.Decoders/SecureDigital/OCR.cs index 2c387dfce..0b29a4713 100644 --- a/DiscImageChef.Decoders/SecureDigital/OCR.cs +++ b/DiscImageChef.Decoders/SecureDigital/OCR.cs @@ -67,20 +67,20 @@ namespace DiscImageChef.Decoders.SecureDigital { return new OCR { - PowerUp = (response & 0x80000000) == 0x80000000, - CCS = (response & 0x40000000) == 0x40000000, - UHS = (response & 0x20000000) == 0x20000000, - OneEight = (response & 0x01000000) == 0x01000000, - ThreeFive = (response & 0x00800000) == 0x00800000, - ThreeFour = (response & 0x00400000) == 0x00400000, + PowerUp = (response & 0x80000000) == 0x80000000, + CCS = (response & 0x40000000) == 0x40000000, + UHS = (response & 0x20000000) == 0x20000000, + OneEight = (response & 0x01000000) == 0x01000000, + ThreeFive = (response & 0x00800000) == 0x00800000, + ThreeFour = (response & 0x00400000) == 0x00400000, ThreeThree = (response & 0x00200000) == 0x00200000, - ThreeTwo = (response & 0x00100000) == 0x00100000, - ThreeOne = (response & 0x00080000) == 0x00080000, - ThreeZero = (response & 0x00040000) == 0x00040000, - TwoNine = (response & 0x00020000) == 0x00020000, - TwoEight = (response & 0x00010000) == 0x00010000, - TwoSeven = (response & 0x00008000) == 0x00008000, - LowPower = (response & 0x00000080) == 0x00000080 + ThreeTwo = (response & 0x00100000) == 0x00100000, + ThreeOne = (response & 0x00080000) == 0x00080000, + ThreeZero = (response & 0x00040000) == 0x00040000, + TwoNine = (response & 0x00020000) == 0x00020000, + TwoEight = (response & 0x00010000) == 0x00010000, + TwoSeven = (response & 0x00008000) == 0x00008000, + LowPower = (response & 0x00000080) == 0x00000080 }; } diff --git a/DiscImageChef.Decoders/SecureDigital/SCR.cs b/DiscImageChef.Decoders/SecureDigital/SCR.cs index 5e9b38a3b..3c4f9a9df 100644 --- a/DiscImageChef.Decoders/SecureDigital/SCR.cs +++ b/DiscImageChef.Decoders/SecureDigital/SCR.cs @@ -42,16 +42,16 @@ namespace DiscImageChef.Decoders.SecureDigital [SuppressMessage("ReSharper", "NotAccessedField.Global")] public class SCR { - public byte Structure; - public byte Spec; - public bool DataStatusAfterErase; - public byte Security; - public byte BusWidth; - public bool Spec3; - public byte ExtendedSecurity; - public bool Spec4; - public byte SpecX; - public byte CommandSupport; + public byte Structure; + public byte Spec; + public bool DataStatusAfterErase; + public byte Security; + public byte BusWidth; + public bool Spec3; + public byte ExtendedSecurity; + public bool Spec4; + public byte SpecX; + public byte CommandSupport; public byte[] ManufacturerReserved; } @@ -79,16 +79,16 @@ namespace DiscImageChef.Decoders.SecureDigital SCR scr = new SCR { - Structure = (byte)((response[0] & 0xF0) >> 4), - Spec = (byte)(response[0] & 0x0F), - DataStatusAfterErase = (response[1] & 0x80) == 0x80, - Security = (byte)((response[1] & 0x70) >> 4), - BusWidth = (byte)(response[1] & 0x0F), - Spec3 = (response[2] & 0x80) == 0x80, - ExtendedSecurity = (byte)((response[2] & 0x78) >> 3), - Spec4 = (response[2] & 0x04) == 0x04, - SpecX = (byte)(((response[2] & 0x03) << 2) + ((response[3] & 0xC0) >> 6)), - CommandSupport = (byte)(response[3] & 0x0F), + Structure = (byte)((response[0] & 0xF0) >> 4), + Spec = (byte)(response[0] & 0x0F), + DataStatusAfterErase = (response[1] & 0x80) == 0x80, + Security = (byte)((response[1] & 0x70) >> 4), + BusWidth = (byte)(response[1] & 0x0F), + Spec3 = (response[2] & 0x80) == 0x80, + ExtendedSecurity = (byte)((response[2] & 0x78) >> 3), + Spec4 = (response[2] & 0x04) == 0x04, + SpecX = (byte)(((response[2] & 0x03) << 2) + ((response[3] & 0xC0) >> 6)), + CommandSupport = (byte)(response[3] & 0x0F), ManufacturerReserved = new byte[4] }; Array.Copy(response, 4, scr.ManufacturerReserved, 0, 4); @@ -119,8 +119,8 @@ namespace DiscImageChef.Decoders.SecureDigital 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(); + .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: diff --git a/DiscImageChef.Decoders/SecureDigital/VendorString.cs b/DiscImageChef.Decoders/SecureDigital/VendorString.cs index 545e0f532..dbea02c6c 100644 --- a/DiscImageChef.Decoders/SecureDigital/VendorString.cs +++ b/DiscImageChef.Decoders/SecureDigital/VendorString.cs @@ -39,7 +39,7 @@ namespace DiscImageChef.Decoders.SecureDigital switch(sdVendorId) { case 0xAA: return "QEMU"; - default: return $"Unknown manufacturer ID 0x{sdVendorId:X2}"; + default: return $"Unknown manufacturer ID 0x{sdVendorId:X2}"; } } } diff --git a/DiscImageChef.Decoders/Sega/CD.cs b/DiscImageChef.Decoders/Sega/CD.cs index 57b3af001..862c7ddf0 100644 --- a/DiscImageChef.Decoders/Sega/CD.cs +++ b/DiscImageChef.Decoders/Sega/CD.cs @@ -49,9 +49,11 @@ 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. @@ -59,7 +61,8 @@ 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 @@ -83,33 +86,46 @@ 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) @@ -129,15 +145,15 @@ namespace DiscImageChef.Decoders.Sega 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.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_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_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_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_work_ram_size = {0}", ipbin.sp_work_ram_size); @@ -178,8 +194,8 @@ namespace DiscImageChef.Decoders.Sega IPBinInformation.AppendLine("--------------------------------"); // Decoding all data - DateTime ipbindate = DateTime.MinValue; - CultureInfo provider = CultureInfo.InvariantCulture; + DateTime ipbindate = DateTime.MinValue; + CultureInfo provider = CultureInfo.InvariantCulture; try { ipbindate = DateTime.ParseExact(Encoding.ASCII.GetString(ipbin.release_date), "MMddyyyy", provider); } catch { @@ -188,12 +204,12 @@ namespace DiscImageChef.Decoders.Sega 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 + #pragma warning disable RECS0022 // A catch clause that catches System.Exception and has an empty body catch { // ignored } -#pragma warning restore RECS0022 // A catch clause that catches System.Exception and has an empty body + #pragma warning restore RECS0022 // A catch clause that catches System.Exception and has an empty body } /* diff --git a/DiscImageChef.Decoders/Sega/Dreamcast.cs b/DiscImageChef.Decoders/Sega/Dreamcast.cs index 163faa44c..bae1c659c 100644 --- a/DiscImageChef.Decoders/Sega/Dreamcast.cs +++ b/DiscImageChef.Decoders/Sega/Dreamcast.cs @@ -48,15 +48,18 @@ 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, '/' @@ -64,29 +67,40 @@ 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) @@ -148,7 +162,7 @@ namespace DiscImageChef.Decoders.Sega IPBinInformation.AppendLine("--------------------------------"); // Decoding all data - DateTime ipbindate; + 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)) diff --git a/DiscImageChef.Decoders/Sega/Saturn.cs b/DiscImageChef.Decoders/Sega/Saturn.cs index c7f24280d..159b13566 100644 --- a/DiscImageChef.Decoders/Sega/Saturn.cs +++ b/DiscImageChef.Decoders/Sega/Saturn.cs @@ -48,17 +48,23 @@ 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, '/' @@ -66,13 +72,17 @@ 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) @@ -128,7 +138,7 @@ namespace DiscImageChef.Decoders.Sega IPBinInformation.AppendLine("--------------------------------"); // Decoding all data - DateTime ipbindate; + 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)) diff --git a/DiscImageChef.Decoders/Xbox/DMI.cs b/DiscImageChef.Decoders/Xbox/DMI.cs index 07bd14ca7..808178abb 100644 --- a/DiscImageChef.Decoders/Xbox/DMI.cs +++ b/DiscImageChef.Decoders/Xbox/DMI.cs @@ -50,8 +50,13 @@ namespace DiscImageChef.Decoders.Xbox 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; + 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; @@ -159,10 +164,10 @@ namespace DiscImageChef.Decoders.Xbox XboxDMI dmi = new XboxDMI { DataLength = (ushort)((response[0] << 8) + response[1]), - Reserved1 = response[2], - Reserved2 = response[3], - Version = BitConverter.ToUInt32(response, 4), - Timestamp = BitConverter.ToInt64(response, 20) + Reserved1 = response[2], + Reserved2 = response[3], + Version = BitConverter.ToUInt32(response, 4), + Timestamp = BitConverter.ToInt64(response, 20) }; byte[] tmp = new byte[8]; @@ -180,11 +185,11 @@ namespace DiscImageChef.Decoders.Xbox Xbox360DMI dmi = new Xbox360DMI { DataLength = (ushort)((response[0] << 8) + response[1]), - Reserved1 = response[2], - Reserved2 = response[3], - Version = BitConverter.ToUInt32(response, 4), - Timestamp = BitConverter.ToInt64(response, 20), - MediaID = new byte[16] + Reserved1 = response[2], + Reserved2 = response[3], + Version = BitConverter.ToUInt32(response, 4), + Timestamp = BitConverter.ToInt64(response, 20), + MediaID = new byte[16] }; Array.Copy(response, 36, dmi.MediaID, 0, 16); @@ -199,8 +204,8 @@ namespace DiscImageChef.Decoders.Xbox { if(dmi == null) return null; - XboxDMI decoded = dmi.Value; - StringBuilder sb = new StringBuilder(); + 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]); @@ -221,8 +226,8 @@ namespace DiscImageChef.Decoders.Xbox { if(dmi == null) return null; - Xbox360DMI decoded = dmi.Value; - StringBuilder sb = new StringBuilder(); + 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]); diff --git a/DiscImageChef.Decoders/Xbox/SS.cs b/DiscImageChef.Decoders/Xbox/SS.cs index dd77bfbe8..ac1cfeab3 100644 --- a/DiscImageChef.Decoders/Xbox/SS.cs +++ b/DiscImageChef.Decoders/Xbox/SS.cs @@ -228,35 +228,38 @@ namespace DiscImageChef.Decoders.Xbox SecuritySector ss = new SecuritySector { - DiskCategory = (DiskCategory)((response[0] & 0xF0) >> 4), - PartVersion = (byte)(response[0] & 0x0F), - DiscSize = (DVDSize)((response[1] & 0xF0) >> 4), - MaximumRate = (MaximumRateField)(response[1] & 0x0F), - Reserved3 = (response[2] & 0x80) == 0x80, - Layers = (byte)((response[2] & 0x60) >> 5), - TrackPath = (response[2] & 0x08) == 0x08, - LayerType = (LayerTypeFieldMask)(response[2] & 0x07), + DiskCategory = (DiskCategory)((response[0] & 0xF0) >> 4), + PartVersion = (byte)(response[0] & 0x0F), + DiscSize = (DVDSize)((response[1] & 0xF0) >> 4), + MaximumRate = (MaximumRateField)(response[1] & 0x0F), + Reserved3 = (response[2] & 0x80) == 0x80, + Layers = (byte)((response[2] & 0x60) >> 5), + TrackPath = (response[2] & 0x08) == 0x08, + LayerType = (LayerTypeFieldMask)(response[2] & 0x07), LinearDensity = (LinearDensityField)((response[3] & 0xF0) >> 4), - TrackDensity = (TrackDensityField)(response[3] & 0x0F), - DataAreaStartPSN = (uint)((response[4] << 24) + (response[5] << 16) + (response[6] << 8) + response[7]), - DataAreaEndPSN = (uint)((response[8] << 24) + (response[9] << 16) + (response[10] << 8) + response[11]), - Layer0EndPSN = (uint)((response[12] << 24) + (response[13] << 16) + (response[14] << 8) + response[15]), - Unknown1 = response[27], - Unknown2 = new byte[28], - Unknown3 = new byte[436], - Unknown4 = new byte[4], - Unknown5 = new byte[43], + TrackDensity = (TrackDensityField)(response[3] & 0x0F), + DataAreaStartPSN = + (uint)((response[4] << 24) + (response[5] << 16) + (response[6] << 8) + response[7]), + DataAreaEndPSN = + (uint)((response[8] << 24) + (response[9] << 16) + (response[10] << 8) + response[11]), + Layer0EndPSN = + (uint)((response[12] << 24) + (response[13] << 16) + (response[14] << 8) + response[15]), + Unknown1 = response[27], + Unknown2 = new byte[28], + Unknown3 = new byte[436], + Unknown4 = new byte[4], + Unknown5 = new byte[43], ChallengeTableVersion = response[768], - NoChallengeEntries = response[769], - ChallengeEntries = new ChallengeEntry[23], - Unknown6 = response[1023], - Unknown7 = new byte[48], - Unknown8 = new byte[16], - Unknown9 = new byte[16], - Unknown10 = new byte[303], - Unknown11 = new byte[104], - Extents = new SecuritySectorExtent[23], - ExtentsCopy = new SecuritySectorExtent[23] + NoChallengeEntries = response[769], + ChallengeEntries = new ChallengeEntry[23], + Unknown6 = response[1023], + Unknown7 = new byte[48], + Unknown8 = new byte[16], + Unknown9 = new byte[16], + Unknown10 = new byte[303], + Unknown11 = new byte[104], + Extents = new SecuritySectorExtent[23], + ExtentsCopy = new SecuritySectorExtent[23] }; Array.Copy(response, 256, ss.Unknown2, 0, 28); @@ -267,19 +270,19 @@ namespace DiscImageChef.Decoders.Xbox for(int i = 0; i < 23; i++) ss.ChallengeEntries[i] = new ChallengeEntry { - Level = response[770 + i * 11 + 0], + Level = response[770 + i * 11 + 0], ChallengeId = response[770 + i * 11 + 1], 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]), + (response[770 + i * 11 + 4] << 8) + response[770 + i * 11 + 5]), ResponseModifier = response[770 + i * 11 + 6], 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]) + (response[770 + i * 11 + 9] << 8) + response[770 + i * 11 + 10]) }; - Array.Copy(response, 1052, ss.Unknown7, 0, 48); - Array.Copy(response, 1120, ss.Unknown8, 0, 16); - Array.Copy(response, 1180, ss.Unknown9, 0, 16); + Array.Copy(response, 1052, ss.Unknown7, 0, 48); + Array.Copy(response, 1120, ss.Unknown8, 0, 16); + Array.Copy(response, 1180, ss.Unknown9, 0, 16); Array.Copy(response, 1208, ss.Unknown10, 0, 303); Array.Copy(response, 1528, ss.Unknown11, 0, 104); for(int i = 0; i < 23; i++) @@ -316,7 +319,7 @@ namespace DiscImageChef.Decoders.Xbox if(ss == null) return null; SecuritySector decoded = ss.Value; - StringBuilder sb = new StringBuilder(); + StringBuilder sb = new StringBuilder(); string sizeString; switch(decoded.DiscSize) @@ -376,7 +379,7 @@ namespace DiscImageChef.Decoders.Xbox } sb.AppendFormat("Disc has {0} layers", decoded.Layers + 1).AppendLine(); - if(decoded.TrackPath && decoded.Layers == 1) sb.AppendLine("Layers are in parallel 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) @@ -437,7 +440,8 @@ 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"); sb.AppendLine("Challenges:"); diff --git a/DiscImageChef.Devices/Command.cs b/DiscImageChef.Devices/Command.cs index 3acc03abf..8188d0241 100644 --- a/DiscImageChef.Devices/Command.cs +++ b/DiscImageChef.Devices/Command.cs @@ -58,8 +58,10 @@ namespace DiscImageChef.Devices /// sense /// /// If the specified platform is not supported - internal static int SendScsiCommand(object fd, byte[] cdb, ref byte[] buffer, out byte[] senseBuffer, - uint timeout, ScsiDirection direction, out double duration, out bool sense) + internal static int SendScsiCommand(object fd, byte[] cdb, ref byte[] buffer, + out byte[] senseBuffer, + uint timeout, ScsiDirection direction, out double duration, + out bool sense) { PlatformID ptId = DetectOS.GetRealPlatformID(); @@ -84,9 +86,10 @@ namespace DiscImageChef.Devices /// sense /// /// If the specified platform is not supported - internal static int SendScsiCommand(PlatformID ptId, object fd, byte[] cdb, ref byte[] buffer, - out byte[] senseBuffer, uint timeout, ScsiDirection direction, - out double duration, out bool sense) + internal static int SendScsiCommand(PlatformID ptId, object fd, byte[] cdb, + ref byte[] buffer, + out byte[] senseBuffer, uint timeout, ScsiDirection direction, + out double duration, out bool sense) { switch(ptId) { @@ -181,14 +184,17 @@ namespace DiscImageChef.Devices /// What register contains the transfer length /// Set to true if the transfer length is in block, otherwise it is in bytes /// If the specified platform is not supported - internal 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) + internal 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) { PlatformID ptId = DetectOS.GetRealPlatformID(); - return SendAtaCommand(ptId, fd, registers, out errorRegisters, protocol, transferRegister, ref buffer, + return SendAtaCommand(ptId, fd, registers, out errorRegisters, protocol, transferRegister, + ref buffer, timeout, transferBlocks, out duration, out sense); } @@ -208,10 +214,13 @@ namespace DiscImageChef.Devices /// What register contains the transfer length /// Set to true if the transfer length is in block, otherwise it is in bytes /// If the specified platform is not supported - internal static int SendAtaCommand(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) + internal static int SendAtaCommand(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) { switch(ptId) { @@ -223,6 +232,7 @@ namespace DiscImageChef.Devices 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."); @@ -260,14 +270,17 @@ namespace DiscImageChef.Devices /// What register contains the transfer length /// Set to true if the transfer length is in block, otherwise it is in bytes /// If the specified platform is not supported - internal 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) + internal 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) { PlatformID ptId = DetectOS.GetRealPlatformID(); - return SendAtaCommand(ptId, fd, registers, out errorRegisters, protocol, transferRegister, ref buffer, + return SendAtaCommand(ptId, fd, registers, out errorRegisters, protocol, transferRegister, + ref buffer, timeout, transferBlocks, out duration, out sense); } @@ -287,10 +300,13 @@ namespace DiscImageChef.Devices /// What register contains the transfer length /// Set to true if the transfer length is in block, otherwise it is in bytes /// If the specified platform is not supported - internal static int SendAtaCommand(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) + internal static int SendAtaCommand(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) { switch(ptId) { @@ -302,6 +318,7 @@ namespace DiscImageChef.Devices 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."); @@ -339,14 +356,17 @@ namespace DiscImageChef.Devices /// What register contains the transfer length /// Set to true if the transfer length is in block, otherwise it is in bytes /// If the specified platform is not supported - internal 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) + internal 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) { PlatformID ptId = DetectOS.GetRealPlatformID(); - return SendAtaCommand(ptId, fd, registers, out errorRegisters, protocol, transferRegister, ref buffer, + return SendAtaCommand(ptId, fd, registers, out errorRegisters, protocol, transferRegister, + ref buffer, timeout, transferBlocks, out duration, out sense); } @@ -366,10 +386,13 @@ namespace DiscImageChef.Devices /// What register contains the transfer length /// Set to true if the transfer length is in block, otherwise it is in bytes /// If the specified platform is not supported - internal static int SendAtaCommand(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) + internal static int SendAtaCommand(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) { switch(ptId) { @@ -412,14 +435,18 @@ namespace DiscImageChef.Devices /// Response registers /// Size of block in bytes /// If the specified platform is not supported - internal 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) + internal 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) { PlatformID ptId = DetectOS.GetRealPlatformID(); - return SendMmcCommand(ptId, (int)fd, command, write, isApplication, flags, argument, blockSize, blocks, + return SendMmcCommand(ptId, (int)fd, command, write, isApplication, flags, argument, + blockSize, blocks, ref buffer, out response, out duration, out sense, timeout); } @@ -442,10 +469,13 @@ namespace DiscImageChef.Devices /// Response registers /// Size of block in bytes /// If the specified platform is not supported - internal static int SendMmcCommand(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) + internal static int SendMmcCommand(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) { diff --git a/DiscImageChef.Devices/Device/AtaCommands/Ata28.cs b/DiscImageChef.Devices/Device/AtaCommands/Ata28.cs index 83d0418f2..9bb1f5cfc 100644 --- a/DiscImageChef.Devices/Device/AtaCommands/Ata28.cs +++ b/DiscImageChef.Devices/Device/AtaCommands/Ata28.cs @@ -43,8 +43,9 @@ namespace DiscImageChef.Devices buffer = new byte[512]; AtaRegistersLba28 registers = new AtaRegistersLba28 {Command = (byte)AtaCommands.ReadBuffer}; - LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn, - AtaTransferRegister.NoTransfer, ref buffer, timeout, false, out duration, + LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn, + AtaTransferRegister.NoTransfer, ref buffer, timeout, false, + out duration, out bool sense); Error = LastError != 0; @@ -59,8 +60,8 @@ namespace DiscImageChef.Devices buffer = new byte[512]; AtaRegistersLba28 registers = new AtaRegistersLba28 {Command = (byte)AtaCommands.ReadBufferDma}; - LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.Dma, AtaTransferRegister.NoTransfer, - ref buffer, timeout, false, out duration, out bool sense); + LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.Dma, AtaTransferRegister.NoTransfer, + ref buffer, timeout, false, out duration, out bool sense); Error = LastError != 0; DicConsole.DebugWriteLine("ATA Device", "READ BUFFER DMA took {0} ms.", duration); @@ -68,29 +69,30 @@ 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) { buffer = count == 0 ? new byte[512 * 256] : new byte[512 * count]; AtaRegistersLba28 registers = new AtaRegistersLba28 { SectorCount = count, - DeviceHead = (byte)((lba & 0xF000000) / 0x1000000), - LbaHigh = (byte)((lba & 0xFF0000) / 0x10000), - LbaMid = (byte)((lba & 0xFF00) / 0x100), - LbaLow = (byte)((lba & 0xFF) / 0x1), - Command = retry ? (byte)AtaCommands.ReadDmaRetry : (byte)AtaCommands.ReadDma + DeviceHead = (byte)((lba & 0xF000000) / 0x1000000), + LbaHigh = (byte)((lba & 0xFF0000) / 0x10000), + LbaMid = (byte)((lba & 0xFF00) / 0x100), + LbaLow = (byte)((lba & 0xFF) / 0x1), + Command = retry ? (byte)AtaCommands.ReadDmaRetry : (byte)AtaCommands.ReadDma }; registers.DeviceHead += 0x40; - LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.Dma, AtaTransferRegister.SectorCount, + LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.Dma, + AtaTransferRegister.SectorCount, ref buffer, timeout, true, out duration, out bool sense); Error = LastError != 0; @@ -99,24 +101,25 @@ 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) { buffer = count == 0 ? new byte[512 * 256] : new byte[512 * count]; AtaRegistersLba28 registers = new AtaRegistersLba28 { - Command = (byte)AtaCommands.ReadMultiple, + Command = (byte)AtaCommands.ReadMultiple, SectorCount = count, - DeviceHead = (byte)((lba & 0xF000000) / 0x1000000), - LbaHigh = (byte)((lba & 0xFF0000) / 0x10000), - LbaMid = (byte)((lba & 0xFF00) / 0x100), - LbaLow = (byte)((lba & 0xFF) / 0x1) + DeviceHead = (byte)((lba & 0xF000000) / 0x1000000), + LbaHigh = (byte)((lba & 0xFF0000) / 0x10000), + LbaMid = (byte)((lba & 0xFF00) / 0x100), + LbaLow = (byte)((lba & 0xFF) / 0x1) }; registers.DeviceHead += 0x40; - LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn, - AtaTransferRegister.SectorCount, ref buffer, timeout, true, out duration, + LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn, + AtaTransferRegister.SectorCount, ref buffer, timeout, true, + out duration, out bool sense); Error = LastError != 0; @@ -125,17 +128,18 @@ namespace DiscImageChef.Devices return sense; } - public bool ReadNativeMaxAddress(out uint lba, out AtaErrorRegistersLba28 statusRegisters, uint timeout, + public bool ReadNativeMaxAddress(out uint lba, out AtaErrorRegistersLba28 statusRegisters, uint timeout, out double duration) { lba = 0; - byte[] buffer = new byte[0]; + byte[] buffer = new byte[0]; AtaRegistersLba28 registers = new AtaRegistersLba28 {Command = (byte)AtaCommands.ReadNativeMaxAddress}; registers.DeviceHead += 0x40; - LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.NonData, - AtaTransferRegister.NoTransfer, ref buffer, timeout, false, out duration, + LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.NonData, + AtaTransferRegister.NoTransfer, ref buffer, timeout, false, + out duration, out bool sense); Error = LastError != 0; @@ -144,7 +148,7 @@ namespace DiscImageChef.Devices lba += (uint)(statusRegisters.DeviceHead & 0xF); lba *= 0x1000000; lba += (uint)(statusRegisters.LbaHigh << 16); - lba += (uint)(statusRegisters.LbaMid << 8); + lba += (uint)(statusRegisters.LbaMid << 8); lba += statusRegisters.LbaLow; } @@ -153,30 +157,31 @@ 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) { buffer = count == 0 ? new byte[512 * 256] : new byte[512 * count]; AtaRegistersLba28 registers = new AtaRegistersLba28 { SectorCount = count, - DeviceHead = (byte)((lba & 0xF000000) / 0x1000000), - LbaHigh = (byte)((lba & 0xFF0000) / 0x10000), - LbaMid = (byte)((lba & 0xFF00) / 0x100), - LbaLow = (byte)((lba & 0xFF) / 0x1), - Command = retry ? (byte)AtaCommands.ReadRetry : (byte)AtaCommands.Read + DeviceHead = (byte)((lba & 0xF000000) / 0x1000000), + LbaHigh = (byte)((lba & 0xFF0000) / 0x10000), + LbaMid = (byte)((lba & 0xFF00) / 0x100), + LbaLow = (byte)((lba & 0xFF) / 0x1), + Command = retry ? (byte)AtaCommands.ReadRetry : (byte)AtaCommands.Read }; registers.DeviceHead += 0x40; - LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn, - AtaTransferRegister.SectorCount, ref buffer, timeout, true, out duration, + LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn, + AtaTransferRegister.SectorCount, ref buffer, timeout, true, + out duration, out bool sense); Error = LastError != 0; @@ -185,30 +190,32 @@ 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 { SectorCount = 1, - DeviceHead = (byte)((lba & 0xF000000) / 0x1000000), - LbaHigh = (byte)((lba & 0xFF0000) / 0x10000), - LbaMid = (byte)((lba & 0xFF00) / 0x100), - LbaLow = (byte)((lba & 0xFF) / 0x1), - Command = retry ? (byte)AtaCommands.ReadLongRetry : (byte)AtaCommands.ReadLong + DeviceHead = (byte)((lba & 0xF000000) / 0x1000000), + LbaHigh = (byte)((lba & 0xFF0000) / 0x10000), + LbaMid = (byte)((lba & 0xFF00) / 0x100), + LbaLow = (byte)((lba & 0xFF) / 0x1), + Command = retry ? (byte)AtaCommands.ReadLongRetry : (byte)AtaCommands.ReadLong }; registers.DeviceHead += 0x40; - LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn, - AtaTransferRegister.SectorCount, ref buffer, timeout, true, out duration, + LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn, + AtaTransferRegister.SectorCount, ref buffer, timeout, true, + out duration, out bool sense); Error = LastError != 0; @@ -222,17 +229,18 @@ namespace DiscImageChef.Devices byte[] buffer = new byte[0]; AtaRegistersLba28 registers = new AtaRegistersLba28 { - Command = (byte)AtaCommands.Seek, + Command = (byte)AtaCommands.Seek, DeviceHead = (byte)((lba & 0xF000000) / 0x1000000), - LbaHigh = (byte)((lba & 0xFF0000) / 0x10000), - LbaMid = (byte)((lba & 0xFF00) / 0x100), - LbaLow = (byte)((lba & 0xFF) / 0x1) + LbaHigh = (byte)((lba & 0xFF0000) / 0x10000), + LbaMid = (byte)((lba & 0xFF00) / 0x100), + LbaLow = (byte)((lba & 0xFF) / 0x1) }; registers.DeviceHead += 0x40; - LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.NonData, - AtaTransferRegister.NoTransfer, ref buffer, timeout, false, out duration, + LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.NonData, + AtaTransferRegister.NoTransfer, ref buffer, timeout, false, + out duration, out bool sense); Error = LastError != 0; diff --git a/DiscImageChef.Devices/Device/AtaCommands/Ata48.cs b/DiscImageChef.Devices/Device/AtaCommands/Ata48.cs index 2050f6e42..b7ba2fe38 100644 --- a/DiscImageChef.Devices/Device/AtaCommands/Ata48.cs +++ b/DiscImageChef.Devices/Device/AtaCommands/Ata48.cs @@ -37,7 +37,7 @@ namespace DiscImageChef.Devices { public partial class Device { - public bool GetNativeMaxAddressExt(out ulong lba, out AtaErrorRegistersLba48 statusRegisters, uint timeout, + public bool GetNativeMaxAddressExt(out ulong lba, out AtaErrorRegistersLba48 statusRegisters, uint timeout, out double duration) { lba = 0; @@ -45,14 +45,15 @@ namespace DiscImageChef.Devices AtaRegistersLba48 registers = new AtaRegistersLba48 {Command = (byte)AtaCommands.NativeMaxAddress, Feature = 0x0000}; - LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.NonData, - AtaTransferRegister.NoTransfer, ref buffer, timeout, false, out duration, + LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.NonData, + AtaTransferRegister.NoTransfer, ref buffer, timeout, false, + out duration, out bool sense); Error = LastError != 0; if((statusRegisters.Status & 0x23) == 0) { - lba = statusRegisters.LbaHigh; + lba = statusRegisters.LbaHigh; lba *= 0x100000000; lba += (ulong)(statusRegisters.LbaMid << 16); lba += statusRegisters.LbaLow; @@ -63,22 +64,23 @@ 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) { buffer = count == 0 ? new byte[512 * 65536] : new byte[512 * count]; AtaRegistersLba48 registers = new AtaRegistersLba48 { - Command = (byte)AtaCommands.ReadDmaExt, + Command = (byte)AtaCommands.ReadDmaExt, SectorCount = count, - LbaHigh = (ushort)((lba & 0xFFFF00000000) / 0x100000000), - LbaMid = (ushort)((lba & 0xFFFF0000) / 0x10000), - LbaLow = (ushort)((lba & 0xFFFF) / 0x1) + LbaHigh = (ushort)((lba & 0xFFFF00000000) / 0x100000000), + LbaMid = (ushort)((lba & 0xFFFF0000) / 0x10000), + LbaLow = (ushort)((lba & 0xFFFF) / 0x1) }; registers.DeviceHead += 0x40; - LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.Dma, AtaTransferRegister.SectorCount, + LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.Dma, + AtaTransferRegister.SectorCount, ref buffer, timeout, true, out duration, out bool sense); Error = LastError != 0; @@ -87,22 +89,24 @@ 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 { - Command = (byte)AtaCommands.ReadLogExt, + Command = (byte)AtaCommands.ReadLogExt, SectorCount = count, - LbaLow = (ushort)((pageNumber & 0xFF) * 0x100), - LbaHigh = (ushort)((pageNumber & 0xFF00) / 0x100) + LbaLow = (ushort)((pageNumber & 0xFF) * 0x100), + LbaHigh = (ushort)((pageNumber & 0xFF00) / 0x100) }; registers.LbaLow += logAddress; - LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn, - AtaTransferRegister.SectorCount, ref buffer, timeout, true, out duration, + LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn, + AtaTransferRegister.SectorCount, ref buffer, timeout, true, + out duration, out bool sense); Error = LastError != 0; @@ -111,21 +115,23 @@ 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 { - Command = (byte)AtaCommands.ReadLogDmaExt, + Command = (byte)AtaCommands.ReadLogDmaExt, SectorCount = count, - LbaLow = (ushort)((pageNumber & 0xFF) * 0x100), - LbaHigh = (ushort)((pageNumber & 0xFF00) / 0x100) + LbaLow = (ushort)((pageNumber & 0xFF) * 0x100), + LbaHigh = (ushort)((pageNumber & 0xFF00) / 0x100) }; registers.LbaLow += logAddress; - LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.Dma, AtaTransferRegister.SectorCount, + LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.Dma, + AtaTransferRegister.SectorCount, ref buffer, timeout, true, out duration, out bool sense); Error = LastError != 0; @@ -134,23 +140,25 @@ 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) { buffer = count == 0 ? new byte[512 * 65536] : new byte[512 * count]; AtaRegistersLba48 registers = new AtaRegistersLba48 { - Command = (byte)AtaCommands.ReadMultipleExt, + Command = (byte)AtaCommands.ReadMultipleExt, SectorCount = count, - LbaHigh = (ushort)((lba & 0xFFFF00000000) / 0x100000000), - LbaMid = (ushort)((lba & 0xFFFF0000) / 0x10000), - LbaLow = (ushort)((lba & 0xFFFF) / 0x1) + LbaHigh = (ushort)((lba & 0xFFFF00000000) / 0x100000000), + LbaMid = (ushort)((lba & 0xFFFF0000) / 0x10000), + LbaLow = (ushort)((lba & 0xFFFF) / 0x1) }; registers.DeviceHead += 0x40; - LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn, - AtaTransferRegister.SectorCount, ref buffer, timeout, true, out duration, + LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn, + AtaTransferRegister.SectorCount, ref buffer, timeout, true, + out duration, out bool sense); Error = LastError != 0; @@ -159,23 +167,24 @@ namespace DiscImageChef.Devices return sense; } - public bool ReadNativeMaxAddress(out ulong lba, out AtaErrorRegistersLba48 statusRegisters, uint timeout, + public bool ReadNativeMaxAddress(out ulong lba, out AtaErrorRegistersLba48 statusRegisters, uint timeout, out double duration) { lba = 0; - byte[] buffer = new byte[0]; + byte[] buffer = new byte[0]; AtaRegistersLba48 registers = new AtaRegistersLba48 {Command = (byte)AtaCommands.ReadNativeMaxAddressExt}; registers.DeviceHead += 0x40; - LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.NonData, - AtaTransferRegister.NoTransfer, ref buffer, timeout, false, out duration, + LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.NonData, + AtaTransferRegister.NoTransfer, ref buffer, timeout, false, + out duration, out bool sense); Error = LastError != 0; if((statusRegisters.Status & 0x23) == 0) { - lba = statusRegisters.LbaHigh; + lba = statusRegisters.LbaHigh; lba *= 0x100000000; lba += (ulong)(statusRegisters.LbaMid << 16); lba += statusRegisters.LbaLow; @@ -186,23 +195,24 @@ 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) { buffer = count == 0 ? new byte[512 * 65536] : new byte[512 * count]; AtaRegistersLba48 registers = new AtaRegistersLba48 { - Command = (byte)AtaCommands.ReadExt, + Command = (byte)AtaCommands.ReadExt, SectorCount = count, - LbaHigh = (ushort)((lba & 0xFFFF00000000) / 0x100000000), - LbaMid = (ushort)((lba & 0xFFFF0000) / 0x10000), - LbaLow = (ushort)((lba & 0xFFFF) / 0x1) + LbaHigh = (ushort)((lba & 0xFFFF00000000) / 0x100000000), + LbaMid = (ushort)((lba & 0xFFFF0000) / 0x10000), + LbaLow = (ushort)((lba & 0xFFFF) / 0x1) }; registers.DeviceHead += 0x40; - LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn, - AtaTransferRegister.SectorCount, ref buffer, timeout, true, out duration, + LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn, + AtaTransferRegister.SectorCount, ref buffer, timeout, true, + out duration, out bool sense); Error = LastError != 0; diff --git a/DiscImageChef.Devices/Device/AtaCommands/AtaCHS.cs b/DiscImageChef.Devices/Device/AtaCommands/AtaCHS.cs index e015ff307..cb219b37c 100644 --- a/DiscImageChef.Devices/Device/AtaCommands/AtaCHS.cs +++ b/DiscImageChef.Devices/Device/AtaCommands/AtaCHS.cs @@ -83,7 +83,7 @@ namespace DiscImageChef.Devices public bool AtaIdentify(out byte[] buffer, out AtaErrorRegistersChs statusRegisters, uint timeout, out double duration) { - buffer = new byte[512]; + buffer = new byte[512]; AtaRegistersChs registers = new AtaRegistersChs {Command = (byte)AtaCommands.IdentifyDevice}; LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn, @@ -106,16 +106,16 @@ namespace DiscImageChef.Devices } public bool ReadDma(out byte[] buffer, out AtaErrorRegistersChs statusRegisters, bool retry, ushort cylinder, - byte head, byte sector, byte count, uint timeout, + byte head, byte sector, byte count, uint timeout, out double duration) { - buffer = count == 0 ? new byte[512 * 256] : new byte[512 * count]; + buffer = count == 0 ? new byte[512 * 256] : new byte[512 * count]; AtaRegistersChs registers = new AtaRegistersChs { SectorCount = count, CylinderHigh = (byte)((cylinder & 0xFF00) / 0x100), CylinderLow = (byte)((cylinder & 0xFF) / 0x1), - DeviceHead = (byte)(head & 0x0F), + DeviceHead = (byte)(head & 0x0F), Sector = sector, Command = retry ? (byte)AtaCommands.ReadDmaRetry : (byte)AtaCommands.ReadDma }; @@ -130,18 +130,18 @@ 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) { - buffer = count == 0 ? new byte[512 * 256] : new byte[512 * count]; + buffer = count == 0 ? new byte[512 * 256] : new byte[512 * count]; AtaRegistersChs registers = new AtaRegistersChs { Command = (byte)AtaCommands.ReadMultiple, SectorCount = count, CylinderHigh = (byte)((cylinder & 0xFF00) / 0x100), CylinderLow = (byte)((cylinder & 0xFF) / 0x1), - DeviceHead = (byte)(head & 0x0F), + DeviceHead = (byte)(head & 0x0F), Sector = sector }; @@ -157,24 +157,24 @@ namespace DiscImageChef.Devices } public bool Read(out byte[] buffer, out AtaErrorRegistersChs statusRegisters, ushort cylinder, byte head, - byte sector, byte count, uint timeout, + 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, + byte head, byte sector, byte count, uint timeout, out double duration) { - buffer = count == 0 ? new byte[512 * 256] : new byte[512 * count]; + buffer = count == 0 ? new byte[512 * 256] : new byte[512 * count]; AtaRegistersChs registers = new AtaRegistersChs { Command = retry ? (byte)AtaCommands.ReadRetry : (byte)AtaCommands.Read, SectorCount = count, CylinderHigh = (byte)((cylinder & 0xFF00) / 0x100), CylinderLow = (byte)((cylinder & 0xFF) / 0x1), - DeviceHead = (byte)(head & 0x0F), + DeviceHead = (byte)(head & 0x0F), Sector = sector }; @@ -198,18 +198,19 @@ namespace DiscImageChef.Devices 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]; + buffer = new byte[blockSize]; AtaRegistersChs registers = new AtaRegistersChs { Command = retry ? (byte)AtaCommands.ReadLongRetry : (byte)AtaCommands.ReadLong, SectorCount = 1, CylinderHigh = (byte)((cylinder & 0xFF00) / 0x100), CylinderLow = (byte)((cylinder & 0xFF) / 0x1), - DeviceHead = (byte)(head & 0x0F), + DeviceHead = (byte)(head & 0x0F), Sector = sector }; @@ -224,16 +225,16 @@ 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]; + byte[] buffer = new byte[0]; AtaRegistersChs registers = new AtaRegistersChs { Command = (byte)AtaCommands.Seek, CylinderHigh = (byte)((cylinder & 0xFF00) / 0x100), CylinderLow = (byte)((cylinder & 0xFF) / 0x1), - DeviceHead = (byte)(head & 0x0F), + DeviceHead = (byte)(head & 0x0F), Sector = sector }; @@ -254,16 +255,16 @@ namespace DiscImageChef.Devices } public bool SetFeatures(out AtaErrorRegistersChs statusRegisters, AtaFeatures feature, ushort cylinder, - byte head, byte sector, byte sectorCount, - uint timeout, out double duration) + byte head, byte sector, byte sectorCount, + uint timeout, out double duration) { - byte[] buffer = new byte[0]; + byte[] buffer = new byte[0]; AtaRegistersChs registers = new AtaRegistersChs { Command = (byte)AtaCommands.SetFeatures, CylinderHigh = (byte)((cylinder & 0xFF00) / 0x100), CylinderLow = (byte)((cylinder & 0xFF) / 0x1), - DeviceHead = (byte)(head & 0x0F), + DeviceHead = (byte)(head & 0x0F), Sector = sector, SectorCount = sectorCount, Feature = (byte)feature diff --git a/DiscImageChef.Devices/Device/AtaCommands/Atapi.cs b/DiscImageChef.Devices/Device/AtaCommands/Atapi.cs index 5d475f65f..d0a73b716 100644 --- a/DiscImageChef.Devices/Device/AtaCommands/Atapi.cs +++ b/DiscImageChef.Devices/Device/AtaCommands/Atapi.cs @@ -86,8 +86,9 @@ namespace DiscImageChef.Devices buffer = new byte[512]; AtaRegistersChs registers = new AtaRegistersChs {Command = (byte)AtaCommands.IdentifyPacketDevice}; - LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn, - AtaTransferRegister.NoTransfer, ref buffer, timeout, false, out duration, + LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn, + AtaTransferRegister.NoTransfer, ref buffer, timeout, false, + out duration, out bool sense); Error = LastError != 0; diff --git a/DiscImageChef.Devices/Device/AtaCommands/Cfa.cs b/DiscImageChef.Devices/Device/AtaCommands/Cfa.cs index 426c71586..9a842e053 100644 --- a/DiscImageChef.Devices/Device/AtaCommands/Cfa.cs +++ b/DiscImageChef.Devices/Device/AtaCommands/Cfa.cs @@ -37,23 +37,24 @@ 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 { - Command = (byte)AtaCommands.TranslateSector, + Command = (byte)AtaCommands.TranslateSector, DeviceHead = (byte)((lba & 0xF000000) / 0x1000000), - LbaHigh = (byte)((lba & 0xFF0000) / 0x10000), - LbaMid = (byte)((lba & 0xFF00) / 0x100), - LbaLow = (byte)((lba & 0xFF) / 0x1) + LbaHigh = (byte)((lba & 0xFF0000) / 0x10000), + LbaMid = (byte)((lba & 0xFF00) / 0x100), + LbaLow = (byte)((lba & 0xFF) / 0x1) }; registers.DeviceHead += 0x40; - LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn, - AtaTransferRegister.NoTransfer, ref buffer, timeout, false, out duration, + LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn, + AtaTransferRegister.NoTransfer, ref buffer, timeout, false, + out duration, out bool sense); Error = LastError != 0; @@ -63,20 +64,22 @@ namespace DiscImageChef.Devices } public bool TranslateSector(out byte[] buffer, out AtaErrorRegistersChs statusRegisters, ushort cylinder, - byte head, byte sector, uint timeout, out double duration) + byte head, byte sector, uint timeout, + out double duration) { buffer = new byte[512]; AtaRegistersChs registers = new AtaRegistersChs { - Command = (byte)AtaCommands.TranslateSector, + Command = (byte)AtaCommands.TranslateSector, CylinderHigh = (byte)((cylinder & 0xFF00) / 0x100), - CylinderLow = (byte)((cylinder & 0xFF) / 0x1), - Sector = sector, - DeviceHead = (byte)(head & 0x0F) + CylinderLow = (byte)((cylinder & 0xFF) / 0x1), + Sector = sector, + DeviceHead = (byte)(head & 0x0F) }; - LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn, - AtaTransferRegister.NoTransfer, ref buffer, timeout, false, out duration, + LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn, + AtaTransferRegister.NoTransfer, ref buffer, timeout, false, + out duration, out bool sense); Error = LastError != 0; @@ -86,13 +89,14 @@ namespace DiscImageChef.Devices } public bool RequestExtendedErrorCode(out byte errorCode, out AtaErrorRegistersLba28 statusRegisters, - uint timeout, out double duration) + uint timeout, out double duration) { - byte[] buffer = new byte[0]; + byte[] buffer = new byte[0]; AtaRegistersLba28 registers = new AtaRegistersLba28 {Command = (byte)AtaCommands.RequestSense}; - LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn, - AtaTransferRegister.NoTransfer, ref buffer, timeout, false, out duration, + LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn, + AtaTransferRegister.NoTransfer, ref buffer, timeout, false, + out duration, out bool sense); Error = LastError != 0; diff --git a/DiscImageChef.Devices/Device/AtaCommands/MCPT.cs b/DiscImageChef.Devices/Device/AtaCommands/MCPT.cs index ad78996b9..13f5b79f6 100644 --- a/DiscImageChef.Devices/Device/AtaCommands/MCPT.cs +++ b/DiscImageChef.Devices/Device/AtaCommands/MCPT.cs @@ -38,26 +38,27 @@ namespace DiscImageChef.Devices public partial class Device { public bool EnableMediaCardPassThrough(out AtaErrorRegistersChs statusRegisters, uint timeout, - out double duration) + out double duration) { return CheckMediaCardType(1, out statusRegisters, timeout, out duration); } public bool DisableMediaCardPassThrough(out AtaErrorRegistersChs statusRegisters, uint timeout, - out double duration) + out double duration) { return CheckMediaCardType(0, out statusRegisters, timeout, out duration); } - public bool CheckMediaCardType(byte feature, out AtaErrorRegistersChs statusRegisters, uint timeout, + public bool CheckMediaCardType(byte feature, out AtaErrorRegistersChs statusRegisters, uint timeout, out double duration) { byte[] buffer = new byte[0]; AtaRegistersChs registers = new AtaRegistersChs {Command = (byte)AtaCommands.CheckMediaCardType, Feature = feature}; - LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.NonData, - AtaTransferRegister.NoTransfer, ref buffer, timeout, false, out duration, + LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.NonData, + AtaTransferRegister.NoTransfer, ref buffer, timeout, false, + out duration, out bool sense); Error = LastError != 0; diff --git a/DiscImageChef.Devices/Device/AtaCommands/Smart.cs b/DiscImageChef.Devices/Device/AtaCommands/Smart.cs index f0ad7d689..7df1a0962 100644 --- a/DiscImageChef.Devices/Device/AtaCommands/Smart.cs +++ b/DiscImageChef.Devices/Device/AtaCommands/Smart.cs @@ -45,11 +45,12 @@ namespace DiscImageChef.Devices Command = (byte)AtaCommands.Smart, Feature = (byte)AtaSmartSubCommands.Disable, LbaHigh = 0xC2, - LbaMid = 0x4F + LbaMid = 0x4F }; - LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.NonData, - AtaTransferRegister.NoTransfer, ref buffer, timeout, false, out duration, + LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.NonData, + AtaTransferRegister.NoTransfer, ref buffer, timeout, false, + out duration, out bool sense); Error = LastError != 0; @@ -59,20 +60,21 @@ namespace DiscImageChef.Devices } public bool SmartEnableAttributeAutosave(out AtaErrorRegistersLba28 statusRegisters, uint timeout, - out double duration) + out double duration) { byte[] buffer = new byte[0]; AtaRegistersLba28 registers = new AtaRegistersLba28 { - Command = (byte)AtaCommands.Smart, - Feature = (byte)AtaSmartSubCommands.EnableDisableAttributeAutosave, - LbaHigh = 0xC2, - LbaMid = 0x4F, + Command = (byte)AtaCommands.Smart, + Feature = (byte)AtaSmartSubCommands.EnableDisableAttributeAutosave, + LbaHigh = 0xC2, + LbaMid = 0x4F, SectorCount = 0xF1 }; - LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.NonData, - AtaTransferRegister.NoTransfer, ref buffer, timeout, false, out duration, + LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.NonData, + AtaTransferRegister.NoTransfer, ref buffer, timeout, false, + out duration, out bool sense); Error = LastError != 0; @@ -82,7 +84,7 @@ namespace DiscImageChef.Devices } public bool SmartDisableAttributeAutosave(out AtaErrorRegistersLba28 statusRegisters, uint timeout, - out double duration) + out double duration) { byte[] buffer = new byte[0]; AtaRegistersLba28 registers = new AtaRegistersLba28 @@ -90,11 +92,12 @@ namespace DiscImageChef.Devices Command = (byte)AtaCommands.Smart, Feature = (byte)AtaSmartSubCommands.EnableDisableAttributeAutosave, LbaHigh = 0xC2, - LbaMid = 0x4F + LbaMid = 0x4F }; - LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.NonData, - AtaTransferRegister.NoTransfer, ref buffer, timeout, false, out duration, + LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.NonData, + AtaTransferRegister.NoTransfer, ref buffer, timeout, false, + out duration, out bool sense); Error = LastError != 0; @@ -111,11 +114,12 @@ namespace DiscImageChef.Devices Command = (byte)AtaCommands.Smart, Feature = (byte)AtaSmartSubCommands.Enable, LbaHigh = 0xC2, - LbaMid = 0x4F + LbaMid = 0x4F }; - LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.NonData, - AtaTransferRegister.NoTransfer, ref buffer, timeout, false, out duration, + LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.NonData, + AtaTransferRegister.NoTransfer, ref buffer, timeout, false, + out duration, out bool sense); Error = LastError != 0; @@ -124,8 +128,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 @@ -133,12 +137,13 @@ namespace DiscImageChef.Devices Command = (byte)AtaCommands.Smart, Feature = (byte)AtaSmartSubCommands.ExecuteOfflineImmediate, LbaHigh = 0xC2, - LbaMid = 0x4F, - LbaLow = subcommand + LbaMid = 0x4F, + LbaLow = subcommand }; - LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.NonData, - AtaTransferRegister.NoTransfer, ref buffer, timeout, false, out duration, + LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.NonData, + AtaTransferRegister.NoTransfer, ref buffer, timeout, false, + out duration, out bool sense); Error = LastError != 0; @@ -156,11 +161,12 @@ namespace DiscImageChef.Devices Command = (byte)AtaCommands.Smart, Feature = (byte)AtaSmartSubCommands.ReadData, LbaHigh = 0xC2, - LbaMid = 0x4F + LbaMid = 0x4F }; - LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn, - AtaTransferRegister.NoTransfer, ref buffer, timeout, false, out duration, + LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn, + AtaTransferRegister.NoTransfer, ref buffer, timeout, false, + out duration, out bool sense); Error = LastError != 0; @@ -169,8 +175,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 @@ -178,12 +184,13 @@ namespace DiscImageChef.Devices Command = (byte)AtaCommands.Smart, Feature = (byte)AtaSmartSubCommands.ReadLog, LbaHigh = 0xC2, - LbaMid = 0x4F, - LbaLow = logAddress + LbaMid = 0x4F, + LbaLow = logAddress }; - LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn, - AtaTransferRegister.NoTransfer, ref buffer, timeout, false, out duration, + LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn, + AtaTransferRegister.NoTransfer, ref buffer, timeout, false, + out duration, out bool sense); Error = LastError != 0; @@ -200,11 +207,12 @@ namespace DiscImageChef.Devices Command = (byte)AtaCommands.Smart, Feature = (byte)AtaSmartSubCommands.ReturnStatus, LbaHigh = 0xC2, - LbaMid = 0x4F + LbaMid = 0x4F }; - LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.NonData, - AtaTransferRegister.NoTransfer, ref buffer, timeout, false, out duration, + LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.NonData, + AtaTransferRegister.NoTransfer, ref buffer, timeout, false, + out duration, out bool sense); Error = LastError != 0; diff --git a/DiscImageChef.Devices/Device/Commands.cs b/DiscImageChef.Devices/Device/Commands.cs index ed7caa9e9..9a2538b93 100644 --- a/DiscImageChef.Devices/Device/Commands.cs +++ b/DiscImageChef.Devices/Device/Commands.cs @@ -53,8 +53,8 @@ namespace DiscImageChef.Devices /// 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, FileHandle, cdb, ref buffer, out senseBuffer, timeout, direction, out duration, out sense); @@ -77,8 +77,10 @@ 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, FileHandle, registers, out errorRegisters, protocol, transferRegister, ref buffer, timeout, transferBlocks, out duration, @@ -102,8 +104,10 @@ 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, FileHandle, registers, out errorRegisters, protocol, transferRegister, ref buffer, timeout, transferBlocks, out duration, @@ -127,8 +131,10 @@ 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, FileHandle, registers, out errorRegisters, protocol, transferRegister, ref buffer, timeout, transferBlocks, out duration, @@ -151,9 +157,10 @@ 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, - out double duration, out bool sense, uint timeout = 0) + 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) { switch(command) { @@ -163,7 +170,7 @@ namespace DiscImageChef.Devices buffer = new byte[cachedCid.Length]; Array.Copy(cachedCid, buffer, buffer.Length); response = new uint[4]; - sense = false; + sense = false; DateTime end = DateTime.Now; duration = (end - start).TotalMilliseconds; return 0; @@ -174,7 +181,7 @@ namespace DiscImageChef.Devices buffer = new byte[cachedCsd.Length]; Array.Copy(cachedCsd, buffer, buffer.Length); response = new uint[4]; - sense = false; + sense = false; DateTime end = DateTime.Now; duration = (end - start).TotalMilliseconds; return 0; @@ -185,7 +192,7 @@ namespace DiscImageChef.Devices buffer = new byte[cachedScr.Length]; Array.Copy(cachedScr, buffer, buffer.Length); response = new uint[4]; - sense = false; + sense = false; DateTime end = DateTime.Now; duration = (end - start).TotalMilliseconds; return 0; @@ -203,7 +210,7 @@ namespace DiscImageChef.Devices buffer = new byte[cachedOcr.Length]; Array.Copy(cachedOcr, buffer, buffer.Length); response = new uint[4]; - sense = false; + sense = false; DateTime end = DateTime.Now; duration = (end - start).TotalMilliseconds; return 0; diff --git a/DiscImageChef.Devices/Device/List.cs b/DiscImageChef.Devices/Device/List.cs index a26ac834c..736361d48 100644 --- a/DiscImageChef.Devices/Device/List.cs +++ b/DiscImageChef.Devices/Device/List.cs @@ -43,7 +43,7 @@ namespace DiscImageChef.Devices public string Model; public string Serial; public string Bus; - public bool Supported; + public bool Supported; } public partial class Device @@ -53,7 +53,7 @@ namespace DiscImageChef.Devices switch(DetectOS.GetRealPlatformID()) { case PlatformID.Win32NT: return Windows.ListDevices.GetList(); - case PlatformID.Linux: return Linux.ListDevices.GetList(); + case PlatformID.Linux: return Linux.ListDevices.GetList(); case PlatformID.FreeBSD: return FreeBSD.ListDevices.GetList(); default: throw new InvalidOperationException($"Platform {DetectOS.GetRealPlatformID()} not yet supported."); diff --git a/DiscImageChef.Devices/Device/MmcCommands/MMC.cs b/DiscImageChef.Devices/Device/MmcCommands/MMC.cs index 3385bd6b4..2e3bb2146 100644 --- a/DiscImageChef.Devices/Device/MmcCommands/MMC.cs +++ b/DiscImageChef.Devices/Device/MmcCommands/MMC.cs @@ -40,9 +40,12 @@ namespace DiscImageChef.Devices { buffer = new byte[16]; - LastError = SendMmcCommand(MmcCommands.SendCsd, false, false, - MmcFlags.ResponseSpiR2 | MmcFlags.ResponseR2 | MmcFlags.CommandAc, 0, 16, 1, - ref buffer, out response, out duration, out bool sense, timeout); + LastError = SendMmcCommand(MmcCommands.SendCsd, false, + false, + MmcFlags.ResponseSpiR2 | MmcFlags.ResponseR2 | MmcFlags.CommandAc, 0, + 16, 1, + ref buffer, out response, + out duration, out bool sense, timeout); Error = LastError != 0; DicConsole.DebugWriteLine("MMC Device", "SEND_CSD took {0} ms.", duration); @@ -54,9 +57,12 @@ namespace DiscImageChef.Devices { buffer = new byte[16]; - LastError = SendMmcCommand(MmcCommands.SendCid, false, false, - MmcFlags.ResponseSpiR2 | MmcFlags.ResponseR2 | MmcFlags.CommandAc, 0, 16, 1, - ref buffer, out response, out duration, out bool sense, timeout); + LastError = SendMmcCommand(MmcCommands.SendCid, false, + false, + MmcFlags.ResponseSpiR2 | MmcFlags.ResponseR2 | MmcFlags.CommandAc, 0, + 16, 1, + ref buffer, out response, + out duration, out bool sense, timeout); Error = LastError != 0; DicConsole.DebugWriteLine("MMC Device", "SEND_CID took {0} ms.", duration); @@ -68,9 +74,12 @@ namespace DiscImageChef.Devices { buffer = new byte[4]; - LastError = SendMmcCommand(MmcCommands.SendOpCond, false, true, - MmcFlags.ResponseSpiR3 | MmcFlags.ResponseR3 | MmcFlags.CommandBcr, 0, 4, 1, - ref buffer, out response, out duration, out bool sense, timeout); + LastError = SendMmcCommand(MmcCommands.SendOpCond, false, + true, + MmcFlags.ResponseSpiR3 | MmcFlags.ResponseR3 | MmcFlags.CommandBcr, 0, + 4, 1, + ref buffer, out response, + out duration, out bool sense, timeout); Error = LastError != 0; DicConsole.DebugWriteLine("SecureDigital Device", "SEND_OP_COND took {0} ms.", duration); @@ -82,9 +91,12 @@ namespace DiscImageChef.Devices { buffer = new byte[512]; - LastError = SendMmcCommand(MmcCommands.SendExtCsd, false, false, - MmcFlags.ResponseSpiR1 | MmcFlags.ResponseR1 | MmcFlags.CommandAdtc, 0, 512, 1, - ref buffer, out response, out duration, out bool sense, timeout); + LastError = SendMmcCommand(MmcCommands.SendExtCsd, false, + false, + MmcFlags.ResponseSpiR1 | MmcFlags.ResponseR1 | MmcFlags.CommandAdtc, 0, + 512, 1, + ref buffer, + out response, out duration, out bool sense, timeout); Error = LastError != 0; DicConsole.DebugWriteLine("MMC Device", "SEND_EXT_CSD took {0} ms.", duration); @@ -96,9 +108,12 @@ namespace DiscImageChef.Devices { byte[] buffer = new byte[0]; - LastError = SendMmcCommand(MmcCommands.SetBlocklen, false, false, - MmcFlags.ResponseSpiR1 | MmcFlags.ResponseR1 | MmcFlags.CommandAc, length, 0, 0, - ref buffer, out response, out duration, out bool sense, timeout); + LastError = SendMmcCommand(MmcCommands.SetBlocklen, false, + false, + MmcFlags.ResponseSpiR1 | MmcFlags.ResponseR1 | MmcFlags.CommandAc, length, + 0, 0, + ref buffer, out response, + out duration, out bool sense, timeout); Error = LastError != 0; DicConsole.DebugWriteLine("MMC Device", "SET_BLOCKLEN took {0} ms.", duration); @@ -106,28 +121,34 @@ 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]; uint address; if(byteAddressed) address = lba * blockSize; - else address = lba; + else address = lba; MmcCommands command = transferLength > 1 ? MmcCommands.ReadMultipleBlock : MmcCommands.ReadSingleBlock; - LastError = SendMmcCommand(command, false, false, + LastError = SendMmcCommand(command, false, + false, MmcFlags.ResponseSpiR1 | MmcFlags.ResponseR1 | MmcFlags.CommandAdtc, address, - blockSize, transferLength, ref buffer, out response, out duration, + blockSize, + transferLength, ref buffer, out response, out duration, out bool sense, timeout); Error = LastError != 0; if(transferLength > 1) { byte[] foo = new byte[0]; - SendMmcCommand(MmcCommands.StopTransmission, false, false, - MmcFlags.ResponseR1B | MmcFlags.ResponseSpiR1B | MmcFlags.CommandAc, 0, 0, 0, ref foo, - out _, out double stopDuration, out bool _, timeout); + SendMmcCommand(MmcCommands.StopTransmission, false, + false, + MmcFlags.ResponseR1B | MmcFlags.ResponseSpiR1B | MmcFlags.CommandAc, 0, + 0, 0, ref foo, + out _, + out double stopDuration, out bool _, timeout); duration += stopDuration; DicConsole.DebugWriteLine("MMC Device", "READ_MULTIPLE_BLOCK took {0} ms.", duration); } @@ -140,9 +161,12 @@ namespace DiscImageChef.Devices { buffer = new byte[4]; - LastError = SendMmcCommand(MmcCommands.SendStatus, false, true, - MmcFlags.ResponseSpiR1 | MmcFlags.ResponseR1 | MmcFlags.CommandAc, 0, 4, 1, - ref buffer, out response, out duration, out bool sense, timeout); + LastError = SendMmcCommand(MmcCommands.SendStatus, false, + true, + MmcFlags.ResponseSpiR1 | MmcFlags.ResponseR1 | MmcFlags.CommandAc, 0, + 4, 1, + ref buffer, out response, + out duration, out bool sense, timeout); Error = LastError != 0; DicConsole.DebugWriteLine("SecureDigital Device", "SEND_STATUS took {0} ms.", duration); diff --git a/DiscImageChef.Devices/Device/MmcCommands/SecureDigital.cs b/DiscImageChef.Devices/Device/MmcCommands/SecureDigital.cs index 9ac3c72e4..17d217aef 100644 --- a/DiscImageChef.Devices/Device/MmcCommands/SecureDigital.cs +++ b/DiscImageChef.Devices/Device/MmcCommands/SecureDigital.cs @@ -40,9 +40,12 @@ namespace DiscImageChef.Devices { buffer = new byte[64]; - LastError = SendMmcCommand((MmcCommands)SecureDigitalCommands.SendStatus, false, true, - MmcFlags.ResponseSpiR1 | MmcFlags.ResponseR1 | MmcFlags.CommandAdtc, 0, 64, 1, - ref buffer, out response, out duration, out bool sense, timeout); + LastError = SendMmcCommand((MmcCommands)SecureDigitalCommands.SendStatus, false, + true, + MmcFlags.ResponseSpiR1 | MmcFlags.ResponseR1 | MmcFlags.CommandAdtc, 0, + 64, 1, + ref buffer, + out response, out duration, out bool sense, timeout); Error = LastError != 0; DicConsole.DebugWriteLine("SecureDigital Device", "SD_STATUS took {0} ms.", duration); @@ -54,9 +57,12 @@ namespace DiscImageChef.Devices { buffer = new byte[4]; - LastError = SendMmcCommand((MmcCommands)SecureDigitalCommands.SendOperatingCondition, false, true, - MmcFlags.ResponseSpiR3 | MmcFlags.ResponseR3 | MmcFlags.CommandBcr, 0, 4, 1, - ref buffer, out response, out duration, out bool sense, timeout); + LastError = SendMmcCommand((MmcCommands)SecureDigitalCommands.SendOperatingCondition, false, + true, + MmcFlags.ResponseSpiR3 | MmcFlags.ResponseR3 | MmcFlags.CommandBcr, 0, + 4, 1, + ref buffer, out response, + out duration, out bool sense, timeout); Error = LastError != 0; DicConsole.DebugWriteLine("SecureDigital Device", "SD_SEND_OP_COND took {0} ms.", duration); @@ -68,9 +74,12 @@ namespace DiscImageChef.Devices { buffer = new byte[8]; - LastError = SendMmcCommand((MmcCommands)SecureDigitalCommands.SendScr, false, true, - MmcFlags.ResponseSpiR1 | MmcFlags.ResponseR1 | MmcFlags.CommandAdtc, 0, 8, 1, - ref buffer, out response, out duration, out bool sense, timeout); + LastError = SendMmcCommand((MmcCommands)SecureDigitalCommands.SendScr, false, + true, + MmcFlags.ResponseSpiR1 | MmcFlags.ResponseR1 | MmcFlags.CommandAdtc, 0, + 8, 1, + ref buffer, + out response, out duration, out bool sense, timeout); Error = LastError != 0; DicConsole.DebugWriteLine("SecureDigital Device", "SEND_SCR took {0} ms.", duration); diff --git a/DiscImageChef.Devices/Device/ScsiCommands/Adaptec.cs b/DiscImageChef.Devices/Device/ScsiCommands/Adaptec.cs index 863847729..8c1c5743a 100644 --- a/DiscImageChef.Devices/Device/ScsiCommands/Adaptec.cs +++ b/DiscImageChef.Devices/Device/ScsiCommands/Adaptec.cs @@ -70,7 +70,7 @@ namespace DiscImageChef.Devices cdb[0] = (byte)ScsiCommands.AdaptecTranslate; cdb[1] = (byte)((lba & 0x1F0000) >> 16); - cdb[2] = (byte)((lba & 0xFF00) >> 8); + cdb[2] = (byte)((lba & 0xFF00) >> 8); cdb[3] = (byte)(lba & 0xFF); if(drive1) cdb[1] += 0x20; @@ -105,7 +105,7 @@ 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, + public bool AdaptecSetErrorThreshold(byte threshold, out byte[] senseBuffer, bool drive1, uint timeout, out double duration) { byte[] buffer = new byte[1]; diff --git a/DiscImageChef.Devices/Device/ScsiCommands/ArchiveCorp.cs b/DiscImageChef.Devices/Device/ScsiCommands/ArchiveCorp.cs index 0848645e1..3d0a19fff 100644 --- a/DiscImageChef.Devices/Device/ScsiCommands/ArchiveCorp.cs +++ b/DiscImageChef.Devices/Device/ScsiCommands/ArchiveCorp.cs @@ -53,7 +53,7 @@ namespace DiscImageChef.Devices cdb[0] = (byte)ScsiCommands.ArchiveRequestBlockAddress; cdb[1] = (byte)((lba & 0x1F0000) >> 16); - cdb[2] = (byte)((lba & 0xFF00) >> 8); + cdb[2] = (byte)((lba & 0xFF00) >> 8); cdb[3] = (byte)(lba & 0xFF); cdb[4] = 3; @@ -90,12 +90,12 @@ namespace DiscImageChef.Devices out double duration) { byte[] buffer = new byte[0]; - byte[] cdb = new byte[6]; + byte[] cdb = new byte[6]; senseBuffer = new byte[32]; cdb[0] = (byte)ScsiCommands.ArchiveSeekBlock; cdb[1] = (byte)((lba & 0x1F0000) >> 16); - cdb[2] = (byte)((lba & 0xFF00) >> 8); + cdb[2] = (byte)((lba & 0xFF00) >> 8); cdb[3] = (byte)(lba & 0xFF); if(immediate) cdb[1] += 0x01; diff --git a/DiscImageChef.Devices/Device/ScsiCommands/Certance.cs b/DiscImageChef.Devices/Device/ScsiCommands/Certance.cs index 6959ef96f..a9775f7d2 100644 --- a/DiscImageChef.Devices/Device/ScsiCommands/Certance.cs +++ b/DiscImageChef.Devices/Device/ScsiCommands/Certance.cs @@ -70,7 +70,7 @@ namespace DiscImageChef.Devices public bool CertanceParkUnpark(out byte[] senseBuffer, bool park, uint timeout, out double duration) { byte[] buffer = new byte[0]; - byte[] cdb = new byte[6]; + byte[] cdb = new byte[6]; senseBuffer = new byte[32]; cdb[0] = (byte)ScsiCommands.CertanceParkUnpark; diff --git a/DiscImageChef.Devices/Device/ScsiCommands/Fujitsu.cs b/DiscImageChef.Devices/Device/ScsiCommands/Fujitsu.cs index c5ebd4590..51cad4742 100644 --- a/DiscImageChef.Devices/Device/ScsiCommands/Fujitsu.cs +++ b/DiscImageChef.Devices/Device/ScsiCommands/Fujitsu.cs @@ -38,22 +38,23 @@ 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]; + byte[] firstHalfBytes = new byte[8]; byte[] secondHalfBytes = new byte[8]; - byte[] buffer = new byte[17]; - bool displayLen = false; - bool halfMsg = false; - byte[] cdb = new byte[10]; + byte[] buffer = new byte[17]; + bool displayLen = false; + bool halfMsg = false; + byte[] cdb = new byte[10]; if(!string.IsNullOrWhiteSpace(firstHalf)) { tmp = Encoding.ASCII.GetBytes(firstHalf); Array.Copy(tmp, 0, firstHalfBytes, 0, 8); } + if(!string.IsNullOrWhiteSpace(secondHalf)) { tmp = Encoding.ASCII.GetBytes(secondHalf); @@ -62,17 +63,18 @@ namespace DiscImageChef.Devices if(mode != FujitsuDisplayModes.Half) if(!ArrayHelpers.ArrayIsNullOrWhiteSpace(firstHalfBytes) && - !ArrayHelpers.ArrayIsNullOrWhiteSpace(secondHalfBytes)) displayLen = true; + !ArrayHelpers.ArrayIsNullOrWhiteSpace(secondHalfBytes)) + displayLen = true; else if(!ArrayHelpers.ArrayIsNullOrWhiteSpace(firstHalfBytes) && ArrayHelpers.ArrayIsNullOrWhiteSpace(secondHalfBytes)) halfMsg = true; buffer[0] = (byte)((byte)mode << 5); if(displayLen) buffer[0] += 0x10; - if(flash) buffer[0] += 0x08; - if(halfMsg) buffer[0] += 0x04; + if(flash) buffer[0] += 0x08; + if(halfMsg) buffer[0] += 0x04; buffer[0] += 0x01; // Always ASCII - Array.Copy(firstHalfBytes, 0, buffer, 1, 8); + Array.Copy(firstHalfBytes, 0, buffer, 1, 8); Array.Copy(secondHalfBytes, 0, buffer, 9, 8); cdb[0] = (byte)ScsiCommands.FujitsuDisplay; diff --git a/DiscImageChef.Devices/Device/ScsiCommands/HL-DT-ST.cs b/DiscImageChef.Devices/Device/ScsiCommands/HL-DT-ST.cs index fb4d75702..6ccddcdde 100644 --- a/DiscImageChef.Devices/Device/ScsiCommands/HL-DT-ST.cs +++ b/DiscImageChef.Devices/Device/ScsiCommands/HL-DT-ST.cs @@ -46,22 +46,22 @@ 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]; buffer = new byte[2064 * transferLength]; - cdb[0] = (byte)ScsiCommands.HlDtStVendor; - cdb[1] = 0x48; - cdb[2] = 0x49; - cdb[3] = 0x54; - cdb[4] = 0x01; - cdb[6] = (byte)((lba & 0xFF000000) >> 24); - cdb[7] = (byte)((lba & 0xFF0000) >> 16); - cdb[8] = (byte)((lba & 0xFF00) >> 8); - cdb[9] = (byte)(lba & 0xFF); + cdb[0] = (byte)ScsiCommands.HlDtStVendor; + cdb[1] = 0x48; + cdb[2] = 0x49; + cdb[3] = 0x54; + cdb[4] = 0x01; + cdb[6] = (byte)((lba & 0xFF000000) >> 24); + cdb[7] = (byte)((lba & 0xFF0000) >> 16); + cdb[8] = (byte)((lba & 0xFF00) >> 8); + cdb[9] = (byte)(lba & 0xFF); cdb[10] = (byte)((buffer.Length & 0xFF00) >> 8); cdb[11] = (byte)(buffer.Length & 0xFF); diff --git a/DiscImageChef.Devices/Device/ScsiCommands/HP.cs b/DiscImageChef.Devices/Device/ScsiCommands/HP.cs index 18a23de76..99882e199 100644 --- a/DiscImageChef.Devices/Device/ScsiCommands/HP.cs +++ b/DiscImageChef.Devices/Device/ScsiCommands/HP.cs @@ -48,8 +48,9 @@ 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); @@ -72,8 +73,9 @@ namespace DiscImageChef.Devices /// /// 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, + 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]; @@ -82,12 +84,12 @@ namespace DiscImageChef.Devices cdb[0] = (byte)ScsiCommands.ReadLong; if(relAddr) cdb[1] += 0x01; cdb[2] = (byte)((address & 0xFF000000) >> 24); - cdb[3] = (byte)((address & 0xFF0000) >> 16); - cdb[4] = (byte)((address & 0xFF00) >> 8); + 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(pba) cdb[9] += 0x80; if(sectorCount) cdb[9] += 0x40; buffer = sectorCount ? new byte[blockBytes * transferLen] : new byte[transferLen]; diff --git a/DiscImageChef.Devices/Device/ScsiCommands/Kreon.cs b/DiscImageChef.Devices/Device/ScsiCommands/Kreon.cs index 09ccf67cd..de4e7dbec 100644 --- a/DiscImageChef.Devices/Device/ScsiCommands/Kreon.cs +++ b/DiscImageChef.Devices/Device/ScsiCommands/Kreon.cs @@ -47,7 +47,7 @@ namespace DiscImageChef.Devices public bool KreonDeprecatedUnlock(out byte[] senseBuffer, uint timeout, out double duration) { senseBuffer = new byte[32]; - byte[] cdb = new byte[6]; + byte[] cdb = new byte[6]; byte[] buffer = new byte[0]; cdb[0] = (byte)ScsiCommands.KreonCommand; @@ -111,7 +111,7 @@ namespace DiscImageChef.Devices public bool KreonSetLockState(out byte[] senseBuffer, KreonLockStates state, uint timeout, out double duration) { senseBuffer = new byte[32]; - byte[] cdb = new byte[6]; + byte[] cdb = new byte[6]; byte[] buffer = new byte[0]; cdb[0] = (byte)ScsiCommands.KreonCommand; @@ -141,7 +141,7 @@ namespace DiscImageChef.Devices out double duration) { senseBuffer = new byte[32]; - byte[] cdb = new byte[6]; + byte[] cdb = new byte[6]; byte[] buffer = new byte[26]; features = 0; @@ -214,22 +214,22 @@ namespace DiscImageChef.Devices /// The SS sector. /// Request number. public bool KreonExtractSs(out byte[] buffer, out byte[] senseBuffer, uint timeout, out double duration, - byte requestNumber = 0x00) + byte requestNumber = 0x00) { buffer = new byte[2048]; byte[] cdb = new byte[12]; senseBuffer = new byte[32]; - cdb[0] = (byte)ScsiCommands.KreonSsCommand; - cdb[1] = 0x00; - cdb[2] = 0xFF; - cdb[3] = 0x02; - cdb[4] = 0xFD; - cdb[5] = 0xFF; - cdb[6] = 0xFE; - cdb[7] = 0x00; - cdb[8] = 0x08; - cdb[9] = 0x00; + cdb[0] = (byte)ScsiCommands.KreonSsCommand; + cdb[1] = 0x00; + cdb[2] = 0xFF; + cdb[3] = 0x02; + cdb[4] = 0xFD; + cdb[5] = 0xFF; + cdb[6] = 0xFE; + cdb[7] = 0x00; + cdb[8] = 0x08; + cdb[9] = 0x00; cdb[10] = requestNumber; cdb[11] = 0xC0; diff --git a/DiscImageChef.Devices/Device/ScsiCommands/MMC.cs b/DiscImageChef.Devices/Device/ScsiCommands/MMC.cs index af1224747..8e88db22e 100644 --- a/DiscImageChef.Devices/Device/ScsiCommands/MMC.cs +++ b/DiscImageChef.Devices/Device/ScsiCommands/MMC.cs @@ -61,7 +61,7 @@ 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, + 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, @@ -78,19 +78,20 @@ 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]; - buffer = new byte[8]; + byte[] cdb = new byte[10]; + buffer = new byte[8]; cdb[0] = (byte)ScsiCommands.GetConfiguration; - cdb[1] = (byte)((byte)rt & 0x03); + cdb[1] = (byte)((byte)rt & 0x03); cdb[2] = (byte)((startingFeatureNumber & 0xFF00) >> 8); - cdb[3] = (byte)(startingFeatureNumber & 0xFF); - cdb[7] = (byte)((buffer.Length & 0xFF00) >> 8); - cdb[8] = (byte)(buffer.Length & 0xFF); + cdb[3] = (byte)(startingFeatureNumber & 0xFF); + cdb[7] = (byte)((buffer.Length & 0xFF00) >> 8); + cdb[8] = (byte)(buffer.Length & 0xFF); cdb[9] = 0; LastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, @@ -100,10 +101,10 @@ namespace DiscImageChef.Devices if(sense) return true; ushort confLength = (ushort)((buffer[2] << 8) + buffer[3] + 4); - buffer = new byte[confLength]; - cdb[7] = (byte)((buffer.Length & 0xFF00) >> 8); - cdb[8] = (byte)(buffer.Length & 0xFF); - senseBuffer = new byte[32]; + buffer = new byte[confLength]; + cdb[7] = (byte)((buffer.Length & 0xFF00) >> 8); + cdb[8] = (byte)(buffer.Length & 0xFF); + senseBuffer = new byte[32]; LastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out sense); @@ -127,26 +128,26 @@ 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, + 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]; - buffer = new byte[8]; + byte[] cdb = new byte[12]; + buffer = new byte[8]; cdb[0] = (byte)ScsiCommands.ReadDiscStructure; cdb[1] = (byte)((byte)mediaType & 0x0F); - cdb[2] = (byte)((address & 0xFF000000) >> 24); - cdb[3] = (byte)((address & 0xFF0000) >> 16); - cdb[4] = (byte)((address & 0xFF00) >> 8); - cdb[5] = (byte)(address & 0xFF); + cdb[2] = (byte)((address & 0xFF000000) >> 24); + cdb[3] = (byte)((address & 0xFF0000) >> 16); + cdb[4] = (byte)((address & 0xFF00) >> 8); + cdb[5] = (byte)(address & 0xFF); cdb[6] = layerNumber; cdb[7] = (byte)format; cdb[8] = (byte)((buffer.Length & 0xFF00) >> 8); - cdb[9] = (byte)(buffer.Length & 0xFF); - cdb[10] = (byte)((agid & 0x03) << 6); + 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 bool sense); @@ -155,10 +156,9 @@ namespace DiscImageChef.Devices if(sense) return true; ushort strctLength = (ushort)((buffer[0] << 8) + buffer[1] + 2); - + // WORKAROUND: Some drives return incorrect length information. As these structures are fixed length just apply known length. if(mediaType == MmcDiscStructureMediaType.Bd) - { switch(format) { case MmcDiscStructureFormat.DiscInformation: @@ -180,12 +180,10 @@ namespace DiscImageChef.Devices buffer = new byte[strctLength]; break; } - } - else - buffer = new byte[strctLength]; - cdb[8] = (byte)((buffer.Length & 0xFF00) >> 8); - cdb[9] = (byte)(buffer.Length & 0xFF); - senseBuffer = new byte[32]; + else buffer = new byte[strctLength]; + cdb[8] = (byte)((buffer.Length & 0xFF00) >> 8); + cdb[9] = (byte)(buffer.Length & 0xFF); + senseBuffer = new byte[32]; LastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out sense); @@ -319,27 +317,27 @@ 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[] cdb = new byte[10]; byte[] tmpBuffer = (format & 0x0F) == 5 ? new byte[32768] : new byte[1024]; - cdb[0] = (byte)ScsiCommands.ReadTocPmaAtip; + cdb[0] = (byte)ScsiCommands.ReadTocPmaAtip; 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); + 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 bool sense); Error = LastError != 0; uint strctLength = (uint)((tmpBuffer[0] << 8) + tmpBuffer[1] + 2); - buffer = new byte[strctLength]; + buffer = new byte[strctLength]; if(buffer.Length <= tmpBuffer.Length) { @@ -386,23 +384,23 @@ namespace DiscImageChef.Devices MmcDiscInformationDataTypes dataType, uint timeout, out double duration) { - senseBuffer = new byte[32]; + senseBuffer = new byte[32]; byte[] cdb = new byte[10]; byte[] tmpBuffer = new byte[804]; cdb[0] = (byte)ScsiCommands.ReadDiscInformation; cdb[1] = (byte)dataType; cdb[7] = (byte)((tmpBuffer.Length & 0xFF00) >> 8); - cdb[8] = (byte)(tmpBuffer.Length & 0xFF); + cdb[8] = (byte)(tmpBuffer.Length & 0xFF); LastError = SendScsiCommand(cdb, ref tmpBuffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out bool sense); Error = LastError != 0; - uint strctLength = (uint)((tmpBuffer[0] << 8) + tmpBuffer[1] + 2); + uint strctLength = (uint)((tmpBuffer[0] << 8) + tmpBuffer[1] + 2); if(strctLength > tmpBuffer.Length) strctLength = (uint)tmpBuffer.Length; - buffer = new byte[strctLength]; + buffer = new byte[strctLength]; Array.Copy(tmpBuffer, 0, buffer, 0, buffer.Length); DicConsole.DebugWriteLine("SCSI Device", "READ DISC INFORMATION took {0} ms.", duration); @@ -430,32 +428,34 @@ 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]; + byte[] cdb = new byte[12]; - cdb[0] = (byte)ScsiCommands.ReadCd; - cdb[1] = (byte)((byte)expectedSectorType << 2); - 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); - cdb[5] = (byte)(lba & 0xFF); - cdb[6] = (byte)((transferLength & 0xFF0000) >> 16); - cdb[7] = (byte)((transferLength & 0xFF00) >> 8); - cdb[8] = (byte)(transferLength & 0xFF); - cdb[9] = (byte)((byte)c2Error << 1); - cdb[9] += (byte)((byte)headerCodes << 5); + cdb[0] = (byte)ScsiCommands.ReadCd; + cdb[1] = (byte)((byte)expectedSectorType << 2); + 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); + cdb[5] = (byte)(lba & 0xFF); + cdb[6] = (byte)((transferLength & 0xFF0000) >> 16); + cdb[7] = (byte)((transferLength & 0xFF00) >> 8); + 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; - cdb[10] = (byte)subchannel; + cdb[10] = (byte)subchannel; buffer = new byte[blockSize * transferLength]; @@ -487,32 +487,32 @@ 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, + 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, + bool userData, bool edcEcc, MmcErrorField c2Error, MmcSubchannel subchannel, uint timeout, out double duration) { senseBuffer = new byte[32]; - byte[] cdb = new byte[12]; + byte[] cdb = new byte[12]; - cdb[0] = (byte)ScsiCommands.ReadCdMsf; - cdb[1] = (byte)((byte)expectedSectorType << 2); - if(dap) cdb[1] += 0x02; - cdb[3] = (byte)((startMsf & 0xFF0000) >> 16); - cdb[4] = (byte)((startMsf & 0xFF00) >> 8); - cdb[5] = (byte)(startMsf & 0xFF); - cdb[6] = (byte)((endMsf & 0xFF0000) >> 16); - cdb[7] = (byte)((endMsf & 0xFF00) >> 8); - cdb[8] = (byte)(endMsf & 0xFF); - cdb[9] = (byte)((byte)c2Error << 1); - cdb[9] += (byte)((byte)headerCodes << 5); + cdb[0] = (byte)ScsiCommands.ReadCdMsf; + cdb[1] = (byte)((byte)expectedSectorType << 2); + if(dap) cdb[1] += 0x02; + cdb[3] = (byte)((startMsf & 0xFF0000) >> 16); + cdb[4] = (byte)((startMsf & 0xFF00) >> 8); + cdb[5] = (byte)(startMsf & 0xFF); + cdb[6] = (byte)((endMsf & 0xFF0000) >> 16); + cdb[7] = (byte)((endMsf & 0xFF00) >> 8); + 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; - cdb[10] = (byte)subchannel; + cdb[10] = (byte)subchannel; uint transferLength = (uint)((cdb[6] - cdb[3]) * 60 * 75 + (cdb[7] - cdb[4]) * 75 + (cdb[8] - cdb[5])); @@ -540,11 +540,11 @@ namespace DiscImageChef.Devices public bool PreventAllowMediumRemoval(out byte[] senseBuffer, bool persistent, bool prevent, uint timeout, out double duration) { - senseBuffer = new byte[32]; + senseBuffer = new byte[32]; byte[] cdb = new byte[6]; byte[] buffer = new byte[0]; - cdb[0] = (byte)ScsiCommands.PreventAllowMediumRemoval; + cdb[0] = (byte)ScsiCommands.PreventAllowMediumRemoval; if(prevent) cdb[4] += 0x01; if(persistent) cdb[4] += 0x02; @@ -577,15 +577,15 @@ 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, + 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]; + senseBuffer = new byte[32]; byte[] cdb = new byte[6]; byte[] buffer = new byte[0]; - cdb[0] = (byte)ScsiCommands.StartStopUnit; + cdb[0] = (byte)ScsiCommands.StartStopUnit; if(immediate) cdb[1] += 0x01; if(changeFormatLayer) { @@ -613,15 +613,15 @@ namespace DiscImageChef.Devices out double duration) { senseBuffer = new byte[32]; - byte[] cdb = new byte[10]; - mcn = null; + byte[] cdb = new byte[10]; + mcn = null; cdb[0] = (byte)ScsiCommands.ReadSubChannel; cdb[1] = 0; cdb[2] = 0x40; cdb[3] = 0x02; cdb[7] = (23 & 0xFF00) >> 8; - cdb[8] = 23 & 0xFF; + cdb[8] = 23 & 0xFF; buffer = new byte[23]; @@ -636,12 +636,13 @@ namespace DiscImageChef.Devices return sense; } - public bool ReadIsrc(byte trackNumber, out string isrc, out byte[] buffer, out byte[] senseBuffer, uint timeout, - out double duration) + public bool ReadIsrc(byte trackNumber, out string isrc, out byte[] buffer, out byte[] senseBuffer, + uint timeout, + out double duration) { senseBuffer = new byte[32]; - byte[] cdb = new byte[10]; - isrc = null; + byte[] cdb = new byte[10]; + isrc = null; cdb[0] = (byte)ScsiCommands.ReadSubChannel; cdb[1] = 0; @@ -649,7 +650,7 @@ namespace DiscImageChef.Devices cdb[3] = 0x03; cdb[6] = trackNumber; cdb[7] = (23 & 0xFF00) >> 8; - cdb[8] = 23 & 0xFF; + cdb[8] = 23 & 0xFF; buffer = new byte[23]; diff --git a/DiscImageChef.Devices/Device/ScsiCommands/NEC.cs b/DiscImageChef.Devices/Device/ScsiCommands/NEC.cs index ac07612ca..c947766f6 100644 --- a/DiscImageChef.Devices/Device/ScsiCommands/NEC.cs +++ b/DiscImageChef.Devices/Device/ScsiCommands/NEC.cs @@ -54,8 +54,8 @@ namespace DiscImageChef.Devices cdb[0] = (byte)ScsiCommands.NecReadCdDa; cdb[2] = (byte)((lba & 0xFF000000) >> 24); - cdb[3] = (byte)((lba & 0xFF0000) >> 16); - cdb[4] = (byte)((lba & 0xFF00) >> 8); + cdb[3] = (byte)((lba & 0xFF0000) >> 16); + cdb[4] = (byte)((lba & 0xFF00) >> 8); cdb[5] = (byte)(lba & 0xFF); cdb[7] = (byte)((transferLength & 0xFF00) >> 8); cdb[8] = (byte)(transferLength & 0xFF); diff --git a/DiscImageChef.Devices/Device/ScsiCommands/Pioneer.cs b/DiscImageChef.Devices/Device/ScsiCommands/Pioneer.cs index 8bd5f1379..265824408 100644 --- a/DiscImageChef.Devices/Device/ScsiCommands/Pioneer.cs +++ b/DiscImageChef.Devices/Device/ScsiCommands/Pioneer.cs @@ -48,21 +48,21 @@ 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, + 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]; - cdb[0] = (byte)ScsiCommands.ReadCdDa; - cdb[2] = (byte)((lba & 0xFF000000) >> 24); - cdb[3] = (byte)((lba & 0xFF0000) >> 16); - cdb[4] = (byte)((lba & 0xFF00) >> 8); - cdb[5] = (byte)(lba & 0xFF); - cdb[7] = (byte)((transferLength & 0xFF0000) >> 16); - cdb[8] = (byte)((transferLength & 0xFF00) >> 8); - cdb[9] = (byte)(transferLength & 0xFF); + cdb[0] = (byte)ScsiCommands.ReadCdDa; + cdb[2] = (byte)((lba & 0xFF000000) >> 24); + cdb[3] = (byte)((lba & 0xFF0000) >> 16); + cdb[4] = (byte)((lba & 0xFF00) >> 8); + cdb[5] = (byte)(lba & 0xFF); + cdb[7] = (byte)((transferLength & 0xFF0000) >> 16); + cdb[8] = (byte)((transferLength & 0xFF00) >> 8); + cdb[9] = (byte)(transferLength & 0xFF); cdb[10] = (byte)subchannel; buffer = new byte[blockSize * transferLength]; @@ -88,19 +88,21 @@ 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]; - cdb[0] = (byte)ScsiCommands.ReadCdDaMsf; - cdb[3] = (byte)((startMsf & 0xFF0000) >> 16); - cdb[4] = (byte)((startMsf & 0xFF00) >> 8); - cdb[5] = (byte)(startMsf & 0xFF); - cdb[7] = (byte)((endMsf & 0xFF0000) >> 16); - cdb[8] = (byte)((endMsf & 0xFF00) >> 8); - cdb[9] = (byte)(endMsf & 0xFF); + cdb[0] = (byte)ScsiCommands.ReadCdDaMsf; + cdb[3] = (byte)((startMsf & 0xFF0000) >> 16); + cdb[4] = (byte)((startMsf & 0xFF00) >> 8); + cdb[5] = (byte)(startMsf & 0xFF); + cdb[7] = (byte)((endMsf & 0xFF0000) >> 16); + cdb[8] = (byte)((endMsf & 0xFF00) >> 8); + cdb[9] = (byte)(endMsf & 0xFF); cdb[10] = (byte)subchannel; uint transferLength = (uint)((cdb[7] - cdb[3]) * 60 * 75 + (cdb[8] - cdb[4]) * 75 + (cdb[9] - cdb[5])); @@ -130,19 +132,20 @@ 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]; cdb[0] = (byte)ScsiCommands.ReadCdXa; cdb[2] = (byte)((lba & 0xFF000000) >> 24); - cdb[3] = (byte)((lba & 0xFF0000) >> 16); - cdb[4] = (byte)((lba & 0xFF00) >> 8); + cdb[3] = (byte)((lba & 0xFF0000) >> 16); + cdb[4] = (byte)((lba & 0xFF00) >> 8); cdb[5] = (byte)(lba & 0xFF); cdb[7] = (byte)((transferLength & 0xFF0000) >> 16); - cdb[8] = (byte)((transferLength & 0xFF00) >> 8); + cdb[8] = (byte)((transferLength & 0xFF00) >> 8); cdb[9] = (byte)(transferLength & 0xFF); if(errorFlags) diff --git a/DiscImageChef.Devices/Device/ScsiCommands/Plasmon.cs b/DiscImageChef.Devices/Device/ScsiCommands/Plasmon.cs index 509ba0599..796b47679 100644 --- a/DiscImageChef.Devices/Device/ScsiCommands/Plasmon.cs +++ b/DiscImageChef.Devices/Device/ScsiCommands/Plasmon.cs @@ -48,8 +48,8 @@ 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); @@ -72,12 +72,13 @@ namespace DiscImageChef.Devices /// /// 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, + 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); + timeout, out duration); } /// @@ -90,16 +91,16 @@ 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]; cdb[0] = (byte)ScsiCommands.PlasmonReadSectorLocation; cdb[2] = (byte)((address & 0xFF000000) >> 24); - cdb[3] = (byte)((address & 0xFF0000) >> 16); - cdb[4] = (byte)((address & 0xFF00) >> 8); + cdb[3] = (byte)((address & 0xFF0000) >> 16); + cdb[4] = (byte)((address & 0xFF00) >> 8); cdb[5] = (byte)(address & 0xFF); if(pba) cdb[9] += 0x80; diff --git a/DiscImageChef.Devices/Device/ScsiCommands/Plextor.cs b/DiscImageChef.Devices/Device/ScsiCommands/Plextor.cs index 0df88908e..7127ee425 100644 --- a/DiscImageChef.Devices/Device/ScsiCommands/Plextor.cs +++ b/DiscImageChef.Devices/Device/ScsiCommands/Plextor.cs @@ -49,22 +49,22 @@ 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, + 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]; - cdb[0] = (byte)ScsiCommands.ReadCdDa; - cdb[2] = (byte)((lba & 0xFF000000) >> 24); - cdb[3] = (byte)((lba & 0xFF0000) >> 16); - cdb[4] = (byte)((lba & 0xFF00) >> 8); - cdb[5] = (byte)(lba & 0xFF); - cdb[6] = (byte)((transferLength & 0xFF000000) >> 24); - cdb[7] = (byte)((transferLength & 0xFF0000) >> 16); - cdb[8] = (byte)((transferLength & 0xFF00) >> 8); - cdb[9] = (byte)(transferLength & 0xFF); + cdb[0] = (byte)ScsiCommands.ReadCdDa; + cdb[2] = (byte)((lba & 0xFF000000) >> 24); + cdb[3] = (byte)((lba & 0xFF0000) >> 16); + cdb[4] = (byte)((lba & 0xFF00) >> 8); + cdb[5] = (byte)(lba & 0xFF); + cdb[6] = (byte)((transferLength & 0xFF000000) >> 24); + cdb[7] = (byte)((transferLength & 0xFF0000) >> 16); + cdb[8] = (byte)((transferLength & 0xFF00) >> 8); + cdb[9] = (byte)(transferLength & 0xFF); cdb[10] = (byte)subchannel; buffer = new byte[blockSize * transferLength]; @@ -88,8 +88,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]; @@ -98,10 +98,10 @@ namespace DiscImageChef.Devices cdb[0] = (byte)ScsiCommands.ReadBuffer; cdb[1] = 0x02; cdb[3] = (byte)((lba & 0xFF0000) >> 16); - cdb[4] = (byte)((lba & 0xFF00) >> 8); + cdb[4] = (byte)((lba & 0xFF00) >> 8); cdb[5] = (byte)(lba & 0xFF); cdb[3] = (byte)((buffer.Length & 0xFF0000) >> 16); - cdb[4] = (byte)((buffer.Length & 0xFF00) >> 8); + 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, @@ -123,7 +123,7 @@ namespace DiscImageChef.Devices /// Duration. public bool PlextorReadEepromCdr(out byte[] buffer, out byte[] senseBuffer, uint timeout, out double duration) { - buffer = new byte[256]; + buffer = new byte[256]; senseBuffer = new byte[32]; byte[] cdb = new byte[12]; @@ -149,7 +149,7 @@ namespace DiscImageChef.Devices /// Duration. public bool PlextorReadEeprom(out byte[] buffer, out byte[] senseBuffer, uint timeout, out double duration) { - buffer = new byte[512]; + buffer = new byte[512]; senseBuffer = new byte[32]; byte[] cdb = new byte[12]; @@ -175,10 +175,10 @@ 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]; + buffer = new byte[blockSize]; senseBuffer = new byte[32]; byte[] cdb = new byte[12]; @@ -208,15 +208,15 @@ namespace DiscImageChef.Devices /// Timeout. /// Duration. public bool PlextorGetSpeeds(out byte[] senseBuffer, out ushort selected, out ushort max, out ushort last, - uint timeout, out double duration) + uint timeout, out double duration) { byte[] buf = new byte[10]; senseBuffer = new byte[32]; byte[] cdb = new byte[12]; selected = 0; - max = 0; - last = 0; + max = 0; + last = 0; cdb[0] = (byte)ScsiCommands.PlextorPoweRec; cdb[9] = (byte)buf.Length; @@ -230,9 +230,9 @@ namespace DiscImageChef.Devices if(sense || Error) return sense; BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian; - selected = BigEndianBitConverter.ToUInt16(buf, 4); - max = BigEndianBitConverter.ToUInt16(buf, 6); - last = BigEndianBitConverter.ToUInt16(buf, 8); + selected = BigEndianBitConverter.ToUInt16(buf, 4); + max = BigEndianBitConverter.ToUInt16(buf, 6); + last = BigEndianBitConverter.ToUInt16(buf, 8); return false; } @@ -254,7 +254,7 @@ namespace DiscImageChef.Devices byte[] cdb = new byte[12]; enabled = false; - speed = 0; + speed = 0; cdb[0] = (byte)ScsiCommands.PlextorExtend2; cdb[1] = (byte)PlextorSubCommands.GetMode; @@ -269,8 +269,8 @@ namespace DiscImageChef.Devices if(sense || Error) return sense; BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian; - enabled = buf[2] != 0; - speed = BigEndianBitConverter.ToUInt16(buf, 4); + enabled = buf[2] != 0; + speed = BigEndianBitConverter.ToUInt16(buf, 4); return false; } @@ -285,14 +285,14 @@ namespace DiscImageChef.Devices /// Duration. public bool PlextorGetSilentMode(out byte[] buffer, out byte[] senseBuffer, uint timeout, out double duration) { - buffer = new byte[8]; + buffer = new byte[8]; senseBuffer = new byte[32]; byte[] cdb = new byte[12]; - cdb[0] = (byte)ScsiCommands.PlextorExtend; - cdb[1] = (byte)PlextorSubCommands.GetMode; - cdb[2] = (byte)PlextorSubCommands.Silent; - cdb[3] = 4; + cdb[0] = (byte)ScsiCommands.PlextorExtend; + cdb[1] = (byte)PlextorSubCommands.GetMode; + cdb[2] = (byte)PlextorSubCommands.Silent; + cdb[3] = 4; cdb[10] = (byte)buffer.Length; LastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, @@ -314,13 +314,13 @@ namespace DiscImageChef.Devices /// Duration. public bool PlextorGetGigaRec(out byte[] buffer, out byte[] senseBuffer, uint timeout, out double duration) { - buffer = new byte[8]; + buffer = new byte[8]; senseBuffer = new byte[32]; byte[] cdb = new byte[12]; - cdb[0] = (byte)ScsiCommands.PlextorExtend; - cdb[1] = (byte)PlextorSubCommands.GetMode; - cdb[2] = (byte)PlextorSubCommands.GigaRec; + cdb[0] = (byte)ScsiCommands.PlextorExtend; + cdb[1] = (byte)PlextorSubCommands.GetMode; + cdb[2] = (byte)PlextorSubCommands.GigaRec; cdb[10] = (byte)buffer.Length; LastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, @@ -344,17 +344,17 @@ namespace DiscImageChef.Devices public bool PlextorGetVariRec(out byte[] buffer, out byte[] senseBuffer, bool dvd, uint timeout, out double duration) { - buffer = new byte[8]; + buffer = new byte[8]; senseBuffer = new byte[32]; byte[] cdb = new byte[12]; - cdb[0] = (byte)ScsiCommands.PlextorExtend; - cdb[1] = (byte)PlextorSubCommands.GetMode; - cdb[2] = (byte)PlextorSubCommands.VariRec; + cdb[0] = (byte)ScsiCommands.PlextorExtend; + cdb[1] = (byte)PlextorSubCommands.GetMode; + cdb[2] = (byte)PlextorSubCommands.VariRec; cdb[10] = (byte)buffer.Length; if(dvd) cdb[3] = 0x12; - else cdb[3] = 0x02; + else cdb[3] = 0x02; LastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out bool sense); @@ -375,12 +375,12 @@ namespace DiscImageChef.Devices /// Duration. public bool PlextorGetSecuRec(out byte[] buffer, out byte[] senseBuffer, uint timeout, out double duration) { - buffer = new byte[8]; + buffer = new byte[8]; senseBuffer = new byte[32]; byte[] cdb = new byte[12]; - cdb[0] = (byte)ScsiCommands.PlextorExtend; - cdb[2] = (byte)PlextorSubCommands.SecuRec; + cdb[0] = (byte)ScsiCommands.PlextorExtend; + cdb[2] = (byte)PlextorSubCommands.SecuRec; cdb[10] = (byte)buffer.Length; LastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, @@ -402,13 +402,13 @@ namespace DiscImageChef.Devices /// Duration. public bool PlextorGetSpeedRead(out byte[] buffer, out byte[] senseBuffer, uint timeout, out double duration) { - buffer = new byte[8]; + buffer = new byte[8]; senseBuffer = new byte[32]; byte[] cdb = new byte[12]; - cdb[0] = (byte)ScsiCommands.PlextorExtend; - cdb[1] = (byte)PlextorSubCommands.GetMode; - cdb[2] = (byte)PlextorSubCommands.SpeedRead; + cdb[0] = (byte)ScsiCommands.PlextorExtend; + cdb[1] = (byte)PlextorSubCommands.GetMode; + cdb[2] = (byte)PlextorSubCommands.SpeedRead; cdb[10] = (byte)buffer.Length; LastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, @@ -430,7 +430,7 @@ namespace DiscImageChef.Devices /// Duration. public bool PlextorGetHiding(out byte[] buffer, out byte[] senseBuffer, uint timeout, out double duration) { - buffer = new byte[8]; + buffer = new byte[8]; senseBuffer = new byte[32]; byte[] cdb = new byte[12]; @@ -460,7 +460,7 @@ namespace DiscImageChef.Devices public bool PlextorGetBitsetting(out byte[] buffer, out byte[] senseBuffer, bool dualLayer, uint timeout, out double duration) { - buffer = new byte[8]; + buffer = new byte[8]; senseBuffer = new byte[32]; byte[] cdb = new byte[12]; @@ -470,7 +470,7 @@ namespace DiscImageChef.Devices cdb[9] = (byte)buffer.Length; if(dualLayer) cdb[3] = (byte)PlextorSubCommands.BitSetRdl; - else cdb[3] = (byte)PlextorSubCommands.BitSetR; + else cdb[3] = (byte)PlextorSubCommands.BitSetR; LastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out bool sense); @@ -492,13 +492,13 @@ namespace DiscImageChef.Devices public bool PlextorGetTestWriteDvdPlus(out byte[] buffer, out byte[] senseBuffer, uint timeout, out double duration) { - buffer = new byte[8]; + buffer = new byte[8]; senseBuffer = new byte[32]; byte[] cdb = new byte[12]; - cdb[0] = (byte)ScsiCommands.PlextorExtend; - cdb[1] = (byte)PlextorSubCommands.GetMode; - cdb[2] = (byte)PlextorSubCommands.TestWriteDvdPlus; + cdb[0] = (byte)ScsiCommands.PlextorExtend; + cdb[1] = (byte)PlextorSubCommands.GetMode; + cdb[2] = (byte)PlextorSubCommands.TestWriteDvdPlus; cdb[10] = (byte)buffer.Length; LastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, diff --git a/DiscImageChef.Devices/Device/ScsiCommands/SBC.cs b/DiscImageChef.Devices/Device/ScsiCommands/SBC.cs index c13bedfbd..aa42bb2e5 100644 --- a/DiscImageChef.Devices/Device/ScsiCommands/SBC.cs +++ b/DiscImageChef.Devices/Device/ScsiCommands/SBC.cs @@ -64,20 +64,20 @@ 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]; cdb[0] = (byte)ScsiCommands.Read6; cdb[1] = (byte)((lba & 0x1F0000) >> 16); - cdb[2] = (byte)((lba & 0xFF00) >> 8); + cdb[2] = (byte)((lba & 0xFF00) >> 8); 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 bool sense); @@ -111,23 +111,25 @@ 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]; 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(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); - cdb[5] = (byte)(lba & 0xFF); + cdb[3] = (byte)((lba & 0xFF0000) >> 16); + cdb[4] = (byte)((lba & 0xFF00) >> 8); + cdb[5] = (byte)(lba & 0xFF); cdb[6] = (byte)(groupNumber & 0x1F); cdb[7] = (byte)((transferLength & 0xFF00) >> 8); cdb[8] = (byte)(transferLength & 0xFF); @@ -167,28 +169,30 @@ 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]; 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(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); - cdb[5] = (byte)(lba & 0xFF); - cdb[6] = (byte)((transferLength & 0xFF000000) >> 24); - cdb[7] = (byte)((transferLength & 0xFF0000) >> 16); - cdb[8] = (byte)((transferLength & 0xFF00) >> 8); - cdb[9] = (byte)(transferLength & 0xFF); - cdb[10] = (byte)(groupNumber & 0x1F); + cdb[2] = (byte)((lba & 0xFF000000) >> 24); + cdb[3] = (byte)((lba & 0xFF0000) >> 16); + cdb[4] = (byte)((lba & 0xFF00) >> 8); + cdb[5] = (byte)(lba & 0xFF); + cdb[6] = (byte)((transferLength & 0xFF000000) >> 24); + cdb[7] = (byte)((transferLength & 0xFF0000) >> 16); + cdb[8] = (byte)((transferLength & 0xFF00) >> 8); + cdb[9] = (byte)(transferLength & 0xFF); + cdb[10] = (byte)(groupNumber & 0x1F); if(streaming) cdb[10] += 0x80; buffer = new byte[transferLength * blockSize]; @@ -225,32 +229,34 @@ 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]; + byte[] cdb = new byte[16]; byte[] lbaBytes = BitConverter.GetBytes(lba); cdb[0] = (byte)ScsiCommands.Read16; cdb[1] = (byte)((rdprotect & 0x07) << 5); - if(dpo) cdb[1] += 0x10; - if(fua) cdb[1] += 0x08; + 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]; - cdb[5] = lbaBytes[4]; - cdb[6] = lbaBytes[3]; - cdb[7] = lbaBytes[2]; - cdb[8] = lbaBytes[1]; - cdb[9] = lbaBytes[0]; + cdb[2] = lbaBytes[7]; + cdb[3] = lbaBytes[6]; + cdb[4] = lbaBytes[5]; + cdb[5] = lbaBytes[4]; + cdb[6] = lbaBytes[3]; + cdb[7] = lbaBytes[2]; + cdb[8] = lbaBytes[1]; + cdb[9] = lbaBytes[0]; cdb[10] = (byte)((transferLength & 0xFF000000) >> 24); - cdb[11] = (byte)((transferLength & 0xFF0000) >> 16); - cdb[12] = (byte)((transferLength & 0xFF00) >> 8); + cdb[11] = (byte)((transferLength & 0xFF0000) >> 16); + cdb[12] = (byte)((transferLength & 0xFF00) >> 8); cdb[13] = (byte)(transferLength & 0xFF); - cdb[14] = (byte)(groupNumber & 0x1F); + cdb[14] = (byte)(groupNumber & 0x1F); if(streaming) cdb[14] += 0x80; buffer = new byte[transferLength * blockSize]; @@ -279,8 +285,9 @@ namespace DiscImageChef.Devices /// 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]; @@ -289,8 +296,8 @@ namespace DiscImageChef.Devices 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); + cdb[3] = (byte)((lba & 0xFF0000) >> 16); + cdb[4] = (byte)((lba & 0xFF00) >> 8); cdb[5] = (byte)(lba & 0xFF); cdb[7] = (byte)((transferBytes & 0xFF00) >> 8); cdb[8] = (byte)(transferBytes & 0xFF); @@ -320,23 +327,23 @@ namespace DiscImageChef.Devices /// 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]; + byte[] cdb = new byte[16]; byte[] lbaBytes = BitConverter.GetBytes(lba); - cdb[0] = (byte)ScsiCommands.ServiceActionIn; - cdb[1] = (byte)ScsiServiceActions.ReadLong16; - cdb[2] = lbaBytes[7]; - cdb[3] = lbaBytes[6]; - cdb[4] = lbaBytes[5]; - cdb[5] = lbaBytes[4]; - cdb[6] = lbaBytes[3]; - cdb[7] = lbaBytes[2]; - cdb[8] = lbaBytes[1]; - cdb[9] = lbaBytes[0]; + cdb[0] = (byte)ScsiCommands.ServiceActionIn; + cdb[1] = (byte)ScsiServiceActions.ReadLong16; + cdb[2] = lbaBytes[7]; + cdb[3] = lbaBytes[6]; + cdb[4] = lbaBytes[5]; + cdb[5] = lbaBytes[4]; + cdb[6] = lbaBytes[3]; + cdb[7] = lbaBytes[2]; + cdb[8] = lbaBytes[1]; + cdb[9] = lbaBytes[0]; cdb[12] = (byte)((transferBytes & 0xFF00) >> 8); cdb[13] = (byte)(transferBytes & 0xFF); if(correct) cdb[14] += 0x01; @@ -362,12 +369,12 @@ namespace DiscImageChef.Devices public bool Seek6(out byte[] senseBuffer, uint lba, uint timeout, out double duration) { senseBuffer = new byte[32]; - byte[] cdb = new byte[6]; + byte[] cdb = new byte[6]; byte[] buffer = new byte[0]; cdb[0] = (byte)ScsiCommands.Seek6; cdb[1] = (byte)((lba & 0x1F0000) >> 16); - cdb[2] = (byte)((lba & 0xFF00) >> 8); + cdb[2] = (byte)((lba & 0xFF00) >> 8); cdb[3] = (byte)(lba & 0xFF); LastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.None, out duration, @@ -389,13 +396,13 @@ namespace DiscImageChef.Devices public bool Seek10(out byte[] senseBuffer, uint lba, uint timeout, out double duration) { senseBuffer = new byte[32]; - byte[] cdb = new byte[10]; + byte[] cdb = new byte[10]; byte[] buffer = new byte[0]; cdb[0] = (byte)ScsiCommands.Seek10; cdb[2] = (byte)((lba & 0xFF000000) >> 24); - cdb[3] = (byte)((lba & 0xFF0000) >> 16); - cdb[4] = (byte)((lba & 0xFF00) >> 8); + cdb[3] = (byte)((lba & 0xFF0000) >> 16); + cdb[4] = (byte)((lba & 0xFF00) >> 8); cdb[5] = (byte)(lba & 0xFF); LastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.None, out duration, diff --git a/DiscImageChef.Devices/Device/ScsiCommands/SMC.cs b/DiscImageChef.Devices/Device/ScsiCommands/SMC.cs index 85b1f5572..42b336f87 100644 --- a/DiscImageChef.Devices/Device/ScsiCommands/SMC.cs +++ b/DiscImageChef.Devices/Device/ScsiCommands/SMC.cs @@ -50,26 +50,28 @@ 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]; senseBuffer = new byte[32]; - cdb[0] = (byte)ScsiCommands.ReadAttribute; - cdb[1] = (byte)((byte)action & 0x1F); - cdb[2] = (byte)((element & 0xFF00) >> 8); - cdb[3] = (byte)(element & 0xFF); - cdb[4] = (byte)(elementType & 0x0F); - cdb[5] = volume; - cdb[7] = partition; - cdb[8] = (byte)((firstAttribute & 0xFF00) >> 8); - cdb[9] = (byte)(firstAttribute & 0xFF); + cdb[0] = (byte)ScsiCommands.ReadAttribute; + cdb[1] = (byte)((byte)action & 0x1F); + cdb[2] = (byte)((element & 0xFF00) >> 8); + cdb[3] = (byte)(element & 0xFF); + cdb[4] = (byte)(elementType & 0x0F); + cdb[5] = volume; + cdb[7] = partition; + cdb[8] = (byte)((firstAttribute & 0xFF00) >> 8); + cdb[9] = (byte)(firstAttribute & 0xFF); cdb[10] = (byte)((buffer.Length & 0xFF000000) >> 24); - cdb[11] = (byte)((buffer.Length & 0xFF0000) >> 16); - cdb[12] = (byte)((buffer.Length & 0xFF00) >> 8); + 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; @@ -80,11 +82,11 @@ namespace DiscImageChef.Devices if(sense) return true; uint attrLen = (uint)((buffer[0] << 24) + (buffer[1] << 16) + (buffer[2] << 8) + buffer[3] + 4); - buffer = new byte[attrLen]; - cdb[10] = (byte)((buffer.Length & 0xFF000000) >> 24); - cdb[11] = (byte)((buffer.Length & 0xFF0000) >> 16); - cdb[12] = (byte)((buffer.Length & 0xFF00) >> 8); - cdb[13] = (byte)(buffer.Length & 0xFF); + buffer = new byte[attrLen]; + cdb[10] = (byte)((buffer.Length & 0xFF000000) >> 24); + cdb[11] = (byte)((buffer.Length & 0xFF0000) >> 16); + cdb[12] = (byte)((buffer.Length & 0xFF00) >> 8); + cdb[13] = (byte)(buffer.Length & 0xFF); senseBuffer = new byte[32]; LastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, diff --git a/DiscImageChef.Devices/Device/ScsiCommands/SPC.cs b/DiscImageChef.Devices/Device/ScsiCommands/SPC.cs index 4908468c4..1824847d1 100644 --- a/DiscImageChef.Devices/Device/ScsiCommands/SPC.cs +++ b/DiscImageChef.Devices/Device/ScsiCommands/SPC.cs @@ -85,7 +85,7 @@ namespace DiscImageChef.Devices /// Duration in milliseconds it took for the device to execute the command. public bool ScsiInquiry(out byte[] buffer, out byte[] senseBuffer, uint timeout, out double duration) { - buffer = new byte[36]; + buffer = new byte[36]; senseBuffer = new byte[32]; byte[] cdb = {(byte)ScsiCommands.Inquiry, 0, 0, 0, 36, 0}; @@ -97,8 +97,8 @@ namespace DiscImageChef.Devices byte pagesLength = (byte)(buffer[4] + 5); - cdb = new byte[] {(byte)ScsiCommands.Inquiry, 0, 0, 0, pagesLength, 0}; - buffer = new byte[pagesLength]; + 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, @@ -159,7 +159,7 @@ namespace DiscImageChef.Devices /// The Extended Vital Product Data public bool ScsiInquiry(out byte[] buffer, out byte[] senseBuffer, byte page, uint timeout, out double duration) { - buffer = new byte[36]; + buffer = new byte[36]; senseBuffer = new byte[32]; byte[] cdb = {(byte)ScsiCommands.Inquiry, 1, page, 0, 36, 0}; @@ -174,8 +174,8 @@ namespace DiscImageChef.Devices byte pagesLength = (byte)(buffer[3] + 4); - cdb = new byte[] {(byte)ScsiCommands.Inquiry, 1, page, 0, pagesLength, 0}; - buffer = new byte[pagesLength]; + 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, @@ -197,7 +197,7 @@ 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}; byte[] buffer = new byte[0]; LastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.None, out duration, @@ -234,8 +234,9 @@ 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); } @@ -252,9 +253,10 @@ 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]; @@ -264,9 +266,9 @@ namespace DiscImageChef.Devices 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; + cdb[3] = subPageCode; + cdb[4] = (byte)buffer.Length; + cdb[5] = 0; LastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out bool sense); @@ -275,8 +277,8 @@ namespace DiscImageChef.Devices if(sense) return true; byte modeLength = (byte)(buffer[0] + 1); - buffer = new byte[modeLength]; - cdb[4] = (byte)buffer.Length; + 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, @@ -299,8 +301,9 @@ 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); @@ -318,8 +321,10 @@ 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); @@ -338,9 +343,11 @@ 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]; @@ -348,13 +355,13 @@ namespace DiscImageChef.Devices cdb[0] = (byte)ScsiCommands.ModeSense10; if(llbaa) cdb[1] |= 0x10; - if(dbd) cdb[1] |= 0x08; + if(dbd) cdb[1] |= 0x08; cdb[2] |= (byte)pageControl; cdb[2] |= (byte)(pageCode & 0x3F); - cdb[3] = subPageCode; - cdb[7] = (byte)((buffer.Length & 0xFF00) >> 8); - cdb[8] = (byte)(buffer.Length & 0xFF); - cdb[9] = 0; + cdb[3] = subPageCode; + cdb[7] = (byte)((buffer.Length & 0xFF00) >> 8); + cdb[8] = (byte)(buffer.Length & 0xFF); + cdb[9] = 0; LastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out bool sense); @@ -363,9 +370,9 @@ namespace DiscImageChef.Devices if(sense) return true; ushort modeLength = (ushort)((buffer[0] << 8) + buffer[1] + 2); - buffer = new byte[modeLength]; - cdb[7] = (byte)((buffer.Length & 0xFF00) >> 8); - cdb[8] = (byte)(buffer.Length & 0xFF); + buffer = new byte[modeLength]; + cdb[7] = (byte)((buffer.Length & 0xFF00) >> 8); + cdb[8] = (byte)(buffer.Length & 0xFF); senseBuffer = new byte[32]; LastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, @@ -431,7 +438,7 @@ namespace DiscImageChef.Devices out double duration) { senseBuffer = new byte[32]; - byte[] cdb = new byte[6]; + byte[] cdb = new byte[6]; byte[] buffer = new byte[0]; cdb[0] = (byte)ScsiCommands.PreventAllowMediumRemoval; @@ -470,8 +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]; @@ -485,8 +492,8 @@ namespace DiscImageChef.Devices if(relAddr) cdb[1] = 0x01; cdb[2] = (byte)((address & 0xFF000000) >> 24); - cdb[3] = (byte)((address & 0xFF0000) >> 16); - cdb[4] = (byte)((address & 0xFF00) >> 8); + cdb[3] = (byte)((address & 0xFF0000) >> 16); + cdb[4] = (byte)((address & 0xFF00) >> 8); cdb[5] = (byte)(address & 0xFF); } @@ -547,8 +554,8 @@ namespace DiscImageChef.Devices } cdb[10] = (byte)((buffer.Length & 0xFF000000) >> 24); - cdb[11] = (byte)((buffer.Length & 0xFF0000) >> 16); - cdb[12] = (byte)((buffer.Length & 0xFF00) >> 8); + cdb[11] = (byte)((buffer.Length & 0xFF0000) >> 16); + 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, @@ -577,8 +584,8 @@ namespace DiscImageChef.Devices cdb[0] = (byte)ScsiCommands.ReadSerialNumber; cdb[1] = 0x01; cdb[6] = (byte)((buffer.Length & 0xFF000000) >> 24); - cdb[7] = (byte)((buffer.Length & 0xFF0000) >> 16); - cdb[8] = (byte)((buffer.Length & 0xFF00) >> 8); + cdb[7] = (byte)((buffer.Length & 0xFF0000) >> 16); + 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, @@ -588,11 +595,11 @@ namespace DiscImageChef.Devices if(sense) return true; uint strctLength = (uint)((buffer[0] << 24) + (buffer[1] << 16) + (buffer[2] << 8) + buffer[3] + 4); - buffer = new byte[strctLength]; - cdb[6] = (byte)((buffer.Length & 0xFF000000) >> 24); - cdb[7] = (byte)((buffer.Length & 0xFF0000) >> 16); - cdb[8] = (byte)((buffer.Length & 0xFF00) >> 8); - cdb[9] = (byte)(buffer.Length & 0xFF); + buffer = new byte[strctLength]; + cdb[6] = (byte)((buffer.Length & 0xFF000000) >> 24); + cdb[7] = (byte)((buffer.Length & 0xFF0000) >> 16); + cdb[8] = (byte)((buffer.Length & 0xFF00) >> 8); + cdb[9] = (byte)(buffer.Length & 0xFF); senseBuffer = new byte[32]; LastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, @@ -615,11 +622,13 @@ 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); + timeout, out duration); } /// @@ -632,8 +641,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 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); @@ -649,11 +659,12 @@ 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); + timeout, out duration); } /// @@ -665,8 +676,8 @@ 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); @@ -683,11 +694,13 @@ 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); + timeout, out duration); } /// @@ -702,11 +715,13 @@ 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); + timeout, out duration); } /// @@ -719,7 +734,7 @@ namespace DiscImageChef.Devices /// Timeout in seconds. /// Duration in milliseconds it took for the device to execute the command. /// Set if page is formatted. - public bool ModeSelect(byte[] buffer, out byte[] senseBuffer, bool pageFormat, bool savePages, uint timeout, + public bool ModeSelect(byte[] buffer, out byte[] senseBuffer, bool pageFormat, bool savePages, uint timeout, out double duration) { senseBuffer = new byte[32]; @@ -727,11 +742,11 @@ namespace DiscImageChef.Devices // Prevent overflows if(buffer.Length > 255) { - if(PlatformId != PlatformID.Win32NT && PlatformId != PlatformID.Win32S && - PlatformId != PlatformID.Win32Windows && PlatformId != PlatformID.WinCE && + if(PlatformId != PlatformID.Win32NT && PlatformId != PlatformID.Win32S && + PlatformId != PlatformID.Win32Windows && PlatformId != PlatformID.WinCE && PlatformId != PlatformID.WindowsPhone && PlatformId != PlatformID.Xbox) LastError = 75; - else LastError = 111; - Error = true; + else LastError = 111; + Error = true; duration = 0; return true; } @@ -740,7 +755,7 @@ namespace DiscImageChef.Devices cdb[0] = (byte)ScsiCommands.ModeSelect; if(pageFormat) cdb[1] += 0x10; - if(savePages) cdb[1] += 0x01; + if(savePages) cdb[1] += 0x01; cdb[4] = (byte)buffer.Length; LastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.Out, out duration, @@ -762,7 +777,8 @@ namespace DiscImageChef.Devices /// Timeout in seconds. /// Duration in milliseconds it took for the device to execute the command. /// Set if page is formatted. - public bool ModeSelect10(byte[] buffer, out byte[] senseBuffer, bool pageFormat, bool savePages, uint timeout, + public bool ModeSelect10(byte[] buffer, out byte[] senseBuffer, bool pageFormat, bool savePages, + uint timeout, out double duration) { senseBuffer = new byte[32]; @@ -770,11 +786,11 @@ namespace DiscImageChef.Devices // Prevent overflows if(buffer.Length > 65535) { - if(PlatformId != PlatformID.Win32NT && PlatformId != PlatformID.Win32S && - PlatformId != PlatformID.Win32Windows && PlatformId != PlatformID.WinCE && + if(PlatformId != PlatformID.Win32NT && PlatformId != PlatformID.Win32S && + PlatformId != PlatformID.Win32Windows && PlatformId != PlatformID.WinCE && PlatformId != PlatformID.WindowsPhone && PlatformId != PlatformID.Xbox) LastError = 75; - else LastError = 111; - Error = true; + else LastError = 111; + Error = true; duration = 0; return true; } @@ -783,7 +799,7 @@ namespace DiscImageChef.Devices cdb[0] = (byte)ScsiCommands.ModeSelect10; if(pageFormat) cdb[1] += 0x10; - if(savePages) cdb[1] += 0x01; + if(savePages) cdb[1] += 0x01; cdb[7] = (byte)((buffer.Length & 0xFF00) << 8); cdb[8] = (byte)(buffer.Length & 0xFF); diff --git a/DiscImageChef.Devices/Device/ScsiCommands/SSC.cs b/DiscImageChef.Devices/Device/ScsiCommands/SSC.cs index 3da645beb..a2060b7f9 100644 --- a/DiscImageChef.Devices/Device/ScsiCommands/SSC.cs +++ b/DiscImageChef.Devices/Device/ScsiCommands/SSC.cs @@ -76,19 +76,19 @@ namespace DiscImageChef.Devices /// /// 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]; + byte[] cdb = new byte[6]; byte[] buffer = new byte[0]; cdb[0] = (byte)ScsiCommands.LoadUnload; - if(immediate) cdb[1] = 0x01; - if(load) cdb[4] += 0x01; - if(retense) cdb[4] += 0x02; + 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(hold) cdb[4] += 0x08; LastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.None, out duration, out bool sense); @@ -163,20 +163,21 @@ 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]; + byte[] cdb = new byte[10]; byte[] buffer = new byte[0]; cdb[0] = (byte)ScsiCommands.Locate; - if(immediate) cdb[1] += 0x01; + if(immediate) cdb[1] += 0x01; if(changePartition) cdb[1] += 0x02; - if(blockType) cdb[1] += 0x04; + if(blockType) cdb[1] += 0x04; cdb[3] = (byte)((objectId & 0xFF000000) >> 24); - cdb[4] = (byte)((objectId & 0xFF0000) >> 16); - cdb[5] = (byte)((objectId & 0xFF00) >> 8); + cdb[4] = (byte)((objectId & 0xFF0000) >> 16); + cdb[5] = (byte)((objectId & 0xFF00) >> 8); cdb[6] = (byte)(objectId & 0xFF); cdb[8] = partition; @@ -243,7 +244,7 @@ namespace DiscImageChef.Devices out double duration) { return Locate16(out senseBuffer, immediate, true, SscLogicalIdTypes.ObjectId, false, partition, lba, - timeout, out duration); + timeout, out duration); } /// @@ -258,27 +259,28 @@ 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]; - byte[] buffer = new byte[0]; + byte[] cdb = new byte[16]; + byte[] buffer = new byte[0]; byte[] idBytes = BitConverter.GetBytes(identifier); cdb[0] = (byte)ScsiCommands.Locate16; cdb[1] = (byte)((byte)destType << 3); - if(immediate) cdb[1] += 0x01; + if(immediate) cdb[1] += 0x01; if(changePartition) cdb[1] += 0x02; - if(bam) cdb[2] = 0x01; + if(bam) cdb[2] = 0x01; cdb[3] = partition; - cdb[4] = idBytes[7]; - cdb[5] = idBytes[6]; - cdb[6] = idBytes[5]; - cdb[7] = idBytes[4]; - cdb[8] = idBytes[3]; - cdb[9] = idBytes[2]; + cdb[4] = idBytes[7]; + cdb[5] = idBytes[6]; + cdb[6] = idBytes[5]; + cdb[7] = idBytes[4]; + cdb[8] = idBytes[3]; + cdb[9] = idBytes[2]; cdb[10] = idBytes[1]; cdb[11] = idBytes[0]; @@ -315,8 +317,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); } @@ -338,8 +340,9 @@ 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) { buffer = fixedLen ? new byte[blockSize * transferLen] : new byte[transferLen]; byte[] cdb = new byte[6]; @@ -347,9 +350,9 @@ namespace DiscImageChef.Devices cdb[0] = (byte)ScsiCommands.Read6; if(fixedLen) cdb[1] += 0x01; - if(sili) cdb[1] += 0x02; + if(sili) cdb[1] += 0x02; cdb[2] = (byte)((transferLen & 0xFF0000) >> 16); - cdb[3] = (byte)((transferLen & 0xFF00) >> 8); + cdb[3] = (byte)((transferLen & 0xFF00) >> 8); cdb[4] = (byte)(transferLen & 0xFF); LastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, @@ -372,8 +375,8 @@ 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); @@ -391,8 +394,9 @@ 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); @@ -408,8 +412,8 @@ 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); @@ -426,8 +430,9 @@ 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); @@ -452,8 +457,10 @@ 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) { buffer = fixedLen ? new byte[objectSize * transferLen] : new byte[transferLen]; byte[] cdb = new byte[6]; @@ -462,18 +469,18 @@ namespace DiscImageChef.Devices cdb[0] = (byte)ScsiCommands.Read16; if(fixedLen) cdb[1] += 0x01; - if(sili) cdb[1] += 0x02; - cdb[3] = partition; - cdb[4] = idBytes[7]; - cdb[5] = idBytes[6]; - cdb[6] = idBytes[5]; - cdb[7] = idBytes[4]; - cdb[8] = idBytes[3]; - cdb[9] = idBytes[2]; + if(sili) cdb[1] += 0x02; + cdb[3] = partition; + cdb[4] = idBytes[7]; + cdb[5] = idBytes[6]; + cdb[6] = idBytes[5]; + cdb[7] = idBytes[4]; + cdb[8] = idBytes[3]; + cdb[9] = idBytes[2]; cdb[10] = idBytes[1]; cdb[11] = idBytes[0]; cdb[12] = (byte)((transferLen & 0xFF0000) >> 16); - cdb[13] = (byte)((transferLen & 0xFF00) >> 8); + cdb[13] = (byte)((transferLen & 0xFF00) >> 8); cdb[14] = (byte)(transferLen & 0xFF); LastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, @@ -543,12 +550,12 @@ 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; + byte responseForm = 0; + if(vendorType) responseForm += 0x01; + if(longForm) responseForm += 0x02; if(totalPosition) responseForm += 0x04; return ReadPosition(out buffer, out senseBuffer, (SscPositionForms)responseForm, timeout, out duration); @@ -631,8 +638,9 @@ 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); @@ -656,19 +664,20 @@ 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) { buffer = fixedLen ? new byte[blockSize * transferLen] : new byte[transferLen]; byte[] cdb = new byte[6]; senseBuffer = new byte[32]; cdb[0] = (byte)ScsiCommands.ReadReverse; - if(fixedLen) cdb[1] += 0x01; - if(sili) cdb[1] += 0x02; + 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[3] = (byte)((transferLen & 0xFF00) >> 8); cdb[4] = (byte)(transferLen & 0xFF); LastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, @@ -691,11 +700,12 @@ 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); + timeout, out duration); } /// @@ -710,11 +720,12 @@ 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); + blockSize, timeout, out duration); } /// @@ -727,11 +738,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); + timeout, out duration); } /// @@ -745,11 +756,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); + blockSize, timeout, out duration); } /// @@ -772,8 +783,10 @@ 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, + 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) { buffer = fixedLen ? new byte[objectSize * transferLen] : new byte[transferLen]; @@ -782,20 +795,20 @@ namespace DiscImageChef.Devices 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; if(byteOrder) cdb[1] += 0x04; - cdb[3] = partition; - cdb[4] = idBytes[7]; - cdb[5] = idBytes[6]; - cdb[6] = idBytes[5]; - cdb[7] = idBytes[4]; - cdb[8] = idBytes[3]; - cdb[9] = idBytes[2]; + cdb[3] = partition; + cdb[4] = idBytes[7]; + cdb[5] = idBytes[6]; + cdb[6] = idBytes[5]; + cdb[7] = idBytes[4]; + cdb[8] = idBytes[3]; + cdb[9] = idBytes[2]; cdb[10] = idBytes[1]; cdb[11] = idBytes[0]; cdb[12] = (byte)((transferLen & 0xFF0000) >> 16); - cdb[13] = (byte)((transferLen & 0xFF00) >> 8); + cdb[13] = (byte)((transferLen & 0xFF00) >> 8); cdb[14] = (byte)(transferLen & 0xFF); LastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, @@ -816,8 +829,8 @@ 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); @@ -833,8 +846,8 @@ 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); @@ -857,8 +870,10 @@ 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) { buffer = fixedLen ? new byte[blockSize * transferLen] : new byte[transferLen]; byte[] cdb = new byte[6]; @@ -866,9 +881,9 @@ namespace DiscImageChef.Devices cdb[0] = (byte)ScsiCommands.RecoverBufferedData; if(fixedLen) cdb[1] += 0x01; - if(sili) cdb[1] += 0x02; + if(sili) cdb[1] += 0x02; cdb[2] = (byte)((transferLen & 0xFF0000) >> 16); - cdb[3] = (byte)((transferLen & 0xFF00) >> 8); + cdb[3] = (byte)((transferLen & 0xFF00) >> 8); cdb[4] = (byte)(transferLen & 0xFF); LastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, @@ -915,8 +930,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]; @@ -924,7 +939,7 @@ namespace DiscImageChef.Devices cdb[0] = (byte)ScsiCommands.ReportDensitySupport; if(currentMedia) cdb[1] += 0x01; - if(mediumType) cdb[1] += 0x02; + if(mediumType) cdb[1] += 0x02; cdb[7] = (byte)((buffer.Length & 0xFF00) >> 8); cdb[8] = (byte)(buffer.Length & 0xFF); @@ -935,9 +950,9 @@ namespace DiscImageChef.Devices if(sense) return true; ushort availableLength = (ushort)((buffer[0] << 8) + buffer[1] + 2); - buffer = new byte[availableLength]; - cdb[7] = (byte)((buffer.Length & 0xFF00) >> 8); - cdb[8] = (byte)(buffer.Length & 0xFF); + buffer = new byte[availableLength]; + cdb[7] = (byte)((buffer.Length & 0xFF00) >> 8); + cdb[8] = (byte)(buffer.Length & 0xFF); senseBuffer = new byte[32]; LastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, @@ -970,7 +985,7 @@ namespace DiscImageChef.Devices public bool Rewind(out byte[] senseBuffer, bool immediate, uint timeout, out double duration) { senseBuffer = new byte[32]; - byte[] cdb = new byte[6]; + byte[] cdb = new byte[6]; byte[] buffer = new byte[0]; cdb[0] = (byte)ScsiCommands.Rewind; @@ -996,7 +1011,7 @@ namespace DiscImageChef.Devices public bool TrackSelect(out byte[] senseBuffer, byte track, uint timeout, out double duration) { senseBuffer = new byte[32]; - byte[] cdb = new byte[6]; + byte[] cdb = new byte[6]; byte[] buffer = new byte[0]; cdb[0] = (byte)ScsiCommands.TrackSelect; @@ -1014,7 +1029,7 @@ namespace DiscImageChef.Devices public bool Space(out byte[] senseBuffer, SscSpaceCodes code, int count, uint timeout, out double duration) { senseBuffer = new byte[32]; - byte[] cdb = new byte[6]; + byte[] cdb = new byte[6]; byte[] buffer = new byte[0]; byte[] countB = BitConverter.GetBytes(count); diff --git a/DiscImageChef.Devices/Device/ScsiCommands/SyQuest.cs b/DiscImageChef.Devices/Device/ScsiCommands/SyQuest.cs index c652d78fe..5cab5e7d2 100644 --- a/DiscImageChef.Devices/Device/ScsiCommands/SyQuest.cs +++ b/DiscImageChef.Devices/Device/ScsiCommands/SyQuest.cs @@ -81,20 +81,21 @@ 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]; - bool sense; + bool sense; cdb[0] = (byte)ScsiCommands.Read6; cdb[1] = (byte)((lba & 0x1F0000) >> 16); - cdb[2] = (byte)((lba & 0xFF00) >> 8); + 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(readLong) cdb[5] += 0x40; if(!inhibitDma && !readLong) buffer = transferLength == 0 ? new byte[256 * blockSize] : new byte[transferLength * blockSize]; @@ -161,23 +162,23 @@ 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, + 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]; - bool sense; + bool sense; cdb[0] = (byte)ScsiCommands.Read10; cdb[2] = (byte)((lba & 0xFF000000) >> 24); - cdb[3] = (byte)((lba & 0xFF0000) >> 16); - cdb[4] = (byte)((lba & 0xFF00) >> 8); + cdb[3] = (byte)((lba & 0xFF0000) >> 16); + cdb[4] = (byte)((lba & 0xFF00) >> 8); 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(readLong) cdb[9] += 0x40; if(!inhibitDma && !readLong) buffer = new byte[transferLength * blockSize]; else if(readLong) diff --git a/DiscImageChef.Devices/Device/Variables.cs b/DiscImageChef.Devices/Device/Variables.cs index 3bf146cb6..97d91abb6 100644 --- a/DiscImageChef.Devices/Device/Variables.cs +++ b/DiscImageChef.Devices/Device/Variables.cs @@ -39,9 +39,9 @@ namespace DiscImageChef.Devices { readonly ushort usbVendor; readonly ushort usbProduct; - readonly ulong firewireGuid; - readonly uint firewireModel; - readonly uint firewireVendor; + readonly ulong firewireGuid; + readonly uint firewireModel; + readonly uint firewireVendor; // MMC and SecureDigital, values that need to be get with card idle, something that may // not be possible to do but usually is already done by the SDHCI driver. diff --git a/DiscImageChef.Devices/Enums.cs b/DiscImageChef.Devices/Enums.cs index afb635dba..79beb9d74 100644 --- a/DiscImageChef.Devices/Enums.cs +++ b/DiscImageChef.Devices/Enums.cs @@ -640,7 +640,7 @@ namespace DiscImageChef.Devices /// Requests SPC-4 style error data /// RequestSenseDataExt = 0x0B, - SanitizeCommands = 0xB4, + SanitizeCommands = 0xB4, /// /// Executes a Security Protocol command that does not require a transfer of data /// @@ -2394,7 +2394,7 @@ namespace DiscImageChef.Devices /// Sets the spindle speed to be used while reading/writing data to a CD /// SetCdSpeed = 0xDA, - WriteCdp = 0xE3, + WriteCdp = 0xE3, #endregion #region ATA Command Pass-Through @@ -2841,7 +2841,7 @@ namespace DiscImageChef.Devices /// /// Drive shall return only the Feature Header with the chosen Feature Descriptor /// - Single = 0x02, + Single = 0x02, Reserved = 0x03 } @@ -3505,8 +3505,8 @@ namespace DiscImageChef.Devices /// The host sends the bus testing data pattern to a device (ADTC, R1) /// BusTestWrite = 19, - SpiReadOcr = 58, - SpicrcOnOff = 59, + SpiReadOcr = 58, + SpicrcOnOff = 59, #endregion Class 1 MMC Commands (Basic and read-stream) #region Class 2 MMC Commands (Block-oriented read) @@ -3756,9 +3756,9 @@ namespace DiscImageChef.Devices ResponseSpiB4 = 1 << 9, ResponseSpiBusy = 1 << 10, ResponseNone = 0, - ResponseR1 = ResponsePresent | ResponseCrc | ResponseOpcode, + ResponseR1 = ResponsePresent | ResponseCrc | ResponseOpcode, ResponseR1B = ResponsePresent | ResponseCrc | ResponseOpcode | ResponseBusy, - ResponseR2 = ResponsePresent | Response136 | ResponseCrc, + ResponseR2 = ResponsePresent | Response136 | ResponseCrc, ResponseR3 = ResponsePresent, ResponseR4 = ResponsePresent, ResponseR5 = ResponsePresent | ResponseCrc | ResponseOpcode, @@ -3916,7 +3916,7 @@ namespace DiscImageChef.Devices DisableReleaseInterrupt = 0xDD, /// Disable SERVICE interrupt DisableServiceInterrupt = 0xDE, - VendorSpecific = 0xE0 + VendorSpecific = 0xE0 } public enum KreonLockStates : byte diff --git a/DiscImageChef.Devices/FreeBSD/Command.cs b/DiscImageChef.Devices/FreeBSD/Command.cs index f5fa1c090..76671843c 100644 --- a/DiscImageChef.Devices/FreeBSD/Command.cs +++ b/DiscImageChef.Devices/FreeBSD/Command.cs @@ -60,12 +60,13 @@ namespace DiscImageChef.Devices.FreeBSD /// 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, CcbFlags direction, out double duration, out bool sense) + internal static int SendScsiCommand64(IntPtr dev, byte[] cdb, ref byte[] buffer, + out byte[] senseBuffer, + uint timeout, CcbFlags direction, out double duration, out bool sense) { senseBuffer = null; - duration = 0; - sense = false; + duration = 0; + sense = false; if(buffer == null) return -1; @@ -79,19 +80,19 @@ namespace DiscImageChef.Devices.FreeBSD } CcbScsiio64 csio = (CcbScsiio64)Marshal.PtrToStructure(ccbPtr, typeof(CcbScsiio64)); - csio.ccb_h.func_code = XptOpcode.XptScsiIo; - csio.ccb_h.flags = direction; - csio.ccb_h.xflags = 0; + csio.ccb_h.func_code = XptOpcode.XptScsiIo; + csio.ccb_h.flags = direction; + csio.ccb_h.xflags = 0; csio.ccb_h.retry_count = 1; - csio.ccb_h.cbfcnp = IntPtr.Zero; - csio.ccb_h.timeout = timeout; - csio.data_ptr = Marshal.AllocHGlobal(buffer.Length); - csio.dxfer_len = (uint)buffer.Length; - csio.sense_len = 32; - csio.cdb_len = (byte)cdb.Length; + csio.ccb_h.cbfcnp = IntPtr.Zero; + csio.ccb_h.timeout = timeout; + csio.data_ptr = Marshal.AllocHGlobal(buffer.Length); + csio.dxfer_len = (uint)buffer.Length; + csio.sense_len = 32; + csio.cdb_len = (byte)cdb.Length; // TODO: Create enum? csio.tag_action = 0x20; - csio.cdb_bytes = new byte[CAM_MAX_CDBLEN]; + csio.cdb_bytes = new byte[CAM_MAX_CDBLEN]; if(cdb.Length <= CAM_MAX_CDBLEN) Array.Copy(cdb, 0, csio.cdb_bytes, 0, cdb.Length); else { @@ -100,14 +101,15 @@ namespace DiscImageChef.Devices.FreeBSD Array.Copy(cdbPtrBytes, 0, csio.cdb_bytes, 0, IntPtr.Size); csio.ccb_h.flags |= CcbFlags.CamCdbPointer; } + csio.ccb_h.flags |= CcbFlags.CamDevQfrzdis; Marshal.Copy(buffer, 0, csio.data_ptr, buffer.Length); Marshal.StructureToPtr(csio, ccbPtr, false); DateTime start = DateTime.UtcNow; - int error = cam_send_ccb(dev, ccbPtr); - DateTime end = DateTime.UtcNow; + int error = cam_send_ccb(dev, ccbPtr); + DateTime end = DateTime.UtcNow; if(error < 0) error = Marshal.GetLastWin32Error(); @@ -123,22 +125,22 @@ namespace DiscImageChef.Devices.FreeBSD if((csio.ccb_h.status & CamStatus.CamStatusMask) == CamStatus.CamScsiStatusError) { - sense = true; - senseBuffer = new byte[1]; + sense = true; + senseBuffer = new byte[1]; senseBuffer[0] = csio.scsi_status; } if((csio.ccb_h.status & CamStatus.CamAutosnsValid) != 0) if(csio.sense_len - csio.sense_resid > 0) { - sense = (csio.ccb_h.status & CamStatus.CamStatusMask) == CamStatus.CamScsiStatusError; - senseBuffer = new byte[csio.sense_len - csio.sense_resid]; + sense = (csio.ccb_h.status & CamStatus.CamStatusMask) == CamStatus.CamScsiStatusError; + senseBuffer = new byte[csio.sense_len - csio.sense_resid]; senseBuffer[0] = csio.sense_data.error_code; Array.Copy(csio.sense_data.sense_buf, 0, senseBuffer, 1, senseBuffer.Length - 1); } buffer = new byte[csio.dxfer_len]; - cdb = new byte[csio.cdb_len]; + cdb = new byte[csio.cdb_len]; Marshal.Copy(csio.data_ptr, buffer, 0, buffer.Length); if(csio.ccb_h.flags.HasFlag(CcbFlags.CamCdbPointer)) @@ -168,12 +170,13 @@ namespace DiscImageChef.Devices.FreeBSD /// 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, CcbFlags direction, out double duration, out bool sense) + internal static int SendScsiCommand(IntPtr dev, byte[] cdb, ref byte[] buffer, + out byte[] senseBuffer, + uint timeout, CcbFlags direction, out double duration, out bool sense) { senseBuffer = null; - duration = 0; - sense = false; + duration = 0; + sense = false; if(buffer == null) return -1; @@ -187,19 +190,19 @@ namespace DiscImageChef.Devices.FreeBSD } CcbScsiio csio = (CcbScsiio)Marshal.PtrToStructure(ccbPtr, typeof(CcbScsiio)); - csio.ccb_h.func_code = XptOpcode.XptScsiIo; - csio.ccb_h.flags = direction; - csio.ccb_h.xflags = 0; + csio.ccb_h.func_code = XptOpcode.XptScsiIo; + csio.ccb_h.flags = direction; + csio.ccb_h.xflags = 0; csio.ccb_h.retry_count = 1; - csio.ccb_h.cbfcnp = IntPtr.Zero; - csio.ccb_h.timeout = timeout; - csio.data_ptr = Marshal.AllocHGlobal(buffer.Length); - csio.dxfer_len = (uint)buffer.Length; - csio.sense_len = 32; - csio.cdb_len = (byte)cdb.Length; + csio.ccb_h.cbfcnp = IntPtr.Zero; + csio.ccb_h.timeout = timeout; + csio.data_ptr = Marshal.AllocHGlobal(buffer.Length); + csio.dxfer_len = (uint)buffer.Length; + csio.sense_len = 32; + csio.cdb_len = (byte)cdb.Length; // TODO: Create enum? csio.tag_action = 0x20; - csio.cdb_bytes = new byte[CAM_MAX_CDBLEN]; + csio.cdb_bytes = new byte[CAM_MAX_CDBLEN]; if(cdb.Length <= CAM_MAX_CDBLEN) Array.Copy(cdb, 0, csio.cdb_bytes, 0, cdb.Length); else { @@ -208,14 +211,15 @@ namespace DiscImageChef.Devices.FreeBSD Array.Copy(cdbPtrBytes, 0, csio.cdb_bytes, 0, IntPtr.Size); csio.ccb_h.flags |= CcbFlags.CamCdbPointer; } + csio.ccb_h.flags |= CcbFlags.CamDevQfrzdis; Marshal.Copy(buffer, 0, csio.data_ptr, buffer.Length); Marshal.StructureToPtr(csio, ccbPtr, false); DateTime start = DateTime.UtcNow; - int error = cam_send_ccb(dev, ccbPtr); - DateTime end = DateTime.UtcNow; + int error = cam_send_ccb(dev, ccbPtr); + DateTime end = DateTime.UtcNow; if(error < 0) error = Marshal.GetLastWin32Error(); @@ -231,22 +235,22 @@ namespace DiscImageChef.Devices.FreeBSD if((csio.ccb_h.status & CamStatus.CamStatusMask) == CamStatus.CamScsiStatusError) { - sense = true; - senseBuffer = new byte[1]; + sense = true; + senseBuffer = new byte[1]; senseBuffer[0] = csio.scsi_status; } if((csio.ccb_h.status & CamStatus.CamAutosnsValid) != 0) if(csio.sense_len - csio.sense_resid > 0) { - sense = (csio.ccb_h.status & CamStatus.CamStatusMask) == CamStatus.CamScsiStatusError; - senseBuffer = new byte[csio.sense_len - csio.sense_resid]; + sense = (csio.ccb_h.status & CamStatus.CamStatusMask) == CamStatus.CamScsiStatusError; + senseBuffer = new byte[csio.sense_len - csio.sense_resid]; senseBuffer[0] = csio.sense_data.error_code; Array.Copy(csio.sense_data.sense_buf, 0, senseBuffer, 1, senseBuffer.Length - 1); } buffer = new byte[csio.dxfer_len]; - cdb = new byte[csio.cdb_len]; + cdb = new byte[csio.cdb_len]; Marshal.Copy(csio.data_ptr, buffer, 0, buffer.Length); if(csio.ccb_h.flags.HasFlag(CcbFlags.CamCdbPointer)) @@ -296,12 +300,13 @@ namespace DiscImageChef.Devices.FreeBSD /// Registers to send to drive /// Registers returned by drive /// ATA protocol to use - internal static int SendAtaCommand(IntPtr dev, AtaRegistersChs registers, - out AtaErrorRegistersChs errorRegisters, AtaProtocol protocol, - ref byte[] buffer, uint timeout, out double duration, out bool sense) + internal static int SendAtaCommand(IntPtr dev, AtaRegistersChs registers, + out AtaErrorRegistersChs errorRegisters, AtaProtocol protocol, + ref byte[] buffer, uint timeout, + out double duration, out bool sense) { - duration = 0; - sense = false; + duration = 0; + sense = false; errorRegisters = new AtaErrorRegistersChs(); if(buffer == null) return -1; @@ -309,16 +314,16 @@ namespace DiscImageChef.Devices.FreeBSD IntPtr ccbPtr = cam_getccb(dev); CcbAtaio ataio = (CcbAtaio)Marshal.PtrToStructure(ccbPtr, typeof(CcbAtaio)); - ataio.ccb_h.func_code = XptOpcode.XptAtaIo; - ataio.ccb_h.flags = AtaProtocolToCamFlags(protocol); - ataio.ccb_h.xflags = 0; - ataio.ccb_h.retry_count = 1; - ataio.ccb_h.cbfcnp = IntPtr.Zero; - ataio.ccb_h.timeout = timeout; - ataio.data_ptr = Marshal.AllocHGlobal(buffer.Length); - ataio.dxfer_len = (uint)buffer.Length; - ataio.ccb_h.flags |= CcbFlags.CamDevQfrzdis; - ataio.cmd.flags = CamAtaIoFlags.NeedResult; + ataio.ccb_h.func_code = XptOpcode.XptAtaIo; + ataio.ccb_h.flags = AtaProtocolToCamFlags(protocol); + ataio.ccb_h.xflags = 0; + ataio.ccb_h.retry_count = 1; + ataio.ccb_h.cbfcnp = IntPtr.Zero; + ataio.ccb_h.timeout = timeout; + ataio.data_ptr = Marshal.AllocHGlobal(buffer.Length); + ataio.dxfer_len = (uint)buffer.Length; + ataio.ccb_h.flags |= CcbFlags.CamDevQfrzdis; + ataio.cmd.flags = CamAtaIoFlags.NeedResult; switch(protocol) { case AtaProtocol.Dma: @@ -332,20 +337,20 @@ namespace DiscImageChef.Devices.FreeBSD break; } - ataio.cmd.command = registers.Command; - ataio.cmd.lba_high = registers.CylinderHigh; - ataio.cmd.lba_mid = registers.CylinderLow; - ataio.cmd.device = (byte)(0x40 | registers.DeviceHead); - ataio.cmd.features = registers.Feature; + ataio.cmd.command = registers.Command; + ataio.cmd.lba_high = registers.CylinderHigh; + ataio.cmd.lba_mid = registers.CylinderLow; + ataio.cmd.device = (byte)(0x40 | registers.DeviceHead); + ataio.cmd.features = registers.Feature; ataio.cmd.sector_count = registers.SectorCount; - ataio.cmd.lba_low = registers.Sector; + ataio.cmd.lba_low = registers.Sector; Marshal.Copy(buffer, 0, ataio.data_ptr, buffer.Length); Marshal.StructureToPtr(ataio, ccbPtr, false); DateTime start = DateTime.UtcNow; - int error = cam_send_ccb(dev, ccbPtr); - DateTime end = DateTime.UtcNow; + int error = cam_send_ccb(dev, ccbPtr); + DateTime end = DateTime.UtcNow; if(error < 0) error = Marshal.GetLastWin32Error(); @@ -362,12 +367,12 @@ namespace DiscImageChef.Devices.FreeBSD if((ataio.ccb_h.status & CamStatus.CamStatusMask) == CamStatus.CamAtaStatusError) sense = true; errorRegisters.CylinderHigh = ataio.res.lba_high; - errorRegisters.CylinderLow = ataio.res.lba_mid; - errorRegisters.DeviceHead = ataio.res.device; - errorRegisters.Error = ataio.res.error; - errorRegisters.Sector = ataio.res.lba_low; - errorRegisters.SectorCount = ataio.res.sector_count; - errorRegisters.Status = ataio.res.status; + errorRegisters.CylinderLow = ataio.res.lba_mid; + errorRegisters.DeviceHead = ataio.res.device; + errorRegisters.Error = ataio.res.error; + errorRegisters.Sector = ataio.res.lba_low; + errorRegisters.SectorCount = ataio.res.sector_count; + errorRegisters.Status = ataio.res.status; buffer = new byte[ataio.dxfer_len]; @@ -394,12 +399,13 @@ namespace DiscImageChef.Devices.FreeBSD /// Registers to send to drive /// Registers returned by drive /// ATA protocol to use - internal static int SendAtaCommand(IntPtr dev, AtaRegistersLba28 registers, - out AtaErrorRegistersLba28 errorRegisters, AtaProtocol protocol, - ref byte[] buffer, uint timeout, out double duration, out bool sense) + internal static int SendAtaCommand(IntPtr dev, AtaRegistersLba28 registers, + out AtaErrorRegistersLba28 errorRegisters, AtaProtocol protocol, + ref byte[] buffer, uint timeout, + out double duration, out bool sense) { - duration = 0; - sense = false; + duration = 0; + sense = false; errorRegisters = new AtaErrorRegistersLba28(); if(buffer == null) return -1; @@ -407,16 +413,16 @@ namespace DiscImageChef.Devices.FreeBSD IntPtr ccbPtr = cam_getccb(dev); CcbAtaio ataio = (CcbAtaio)Marshal.PtrToStructure(ccbPtr, typeof(CcbAtaio)); - ataio.ccb_h.func_code = XptOpcode.XptAtaIo; - ataio.ccb_h.flags = AtaProtocolToCamFlags(protocol); - ataio.ccb_h.xflags = 0; - ataio.ccb_h.retry_count = 1; - ataio.ccb_h.cbfcnp = IntPtr.Zero; - ataio.ccb_h.timeout = timeout; - ataio.data_ptr = Marshal.AllocHGlobal(buffer.Length); - ataio.dxfer_len = (uint)buffer.Length; - ataio.ccb_h.flags |= CcbFlags.CamDevQfrzdis; - ataio.cmd.flags = CamAtaIoFlags.NeedResult; + ataio.ccb_h.func_code = XptOpcode.XptAtaIo; + ataio.ccb_h.flags = AtaProtocolToCamFlags(protocol); + ataio.ccb_h.xflags = 0; + ataio.ccb_h.retry_count = 1; + ataio.ccb_h.cbfcnp = IntPtr.Zero; + ataio.ccb_h.timeout = timeout; + ataio.data_ptr = Marshal.AllocHGlobal(buffer.Length); + ataio.dxfer_len = (uint)buffer.Length; + ataio.ccb_h.flags |= CcbFlags.CamDevQfrzdis; + ataio.cmd.flags = CamAtaIoFlags.NeedResult; switch(protocol) { case AtaProtocol.Dma: @@ -430,20 +436,20 @@ namespace DiscImageChef.Devices.FreeBSD break; } - ataio.cmd.command = registers.Command; - ataio.cmd.lba_high = registers.LbaHigh; - ataio.cmd.lba_mid = registers.LbaMid; - ataio.cmd.device = (byte)(0x40 | registers.DeviceHead); - ataio.cmd.features = registers.Feature; + ataio.cmd.command = registers.Command; + ataio.cmd.lba_high = registers.LbaHigh; + ataio.cmd.lba_mid = registers.LbaMid; + ataio.cmd.device = (byte)(0x40 | registers.DeviceHead); + ataio.cmd.features = registers.Feature; ataio.cmd.sector_count = registers.SectorCount; - ataio.cmd.lba_low = registers.LbaLow; + ataio.cmd.lba_low = registers.LbaLow; Marshal.Copy(buffer, 0, ataio.data_ptr, buffer.Length); Marshal.StructureToPtr(ataio, ccbPtr, false); DateTime start = DateTime.UtcNow; - int error = cam_send_ccb(dev, ccbPtr); - DateTime end = DateTime.UtcNow; + int error = cam_send_ccb(dev, ccbPtr); + DateTime end = DateTime.UtcNow; if(error < 0) error = Marshal.GetLastWin32Error(); @@ -459,13 +465,13 @@ namespace DiscImageChef.Devices.FreeBSD if((ataio.ccb_h.status & CamStatus.CamStatusMask) == CamStatus.CamAtaStatusError) sense = true; - errorRegisters.LbaHigh = ataio.res.lba_high; - errorRegisters.LbaMid = ataio.res.lba_mid; - errorRegisters.DeviceHead = ataio.res.device; - errorRegisters.Error = ataio.res.error; - errorRegisters.LbaLow = ataio.res.lba_low; + errorRegisters.LbaHigh = ataio.res.lba_high; + errorRegisters.LbaMid = ataio.res.lba_mid; + errorRegisters.DeviceHead = ataio.res.device; + errorRegisters.Error = ataio.res.error; + errorRegisters.LbaLow = ataio.res.lba_low; errorRegisters.SectorCount = ataio.res.sector_count; - errorRegisters.Status = ataio.res.status; + errorRegisters.Status = ataio.res.status; buffer = new byte[ataio.dxfer_len]; @@ -492,12 +498,13 @@ namespace DiscImageChef.Devices.FreeBSD /// Registers to send to drive /// Registers returned by drive /// ATA protocol to use - internal static int SendAtaCommand(IntPtr dev, AtaRegistersLba48 registers, - out AtaErrorRegistersLba48 errorRegisters, AtaProtocol protocol, - ref byte[] buffer, uint timeout, out double duration, out bool sense) + internal static int SendAtaCommand(IntPtr dev, AtaRegistersLba48 registers, + out AtaErrorRegistersLba48 errorRegisters, AtaProtocol protocol, + ref byte[] buffer, uint timeout, + out double duration, out bool sense) { - duration = 0; - sense = false; + duration = 0; + sense = false; errorRegisters = new AtaErrorRegistersLba48(); // 48-bit ATA CAM commands can crash FreeBSD < 9.2-RELEASE @@ -509,16 +516,16 @@ namespace DiscImageChef.Devices.FreeBSD IntPtr ccbPtr = cam_getccb(dev); CcbAtaio ataio = (CcbAtaio)Marshal.PtrToStructure(ccbPtr, typeof(CcbAtaio)); - ataio.ccb_h.func_code = XptOpcode.XptAtaIo; - ataio.ccb_h.flags = AtaProtocolToCamFlags(protocol); - ataio.ccb_h.xflags = 0; - ataio.ccb_h.retry_count = 1; - ataio.ccb_h.cbfcnp = IntPtr.Zero; - ataio.ccb_h.timeout = timeout; - ataio.data_ptr = Marshal.AllocHGlobal(buffer.Length); - ataio.dxfer_len = (uint)buffer.Length; - ataio.ccb_h.flags |= CcbFlags.CamDevQfrzdis; - ataio.cmd.flags = CamAtaIoFlags.NeedResult | CamAtaIoFlags.ExtendedCommand; + ataio.ccb_h.func_code = XptOpcode.XptAtaIo; + ataio.ccb_h.flags = AtaProtocolToCamFlags(protocol); + ataio.ccb_h.xflags = 0; + ataio.ccb_h.retry_count = 1; + ataio.ccb_h.cbfcnp = IntPtr.Zero; + ataio.ccb_h.timeout = timeout; + ataio.data_ptr = Marshal.AllocHGlobal(buffer.Length); + ataio.dxfer_len = (uint)buffer.Length; + ataio.ccb_h.flags |= CcbFlags.CamDevQfrzdis; + ataio.cmd.flags = CamAtaIoFlags.NeedResult | CamAtaIoFlags.ExtendedCommand; switch(protocol) { case AtaProtocol.Dma: @@ -532,25 +539,25 @@ namespace DiscImageChef.Devices.FreeBSD break; } - ataio.cmd.lba_high_exp = (byte)((registers.LbaHigh & 0xFF00) >> 8); - ataio.cmd.lba_mid_exp = (byte)((registers.LbaMid & 0xFF00) >> 8); - ataio.cmd.features_exp = (byte)((registers.Feature & 0xFF00) >> 8); + ataio.cmd.lba_high_exp = (byte)((registers.LbaHigh & 0xFF00) >> 8); + ataio.cmd.lba_mid_exp = (byte)((registers.LbaMid & 0xFF00) >> 8); + ataio.cmd.features_exp = (byte)((registers.Feature & 0xFF00) >> 8); ataio.cmd.sector_count_exp = (byte)((registers.SectorCount & 0xFF00) >> 8); - ataio.cmd.lba_low_exp = (byte)((registers.LbaLow & 0xFF00) >> 8); - ataio.cmd.lba_high = (byte)(registers.LbaHigh & 0xFF); - ataio.cmd.lba_mid = (byte)(registers.LbaMid & 0xFF); - ataio.cmd.features = (byte)(registers.Feature & 0xFF); - ataio.cmd.sector_count = (byte)(registers.SectorCount & 0xFF); - ataio.cmd.lba_low = (byte)(registers.LbaLow & 0xFF); - ataio.cmd.command = registers.Command; - ataio.cmd.device = (byte)(0x40 | registers.DeviceHead); + ataio.cmd.lba_low_exp = (byte)((registers.LbaLow & 0xFF00) >> 8); + ataio.cmd.lba_high = (byte)(registers.LbaHigh & 0xFF); + ataio.cmd.lba_mid = (byte)(registers.LbaMid & 0xFF); + ataio.cmd.features = (byte)(registers.Feature & 0xFF); + ataio.cmd.sector_count = (byte)(registers.SectorCount & 0xFF); + ataio.cmd.lba_low = (byte)(registers.LbaLow & 0xFF); + ataio.cmd.command = registers.Command; + ataio.cmd.device = (byte)(0x40 | registers.DeviceHead); Marshal.Copy(buffer, 0, ataio.data_ptr, buffer.Length); Marshal.StructureToPtr(ataio, ccbPtr, false); DateTime start = DateTime.UtcNow; - int error = cam_send_ccb(dev, ccbPtr); - DateTime end = DateTime.UtcNow; + int error = cam_send_ccb(dev, ccbPtr); + DateTime end = DateTime.UtcNow; if(error < 0) error = Marshal.GetLastWin32Error(); @@ -567,12 +574,12 @@ namespace DiscImageChef.Devices.FreeBSD if((ataio.ccb_h.status & CamStatus.CamStatusMask) == CamStatus.CamAtaStatusError) sense = true; errorRegisters.SectorCount = (ushort)((ataio.res.sector_count_exp << 8) + ataio.res.sector_count); - errorRegisters.LbaLow = (ushort)((ataio.res.lba_low_exp << 8) + ataio.res.lba_low); - errorRegisters.LbaMid = (ushort)((ataio.res.lba_mid_exp << 8) + ataio.res.lba_mid); - errorRegisters.LbaHigh = (ushort)((ataio.res.lba_high_exp << 8) + ataio.res.lba_high); - errorRegisters.DeviceHead = ataio.res.device; - errorRegisters.Error = ataio.res.error; - errorRegisters.Status = ataio.res.status; + errorRegisters.LbaLow = (ushort)((ataio.res.lba_low_exp << 8) + ataio.res.lba_low); + errorRegisters.LbaMid = (ushort)((ataio.res.lba_mid_exp << 8) + ataio.res.lba_mid); + errorRegisters.LbaHigh = (ushort)((ataio.res.lba_high_exp << 8) + ataio.res.lba_high); + errorRegisters.DeviceHead = ataio.res.device; + errorRegisters.Error = ataio.res.error; + errorRegisters.Status = ataio.res.status; buffer = new byte[ataio.dxfer_len]; diff --git a/DiscImageChef.Devices/FreeBSD/Enums.cs b/DiscImageChef.Devices/FreeBSD/Enums.cs index b7d33024a..f7c8715f1 100644 --- a/DiscImageChef.Devices/FreeBSD/Enums.cs +++ b/DiscImageChef.Devices/FreeBSD/Enums.cs @@ -269,34 +269,34 @@ namespace DiscImageChef.Devices.FreeBSD [Flags] enum PeriphPatternFlags { - PeriphMatchNone = 0x000, - PeriphMatchPath = 0x001, + PeriphMatchNone = 0x000, + PeriphMatchPath = 0x001, PeriphMatchTarget = 0x002, - PeriphMatchLun = 0x004, - PeriphMatchName = 0x008, - PeriphMatchUnit = 0x010 + PeriphMatchLun = 0x004, + PeriphMatchName = 0x008, + PeriphMatchUnit = 0x010 // PERIPH_MATCH_ANY = 0x01f } [Flags] enum DevPatternFlags { - DevMatchNone = 0x000, - DevMatchPath = 0x001, - DevMatchTarget = 0x002, - DevMatchLun = 0x004, + DevMatchNone = 0x000, + DevMatchPath = 0x001, + DevMatchTarget = 0x002, + DevMatchLun = 0x004, DevMatchInquiry = 0x008, - DevMatchDevid = 0x010 + DevMatchDevid = 0x010 // DEV_MATCH_ANY = 0x00f } [Flags] enum BusPatternFlags { - BusMatchNone = 0x000, - BusMatchPath = 0x001, - BusMatchName = 0x002, - BusMatchUnit = 0x004, + BusMatchNone = 0x000, + BusMatchPath = 0x001, + BusMatchName = 0x002, + BusMatchUnit = 0x004, BusMatchBusId = 0x008 // BUS_MATCH_ANY = 0x00f } @@ -304,7 +304,7 @@ namespace DiscImageChef.Devices.FreeBSD [Flags] enum DevResultFlags { - DevResultNoflag = 0x00, + DevResultNoflag = 0x00, DevResultUnconfigured = 0x01 } @@ -353,32 +353,32 @@ namespace DiscImageChef.Devices.FreeBSD enum MmcCardFeatures { CardFeatureMemory = 0x1, - CardFeatureSdhc = 0x1 << 1, - CardFeatureSdio = 0x1 << 2, - CardFeatureSd20 = 0x1 << 3, - CardFeatureMmc = 0x1 << 4, - CardFeature18V = 0x1 << 5 + CardFeatureSdhc = 0x1 << 1, + CardFeatureSdio = 0x1 << 2, + CardFeatureSd20 = 0x1 << 3, + CardFeatureMmc = 0x1 << 4, + CardFeature18V = 0x1 << 5 } enum CamGenerations : uint { - CamBusGeneration = 0x00, + CamBusGeneration = 0x00, CamTargetGeneration = 0x01, - CamDevGeneration = 0x02, + CamDevGeneration = 0x02, CamPeriphGeneration = 0x03 } [Flags] enum DevPosType { - CamDevPosNone = 0x000, - CamDevPosBus = 0x001, + CamDevPosNone = 0x000, + CamDevPosBus = 0x001, CamDevPosTarget = 0x002, CamDevPosDevice = 0x004, CamDevPosPeriph = 0x008, - CamDevPosPdptr = 0x010, + CamDevPosPdptr = 0x010, // CAM_DEV_POS_TYPEMASK = 0xf00, - CamDevPosEdt = 0x100, + CamDevPosEdt = 0x100, CamDevPosPdrv = 0x200 } diff --git a/DiscImageChef.Devices/FreeBSD/ListDevices.cs b/DiscImageChef.Devices/FreeBSD/ListDevices.cs index 12294369c..6f44ba5c4 100644 --- a/DiscImageChef.Devices/FreeBSD/ListDevices.cs +++ b/DiscImageChef.Devices/FreeBSD/ListDevices.cs @@ -49,14 +49,14 @@ namespace DiscImageChef.Devices.FreeBSD /// List of devices internal static DeviceInfo[] GetList() { - string[] passDevices = Directory.GetFiles("/dev/", "pass*", SearchOption.TopDirectoryOnly); + string[] passDevices = Directory.GetFiles("/dev/", "pass*", SearchOption.TopDirectoryOnly); List listDevices = new List(); foreach(string passDevice in passDevices) { DeviceInfo deviceInfo = new DeviceInfo(); - IntPtr dev = cam_open_device(passDevice, FileFlags.ReadWrite); - CamDevice camDevice = (CamDevice)Marshal.PtrToStructure(dev, typeof(CamDevice)); + IntPtr dev = cam_open_device(passDevice, FileFlags.ReadWrite); + CamDevice camDevice = (CamDevice)Marshal.PtrToStructure(dev, typeof(CamDevice)); IntPtr ccbPtr = cam_getccb(dev); @@ -99,7 +99,7 @@ namespace DiscImageChef.Devices.FreeBSD for(int aIndex = 0; aIndex < 512; aIndex += 2) { atadTneid[aIndex] = cgd.ident_data[aIndex + 1]; - atadTneid[aIndex + 1] = cgd.ident_data[aIndex]; + atadTneid[aIndex + 1] = cgd.ident_data[aIndex]; } Identify.IdentifyDevice? idt = Identify.Decode(atadTneid); @@ -110,18 +110,19 @@ namespace DiscImageChef.Devices.FreeBSD if(separated.Length == 1) { deviceInfo.Vendor = "ATA"; - deviceInfo.Model = separated[0]; + deviceInfo.Model = separated[0]; } else { deviceInfo.Vendor = separated[0]; - deviceInfo.Model = separated[separated.Length - 1]; + deviceInfo.Model = separated[separated.Length - 1]; } - deviceInfo.Serial = idt.Value.SerialNumber; - deviceInfo.Bus = simName == "ahcich" ? "SATA" : "ATA"; + deviceInfo.Serial = idt.Value.SerialNumber; + deviceInfo.Bus = simName == "ahcich" ? "SATA" : "ATA"; deviceInfo.Supported = simName != "ata"; } + if(cgd.protocol == CamProto.ProtoAtapi) goto case CamProto.ProtoScsi; break; } @@ -130,20 +131,21 @@ namespace DiscImageChef.Devices.FreeBSD Inquiry.SCSIInquiry? inq = Inquiry.Decode(cgd.inq_data); if(inq.HasValue) { - deviceInfo.Vendor = StringHandlers.CToString(inq.Value.VendorIdentification).Trim(); - deviceInfo.Model = StringHandlers.CToString(inq.Value.ProductIdentification).Trim(); - deviceInfo.Bus = simName == "ata" || simName == "ahcich" ? "ATAPI" : "SCSI"; + deviceInfo.Vendor = StringHandlers.CToString(inq.Value.VendorIdentification).Trim(); + deviceInfo.Model = StringHandlers.CToString(inq.Value.ProductIdentification).Trim(); + deviceInfo.Bus = simName == "ata" || simName == "ahcich" ? "ATAPI" : "SCSI"; deviceInfo.Supported = simName != "ata"; } + break; } case CamProto.ProtoNvme: - deviceInfo.Bus = "NVMe"; + deviceInfo.Bus = "NVMe"; deviceInfo.Supported = false; break; case CamProto.ProtoMmcsd: - deviceInfo.Model = "Unknown card"; - deviceInfo.Bus = "MMC/SD"; + deviceInfo.Model = "Unknown card"; + deviceInfo.Bus = "MMC/SD"; deviceInfo.Supported = false; break; } diff --git a/DiscImageChef.Devices/FreeBSD/Structs.cs b/DiscImageChef.Devices/FreeBSD/Structs.cs index db36aeba1..fa57b6f33 100644 --- a/DiscImageChef.Devices/FreeBSD/Structs.cs +++ b/DiscImageChef.Devices/FreeBSD/Structs.cs @@ -50,19 +50,19 @@ namespace DiscImageChef.Devices.FreeBSD struct AtaCmd { public CamAtaIoFlags flags; - public byte command; - public byte features; - public byte lba_low; - public byte lba_mid; - public byte lba_high; - public byte device; - public byte lba_low_exp; - public byte lba_mid_exp; - public byte lba_high_exp; - public byte features_exp; - public byte sector_count; - public byte sector_count_exp; - public byte control; + public byte command; + public byte features; + public byte lba_low; + public byte lba_mid; + public byte lba_high; + public byte device; + public byte lba_low_exp; + public byte lba_mid_exp; + public byte lba_high_exp; + public byte features_exp; + public byte sector_count; + public byte sector_count_exp; + public byte control; } [StructLayout(LayoutKind.Sequential)] @@ -70,17 +70,17 @@ namespace DiscImageChef.Devices.FreeBSD struct AtaRes { public CamAtaIoFlags flags; - public byte status; - public byte error; - public byte lba_low; - public byte lba_mid; - public byte lba_high; - public byte device; - public byte lba_low_exp; - public byte lba_mid_exp; - public byte lba_high_exp; - public byte sector_count; - public byte sector_count_exp; + public byte status; + public byte error; + public byte lba_low; + public byte lba_mid; + public byte lba_high; + public byte device; + public byte lba_low_exp; + public byte lba_mid_exp; + public byte lba_high_exp; + public byte sector_count; + public byte sector_count_exp; } [StructLayout(LayoutKind.Sequential)] @@ -89,7 +89,7 @@ namespace DiscImageChef.Devices.FreeBSD { public uint priority; public uint generation; - public int index; + public int index; } [SuppressMessage("ReSharper", "MemberCanBePrivate.Global")] @@ -140,9 +140,9 @@ namespace DiscImageChef.Devices.FreeBSD [SuppressMessage("ReSharper", "MemberCanBePrivate.Global")] struct CamqEntry { - [FieldOffset(0)] public ListEntry le; - [FieldOffset(0)] public SlistEntry sle; - [FieldOffset(0)] public TailqEntry tqe; + [FieldOffset(0)] public ListEntry le; + [FieldOffset(0)] public SlistEntry sle; + [FieldOffset(0)] public TailqEntry tqe; [FieldOffset(0)] public StailqEntry stqe; } @@ -168,34 +168,37 @@ namespace DiscImageChef.Devices.FreeBSD [SuppressMessage("ReSharper", "MemberCanBePrivate.Global")] struct CcbHdr { - public CamPinfo pinfo; + public CamPinfo pinfo; public CamqEntry xpt_links; public CamqEntry sim_links; public CamqEntry periph_links; - public uint retry_count; - public IntPtr cbfcnp; + public uint retry_count; + public IntPtr cbfcnp; public XptOpcode func_code; public CamStatus status; - public IntPtr path; - public uint path_id; - public uint target_id; - public ulong target_lun; - public CcbFlags flags; - public uint xflags; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)] public IntPtr[] periph_priv; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)] public IntPtr[] sim_priv; + public IntPtr path; + public uint path_id; + public uint target_id; + public ulong target_lun; + public CcbFlags flags; + public uint xflags; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)] + public IntPtr[] periph_priv; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)] + public IntPtr[] sim_priv; public CcbQosArea qos; - public uint timeout; - public Timeval softtimeout; + public uint timeout; + public Timeval softtimeout; } [StructLayout(LayoutKind.Sequential)] [SuppressMessage("ReSharper", "MemberCanBePrivate.Global")] struct ScsiSenseData { - const int SSD_FULL_SIZE = 252; + const int SSD_FULL_SIZE = 252; public byte error_code; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = SSD_FULL_SIZE - 1)] public byte[] sense_buf; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = SSD_FULL_SIZE - 1)] + public byte[] sense_buf; } /// @@ -232,7 +235,8 @@ namespace DiscImageChef.Devices.FreeBSD /// Area for the CDB send, or pointer to the CDB bytes to send /// const int IOCDBLEN = 16; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = IOCDBLEN)] public byte[] cdb_bytes; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = IOCDBLEN)] + public byte[] cdb_bytes; /// Pointer to the message buffer public IntPtr msg_ptr; /// Number of bytes for the Message @@ -283,7 +287,8 @@ namespace DiscImageChef.Devices.FreeBSD /// Area for the CDB send, or pointer to the CDB bytes to send /// const int IOCDBLEN = 16; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = IOCDBLEN)] public byte[] cdb_bytes; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = IOCDBLEN)] + public byte[] cdb_bytes; /// Pointer to the message buffer public IntPtr msg_ptr; /// Number of bytes for the Message @@ -496,11 +501,12 @@ namespace DiscImageChef.Devices.FreeBSD { const int DEV_IDLEN = 16; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = DEV_IDLEN)] public byte[] periph_name; - public uint unit_number; - public path_id_t path_id; - public target_id_t target_id; - public lun_id_t target_lun; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = DEV_IDLEN)] + public byte[] periph_name; + public uint unit_number; + public path_id_t path_id; + public target_id_t target_id; + public lun_id_t target_lun; public PeriphPatternFlags flags; } @@ -509,21 +515,25 @@ namespace DiscImageChef.Devices.FreeBSD struct DeviceIdMatchPattern { public byte id_len; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 256)] public byte[] id; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 256)] + public byte[] id; } [StructLayout(LayoutKind.Sequential)] [SuppressMessage("ReSharper", "MemberCanBePrivate.Global")] struct ScsiStaticInquiryPattern { - const int SID_VENDOR_SIZE = 8; - const int SID_PRODUCT_SIZE = 16; - const int SID_REVISION_SIZE = 4; + const int SID_VENDOR_SIZE = 8; + const int SID_PRODUCT_SIZE = 16; + const int SID_REVISION_SIZE = 4; public byte type; public byte media_type; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = SID_VENDOR_SIZE + 1)] public byte[] vendor; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = SID_PRODUCT_SIZE + 1)] public byte[] product; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = SID_REVISION_SIZE + 1)] public byte[] revision; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = SID_VENDOR_SIZE + 1)] + public byte[] vendor; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = SID_PRODUCT_SIZE + 1)] + public byte[] product; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = SID_REVISION_SIZE + 1)] + public byte[] revision; } [StructLayout(LayoutKind.Explicit)] @@ -531,17 +541,17 @@ namespace DiscImageChef.Devices.FreeBSD struct DeviceMatchPatternData { [FieldOffset(0)] public ScsiStaticInquiryPattern inq_pat; - [FieldOffset(0)] public DeviceIdMatchPattern devid_pat; + [FieldOffset(0)] public DeviceIdMatchPattern devid_pat; } [StructLayout(LayoutKind.Sequential)] [SuppressMessage("ReSharper", "MemberCanBePrivate.Global")] struct DeviceMatchPattern { - public uint path_id; - public uint target_id; - public uint target_lun; - public DevPatternFlags flags; + public uint path_id; + public uint target_id; + public uint target_lun; + public DevPatternFlags flags; public DeviceMatchPatternData data; } @@ -552,9 +562,10 @@ namespace DiscImageChef.Devices.FreeBSD const int DEV_IDLEN = 16; public path_id_t path_id; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = DEV_IDLEN)] public byte[] dev_name; - public uint unit_number; - public uint bus_id; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = DEV_IDLEN)] + public byte[] dev_name; + public uint unit_number; + public uint bus_id; BusPatternFlags flags; } @@ -564,7 +575,7 @@ namespace DiscImageChef.Devices.FreeBSD { [FieldOffset(0)] public PeriphMatchPattern periph_pattern; [FieldOffset(0)] public DeviceMatchPattern device_pattern; - [FieldOffset(0)] public BusMatchPattern bus_pattern; + [FieldOffset(0)] public BusMatchPattern bus_pattern; } [StructLayout(LayoutKind.Sequential)] @@ -579,11 +590,12 @@ namespace DiscImageChef.Devices.FreeBSD [SuppressMessage("ReSharper", "MemberCanBePrivate.Global")] struct PeriphMatchResult { - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] public byte[] periph_name; - public uint unit_number; - public path_id_t path_id; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] + public byte[] periph_name; + public uint unit_number; + public path_id_t path_id; public target_id_t target_id; - public lun_id_t target_lun; + public lun_id_t target_lun; } [StructLayout(LayoutKind.Sequential)] @@ -591,13 +603,14 @@ namespace DiscImageChef.Devices.FreeBSD struct MmcCid { public uint mid; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] public byte[] pnm; - public uint psn; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] + public byte[] pnm; + public uint psn; public ushort oid; public ushort mdt_year; - public byte mdt_month; - public byte prv; - public byte fwrev; + public byte mdt_month; + public byte prv; + public byte fwrev; } [StructLayout(LayoutKind.Sequential)] @@ -607,7 +620,8 @@ namespace DiscImageChef.Devices.FreeBSD /// /// Card model /// - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 40)] public byte[] model; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 40)] + public byte[] model; /// /// Card OCR @@ -622,7 +636,8 @@ namespace DiscImageChef.Devices.FreeBSD /// /// Card CID -- raw /// - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)] public uint[] card_cid; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)] + public uint[] card_cid; /// /// Card CID -- parsed @@ -632,7 +647,8 @@ namespace DiscImageChef.Devices.FreeBSD /// /// Card CSD -- raw /// - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)] public uint[] card_csd; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)] + public uint[] card_csd; /// /// Card RCA @@ -651,14 +667,16 @@ namespace DiscImageChef.Devices.FreeBSD [SuppressMessage("ReSharper", "MemberCanBePrivate.Global")] struct DeviceMatchResult { - public path_id_t path_id; + public path_id_t path_id; public target_id_t target_id; - public lun_id_t target_lun; - public CamProto protocol; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 256)] public byte[] inq_data; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 512)] public byte[] ident_data; + public lun_id_t target_lun; + public CamProto protocol; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 256)] + public byte[] inq_data; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 512)] + public byte[] ident_data; public DevResultFlags flags; - public MmcParams mmc_ident_data; + public MmcParams mmc_ident_data; } [StructLayout(LayoutKind.Sequential)] @@ -666,8 +684,9 @@ namespace DiscImageChef.Devices.FreeBSD struct BusMatchResult { public path_id_t path_id; - const int DEV_IDLEN = 16; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = DEV_IDLEN)] public byte[] dev_name; + const int DEV_IDLEN = 16; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = DEV_IDLEN)] + public byte[] dev_name; public uint unit_number; public uint bus_id; } @@ -678,7 +697,7 @@ namespace DiscImageChef.Devices.FreeBSD { [FieldOffset(0)] public PeriphMatchResult periph_result; [FieldOffset(0)] public DeviceMatchResult device_result; - [FieldOffset(0)] public BusMatchResult bus_result; + [FieldOffset(0)] public BusMatchResult bus_result; } [StructLayout(LayoutKind.Sequential)] @@ -686,7 +705,7 @@ namespace DiscImageChef.Devices.FreeBSD struct DevMatchResult { public DevMatchType type; - public MatchResult result; + public MatchResult result; } [StructLayout(LayoutKind.Sequential)] @@ -704,8 +723,9 @@ namespace DiscImageChef.Devices.FreeBSD [SuppressMessage("ReSharper", "MemberCanBePrivate.Global")] struct CcbDevPosition { - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)] public CamGenerations[] generations; - DevPosType position_type; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)] + public CamGenerations[] generations; + DevPosType position_type; public CcbDmCookie cookie; } @@ -713,10 +733,10 @@ namespace DiscImageChef.Devices.FreeBSD [SuppressMessage("ReSharper", "MemberCanBePrivate.Global")] struct CcbDevMatch { - public CcbHdr ccb_h; + public CcbHdr ccb_h; CcbDevMatchStatus status; - public uint num_patterns; - public uint pattern_buf_len; + public uint num_patterns; + public uint pattern_buf_len; /// /// dev_match_pattern* @@ -738,17 +758,19 @@ namespace DiscImageChef.Devices.FreeBSD struct CamDevice { const int MAXPATHLEN = 1024; - const int DEV_IDLEN = 16; - const int SIM_IDLEN = 16; + const int DEV_IDLEN = 16; + const int SIM_IDLEN = 16; /// /// Pathname of the device given by the user. This may be null if the user states the device name and unit number /// separately. /// - [MarshalAs(UnmanagedType.ByValArray, SizeConst = MAXPATHLEN)] public byte[] DevicePath; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = MAXPATHLEN)] + public byte[] DevicePath; /// /// Device name given by the user. /// - [MarshalAs(UnmanagedType.ByValArray, SizeConst = DEV_IDLEN + 1)] public byte[] GivenDevName; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = DEV_IDLEN + 1)] + public byte[] GivenDevName; /// /// Unit number given by the user. /// @@ -756,7 +778,8 @@ namespace DiscImageChef.Devices.FreeBSD /// /// Name of the device, e.g. 'pass' /// - [MarshalAs(UnmanagedType.ByValArray, SizeConst = DEV_IDLEN + 1)] public byte[] DeviceName; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = DEV_IDLEN + 1)] + public byte[] DeviceName; /// /// Unit number of the passthrough device associated with this particular device. /// @@ -764,7 +787,8 @@ namespace DiscImageChef.Devices.FreeBSD /// /// Controller name, e.g. 'ahc' /// - [MarshalAs(UnmanagedType.ByValArray, SizeConst = SIM_IDLEN + 1)] public byte[] SimName; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = SIM_IDLEN + 1)] + public byte[] SimName; /// /// Controller unit number /// @@ -792,11 +816,13 @@ namespace DiscImageChef.Devices.FreeBSD /// /// SCSI Inquiry data /// - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 256)] public byte[] InqData; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 256)] + public byte[] InqData; /// /// device serial number /// - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 252)] public byte[] SerialNum; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 252)] + public byte[] SerialNum; /// /// length of the serial number /// @@ -823,19 +849,23 @@ namespace DiscImageChef.Devices.FreeBSD [SuppressMessage("ReSharper", "MemberCanBePrivate.Global")] struct CcbGetdev { - public CcbHdr ccb_h; + public CcbHdr ccb_h; public CamProto protocol; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 256)] public byte[] inq_data; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 512)] public byte[] ident_data; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 256)] + public byte[] inq_data; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 512)] + public byte[] ident_data; /// /// device serial number /// - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 252)] public byte[] serial_num; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 252)] + public byte[] serial_num; public byte inq_flags; /// /// length of the serial number /// public byte serial_num_len; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)] public IntPtr[] padding; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)] + public IntPtr[] padding; } } \ No newline at end of file diff --git a/DiscImageChef.Devices/Linux/ListDevices.cs b/DiscImageChef.Devices/Linux/ListDevices.cs index 62e3ccfd3..1dfbfd775 100644 --- a/DiscImageChef.Devices/Linux/ListDevices.cs +++ b/DiscImageChef.Devices/Linux/ListDevices.cs @@ -46,15 +46,16 @@ namespace DiscImageChef.Devices.Linux /// List of devices internal static DeviceInfo[] GetList() { - string[] sysdevs = Directory.GetFileSystemEntries(PATH_SYS_DEVBLOCK, "*", SearchOption.TopDirectoryOnly); + string[] sysdevs = + Directory.GetFileSystemEntries(PATH_SYS_DEVBLOCK, "*", SearchOption.TopDirectoryOnly); DeviceInfo[] devices = new DeviceInfo[sysdevs.Length]; - bool hasUdev; + bool hasUdev; IntPtr udev = IntPtr.Zero; try { - udev = Extern.udev_new(); + udev = Extern.udev_new(); hasUdev = udev != IntPtr.Zero; } catch { hasUdev = false; } @@ -68,7 +69,7 @@ namespace DiscImageChef.Devices.Linux IntPtr 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"); + 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('_', ' '); devices[i].Serial = Extern.udev_device_get_property_value(udevDev, "ID_SCSI_SERIAL"); if(string.IsNullOrEmpty(devices[i].Serial)) @@ -79,7 +80,7 @@ namespace DiscImageChef.Devices.Linux StreamReader sr; if(File.Exists(Path.Combine(sysdevs[i], "device/vendor")) && string.IsNullOrEmpty(devices[i].Vendor)) { - sr = new StreamReader(Path.Combine(sysdevs[i], "device/vendor"), Encoding.ASCII); + sr = new StreamReader(Path.Combine(sysdevs[i], "device/vendor"), Encoding.ASCII); devices[i].Vendor = sr.ReadLine()?.Trim(); } else if(devices[i].Path.StartsWith("/dev/loop", StringComparison.CurrentCulture)) @@ -88,7 +89,7 @@ namespace DiscImageChef.Devices.Linux 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); + sr = new StreamReader(Path.Combine(sysdevs[i], "device/model"), Encoding.ASCII); devices[i].Model = sr.ReadLine()?.Trim(); } else if(devices[i].Path.StartsWith("/dev/loop", StringComparison.CurrentCulture)) @@ -96,7 +97,7 @@ namespace DiscImageChef.Devices.Linux if(File.Exists(Path.Combine(sysdevs[i], "device/serial")) && string.IsNullOrEmpty(devices[i].Serial)) { - sr = new StreamReader(Path.Combine(sysdevs[i], "device/serial"), Encoding.ASCII); + sr = new StreamReader(Path.Combine(sysdevs[i], "device/serial"), Encoding.ASCII); devices[i].Serial = sr.ReadLine()?.Trim(); } @@ -107,7 +108,7 @@ namespace DiscImageChef.Devices.Linux if(pieces.Length > 1) { devices[i].Vendor = pieces[0]; - devices[i].Model = devices[i].Model.Substring(pieces[0].Length + 1); + devices[i].Model = devices[i].Model.Substring(pieces[0].Length + 1); } } diff --git a/DiscImageChef.Devices/Linux/Structs.cs b/DiscImageChef.Devices/Linux/Structs.cs index de1396dc6..f4833e6ba 100644 --- a/DiscImageChef.Devices/Linux/Structs.cs +++ b/DiscImageChef.Devices/Linux/Structs.cs @@ -44,28 +44,28 @@ namespace DiscImageChef.Devices.Linux /// /// Always 'S' for SG v3 /// - public int interface_id; /* [i] 'S' (required) */ + 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 ushort host_status; /* [o] */ - public ushort driver_status; /* [o] */ - public int resid; /* [o] */ - public uint duration; /* [o] */ - public SgInfo info; /* [o] */ + 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 ushort host_status; /* [o] */ + public ushort driver_status; /* [o] */ + public int resid; /* [o] */ + public uint duration; /* [o] */ + public SgInfo info; /* [o] */ } [StructLayout(LayoutKind.Sequential)] @@ -85,10 +85,11 @@ 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; + public uint blksz; + public uint blocks; /// /// Sleep at least useconds, and at most /// useconds *after* issuing command.Needed for diff --git a/DiscImageChef.Devices/Windows/Command.cs b/DiscImageChef.Devices/Windows/Command.cs index b25f1b3dd..3f2abbd25 100644 --- a/DiscImageChef.Devices/Windows/Command.cs +++ b/DiscImageChef.Devices/Windows/Command.cs @@ -58,13 +58,14 @@ namespace DiscImageChef.Devices.Windows /// 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; + duration = 0; + sense = false; if(buffer == null) return -1; @@ -73,21 +74,21 @@ namespace DiscImageChef.Devices.Windows SenseBuf = new byte[32], sptd = new ScsiPassThroughDirect { - Cdb = new byte[16], - CdbLength = (byte)cdb.Length, - SenseInfoLength = 32, - DataIn = direction, + Cdb = new byte[16], + CdbLength = (byte)cdb.Length, + SenseInfoLength = 32, + DataIn = direction, DataTransferLength = (uint)buffer.Length, - TimeOutValue = timeout, - DataBuffer = Marshal.AllocHGlobal(buffer.Length) + TimeOutValue = timeout, + DataBuffer = Marshal.AllocHGlobal(buffer.Length) } }; - sptdSb.sptd.Length = (ushort)Marshal.SizeOf(sptdSb.sptd); + sptdSb.sptd.Length = (ushort)Marshal.SizeOf(sptdSb.sptd); sptdSb.sptd.SenseInfoOffset = (uint)Marshal.SizeOf(sptdSb.sptd); Array.Copy(cdb, sptdSb.sptd.Cdb, cdb.Length); - uint k = 0; - int error = 0; + uint k = 0; + int error = 0; Marshal.Copy(buffer, 0, sptdSb.sptd.DataBuffer, buffer.Length); @@ -125,12 +126,13 @@ namespace DiscImageChef.Devices.Windows /// Registers to send to drive /// Registers returned by drive /// ATA protocol to use - 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; + duration = 0; + sense = false; errorRegisters = new AtaErrorRegistersChs(); if(buffer == null) return -1; @@ -141,19 +143,19 @@ namespace DiscImageChef.Devices.Windows { aptd = new AtaPassThroughDirect { - TimeOutValue = timeout, - DataBuffer = (IntPtr)offsetForBuffer, - Length = (ushort)Marshal.SizeOf(typeof(AtaPassThroughDirect)), + TimeOutValue = timeout, + DataBuffer = (IntPtr)offsetForBuffer, + Length = (ushort)Marshal.SizeOf(typeof(AtaPassThroughDirect)), DataTransferLength = (uint)buffer.Length, - PreviousTaskFile = new AtaTaskFile(), + PreviousTaskFile = new AtaTaskFile(), CurrentTaskFile = new AtaTaskFile { - Command = registers.Command, + Command = registers.Command, CylinderHigh = registers.CylinderHigh, - CylinderLow = registers.CylinderLow, - DeviceHead = registers.DeviceHead, - Features = registers.Feature, - SectorCount = registers.SectorCount, + CylinderLow = registers.CylinderLow, + DeviceHead = registers.DeviceHead, + Features = registers.Feature, + SectorCount = registers.SectorCount, SectorNumber = registers.Sector } }, @@ -187,8 +189,8 @@ namespace DiscImageChef.Devices.Windows // Unknown if needed aptdBuf.aptd.AtaFlags |= AtaFlags.DrdyRequired; - uint k = 0; - int error = 0; + uint k = 0; + int error = 0; Array.Copy(buffer, 0, aptdBuf.dataBuffer, 0, buffer.Length); @@ -205,12 +207,12 @@ namespace DiscImageChef.Devices.Windows duration = (end - start).TotalMilliseconds; errorRegisters.CylinderHigh = aptdBuf.aptd.CurrentTaskFile.CylinderHigh; - errorRegisters.CylinderLow = aptdBuf.aptd.CurrentTaskFile.CylinderLow; - errorRegisters.DeviceHead = aptdBuf.aptd.CurrentTaskFile.DeviceHead; - errorRegisters.Error = aptdBuf.aptd.CurrentTaskFile.Error; - errorRegisters.Sector = aptdBuf.aptd.CurrentTaskFile.SectorNumber; - errorRegisters.SectorCount = aptdBuf.aptd.CurrentTaskFile.SectorCount; - errorRegisters.Status = aptdBuf.aptd.CurrentTaskFile.Status; + errorRegisters.CylinderLow = aptdBuf.aptd.CurrentTaskFile.CylinderLow; + errorRegisters.DeviceHead = aptdBuf.aptd.CurrentTaskFile.DeviceHead; + errorRegisters.Error = aptdBuf.aptd.CurrentTaskFile.Error; + errorRegisters.Sector = aptdBuf.aptd.CurrentTaskFile.SectorNumber; + errorRegisters.SectorCount = aptdBuf.aptd.CurrentTaskFile.SectorCount; + errorRegisters.Status = aptdBuf.aptd.CurrentTaskFile.Status; sense = errorRegisters.Error != 0 || (errorRegisters.Status & 0xA5) != 0; @@ -229,12 +231,13 @@ namespace DiscImageChef.Devices.Windows /// Registers to send to drive /// Registers returned by drive /// ATA protocol to use - 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; + duration = 0; + sense = false; errorRegisters = new AtaErrorRegistersLba28(); if(buffer == null) return -1; @@ -245,19 +248,19 @@ namespace DiscImageChef.Devices.Windows { aptd = new AtaPassThroughDirect { - TimeOutValue = timeout, - DataBuffer = (IntPtr)offsetForBuffer, - Length = (ushort)Marshal.SizeOf(typeof(AtaPassThroughDirect)), + TimeOutValue = timeout, + DataBuffer = (IntPtr)offsetForBuffer, + Length = (ushort)Marshal.SizeOf(typeof(AtaPassThroughDirect)), DataTransferLength = (uint)buffer.Length, - PreviousTaskFile = new AtaTaskFile(), + PreviousTaskFile = new AtaTaskFile(), CurrentTaskFile = new AtaTaskFile { - Command = registers.Command, + Command = registers.Command, CylinderHigh = registers.LbaHigh, - CylinderLow = registers.LbaMid, - DeviceHead = registers.DeviceHead, - Features = registers.Feature, - SectorCount = registers.SectorCount, + CylinderLow = registers.LbaMid, + DeviceHead = registers.DeviceHead, + Features = registers.Feature, + SectorCount = registers.SectorCount, SectorNumber = registers.LbaLow } }, @@ -291,8 +294,8 @@ namespace DiscImageChef.Devices.Windows // Unknown if needed aptdBuf.aptd.AtaFlags |= AtaFlags.DrdyRequired; - uint k = 0; - int error = 0; + uint k = 0; + int error = 0; Array.Copy(buffer, 0, aptdBuf.dataBuffer, 0, buffer.Length); @@ -308,13 +311,13 @@ namespace DiscImageChef.Devices.Windows duration = (end - start).TotalMilliseconds; - errorRegisters.LbaHigh = aptdBuf.aptd.CurrentTaskFile.CylinderHigh; - errorRegisters.LbaMid = aptdBuf.aptd.CurrentTaskFile.CylinderLow; - errorRegisters.DeviceHead = aptdBuf.aptd.CurrentTaskFile.DeviceHead; - errorRegisters.Error = aptdBuf.aptd.CurrentTaskFile.Error; - errorRegisters.LbaLow = aptdBuf.aptd.CurrentTaskFile.SectorNumber; + errorRegisters.LbaHigh = aptdBuf.aptd.CurrentTaskFile.CylinderHigh; + errorRegisters.LbaMid = aptdBuf.aptd.CurrentTaskFile.CylinderLow; + errorRegisters.DeviceHead = aptdBuf.aptd.CurrentTaskFile.DeviceHead; + errorRegisters.Error = aptdBuf.aptd.CurrentTaskFile.Error; + errorRegisters.LbaLow = aptdBuf.aptd.CurrentTaskFile.SectorNumber; errorRegisters.SectorCount = aptdBuf.aptd.CurrentTaskFile.SectorCount; - errorRegisters.Status = aptdBuf.aptd.CurrentTaskFile.Status; + errorRegisters.Status = aptdBuf.aptd.CurrentTaskFile.Status; sense = errorRegisters.Error != 0 || (errorRegisters.Status & 0xA5) != 0; @@ -333,12 +336,13 @@ namespace DiscImageChef.Devices.Windows /// Registers to send to drive /// Registers returned by drive /// ATA protocol to use - 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; + duration = 0; + sense = false; errorRegisters = new AtaErrorRegistersLba48(); if(buffer == null) return -1; @@ -349,28 +353,28 @@ namespace DiscImageChef.Devices.Windows { aptd = new AtaPassThroughDirect { - TimeOutValue = timeout, - DataBuffer = (IntPtr)offsetForBuffer, - Length = (ushort)Marshal.SizeOf(typeof(AtaPassThroughDirect)), + TimeOutValue = timeout, + 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) + 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, + Command = registers.Command, CylinderHigh = (byte)(registers.LbaHigh & 0xFF), - CylinderLow = (byte)(registers.LbaMid & 0xFF), - DeviceHead = registers.DeviceHead, - Features = (byte)(registers.Feature & 0xFF), - SectorCount = (byte)(registers.SectorCount & 0xFF), - SectorNumber = (byte)(registers.LbaLow & 0xFF) + CylinderLow = (byte)(registers.LbaMid & 0xFF), + DeviceHead = registers.DeviceHead, + Features = (byte)(registers.Feature & 0xFF), + SectorCount = (byte)(registers.SectorCount & 0xFF), + SectorNumber = (byte)(registers.LbaLow & 0xFF) } }, dataBuffer = new byte[64 * 512] @@ -403,8 +407,8 @@ namespace DiscImageChef.Devices.Windows // Unknown if needed aptdBuf.aptd.AtaFlags |= AtaFlags.DrdyRequired; - uint k = 0; - int error = 0; + uint k = 0; + int error = 0; Array.Copy(buffer, 0, aptdBuf.dataBuffer, 0, buffer.Length); @@ -429,8 +433,8 @@ namespace DiscImageChef.Devices.Windows errorRegisters.LbaHigh = (ushort)((aptdBuf.aptd.PreviousTaskFile.CylinderHigh << 8) + aptdBuf.aptd.CurrentTaskFile.CylinderHigh); errorRegisters.DeviceHead = aptdBuf.aptd.CurrentTaskFile.DeviceHead; - errorRegisters.Error = aptdBuf.aptd.CurrentTaskFile.Error; - errorRegisters.Status = aptdBuf.aptd.CurrentTaskFile.Status; + errorRegisters.Error = aptdBuf.aptd.CurrentTaskFile.Error; + errorRegisters.Status = aptdBuf.aptd.CurrentTaskFile.Status; sense = errorRegisters.Error != 0 || (errorRegisters.Status & 0xA5) != 0; @@ -449,12 +453,13 @@ namespace DiscImageChef.Devices.Windows /// Registers to send to drive /// Registers returned by drive /// ATA protocol to use - 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; + duration = 0; + sense = false; errorRegisters = new AtaErrorRegistersChs(); if(buffer == null || buffer.Length > 512) return -1; @@ -463,20 +468,20 @@ namespace DiscImageChef.Devices.Windows { CurrentTaskFile = new AtaTaskFile { - Command = registers.Command, + Command = registers.Command, CylinderHigh = registers.CylinderHigh, - CylinderLow = registers.CylinderLow, - DeviceHead = registers.DeviceHead, - Features = registers.Feature, - SectorCount = registers.SectorCount, + CylinderLow = registers.CylinderLow, + DeviceHead = registers.DeviceHead, + Features = registers.Feature, + SectorCount = registers.SectorCount, SectorNumber = registers.Sector }, DataBufferSize = 512, - DataBuffer = new byte[512] + DataBuffer = new byte[512] }; - uint k = 0; - int error = 0; + uint k = 0; + int error = 0; Array.Copy(buffer, 0, iptd.DataBuffer, 0, buffer.Length); @@ -494,12 +499,12 @@ namespace DiscImageChef.Devices.Windows duration = (end - start).TotalMilliseconds; errorRegisters.CylinderHigh = iptd.CurrentTaskFile.CylinderHigh; - errorRegisters.CylinderLow = iptd.CurrentTaskFile.CylinderLow; - errorRegisters.DeviceHead = iptd.CurrentTaskFile.DeviceHead; - errorRegisters.Error = iptd.CurrentTaskFile.Error; - errorRegisters.Sector = iptd.CurrentTaskFile.SectorNumber; - errorRegisters.SectorCount = iptd.CurrentTaskFile.SectorCount; - errorRegisters.Status = iptd.CurrentTaskFile.Status; + errorRegisters.CylinderLow = iptd.CurrentTaskFile.CylinderLow; + errorRegisters.DeviceHead = iptd.CurrentTaskFile.DeviceHead; + errorRegisters.Error = iptd.CurrentTaskFile.Error; + errorRegisters.Sector = iptd.CurrentTaskFile.SectorNumber; + errorRegisters.SectorCount = iptd.CurrentTaskFile.SectorCount; + errorRegisters.Status = iptd.CurrentTaskFile.Status; sense = errorRegisters.Error != 0 || (errorRegisters.Status & 0xA5) != 0; @@ -518,12 +523,13 @@ namespace DiscImageChef.Devices.Windows /// Registers to send to drive /// Registers returned by drive /// ATA protocol to use - 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; + duration = 0; + sense = false; errorRegisters = new AtaErrorRegistersLba28(); if(buffer == null) return -1; @@ -532,20 +538,20 @@ namespace DiscImageChef.Devices.Windows { CurrentTaskFile = new AtaTaskFile { - Command = registers.Command, + Command = registers.Command, CylinderHigh = registers.LbaHigh, - CylinderLow = registers.LbaMid, - DeviceHead = registers.DeviceHead, - Features = registers.Feature, - SectorCount = registers.SectorCount, + CylinderLow = registers.LbaMid, + DeviceHead = registers.DeviceHead, + Features = registers.Feature, + SectorCount = registers.SectorCount, SectorNumber = registers.LbaLow }, DataBufferSize = 512, - DataBuffer = new byte[512] + DataBuffer = new byte[512] }; - uint k = 0; - int error = 0; + uint k = 0; + int error = 0; Array.Copy(buffer, 0, iptd.DataBuffer, 0, buffer.Length); @@ -562,13 +568,13 @@ namespace DiscImageChef.Devices.Windows duration = (end - start).TotalMilliseconds; - errorRegisters.LbaHigh = iptd.CurrentTaskFile.CylinderHigh; - errorRegisters.LbaMid = iptd.CurrentTaskFile.CylinderLow; - errorRegisters.DeviceHead = iptd.CurrentTaskFile.DeviceHead; - errorRegisters.Error = iptd.CurrentTaskFile.Error; - errorRegisters.LbaLow = iptd.CurrentTaskFile.SectorNumber; + errorRegisters.LbaHigh = iptd.CurrentTaskFile.CylinderHigh; + errorRegisters.LbaMid = iptd.CurrentTaskFile.CylinderLow; + errorRegisters.DeviceHead = iptd.CurrentTaskFile.DeviceHead; + errorRegisters.Error = iptd.CurrentTaskFile.Error; + errorRegisters.LbaLow = iptd.CurrentTaskFile.SectorNumber; errorRegisters.SectorCount = iptd.CurrentTaskFile.SectorCount; - errorRegisters.Status = iptd.CurrentTaskFile.Status; + errorRegisters.Status = iptd.CurrentTaskFile.Status; sense = errorRegisters.Error != 0 || (errorRegisters.Status & 0xA5) != 0; @@ -583,7 +589,7 @@ namespace DiscImageChef.Devices.Windows static uint GetDeviceNumber(SafeFileHandle deviceHandle) { StorageDeviceNumber sdn = new StorageDeviceNumber {deviceNumber = -1}; - uint k = 0; + uint k = 0; if(!Extern.DeviceIoControlGetDeviceNumber(deviceHandle, WindowsIoctl.IoctlStorageGetDeviceNumber, IntPtr.Zero, 0, ref sdn, (uint)Marshal.SizeOf(sdn), ref k, IntPtr.Zero)) return uint.MaxValue; @@ -609,7 +615,7 @@ namespace DiscImageChef.Devices.Windows if(hDevInfo.IsInvalid) return null; - uint index = 0; + uint index = 0; DeviceInterfaceData spdid = new DeviceInterfaceData(); spdid.cbSize = Marshal.SizeOf(spdid); @@ -700,19 +706,22 @@ namespace DiscImageChef.Devices.Windows /// Command argument /// 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) + 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) { - SffdiskDeviceCommandData commandData = new SffdiskDeviceCommandData(); - SdCmdDescriptor commandDescriptor = new SdCmdDescriptor(); - commandData.size = (ushort)Marshal.SizeOf(commandData); - commandData.command = SffdiskDcmd.DeviceCommand; - commandData.protocolArgumentSize = (ushort)Marshal.SizeOf(commandDescriptor); - commandData.deviceDataBufferSize = blockSize * blocks; - commandDescriptor.commandCode = (byte)command; - commandDescriptor.cmdClass = isApplication ? SdCommandClass.AppCmd : SdCommandClass.Standard; + SffdiskDeviceCommandData commandData = new SffdiskDeviceCommandData(); + SdCmdDescriptor commandDescriptor = new SdCmdDescriptor(); + commandData.size = (ushort)Marshal.SizeOf(commandData); + commandData.command = SffdiskDcmd.DeviceCommand; + commandData.protocolArgumentSize = (ushort)Marshal.SizeOf(commandDescriptor); + commandData.deviceDataBufferSize = blockSize * blocks; + 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 @@ -742,7 +751,7 @@ namespace DiscImageChef.Devices.Windows Marshal.Copy(hBuf, commandB, 0, commandB.Length); Marshal.FreeHGlobal(hBuf); - int error = 0; + int error = 0; DateTime start = DateTime.Now; sense = !Extern.DeviceIoControl(fd, WindowsIoctl.IoctlSffdiskDeviceCommand, commandB, (uint)commandB.Length, commandB, (uint)commandB.Length, out _, IntPtr.Zero); diff --git a/DiscImageChef.Devices/Windows/Enums.cs b/DiscImageChef.Devices/Windows/Enums.cs index 92077cb72..fb4180959 100644 --- a/DiscImageChef.Devices/Windows/Enums.cs +++ b/DiscImageChef.Devices/Windows/Enums.cs @@ -327,7 +327,7 @@ namespace DiscImageChef.Devices.Windows enum WindowsIoctl : uint { - IoctlAtaPassThrough = 0x4D02C, + IoctlAtaPassThrough = 0x4D02C, IoctlAtaPassThroughDirect = 0x4D030, /// /// ScsiPassThrough @@ -341,11 +341,11 @@ namespace DiscImageChef.Devices.Windows /// ScsiGetAddress /// IoctlScsiGetAddress = 0x41018, - IoctlStorageQueryProperty = 0x2D1400, - IoctlIdePassThrough = 0x4D028, - IoctlStorageGetDeviceNumber = 0x2D1080, + IoctlStorageQueryProperty = 0x2D1400, + IoctlIdePassThrough = 0x4D028, + IoctlStorageGetDeviceNumber = 0x2D1080, IoctlSffdiskQueryDeviceProtocol = 0x71E80, - IoctlSffdiskDeviceCommand = 0x79E84 + IoctlSffdiskDeviceCommand = 0x79E84 } [Flags] @@ -379,51 +379,51 @@ namespace DiscImageChef.Devices.Windows enum StoragePropertyId { - Device = 0, - Adapter = 1, - Id = 2, - UniqueId = 3, - WriteCache = 4, - Miniport = 5, - AccessAlignment = 6, - SeekPenalty = 7, - Trim = 8, + Device = 0, + Adapter = 1, + Id = 2, + UniqueId = 3, + WriteCache = 4, + Miniport = 5, + AccessAlignment = 6, + SeekPenalty = 7, + Trim = 8, WriteAggregation = 9, - Telemetry = 10, - LbProvisioning = 11, - Power = 12, - Copyoffload = 13, - Resiliency = 14 + Telemetry = 10, + LbProvisioning = 11, + Power = 12, + Copyoffload = 13, + Resiliency = 14 } enum StorageQueryType { Standard = 0, - Exists = 1, - Mask = 2, - Max = 3 + Exists = 1, + Mask = 2, + Max = 3 } [SuppressMessage("ReSharper", "InconsistentNaming")] enum StorageBusType { - Unknown = 0, - SCSI = 1, - ATAPI = 2, - ATA = 3, - FireWire = 4, - SSA = 5, - Fibre = 6, - USB = 7, - RAID = 8, - iSCSI = 9, - SAS = 0xA, - SATA = 0xB, - SecureDigital = 0xC, - MultiMediaCard = 0xD, - Virtual = 0xE, + Unknown = 0, + SCSI = 1, + ATAPI = 2, + ATA = 3, + FireWire = 4, + SSA = 5, + Fibre = 6, + USB = 7, + RAID = 8, + iSCSI = 9, + SAS = 0xA, + SATA = 0xB, + SecureDigital = 0xC, + MultiMediaCard = 0xD, + Virtual = 0xE, FileBackedVirtual = 0xF, - NVMe = 0x11 + NVMe = 0x11 } [Flags] diff --git a/DiscImageChef.Devices/Windows/Extern.cs b/DiscImageChef.Devices/Windows/Extern.cs index c2c8a3730..e90760ba4 100644 --- a/DiscImageChef.Devices/Windows/Extern.cs +++ b/DiscImageChef.Devices/Windows/Extern.cs @@ -40,72 +40,99 @@ 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, + 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, + internal static extern bool DeviceIoControlScsi(SafeFileHandle hDevice, + WindowsIoctl ioControlCode, ref ScsiPassThroughDirectAndSenseBuffer inBuffer, - uint nInBufferSize, + uint nInBufferSize, ref ScsiPassThroughDirectAndSenseBuffer outBuffer, - uint nOutBufferSize, ref uint pBytesReturned, - IntPtr overlapped); + 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, + internal static extern bool DeviceIoControlAta(SafeFileHandle hDevice, + WindowsIoctl ioControlCode, + ref AtaPassThroughDirectWithBuffer inBuffer, + uint nInBufferSize, ref AtaPassThroughDirectWithBuffer outBuffer, - uint nOutBufferSize, ref uint pBytesReturned, IntPtr overlapped); + 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, + internal static extern bool DeviceIoControlGetDeviceNumber(SafeFileHandle hDevice, + WindowsIoctl ioControlCode, + IntPtr inBuffer, + uint nInBufferSize, ref StorageDeviceNumber outBuffer, - uint nOutBufferSize, ref uint pBytesReturned, - IntPtr overlapped); + 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); + internal static extern bool DeviceIoControl(SafeFileHandle hDevice, WindowsIoctl ioControlCode, + byte[] inBuffer, + 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, + 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, + public static extern bool SetupDiGetDeviceInterfaceDetail(SafeFileHandle hDevInfo, ref DeviceInterfaceData deviceInterfaceData, - IntPtr deviceInterfaceDetailData, - uint deviceInterfaceDetailDataSize, - ref uint requiredSize, IntPtr deviceInfoData); + IntPtr deviceInterfaceDetailData, + uint deviceInterfaceDetailDataSize, + ref uint requiredSize, + IntPtr deviceInfoData); [DllImport("setupapi.dll", CharSet = CharSet.Auto, SetLastError = true)] public static extern bool SetupDiDestroyDeviceInfoList(SafeFileHandle hDevInfo); diff --git a/DiscImageChef.Devices/Windows/ListDevices.cs b/DiscImageChef.Devices/Windows/ListDevices.cs index e01dda078..c47057c9c 100644 --- a/DiscImageChef.Devices/Windows/ListDevices.cs +++ b/DiscImageChef.Devices/Windows/ListDevices.cs @@ -50,8 +50,8 @@ namespace DiscImageChef.Devices.Windows /// Decoded string static string HexStringToString(string hex) { - StringBuilder result = new StringBuilder(); - const string HEXTABLE = "0123456789abcdef"; + StringBuilder result = new StringBuilder(); + const string HEXTABLE = "0123456789abcdef"; for(int i = 0; i < hex.Length / 2; i++) result.Append((char)(16 * HEXTABLE.IndexOf(hex[2 * i]) + HEXTABLE.IndexOf(hex[2 * i + 1]))); @@ -77,20 +77,20 @@ namespace DiscImageChef.Devices.Windows deviceIDs.AddRange(from ManagementObject drive in objCol select (string)drive["DeviceID"]); mgmtObjSearcher = new ManagementObjectSearcher("SELECT * FROM Win32_TapeDrive"); - objCol = mgmtObjSearcher.Get(); + objCol = mgmtObjSearcher.Get(); deviceIDs.AddRange(from ManagementObject drive in objCol select (string)drive["DeviceID"]); mgmtObjSearcher = new ManagementObjectSearcher("SELECT * FROM Win32_CDROMDrive"); - objCol = mgmtObjSearcher.Get(); + objCol = mgmtObjSearcher.Get(); deviceIDs.AddRange(from ManagementObject drive in objCol select (string)drive["Drive"]); } catch(Exception) { -#if DEBUG + #if DEBUG throw; -#else + #else return null; #endif } @@ -108,8 +108,8 @@ namespace DiscImageChef.Devices.Windows StoragePropertyQuery query = new StoragePropertyQuery { - PropertyId = StoragePropertyId.Device, - QueryType = StorageQueryType.Standard, + PropertyId = StoragePropertyId.Device, + QueryType = StorageQueryType.Standard, AdditionalParameters = new byte[1] }; @@ -117,10 +117,10 @@ namespace DiscImageChef.Devices.Windows //descriptor.RawDeviceProperties = new byte[16384]; IntPtr descriptorPtr = Marshal.AllocHGlobal(1000); - byte[] descriptorB = new byte[1000]; + byte[] descriptorB = new byte[1000]; uint returned = 0; - int error = 0; + int error = 0; bool hasError = !Extern.DeviceIoControlStorageQuery(fd, WindowsIoctl.IoctlStorageQueryProperty, ref query, (uint)Marshal.SizeOf(query), @@ -134,18 +134,18 @@ namespace DiscImageChef.Devices.Windows StorageDeviceDescriptor descriptor = new StorageDeviceDescriptor { - Version = BitConverter.ToUInt32(descriptorB, 0), - Size = BitConverter.ToUInt32(descriptorB, 4), - DeviceType = descriptorB[8], - DeviceTypeModifier = descriptorB[9], - RemovableMedia = BitConverter.ToBoolean(descriptorB, 10), - CommandQueueing = BitConverter.ToBoolean(descriptorB, 11), - VendorIdOffset = BitConverter.ToInt32(descriptorB, 12), - ProductIdOffset = BitConverter.ToInt32(descriptorB, 16), + Version = BitConverter.ToUInt32(descriptorB, 0), + Size = BitConverter.ToUInt32(descriptorB, 4), + DeviceType = descriptorB[8], + DeviceTypeModifier = descriptorB[9], + RemovableMedia = BitConverter.ToBoolean(descriptorB, 10), + CommandQueueing = BitConverter.ToBoolean(descriptorB, 11), + VendorIdOffset = BitConverter.ToInt32(descriptorB, 12), + ProductIdOffset = BitConverter.ToInt32(descriptorB, 16), ProductRevisionOffset = BitConverter.ToInt32(descriptorB, 20), - SerialNumberOffset = BitConverter.ToInt32(descriptorB, 24), - BusType = (StorageBusType)BitConverter.ToUInt32(descriptorB, 28), - RawPropertiesLength = BitConverter.ToUInt32(descriptorB, 32) + SerialNumberOffset = BitConverter.ToInt32(descriptorB, 24), + BusType = (StorageBusType)BitConverter.ToUInt32(descriptorB, 28), + RawPropertiesLength = BitConverter.ToUInt32(descriptorB, 32) }; DeviceInfo info = new DeviceInfo {Path = physId, Bus = descriptor.BusType.ToString()}; @@ -173,7 +173,7 @@ namespace DiscImageChef.Devices.Windows if(pieces.Length > 1) { info.Vendor = pieces[0]; - info.Model = info.Model.Substring(pieces[0].Length + 1); + info.Model = info.Model.Substring(pieces[0].Length + 1); } } diff --git a/DiscImageChef.Devices/Windows/Structs.cs b/DiscImageChef.Devices/Windows/Structs.cs index 9348332ff..494477842 100644 --- a/DiscImageChef.Devices/Windows/Structs.cs +++ b/DiscImageChef.Devices/Windows/Structs.cs @@ -41,26 +41,28 @@ namespace DiscImageChef.Devices.Windows [SuppressMessage("ReSharper", "MemberCanBePrivate.Global")] struct ScsiPassThroughDirect { - public ushort Length; - public byte ScsiStatus; - public byte PathId; - public byte TargetId; - public byte Lun; - public byte CdbLength; - public byte SenseInfoLength; + public ushort Length; + public byte ScsiStatus; + public byte PathId; + public byte TargetId; + public byte Lun; + public byte CdbLength; + public byte SenseInfoLength; [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; + public uint DataTransferLength; + public uint TimeOutValue; + public IntPtr DataBuffer; + public uint SenseInfoOffset; + [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)] @@ -122,8 +124,9 @@ namespace DiscImageChef.Devices.Windows struct AtaPassThroughDirectWithBuffer { public AtaPassThroughDirect aptd; - public uint filler; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 64 * 512)] public byte[] dataBuffer; + public uint filler; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 64 * 512)] + public byte[] dataBuffer; } [StructLayout(LayoutKind.Explicit)] @@ -151,8 +154,9 @@ namespace DiscImageChef.Devices.Windows 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 StorageQueryType QueryType; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 1)] + public byte[] AdditionalParameters; } [StructLayout(LayoutKind.Sequential)] @@ -166,19 +170,19 @@ namespace DiscImageChef.Devices.Windows [StructLayout(LayoutKind.Sequential)] struct StorageDeviceDescriptor { - public uint Version; - public uint Size; - public byte DeviceType; - public byte DeviceTypeModifier; - [MarshalAs(UnmanagedType.U1)] public bool RemovableMedia; - [MarshalAs(UnmanagedType.U1)] public bool CommandQueueing; - public int VendorIdOffset; - public int ProductIdOffset; - public int ProductRevisionOffset; - public int SerialNumberOffset; - public StorageBusType BusType; - public uint RawPropertiesLength; - public byte[] RawDeviceProperties; + public uint Version; + public uint Size; + public byte DeviceType; + public byte DeviceTypeModifier; + [MarshalAs(UnmanagedType.U1)] public bool RemovableMedia; + [MarshalAs(UnmanagedType.U1)] public bool CommandQueueing; + public int VendorIdOffset; + public int ProductIdOffset; + public int ProductRevisionOffset; + public int SerialNumberOffset; + public StorageBusType BusType; + public uint RawPropertiesLength; + public byte[] RawDeviceProperties; } [StructLayout(LayoutKind.Sequential)] @@ -195,7 +199,8 @@ 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)] @@ -211,9 +216,9 @@ namespace DiscImageChef.Devices.Windows [SuppressMessage("ReSharper", "MemberCanBePrivate.Global")] struct DeviceInfoData { - public int cbSize; - public Guid classGuid; - public uint devInst; + public int cbSize; + public Guid classGuid; + public uint devInst; public IntPtr reserved; } @@ -221,18 +226,18 @@ namespace DiscImageChef.Devices.Windows [SuppressMessage("ReSharper", "MemberCanBePrivate.Global")] struct DeviceInterfaceData { - public int cbSize; + public int cbSize; public Guid interfaceClassGuid; public uint flags; - IntPtr reserved; + IntPtr reserved; } [StructLayout(LayoutKind.Sequential)] [SuppressMessage("ReSharper", "MemberCanBePrivate.Global")] struct UsbSetupPacket { - public byte bmRequest; - public byte bRequest; + public byte bmRequest; + public byte bRequest; public short wValue; public short wIndex; public short wLength; @@ -242,7 +247,7 @@ namespace DiscImageChef.Devices.Windows [SuppressMessage("ReSharper", "MemberCanBePrivate.Global")] struct UsbDescriptorRequest { - public int ConnectionIndex; + public int ConnectionIndex; public UsbSetupPacket SetupPacket; //public byte[] Data; } @@ -253,28 +258,28 @@ namespace DiscImageChef.Devices.Windows { public ushort size; public ushort reserved; - public Guid protocolGuid; + public Guid protocolGuid; } [StructLayout(LayoutKind.Sequential)] [SuppressMessage("ReSharper", "MemberCanBePrivate.Global")] struct SffdiskDeviceCommandData { - public ushort size; - public ushort reserved; + public ushort size; + public ushort reserved; public SffdiskDcmd command; - public ushort protocolArgumentSize; - public uint deviceDataBufferSize; - public uint information; + public ushort protocolArgumentSize; + public uint deviceDataBufferSize; + public uint information; } [StructLayout(LayoutKind.Sequential)] struct SdCmdDescriptor { - public byte commandCode; - public SdCommandClass cmdClass; + public byte commandCode; + public SdCommandClass cmdClass; public SdTransferDirection transferDirection; - public SdTransferType transferType; - public SdResponseType responseType; + 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 3786cab14..55c1ab31e 100644 --- a/DiscImageChef.Devices/Windows/Usb.cs +++ b/DiscImageChef.Devices/Windows/Usb.cs @@ -53,7 +53,7 @@ namespace DiscImageChef.Devices.Windows static IEnumerable GetHostControllers() { List hostList = new List(); - Guid hostGuid = new Guid(GUID_DEVINTERFACE_HUBCONTROLLER); + Guid hostGuid = new Guid(GUID_DEVINTERFACE_HUBCONTROLLER); // We start at the "root" of the device tree and look for all // devices that match the interface GUID of a Hub Controller @@ -61,8 +61,8 @@ namespace DiscImageChef.Devices.Windows if(h == INVALID_HANDLE_VALUE) return new ReadOnlyCollection(hostList); IntPtr ptrBuf = Marshal.AllocHGlobal(BUFFER_SIZE); - bool success; - int i = 0; + bool success; + int i = 0; do { UsbController host = new UsbController {ControllerIndex = i}; @@ -85,25 +85,27 @@ namespace DiscImageChef.Devices.Windows // trust me :) // now we can get some more detailed information - int nRequiredSize = 0; - const int N_BYTES = BUFFER_SIZE; + int nRequiredSize = 0; + const int N_BYTES = BUFFER_SIZE; if(SetupDiGetDeviceInterfaceDetail(h, ref dia, ref didd, N_BYTES, ref nRequiredSize, ref da)) { host.ControllerDevicePath = didd.DevicePath; // get the Device Description and DriverKeyName int requiredSize = 0; - int regType = REG_SZ; + int regType = REG_SZ; - if(SetupDiGetDeviceRegistryProperty(h, ref da, SPDRP_DEVICEDESC, ref regType, ptrBuf, + if(SetupDiGetDeviceRegistryProperty(h, ref da, SPDRP_DEVICEDESC, ref regType, ptrBuf, BUFFER_SIZE, ref requiredSize)) host.ControllerDeviceDesc = Marshal.PtrToStringAuto(ptrBuf); if(SetupDiGetDeviceRegistryProperty(h, ref da, SPDRP_DRIVER, ref regType, ptrBuf, BUFFER_SIZE, ref requiredSize)) host.ControllerDriverKeyName = Marshal.PtrToStringAuto(ptrBuf); } + hostList.Add(host); } + i++; } while(success); @@ -122,7 +124,7 @@ namespace DiscImageChef.Devices.Windows /// USB device description static string GetDescriptionByKeyName(string driverKeyName) { - string ans = ""; + string ans = ""; const string DEV_ENUM = REGSTR_KEY_USB; // Use the "enumerator form" of the SetupDiGetClassDevs API @@ -133,7 +135,7 @@ namespace DiscImageChef.Devices.Windows IntPtr ptrBuf = Marshal.AllocHGlobal(BUFFER_SIZE); bool success; - int i = 0; + int i = 0; do { // create a Device Interface Data structure @@ -144,9 +146,9 @@ namespace DiscImageChef.Devices.Windows success = SetupDiEnumDeviceInfo(h, i, ref da); if(success) { - int requiredSize = 0; - int regType = REG_SZ; - string keyName = ""; + int requiredSize = 0; + int regType = REG_SZ; + string keyName = ""; if(SetupDiGetDeviceRegistryProperty(h, ref da, SPDRP_DRIVER, ref regType, ptrBuf, BUFFER_SIZE, ref requiredSize)) keyName = Marshal.PtrToStringAuto(ptrBuf); @@ -154,7 +156,7 @@ namespace DiscImageChef.Devices.Windows // is it a match? if(keyName == driverKeyName) { - if(SetupDiGetDeviceRegistryProperty(h, ref da, SPDRP_DEVICEDESC, ref regType, ptrBuf, + if(SetupDiGetDeviceRegistryProperty(h, ref da, SPDRP_DEVICEDESC, ref regType, ptrBuf, BUFFER_SIZE, ref requiredSize)) ans = Marshal.PtrToStringAuto(ptrBuf); break; @@ -178,7 +180,7 @@ namespace DiscImageChef.Devices.Windows /// Device instance ID static string GetInstanceIdByKeyName(string driverKeyName) { - string ans = ""; + string ans = ""; const string DEV_ENUM = REGSTR_KEY_USB; // Use the "enumerator form" of the SetupDiGetClassDevs API @@ -189,7 +191,7 @@ namespace DiscImageChef.Devices.Windows IntPtr ptrBuf = Marshal.AllocHGlobal(BUFFER_SIZE); bool success; - int i = 0; + int i = 0; do { // create a Device Interface Data structure @@ -201,7 +203,7 @@ namespace DiscImageChef.Devices.Windows if(success) { int requiredSize = 0; - int regType = REG_SZ; + int regType = REG_SZ; string keyName = ""; if(SetupDiGetDeviceRegistryProperty(h, ref da, SPDRP_DRIVER, ref regType, ptrBuf, BUFFER_SIZE, @@ -210,8 +212,8 @@ namespace DiscImageChef.Devices.Windows // is it a match? if(keyName == driverKeyName) { - const int N_BYTES = BUFFER_SIZE; - StringBuilder sb = new StringBuilder(N_BYTES); + const int N_BYTES = BUFFER_SIZE; + StringBuilder sb = new StringBuilder(N_BYTES); SetupDiGetDeviceInstanceId(h, ref da, sb, N_BYTES, out requiredSize); ans = sb.ToString(); break; @@ -234,16 +236,16 @@ namespace DiscImageChef.Devices.Windows class UsbController { internal string ControllerDriverKeyName, ControllerDevicePath, ControllerDeviceDesc; - internal int ControllerIndex; + internal int ControllerIndex; /// /// A simple default constructor /// internal UsbController() { - ControllerIndex = 0; - ControllerDevicePath = ""; - ControllerDeviceDesc = ""; + ControllerIndex = 0; + ControllerDevicePath = ""; + ControllerDeviceDesc = ""; ControllerDriverKeyName = ""; } @@ -273,15 +275,15 @@ namespace DiscImageChef.Devices.Windows IntPtr.Zero); if(h == INVALID_HANDLE_VALUE) return root; - UsbRootHubName hubName = new UsbRootHubName(); - int nBytes = Marshal.SizeOf(hubName); - IntPtr ptrHubName = Marshal.AllocHGlobal(nBytes); + UsbRootHubName hubName = new UsbRootHubName(); + int nBytes = Marshal.SizeOf(hubName); + IntPtr ptrHubName = Marshal.AllocHGlobal(nBytes); // get the Hub Name if(DeviceIoControl(h, IOCTL_USB_GET_ROOT_HUB_NAME, ptrHubName, nBytes, ptrHubName, nBytes, out _, IntPtr.Zero)) { - hubName = (UsbRootHubName)Marshal.PtrToStructure(ptrHubName, typeof(UsbRootHubName)); + hubName = (UsbRootHubName)Marshal.PtrToStructure(ptrHubName, typeof(UsbRootHubName)); root.HubDevicePath = @"\\.\" + hubName.RootHubName; } @@ -298,13 +300,15 @@ namespace DiscImageChef.Devices.Windows Marshal.StructureToPtr(nodeInfo, ptrNodeInfo, true); // get the Hub Information - if(DeviceIoControl(h2, IOCTL_USB_GET_NODE_INFORMATION, ptrNodeInfo, nBytes, ptrNodeInfo, nBytes, + if(DeviceIoControl(h2, IOCTL_USB_GET_NODE_INFORMATION, ptrNodeInfo, nBytes, ptrNodeInfo, nBytes, out _, IntPtr.Zero)) { - nodeInfo = (UsbNodeInformation)Marshal.PtrToStructure(ptrNodeInfo, typeof(UsbNodeInformation)); + nodeInfo = + (UsbNodeInformation)Marshal.PtrToStructure(ptrNodeInfo, typeof(UsbNodeInformation)); root.HubIsBusPowered = Convert.ToBoolean(nodeInfo.HubInformation.HubIsBusPowered); - root.HubPortCount = nodeInfo.HubInformation.HubDescriptor.bNumberOfPorts; + root.HubPortCount = nodeInfo.HubInformation.HubDescriptor.bNumberOfPorts; } + Marshal.FreeHGlobal(ptrNodeInfo); CloseHandle(h2); } @@ -318,24 +322,24 @@ namespace DiscImageChef.Devices.Windows /// The Hub class internal class UsbHub { - internal string HubDriverKey, HubDevicePath, HubDeviceDesc; - internal bool HubIsBusPowered, HubIsRootHub; + internal string HubDriverKey, HubDevicePath, HubDeviceDesc; + internal bool HubIsBusPowered, HubIsRootHub; internal string HubManufacturer, HubProduct, HubSerialNumber, HubInstanceId; - internal int HubPortCount; + internal int HubPortCount; /// a simple default constructor internal UsbHub() { - HubPortCount = 0; - HubDevicePath = ""; - HubDeviceDesc = ""; - HubDriverKey = ""; + HubPortCount = 0; + HubDevicePath = ""; + HubDeviceDesc = ""; + HubDriverKey = ""; HubIsBusPowered = false; - HubIsRootHub = false; + HubIsRootHub = false; HubManufacturer = ""; - HubProduct = ""; + HubProduct = ""; HubSerialNumber = ""; - HubInstanceId = ""; + HubInstanceId = ""; } /// return Port Count @@ -381,7 +385,7 @@ namespace DiscImageChef.Devices.Windows IntPtr.Zero); if(h == INVALID_HANDLE_VALUE) return new ReadOnlyCollection(portList); - int nBytes = Marshal.SizeOf(typeof(UsbNodeConnectionInformationEx)); + int nBytes = Marshal.SizeOf(typeof(UsbNodeConnectionInformationEx)); IntPtr ptrNodeConnection = Marshal.AllocHGlobal(nBytes); // loop thru all of the ports on the hub @@ -392,8 +396,10 @@ namespace DiscImageChef.Devices.Windows new UsbNodeConnectionInformationEx {ConnectionIndex = i}; Marshal.StructureToPtr(nodeConnection, ptrNodeConnection, true); - if(!DeviceIoControl(h, IOCTL_USB_GET_NODE_CONNECTION_INFORMATION_EX, ptrNodeConnection, nBytes, - ptrNodeConnection, nBytes, out _, IntPtr.Zero)) continue; + if(!DeviceIoControl(h, IOCTL_USB_GET_NODE_CONNECTION_INFORMATION_EX, + ptrNodeConnection, nBytes, + ptrNodeConnection, nBytes, out _, + IntPtr.Zero)) continue; nodeConnection = (UsbNodeConnectionInformationEx)Marshal.PtrToStructure(ptrNodeConnection, @@ -402,13 +408,13 @@ namespace DiscImageChef.Devices.Windows // load up the USBPort class UsbPort port = new UsbPort { - PortPortNumber = i, + PortPortNumber = i, PortHubDevicePath = HubDevicePath, - PortStatus = ((UsbConnectionStatus)nodeConnection.ConnectionStatus).ToString(), - PortSpeed = ((UsbDeviceSpeed)nodeConnection.Speed).ToString(), + PortStatus = ((UsbConnectionStatus)nodeConnection.ConnectionStatus).ToString(), + PortSpeed = ((UsbDeviceSpeed)nodeConnection.Speed).ToString(), PortIsDeviceConnected = nodeConnection.ConnectionStatus == (int)UsbConnectionStatus.DeviceConnected, - PortIsHub = Convert.ToBoolean(nodeConnection.DeviceIsHub), + PortIsHub = Convert.ToBoolean(nodeConnection.DeviceIsHub), PortDeviceDescriptor = nodeConnection.DeviceDescriptor }; @@ -429,18 +435,18 @@ namespace DiscImageChef.Devices.Windows internal class UsbPort { internal UsbDeviceDescriptor PortDeviceDescriptor; - internal bool PortIsHub, PortIsDeviceConnected; - internal int PortPortNumber; - internal string PortStatus, PortHubDevicePath, PortSpeed; + internal bool PortIsHub, PortIsDeviceConnected; + internal int PortPortNumber; + internal string PortStatus, PortHubDevicePath, PortSpeed; /// a simple default constructor internal UsbPort() { - PortPortNumber = 0; - PortStatus = ""; - PortHubDevicePath = ""; - PortSpeed = ""; - PortIsHub = false; + PortPortNumber = 0; + PortStatus = ""; + PortHubDevicePath = ""; + PortSpeed = ""; + PortIsHub = false; PortIsDeviceConnected = false; } @@ -474,9 +480,9 @@ namespace DiscImageChef.Devices.Windows // Ya know, I've given some thought about making Device a derived class... UsbDevice device = new UsbDevice { - DevicePortNumber = PortPortNumber, + DevicePortNumber = PortPortNumber, DeviceHubDevicePath = PortHubDevicePath, - DeviceDescriptor = PortDeviceDescriptor + DeviceDescriptor = PortDeviceDescriptor }; // Open a handle to the Hub device @@ -512,7 +518,8 @@ namespace DiscImageChef.Devices.Windows Marshal.StructureToPtr(request, ptrRequest, true); // Use an IOCTL call to request the String Descriptor - if(DeviceIoControl(h, IOCTL_USB_GET_DESCRIPTOR_FROM_NODE_CONNECTION, ptrRequest, nBytes, ptrRequest, + if(DeviceIoControl(h, IOCTL_USB_GET_DESCRIPTOR_FROM_NODE_CONNECTION, ptrRequest, nBytes, + ptrRequest, nBytes, out nBytesReturned, IntPtr.Zero)) { // The location of the string descriptor is immediately after @@ -524,8 +531,10 @@ namespace DiscImageChef.Devices.Windows (UsbStringDescriptor)Marshal.PtrToStructure(ptrStringDesc, typeof(UsbStringDescriptor)); device.DeviceManufacturer = stringDesc.bString; } + Marshal.FreeHGlobal(ptrRequest); } + if(PortDeviceDescriptor.iProduct > 0) { // build a request for string descriptor @@ -545,7 +554,8 @@ namespace DiscImageChef.Devices.Windows Marshal.StructureToPtr(request, ptrRequest, true); // Use an IOCTL call to request the String Descriptor - if(DeviceIoControl(h, IOCTL_USB_GET_DESCRIPTOR_FROM_NODE_CONNECTION, ptrRequest, nBytes, ptrRequest, + if(DeviceIoControl(h, IOCTL_USB_GET_DESCRIPTOR_FROM_NODE_CONNECTION, ptrRequest, nBytes, + ptrRequest, nBytes, out nBytesReturned, IntPtr.Zero)) { // the location of the string descriptor is immediately after the Request structure @@ -554,8 +564,10 @@ namespace DiscImageChef.Devices.Windows (UsbStringDescriptor)Marshal.PtrToStructure(ptrStringDesc, typeof(UsbStringDescriptor)); device.DeviceProduct = stringDesc.bString; } + Marshal.FreeHGlobal(ptrRequest); } + if(PortDeviceDescriptor.iSerialNumber > 0) { // build a request for string descriptor @@ -575,7 +587,8 @@ namespace DiscImageChef.Devices.Windows Marshal.StructureToPtr(request, ptrRequest, true); // Use an IOCTL call to request the String Descriptor - if(DeviceIoControl(h, IOCTL_USB_GET_DESCRIPTOR_FROM_NODE_CONNECTION, ptrRequest, nBytes, ptrRequest, + if(DeviceIoControl(h, IOCTL_USB_GET_DESCRIPTOR_FROM_NODE_CONNECTION, ptrRequest, nBytes, + ptrRequest, nBytes, out nBytesReturned, IntPtr.Zero)) { // the location of the string descriptor is immediately after the Request structure @@ -584,6 +597,7 @@ namespace DiscImageChef.Devices.Windows (UsbStringDescriptor)Marshal.PtrToStructure(ptrStringDesc, typeof(UsbStringDescriptor)); device.DeviceSerialNumber = stringDesc.bString; } + Marshal.FreeHGlobal(ptrRequest); } @@ -591,7 +605,7 @@ namespace DiscImageChef.Devices.Windows UsbDescriptorRequest dcrRequest = new UsbDescriptorRequest { ConnectionIndex = PortPortNumber, - SetupPacket = {wIndex = 0, wValue = USB_CONFIGURATION_DESCRIPTOR_TYPE << 8} + SetupPacket = {wIndex = 0, wValue = USB_CONFIGURATION_DESCRIPTOR_TYPE << 8} }; dcrRequest.SetupPacket.wLength = (short)(nBytes - Marshal.SizeOf(dcrRequest)); // Geez, I wish C# had a Marshal.MemSet() method @@ -599,13 +613,16 @@ namespace DiscImageChef.Devices.Windows 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)) + if(DeviceIoControl(h, IOCTL_USB_GET_DESCRIPTOR_FROM_NODE_CONNECTION, dcrPtrRequest, + nBytes, + dcrPtrRequest, nBytes, out nBytesReturned, + IntPtr.Zero)) { IntPtr ptrStringDesc = IntPtr.Add(dcrPtrRequest, Marshal.SizeOf(dcrRequest)); device.BinaryDeviceDescriptors = new byte[nBytesReturned]; Marshal.Copy(ptrStringDesc, device.BinaryDeviceDescriptors, 0, nBytesReturned); } + Marshal.FreeHGlobal(dcrPtrRequest); // Get the Driver Key Name (usefull in locating a device) @@ -616,7 +633,8 @@ namespace DiscImageChef.Devices.Windows Marshal.StructureToPtr(driverKey, ptrDriverKey, true); // Use an IOCTL call to request the Driver Key Name - if(DeviceIoControl(h, IOCTL_USB_GET_NODE_CONNECTION_DRIVERKEY_NAME, ptrDriverKey, nBytes, ptrDriverKey, + if(DeviceIoControl(h, IOCTL_USB_GET_NODE_CONNECTION_DRIVERKEY_NAME, ptrDriverKey, nBytes, + ptrDriverKey, nBytes, out nBytesReturned, IntPtr.Zero)) { driverKey = (UsbNodeConnectionDriverkeyName)Marshal.PtrToStructure(ptrDriverKey, @@ -626,9 +644,10 @@ namespace DiscImageChef.Devices.Windows device.DeviceDriverKey = driverKey.DriverKeyName; // use the DriverKeyName to get the Device Description and Instance ID - device.DeviceName = GetDescriptionByKeyName(device.DeviceDriverKey); + device.DeviceName = GetDescriptionByKeyName(device.DeviceDriverKey); device.DeviceInstanceId = GetInstanceIdByKeyName(device.DeviceDriverKey); } + Marshal.FreeHGlobal(ptrDriverKey); CloseHandle(h); return device; @@ -644,21 +663,22 @@ namespace DiscImageChef.Devices.Windows UsbHub hub = new UsbHub(); IntPtr h, h2; - hub.HubIsRootHub = false; + hub.HubIsRootHub = false; hub.HubDeviceDesc = "External Hub"; // Open a handle to the Host Controller h = CreateFile(PortHubDevicePath, GENERIC_WRITE, FILE_SHARE_WRITE, IntPtr.Zero, OPEN_EXISTING, 0, IntPtr.Zero); if(h == INVALID_HANDLE_VALUE) return hub; + // Get the DevicePath for downstream hub - UsbNodeConnectionName nodeName = new UsbNodeConnectionName {ConnectionIndex = PortPortNumber}; - int nBytes = Marshal.SizeOf(nodeName); - IntPtr ptrNodeName = Marshal.AllocHGlobal(nBytes); + UsbNodeConnectionName nodeName = new UsbNodeConnectionName {ConnectionIndex = PortPortNumber}; + int nBytes = Marshal.SizeOf(nodeName); + IntPtr ptrNodeName = Marshal.AllocHGlobal(nBytes); Marshal.StructureToPtr(nodeName, ptrNodeName, true); // Use an IOCTL call to request the Node Name - if(DeviceIoControl(h, IOCTL_USB_GET_NODE_CONNECTION_NAME, ptrNodeName, nBytes, ptrNodeName, nBytes, + if(DeviceIoControl(h, IOCTL_USB_GET_NODE_CONNECTION_NAME, ptrNodeName, nBytes, ptrNodeName, nBytes, out _, IntPtr.Zero)) { nodeName = (UsbNodeConnectionName)Marshal.PtrToStructure(ptrNodeName, @@ -677,13 +697,15 @@ namespace DiscImageChef.Devices.Windows Marshal.StructureToPtr(nodeInfo, ptrNodeInfo, true); // get the Hub Information - if(DeviceIoControl(h2, IOCTL_USB_GET_NODE_INFORMATION, ptrNodeInfo, nBytes, ptrNodeInfo, nBytes, + if(DeviceIoControl(h2, IOCTL_USB_GET_NODE_INFORMATION, ptrNodeInfo, nBytes, ptrNodeInfo, nBytes, out _, IntPtr.Zero)) { - nodeInfo = (UsbNodeInformation)Marshal.PtrToStructure(ptrNodeInfo, typeof(UsbNodeInformation)); + nodeInfo = + (UsbNodeInformation)Marshal.PtrToStructure(ptrNodeInfo, typeof(UsbNodeInformation)); hub.HubIsBusPowered = Convert.ToBoolean(nodeInfo.HubInformation.HubIsBusPowered); - hub.HubPortCount = nodeInfo.HubInformation.HubDescriptor.bNumberOfPorts; + hub.HubPortCount = nodeInfo.HubInformation.HubDescriptor.bNumberOfPorts; } + Marshal.FreeHGlobal(ptrNodeInfo); CloseHandle(h2); } @@ -691,11 +713,11 @@ namespace DiscImageChef.Devices.Windows // Fill in the missing Manufacture, Product, and SerialNumber values // values by just creating a Device instance and copying the values UsbDevice device = GetDevice(); - hub.HubInstanceId = device.DeviceInstanceId; + hub.HubInstanceId = device.DeviceInstanceId; hub.HubManufacturer = device.Manufacturer; - hub.HubProduct = device.Product; + hub.HubProduct = device.Product; hub.HubSerialNumber = device.SerialNumber; - hub.HubDriverKey = device.DriverKey; + hub.HubDriverKey = device.DriverKey; Marshal.FreeHGlobal(ptrNodeName); CloseHandle(h); @@ -708,23 +730,23 @@ namespace DiscImageChef.Devices.Windows /// internal class UsbDevice { - internal byte[] BinaryDeviceDescriptors; + internal byte[] BinaryDeviceDescriptors; internal UsbDeviceDescriptor DeviceDescriptor; - internal string DeviceDriverKey, DeviceHubDevicePath, DeviceInstanceId, DeviceName; - internal string DeviceManufacturer, DeviceProduct, DeviceSerialNumber; - internal int DevicePortNumber; + internal string DeviceDriverKey, DeviceHubDevicePath, DeviceInstanceId, DeviceName; + internal string DeviceManufacturer, DeviceProduct, DeviceSerialNumber; + internal int DevicePortNumber; /// a simple default constructor internal UsbDevice() { - DevicePortNumber = 0; - DeviceHubDevicePath = ""; - DeviceDriverKey = ""; - DeviceManufacturer = ""; - DeviceProduct = "Unknown USB Device"; - DeviceSerialNumber = ""; - DeviceName = ""; - DeviceInstanceId = ""; + DevicePortNumber = 0; + DeviceHubDevicePath = ""; + DeviceDriverKey = ""; + DeviceManufacturer = ""; + DeviceProduct = "Unknown USB Device"; + DeviceSerialNumber = ""; + DeviceName = ""; + DeviceInstanceId = ""; BinaryDeviceDescriptors = null; } @@ -755,35 +777,35 @@ namespace DiscImageChef.Devices.Windows #region "API Region" // ********************** Constants ************************ - const int GENERIC_WRITE = 0x40000000; - const int FILE_SHARE_READ = 0x1; - const int FILE_SHARE_WRITE = 0x2; - const int OPEN_EXISTING = 0x3; + const int GENERIC_WRITE = 0x40000000; + const int FILE_SHARE_READ = 0x1; + const int FILE_SHARE_WRITE = 0x2; + const int OPEN_EXISTING = 0x3; static readonly IntPtr INVALID_HANDLE_VALUE = new IntPtr(-1); - const int IOCTL_GET_HCD_DRIVERKEY_NAME = 0x220424; - const int IOCTL_USB_GET_ROOT_HUB_NAME = 0x220408; - const int IOCTL_USB_GET_NODE_INFORMATION = 0x220408; // same as above... strange, eh? - const int IOCTL_USB_GET_NODE_CONNECTION_INFORMATION_EX = 0x220448; + const int IOCTL_GET_HCD_DRIVERKEY_NAME = 0x220424; + const int IOCTL_USB_GET_ROOT_HUB_NAME = 0x220408; + const int IOCTL_USB_GET_NODE_INFORMATION = 0x220408; // same as above... strange, eh? + const int IOCTL_USB_GET_NODE_CONNECTION_INFORMATION_EX = 0x220448; const int IOCTL_USB_GET_DESCRIPTOR_FROM_NODE_CONNECTION = 0x220410; - const int IOCTL_USB_GET_NODE_CONNECTION_NAME = 0x220414; - const int IOCTL_USB_GET_NODE_CONNECTION_DRIVERKEY_NAME = 0x220420; + const int IOCTL_USB_GET_NODE_CONNECTION_NAME = 0x220414; + const int IOCTL_USB_GET_NODE_CONNECTION_DRIVERKEY_NAME = 0x220420; - const int USB_DEVICE_DESCRIPTOR_TYPE = 0x1; + const int USB_DEVICE_DESCRIPTOR_TYPE = 0x1; const int USB_CONFIGURATION_DESCRIPTOR_TYPE = 0x2; - const int USB_STRING_DESCRIPTOR_TYPE = 0x3; + const int USB_STRING_DESCRIPTOR_TYPE = 0x3; - const int BUFFER_SIZE = 2048; + const int BUFFER_SIZE = 2048; const int MAXIMUM_USB_STRING_LENGTH = 255; const string GUID_DEVINTERFACE_HUBCONTROLLER = "3abf6f2d-71c4-462a-8a92-1e6861e6af27"; - const string REGSTR_KEY_USB = "USB"; - const int DIGCF_PRESENT = 0x2; - const int DIGCF_ALLCLASSES = 0x4; - const int DIGCF_DEVICEINTERFACE = 0x10; - const int SPDRP_DRIVER = 0x9; - const int SPDRP_DEVICEDESC = 0x0; - const int REG_SZ = 1; + const string REGSTR_KEY_USB = "USB"; + const int DIGCF_PRESENT = 0x2; + const int DIGCF_ALLCLASSES = 0x4; + const int DIGCF_DEVICEINTERFACE = 0x10; + const int SPDRP_DRIVER = 0x9; + const int SPDRP_DEVICEDESC = 0x0; + const int REG_SZ = 1; // ********************** Enumerations ************************ @@ -818,8 +840,8 @@ namespace DiscImageChef.Devices.Windows [StructLayout(LayoutKind.Sequential)] struct SpDevinfoData { - internal int cbSize; - internal Guid ClassGuid; + internal int cbSize; + internal Guid ClassGuid; internal IntPtr DevInst; internal IntPtr Reserved; } @@ -827,9 +849,9 @@ namespace DiscImageChef.Devices.Windows [StructLayout(LayoutKind.Sequential)] struct SpDeviceInterfaceData { - internal int cbSize; - internal Guid InterfaceClassGuid; - internal int Flags; + internal int cbSize; + internal Guid InterfaceClassGuid; + internal int Flags; internal IntPtr Reserved; } @@ -837,59 +859,63 @@ namespace DiscImageChef.Devices.Windows struct SpDeviceInterfaceDetailData { internal int cbSize; - [MarshalAs(UnmanagedType.ByValTStr, SizeConst = BUFFER_SIZE)] internal string DevicePath; + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = BUFFER_SIZE)] + internal string DevicePath; } [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)] struct UsbHcdDriverkeyName { internal int ActualLength; - [MarshalAs(UnmanagedType.ByValTStr, SizeConst = BUFFER_SIZE)] internal string DriverKeyName; + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = BUFFER_SIZE)] + internal string DriverKeyName; } [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)] struct UsbRootHubName { internal int ActualLength; - [MarshalAs(UnmanagedType.ByValTStr, SizeConst = BUFFER_SIZE)] internal string RootHubName; + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = BUFFER_SIZE)] + internal string RootHubName; } [StructLayout(LayoutKind.Sequential, Pack = 1)] struct UsbHubDescriptor { - internal byte bDescriptorLength; - internal byte bDescriptorType; - internal byte bNumberOfPorts; + internal byte bDescriptorLength; + internal byte bDescriptorType; + internal byte bNumberOfPorts; internal short wHubCharacteristics; - internal byte bPowerOnToPowerGood; - internal byte bHubControlCurrent; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 64)] internal byte[] bRemoveAndPowerMask; + internal byte bPowerOnToPowerGood; + internal byte bHubControlCurrent; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 64)] + internal byte[] bRemoveAndPowerMask; } [StructLayout(LayoutKind.Sequential)] struct UsbHubInformation { internal UsbHubDescriptor HubDescriptor; - internal byte HubIsBusPowered; + internal byte HubIsBusPowered; } [StructLayout(LayoutKind.Sequential)] struct UsbNodeInformation { - internal int NodeType; + internal int NodeType; internal UsbHubInformation HubInformation; // Yeah, I'm assuming we'll just use the first form } [StructLayout(LayoutKind.Sequential, Pack = 1)] struct UsbNodeConnectionInformationEx { - internal int ConnectionIndex; + internal int ConnectionIndex; internal UsbDeviceDescriptor DeviceDescriptor; - internal byte CurrentConfigurationValue; - internal byte Speed; - internal byte DeviceIsHub; - internal short DeviceAddress; - internal int NumberOfOpenPipes; + internal byte CurrentConfigurationValue; + internal byte Speed; + internal byte DeviceIsHub; + internal short DeviceAddress; + internal int NumberOfOpenPipes; internal int ConnectionStatus; //internal IntPtr PipeList; @@ -899,20 +925,20 @@ namespace DiscImageChef.Devices.Windows [SuppressMessage("ReSharper", "MemberCanBePrivate.Global")] internal struct UsbDeviceDescriptor { - internal byte bLength; - internal byte bDescriptorType; + internal byte bLength; + internal byte bDescriptorType; internal short bcdUSB; - internal byte bDeviceClass; - internal byte bDeviceSubClass; - internal byte bDeviceProtocol; - internal byte bMaxPacketSize0; + internal byte bDeviceClass; + internal byte bDeviceSubClass; + internal byte bDeviceProtocol; + internal byte bMaxPacketSize0; internal short idVendor; internal short idProduct; internal short bcdDevice; - internal byte iManufacturer; - internal byte iProduct; - internal byte iSerialNumber; - internal byte bNumConfigurations; + internal byte iManufacturer; + internal byte iProduct; + internal byte iSerialNumber; + internal byte bNumConfigurations; } [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)] @@ -920,14 +946,15 @@ namespace DiscImageChef.Devices.Windows { internal byte bLength; internal byte bDescriptorType; - [MarshalAs(UnmanagedType.ByValTStr, SizeConst = MAXIMUM_USB_STRING_LENGTH)] internal string bString; + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = MAXIMUM_USB_STRING_LENGTH)] + internal string bString; } [StructLayout(LayoutKind.Sequential)] struct UsbSetupPacket { - internal byte bmRequest; - internal byte bRequest; + internal byte bmRequest; + internal byte bRequest; internal short wValue; internal short wIndex; internal short wLength; @@ -947,7 +974,8 @@ namespace DiscImageChef.Devices.Windows { internal int ConnectionIndex; internal int ActualLength; - [MarshalAs(UnmanagedType.ByValTStr, SizeConst = BUFFER_SIZE)] internal string NodeName; + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = BUFFER_SIZE)] + internal string NodeName; } [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)] @@ -955,7 +983,8 @@ namespace DiscImageChef.Devices.Windows { internal int ConnectionIndex; internal int ActualLength; - [MarshalAs(UnmanagedType.ByValTStr, SizeConst = BUFFER_SIZE)] internal string DriverKeyName; + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = BUFFER_SIZE)] + internal string DriverKeyName; } // ********************** API Definitions ************************ @@ -968,44 +997,50 @@ namespace DiscImageChef.Devices.Windows static extern IntPtr SetupDiGetClassDevs(int classGuid, string enumerator, IntPtr hwndParent, int flags); [DllImport("setupapi.dll", SetLastError = true, CharSet = CharSet.Auto)] - static extern bool SetupDiEnumDeviceInterfaces(IntPtr deviceInfoSet, IntPtr deviceInfoData, - ref Guid interfaceClassGuid, int memberIndex, + static extern bool SetupDiEnumDeviceInterfaces(IntPtr deviceInfoSet, + IntPtr deviceInfoData, + ref Guid interfaceClassGuid, int memberIndex, ref SpDeviceInterfaceData deviceInterfaceData); [DllImport("setupapi.dll", SetLastError = true, CharSet = CharSet.Auto)] - static extern bool SetupDiGetDeviceInterfaceDetail(IntPtr deviceInfoSet, - ref SpDeviceInterfaceData deviceInterfaceData, + static extern bool SetupDiGetDeviceInterfaceDetail(IntPtr deviceInfoSet, + ref SpDeviceInterfaceData deviceInterfaceData, ref SpDeviceInterfaceDetailData deviceInterfaceDetailData, - int deviceInterfaceDetailDataSize, ref int requiredSize, + int + deviceInterfaceDetailDataSize, ref int requiredSize, ref SpDevinfoData deviceInfoData); [DllImport("setupapi.dll", SetLastError = true, CharSet = CharSet.Auto)] - static extern bool SetupDiGetDeviceRegistryProperty(IntPtr deviceInfoSet, ref SpDevinfoData deviceInfoData, - int iProperty, ref int propertyRegDataType, - IntPtr propertyBuffer, int propertyBufferSize, + static extern bool SetupDiGetDeviceRegistryProperty(IntPtr deviceInfoSet, ref SpDevinfoData deviceInfoData, + int iProperty, + ref int propertyRegDataType, + IntPtr propertyBuffer, + int propertyBufferSize, ref int requiredSize); [DllImport("setupapi.dll", SetLastError = true, CharSet = CharSet.Auto)] - static extern bool SetupDiEnumDeviceInfo(IntPtr deviceInfoSet, int memberIndex, + static extern bool SetupDiEnumDeviceInfo(IntPtr deviceInfoSet, int memberIndex, ref SpDevinfoData deviceInfoData); [DllImport("setupapi.dll", SetLastError = true)] static extern bool SetupDiDestroyDeviceInfoList(IntPtr deviceInfoSet); [DllImport("setupapi.dll", SetLastError = true, CharSet = CharSet.Auto)] - static extern bool SetupDiGetDeviceInstanceId(IntPtr deviceInfoSet, ref SpDevinfoData deviceInfoData, - StringBuilder deviceInstanceId, int deviceInstanceIdSize, - out int requiredSize); + static extern bool SetupDiGetDeviceInstanceId(IntPtr deviceInfoSet, ref SpDevinfoData deviceInfoData, + StringBuilder deviceInstanceId, + int deviceInstanceIdSize, + out int requiredSize); [DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Auto)] - static extern bool DeviceIoControl(IntPtr hDevice, int dwIoControlCode, IntPtr lpInBuffer, int nInBufferSize, + static extern bool DeviceIoControl(IntPtr hDevice, int dwIoControlCode, IntPtr lpInBuffer, + int nInBufferSize, IntPtr lpOutBuffer, int nOutBufferSize, out int lpBytesReturned, IntPtr lpOverlapped); [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); [DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Auto)] static extern bool CloseHandle(IntPtr hObject); diff --git a/DiscImageChef.Devices/Windows/UsbFunctions.cs b/DiscImageChef.Devices/Windows/UsbFunctions.cs index a64472bf6..60a691772 100644 --- a/DiscImageChef.Devices/Windows/UsbFunctions.cs +++ b/DiscImageChef.Devices/Windows/UsbFunctions.cs @@ -47,10 +47,10 @@ namespace DiscImageChef.Devices.Windows /// static partial class Usb { - const int IOCTL_STORAGE_GET_DEVICE_NUMBER = 0x2D1080; - internal const string GuidDevinterfaceDisk = "53f56307-b6bf-11d0-94f2-00a0c91efb8b"; - internal const string GuidDevinterfaceCdrom = "53f56308-b6bf-11d0-94f2-00a0c91efb8b"; - internal const string GuidDevinterfaceFloppy = "53f56311-b6bf-11d0-94f2-00a0c91efb8b"; + const int IOCTL_STORAGE_GET_DEVICE_NUMBER = 0x2D1080; + internal const string GuidDevinterfaceDisk = "53f56307-b6bf-11d0-94f2-00a0c91efb8b"; + internal const string GuidDevinterfaceCdrom = "53f56308-b6bf-11d0-94f2-00a0c91efb8b"; + internal const string GuidDevinterfaceFloppy = "53f56311-b6bf-11d0-94f2-00a0c91efb8b"; /// /// Get a list of all connected devices @@ -73,8 +73,12 @@ namespace DiscImageChef.Devices.Windows static void ListHub(UsbHub hub, ICollection devList) { foreach(UsbPort port in hub.GetPorts()) - if(port.IsHub) ListHub(port.GetHub(), devList); - else { if(port.IsDeviceConnected) devList.Add(port.GetDevice()); } + if(port.IsHub) + ListHub(port.GetHub(), devList); + else + { + if(port.IsDeviceConnected) devList.Add(port.GetDevice()); + } } /// @@ -104,7 +108,8 @@ namespace DiscImageChef.Devices.Windows static void SearchHubDriverKeyName(UsbHub hub, ref UsbDevice foundDevice, string driverKeyName) { foreach(UsbPort port in hub.GetPorts()) - if(port.IsHub) SearchHubDriverKeyName(port.GetHub(), ref foundDevice, driverKeyName); + if(port.IsHub) + SearchHubDriverKeyName(port.GetHub(), ref foundDevice, driverKeyName); else { if(!port.IsDeviceConnected) continue; @@ -144,7 +149,8 @@ namespace DiscImageChef.Devices.Windows static void SearchHubInstanceId(UsbHub hub, ref UsbDevice foundDevice, string instanceId) { foreach(UsbPort port in hub.GetPorts()) - if(port.IsHub) SearchHubInstanceId(port.GetHub(), ref foundDevice, instanceId); + if(port.IsHub) + SearchHubInstanceId(port.GetHub(), ref foundDevice, instanceId); else { if(!port.IsDeviceConnected) continue; @@ -202,7 +208,7 @@ namespace DiscImageChef.Devices.Windows static UsbDevice FindDeviceNumber(int devNum, string deviceGuid) { UsbDevice foundDevice = null; - string instanceId = ""; + string instanceId = ""; Guid diskGuid = new Guid(deviceGuid); @@ -212,7 +218,7 @@ namespace DiscImageChef.Devices.Windows if(h != INVALID_HANDLE_VALUE) { bool success; - int i = 0; + int i = 0; do { // create a Device Interface Data structure @@ -232,8 +238,8 @@ namespace DiscImageChef.Devices.Windows new SpDeviceInterfaceDetailData {cbSize = 4 + Marshal.SystemDefaultCharSize}; // trust me :) // now we can get some more detailed information - int nRequiredSize = 0; - const int N_BYTES = BUFFER_SIZE; + int nRequiredSize = 0; + const int N_BYTES = BUFFER_SIZE; if(SetupDiGetDeviceInterfaceDetail(h, ref dia, ref didd, N_BYTES, ref nRequiredSize, ref da)) if(GetDeviceNumber(didd.DevicePath) == devNum) { @@ -251,6 +257,7 @@ namespace DiscImageChef.Devices.Windows //break; } } + i++; } while(success); @@ -276,9 +283,9 @@ namespace DiscImageChef.Devices.Windows IntPtr h = CreateFile(devicePath.TrimEnd('\\'), 0, 0, IntPtr.Zero, OPEN_EXISTING, 0, IntPtr.Zero); if(h == INVALID_HANDLE_VALUE) return ans; - StorageDeviceNumber sdn = new StorageDeviceNumber(); - int nBytes = Marshal.SizeOf(sdn); - IntPtr ptrSdn = Marshal.AllocHGlobal(nBytes); + StorageDeviceNumber sdn = new StorageDeviceNumber(); + int nBytes = Marshal.SizeOf(sdn); + IntPtr ptrSdn = Marshal.AllocHGlobal(nBytes); if(DeviceIoControl(h, IOCTL_STORAGE_GET_DEVICE_NUMBER, IntPtr.Zero, 0, ptrSdn, nBytes, out _, IntPtr.Zero)) { @@ -287,6 +294,7 @@ namespace DiscImageChef.Devices.Windows // STORAGE_DEVICE_NUMBER into a single number ans = (sdn.DeviceType << 8) + sdn.DeviceNumber; } + Marshal.FreeHGlobal(ptrSdn); CloseHandle(h); return ans; diff --git a/DiscImageChef.DiscImages/Alcohol120.cs b/DiscImageChef.DiscImages/Alcohol120.cs index 02a5a6526..d87cf03a7 100644 --- a/DiscImageChef.DiscImages/Alcohol120.cs +++ b/DiscImageChef.DiscImages/Alcohol120.cs @@ -124,7 +124,7 @@ namespace DiscImageChef.DiscImages { Indexes = new Dictionary {{1, alcTrack.startLba}}, TrackStartSector = alcTrack.startLba, - TrackEndSector = (alcTrack.startLba + alcExtra.sectors) - 1, + TrackEndSector = alcTrack.startLba + alcExtra.sectors - 1, TrackPregap = alcExtra.pregap, TrackSession = sessionNo, TrackSequence = alcTrack.point, @@ -181,7 +181,7 @@ namespace DiscImageChef.DiscImages stream.Seek(0, SeekOrigin.Begin); if(stream.Length < 88) return false; - isDvd = false; + isDvd = false; byte[] hdr = new byte[88]; stream.Read(hdr, 0, 88); IntPtr hdrPtr = Marshal.AllocHGlobal(88); @@ -352,7 +352,7 @@ namespace DiscImageChef.DiscImages byte[] footer = new byte[16]; stream.Seek(footerOff, SeekOrigin.Begin); stream.Read(footer, 0, 16); - alcFooter = new AlcoholFooter(); + alcFooter = new AlcoholFooter(); IntPtr footPtr = Marshal.AllocHGlobal(16); Marshal.Copy(footer, 0, footPtr, 16); alcFooter = (AlcoholFooter)Marshal.PtrToStructure(footPtr, typeof(AlcoholFooter)); @@ -494,9 +494,8 @@ namespace DiscImageChef.DiscImages break; } - if(DMI.IsXbox(dmi)) imageInfo.MediaType = MediaType.XGD; - else if(DMI.IsXbox360(dmi)) - imageInfo.MediaType = MediaType.XGD2; + if(DMI.IsXbox(dmi)) imageInfo.MediaType = MediaType.XGD; + else if(DMI.IsXbox360(dmi)) imageInfo.MediaType = MediaType.XGD2; imageInfo.ReadableMediaTags.Add(MediaTagType.DVD_PFI); imageInfo.ReadableMediaTags.Add(MediaTagType.DVD_DMI); @@ -535,21 +534,17 @@ namespace DiscImageChef.DiscImages } } - 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); - Partitions = new List(); - offsetmap = new Dictionary(); + Partitions = new List(); + offsetmap = new Dictionary(); ulong byteOffset = 0; foreach(AlcoholTrack trk in alcTracks.Values) @@ -646,7 +641,7 @@ namespace DiscImageChef.DiscImages DicConsole.DebugWriteLine("Alcohol 120% plugin", "Data filename: {0}", alcFile); FiltersList filtersList = new FiltersList(); - alcImage = filtersList.GetFilter(alcFile); + alcImage = filtersList.GetFilter(alcFile); if(alcImage == null) throw new Exception("Cannot open data file"); @@ -686,11 +681,11 @@ namespace DiscImageChef.DiscImages fullToc = tocMs.ToArray(); BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian; - byte[] fullTocSize = BigEndianBitConverter.GetBytes((short)(fullToc.Length - 2)); - fullToc[0] = fullTocSize[0]; - fullToc[1] = fullTocSize[1]; - fullToc[2] = firstSession; - fullToc[3] = lastSession; + byte[] fullTocSize = BigEndianBitConverter.GetBytes((short)(fullToc.Length - 2)); + fullToc[0] = fullTocSize[0]; + fullToc[1] = fullTocSize[1]; + fullToc[2] = firstSession; + fullToc[3] = lastSession; FullTOC.CDFullTOC? decodedFullToc = FullTOC.Decode(fullToc); @@ -704,7 +699,7 @@ namespace DiscImageChef.DiscImages imageInfo.ReadableSectorTags.Add(SectorTagType.CdTrackFlags); } - if(imageInfo.MediaType == MediaType.XGD2) + if(imageInfo.MediaType == MediaType.XGD2) if(imageInfo.Sectors == 25063 || // Locked (or non compatible drive) imageInfo.Sectors == 4229664 || // Xtreme unlock imageInfo.Sectors == 4246304) // Wxripper unlock @@ -777,7 +772,7 @@ namespace DiscImageChef.DiscImages if(track.point != kvp.Key || !alcTrackExtras.TryGetValue(track.point, out AlcoholTrackExtra extra)) continue; - if(sectorAddress - kvp.Value < extra.sectors) + if(sectorAddress - kvp.Value < extra.sectors) return ReadSectors(sectorAddress - kvp.Value, length, kvp.Key); } @@ -793,7 +788,7 @@ namespace DiscImageChef.DiscImages if(track.point != kvp.Key || !alcTrackExtras.TryGetValue(track.point, out AlcoholTrackExtra extra)) continue; - if(sectorAddress - kvp.Value < extra.sectors) + if(sectorAddress - kvp.Value < extra.sectors) return ReadSectorsTag(sectorAddress - kvp.Value, length, kvp.Key, tag); } @@ -875,7 +870,7 @@ namespace DiscImageChef.DiscImages byte[] buffer = new byte[sectorSize * length]; - imageStream = alcImage.GetDataForkStream(); + imageStream = alcImage.GetDataForkStream(); BinaryReader br = new BinaryReader(imageStream); br.BaseStream .Seek((long)alcTrack.startOffset + (long)(sectorAddress * (sectorOffset + sectorSize + sectorSkip)), @@ -1198,7 +1193,7 @@ namespace DiscImageChef.DiscImages byte[] buffer = new byte[sectorSize * length]; - imageStream = alcImage.GetDataForkStream(); + imageStream = alcImage.GetDataForkStream(); BinaryReader br = new BinaryReader(imageStream); br.BaseStream .Seek((long)alcTrack.startOffset + (long)(sectorAddress * (sectorOffset + sectorSize + sectorSkip)), @@ -1235,7 +1230,7 @@ namespace DiscImageChef.DiscImages if(alcTrack.point != kvp.Key || !alcTrackExtras.TryGetValue(alcTrack.point, out AlcoholTrackExtra alcExtra)) continue; - if(sectorAddress - kvp.Value < alcExtra.sectors) + if(sectorAddress - kvp.Value < alcExtra.sectors) return ReadSectorsLong(sectorAddress - kvp.Value, length, kvp.Key); } @@ -1278,7 +1273,7 @@ namespace DiscImageChef.DiscImages byte[] buffer = new byte[sectorSize * length]; - imageStream = alcImage.GetDataForkStream(); + imageStream = alcImage.GetDataForkStream(); BinaryReader br = new BinaryReader(imageStream); br.BaseStream @@ -1368,14 +1363,14 @@ namespace DiscImageChef.DiscImages return CdChecksums.CheckCdSector(buffer); } - public bool? VerifySectors(ulong sectorAddress, uint length, out List failingLbas, - out List unknownLbas) + public bool? VerifySectors(ulong sectorAddress, uint length, out List failingLbas, + out List unknownLbas) { byte[] buffer = ReadSectorsLong(sectorAddress, length); int bps = (int)(buffer.Length / length); byte[] sector = new byte[bps]; - failingLbas = new List(); - unknownLbas = new List(); + failingLbas = new List(); + unknownLbas = new List(); for(int i = 0; i < length; i++) { @@ -1398,14 +1393,14 @@ namespace DiscImageChef.DiscImages return failingLbas.Count <= 0; } - public bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List failingLbas, - out List unknownLbas) + public 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); byte[] sector = new byte[bps]; - failingLbas = new List(); - unknownLbas = new List(); + failingLbas = new List(); + unknownLbas = new List(); for(int i = 0; i < length; i++) { @@ -1463,7 +1458,7 @@ namespace DiscImageChef.DiscImages MediaType.NeoGeoCD, MediaType.PCFX }; public IEnumerable<(string name, Type type, string description)> SupportedOptions => - new(string name, Type type, string description)[] { }; + new (string name, Type type, string description)[] { }; public IEnumerable KnownExtensions => new[] {".mds"}; public bool IsWriting { get; private set; } public string ErrorMessage { get; private set; } @@ -1482,7 +1477,7 @@ namespace DiscImageChef.DiscImages try { descriptorStream = new FileStream(path, FileMode.Create, FileAccess.ReadWrite, FileShare.None); - imageStream = + imageStream = new FileStream(Path.Combine(Path.GetDirectoryName(path), Path.GetFileNameWithoutExtension(path)) + ".mdf", FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.None); @@ -1830,11 +1825,11 @@ namespace DiscImageChef.DiscImages // Alcohol sets this always, Daemon Tool expects this header.unknown1[0] = 2; - alcSessions = new Dictionary(); - alcTracks = new Dictionary(); - alcToc = new Dictionary>(); - writingTracks = writingTracks.OrderBy(t => t.TrackSession).ThenBy(t => t.TrackSequence).ToList(); - alcTrackExtras = new Dictionary(); + alcSessions = new Dictionary(); + alcTracks = new Dictionary(); + alcToc = new Dictionary>(); + writingTracks = writingTracks.OrderBy(t => t.TrackSession).ThenBy(t => t.TrackSequence).ToList(); + alcTrackExtras = new Dictionary(); long currentTrackOffset = header.sessionOffset + Marshal.SizeOf(typeof(AlcoholSession)) * sessions; long currentExtraOffset = currentTrackOffset; @@ -1843,8 +1838,7 @@ namespace DiscImageChef.DiscImages currentExtraOffset += Marshal.SizeOf(typeof(AlcoholTrack)) * 3; currentExtraOffset += Marshal.SizeOf(typeof(AlcoholTrack)) * writingTracks.Count(t => t.TrackSession == i); - if(i < sessions) - currentExtraOffset += Marshal.SizeOf(typeof(AlcoholTrack)) * 2; + if(i < sessions) currentExtraOffset += Marshal.SizeOf(typeof(AlcoholTrack)) * 2; } long footerOffset = currentExtraOffset + Marshal.SizeOf(typeof(AlcoholTrackExtra)) * writingTracks.Count; @@ -1869,15 +1863,15 @@ namespace DiscImageChef.DiscImages trackOffset = 4220 }); - footerOffset = 4300; + footerOffset = 4300; if(bca != null) footerOffset += bca.Length; alcTracks.Add(1, new AlcoholTrack { - mode = AlcoholTrackMode.DVD, - adrCtl = 20, - point = 1, + mode = AlcoholTrackMode.DVD, + adrCtl = 20, + point = 1, extraOffset = (uint)(writingTracks[0].TrackEndSector - writingTracks[0].TrackStartSector + 1), sectorSize = 2048, @@ -1914,7 +1908,7 @@ namespace DiscImageChef.DiscImages if(firstTrackControl == 0 && firstTrack.TrackType != TrackType.Audio) firstTrackControl = (byte)CdFlags.DataTrack; if(lastTrackControl == 0 && lastTrack.TrackType != TrackType.Audio) - lastTrackControl = (byte)CdFlags.DataTrack; + lastTrackControl = (byte)CdFlags.DataTrack; (byte hour, byte minute, byte second, byte frame) leadinPmsf = LbaToMsf(lastTrack.TrackEndSector + 1); @@ -1965,17 +1959,17 @@ namespace DiscImageChef.DiscImages thisSessionTracks.Add((int)track.TrackSequence, new AlcoholTrack { - mode = TrackTypeToAlcohol(track.TrackType), + mode = TrackTypeToAlcohol(track.TrackType), subMode = track.TrackSubchannelType != TrackSubchannelType.None ? AlcoholSubchannelMode.Interleaved : AlcoholSubchannelMode.None, - adrCtl = (byte)((1 << 4) + trackControl), - point = (byte)track.TrackSequence, - zero = msf.hour, - pmin = msf.minute, - psec = msf.second, - pframe = msf.frame, + adrCtl = (byte)((1 << 4) + trackControl), + point = (byte)track.TrackSequence, + zero = msf.hour, + pmin = msf.minute, + psec = msf.second, + pframe = msf.frame, sectorSize = (ushort)(track.TrackRawBytesPerSector + (track.TrackSubchannelType != TrackSubchannelType.None ? 96 : 0)), @@ -2018,9 +2012,9 @@ namespace DiscImageChef.DiscImages { point = 0xB0, adrCtl = 0x50, - zero = + zero = (byte)(((leadoutAmsf.hour & 0xF) << 4) + - (leadoutPmsf.hour & 0xF)), + (leadoutPmsf.hour & 0xF)), min = leadoutAmsf.minute, sec = leadoutAmsf.second, frame = leadoutAmsf.frame, @@ -2062,7 +2056,7 @@ namespace DiscImageChef.DiscImages // Write header descriptorStream.Seek(0, SeekOrigin.Begin); byte[] block = new byte[Marshal.SizeOf(header)]; - blockPtr = Marshal.AllocHGlobal(Marshal.SizeOf(header)); + blockPtr = Marshal.AllocHGlobal(Marshal.SizeOf(header)); Marshal.StructureToPtr(header, blockPtr, true); Marshal.Copy(blockPtr, block, 0, block.Length); Marshal.FreeHGlobal(blockPtr); @@ -2310,8 +2304,8 @@ namespace DiscImageChef.DiscImages case AlcoholTrackMode.Mode2F2: case AlcoholTrackMode.Mode2F1: case AlcoholTrackMode.Mode2F1Alt: return 2352; - case AlcoholTrackMode.DVD: return 2048; - default: return 0; + case AlcoholTrackMode.DVD: return 2048; + default: return 0; } } @@ -2322,11 +2316,11 @@ namespace DiscImageChef.DiscImages 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.Mode2F2: return 2324; + case AlcoholTrackMode.Mode2: return 2336; + case AlcoholTrackMode.Audio: return 2352; + case AlcoholTrackMode.DVD: return 2048; + default: return 0; } } @@ -2337,10 +2331,10 @@ namespace DiscImageChef.DiscImages 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.Mode2F2: return TrackType.CdMode2Form2; + case AlcoholTrackMode.Mode2: return TrackType.CdMode2Formless; + case AlcoholTrackMode.Audio: return TrackType.Audio; + default: return TrackType.Data; } } @@ -2395,7 +2389,7 @@ namespace DiscImageChef.DiscImages case MediaType.DVDRWDL: case MediaType.DVDPRDL: case MediaType.DVDPRWDL: return AlcoholMediumType.DVDR; - default: return AlcoholMediumType.DVD; + default: return AlcoholMediumType.DVD; } } @@ -2415,7 +2409,8 @@ namespace DiscImageChef.DiscImages static (byte hour, byte minute, byte second, byte frame) LbaToMsf(ulong sector) { return ((byte)((sector + 150) / 75 / 60 / 60), (byte)((sector + 150) / 75 / 60 % 60), - (byte)((sector + 150) / 75 % 60), (byte)((sector + 150) % 75)); + (byte)((sector + 150) / 75 % 60), + (byte)((sector + 150) % 75)); } [StructLayout(LayoutKind.Sequential, Pack = 1)] @@ -2424,22 +2419,22 @@ namespace DiscImageChef.DiscImages [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] public byte[] signature; [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)] - public byte[] version; + public byte[] version; public AlcoholMediumType type; public ushort sessions; [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)] public ushort[] unknown1; - public ushort bcaLength; + public ushort bcaLength; [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)] public uint[] unknown2; - public uint bcaOffset; + public uint bcaOffset; [MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)] public uint[] unknown3; - public uint structuresOffset; + public uint structuresOffset; [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] public uint[] unknown4; - public uint sessionOffset; - public uint dpmOffset; + public uint sessionOffset; + public uint dpmOffset; } [StructLayout(LayoutKind.Sequential, Pack = 1)] @@ -2475,10 +2470,10 @@ namespace DiscImageChef.DiscImages public ushort sectorSize; [MarshalAs(UnmanagedType.ByValArray, SizeConst = 18)] public byte[] unknown; - public uint startLba; - public ulong startOffset; - public uint files; - public uint footerOffset; + public uint startLba; + public ulong startOffset; + public uint files; + public uint footerOffset; [MarshalAs(UnmanagedType.ByValArray, SizeConst = 24)] public byte[] unknown2; } diff --git a/DiscImageChef.DiscImages/Anex86.cs b/DiscImageChef.DiscImages/Anex86.cs index 1d2bc2d6e..e8e4facac 100644 --- a/DiscImageChef.DiscImages/Anex86.cs +++ b/DiscImageChef.DiscImages/Anex86.cs @@ -105,7 +105,7 @@ namespace DiscImageChef.DiscImages stream.Read(hdrB, 0, hdrB.Length); GCHandle handle = GCHandle.Alloc(hdrB, GCHandleType.Pinned); - fdihdr = (Anex86Header)Marshal.PtrToStructure(handle.AddrOfPinnedObject(), typeof(Anex86Header)); + fdihdr = (Anex86Header)Marshal.PtrToStructure(handle.AddrOfPinnedObject(), typeof(Anex86Header)); handle.Free(); DicConsole.DebugWriteLine("Anex86 plugin", "fdihdr.unknown = {0}", fdihdr.unknown); @@ -134,12 +134,12 @@ namespace DiscImageChef.DiscImages stream.Read(hdrB, 0, hdrB.Length); GCHandle handle = GCHandle.Alloc(hdrB, GCHandleType.Pinned); - fdihdr = (Anex86Header)Marshal.PtrToStructure(handle.AddrOfPinnedObject(), typeof(Anex86Header)); + fdihdr = (Anex86Header)Marshal.PtrToStructure(handle.AddrOfPinnedObject(), typeof(Anex86Header)); handle.Free(); - imageInfo.MediaType = - Geometry.GetMediaType(((ushort)fdihdr.cylinders, (byte)fdihdr.heads, (ushort)fdihdr.spt, - (uint)fdihdr.bps, MediaEncoding.MFM, false)); + imageInfo.MediaType = Geometry.GetMediaType(((ushort)fdihdr.cylinders, (byte)fdihdr.heads, + (ushort)fdihdr.spt, (uint)fdihdr.bps, MediaEncoding.MFM, + false)); if(imageInfo.MediaType == MediaType.Unknown) imageInfo.MediaType = MediaType.GENERIC_HDD; DicConsole.DebugWriteLine("Anex86 plugin", "MediaType: {0}", imageInfo.MediaType); @@ -259,8 +259,8 @@ namespace DiscImageChef.DiscImages throw new FeatureUnsupportedImageException("Feature not supported by image format"); } - public bool? VerifySectors(ulong sectorAddress, uint length, out List failingLbas, - out List unknownLbas) + public bool? VerifySectors(ulong sectorAddress, uint length, out List failingLbas, + out List unknownLbas) { failingLbas = new List(); unknownLbas = new List(); @@ -269,8 +269,8 @@ namespace DiscImageChef.DiscImages return null; } - public bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List failingLbas, - out List unknownLbas) + public bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List failingLbas, + out List unknownLbas) { throw new FeatureUnsupportedImageException("Feature not supported by image format"); } @@ -304,7 +304,7 @@ namespace DiscImageChef.DiscImages MediaType.PCCardTypeIV }; public IEnumerable<(string name, Type type, string description)> SupportedOptions => - new(string name, Type type, string description)[] { }; + new (string name, Type type, string description)[] { }; public IEnumerable KnownExtensions => new[] {".fdi", ".hdi"}; public bool IsWriting { get; private set; } @@ -437,7 +437,7 @@ namespace DiscImageChef.DiscImages imageInfo.MediaType == MediaType.FlashDrive || imageInfo.MediaType == MediaType.CompactFlash || imageInfo.MediaType == MediaType.CompactFlashType2 || imageInfo.MediaType == MediaType.PCCardTypeI || imageInfo.MediaType == MediaType.PCCardTypeII || imageInfo.MediaType == MediaType.PCCardTypeIII || - imageInfo.MediaType == MediaType.PCCardTypeIV) && fdihdr.cylinders == 0) + imageInfo.MediaType == MediaType.PCCardTypeIV) && fdihdr.cylinders == 0) { fdihdr.cylinders = (int)(imageInfo.Sectors / 8 / 33); fdihdr.heads = 8; diff --git a/DiscImageChef.DiscImages/Apple2MG.cs b/DiscImageChef.DiscImages/Apple2MG.cs index f9115668f..7bc4d6a06 100644 --- a/DiscImageChef.DiscImages/Apple2MG.cs +++ b/DiscImageChef.DiscImages/Apple2MG.cs @@ -193,18 +193,18 @@ namespace DiscImageChef.DiscImages imageHeader.HeaderSize = BitConverter.ToUInt16(header, 0x08); imageHeader.Version = BitConverter.ToUInt16(header, 0x0A); imageHeader.ImageFormat = (SectorOrder)BitConverter.ToUInt32(header, 0x0C); - imageHeader.Flags = BitConverter.ToUInt32(header, 0x10); - imageHeader.Blocks = BitConverter.ToUInt32(header, 0x14); - imageHeader.DataOffset = BitConverter.ToUInt32(header, 0x18); - imageHeader.DataSize = BitConverter.ToUInt32(header, 0x1C); - imageHeader.CommentOffset = BitConverter.ToUInt32(header, 0x20); - imageHeader.CommentSize = BitConverter.ToUInt32(header, 0x24); - imageHeader.CreatorSpecificOffset = BitConverter.ToUInt32(header, 0x28); - imageHeader.CreatorSpecificSize = BitConverter.ToUInt32(header, 0x2C); - imageHeader.Reserved1 = BitConverter.ToUInt32(header, 0x30); - imageHeader.Reserved2 = BitConverter.ToUInt32(header, 0x34); - imageHeader.Reserved3 = BitConverter.ToUInt32(header, 0x38); - imageHeader.Reserved4 = BitConverter.ToUInt32(header, 0x3C); + imageHeader.Flags = BitConverter.ToUInt32(header, 0x10); + imageHeader.Blocks = BitConverter.ToUInt32(header, 0x14); + imageHeader.DataOffset = BitConverter.ToUInt32(header, 0x18); + imageHeader.DataSize = BitConverter.ToUInt32(header, 0x1C); + imageHeader.CommentOffset = BitConverter.ToUInt32(header, 0x20); + imageHeader.CommentSize = BitConverter.ToUInt32(header, 0x24); + imageHeader.CreatorSpecificOffset = BitConverter.ToUInt32(header, 0x28); + imageHeader.CreatorSpecificSize = BitConverter.ToUInt32(header, 0x2C); + imageHeader.Reserved1 = BitConverter.ToUInt32(header, 0x30); + imageHeader.Reserved2 = BitConverter.ToUInt32(header, 0x34); + imageHeader.Reserved3 = BitConverter.ToUInt32(header, 0x38); + imageHeader.Reserved4 = BitConverter.ToUInt32(header, 0x3C); if(imageHeader.DataSize == 0x00800C00) { @@ -262,9 +262,9 @@ namespace DiscImageChef.DiscImages bool isDos = tmp[0x11001] == 17 && tmp[0x11002] < 16 && tmp[0x11027] <= 122 && tmp[0x11034] == 35 && tmp[0x11035] == 16 && tmp[0x11036] == 0 && tmp[0x11037] == 1; decodedImage = new byte[imageHeader.DataSize]; - offsets = imageHeader.ImageFormat == SectorOrder.Dos - ? (isDos ? deinterleave : interleave) - : (isDos ? interleave : deinterleave); + offsets = imageHeader.ImageFormat == SectorOrder.Dos + ? (isDos ? deinterleave : interleave) + : (isDos ? interleave : deinterleave); for(int t = 0; t < 35; t++) { for(int s = 0; s < 16; s++) @@ -414,12 +414,12 @@ namespace DiscImageChef.DiscImages if(decodedImage != null) Array.Copy(decodedImage, (long)(sectorAddress * imageInfo.SectorSize), buffer, 0, - length * imageInfo.SectorSize); + length * imageInfo.SectorSize); else { Stream stream = a2MgImageFilter.GetDataForkStream(); stream.Seek((long)(imageHeader.DataOffset + sectorAddress * imageInfo.SectorSize), SeekOrigin.Begin); - stream.Read(buffer, 0, (int)(length * imageInfo.SectorSize)); + stream.Read(buffer, 0, (int)(length * imageInfo.SectorSize)); } return buffer; @@ -500,8 +500,8 @@ namespace DiscImageChef.DiscImages throw new FeatureUnsupportedImageException("Feature not supported by image format"); } - public bool? VerifySectors(ulong sectorAddress, uint length, out List failingLbas, - out List unknownLbas) + public bool? VerifySectors(ulong sectorAddress, uint length, out List failingLbas, + out List unknownLbas) { failingLbas = new List(); unknownLbas = new List(); @@ -510,8 +510,8 @@ namespace DiscImageChef.DiscImages return null; } - public bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List failingLbas, - out List unknownLbas) + public bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List failingLbas, + out List unknownLbas) { throw new FeatureUnsupportedImageException("Feature not supported by image format"); } @@ -526,7 +526,7 @@ namespace DiscImageChef.DiscImages public IEnumerable SupportedMediaTags => new MediaTagType[] { }; public IEnumerable SupportedSectorTags => new SectorTagType[] { }; - public IEnumerable SupportedMediaTypes => + public IEnumerable SupportedMediaTypes => new[] { MediaType.Apple32SS, MediaType.Apple33SS, MediaType.AppleSonySS, MediaType.AppleSonyDS, @@ -543,7 +543,7 @@ namespace DiscImageChef.DiscImages public bool Create(string path, MediaType mediaType, Dictionary options, ulong sectors, uint sectorSize) { - if(sectorSize != 512) + if(sectorSize != 512) if(sectorSize != 256 || mediaType != MediaType.Apple32SS && mediaType != MediaType.Apple33SS) { ErrorMessage = "Unsupported sector size"; @@ -674,7 +674,7 @@ namespace DiscImageChef.DiscImages Creator = CREATOR_DIC, DataOffset = 0x40, DataSize = (uint)(imageInfo.Sectors * imageInfo.SectorSize), - Flags = + Flags = (uint)(imageInfo.LastMediaSequence != 0 ? VALID_VOLUME_NUMBER + (imageInfo.MediaSequence & 0xFF) : 0), diff --git a/DiscImageChef.DiscImages/AppleDOS.cs b/DiscImageChef.DiscImages/AppleDOS.cs index 9ca24f09b..b2107d3c4 100644 --- a/DiscImageChef.DiscImages/AppleDOS.cs +++ b/DiscImageChef.DiscImages/AppleDOS.cs @@ -169,8 +169,8 @@ namespace DiscImageChef.DiscImages return null; } - public bool? VerifySectors(ulong sectorAddress, uint length, out List failingLbas, - out List unknownLbas) + public bool? VerifySectors(ulong sectorAddress, uint length, out List failingLbas, + out List unknownLbas) { failingLbas = new List(); unknownLbas = new List(); @@ -180,8 +180,8 @@ namespace DiscImageChef.DiscImages return null; } - public bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List failingLbas, - out List unknownLbas) + public bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List failingLbas, + out List unknownLbas) { failingLbas = new List(); unknownLbas = new List(); @@ -269,8 +269,7 @@ namespace DiscImageChef.DiscImages public IEnumerable SupportedMediaTags => new MediaTagType[] { }; public IEnumerable SupportedSectorTags => new SectorTagType[] { }; - public IEnumerable SupportedMediaTypes => - new[] {MediaType.Apple33SS}; + public IEnumerable SupportedMediaTypes => new[] {MediaType.Apple33SS}; public IEnumerable<(string name, Type type, string description)> SupportedOptions => new (string name, Type type, string description)[] { }; public IEnumerable KnownExtensions => new[] {".do", ".po"}; diff --git a/DiscImageChef.DiscImages/AppleNIB.cs b/DiscImageChef.DiscImages/AppleNIB.cs index 16d3c0186..68fb167c6 100644 --- a/DiscImageChef.DiscImages/AppleNIB.cs +++ b/DiscImageChef.DiscImages/AppleNIB.cs @@ -49,7 +49,7 @@ namespace DiscImageChef.DiscImages readonly byte[] cpm_sign = {0xA2, 0x55, 0xA9, 0x00, 0x9D, 0x00, 0x0D, 0xCA}; readonly byte[] dos_sign = {0xA2, 0x02, 0x8E, 0x52}; readonly ulong[] dosSkewing = {0, 7, 14, 6, 13, 5, 12, 4, 11, 3, 10, 2, 9, 1, 8, 15}; - readonly byte[] dri_string = + 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 @@ -139,7 +139,7 @@ namespace DiscImageChef.DiscImages int spt = 0; bool allTracksEqual = true; - for(int i = 1; i < tracks.Count; i++) + 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; @@ -172,11 +172,11 @@ namespace DiscImageChef.DiscImages if(skewed && spt != 0) { ulong sectorNo = (ulong)((((sector.addressField.sector[0] & 0x55) << 1) | - (sector.addressField.sector[1] & 0x55)) & 0xFF); + (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); + rawSectors.Add(skewing[sectorNo] + (ulong)(i * spt), sector); imageInfo.Sectors++; } else @@ -206,15 +206,12 @@ namespace DiscImageChef.DiscImages imageInfo.ImageSize = (ulong)imageFilter.GetDataForkLength(); imageInfo.CreationTime = imageFilter.GetCreationTime(); imageInfo.LastModificationTime = imageFilter.GetLastWriteTime(); - imageInfo.MediaTitle = - Path.GetFileNameWithoutExtension(imageFilter.GetFilename()); + imageInfo.MediaTitle = 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; + 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) { @@ -384,8 +381,8 @@ namespace DiscImageChef.DiscImages throw new FeatureUnsupportedImageException("Feature not supported by image format"); } - public bool? VerifySectors(ulong sectorAddress, uint length, out List failingLbas, - out List unknownLbas) + public bool? VerifySectors(ulong sectorAddress, uint length, out List failingLbas, + out List unknownLbas) { failingLbas = new List(); unknownLbas = new List(); @@ -394,8 +391,8 @@ namespace DiscImageChef.DiscImages return null; } - public bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List failingLbas, - out List unknownLbas) + public bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List failingLbas, + out List unknownLbas) { throw new FeatureUnsupportedImageException("Feature not supported by image format"); } diff --git a/DiscImageChef.DiscImages/Apridisk.cs b/DiscImageChef.DiscImages/Apridisk.cs index 3013e581e..6e56163db 100644 --- a/DiscImageChef.DiscImages/Apridisk.cs +++ b/DiscImageChef.DiscImages/Apridisk.cs @@ -138,7 +138,7 @@ namespace DiscImageChef.DiscImages byte[] recB = new byte[recordSize]; stream.Read(recB, 0, recordSize); - GCHandle handle = GCHandle.Alloc(recB, GCHandleType.Pinned); + GCHandle handle = GCHandle.Alloc(recB, GCHandleType.Pinned); ApridiskRecord record = (ApridiskRecord)Marshal.PtrToStructure(handle.AddrOfPinnedObject(), typeof(ApridiskRecord)); handle.Free(); @@ -228,7 +228,7 @@ namespace DiscImageChef.DiscImages byte[] recB = new byte[recordSize]; stream.Read(recB, 0, recordSize); - GCHandle handle = GCHandle.Alloc(recB, GCHandleType.Pinned); + GCHandle handle = GCHandle.Alloc(recB, GCHandleType.Pinned); ApridiskRecord record = (ApridiskRecord)Marshal.PtrToStructure(handle.AddrOfPinnedObject(), typeof(ApridiskRecord)); handle.Free(); @@ -239,7 +239,7 @@ namespace DiscImageChef.DiscImages case RecordType.Deleted: case RecordType.Comment: case RecordType.Creator: - stream.Seek(record.headerSize - recordSize + record.dataSize, SeekOrigin.Current); + stream.Seek(record.headerSize - recordSize + record.dataSize, SeekOrigin.Current); headersizes += record.headerSize + record.dataSize; break; case RecordType.Sector: @@ -272,7 +272,7 @@ namespace DiscImageChef.DiscImages for(ushort cyl = 0; cyl < imageInfo.Cylinders; cyl++) { for(ushort head = 0; head < imageInfo.Heads; head++) - if(spts[cyl][head] < spt) + if(spts[cyl][head] < spt) spt = spts[cyl][head]; } @@ -281,9 +281,9 @@ namespace DiscImageChef.DiscImages DicConsole.DebugWriteLine("Apridisk plugin", "Found a minimum of {0} sectors per track", imageInfo.SectorsPerTrack); - imageInfo.MediaType = - Geometry.GetMediaType(((ushort)imageInfo.Cylinders, (byte)imageInfo.Heads, - (ushort)imageInfo.SectorsPerTrack, 512, MediaEncoding.MFM, false)); + imageInfo.MediaType = Geometry.GetMediaType(((ushort)imageInfo.Cylinders, (byte)imageInfo.Heads, + (ushort)imageInfo.SectorsPerTrack, 512, MediaEncoding.MFM, + false)); imageInfo.ImageSize = (ulong)stream.Length - headersizes; imageInfo.CreationTime = imageFilter.GetCreationTime(); @@ -404,8 +404,8 @@ namespace DiscImageChef.DiscImages throw new FeatureUnsupportedImageException("Feature not supported by image format"); } - public bool? VerifySectors(ulong sectorAddress, uint length, out List failingLbas, - out List unknownLbas) + public bool? VerifySectors(ulong sectorAddress, uint length, out List failingLbas, + out List unknownLbas) { failingLbas = new List(); unknownLbas = new List(); @@ -414,8 +414,8 @@ namespace DiscImageChef.DiscImages return null; } - public bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List failingLbas, - out List unknownLbas) + public bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List failingLbas, + out List unknownLbas) { throw new FeatureUnsupportedImageException("Feature not supported by image format"); } @@ -591,7 +591,7 @@ namespace DiscImageChef.DiscImages if(!string.IsNullOrEmpty(imageInfo.Creator)) { - byte[] creatorBytes = Encoding.UTF8.GetBytes(imageInfo.Creator); + byte[] creatorBytes = Encoding.UTF8.GetBytes(imageInfo.Creator); ApridiskRecord creatorRecord = new ApridiskRecord { type = RecordType.Creator, @@ -613,7 +613,7 @@ namespace DiscImageChef.DiscImages if(!string.IsNullOrEmpty(imageInfo.Comments)) { - byte[] commentBytes = Encoding.UTF8.GetBytes(imageInfo.Comments); + byte[] commentBytes = Encoding.UTF8.GetBytes(imageInfo.Comments); ApridiskRecord commentRecord = new ApridiskRecord { type = RecordType.Comment, @@ -672,7 +672,7 @@ namespace DiscImageChef.DiscImages sectorsData = new byte[cylinders][][][]; for(ushort c = 0; c < cylinders; c++) { - sectorsData[c] = new byte[heads][][]; + sectorsData[c] = new byte[heads][][]; for(byte h = 0; h < heads; h++) sectorsData[c][h] = new byte[sectorsPerTrack][]; } @@ -718,7 +718,7 @@ namespace DiscImageChef.DiscImages while(cLen >= 3) { ushort blklen = BitConverter.ToUInt16(compressed, readp); - readp += 2; + readp += 2; for(int i = 0; i < blklen; i++) buffer.WriteByte(compressed[readp]); @@ -733,9 +733,9 @@ namespace DiscImageChef.DiscImages (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); + 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); } diff --git a/DiscImageChef.DiscImages/BLU.cs b/DiscImageChef.DiscImages/BLU.cs index 6e362b6b7..055479c59 100644 --- a/DiscImageChef.DiscImages/BLU.cs +++ b/DiscImageChef.DiscImages/BLU.cs @@ -110,7 +110,7 @@ namespace DiscImageChef.DiscImages byte[] header = new byte[0x17]; stream.Read(header, 0, 0x17); - BluHeader tmpHdr = new BluHeader {DeviceName = new byte[0x0D]}; + BluHeader tmpHdr = new BluHeader {DeviceName = new byte[0x0D]}; BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian; Array.Copy(header, 0, tmpHdr.DeviceName, 0, 0x0D); @@ -118,7 +118,7 @@ namespace DiscImageChef.DiscImages tmpHdr.DeviceBlocks = BigEndianBitConverter.ToUInt32(header, 0x11) & 0x00FFFFFF; tmpHdr.BytesPerBlock = BigEndianBitConverter.ToUInt16(header, 0x15); - for(int i = 0; i < 0xD; i++) + for(int i = 0; i < 0xD; i++) if(tmpHdr.DeviceName[i] < 0x20) return false; @@ -146,7 +146,7 @@ namespace DiscImageChef.DiscImages 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++) + for(int i = 0; i < 0xD; i++) if(imageHeader.DeviceName[i] < 0x20) return false; @@ -161,7 +161,7 @@ namespace DiscImageChef.DiscImages imageInfo.Sectors = imageHeader.DeviceBlocks; imageInfo.ImageSize = imageHeader.DeviceBlocks * imageHeader.BytesPerBlock; bptag = imageHeader.BytesPerBlock - 0x200; - byte[] hdrTag = new byte[bptag]; + byte[] hdrTag = new byte[bptag]; Array.Copy(header, 0x200, hdrTag, 0, bptag); switch(StringHandlers.CToString(imageHeader.DeviceName)) @@ -368,8 +368,8 @@ namespace DiscImageChef.DiscImages return null; } - public bool? VerifySectors(ulong sectorAddress, uint length, out List failingLbas, - out List unknownLbas) + public bool? VerifySectors(ulong sectorAddress, uint length, out List failingLbas, + out List unknownLbas) { failingLbas = new List(); unknownLbas = new List(); @@ -379,8 +379,8 @@ namespace DiscImageChef.DiscImages return null; } - public bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List failingLbas, - out List unknownLbas) + public bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List failingLbas, + out List unknownLbas) { failingLbas = new List(); unknownLbas = new List(); @@ -400,7 +400,7 @@ namespace DiscImageChef.DiscImages public IEnumerable SupportedMediaTags => new MediaTagType[] { }; public IEnumerable SupportedSectorTags => new[] {SectorTagType.AppleSectorTag}; - public IEnumerable SupportedMediaTypes => + public IEnumerable SupportedMediaTypes => new[] { MediaType.AppleProfile, MediaType.AppleWidget, MediaType.PriamDataTower, MediaType.GENERIC_HDD, @@ -665,8 +665,8 @@ namespace DiscImageChef.DiscImages if(newTag == null) newTag = new byte[longSectorSize - 512]; writingStream.Seek(longSectorSize + (long)sectorAddress * longSectorSize, SeekOrigin.Begin); - writingStream.Write(data, (int)(givenSectorSize * i), 512); - writingStream.Write(newTag, 0, newTag.Length); + writingStream.Write(data, (int)(givenSectorSize * i), 512); + writingStream.Write(newTag, 0, newTag.Length); } ErrorMessage = ""; @@ -688,7 +688,7 @@ namespace DiscImageChef.DiscImages } BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian; - byte[] markerTag = Encoding.UTF8.GetBytes("DiscImageChef " + Version.GetVersion()); + byte[] markerTag = Encoding.UTF8.GetBytes("DiscImageChef " + Version.GetVersion()); byte[] driveName; byte[] driveType = new byte[3]; byte[] driveBlocks = BigEndianBitConverter.GetBytes((uint)imageInfo.Sectors); diff --git a/DiscImageChef.DiscImages/BlindWrite4.cs b/DiscImageChef.DiscImages/BlindWrite4.cs index a48478784..fb0d05ac5 100644 --- a/DiscImageChef.DiscImages/BlindWrite4.cs +++ b/DiscImageChef.DiscImages/BlindWrite4.cs @@ -504,10 +504,10 @@ namespace DiscImageChef.DiscImages .ToUpper(CultureInfo.CurrentCulture))); } - Tracks = new List(); - Partitions = new List(); - offsetmap = new Dictionary(); - trackFlags = new Dictionary(); + Tracks = new List(); + Partitions = new List(); + offsetmap = new Dictionary(); + trackFlags = new Dictionary(); ushort maxSession = 0; ulong currentPos = 0; foreach(Bw4TrackDescriptor bwTrack in bwTracks) @@ -564,19 +564,17 @@ namespace DiscImageChef.DiscImages track.TrackFile = dataFilter.GetFilename(); if(bwTrack.pregap != 0) - track.TrackFileOffset += - (ulong)(bwTrack.startSector - bwTrack.pregap) * 2352; - track.TrackFileType = "BINARY"; - track.TrackPregap = (ulong)(bwTrack.startSector - bwTrack.pregap); - track.TrackRawBytesPerSector = 2352; - track.TrackSequence = bwTrack.point; - track.TrackSession = bwTrack.session; + track.TrackFileOffset += (ulong)(bwTrack.startSector - bwTrack.pregap) * 2352; + track.TrackFileType = "BINARY"; + track.TrackPregap = (ulong)(bwTrack.startSector - bwTrack.pregap); + track.TrackRawBytesPerSector = 2352; + track.TrackSequence = bwTrack.point; + track.TrackSession = bwTrack.session; if(track.TrackSession > maxSession) maxSession = track.TrackSession; - track.TrackStartSector = (ulong)bwTrack.startSector; - track.TrackSubchannelFilter = subFilter; - track.TrackSubchannelFile = subFilter.GetFilename(); - track.TrackSubchannelOffset = - track.TrackStartSector * 96 + track.TrackPregap * 96; + track.TrackStartSector = (ulong)bwTrack.startSector; + track.TrackSubchannelFilter = subFilter; + track.TrackSubchannelFile = subFilter.GetFilename(); + track.TrackSubchannelOffset = track.TrackStartSector * 96 + track.TrackPregap * 96; if(subFilter != null && bwTrack.subchannel > 0) { track.TrackSubchannelType = TrackSubchannelType.Packed; @@ -609,7 +607,7 @@ namespace DiscImageChef.DiscImages if(!imageInfo.ReadableSectorTags.Contains(SectorTagType.CdSectorEdc)) imageInfo.ReadableSectorTags.Add(SectorTagType.CdSectorEdc); if(imageInfo.SectorSize < 2048) imageInfo.SectorSize = 2048; - track.TrackBytesPerSector = 2048; + track.TrackBytesPerSector = 2048; break; case Bw4TrackType.Mode2: track.TrackType = TrackType.CdMode2Formless; @@ -618,7 +616,7 @@ namespace DiscImageChef.DiscImages if(!imageInfo.ReadableSectorTags.Contains(SectorTagType.CdSectorHeader)) imageInfo.ReadableSectorTags.Add(SectorTagType.CdSectorHeader); if(imageInfo.SectorSize < 2336) imageInfo.SectorSize = 2336; - track.TrackBytesPerSector = 2336; + track.TrackBytesPerSector = 2336; break; default: track.TrackType = TrackType.Data; @@ -630,17 +628,17 @@ namespace DiscImageChef.DiscImages track.Indexes = new Dictionary(); if(bwTrack.pregap > 0) track.Indexes.Add(0, (ulong)bwTrack.pregap); - track.Indexes.Add(1, (ulong)bwTrack.startSector); + track.Indexes.Add(1, (ulong)bwTrack.startSector); Partition partition = new Partition(); 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; - partition.Sequence = track.TrackSequence; - partition.Offset = currentPos; - partition.Start = track.TrackStartSector; - partition.Type = track.TrackType.ToString(); + partition.Description = track.TrackDescription; + partition.Size = (track.TrackEndSector - track.TrackStartSector + 1) * 2352; + partition.Length = track.TrackEndSector - track.TrackStartSector; + partition.Sequence = track.TrackSequence; + partition.Offset = currentPos; + partition.Start = track.TrackStartSector; + partition.Type = track.TrackType.ToString(); Partitions.Add(partition); Tracks.Add(track); @@ -725,15 +723,11 @@ namespace DiscImageChef.DiscImages } } - 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.Comments = header.Comments; @@ -784,8 +778,8 @@ namespace DiscImageChef.DiscImages foreach(KeyValuePair kvp in from kvp in offsetmap where sectorAddress >= kvp.Value from track in Tracks - where track.TrackSequence == kvp.Key - where sectorAddress - kvp.Value < + where track.TrackSequence == kvp.Key + where sectorAddress - kvp.Value < track.TrackEndSector - track.TrackStartSector + 1 select kvp) return ReadSectors(sectorAddress - kvp.Value, length, kvp.Key); @@ -798,8 +792,8 @@ namespace DiscImageChef.DiscImages foreach(KeyValuePair kvp in from kvp in offsetmap where sectorAddress >= kvp.Value from track in Tracks - where track.TrackSequence == kvp.Key - where sectorAddress - kvp.Value < + where track.TrackSequence == kvp.Key + where sectorAddress - kvp.Value < track.TrackEndSector - track.TrackStartSector + 1 select kvp) return ReadSectorsTag(sectorAddress - kvp.Value, length, kvp.Key, tag); @@ -863,7 +857,7 @@ namespace DiscImageChef.DiscImages byte[] buffer = new byte[sectorSize * length]; - imageStream = dicTrack.TrackFilter.GetDataForkStream(); + imageStream = dicTrack.TrackFilter.GetDataForkStream(); BinaryReader br = new BinaryReader(imageStream); br.BaseStream .Seek((long)dicTrack.TrackFileOffset + (long)(sectorAddress * (sectorOffset + sectorSize + sectorSkip)), @@ -918,7 +912,7 @@ namespace DiscImageChef.DiscImages case SectorTagType.CdTrackFlags: if(trackFlags.TryGetValue(track, out byte flag)) return new[] {flag}; - throw new ArgumentException("Unsupported tag requested", nameof(tag)); + throw new ArgumentException("Unsupported tag requested", nameof(tag)); default: throw new ArgumentException("Unsupported tag requested", nameof(tag)); } @@ -1022,7 +1016,7 @@ namespace DiscImageChef.DiscImages byte[] buffer = new byte[sectorSize * length]; - imageStream = dicTrack.TrackFilter.GetDataForkStream(); + imageStream = dicTrack.TrackFilter.GetDataForkStream(); BinaryReader br = new BinaryReader(imageStream); br.BaseStream .Seek((long)dicTrack.TrackFileOffset + (long)(sectorAddress * (sectorOffset + sectorSize + sectorSkip)), @@ -1055,8 +1049,8 @@ namespace DiscImageChef.DiscImages foreach(KeyValuePair kvp in from kvp in offsetmap where sectorAddress >= kvp.Value from track in Tracks - where track.TrackSequence == kvp.Key - where sectorAddress - kvp.Value < + where track.TrackSequence == kvp.Key + where sectorAddress - kvp.Value < track.TrackEndSector - track.TrackStartSector + 1 select kvp) return ReadSectorsLong(sectorAddress - kvp.Value, length, kvp.Key); @@ -1100,7 +1094,7 @@ namespace DiscImageChef.DiscImages default: throw new FeatureSupportedButNotImplementedImageException("Unsupported track type"); } - imageStream = dicTrack.TrackFilter.GetDataForkStream(); + imageStream = dicTrack.TrackFilter.GetDataForkStream(); BinaryReader br = new BinaryReader(imageStream); br.BaseStream .Seek((long)dicTrack.TrackFileOffset + (long)(sectorAddress * (sectorOffset + sectorSize + sectorSkip)), @@ -1134,14 +1128,14 @@ namespace DiscImageChef.DiscImages return CdChecksums.CheckCdSector(buffer); } - public bool? VerifySectors(ulong sectorAddress, uint length, out List failingLbas, - out List unknownLbas) + public bool? VerifySectors(ulong sectorAddress, uint length, out List failingLbas, + out List unknownLbas) { byte[] buffer = ReadSectorsLong(sectorAddress, length); int bps = (int)(buffer.Length / length); byte[] sector = new byte[bps]; - failingLbas = new List(); - unknownLbas = new List(); + failingLbas = new List(); + unknownLbas = new List(); for(int i = 0; i < length; i++) { @@ -1164,14 +1158,14 @@ namespace DiscImageChef.DiscImages return failingLbas.Count <= 0; } - public bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List failingLbas, - out List unknownLbas) + public 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); byte[] sector = new byte[bps]; - failingLbas = new List(); - unknownLbas = new List(); + failingLbas = new List(); + unknownLbas = new List(); for(int i = 0; i < length; i++) { @@ -1242,7 +1236,7 @@ namespace DiscImageChef.DiscImages public uint offset; public byte subchannel; [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] - public byte[] unknown1; + public byte[] unknown1; public uint unknown2; public byte unknown3; public byte session; diff --git a/DiscImageChef.DiscImages/BlindWrite5.cs b/DiscImageChef.DiscImages/BlindWrite5.cs index 3e4e60f09..12af20baf 100644 --- a/DiscImageChef.DiscImages/BlindWrite5.cs +++ b/DiscImageChef.DiscImages/BlindWrite5.cs @@ -142,7 +142,7 @@ namespace DiscImageChef.DiscImages byte[] hdr = new byte[260]; stream.Read(hdr, 0, 260); - header = new Bw5Header(); + header = new Bw5Header(); IntPtr hdrPtr = Marshal.AllocHGlobal(260); Marshal.Copy(hdr, 0, hdrPtr, 260); header = (Bw5Header)Marshal.PtrToStructure(hdrPtr, typeof(Bw5Header)); @@ -203,7 +203,7 @@ namespace DiscImageChef.DiscImages if(mode2A.Length > 0) { stream.Read(mode2A, 0, mode2A.Length); - mode2A[1] -= 2; + mode2A[1] -= 2; Modes.ModePage_2A? decoded2A = Modes.DecodeModePage_2A(mode2A); if(decoded2A.HasValue) DicConsole.DebugWriteLine("BlindWrite5 plugin", "mode page 2A: {0}", @@ -333,7 +333,7 @@ namespace DiscImageChef.DiscImages dataFiles = new List(); for(int cD = 0; cD < dataBlockCount; cD++) { - tmpArray = new byte[52]; + tmpArray = new byte[52]; Bw5DataFile dataFile = new Bw5DataFile {Unknown1 = new uint[4], Unknown2 = new uint[3]}; stream.Read(tmpArray, 0, tmpArray.Length); @@ -384,7 +384,7 @@ namespace DiscImageChef.DiscImages for(int ses = 0; ses < header.sessions; ses++) { Bw5SessionDescriptor session = new Bw5SessionDescriptor(); - tmpArray = new byte[16]; + tmpArray = new byte[16]; stream.Read(tmpArray, 0, tmpArray.Length); session.Sequence = BitConverter.ToUInt16(tmpArray, 0); session.Entries = tmpArray[2]; @@ -409,7 +409,7 @@ namespace DiscImageChef.DiscImages byte[] trk = new byte[72]; stream.Read(trk, 0, 72); session.Tracks[tSeq] = new Bw5TrackDescriptor(); - IntPtr trkPtr = Marshal.AllocHGlobal(72); + IntPtr trkPtr = Marshal.AllocHGlobal(72); Marshal.Copy(trk, 0, trkPtr, 72); session.Tracks[tSeq] = (Bw5TrackDescriptor)Marshal.PtrToStructure(trkPtr, typeof(Bw5TrackDescriptor)); @@ -524,8 +524,7 @@ namespace DiscImageChef.DiscImages } else { - path = Path.Combine(dataPath, - dataFile.Filename.ToLower(CultureInfo.CurrentCulture)); + path = Path.Combine(dataPath, dataFile.Filename.ToLower(CultureInfo.CurrentCulture)); if(filtersList.GetFilter(Path.Combine(imageFilter.GetParentFolder(), path)) != null) { chars.FileFilter = filtersList.GetFilter(Path.Combine(imageFilter.GetParentFolder(), path)); @@ -533,8 +532,7 @@ namespace DiscImageChef.DiscImages } else { - path = Path.Combine(dataPath, - dataFile.Filename.ToUpper(CultureInfo.CurrentCulture)); + path = Path.Combine(dataPath, dataFile.Filename.ToUpper(CultureInfo.CurrentCulture)); if(filtersList.GetFilter(Path.Combine(imageFilter.GetParentFolder(), path)) != null) { chars.FileFilter = filtersList.GetFilter(Path.Combine(imageFilter.GetParentFolder(), path)); @@ -542,7 +540,7 @@ namespace DiscImageChef.DiscImages } else { - path = Path.Combine(dataPath.ToLower(CultureInfo.CurrentCulture), dataFile.Filename); + path = Path.Combine(dataPath.ToLower(CultureInfo.CurrentCulture), dataFile.Filename); if(filtersList.GetFilter(Path.Combine(imageFilter.GetParentFolder(), path)) != null) { chars.FileFilter = @@ -551,7 +549,7 @@ namespace DiscImageChef.DiscImages } else { - path = Path.Combine(dataPath.ToUpper(CultureInfo.CurrentCulture), dataFile.Filename); + path = Path.Combine(dataPath.ToUpper(CultureInfo.CurrentCulture), dataFile.Filename); if(filtersList.GetFilter(Path.Combine(imageFilter.GetParentFolder(), path)) != null) { chars.FileFilter = @@ -565,7 +563,7 @@ namespace DiscImageChef.DiscImages path.ToLower(CultureInfo.CurrentCulture))) != null) { - chars.FilePath = path.ToLower(CultureInfo.CurrentCulture); + chars.FilePath = path.ToLower(CultureInfo.CurrentCulture); chars.FileFilter = filtersList.GetFilter(Path.Combine(imageFilter.GetParentFolder(), path.ToLower(CultureInfo @@ -576,7 +574,7 @@ namespace DiscImageChef.DiscImages .CurrentCulture))) != null) { - chars.FilePath = path.ToUpper(CultureInfo.CurrentCulture); + chars.FilePath = path.ToUpper(CultureInfo.CurrentCulture); chars.FileFilter = filtersList.GetFilter(Path.Combine(imageFilter.GetParentFolder(), path.ToUpper(CultureInfo @@ -587,7 +585,7 @@ namespace DiscImageChef.DiscImages .CurrentCulture))) != null) { - chars.FilePath = dataFile.Filename.ToLower(CultureInfo.CurrentCulture); + chars.FilePath = dataFile.Filename.ToLower(CultureInfo.CurrentCulture); chars.FileFilter = filtersList.GetFilter(Path.Combine(imageFilter.GetParentFolder(), dataFile.Filename.ToLower(CultureInfo @@ -598,7 +596,7 @@ namespace DiscImageChef.DiscImages .CurrentCulture))) != null) { - chars.FilePath = dataFile.Filename.ToUpper(CultureInfo.CurrentCulture); + chars.FilePath = dataFile.Filename.ToUpper(CultureInfo.CurrentCulture); chars.FileFilter = filtersList.GetFilter(Path.Combine(imageFilter.GetParentFolder(), dataFile.Filename.ToUpper(CultureInfo @@ -607,7 +605,7 @@ namespace DiscImageChef.DiscImages else if(filtersList.GetFilter(Path.Combine(imageFilter.GetParentFolder(), dataFile.Filename)) != null) { - chars.FilePath = dataFile.Filename; + chars.FilePath = dataFile.Filename; chars.FileFilter = filtersList.GetFilter(Path.Combine(imageFilter.GetParentFolder(), dataFile.Filename)); @@ -647,13 +645,13 @@ namespace DiscImageChef.DiscImages filePaths.Add(chars); } - Sessions = new List(); - Tracks = new List(); - Partitions = new List(); + Sessions = new List(); + Tracks = new List(); + Partitions = new List(); MemoryStream fullTocStream = new MemoryStream(); fullTocStream.Write(new byte[] {0, 0, 0, 0}, 0, 4); ulong offsetBytes = 0; - offsetmap = new Dictionary(); + offsetmap = new Dictionary(); bool isDvd = false; byte firstSession = byte.MaxValue; byte lastSession = 0; @@ -701,8 +699,8 @@ namespace DiscImageChef.DiscImages switch(trk.type) { case Bw5TrackType.Audio: - track.TrackBytesPerSector = 2352; - track.TrackRawBytesPerSector = 2352; + track.TrackBytesPerSector = 2352; + track.TrackRawBytesPerSector = 2352; if(imageInfo.SectorSize < 2352) imageInfo.SectorSize = 2352; break; case Bw5TrackType.Mode1: @@ -721,8 +719,8 @@ namespace DiscImageChef.DiscImages imageInfo.ReadableSectorTags.Add(SectorTagType.CdSectorEccQ); if(!imageInfo.ReadableSectorTags.Contains(SectorTagType.CdSectorEdc)) imageInfo.ReadableSectorTags.Add(SectorTagType.CdSectorEdc); - track.TrackBytesPerSector = 2048; - track.TrackRawBytesPerSector = 2352; + track.TrackBytesPerSector = 2048; + track.TrackRawBytesPerSector = 2352; if(imageInfo.SectorSize < 2048) imageInfo.SectorSize = 2048; break; case Bw5TrackType.Mode2: @@ -730,8 +728,8 @@ namespace DiscImageChef.DiscImages imageInfo.ReadableSectorTags.Add(SectorTagType.CdSectorSync); if(!imageInfo.ReadableSectorTags.Contains(SectorTagType.CdSectorHeader)) imageInfo.ReadableSectorTags.Add(SectorTagType.CdSectorHeader); - track.TrackBytesPerSector = 2336; - track.TrackRawBytesPerSector = 2352; + track.TrackBytesPerSector = 2336; + track.TrackRawBytesPerSector = 2352; if(imageInfo.SectorSize < 2336) imageInfo.SectorSize = 2336; break; case Bw5TrackType.Mode2F2: @@ -743,15 +741,15 @@ namespace DiscImageChef.DiscImages imageInfo.ReadableSectorTags.Add(SectorTagType.CdSectorSubHeader); if(!imageInfo.ReadableSectorTags.Contains(SectorTagType.CdSectorEdc)) imageInfo.ReadableSectorTags.Add(SectorTagType.CdSectorEdc); - track.TrackBytesPerSector = 2336; - track.TrackRawBytesPerSector = 2352; + track.TrackBytesPerSector = 2336; + track.TrackRawBytesPerSector = 2352; if(imageInfo.SectorSize < 2324) imageInfo.SectorSize = 2324; break; case Bw5TrackType.Dvd: - track.TrackBytesPerSector = 2048; - track.TrackRawBytesPerSector = 2048; + track.TrackBytesPerSector = 2048; + track.TrackRawBytesPerSector = 2048; if(imageInfo.SectorSize < 2048) imageInfo.SectorSize = 2048; - isDvd = true; + isDvd = true; break; } @@ -759,18 +757,16 @@ namespace DiscImageChef.DiscImages track.TrackStartSector = (ulong)(trk.startLba + trk.pregap); track.TrackEndSector = (ulong)(trk.sectors + trk.startLba); - foreach(DataFileCharacteristics chars in filePaths.Where(chars => - trk.startLba >= - chars.StartLba && - trk.startLba + trk.sectors <= - chars.StartLba + chars.Sectors)) + foreach(DataFileCharacteristics chars in filePaths.Where(chars => 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.TrackFileType = "BINARY"; + else track.TrackFileOffset = (ulong)(trk.startLba * -1 * chars.SectorSize); + track.TrackFileType = "BINARY"; if(chars.Subchannel != TrackSubchannelType.None) { track.TrackSubchannelFilter = track.TrackFilter; @@ -792,8 +788,8 @@ namespace DiscImageChef.DiscImages track.Indexes = new Dictionary {{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; @@ -842,10 +838,10 @@ namespace DiscImageChef.DiscImages DicConsole.DebugWriteLine("BlindWrite5 plugin", "TOC len {0}", fullToc.Length); byte[] fullTocSize = BitConverter.GetBytes((short)(fullToc.Length - 2)); - fullToc[0] = fullTocSize[1]; - fullToc[1] = fullTocSize[0]; - fullToc[2] = firstSession; - fullToc[3] = lastSession; + fullToc[0] = fullTocSize[1]; + fullToc[1] = fullTocSize[0]; + fullToc[2] = firstSession; + fullToc[3] = lastSession; FullTOC.CDFullTOC? decodedFullToc = FullTOC.Decode(fullToc); @@ -915,9 +911,8 @@ namespace DiscImageChef.DiscImages break; } - if(DMI.IsXbox(dmi)) imageInfo.MediaType = MediaType.XGD; - else if(DMI.IsXbox360(dmi)) - imageInfo.MediaType = MediaType.XGD2; + if(DMI.IsXbox(dmi)) imageInfo.MediaType = MediaType.XGD; + else if(DMI.IsXbox360(dmi)) imageInfo.MediaType = MediaType.XGD2; } } else if(imageInfo.MediaType == MediaType.CD || imageInfo.MediaType == MediaType.CDROM) @@ -952,15 +947,11 @@ namespace DiscImageChef.DiscImages } } - 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); @@ -970,9 +961,8 @@ namespace DiscImageChef.DiscImages if(string.Compare(Path.GetExtension(imageFilter.GetFilename()), "B5T", StringComparison.OrdinalIgnoreCase) == 0) imageInfo.ApplicationVersion = "5"; else if(string.Compare(Path.GetExtension(imageFilter.GetFilename()), "B6T", - StringComparison.OrdinalIgnoreCase) == 0) - imageInfo.ApplicationVersion = "6"; - imageInfo.Version = "5"; + StringComparison.OrdinalIgnoreCase) == 0) imageInfo.ApplicationVersion = "6"; + imageInfo.Version = "5"; imageInfo.ImageSize = (ulong)imageFilter.GetDataForkLength(); imageInfo.CreationTime = imageFilter.GetCreationTime(); @@ -997,8 +987,8 @@ namespace DiscImageChef.DiscImages if(atip0.LeadInStartMin == 97) { - int type = atip0.LeadInStartFrame % 10; - int frm = atip0.LeadInStartFrame - type; + int type = atip0.LeadInStartFrame % 10; + int frm = atip0.LeadInStartFrame - type; imageInfo.MediaManufacturer = ATIP.ManufacturerFromATIP(atip0.LeadInStartSec, frm); } } @@ -1028,16 +1018,15 @@ namespace DiscImageChef.DiscImages 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(bca != null) if(isDvd) imageInfo.ReadableMediaTags.Add(MediaTagType.DVD_BCA); - else if(isBd) - imageInfo.ReadableMediaTags.Add(MediaTagType.BD_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(imageInfo.MediaType == MediaType.XGD2) + if(imageInfo.MediaType == MediaType.XGD2) if(imageInfo.Sectors == 25063 || // Locked (or non compatible drive) imageInfo.Sectors == 4229664 || // Xtreme unlock imageInfo.Sectors == 4246304) // Wxripper unlock @@ -1131,7 +1120,7 @@ namespace DiscImageChef.DiscImages foreach(KeyValuePair kvp in from kvp in offsetmap where sectorAddress >= kvp.Value from track in Tracks - where track.TrackSequence == kvp.Key + where track.TrackSequence == kvp.Key where sectorAddress - kvp.Value < track.TrackEndSector - track.TrackStartSector select kvp) @@ -1145,7 +1134,7 @@ namespace DiscImageChef.DiscImages foreach(KeyValuePair kvp in from kvp in offsetmap where sectorAddress >= kvp.Value from track in Tracks - where track.TrackSequence == kvp.Key + where track.TrackSequence == kvp.Key where sectorAddress - kvp.Value < track.TrackEndSector - track.TrackStartSector select kvp) @@ -1176,9 +1165,10 @@ namespace DiscImageChef.DiscImages $"Requested more sectors ({length + sectorAddress}) than present in track ({dicTrack.TrackEndSector}), won't cross tracks"); foreach(DataFileCharacteristics characteristics in filePaths.Where(characteristics => - (long)sectorAddress >= characteristics.StartLba && - length < (ulong)characteristics.Sectors - - sectorAddress)) + (long)sectorAddress >= + characteristics.StartLba && + length < (ulong)characteristics + .Sectors - sectorAddress)) { chars = characteristics; break; @@ -1254,7 +1244,7 @@ namespace DiscImageChef.DiscImages byte[] buffer = new byte[sectorSize * length]; - imageStream = chars.FileFilter.GetDataForkStream(); + imageStream = chars.FileFilter.GetDataForkStream(); BinaryReader br = new BinaryReader(imageStream); br.BaseStream .Seek((long)dicTrack.TrackFileOffset + (long)(sectorAddress * (sectorOffset + sectorSize + sectorSkip)), @@ -1295,9 +1285,10 @@ namespace DiscImageChef.DiscImages $"Requested more sectors ({length + sectorAddress}) than present in track ({dicTrack.TrackEndSector}), won't cross tracks"); foreach(DataFileCharacteristics characteristics in filePaths.Where(characteristics => - (long)sectorAddress >= characteristics.StartLba && - length < (ulong)characteristics.Sectors - - sectorAddress)) + (long)sectorAddress >= + characteristics.StartLba && + length < (ulong)characteristics + .Sectors - sectorAddress)) { chars = characteristics; break; @@ -1322,7 +1313,7 @@ namespace DiscImageChef.DiscImages case SectorTagType.CdTrackFlags: if(trackFlags.TryGetValue(track, out byte flag)) return new[] {flag}; - throw new ArgumentException("Unsupported tag requested", nameof(tag)); + throw new ArgumentException("Unsupported tag requested", nameof(tag)); default: throw new ArgumentException("Unsupported tag requested", nameof(tag)); } @@ -1539,7 +1530,7 @@ namespace DiscImageChef.DiscImages byte[] buffer = new byte[sectorSize * length]; - imageStream = dicTrack.TrackFilter.GetDataForkStream(); + imageStream = dicTrack.TrackFilter.GetDataForkStream(); BinaryReader br = new BinaryReader(imageStream); br.BaseStream .Seek((long)dicTrack.TrackFileOffset + (long)(sectorAddress * (sectorOffset + sectorSize + sectorSkip)), @@ -1572,7 +1563,7 @@ namespace DiscImageChef.DiscImages foreach(KeyValuePair kvp in from kvp in offsetmap where sectorAddress >= kvp.Value from track in Tracks - where track.TrackSequence == kvp.Key + where track.TrackSequence == kvp.Key where sectorAddress - kvp.Value < track.TrackEndSector - track.TrackStartSector select kvp) @@ -1603,9 +1594,10 @@ namespace DiscImageChef.DiscImages $"Requested more sectors ({length + sectorAddress}) than present in track ({dicTrack.TrackEndSector}), won't cross tracks"); foreach(DataFileCharacteristics characteristics in filePaths.Where(characteristics => - (long)sectorAddress >= characteristics.StartLba && - length < (ulong)characteristics.Sectors - - sectorAddress)) + (long)sectorAddress >= + characteristics.StartLba && + length < (ulong)characteristics + .Sectors - sectorAddress)) { chars = characteristics; break; @@ -1657,7 +1649,7 @@ namespace DiscImageChef.DiscImages byte[] buffer = new byte[sectorSize * length]; - imageStream = dicTrack.TrackFilter.GetDataForkStream(); + imageStream = dicTrack.TrackFilter.GetDataForkStream(); BinaryReader br = new BinaryReader(imageStream); br.BaseStream .Seek((long)dicTrack.TrackFileOffset + (long)(sectorAddress * (sectorOffset + sectorSize + sectorSkip)), @@ -1699,14 +1691,14 @@ namespace DiscImageChef.DiscImages return CdChecksums.CheckCdSector(buffer); } - public bool? VerifySectors(ulong sectorAddress, uint length, out List failingLbas, - out List unknownLbas) + public bool? VerifySectors(ulong sectorAddress, uint length, out List failingLbas, + out List unknownLbas) { byte[] buffer = ReadSectorsLong(sectorAddress, length); int bps = (int)(buffer.Length / length); byte[] sector = new byte[bps]; - failingLbas = new List(); - unknownLbas = new List(); + failingLbas = new List(); + unknownLbas = new List(); for(int i = 0; i < length; i++) { @@ -1729,14 +1721,14 @@ namespace DiscImageChef.DiscImages return failingLbas.Count <= 0; } - public bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List failingLbas, - out List unknownLbas) + public 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); byte[] sector = new byte[bps]; - failingLbas = new List(); - unknownLbas = new List(); + failingLbas = new List(); + unknownLbas = new List(); for(int i = 0; i < length; i++) { @@ -1793,14 +1785,14 @@ namespace DiscImageChef.DiscImages case ProfileNumber.CDROM: case ProfileNumber.HDBURNROM: return MediaType.CDROM; case ProfileNumber.CDRW: - case ProfileNumber.HDBURNRW: return MediaType.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.DVDRDLJump: - case ProfileNumber.DVDRDLSeq: return MediaType.DVDRDL; + case ProfileNumber.DVDRDLSeq: return MediaType.DVDRDL; case ProfileNumber.DVDRDLPlus: return MediaType.DVDPRDL; case ProfileNumber.DVDROM: return MediaType.DVDROM; case ProfileNumber.DVDRPlus: return MediaType.DVDPR; @@ -1809,7 +1801,7 @@ namespace DiscImageChef.DiscImages case ProfileNumber.DVDRWDLPlus: return MediaType.DVDPRWDL; case ProfileNumber.DVDRWPlus: return MediaType.DVDPRW; case ProfileNumber.DVDRWRes: - case ProfileNumber.DVDRWSeq: return MediaType.DVDRW; + case ProfileNumber.DVDRWSeq: return MediaType.DVDRW; case ProfileNumber.HDDVDR: return MediaType.HDDVDR; case ProfileNumber.HDDVDRAM: return MediaType.HDDVDRAM; case ProfileNumber.HDDVDRDL: return MediaType.HDDVDRDL; @@ -1817,7 +1809,7 @@ namespace DiscImageChef.DiscImages case ProfileNumber.HDDVDRW: return MediaType.HDDVDRW; case ProfileNumber.HDDVDRWDL: return MediaType.HDDVDRWDL; case ProfileNumber.ASMO: - case ProfileNumber.MOErasable: return MediaType.UnknownMO; + case ProfileNumber.MOErasable: return MediaType.UnknownMO; case ProfileNumber.NonRemovable: return MediaType.GENERIC_HDD; default: return MediaType.CD; } @@ -1847,7 +1839,7 @@ namespace DiscImageChef.DiscImages [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] public byte[] signature; [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] - public uint[] unknown1; + public uint[] unknown1; public ProfileNumber profile; public ushort sessions; [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] @@ -1866,8 +1858,8 @@ namespace DiscImageChef.DiscImages public uint bcaLen; [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] public uint[] unknown5; - public uint dvdStrLen; - public uint dvdInfoLen; + public uint dvdStrLen; + public uint dvdInfoLen; [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] public byte[] unknown6; [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] @@ -1880,11 +1872,11 @@ namespace DiscImageChef.DiscImages public byte[] vendor; [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] public byte[] volumeId; - public uint mode2ALen; - public uint unkBlkLen; - public uint dataLen; - public uint sessionsLen; - public uint dpmLen; + public uint mode2ALen; + public uint unkBlkLen; + public uint dataLen; + public uint sessionsLen; + public uint dpmLen; } struct Bw5DataFile @@ -1893,7 +1885,7 @@ namespace DiscImageChef.DiscImages public uint Length; [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] public uint[] Unknown1; - public uint Offset; + public uint Offset; [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)] public uint[] Unknown2; public int StartLba; @@ -1910,7 +1902,7 @@ namespace DiscImageChef.DiscImages { public Bw5TrackType type; [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] - public byte[] unknown1; + public byte[] unknown1; public uint unknown2; public Bw5TrackSubchannel subchannel; public byte unknown3; @@ -1929,8 +1921,8 @@ namespace DiscImageChef.DiscImages public uint pregap; [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)] public uint[] unknown6; - public int startLba; - public int sectors; + public int startLba; + public int sectors; [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)] public uint[] unknown7; public uint session; diff --git a/DiscImageChef.DiscImages/CDRDAO.cs b/DiscImageChef.DiscImages/CDRDAO.cs index 5ce001305..7501f8cd8 100644 --- a/DiscImageChef.DiscImages/CDRDAO.cs +++ b/DiscImageChef.DiscImages/CDRDAO.cs @@ -66,10 +66,10 @@ namespace DiscImageChef.DiscImages /// Mode 2 track, raw, 2352 bytes/sector const string CDRDAO_TRACK_TYPE_MODE2_RAW = "MODE2_RAW"; - const string REGEX_COMMENT = @"^\s*\/{2}(?.+)$"; - const string REGEX_COPY = @"^\s*(?NO)?\s*COPY"; - const string REGEX_DISCTYPE = @"^\s*(?(CD_DA|CD_ROM_XA|CD_ROM|CD_I))"; - const string REGEX_EMPHASIS = @"^\s*(?NO)?\s*PRE_EMPHASIS"; + const string REGEX_COMMENT = @"^\s*\/{2}(?.+)$"; + const string REGEX_COPY = @"^\s*(?NO)?\s*COPY"; + const string REGEX_DISCTYPE = @"^\s*(?(CD_DA|CD_ROM_XA|CD_ROM|CD_I))"; + const string REGEX_EMPHASIS = @"^\s*(?NO)?\s*PRE_EMPHASIS"; const string REGEX_FILE_AUDIO = @"^\s*(AUDIO)?FILE\s*""(?.+)""\s*(#(?\d+))?\s*((?[\d]+:[\d]+:[\d]+)|(?\d+))\s*(?[\d]+:[\d]+:[\d]+)?"; const string REGEX_FILE_DATA = @@ -79,7 +79,7 @@ namespace DiscImageChef.DiscImages const string REGEX_MCN = @"^\s*CATALOG\s*""(?[\d]{13,13})"""; const string REGEX_PREGAP = @"^\s*START\s*(?
\d+:\d+:\d+)?"; const string REGEX_STEREO = @"^\s*(?(TWO|FOUR))_CHANNEL_AUDIO"; - const string REGEX_TRACK = + const string REGEX_TRACK = @"^\s*TRACK\s*(?(AUDIO|MODE1_RAW|MODE1|MODE2_FORM1|MODE2_FORM2|MODE2_FORM_MIX|MODE2_RAW|MODE2))\s*(?(RW_RAW|RW))?"; const string REGEX_ZERO_AUDIO = @"^\s*SILENCE\s*(?\d+:\d+:\d+)"; const string REGEX_ZERO_DATA = @"^\s*ZERO\s*(?\d+:\d+:\d+)"; @@ -108,7 +108,7 @@ namespace DiscImageChef.DiscImages ImageInfo imageInfo; Stream imageStream; /// Dictionary, index is track #, value is TrackFile - Dictionary offsetmap; + Dictionary offsetmap; bool separateTracksWriting; StreamReader tocStream; Dictionary trackFlags; @@ -262,7 +262,7 @@ namespace DiscImageChef.DiscImages try { imageFilter.GetDataForkStream().Seek(0, SeekOrigin.Begin); - tocStream = new StreamReader(imageFilter.GetDataForkStream()); + tocStream = new StreamReader(imageFilter.GetDataForkStream()); bool intrack = false; // Initialize all RegExs @@ -304,11 +304,11 @@ namespace DiscImageChef.DiscImages CdrdaoTrack currenttrack = new CdrdaoTrack(); uint currentTrackNumber = 0; - currenttrack.Indexes = new Dictionary(); - currenttrack.Pregap = 0; - ulong currentSector = 0; - int nextindex = 2; - StringBuilder commentBuilder = new StringBuilder(); + currenttrack.Indexes = new Dictionary(); + currenttrack.Pregap = 0; + ulong currentSector = 0; + int nextindex = 2; + StringBuilder commentBuilder = new StringBuilder(); tocStream = new StreamReader(cdrdaoFilter.GetDataForkStream()); string line; @@ -344,8 +344,8 @@ namespace DiscImageChef.DiscImages lineNumber++; line = tocStream.ReadLine(); - matchComment = regexComment.Match(line ?? throw new InvalidOperationException()); - matchDiskType = regexDiskType.Match(line); + matchComment = regexComment.Match(line ?? throw new InvalidOperationException()); + matchDiskType = regexDiskType.Match(line); Match matchMcn = regexMcn.Match(line); Match matchTrack = regexTrack.Match(line); Match matchCopy = regexCopy.Match(line); @@ -510,9 +510,8 @@ namespace DiscImageChef.DiscImages matchIndex.Groups["address"].Value); string[] lengthString = matchFile.Groups["length"].Value.Split(':'); - ulong nextIndexPos = ulong.Parse(lengthString[0]) * 60 * 75 + - ulong.Parse(lengthString[1]) * 75 + - ulong.Parse(lengthString[2]); + 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); } @@ -525,9 +524,8 @@ namespace DiscImageChef.DiscImages if(matchPregap.Groups["address"].Value != "") { string[] lengthString = matchPregap.Groups["address"].Value.Split(':'); - currenttrack.Pregap = ulong.Parse(lengthString[0]) * 60 * 75 + - ulong.Parse(lengthString[1]) * 75 + - ulong.Parse(lengthString[2]); + currenttrack.Pregap = ulong.Parse(lengthString[0]) * 60 * 75 + + ulong.Parse(lengthString[1]) * 75 + ulong.Parse(lengthString[2]); } else currenttrack.Pregap = currenttrack.Sectors; } @@ -537,8 +535,8 @@ namespace DiscImageChef.DiscImages matchZeroPregap.Groups["length"].Value); currenttrack.Indexes.Add(0, currenttrack.StartSector); string[] lengthString = matchZeroPregap.Groups["length"].Value.Split(':'); - currenttrack.Pregap = ulong.Parse(lengthString[0]) * 60 * 75 + - ulong.Parse(lengthString[1]) * 75 + ulong.Parse(lengthString[2]); + 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}", lineNumber, @@ -554,16 +552,16 @@ namespace DiscImageChef.DiscImages DicConsole.DebugWriteLine("CDRDAO plugin", "Found AUDIOFILE \"{1}\" at line {0}", lineNumber, matchAudioFile.Groups["filename"].Value); - filtersList = new FiltersList(); + filtersList = new FiltersList(); currenttrack.Trackfile = new CdrdaoTrackFile { Datafilter = filtersList.GetFilter(Path.Combine(imageFilter.GetParentFolder(), matchAudioFile.Groups["filename"].Value)), Datafile = matchAudioFile.Groups["filename"].Value, - Offset = matchAudioFile.Groups["base_offset"].Value != "" - ? ulong.Parse(matchAudioFile.Groups["base_offset"].Value) - : 0, + Offset = matchAudioFile.Groups["base_offset"].Value != "" + ? ulong.Parse(matchAudioFile.Groups["base_offset"].Value) + : 0, Filetype = "BINARY", Sequence = currentTrackNumber }; @@ -573,9 +571,8 @@ namespace DiscImageChef.DiscImages if(matchAudioFile.Groups["start"].Value != "") { string[] startString = matchAudioFile.Groups["start"].Value.Split(':'); - startSectors = ulong.Parse(startString[0]) * 60 * 75 + - ulong.Parse(startString[1]) * 75 + - ulong.Parse(startString[2]); + startSectors = ulong.Parse(startString[0]) * 60 * 75 + + ulong.Parse(startString[1]) * 75 + ulong.Parse(startString[2]); } currenttrack.Trackfile.Offset += startSectors * currenttrack.Bps; @@ -583,9 +580,9 @@ namespace DiscImageChef.DiscImages if(matchAudioFile.Groups["length"].Value != "") { string[] lengthString = matchAudioFile.Groups["length"].Value.Split(':'); - currenttrack.Sectors = ulong.Parse(lengthString[0]) * 60 * 75 + - ulong.Parse(lengthString[1]) * 75 + - ulong.Parse(lengthString[2]); + currenttrack.Sectors = ulong.Parse(lengthString[0]) * 60 * 75 + + ulong.Parse(lengthString[1]) * 75 + + ulong.Parse(lengthString[2]); } else currenttrack.Sectors = @@ -597,16 +594,16 @@ namespace DiscImageChef.DiscImages DicConsole.DebugWriteLine("CDRDAO plugin", "Found DATAFILE \"{1}\" at line {0}", lineNumber, matchFile.Groups["filename"].Value); - filtersList = new FiltersList(); + filtersList = new FiltersList(); currenttrack.Trackfile = new CdrdaoTrackFile { Datafilter = filtersList.GetFilter(Path.Combine(imageFilter.GetParentFolder(), matchFile.Groups["filename"].Value)), Datafile = matchAudioFile.Groups["filename"].Value, - Offset = matchFile.Groups["base_offset"].Value != "" - ? ulong.Parse(matchFile.Groups["base_offset"].Value) - : 0, + Offset = matchFile.Groups["base_offset"].Value != "" + ? ulong.Parse(matchFile.Groups["base_offset"].Value) + : 0, Filetype = "BINARY", Sequence = currentTrackNumber }; @@ -614,9 +611,9 @@ namespace DiscImageChef.DiscImages if(matchFile.Groups["length"].Value != "") { string[] lengthString = matchFile.Groups["length"].Value.Split(':'); - currenttrack.Sectors = ulong.Parse(lengthString[0]) * 60 * 75 + - ulong.Parse(lengthString[1]) * 75 + - ulong.Parse(lengthString[2]); + currenttrack.Sectors = ulong.Parse(lengthString[0]) * 60 * 75 + + ulong.Parse(lengthString[1]) * 75 + + ulong.Parse(lengthString[2]); } else currenttrack.Sectors = @@ -704,9 +701,8 @@ namespace DiscImageChef.DiscImages discimage.Comment = commentBuilder.ToString(); // DEBUG information - DicConsole.DebugWriteLine("CDRDAO plugin", - "Disc image parsing results"); - DicConsole.DebugWriteLine("CDRDAO plugin", "Disc CD-TEXT:"); + 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}", @@ -724,12 +720,9 @@ namespace DiscImageChef.DiscImages 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); + 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); + 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}", @@ -739,8 +732,7 @@ namespace DiscImageChef.DiscImages DicConsole.DebugWriteLine("CDRDAO plugin", "\tDisc ID: {0}", discimage.DiskId); if(discimage.Mcn == null) DicConsole.DebugWriteLine("CDRDAO plugin", "\tMCN not set."); - else - DicConsole.DebugWriteLine("CDRDAO plugin", "\tMCN: {0}", discimage.Mcn); + 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); @@ -821,7 +813,7 @@ namespace DiscImageChef.DiscImages Name = discimage.Tracks[i].Title, Start = discimage.Tracks[i].StartSector, Size = (discimage.Tracks[i].Sectors - index0Len) * discimage.Tracks[i].Bps, - Length = discimage.Tracks[i].Sectors - index0Len, + Length = discimage.Tracks[i].Sectors - index0Len, Sequence = partitionSequence, Offset = byteOffset, Type = discimage.Tracks[i].Tracktype @@ -1095,7 +1087,7 @@ namespace DiscImageChef.DiscImages byte[] buffer = new byte[sectorSize * length]; - imageStream = dicTrack.Trackfile.Datafilter.GetDataForkStream(); + imageStream = dicTrack.Trackfile.Datafilter.GetDataForkStream(); BinaryReader br = new BinaryReader(imageStream); br.BaseStream .Seek((long)dicTrack.Trackfile.Offset + (long)(sectorAddress * (sectorOffset + sectorSize + sectorSkip)), @@ -1274,7 +1266,7 @@ namespace DiscImageChef.DiscImages byte[] buffer = new byte[sectorSize * length]; - imageStream = dicTrack.Trackfile.Datafilter.GetDataForkStream(); + imageStream = dicTrack.Trackfile.Datafilter.GetDataForkStream(); BinaryReader br = new BinaryReader(imageStream); br.BaseStream .Seek((long)dicTrack.Trackfile.Offset + (long)(sectorAddress * (sectorOffset + sectorSize + sectorSkip)), @@ -1377,7 +1369,7 @@ namespace DiscImageChef.DiscImages byte[] buffer = new byte[sectorSize * length]; - imageStream = dicTrack.Trackfile.Datafilter.GetDataForkStream(); + imageStream = dicTrack.Trackfile.Datafilter.GetDataForkStream(); BinaryReader br = new BinaryReader(imageStream); br.BaseStream @@ -1432,14 +1424,14 @@ namespace DiscImageChef.DiscImages return CdChecksums.CheckCdSector(buffer); } - public bool? VerifySectors(ulong sectorAddress, uint length, out List failingLbas, - out List unknownLbas) + public bool? VerifySectors(ulong sectorAddress, uint length, out List failingLbas, + out List unknownLbas) { byte[] buffer = ReadSectorsLong(sectorAddress, length); int bps = (int)(buffer.Length / length); byte[] sector = new byte[bps]; - failingLbas = new List(); - unknownLbas = new List(); + failingLbas = new List(); + unknownLbas = new List(); for(int i = 0; i < length; i++) { @@ -1462,14 +1454,14 @@ namespace DiscImageChef.DiscImages return failingLbas.Count <= 0; } - public bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List failingLbas, - out List unknownLbas) + public 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); byte[] sector = new byte[bps]; - failingLbas = new List(); - unknownLbas = new List(); + failingLbas = new List(); + unknownLbas = new List(); for(int i = 0; i < length; i++) { @@ -1501,7 +1493,7 @@ namespace DiscImageChef.DiscImages public CICMMetadataType CicmMetadata => null; // TODO: Decode CD-Text to text - public IEnumerable SupportedMediaTags => new[] {MediaTagType.CD_MCN}; + public IEnumerable SupportedMediaTags => new[] {MediaTagType.CD_MCN}; public IEnumerable SupportedSectorTags => new[] { @@ -1642,12 +1634,12 @@ namespace DiscImageChef.DiscImages for(long i = 0; i < swapped.Length; i += 2) { swapped[i] = data[i + 1]; - swapped[i + 1] = data[i]; + swapped[i + 1] = data[i]; } data = swapped; } - + trackStream.Seek((long)(track.TrackFileOffset + (sectorAddress - track.TrackStartSector) * (ulong)track.TrackRawBytesPerSector), SeekOrigin.Begin); trackStream.Write(data, 0, data.Length); @@ -1772,7 +1764,7 @@ namespace DiscImageChef.DiscImages ErrorMessage = "Incorrect data size"; return false; } - + // cdrdao audio tracks are endian swapped corresponding to DiscImageChef if(track.TrackType == TrackType.Audio) { @@ -1832,7 +1824,7 @@ namespace DiscImageChef.DiscImages ErrorMessage = "Incorrect data size"; return false; } - + // cdrdao audio tracks are endian swapped corresponding to DiscImageChef if(track.TrackType == TrackType.Audio) { @@ -1877,7 +1869,7 @@ namespace DiscImageChef.DiscImages oldTrack.Close(); ulong currentOffset = 0; - writingTracks = new List(); + writingTracks = new List(); foreach(Track track in tracks.OrderBy(t => t.TrackSequence)) { if(track.TrackSubchannelType == TrackSubchannelType.Q16 || @@ -1888,7 +1880,7 @@ namespace DiscImageChef.DiscImages return false; } - Track newTrack = track; + Track newTrack = track; newTrack.TrackFile = separateTracksWriting ? writingBaseName + $"_track{track.TrackSequence:D2}.bin" : writingBaseName + ".bin"; @@ -1937,16 +1929,14 @@ namespace DiscImageChef.DiscImages writingStreams.First().Value.Close(); } - bool data = writingTracks.Count(t => t.TrackType != TrackType.Audio) > 0; + bool data = writingTracks.Count(t => t.TrackType != TrackType.Audio) > 0; bool mode2 = writingTracks.Count(t => t.TrackType == TrackType.CdMode2Form1 || t.TrackType == TrackType.CdMode2Form2 || t.TrackType == TrackType.CdMode2Formless) > 0; if(mode2) descriptorStream.WriteLine("CD_ROM_XA"); - else if(data) - descriptorStream.WriteLine("CD_ROM"); - else - descriptorStream.WriteLine("CD_DA"); + else if(data) descriptorStream.WriteLine("CD_ROM"); + else descriptorStream.WriteLine("CD_DA"); if(!string.IsNullOrWhiteSpace(discimage.Comment)) { @@ -2004,7 +1994,7 @@ namespace DiscImageChef.DiscImages descriptorStream.WriteLine("DATAFILE \"{0}\" #{1} {2:D2}:{3:D2}:{4:D2} // length in bytes: {5}", Path.GetFileName(track.TrackFile), track.TrackFileOffset, msf.minute, msf.second, msf.frame, - (track.TrackEndSector - track.TrackStartSector + 1) * + (track.TrackEndSector - track.TrackStartSector + 1) * (ulong)(track.TrackRawBytesPerSector + (track.TrackSubchannelType != TrackSubchannelType.None ? 96 : 0))); @@ -2190,7 +2180,7 @@ namespace DiscImageChef.DiscImages case CDRDAO_TRACK_TYPE_AUDIO: case CDRDAO_TRACK_TYPE_MODE1_RAW: case CDRDAO_TRACK_TYPE_MODE2_RAW: return 2352; - default: return 0; + default: return 0; } } @@ -2200,13 +2190,13 @@ namespace DiscImageChef.DiscImages { case CDRDAO_TRACK_TYPE_MODE1: case CDRDAO_TRACK_TYPE_MODE2_FORM1: - case CDRDAO_TRACK_TYPE_MODE1_RAW: return 2048; + case CDRDAO_TRACK_TYPE_MODE1_RAW: return 2048; case CDRDAO_TRACK_TYPE_MODE2_FORM2: return 2324; case CDRDAO_TRACK_TYPE_MODE2: case CDRDAO_TRACK_TYPE_MODE2_MIX: case CDRDAO_TRACK_TYPE_MODE2_RAW: return 2336; - case CDRDAO_TRACK_TYPE_AUDIO: return 2352; - default: return 0; + case CDRDAO_TRACK_TYPE_AUDIO: return 2352; + default: return 0; } } @@ -2215,14 +2205,14 @@ namespace DiscImageChef.DiscImages switch(trackType) { case CDRDAO_TRACK_TYPE_MODE1: - case CDRDAO_TRACK_TYPE_MODE1_RAW: return TrackType.CdMode1; + case CDRDAO_TRACK_TYPE_MODE1_RAW: return TrackType.CdMode1; case CDRDAO_TRACK_TYPE_MODE2_FORM1: return TrackType.CdMode2Form1; case CDRDAO_TRACK_TYPE_MODE2_FORM2: return TrackType.CdMode2Form2; case CDRDAO_TRACK_TYPE_MODE2: case CDRDAO_TRACK_TYPE_MODE2_MIX: case CDRDAO_TRACK_TYPE_MODE2_RAW: return TrackType.CdMode2Formless; - case CDRDAO_TRACK_TYPE_AUDIO: return TrackType.Audio; - default: return TrackType.Data; + case CDRDAO_TRACK_TYPE_AUDIO: return TrackType.Audio; + default: return TrackType.Data; } } @@ -2235,22 +2225,19 @@ namespace DiscImageChef.DiscImages { switch(track.TrackType) { - case TrackType.Audio when track.TrackRawBytesPerSector == 2352: - return CDRDAO_TRACK_TYPE_AUDIO; - case TrackType.Data: - return CDRDAO_TRACK_TYPE_MODE1; - case TrackType.CdMode1 when track.TrackRawBytesPerSector == 2352: - return CDRDAO_TRACK_TYPE_MODE1_RAW; - case TrackType.CdMode2Formless when track.TrackRawBytesPerSector != 2352: - return CDRDAO_TRACK_TYPE_MODE2; - case TrackType.CdMode2Form1 when track.TrackRawBytesPerSector != 2352: - return CDRDAO_TRACK_TYPE_MODE2_FORM1; - case TrackType.CdMode2Form2 when track.TrackRawBytesPerSector != 2352: - return CDRDAO_TRACK_TYPE_MODE2_FORM2; + case TrackType.Audio when track.TrackRawBytesPerSector == 2352: return CDRDAO_TRACK_TYPE_AUDIO; + case TrackType.Data: return CDRDAO_TRACK_TYPE_MODE1; + case TrackType.CdMode1 when track.TrackRawBytesPerSector == 2352: return CDRDAO_TRACK_TYPE_MODE1_RAW; + case TrackType.CdMode2Formless + when track.TrackRawBytesPerSector != 2352: return CDRDAO_TRACK_TYPE_MODE2; + case TrackType.CdMode2Form1 + when track.TrackRawBytesPerSector != 2352: return CDRDAO_TRACK_TYPE_MODE2_FORM1; + case TrackType.CdMode2Form2 + when track.TrackRawBytesPerSector != 2352: return CDRDAO_TRACK_TYPE_MODE2_FORM2; case TrackType.CdMode2Formless when track.TrackRawBytesPerSector == 2352: case TrackType.CdMode2Form1 when track.TrackRawBytesPerSector == 2352: - case TrackType.CdMode2Form2 when track.TrackRawBytesPerSector == 2352: - return CDRDAO_TRACK_TYPE_MODE2_RAW; + case TrackType.CdMode2Form2 + when track.TrackRawBytesPerSector == 2352: return CDRDAO_TRACK_TYPE_MODE2_RAW; default: return CDRDAO_TRACK_TYPE_MODE1; } } @@ -2314,8 +2301,8 @@ namespace DiscImageChef.DiscImages public ulong StartSector; /// Track type public string Tracktype; - public bool Subchannel; - public bool Packedsubchannel; + public bool Subchannel; + public bool Packedsubchannel; } [SuppressMessage("ReSharper", "NotAccessedField.Local")] diff --git a/DiscImageChef.DiscImages/CDRWin.cs b/DiscImageChef.DiscImages/CDRWin.cs index bc5825ce6..7d2d0ea20 100644 --- a/DiscImageChef.DiscImages/CDRWin.cs +++ b/DiscImageChef.DiscImages/CDRWin.cs @@ -179,7 +179,7 @@ namespace DiscImageChef.DiscImages Stream imageStream; /// Dictionary, index is track #, value is TrackFile Dictionary offsetmap; - bool separateTracksWriting; + bool separateTracksWriting; Dictionary trackFlags; Dictionary trackIsrcs; @@ -340,7 +340,7 @@ namespace DiscImageChef.DiscImages try { imageFilter.GetDataForkStream().Seek(0, SeekOrigin.Begin); - cueStream = new StreamReader(imageFilter.GetDataForkStream()); + cueStream = new StreamReader(imageFilter.GetDataForkStream()); int lineNumber = 0; bool intrack = false; byte currentsession = 1; @@ -453,7 +453,7 @@ namespace DiscImageChef.DiscImages } else { - matchTrack = regexTrack.Match(line); + matchTrack = regexTrack.Match(line); Match matchTitle = regexTitle.Match(line); Match matchSongWriter = regexSongWriter.Match(line); Match matchPregap = regexPregap.Match(line); @@ -515,7 +515,7 @@ namespace DiscImageChef.DiscImages { currentfile.Sequence = currenttrack.Sequence; currenttrack.Trackfile = currentfile; - currenttrack.Sectors = + currenttrack.Sectors = ((ulong)currentfile.Datafilter.GetLength() - currentfile.Offset) / CdrWinTrackTypeToBytesPerSector(currenttrack.Tracktype); cuetracks[currenttrack.Sequence - 1] = currenttrack; @@ -526,7 +526,7 @@ namespace DiscImageChef.DiscImages } //currentfile = new CDRWinTrackFile(); - string datafile = matchFile.Groups[1].Value; + string datafile = matchFile.Groups[1].Value; currentfile.Filetype = matchFile.Groups[2].Value; // Check if file path is quoted @@ -537,8 +537,7 @@ namespace DiscImageChef.DiscImages // 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); @@ -591,8 +590,7 @@ namespace DiscImageChef.DiscImages } else { - string path = - imageFilter.GetParentFolder() + Path.PathSeparator + datafile; + string path = imageFilter.GetParentFolder() + Path.PathSeparator + datafile; currentfile.Datafilter = filtersList.GetFilter(path); if(currentfile.Datafilter == null) @@ -652,16 +650,14 @@ namespace DiscImageChef.DiscImages throw new FeatureUnsupportedImageException($"Found INDEX {index} before INDEX 00 or INDEX 01"); - if(index == 0 || - index == 1 && !currenttrack.Indexes.ContainsKey(0)) + 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 += + currentfile.Offset += cuetracks[currenttrack.Sequence - 2].Sectors * cuetracks[currenttrack.Sequence - 2].Bps; - DicConsole.DebugWriteLine("CDRWin plugin", - "Sets currentfile.offset to {0}", + DicConsole.DebugWriteLine("CDRWin plugin", "Sets currentfile.offset to {0}", currentfile.Offset); DicConsole.DebugWriteLine("CDRWin plugin", "cuetracks[currenttrack.sequence-2].sectors = {0}", @@ -671,12 +667,12 @@ namespace DiscImageChef.DiscImages cuetracks[currenttrack.Sequence - 2].Bps); } - if((index == 0 || index == 1 && !currenttrack.Indexes.ContainsKey(0)) && + if((index == 0 || index == 1 && !currenttrack.Indexes.ContainsKey(0)) && currenttrack.Sequence == 1) { DicConsole.DebugWriteLine("CDRWin plugin", "Sets currentfile.offset to {0}", offset * currenttrack.Bps); - currentfile.Offset = offset * currenttrack.Bps; + currentfile.Offset = offset * currenttrack.Bps; } currentfileoffsetsector = offset; @@ -773,8 +769,8 @@ namespace DiscImageChef.DiscImages { 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; } @@ -789,11 +785,11 @@ namespace DiscImageChef.DiscImages ulong sessionSectors = 0; int lastSessionTrack = 0; - for(int i = 0; i < cuetracks.Length; i++) + for(int i = 0; i < cuetracks.Length; i++) if(cuetracks[i].Session == s) { - sessionSectors += cuetracks[i].Sectors; - if(i > lastSessionTrack) lastSessionTrack = i; + sessionSectors += cuetracks[i].Sectors; + if(i > lastSessionTrack) lastSessionTrack = i; } sessions[s - 1].EndTrack = cuetracks[lastSessionTrack].Sequence; @@ -849,24 +845,18 @@ namespace DiscImageChef.DiscImages } if(!data && !firstdata) discimage.Disktype = MediaType.CDDA; - else if(cdg) - discimage.Disktype = MediaType.CDG; - else if(cdi) - discimage.Disktype = MediaType.CDI; + 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; + 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; } // DEBUG information - DicConsole.DebugWriteLine("CDRWin plugin", - "Disc image parsing results"); - DicConsole.DebugWriteLine("CDRWin plugin", "Disc CD-TEXT:"); + 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}", @@ -876,9 +866,7 @@ namespace DiscImageChef.DiscImages 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); + 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}", @@ -888,21 +876,15 @@ namespace DiscImageChef.DiscImages 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); + 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); - DicConsole.DebugWriteLine("CDRWin plugin", "Disc information:"); + 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); - DicConsole.DebugWriteLine("CDRWin plugin", "\tGuessed disk type: {0}", - discimage.Disktype); + DicConsole.DebugWriteLine("CDRWin plugin", "\tISOBuster disc type not set."); + 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}", @@ -911,15 +893,14 @@ namespace DiscImageChef.DiscImages else DicConsole.DebugWriteLine("CDRWin plugin", "\tDisc ID: {0}", discimage.DiskId); - if(discimage.Mcn == null) DicConsole.DebugWriteLine("CDRWin plugin", "\tMCN not set."); - else DicConsole.DebugWriteLine("CDRWin plugin", "\tMCN: {0}", discimage.Mcn); + 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); + 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); @@ -949,8 +930,7 @@ namespace DiscImageChef.DiscImages if(discimage.Tracks[i].FlagDcp) DicConsole.DebugWriteLine("CDRWin plugin", "\t\tTrack allows digital copy"); if(discimage.Tracks[i].FlagPre) - DicConsole.DebugWriteLine("CDRWin plugin", - "\t\tTrack has pre-emphasis applied"); + DicConsole.DebugWriteLine("CDRWin plugin", "\t\tTrack has pre-emphasis applied"); if(discimage.Tracks[i].FlagScms) DicConsole.DebugWriteLine("CDRWin plugin", "\t\tTrack has SCMS"); DicConsole.DebugWriteLine("CDRWin plugin", @@ -1090,7 +1070,7 @@ namespace DiscImageChef.DiscImages partition.Name = discimage.Tracks[i].Title; partition.Start = sectorOffset; partition.Size = (discimage.Tracks[i].Sectors - index0Len) * discimage.Tracks[i].Bps; - partition.Length = discimage.Tracks[i].Sectors - index0Len; + partition.Length = discimage.Tracks[i].Sectors - index0Len; partition.Sequence = partitionSequence; partition.Offset = byteOffset; partition.Type = discimage.Tracks[i].Tracktype; @@ -1388,7 +1368,7 @@ namespace DiscImageChef.DiscImages byte[] buffer = new byte[sectorSize * length]; - imageStream = dicTrack.Trackfile.Datafilter.GetDataForkStream(); + imageStream = dicTrack.Trackfile.Datafilter.GetDataForkStream(); BinaryReader br = new BinaryReader(imageStream); br.BaseStream .Seek((long)dicTrack.Trackfile.Offset + (long)(sectorAddress * (sectorOffset + sectorSize + sectorSkip)), @@ -1572,7 +1552,7 @@ namespace DiscImageChef.DiscImages byte[] buffer = new byte[sectorSize * length]; - imageStream = dicTrack.Trackfile.Datafilter.GetDataForkStream(); + imageStream = dicTrack.Trackfile.Datafilter.GetDataForkStream(); BinaryReader br = new BinaryReader(imageStream); br.BaseStream .Seek((long)dicTrack.Trackfile.Offset + (long)(sectorAddress * (sectorOffset + sectorSize + sectorSkip)), @@ -1681,7 +1661,7 @@ namespace DiscImageChef.DiscImages byte[] buffer = new byte[sectorSize * length]; - imageStream = dicTrack.Trackfile.Datafilter.GetDataForkStream(); + imageStream = dicTrack.Trackfile.Datafilter.GetDataForkStream(); BinaryReader br = new BinaryReader(imageStream); br.BaseStream @@ -1762,14 +1742,14 @@ namespace DiscImageChef.DiscImages return CdChecksums.CheckCdSector(buffer); } - public bool? VerifySectors(ulong sectorAddress, uint length, out List failingLbas, - out List unknownLbas) + public bool? VerifySectors(ulong sectorAddress, uint length, out List failingLbas, + out List unknownLbas) { byte[] buffer = ReadSectorsLong(sectorAddress, length); int bps = (int)(buffer.Length / length); byte[] sector = new byte[bps]; - failingLbas = new List(); - unknownLbas = new List(); + failingLbas = new List(); + unknownLbas = new List(); for(int i = 0; i < length; i++) { @@ -1792,14 +1772,14 @@ namespace DiscImageChef.DiscImages return failingLbas.Count <= 0; } - public bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List failingLbas, - out List unknownLbas) + public 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); byte[] sector = new byte[bps]; - failingLbas = new List(); - unknownLbas = new List(); + failingLbas = new List(); + unknownLbas = new List(); for(int i = 0; i < length; i++) { @@ -1830,7 +1810,7 @@ namespace DiscImageChef.DiscImages public List DumpHardware => null; public CICMMetadataType CicmMetadata => null; - public IEnumerable SupportedMediaTags => new[] {MediaTagType.CD_MCN, MediaTagType.CD_TEXT}; + public IEnumerable SupportedMediaTags => new[] {MediaTagType.CD_MCN, MediaTagType.CD_TEXT}; public IEnumerable SupportedSectorTags => new[] { @@ -2143,10 +2123,10 @@ namespace DiscImageChef.DiscImages oldTrack.Close(); ulong currentOffset = 0; - writingTracks = new List(); + writingTracks = new List(); foreach(Track track in tracks.OrderBy(t => t.TrackSequence)) { - Track newTrack = track; + Track newTrack = track; newTrack.TrackFile = separateTracksWriting ? writingBaseName + $"_track{track.TrackSequence:D2}.bin" : writingBaseName + ".bin"; @@ -2348,7 +2328,7 @@ namespace DiscImageChef.DiscImages case CDRWIN_TRACK_TYPE_MODE2_RAW: case CDRWIN_TRACK_TYPE_CDG: case CDRWIN_TRACK_TYPE_CDI_RAW: return 2352; - default: return 0; + default: return 0; } } @@ -2358,7 +2338,7 @@ namespace DiscImageChef.DiscImages { case CDRWIN_TRACK_TYPE_MODE1: case CDRWIN_TRACK_TYPE_MODE2_FORM1: - case CDRWIN_TRACK_TYPE_MODE1_RAW: return 2048; + case CDRWIN_TRACK_TYPE_MODE1_RAW: return 2048; case CDRWIN_TRACK_TYPE_MODE2_FORM2: return 2324; case CDRWIN_TRACK_TYPE_MODE2_FORMLESS: case CDRWIN_TRACK_TYPE_CDI: @@ -2366,7 +2346,7 @@ namespace DiscImageChef.DiscImages case CDRWIN_TRACK_TYPE_CDI_RAW: return 2336; case CDRWIN_TRACK_TYPE_CDG: case CDRWIN_TRACK_TYPE_AUDIO: return 2352; - default: return 0; + default: return 0; } } @@ -2375,7 +2355,7 @@ namespace DiscImageChef.DiscImages switch(trackType) { case CDRWIN_TRACK_TYPE_MODE1: - case CDRWIN_TRACK_TYPE_MODE1_RAW: return TrackType.CdMode1; + case CDRWIN_TRACK_TYPE_MODE1_RAW: return TrackType.CdMode1; case CDRWIN_TRACK_TYPE_MODE2_FORM1: return TrackType.CdMode2Form1; case CDRWIN_TRACK_TYPE_MODE2_FORM2: return TrackType.CdMode2Form2; case CDRWIN_TRACK_TYPE_CDI_RAW: @@ -2384,7 +2364,7 @@ namespace DiscImageChef.DiscImages case CDRWIN_TRACK_TYPE_MODE2_FORMLESS: return TrackType.CdMode2Formless; case CDRWIN_TRACK_TYPE_AUDIO: case CDRWIN_TRACK_TYPE_CDG: return TrackType.Audio; - default: return TrackType.Data; + default: return TrackType.Data; } } @@ -2396,7 +2376,7 @@ namespace DiscImageChef.DiscImages case CDRWIN_DISK_TYPE_CDRW: case CDRWIN_DISK_TYPE_CDMRW: case CDRWIN_DISK_TYPE_CDMRW2: return MediaType.CDRW; - case CDRWIN_DISK_TYPE_DVD: return MediaType.DVDROM; + case CDRWIN_DISK_TYPE_DVD: return MediaType.DVDROM; case CDRWIN_DISK_TYPE_DVDPRW: case CDRWIN_DISK_TYPE_DVDPMRW: case CDRWIN_DISK_TYPE_DVDPMRW2: return MediaType.DVDPRW; @@ -2404,27 +2384,27 @@ namespace DiscImageChef.DiscImages case CDRWIN_DISK_TYPE_DVDPMRWDL: case CDRWIN_DISK_TYPE_DVDPMRWDL2: return MediaType.DVDPRWDL; case CDRWIN_DISK_TYPE_DVDPR: - case CDRWIN_DISK_TYPE_DVDPVR: return MediaType.DVDPR; + case CDRWIN_DISK_TYPE_DVDPVR: return MediaType.DVDPR; case CDRWIN_DISK_TYPE_DVDPRDL: return MediaType.DVDPRDL; case CDRWIN_DISK_TYPE_DVDRAM: return MediaType.DVDRAM; case CDRWIN_DISK_TYPE_DVDVR: - case CDRWIN_DISK_TYPE_DVDR: return MediaType.DVDR; + case CDRWIN_DISK_TYPE_DVDR: return MediaType.DVDR; case CDRWIN_DISK_TYPE_DVDRDL: return MediaType.DVDRDL; case CDRWIN_DISK_TYPE_DVDRW: case CDRWIN_DISK_TYPE_DVDRWDL: - case CDRWIN_DISK_TYPE_DVDRW2: return MediaType.DVDRW; + case CDRWIN_DISK_TYPE_DVDRW2: return MediaType.DVDRW; case CDRWIN_DISK_TYPE_HDDVD: return MediaType.HDDVDROM; case CDRWIN_DISK_TYPE_HDDVDRAM: return MediaType.HDDVDRAM; case CDRWIN_DISK_TYPE_HDDVDR: case CDRWIN_DISK_TYPE_HDDVDRDL: return MediaType.HDDVDR; case CDRWIN_DISK_TYPE_HDDVDRW: case CDRWIN_DISK_TYPE_HDDVDRWDL: return MediaType.HDDVDRW; - case CDRWIN_DISK_TYPE_BD: return MediaType.BDROM; + case CDRWIN_DISK_TYPE_BD: return MediaType.BDROM; case CDRWIN_DISK_TYPE_BDR: case CDRWIN_DISK_TYPE_BDRDL: return MediaType.BDR; case CDRWIN_DISK_TYPE_BDRE: case CDRWIN_DISK_TYPE_BDREDL: return MediaType.BDRE; - default: return MediaType.Unknown; + default: return MediaType.Unknown; } } @@ -2437,22 +2417,19 @@ namespace DiscImageChef.DiscImages { switch(track.TrackType) { - case TrackType.Audio when track.TrackRawBytesPerSector == 2352: - return CDRWIN_TRACK_TYPE_AUDIO; - case TrackType.Data: - return CDRWIN_TRACK_TYPE_MODE1; - case TrackType.CdMode1 when track.TrackRawBytesPerSector == 2352: - return CDRWIN_TRACK_TYPE_MODE1_RAW; - case TrackType.CdMode2Formless when track.TrackRawBytesPerSector != 2352: - return CDRWIN_TRACK_TYPE_MODE2_FORMLESS; - case TrackType.CdMode2Form1 when track.TrackRawBytesPerSector != 2352: - return CDRWIN_TRACK_TYPE_MODE2_FORM1; - case TrackType.CdMode2Form2 when track.TrackRawBytesPerSector != 2352: - return CDRWIN_TRACK_TYPE_MODE2_FORM2; + case TrackType.Audio when track.TrackRawBytesPerSector == 2352: return CDRWIN_TRACK_TYPE_AUDIO; + case TrackType.Data: return CDRWIN_TRACK_TYPE_MODE1; + case TrackType.CdMode1 when track.TrackRawBytesPerSector == 2352: return CDRWIN_TRACK_TYPE_MODE1_RAW; + case TrackType.CdMode2Formless + when track.TrackRawBytesPerSector != 2352: return CDRWIN_TRACK_TYPE_MODE2_FORMLESS; + case TrackType.CdMode2Form1 + when track.TrackRawBytesPerSector != 2352: return CDRWIN_TRACK_TYPE_MODE2_FORM1; + case TrackType.CdMode2Form2 + when track.TrackRawBytesPerSector != 2352: return CDRWIN_TRACK_TYPE_MODE2_FORM2; case TrackType.CdMode2Formless when track.TrackRawBytesPerSector == 2352: case TrackType.CdMode2Form1 when track.TrackRawBytesPerSector == 2352: - case TrackType.CdMode2Form2 when track.TrackRawBytesPerSector == 2352: - return CDRWIN_TRACK_TYPE_MODE2_RAW; + case TrackType.CdMode2Form2 + when track.TrackRawBytesPerSector == 2352: return CDRWIN_TRACK_TYPE_MODE2_RAW; default: return CDRWIN_TRACK_TYPE_MODE1; } } @@ -2499,7 +2476,7 @@ namespace DiscImageChef.DiscImages case MediaType.SATURNCD: case MediaType.ThreeDO: case MediaType.VCD: - case MediaType.VCDHD: return CDRWIN_DISK_TYPE_CD; + case MediaType.VCDHD: return CDRWIN_DISK_TYPE_CD; case MediaType.CDMRW: return CDRWIN_DISK_TYPE_CDMRW; case MediaType.CDRW: return CDRWIN_DISK_TYPE_CDRW; case MediaType.DVDPR: return CDRWIN_DISK_TYPE_DVDPR; @@ -2513,7 +2490,7 @@ namespace DiscImageChef.DiscImages case MediaType.DVDROM: case MediaType.UMD: case MediaType.PS2DVD: - case MediaType.PS3DVD: return CDRWIN_DISK_TYPE_DVD; + case MediaType.PS3DVD: return CDRWIN_DISK_TYPE_DVD; case MediaType.DVDRW: return CDRWIN_DISK_TYPE_DVDRW; case MediaType.DVDRWDL: return CDRWIN_DISK_TYPE_DVDRWDL; case MediaType.HDDVDR: return CDRWIN_DISK_TYPE_HDDVDR; diff --git a/DiscImageChef.DiscImages/CHD.cs b/DiscImageChef.DiscImages/CHD.cs index a13ba985d..904dbebfc 100644 --- a/DiscImageChef.DiscImages/CHD.cs +++ b/DiscImageChef.DiscImages/CHD.cs @@ -105,7 +105,7 @@ namespace DiscImageChef.DiscImages const int MAX_CACHE_SIZE = 16777216; /// "MComprHD" - readonly byte[] chdTag = {0x4D, 0x43, 0x6F, 0x6D, 0x70, 0x72, 0x48, 0x44}; + readonly byte[] chdTag = {0x4D, 0x43, 0x6F, 0x6D, 0x70, 0x72, 0x48, 0x44}; uint bytesPerHunk; byte[] cis; byte[] expectedChecksum; @@ -224,7 +224,7 @@ namespace DiscImageChef.DiscImages byte[] buffer = new byte[4]; stream.Read(buffer, 0, 4); uint length = BitConverter.ToUInt32(buffer.Reverse().ToArray(), 0); - buffer = new byte[4]; + buffer = new byte[4]; stream.Read(buffer, 0, 4); uint version = BitConverter.ToUInt32(buffer.Reverse().ToArray(), 0); @@ -273,14 +273,14 @@ namespace DiscImageChef.DiscImages 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); + GCHandle handle = GCHandle.Alloc(hunkSectorBytes, GCHandleType.Pinned); HunkSector 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); + 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); } @@ -346,14 +346,14 @@ namespace DiscImageChef.DiscImages 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); + GCHandle handle = GCHandle.Alloc(hunkSectorBytes, GCHandleType.Pinned); HunkSector 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); + 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); } @@ -527,18 +527,18 @@ namespace DiscImageChef.DiscImages 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); + GCHandle handle = GCHandle.Alloc(hunkSectorBytes, GCHandleType.Pinned); HunkSectorSmall 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); + 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); + hunkTableSmall.Length - i * 512 / 4); } DateTime end = DateTime.UtcNow; @@ -707,7 +707,7 @@ namespace DiscImageChef.DiscImages } dicTrack.Indexes = new Dictionary(); - dicTrack.TrackDescription = $"Track {i + 1}"; + dicTrack.TrackDescription = $"Track {i + 1}"; dicTrack.TrackEndSector = currentSector + chdTrack.frames - 1; dicTrack.TrackFile = imageFilter.GetFilename(); dicTrack.TrackFileType = "BINARY"; @@ -1128,21 +1128,20 @@ namespace DiscImageChef.DiscImages foreach(Track dicTrack in tracks.Values) imageInfo.Sectors += dicTrack.TrackEndSector - dicTrack.TrackStartSector + 1; } - else - throw new ImageNotSupportedException("Image does not represent a known media, aborting"); + else throw new ImageNotSupportedException("Image does not represent a known media, aborting"); } if(isCdrom || isGdrom) { - offsetmap = new Dictionary(); - partitions = new List(); + offsetmap = new Dictionary(); + partitions = new List(); ulong partPos = 0; foreach(Track dicTrack in tracks.Values) { Partition partition = new Partition { Description = dicTrack.TrackDescription, - Size = + Size = (dicTrack.TrackEndSector - dicTrack.TrackStartSector + 1) * (ulong)dicTrack.TrackRawBytesPerSector, Length = dicTrack.TrackEndSector - dicTrack.TrackStartSector + 1, @@ -1248,8 +1247,8 @@ namespace DiscImageChef.DiscImages return VerifySector(GetAbsoluteSector(sectorAddress, track)); } - public bool? VerifySectors(ulong sectorAddress, uint length, out List failingLbas, - out List unknownLbas) + public bool? VerifySectors(ulong sectorAddress, uint length, out List failingLbas, + out List unknownLbas) { unknownLbas = new List(); failingLbas = new List(); @@ -1280,8 +1279,8 @@ namespace DiscImageChef.DiscImages return failingLbas.Count <= 0; } - public bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List failingLbas, - out List unknownLbas) + public bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List failingLbas, + out List unknownLbas) { unknownLbas = new List(); failingLbas = new List(); @@ -1354,7 +1353,7 @@ namespace DiscImageChef.DiscImages sectorSize = (uint)track.TrackRawBytesPerSector; } - ulong hunkNo = sectorAddress / sectorsPerHunk; + ulong hunkNo = sectorAddress / sectorsPerHunk; ulong secOff = sectorAddress * sectorSize % (sectorsPerHunk * sectorSize); byte[] hunk = GetHunk(hunkNo); @@ -1430,7 +1429,7 @@ namespace DiscImageChef.DiscImages byte[] buffer = new byte[sectorSize]; - if(track.TrackType == TrackType.Audio && swapAudio) + if(track.TrackType == TrackType.Audio && swapAudio) for(int i = 0; i < 2352; i += 2) { buffer[i + 1] = sector[i]; @@ -1458,7 +1457,7 @@ namespace DiscImageChef.DiscImages track = GetTrack(sectorAddress); sectorSize = (uint)track.TrackRawBytesPerSector; - ulong hunkNo = sectorAddress / sectorsPerHunk; + ulong hunkNo = sectorAddress / sectorsPerHunk; ulong secOff = sectorAddress * sectorSize % (sectorsPerHunk * sectorSize); byte[] hunk = GetHunk(hunkNo); @@ -1638,7 +1637,7 @@ namespace DiscImageChef.DiscImages byte[] buffer = new byte[sectorSize]; - if(track.TrackType == TrackType.Audio && swapAudio) + if(track.TrackType == TrackType.Audio && swapAudio) for(int i = 0; i < 2352; i += 2) { buffer[i + 1] = sector[i]; @@ -1646,7 +1645,7 @@ namespace DiscImageChef.DiscImages } else Array.Copy(sector, sectorOffset, buffer, 0, sectorSize); - if(track.TrackType == TrackType.Audio && swapAudio) + if(track.TrackType == TrackType.Audio && swapAudio) for(int i = 0; i < 2352; i += 2) { buffer[i + 1] = sector[i]; @@ -1711,10 +1710,10 @@ namespace DiscImageChef.DiscImages if(!sectorCache.TryGetValue(sectorAddress, out byte[] sector)) { - track = GetTrack(sectorAddress); + track = GetTrack(sectorAddress); uint sectorSize = (uint)track.TrackRawBytesPerSector; - ulong hunkNo = sectorAddress / sectorsPerHunk; + ulong hunkNo = sectorAddress / sectorsPerHunk; ulong secOff = sectorAddress * sectorSize % (sectorsPerHunk * sectorSize); byte[] hunk = GetHunk(hunkNo); @@ -1729,7 +1728,7 @@ namespace DiscImageChef.DiscImages byte[] buffer = new byte[track.TrackRawBytesPerSector]; - if(track.TrackType == TrackType.Audio && swapAudio) + if(track.TrackType == TrackType.Audio && swapAudio) for(int i = 0; i < 2352; i += 2) { buffer[i + 1] = sector[i]; @@ -1871,9 +1870,9 @@ namespace DiscImageChef.DiscImages { DeflateStream zStream = new DeflateStream(new MemoryStream(compHunk), CompressionMode.Decompress); - hunk = new byte[sectorsPerHunk * imageInfo.SectorSize]; + hunk = new byte[sectorsPerHunk * imageInfo.SectorSize]; int read = zStream.Read(hunk, 0, (int)(sectorsPerHunk * imageInfo.SectorSize)); - if(read != sectorsPerHunk * imageInfo.SectorSize) + if(read != sectorsPerHunk * imageInfo.SectorSize) throw new IOException($"Unable to decompress hunk correctly, got {read} bytes, expected {sectorsPerHunk * imageInfo.SectorSize}"); @@ -1901,7 +1900,7 @@ namespace DiscImageChef.DiscImages imageStream.Read(zHunk, 0, zHunk.Length); DeflateStream zStream = new DeflateStream(new MemoryStream(zHunk), CompressionMode.Decompress); - hunk = new byte[bytesPerHunk]; + hunk = new byte[bytesPerHunk]; int read = zStream.Read(hunk, 0, (int)bytesPerHunk); if(read != bytesPerHunk) throw new @@ -1930,8 +1929,7 @@ namespace DiscImageChef.DiscImages case Chdv3EntryFlags.Mini: hunk = new byte[bytesPerHunk]; byte[] mini; - mini = - BigEndianBitConverter.GetBytes(entry.offset); + mini = BigEndianBitConverter.GetBytes(entry.offset); for(int i = 0; i < bytesPerHunk; i++) hunk[i] = mini[i % 8]; break; diff --git a/DiscImageChef.DiscImages/CPCDSK.cs b/DiscImageChef.DiscImages/CPCDSK.cs index 1688a6161..a0648368e 100644 --- a/DiscImageChef.DiscImages/CPCDSK.cs +++ b/DiscImageChef.DiscImages/CPCDSK.cs @@ -73,7 +73,7 @@ namespace DiscImageChef.DiscImages /// /// Identifier for track information, "Track-Info\r\n" /// - 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}; Dictionary addressMarks; bool extended; @@ -169,8 +169,8 @@ namespace DiscImageChef.DiscImages 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); + 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); else for(int i = 0; i < header.tracks; i++) @@ -180,9 +180,9 @@ namespace DiscImageChef.DiscImages header.tracksizeTable[i * header.sides + j] * 256); } - ulong currentSector = 0; - sectors = new Dictionary(); - addressMarks = new Dictionary(); + ulong currentSector = 0; + sectors = new Dictionary(); + addressMarks = new Dictionary(); ulong readtracks = 0; bool allTracksSameSize = true; ulong sectorsPerTrack = 0; @@ -230,7 +230,7 @@ namespace DiscImageChef.DiscImages 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(trackInfo.sectors != sectorsPerTrack) if(sectorsPerTrack == 0) sectorsPerTrack = trackInfo.sectors; else @@ -257,7 +257,7 @@ namespace DiscImageChef.DiscImages trackInfo.sectorsInfo[k - 1].track, i, j, k); int sectLen = extended - ? trackInfo.sectorsInfo[k - 1].len + ? trackInfo.sectorsInfo[k - 1].len : SizeCodeToBytes(trackInfo.sectorsInfo[k - 1].size); byte[] sector = new byte[sectLen]; @@ -279,14 +279,14 @@ namespace DiscImageChef.DiscImages thisTrackSectors[(trackInfo.sectorsInfo[k - 1].id & 0x3F) - 1] = sector; byte[] amForCrc = new byte[8]; - amForCrc[0] = 0xA1; - amForCrc[1] = 0xA1; - amForCrc[2] = 0xA1; - amForCrc[3] = (byte)IBMIdType.AddressMark; - amForCrc[4] = trackInfo.sectorsInfo[k - 1].track; - amForCrc[5] = trackInfo.sectorsInfo[k - 1].side; - amForCrc[6] = trackInfo.sectorsInfo[k - 1].id; - amForCrc[7] = (byte)trackInfo.sectorsInfo[k - 1].size; + amForCrc[0] = 0xA1; + amForCrc[1] = 0xA1; + amForCrc[2] = 0xA1; + amForCrc[3] = (byte)IBMIdType.AddressMark; + amForCrc[4] = trackInfo.sectorsInfo[k - 1].track; + amForCrc[5] = trackInfo.sectorsInfo[k - 1].side; + amForCrc[6] = trackInfo.sectorsInfo[k - 1].id; + amForCrc[7] = (byte)trackInfo.sectorsInfo[k - 1].size; Crc16Context.Data(amForCrc, 8, out byte[] amCrc); @@ -309,8 +309,7 @@ namespace DiscImageChef.DiscImages stream.Seek(trackPos, SeekOrigin.Begin); if(extended) { - stream.Seek(header.tracksizeTable[i * header.sides + j] * 256, - SeekOrigin.Current); + stream.Seek(header.tracksizeTable[i * header.sides + j] * 256, SeekOrigin.Current); imageInfo.ImageSize += (ulong)(header.tracksizeTable[i * header.sides + j] * 256) - 256; } else @@ -480,8 +479,8 @@ namespace DiscImageChef.DiscImages throw new FeatureUnsupportedImageException("Feature not supported by image format"); } - public bool? VerifySectors(ulong sectorAddress, uint length, out List failingLbas, - out List unknownLbas) + public bool? VerifySectors(ulong sectorAddress, uint length, out List failingLbas, + out List unknownLbas) { failingLbas = new List(); unknownLbas = new List(); @@ -490,8 +489,8 @@ namespace DiscImageChef.DiscImages return null; } - public bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List failingLbas, - out List unknownLbas) + public bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List failingLbas, + out List unknownLbas) { throw new FeatureUnsupportedImageException("Feature not supported by image format"); } diff --git a/DiscImageChef.DiscImages/CisCopy.cs b/DiscImageChef.DiscImages/CisCopy.cs index 1402d8be0..111f3e5d2 100644 --- a/DiscImageChef.DiscImages/CisCopy.cs +++ b/DiscImageChef.DiscImages/CisCopy.cs @@ -133,7 +133,7 @@ namespace DiscImageChef.DiscImages byte[] trackBytes = new byte[tracks]; stream.Read(trackBytes, 0, tracks); - for(int i = 0; i < tracks; i++) + 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; @@ -325,8 +325,8 @@ namespace DiscImageChef.DiscImages return null; } - public bool? VerifySectors(ulong sectorAddress, uint length, out List failingLbas, - out List unknownLbas) + public bool? VerifySectors(ulong sectorAddress, uint length, out List failingLbas, + out List unknownLbas) { failingLbas = new List(); unknownLbas = new List(); @@ -336,8 +336,8 @@ namespace DiscImageChef.DiscImages return null; } - public bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List failingLbas, - out List unknownLbas) + public bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List failingLbas, + out List unknownLbas) { failingLbas = new List(); unknownLbas = new List(); @@ -451,7 +451,7 @@ namespace DiscImageChef.DiscImages MediaType.DOS_525_HD, MediaType.DOS_525_SS_DD_8, MediaType.DOS_525_SS_DD_9 }; public IEnumerable<(string name, Type type, string description)> SupportedOptions => - new(string name, Type type, string description)[] { }; + new (string name, Type type, string description)[] { }; public IEnumerable KnownExtensions => new[] {".dcf"}; public bool IsWriting { get; private set; } diff --git a/DiscImageChef.DiscImages/CloneCD.cs b/DiscImageChef.DiscImages/CloneCD.cs index 51e041ccf..4c186c83e 100644 --- a/DiscImageChef.DiscImages/CloneCD.cs +++ b/DiscImageChef.DiscImages/CloneCD.cs @@ -188,7 +188,7 @@ namespace DiscImageChef.DiscImages try { imageFilter.GetDataForkStream().Seek(0, SeekOrigin.Begin); - cueStream = new StreamReader(imageFilter.GetDataForkStream()); + cueStream = new StreamReader(imageFilter.GetDataForkStream()); int lineNumber = 0; Regex ccdIdRegex = new Regex(CCD_IDENTIFIER); @@ -233,8 +233,8 @@ namespace DiscImageChef.DiscImages int maxSession = int.MinValue; FullTOC.TrackDataDescriptor currentEntry = new FullTOC.TrackDataDescriptor(); List entries = new List(); - scrambled = false; - catalog = null; + scrambled = false; + catalog = null; while(cueStream.Peek() >= 0) { @@ -371,8 +371,7 @@ namespace DiscImageChef.DiscImages if(entSessMatch.Success) { DicConsole.DebugWriteLine("CloneCD plugin", "Found Session at line {0}", lineNumber); - currentEntry.SessionNumber = - Convert.ToByte(entSessMatch.Groups["value"].Value, 10); + currentEntry.SessionNumber = Convert.ToByte(entSessMatch.Groups["value"].Value, 10); if(currentEntry.SessionNumber < minSession) minSession = currentEntry.SessionNumber; if(currentEntry.SessionNumber > maxSession) maxSession = currentEntry.SessionNumber; } @@ -418,7 +417,7 @@ namespace DiscImageChef.DiscImages DicConsole.DebugWriteLine("CloneCD plugin", "Found Zero at line {0}", lineNumber); currentEntry.Zero = Convert.ToByte(entZeroMatch.Groups["value"].Value, 10); currentEntry.HOUR = (byte)((currentEntry.Zero & 0xF0) >> 4); - currentEntry.PHOUR = (byte)(currentEntry.Zero & 0x0F); + currentEntry.PHOUR = (byte)(currentEntry.Zero & 0x0F); } else if(entPMinMatch.Success) { @@ -450,7 +449,7 @@ namespace DiscImageChef.DiscImages toc.LastCompleteSession = (byte)maxSession; toc.FirstCompleteSession = (byte)minSession; toc.DataLength = (ushort)(entries.Count * 11 + 2); - MemoryStream tocMs = new MemoryStream(); + MemoryStream tocMs = new MemoryStream(); tocMs.Write(BigEndianBitConverter.GetBytes(toc.DataLength), 0, 2); tocMs.WriteByte(toc.FirstCompleteSession); tocMs.WriteByte(toc.LastCompleteSession); @@ -478,7 +477,7 @@ namespace DiscImageChef.DiscImages string subFile = Path.GetFileNameWithoutExtension(imageFilter.GetBasePath()) + ".sub"; FiltersList filtersList = new FiltersList(); - dataFilter = filtersList.GetFilter(dataFile); + dataFilter = filtersList.GetFilter(dataFile); if(dataFilter == null) throw new Exception("Cannot open data file"); @@ -488,12 +487,12 @@ namespace DiscImageChef.DiscImages int curSessionNo = 0; Track currentTrack = new Track(); bool firstTrackInSession = true; - Tracks = new List(); - ulong leadOutStart = 0; + Tracks = new List(); + ulong leadOutStart = 0; - dataStream = dataFilter.GetDataForkStream(); + dataStream = dataFilter.GetDataForkStream(); if(subFilter != null) subStream = subFilter.GetDataForkStream(); - trackFlags = new Dictionary(); + trackFlags = new Dictionary(); foreach(FullTOC.TrackDataDescriptor descriptor in entries) { @@ -543,7 +542,7 @@ namespace DiscImageChef.DiscImages TrackFilter = dataFilter, TrackRawBytesPerSector = 2352, TrackSequence = descriptor.POINT, - TrackStartSector = + TrackStartSector = GetLba(descriptor.PHOUR, descriptor.PMIN, descriptor.PSEC, descriptor.PFRAME), TrackSession = descriptor.SessionNumber @@ -740,7 +739,7 @@ namespace DiscImageChef.DiscImages imageInfo.ReadableSectorTags.Add(SectorTagType.CdTrackFlags); - Sessions = new List(); + Sessions = new List(); Session currentSession = new Session { EndTrack = uint.MinValue, @@ -780,9 +779,8 @@ namespace DiscImageChef.DiscImages Partition partition = new Partition { Description = track.TrackDescription, - Size = - (track.TrackEndSector - track.TrackStartSector + 1) * - (ulong)track.TrackRawBytesPerSector, + Size = + (track.TrackEndSector - track.TrackStartSector + 1) * (ulong)track.TrackRawBytesPerSector, Length = track.TrackEndSector - track.TrackStartSector + 1, Sequence = track.TrackSequence, Offset = track.TrackFileOffset, @@ -827,15 +825,11 @@ namespace DiscImageChef.DiscImages // 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; + 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.Application = "CloneCD"; imageInfo.ImageSize = (ulong)imageFilter.GetDataForkLength(); @@ -1033,7 +1027,7 @@ namespace DiscImageChef.DiscImages ? new[] {flags} : new byte[1]; case SectorTagType.CdSectorSubchannel: - buffer = new byte[96 * length]; + buffer = new byte[96 * length]; subStream.Seek((long)(dicTrack.TrackSubchannelOffset + sectorAddress * 96), SeekOrigin.Begin); subStream.Read(buffer, 0, buffer.Length); return buffer; @@ -1254,8 +1248,8 @@ namespace DiscImageChef.DiscImages foreach(KeyValuePair kvp in from kvp in offsetmap where sectorAddress >= kvp.Value from track in Tracks - where track.TrackSequence == kvp.Key - where sectorAddress - kvp.Value < + where track.TrackSequence == kvp.Key + where sectorAddress - kvp.Value < track.TrackEndSector - track.TrackStartSector + 1 select kvp) return ReadSectorsLong(sectorAddress - kvp.Value, length, kvp.Key); @@ -1312,14 +1306,14 @@ namespace DiscImageChef.DiscImages return CdChecksums.CheckCdSector(buffer); } - public bool? VerifySectors(ulong sectorAddress, uint length, out List failingLbas, - out List unknownLbas) + public bool? VerifySectors(ulong sectorAddress, uint length, out List failingLbas, + out List unknownLbas) { byte[] buffer = ReadSectorsLong(sectorAddress, length); int bps = (int)(buffer.Length / length); byte[] sector = new byte[bps]; - failingLbas = new List(); - unknownLbas = new List(); + failingLbas = new List(); + unknownLbas = new List(); for(int i = 0; i < length; i++) { @@ -1342,14 +1336,14 @@ namespace DiscImageChef.DiscImages return failingLbas.Count <= 0; } - public bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List failingLbas, - out List unknownLbas) + public 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); byte[] sector = new byte[bps]; - failingLbas = new List(); - unknownLbas = new List(); + failingLbas = new List(); + unknownLbas = new List(); for(int i = 0; i < length; i++) { @@ -1380,7 +1374,7 @@ namespace DiscImageChef.DiscImages public List DumpHardware => null; public CICMMetadataType CicmMetadata => null; - public IEnumerable SupportedMediaTags => new[] {MediaTagType.CD_MCN, MediaTagType.CD_FullTOC}; + public IEnumerable SupportedMediaTags => new[] {MediaTagType.CD_MCN, MediaTagType.CD_FullTOC}; public IEnumerable SupportedSectorTags => new[] { @@ -1419,8 +1413,8 @@ namespace DiscImageChef.DiscImages { writingBaseName = Path.Combine(Path.GetDirectoryName(path), Path.GetFileNameWithoutExtension(path)); descriptorStream = new StreamWriter(path, false, Encoding.ASCII); - dataStream = new FileStream(writingBaseName + ".img", FileMode.OpenOrCreate, FileAccess.ReadWrite, - FileShare.None); + dataStream = new FileStream(writingBaseName + ".img", FileMode.OpenOrCreate, FileAccess.ReadWrite, + FileShare.None); } catch(IOException e) { @@ -1581,7 +1575,7 @@ namespace DiscImageChef.DiscImages newTrack.TrackSubchannelOffset = currentSubchannelOffset; currentDataOffset += (ulong)newTrack.TrackRawBytesPerSector * - (newTrack.TrackEndSector - newTrack.TrackStartSector + 1); + (newTrack.TrackEndSector - newTrack.TrackStartSector + 1); currentSubchannelOffset += subchannelSize * (newTrack.TrackEndSector - newTrack.TrackStartSector + 1); Tracks.Add(newTrack); @@ -1604,7 +1598,7 @@ namespace DiscImageChef.DiscImages subStream?.Flush(); subStream?.Close(); - FullTOC.CDFullTOC? nullableToc = null; + FullTOC.CDFullTOC? nullableToc = null; FullTOC.CDFullTOC toc; // Easy, just decode the real toc @@ -1613,10 +1607,10 @@ namespace DiscImageChef.DiscImages // Not easy, create a toc from scratch if(nullableToc == null) { - toc = new FullTOC.CDFullTOC(); - Dictionary sessionEndingTrack = new Dictionary(); - toc.FirstCompleteSession = byte.MaxValue; - toc.LastCompleteSession = byte.MinValue; + toc = new FullTOC.CDFullTOC(); + Dictionary sessionEndingTrack = new Dictionary(); + toc.FirstCompleteSession = byte.MaxValue; + toc.LastCompleteSession = byte.MinValue; List trackDescriptors = new List(); byte currentTrack = 0; @@ -1764,12 +1758,10 @@ namespace DiscImageChef.DiscImages for(int i = 0; i < toc.TrackDescriptors.Length; i++) { - long alba = - MsfToLba((toc.TrackDescriptors[i].HOUR, toc.TrackDescriptors[i].Min, toc.TrackDescriptors[i].Sec, - toc.TrackDescriptors[i].Frame)); - long plba = - MsfToLba((toc.TrackDescriptors[i].PHOUR, toc.TrackDescriptors[i].PMIN, toc.TrackDescriptors[i].PSEC, - toc.TrackDescriptors[i].PFRAME)); + long alba = MsfToLba((toc.TrackDescriptors[i].HOUR, toc.TrackDescriptors[i].Min, + toc.TrackDescriptors[i].Sec, toc.TrackDescriptors[i].Frame)); + long plba = MsfToLba((toc.TrackDescriptors[i].PHOUR, toc.TrackDescriptors[i].PMIN, + toc.TrackDescriptors[i].PSEC, toc.TrackDescriptors[i].PFRAME)); descriptorStream.WriteLine("[Entry {0}]", i); descriptorStream.WriteLine("Session={0}", toc.TrackDescriptors[i].SessionNumber); @@ -1966,7 +1958,8 @@ namespace DiscImageChef.DiscImages static (byte hour, byte minute, byte second, byte frame) LbaToMsf(ulong sector) { return ((byte)((sector + 150) / 75 / 60 / 60), (byte)((sector + 150) / 75 / 60 % 60), - (byte)((sector + 150) / 75 % 60), (byte)((sector + 150) % 75)); + (byte)((sector + 150) / 75 % 60), + (byte)((sector + 150) % 75)); } } } \ No newline at end of file diff --git a/DiscImageChef.DiscImages/CopyQM.cs b/DiscImageChef.DiscImages/CopyQM.cs index e946a5771..c1d40cb04 100644 --- a/DiscImageChef.DiscImages/CopyQM.cs +++ b/DiscImageChef.DiscImages/CopyQM.cs @@ -162,7 +162,7 @@ namespace DiscImageChef.DiscImages byte[] hdr = new byte[133]; stream.Read(hdr, 0, 133); - header = new CopyQmHeader(); + header = new CopyQmHeader(); IntPtr hdrPtr = Marshal.AllocHGlobal(133); Marshal.Copy(hdr, 0, hdrPtr, 133); header = (CopyQmHeader)Marshal.PtrToStructure(hdrPtr, typeof(CopyQmHeader)); @@ -266,9 +266,9 @@ namespace DiscImageChef.DiscImages imageInfo.Sectors = (ulong)sectors; imageInfo.SectorSize = header.sectorSize; - imageInfo.MediaType = - Geometry.GetMediaType(((ushort)header.totalCylinders, (byte)header.heads, header.sectorsPerTrack, - (uint)header.sectorSize, MediaEncoding.MFM, false)); + imageInfo.MediaType = Geometry.GetMediaType(((ushort)header.totalCylinders, (byte)header.heads, + header.sectorsPerTrack, (uint)header.sectorSize, + MediaEncoding.MFM, false)); switch(imageInfo.MediaType) { @@ -309,8 +309,8 @@ namespace DiscImageChef.DiscImages return null; } - public bool? VerifySectors(ulong sectorAddress, uint length, out List failingLbas, - out List unknownLbas) + public bool? VerifySectors(ulong sectorAddress, uint length, out List failingLbas, + out List unknownLbas) { failingLbas = new List(); unknownLbas = new List(); @@ -320,8 +320,8 @@ namespace DiscImageChef.DiscImages return null; } - public bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List failingLbas, - out List unknownLbas) + public bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List failingLbas, + out List unknownLbas) { failingLbas = new List(); unknownLbas = new List(); diff --git a/DiscImageChef.DiscImages/D88.cs b/DiscImageChef.DiscImages/D88.cs index 05462cae4..106a03eff 100644 --- a/DiscImageChef.DiscImages/D88.cs +++ b/DiscImageChef.DiscImages/D88.cs @@ -113,7 +113,7 @@ namespace DiscImageChef.DiscImages stream.Read(hdrB, 0, hdrB.Length); GCHandle handle = GCHandle.Alloc(hdrB, GCHandleType.Pinned); - d88Hdr = (D88Header)Marshal.PtrToStructure(handle.AddrOfPinnedObject(), typeof(D88Header)); + d88Hdr = (D88Header)Marshal.PtrToStructure(handle.AddrOfPinnedObject(), typeof(D88Header)); handle.Free(); DicConsole.DebugWriteLine("D88 plugin", "d88hdr.name = \"{0}\"", @@ -160,7 +160,7 @@ namespace DiscImageChef.DiscImages stream.Read(hdrB, 0, hdrB.Length); GCHandle handle = GCHandle.Alloc(hdrB, GCHandleType.Pinned); - d88Hdr = (D88Header)Marshal.PtrToStructure(handle.AddrOfPinnedObject(), typeof(D88Header)); + d88Hdr = (D88Header)Marshal.PtrToStructure(handle.AddrOfPinnedObject(), typeof(D88Header)); handle.Free(); DicConsole.DebugWriteLine("D88 plugin", "d88hdr.name = \"{0}\"", @@ -192,7 +192,7 @@ namespace DiscImageChef.DiscImages if(trkCounter == 0) return false; SectorHeader sechdr = new SectorHeader(); - hdrB = new byte[Marshal.SizeOf(sechdr)]; + hdrB = new byte[Marshal.SizeOf(sechdr)]; stream.Seek(d88Hdr.track_table[0], SeekOrigin.Begin); stream.Read(hdrB, 0, hdrB.Length); @@ -213,7 +213,7 @@ namespace DiscImageChef.DiscImages short spt = sechdr.spt; IBMSectorSizeCode bps = sechdr.n; bool allEqual = true; - sectorsData = new List(); + sectorsData = new List(); for(int i = 0; i < trkCounter; i++) { @@ -517,8 +517,8 @@ namespace DiscImageChef.DiscImages throw new FeatureUnsupportedImageException("Feature not supported by image format"); } - public bool? VerifySectors(ulong sectorAddress, uint length, out List failingLbas, - out List unknownLbas) + public bool? VerifySectors(ulong sectorAddress, uint length, out List failingLbas, + out List unknownLbas) { failingLbas = new List(); unknownLbas = new List(); @@ -527,8 +527,8 @@ namespace DiscImageChef.DiscImages return null; } - public bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List failingLbas, - out List unknownLbas) + public bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List failingLbas, + out List unknownLbas) { throw new FeatureUnsupportedImageException("Feature not supported by image format"); } diff --git a/DiscImageChef.DiscImages/DART.cs b/DiscImageChef.DiscImages/DART.cs index f22e57ea6..408e80c2a 100644 --- a/DiscImageChef.DiscImages/DART.cs +++ b/DiscImageChef.DiscImages/DART.cs @@ -269,8 +269,8 @@ namespace DiscImageChef.DiscImages { temp = new byte[l * 2]; stream.Read(temp, 0, temp.Length); - AppleRle rle = new AppleRle(new MemoryStream(temp)); - buffer = new byte[BUFFER_SIZE]; + AppleRle rle = new AppleRle(new MemoryStream(temp)); + buffer = new byte[BUFFER_SIZE]; for(int i = 0; i < BUFFER_SIZE; i++) buffer[i] = (byte)rle.ProduceByte(); dataMs.Write(buffer, 0, DATA_SIZE); tagMs.Write(buffer, DATA_SIZE, TAG_SIZE); @@ -311,9 +311,9 @@ namespace DiscImageChef.DiscImages string dev = null; string pre = null; - string major = $"{version.MajorVersion}"; - string minor = $".{version.MinorVersion / 10}"; - if(version.MinorVersion % 10 > 0) release = $".{version.MinorVersion % 10}"; + string major = $"{version.MajorVersion}"; + string minor = $".{version.MinorVersion / 10}"; + if(version.MinorVersion % 10 > 0) release = $".{version.MinorVersion % 10}"; switch(version.DevStage) { case Version.DevelopmentStage.Alpha: @@ -367,13 +367,13 @@ namespace DiscImageChef.DiscImages if(cksmRsrc?.ContainsId(1) == true) { byte[] tagChk = cksmRsrc.GetResource(1); - tagChecksum = BigEndianBitConverter.ToUInt32(tagChk, 0); + tagChecksum = BigEndianBitConverter.ToUInt32(tagChk, 0); } if(cksmRsrc?.ContainsId(2) == true) { byte[] dataChk = cksmRsrc.GetResource(1); - dataChecksum = BigEndianBitConverter.ToUInt32(dataChk, 0); + dataChecksum = BigEndianBitConverter.ToUInt32(dataChk, 0); } } } @@ -491,7 +491,7 @@ namespace DiscImageChef.DiscImages Array.Copy(data, i * imageInfo.SectorSize, buffer, i * (imageInfo.SectorSize + TAG_SECTOR_SIZE), imageInfo.SectorSize); Array.Copy(tags, i * TAG_SECTOR_SIZE, buffer, - i * (imageInfo.SectorSize + TAG_SECTOR_SIZE) + imageInfo.SectorSize, TAG_SECTOR_SIZE); + i * (imageInfo.SectorSize + TAG_SECTOR_SIZE) + imageInfo.SectorSize, TAG_SECTOR_SIZE); } return buffer; @@ -552,8 +552,8 @@ namespace DiscImageChef.DiscImages throw new FeatureUnsupportedImageException("Feature not supported by image format"); } - public bool? VerifySectors(ulong sectorAddress, uint length, out List failingLbas, - out List unknownLbas) + public bool? VerifySectors(ulong sectorAddress, uint length, out List failingLbas, + out List unknownLbas) { failingLbas = new List(); unknownLbas = new List(); @@ -562,8 +562,8 @@ namespace DiscImageChef.DiscImages return null; } - public bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List failingLbas, - out List unknownLbas) + public bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List failingLbas, + out List unknownLbas) { throw new FeatureUnsupportedImageException("Feature not supported by image format"); } diff --git a/DiscImageChef.DiscImages/DIM.cs b/DiscImageChef.DiscImages/DIM.cs index 99d32ac38..63f4ea370 100644 --- a/DiscImageChef.DiscImages/DIM.cs +++ b/DiscImageChef.DiscImages/DIM.cs @@ -51,7 +51,7 @@ namespace DiscImageChef.DiscImages readonly byte[] headerId = {0x44, 0x49, 0x46, 0x43, 0x20, 0x48, 0x45, 0x41, 0x44, 0x45, 0x52, 0x20, 0x20}; byte[] comment; /// Disk image file - IFilter dimImageFilter; + IFilter dimImageFilter; DiskType dskType; byte[] hdrId; ImageInfo imageInfo; @@ -150,7 +150,7 @@ namespace DiscImageChef.DiscImages } if(diskSize / (2 * 8 * 1024) == 77) imageInfo.MediaType = MediaType.SHARP_525; - imageInfo.SectorSize = 1024; + imageInfo.SectorSize = 1024; break; // 9 spt, 1024 bps case DiskType.Hs2: @@ -161,7 +161,7 @@ namespace DiscImageChef.DiscImages } if(diskSize / (2 * 9 * 512) == 80) imageInfo.MediaType = MediaType.SHARP_525_9; - imageInfo.SectorSize = 512; + imageInfo.SectorSize = 512; break; // 15 spt, 512 bps case DiskType.Hc2: @@ -172,7 +172,7 @@ namespace DiscImageChef.DiscImages } if(diskSize / (2 * 15 * 512) == 80) imageInfo.MediaType = MediaType.DOS_525_HD; - imageInfo.SectorSize = 512; + imageInfo.SectorSize = 512; break; // 9 spt, 1024 bps case DiskType.Hde2: @@ -183,7 +183,7 @@ namespace DiscImageChef.DiscImages } if(diskSize / (2 * 9 * 512) == 80) imageInfo.MediaType = MediaType.SHARP_35_9; - imageInfo.SectorSize = 512; + imageInfo.SectorSize = 512; break; // 18 spt, 512 bps case DiskType.Hq2: @@ -194,19 +194,19 @@ namespace DiscImageChef.DiscImages } if(diskSize / (2 * 18 * 512) == 80) imageInfo.MediaType = MediaType.DOS_35_HD; - imageInfo.SectorSize = 512; + 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; - imageInfo.SectorSize = 256; + imageInfo.SectorSize = 256; } else if(diskSize % (2 * 26 * 128) == 0) { if(diskSize % (2 * 26 * 128) == 77) imageInfo.MediaType = MediaType.NEC_8_SD; - imageInfo.SectorSize = 256; + imageInfo.SectorSize = 256; } else { @@ -369,8 +369,8 @@ namespace DiscImageChef.DiscImages throw new FeatureUnsupportedImageException("Feature not supported by image format"); } - public bool? VerifySectors(ulong sectorAddress, uint length, out List failingLbas, - out List unknownLbas) + public bool? VerifySectors(ulong sectorAddress, uint length, out List failingLbas, + out List unknownLbas) { failingLbas = new List(); unknownLbas = new List(); @@ -379,8 +379,8 @@ namespace DiscImageChef.DiscImages return null; } - public bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List failingLbas, - out List unknownLbas) + public bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List failingLbas, + out List unknownLbas) { throw new FeatureUnsupportedImageException("Feature not supported by image format"); } diff --git a/DiscImageChef.DiscImages/DiscFerret.cs b/DiscImageChef.DiscImages/DiscFerret.cs index 2f43da519..6ba46abb6 100644 --- a/DiscImageChef.DiscImages/DiscFerret.cs +++ b/DiscImageChef.DiscImages/DiscFerret.cs @@ -51,7 +51,7 @@ namespace DiscImageChef.DiscImages /// "DFE2" ///
const uint DFI_MAGIC2 = 0x32454644; - ImageInfo imageInfo; + ImageInfo imageInfo; // TODO: These variables have been made public so create-sidecar can access to this information until I define an API >4.0 public SortedDictionary TrackLengths; public SortedDictionary TrackOffsets; @@ -117,8 +117,8 @@ namespace DiscImageChef.DiscImages if(magic != DFI_MAGIC && magic != DFI_MAGIC2) return false; - TrackOffsets = new SortedDictionary(); - TrackLengths = new SortedDictionary(); + TrackOffsets = new SortedDictionary(); + TrackLengths = new SortedDictionary(); int t = -1; ushort lastCylinder = 0, lastHead = 0; long offset = 0; @@ -224,8 +224,8 @@ namespace DiscImageChef.DiscImages throw new NotImplementedException("Flux decoding is not yet implemented."); } - public bool? VerifySectors(ulong sectorAddress, uint length, out List failingLbas, - out List unknownLbas) + public bool? VerifySectors(ulong sectorAddress, uint length, out List failingLbas, + out List unknownLbas) { throw new NotImplementedException("Flux decoding is not yet implemented."); } @@ -270,8 +270,8 @@ namespace DiscImageChef.DiscImages throw new FeatureUnsupportedImageException("Feature not supported by image format"); } - public bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List failingLbas, - out List unknownLbas) + public bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List failingLbas, + out List unknownLbas) { throw new FeatureUnsupportedImageException("Feature not supported by image format"); } diff --git a/DiscImageChef.DiscImages/DiscImageChef.cs b/DiscImageChef.DiscImages/DiscImageChef.cs index 4ea7eafc9..e1e9237e5 100644 --- a/DiscImageChef.DiscImages/DiscImageChef.cs +++ b/DiscImageChef.DiscImages/DiscImageChef.cs @@ -117,7 +117,7 @@ namespace DiscImageChef.DiscImages /// smaller than 256. ///
const int MIN_FLAKE_BLOCK = 256; - bool alreadyWrittenZero; + bool alreadyWrittenZero; /// Cache of uncompressed blocks. Dictionary blockCache; @@ -137,8 +137,8 @@ namespace DiscImageChef.DiscImages uint currentCacheSize; /// Cache of DDT entries. Dictionary ddtEntryCache; - MemoryStream decompressedStream; - bool deduplicate; + MemoryStream decompressedStream; + bool deduplicate; /// On-memory deduplication table indexed by checksum. Dictionary deduplicationTable; /// writer. @@ -156,16 +156,16 @@ namespace DiscImageChef.DiscImages /// Index. List index; /// If set to true, the DDT entries are in-memory. - bool inMemoryDdt; + bool inMemoryDdt; ulong lastWrittenBlock; /// LZMA stream. LzmaStream lzmaBlockStream; /// LZMA properties. LzmaEncoderProperties lzmaEncoderProperties; - Md5Context md5Provider; + Md5Context md5Provider; /// Cache of media tags. Dictionary mediaTags; - bool nocompress; + bool nocompress; /// If DDT is on-disk, this is the image stream offset at which it starts. long outMemoryDdtPosition; bool rewinded; @@ -174,11 +174,11 @@ namespace DiscImageChef.DiscImages /// Cache for data that goes side by side with user data (e.g. CompactDisc subchannel). byte[] sectorSubchannel; /// Cache for data that suffixes the user data on a sector (e.g. edc, ecc). - byte[] sectorSuffix; + byte[] sectorSuffix; Sha1Context sha1Provider; Sha256Context sha256Provider; /// Shift for calculating number of sectors in a block. - byte shift; + byte shift; SpamSumContext spamsumProvider; /// Cache for bytes to write/rad on-disk. byte[] structureBytes; @@ -190,8 +190,8 @@ namespace DiscImageChef.DiscImages Dictionary trackIsrcs; /// In-memory deduplication table ulong[] userDataDdt; - bool writingLong; - ulong writtenSectors; + bool writingLong; + ulong writtenSectors; public DiscImageChef() { @@ -270,9 +270,9 @@ namespace DiscImageChef.DiscImages imageInfo.MediaType = header.mediaType; // Read the index header - imageStream.Position = (long)header.indexOffset; + imageStream.Position = (long)header.indexOffset; IndexHeader idxHeader = new IndexHeader(); - structureBytes = new byte[Marshal.SizeOf(idxHeader)]; + structureBytes = new byte[Marshal.SizeOf(idxHeader)]; imageStream.Read(structureBytes, 0, structureBytes.Length); structurePointer = Marshal.AllocHGlobal(Marshal.SizeOf(idxHeader)); Marshal.Copy(structureBytes, 0, structurePointer, Marshal.SizeOf(idxHeader)); @@ -289,7 +289,7 @@ namespace DiscImageChef.DiscImages for(ushort i = 0; i < idxHeader.entries; i++) { IndexEntry entry = new IndexEntry(); - structureBytes = new byte[Marshal.SizeOf(entry)]; + structureBytes = new byte[Marshal.SizeOf(entry)]; imageStream.Read(structureBytes, 0, structureBytes.Length); structurePointer = Marshal.AllocHGlobal(Marshal.SizeOf(entry)); Marshal.Copy(structureBytes, 0, structurePointer, Marshal.SizeOf(entry)); @@ -304,7 +304,7 @@ namespace DiscImageChef.DiscImages imageInfo.ImageSize = 0; bool foundUserDataDdt = false; - mediaTags = new Dictionary(); + mediaTags = new Dictionary(); foreach(IndexEntry entry in index) { imageStream.Position = (long)entry.offset; @@ -317,7 +317,7 @@ namespace DiscImageChef.DiscImages imageStream.Position = (long)entry.offset; BlockHeader blockHeader = new BlockHeader(); - structureBytes = new byte[Marshal.SizeOf(blockHeader)]; + structureBytes = new byte[Marshal.SizeOf(blockHeader)]; imageStream.Read(structureBytes, 0, structureBytes.Length); structurePointer = Marshal.AllocHGlobal(Marshal.SizeOf(blockHeader)); Marshal.Copy(structureBytes, 0, structurePointer, Marshal.SizeOf(blockHeader)); @@ -364,7 +364,7 @@ namespace DiscImageChef.DiscImages imageStream.Read(compressedTag, 0, compressedTag.Length); MemoryStream compressedTagMs = new MemoryStream(compressedTag); LzmaStream lzmaBlock = new LzmaStream(lzmaProperties, compressedTagMs); - data = new byte[blockHeader.length]; + data = new byte[blockHeader.length]; lzmaBlock.Read(data, 0, (int)blockHeader.length); lzmaBlock.Close(); compressedTagMs.Close(); @@ -449,7 +449,7 @@ namespace DiscImageChef.DiscImages if(entry.dataType != DataType.UserData) break; DdtHeader ddtHeader = new DdtHeader(); - structureBytes = new byte[Marshal.SizeOf(ddtHeader)]; + structureBytes = new byte[Marshal.SizeOf(ddtHeader)]; imageStream.Read(structureBytes, 0, structureBytes.Length); structurePointer = Marshal.AllocHGlobal(Marshal.SizeOf(ddtHeader)); Marshal.Copy(structureBytes, 0, structurePointer, Marshal.SizeOf(ddtHeader)); @@ -481,8 +481,8 @@ namespace DiscImageChef.DiscImages userDataDdt = new ulong[ddtHeader.entries]; for(ulong i = 0; i < ddtHeader.entries; i++) userDataDdt[i] = BitConverter.ToUInt64(decompressedDdt, (int)(i * sizeof(ulong))); - DateTime ddtEnd = DateTime.UtcNow; - inMemoryDdt = true; + DateTime ddtEnd = DateTime.UtcNow; + inMemoryDdt = true; DicConsole.DebugWriteLine("DiscImageChef format plugin", "Took {0} seconds to decompress DDT", (ddtEnd - ddtStart).TotalSeconds); @@ -522,7 +522,7 @@ namespace DiscImageChef.DiscImages // Metadata block case BlockType.MetadataBlock: MetadataBlock metadataBlock = new MetadataBlock(); - structureBytes = new byte[Marshal.SizeOf(metadataBlock)]; + structureBytes = new byte[Marshal.SizeOf(metadataBlock)]; imageStream.Read(structureBytes, 0, structureBytes.Length); structurePointer = Marshal.AllocHGlobal(Marshal.SizeOf(metadataBlock)); Marshal.Copy(structureBytes, 0, structurePointer, Marshal.SizeOf(metadataBlock)); @@ -540,7 +540,7 @@ namespace DiscImageChef.DiscImages DicConsole.DebugWriteLine("DiscImageChef format plugin", "Found metadata block at position {0}", entry.offset); - byte[] metadata = new byte[metadataBlock.blockSize]; + byte[] metadata = new byte[metadataBlock.blockSize]; imageStream.Position = (long)entry.offset; imageStream.Read(metadata, 0, metadata.Length); @@ -585,7 +585,7 @@ namespace DiscImageChef.DiscImages imageInfo.MediaTitle); } - if(metadataBlock.mediaManufacturerOffset > 0 && + if(metadataBlock.mediaManufacturerOffset > 0 && metadataBlock.mediaManufacturerLength + metadataBlock.mediaManufacturerOffset <= metadata.Length) { @@ -608,7 +608,7 @@ namespace DiscImageChef.DiscImages imageInfo.MediaModel); } - if(metadataBlock.mediaSerialNumberOffset > 0 && + if(metadataBlock.mediaSerialNumberOffset > 0 && metadataBlock.mediaSerialNumberLength + metadataBlock.mediaSerialNumberOffset <= metadata.Length) { @@ -642,7 +642,7 @@ namespace DiscImageChef.DiscImages imageInfo.MediaPartNumber); } - if(metadataBlock.driveManufacturerOffset > 0 && + if(metadataBlock.driveManufacturerOffset > 0 && metadataBlock.driveManufacturerLength + metadataBlock.driveManufacturerOffset <= metadata.Length) { @@ -665,7 +665,7 @@ namespace DiscImageChef.DiscImages imageInfo.DriveModel); } - if(metadataBlock.driveSerialNumberOffset > 0 && + if(metadataBlock.driveSerialNumberOffset > 0 && metadataBlock.driveSerialNumberLength + metadataBlock.driveSerialNumberOffset <= metadata.Length) { @@ -693,7 +693,7 @@ namespace DiscImageChef.DiscImages // Optical disc tracks block case BlockType.TracksBlock: TracksHeader tracksHeader = new TracksHeader(); - structureBytes = new byte[Marshal.SizeOf(tracksHeader)]; + structureBytes = new byte[Marshal.SizeOf(tracksHeader)]; imageStream.Read(structureBytes, 0, structureBytes.Length); structurePointer = Marshal.AllocHGlobal(Marshal.SizeOf(tracksHeader)); Marshal.Copy(structureBytes, 0, structurePointer, Marshal.SizeOf(tracksHeader)); @@ -730,7 +730,7 @@ namespace DiscImageChef.DiscImages for(ushort i = 0; i < tracksHeader.entries; i++) { TrackEntry trackEntry = new TrackEntry(); - structureBytes = new byte[Marshal.SizeOf(trackEntry)]; + structureBytes = new byte[Marshal.SizeOf(trackEntry)]; imageStream.Read(structureBytes, 0, structureBytes.Length); structurePointer = Marshal.AllocHGlobal(Marshal.SizeOf(trackEntry)); Marshal.Copy(structureBytes, 0, structurePointer, Marshal.SizeOf(trackEntry)); @@ -760,7 +760,7 @@ namespace DiscImageChef.DiscImages // CICM XML metadata block case BlockType.CicmBlock: CicmMetadataBlock cicmBlock = new CicmMetadataBlock(); - structureBytes = new byte[Marshal.SizeOf(cicmBlock)]; + structureBytes = new byte[Marshal.SizeOf(cicmBlock)]; imageStream.Read(structureBytes, 0, structureBytes.Length); structurePointer = Marshal.AllocHGlobal(Marshal.SizeOf(cicmBlock)); Marshal.Copy(structureBytes, 0, structurePointer, Marshal.SizeOf(cicmBlock)); @@ -779,7 +779,7 @@ namespace DiscImageChef.DiscImages try { StreamReader sr = new StreamReader(cicmMs); - CicmMetadata = (CICMMetadataType)cicmXs.Deserialize(sr); + CicmMetadata = (CICMMetadataType)cicmXs.Deserialize(sr); sr.Close(); } catch(XmlException ex) @@ -793,7 +793,7 @@ namespace DiscImageChef.DiscImages // Dump hardware block case BlockType.DumpHardwareBlock: DumpHardwareHeader dumpBlock = new DumpHardwareHeader(); - structureBytes = new byte[Marshal.SizeOf(dumpBlock)]; + structureBytes = new byte[Marshal.SizeOf(dumpBlock)]; imageStream.Read(structureBytes, 0, structureBytes.Length); structurePointer = Marshal.AllocHGlobal(Marshal.SizeOf(dumpBlock)); Marshal.Copy(structureBytes, 0, structurePointer, Marshal.SizeOf(dumpBlock)); @@ -823,7 +823,7 @@ namespace DiscImageChef.DiscImages for(ushort i = 0; i < dumpBlock.entries; i++) { DumpHardwareEntry dumpEntry = new DumpHardwareEntry(); - structureBytes = new byte[Marshal.SizeOf(dumpEntry)]; + structureBytes = new byte[Marshal.SizeOf(dumpEntry)]; imageStream.Read(structureBytes, 0, structureBytes.Length); structurePointer = Marshal.AllocHGlobal(Marshal.SizeOf(dumpEntry)); Marshal.Copy(structureBytes, 0, structurePointer, Marshal.SizeOf(dumpEntry)); @@ -942,9 +942,9 @@ namespace DiscImageChef.DiscImages imageInfo.ReadableMediaTags.AddRange(mediaTags.Keys); // Initialize caches - blockCache = new Dictionary(); - blockHeaderCache = new Dictionary(); - currentCacheSize = 0; + blockCache = new Dictionary(); + blockHeaderCache = new Dictionary(); + currentCacheSize = 0; if(!inMemoryDdt) ddtEntryCache = new Dictionary(); // Initialize tracks, sessions and partitions @@ -985,7 +985,7 @@ namespace DiscImageChef.DiscImages }); ulong currentTrackOffset = 0; - Partitions = new List(); + Partitions = new List(); foreach(Track track in Tracks.OrderBy(t => t.TrackStartSector)) { Partitions.Add(new Partition @@ -995,7 +995,7 @@ namespace DiscImageChef.DiscImages Name = $"Track {track.TrackSequence}", Offset = currentTrackOffset, Start = track.TrackStartSector, - Size = (track.TrackEndSector - track.TrackStartSector + 1) * + Size = (track.TrackEndSector - track.TrackStartSector + 1) * (ulong)track.TrackBytesPerSector, Length = track.TrackEndSector - track.TrackStartSector + 1, Scheme = "Optical disc track" @@ -1007,8 +1007,8 @@ namespace DiscImageChef.DiscImages Track[] tracks = Tracks.ToArray(); for(int i = 0; i < tracks.Length; i++) { - byte[] sector = ReadSector(tracks[i].TrackStartSector); - tracks[i].TrackBytesPerSector = sector.Length; + byte[] sector = ReadSector(tracks[i].TrackStartSector); + tracks[i].TrackBytesPerSector = sector.Length; tracks[i].TrackRawBytesPerSector = sectorPrefix != null && sectorSuffix != null ? 2352 : sector.Length; @@ -1089,7 +1089,7 @@ namespace DiscImageChef.DiscImages imageStream.Read(compressedBlock, 0, compressedBlock.Length); MemoryStream compressedBlockMs = new MemoryStream(compressedBlock); LzmaStream lzmaBlock = new LzmaStream(lzmaProperties, compressedBlockMs); - block = new byte[blockHeader.length]; + block = new byte[blockHeader.length]; lzmaBlock.Read(block, 0, (int)blockHeader.length); lzmaBlock.Close(); compressedBlockMs.Close(); @@ -1099,9 +1099,9 @@ namespace DiscImageChef.DiscImages imageStream.Read(flacBlock, 0, flacBlock.Length); MemoryStream flacMs = new MemoryStream(flacBlock); FlakeReader flakeReader = new FlakeReader("", flacMs); - block = new byte[blockHeader.length]; - int samples = (int)(block.Length / blockHeader.sectorSize * 588); - AudioBuffer audioBuffer = new AudioBuffer(AudioPCMConfig.RedBook, block, samples); + block = new byte[blockHeader.length]; + int samples = (int)(block.Length / blockHeader.sectorSize * 588); + AudioBuffer audioBuffer = new AudioBuffer(AudioPCMConfig.RedBook, block, samples); flakeReader.Read(audioBuffer, samples); flakeReader.Close(); flacMs.Close(); @@ -1140,7 +1140,7 @@ namespace DiscImageChef.DiscImages throw new FeatureNotPresentImageException("Feature not present in image"); Track trk = Tracks.FirstOrDefault(t => t.TrackSequence == track); - if(trk.TrackSequence != track) + if(trk.TrackSequence != track) throw new ArgumentOutOfRangeException(nameof(track), "Track does not exist in disc image"); return ReadSector(trk.TrackStartSector + sectorAddress); @@ -1152,7 +1152,7 @@ namespace DiscImageChef.DiscImages throw new FeatureNotPresentImageException("Feature not present in image"); Track trk = Tracks.FirstOrDefault(t => t.TrackSequence == track); - if(trk.TrackSequence != track) + if(trk.TrackSequence != track) throw new ArgumentOutOfRangeException(nameof(track), "Track does not exist in disc image"); return ReadSectorTag(trk.TrackStartSector + sectorAddress, tag); @@ -1189,7 +1189,7 @@ namespace DiscImageChef.DiscImages { Track trk = Tracks.FirstOrDefault(t => sectorAddress >= t.TrackStartSector && sectorAddress <= t.TrackEndSector); - if(trk.TrackSequence == 0) + if(trk.TrackSequence == 0) throw new ArgumentOutOfRangeException(nameof(sectorAddress), "Can't found track containing requested sector"); @@ -1358,7 +1358,7 @@ namespace DiscImageChef.DiscImages for(int i = 0; i < length; i++) Array.Copy(dataSource, (long)(sectorAddress * (sectorOffset + sectorSize + sectorSkip)), data, - i * sectorSize, sectorSize); + i * sectorSize, sectorSize); return data; } @@ -1369,7 +1369,7 @@ namespace DiscImageChef.DiscImages throw new FeatureNotPresentImageException("Feature not present in image"); Track trk = Tracks.FirstOrDefault(t => t.TrackSequence == track); - if(trk.TrackSequence != track) + if(trk.TrackSequence != track) throw new ArgumentOutOfRangeException(nameof(track), "Track does not exist in disc image"); if(trk.TrackStartSector + sectorAddress + length > trk.TrackEndSector + 1) @@ -1385,7 +1385,7 @@ namespace DiscImageChef.DiscImages throw new FeatureNotPresentImageException("Feature not present in image"); Track trk = Tracks.FirstOrDefault(t => t.TrackSequence == track); - if(trk.TrackSequence != track) + if(trk.TrackSequence != track) throw new ArgumentOutOfRangeException(nameof(track), "Track does not exist in disc image"); if(trk.TrackStartSector + sectorAddress + length > trk.TrackEndSector + 1) @@ -1402,7 +1402,7 @@ namespace DiscImageChef.DiscImages case XmlMediaType.OpticalDisc: Track trk = Tracks.FirstOrDefault(t => sectorAddress >= t.TrackStartSector && sectorAddress <= t.TrackEndSector); - if(trk.TrackSequence == 0) + if(trk.TrackSequence == 0) throw new ArgumentOutOfRangeException(nameof(sectorAddress), "Can't found track containing requested sector"); @@ -1452,7 +1452,7 @@ namespace DiscImageChef.DiscImages throw new FeatureNotPresentImageException("Feature not present in image"); Track trk = Tracks.FirstOrDefault(t => t.TrackSequence == track); - if(trk.TrackSequence != track) + if(trk.TrackSequence != track) throw new ArgumentOutOfRangeException(nameof(track), "Track does not exist in disc image"); return ReadSectorLong(trk.TrackStartSector + sectorAddress); @@ -1468,7 +1468,7 @@ namespace DiscImageChef.DiscImages case XmlMediaType.OpticalDisc: Track trk = Tracks.FirstOrDefault(t => sectorAddress >= t.TrackStartSector && sectorAddress <= t.TrackEndSector); - if(trk.TrackSequence == 0) + if(trk.TrackSequence == 0) throw new ArgumentOutOfRangeException(nameof(sectorAddress), "Can't found track containing requested sector"); @@ -1492,13 +1492,9 @@ namespace DiscImageChef.DiscImages Array.Copy(sectorPrefix, (int)((sectorAddress + i) * 16), sectors, (int)(i * 2352), 16); Array.Copy(data, (int)(i * 2048), sectors, - (int)(i * 2352) + 16, 2048); - Array.Copy(sectorSuffix, - (int)((sectorAddress + i) * 288), - sectors, - (int) - (i * - 2352) + 2064, 288); + (int)(i * 2352) + 16, 2048); + Array.Copy(sectorSuffix, (int)((sectorAddress + i) * 288), sectors, + (int)(i * 2352) + 2064, 288); } return sectors; @@ -1515,7 +1511,7 @@ namespace DiscImageChef.DiscImages Array.Copy(sectorPrefix, (int)((sectorAddress + i) * 16), sectors, (int)(i * 2352), 16); Array.Copy(data, (int)(i * 2336), sectors, - (int)(i * 2352) + 16, 2336); + (int)(i * 2352) + 16, 2336); } return sectors; @@ -1552,14 +1548,13 @@ namespace DiscImageChef.DiscImages } uint sectorSize = 512 + tagSize; - data = ReadSectors(sectorAddress, length); - sectors = new byte[(sectorSize + 512) * length]; + data = ReadSectors(sectorAddress, length); + sectors = new byte[(sectorSize + 512) * length]; for(uint i = 0; i < length; i++) { Array.Copy(sectorSubchannel, (int)((sectorAddress + i) * tagSize), sectors, - (int)(i * sectorSize + 512), tagSize); - Array.Copy(data, (int)((sectorAddress + i) * 512), - sectors, (int)(i * 512), 512); + (int)(i * sectorSize + 512), tagSize); + Array.Copy(data, (int)((sectorAddress + i) * 512), sectors, (int)(i * 512), 512); } return sectors; @@ -1577,7 +1572,7 @@ namespace DiscImageChef.DiscImages throw new FeatureNotPresentImageException("Feature not present in image"); Track trk = Tracks.FirstOrDefault(t => t.TrackSequence == track); - if(trk.TrackSequence != track) + if(trk.TrackSequence != track) throw new ArgumentOutOfRangeException(nameof(track), "Track does not exist in disc image"); if(trk.TrackStartSector + sectorAddress + length > trk.TrackEndSector + 1) @@ -1613,8 +1608,8 @@ namespace DiscImageChef.DiscImages return CdChecksums.CheckCdSector(buffer); } - public bool? VerifySectors(ulong sectorAddress, uint length, out List failingLbas, - out List unknownLbas) + public bool? VerifySectors(ulong sectorAddress, uint length, out List failingLbas, + out List unknownLbas) { failingLbas = new List(); unknownLbas = new List(); @@ -1630,8 +1625,8 @@ namespace DiscImageChef.DiscImages byte[] buffer = ReadSectorsLong(sectorAddress, length); int bps = (int)(buffer.Length / length); byte[] sector = new byte[bps]; - failingLbas = new List(); - unknownLbas = new List(); + failingLbas = new List(); + unknownLbas = new List(); for(int i = 0; i < length; i++) { @@ -1654,8 +1649,8 @@ namespace DiscImageChef.DiscImages return failingLbas.Count <= 0; } - public bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List failingLbas, - out List unknownLbas) + public bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List failingLbas, + out List unknownLbas) { // Right now only CompactDisc sectors are verifyable if(imageInfo.XmlMediaType != XmlMediaType.OpticalDisc) @@ -1671,8 +1666,8 @@ namespace DiscImageChef.DiscImages byte[] buffer = ReadSectorsLong(sectorAddress, length, track); int bps = (int)(buffer.Length / length); byte[] sector = new byte[bps]; - failingLbas = new List(); - unknownLbas = new List(); + failingLbas = new List(); + unknownLbas = new List(); for(int i = 0; i < length; i++) { @@ -1703,7 +1698,7 @@ namespace DiscImageChef.DiscImages imageStream.Position = (long)header.indexOffset; IndexHeader idxHeader = new IndexHeader(); - structureBytes = new byte[Marshal.SizeOf(idxHeader)]; + structureBytes = new byte[Marshal.SizeOf(idxHeader)]; imageStream.Read(structureBytes, 0, structureBytes.Length); structurePointer = Marshal.AllocHGlobal(Marshal.SizeOf(idxHeader)); Marshal.Copy(structureBytes, 0, structurePointer, Marshal.SizeOf(idxHeader)); @@ -1736,7 +1731,7 @@ namespace DiscImageChef.DiscImages for(ushort i = 0; i < idxHeader.entries; i++) { IndexEntry entry = new IndexEntry(); - structureBytes = new byte[Marshal.SizeOf(entry)]; + structureBytes = new byte[Marshal.SizeOf(entry)]; imageStream.Read(structureBytes, 0, structureBytes.Length); structurePointer = Marshal.AllocHGlobal(Marshal.SizeOf(entry)); Marshal.Copy(structureBytes, 0, structurePointer, Marshal.SizeOf(entry)); @@ -1762,7 +1757,7 @@ namespace DiscImageChef.DiscImages { case BlockType.DataBlock: BlockHeader blockHeader = new BlockHeader(); - structureBytes = new byte[Marshal.SizeOf(blockHeader)]; + structureBytes = new byte[Marshal.SizeOf(blockHeader)]; imageStream.Read(structureBytes, 0, structureBytes.Length); structurePointer = Marshal.AllocHGlobal(Marshal.SizeOf(blockHeader)); Marshal.Copy(structureBytes, 0, structurePointer, Marshal.SizeOf(blockHeader)); @@ -1801,7 +1796,7 @@ namespace DiscImageChef.DiscImages break; case BlockType.DeDuplicationTable: DdtHeader ddtHeader = new DdtHeader(); - structureBytes = new byte[Marshal.SizeOf(ddtHeader)]; + structureBytes = new byte[Marshal.SizeOf(ddtHeader)]; imageStream.Read(structureBytes, 0, structureBytes.Length); structurePointer = Marshal.AllocHGlobal(Marshal.SizeOf(ddtHeader)); Marshal.Copy(structureBytes, 0, structurePointer, Marshal.SizeOf(ddtHeader)); @@ -1840,7 +1835,7 @@ namespace DiscImageChef.DiscImages break; case BlockType.TracksBlock: TracksHeader trkHeader = new TracksHeader(); - structureBytes = new byte[Marshal.SizeOf(trkHeader)]; + structureBytes = new byte[Marshal.SizeOf(trkHeader)]; imageStream.Read(structureBytes, 0, structureBytes.Length); structurePointer = Marshal.AllocHGlobal(Marshal.SizeOf(trkHeader)); Marshal.Copy(structureBytes, 0, structurePointer, Marshal.SizeOf(trkHeader)); @@ -1881,22 +1876,21 @@ namespace DiscImageChef.DiscImages Enum.GetValues(typeof(MediaTagType)).Cast(); public IEnumerable SupportedSectorTags => Enum.GetValues(typeof(SectorTagType)).Cast(); - public IEnumerable SupportedMediaTypes => - Enum.GetValues(typeof(MediaType)).Cast(); + public IEnumerable SupportedMediaTypes => Enum.GetValues(typeof(MediaType)).Cast(); public IEnumerable<(string name, Type type, string description)> SupportedOptions => new[] { ("sectors_per_block", typeof(uint), - "How many sectors to store per block (will be rounded to next power of two)"), + "How many sectors to store per block (will be rounded to next power of two)"), ("dictionary", typeof(uint), "Size, in bytes, of the LZMA dictionary"), ("max_ddt_size", typeof(uint), - "Maximum size, in mebibytes, for in-memory DDT. If image needs a bigger one, it will be on-disk"), + "Maximum size, in mebibytes, for in-memory DDT. If image needs a bigger one, it will be on-disk"), ("md5", typeof(bool), "Calculate and store MD5 of image's user data"), ("sha1", typeof(bool), "Calculate and store SHA1 of image's user data"), ("sha256", typeof(bool), "Calculate and store SHA256 of image's user data"), ("spamsum", typeof(bool), "Calculate and store SpamSum of image's user data"), ("deduplicate", typeof(bool), - "Store only unique sectors. This consumes more memory and is slower, but it's enabled by default"), + "Store only unique sectors. This consumes more memory and is slower, but it's enabled by default"), ("nocompress", typeof(bool), "Don't compress user data blocks. Other blocks will still be compressed") }; public IEnumerable KnownExtensions => new[] {".dicf"}; @@ -2027,7 +2021,7 @@ namespace DiscImageChef.DiscImages } // Calculate shift - shift = 0; + shift = 0; uint oldSectorsPerBlock = sectorsPerBlock; while(sectorsPerBlock > 1) { @@ -2112,9 +2106,9 @@ namespace DiscImageChef.DiscImages sha256Provider = null; spamsumProvider = null; - imageStream.Position = (long)header.indexOffset; + imageStream.Position = (long)header.indexOffset; IndexHeader idxHeader = new IndexHeader(); - structureBytes = new byte[Marshal.SizeOf(idxHeader)]; + structureBytes = new byte[Marshal.SizeOf(idxHeader)]; imageStream.Read(structureBytes, 0, structureBytes.Length); structurePointer = Marshal.AllocHGlobal(Marshal.SizeOf(idxHeader)); Marshal.Copy(structureBytes, 0, structurePointer, Marshal.SizeOf(idxHeader)); @@ -2133,7 +2127,7 @@ namespace DiscImageChef.DiscImages for(ushort i = 0; i < idxHeader.entries; i++) { IndexEntry entry = new IndexEntry(); - structureBytes = new byte[Marshal.SizeOf(entry)]; + structureBytes = new byte[Marshal.SizeOf(entry)]; imageStream.Read(structureBytes, 0, structureBytes.Length); structurePointer = Marshal.AllocHGlobal(Marshal.SizeOf(entry)); Marshal.Copy(structureBytes, 0, structurePointer, Marshal.SizeOf(entry)); @@ -2163,11 +2157,11 @@ namespace DiscImageChef.DiscImages case DataType.AppleProfileTag: case DataType.AppleSonyTag: case DataType.PriamDataTowerTag: break; - default: continue; + default: continue; } BlockHeader blockHeader = new BlockHeader(); - structureBytes = new byte[Marshal.SizeOf(blockHeader)]; + structureBytes = new byte[Marshal.SizeOf(blockHeader)]; imageStream.Read(structureBytes, 0, structureBytes.Length); structurePointer = Marshal.AllocHGlobal(Marshal.SizeOf(blockHeader)); Marshal.Copy(structureBytes, 0, structurePointer, Marshal.SizeOf(blockHeader)); @@ -2205,7 +2199,7 @@ namespace DiscImageChef.DiscImages imageStream.Read(compressedTag, 0, compressedTag.Length); MemoryStream compressedTagMs = new MemoryStream(compressedTag); LzmaStream lzmaBlock = new LzmaStream(lzmaProperties, compressedTagMs); - data = new byte[blockHeader.length]; + data = new byte[blockHeader.length]; lzmaBlock.Read(data, 0, (int)blockHeader.length); lzmaBlock.Close(); compressedTagMs.Close(); @@ -2255,7 +2249,7 @@ namespace DiscImageChef.DiscImages if(entry.dataType != DataType.UserData) break; DdtHeader ddtHeader = new DdtHeader(); - structureBytes = new byte[Marshal.SizeOf(ddtHeader)]; + structureBytes = new byte[Marshal.SizeOf(ddtHeader)]; imageStream.Read(structureBytes, 0, structureBytes.Length); structurePointer = Marshal.AllocHGlobal(Marshal.SizeOf(ddtHeader)); Marshal.Copy(structureBytes, 0, structurePointer, Marshal.SizeOf(ddtHeader)); @@ -2293,7 +2287,7 @@ namespace DiscImageChef.DiscImages userDataDdt[i] = BitConverter.ToUInt64(decompressedDdt, (int)(i * sizeof(ulong))); DateTime ddtEnd = DateTime.UtcNow; - inMemoryDdt = true; + inMemoryDdt = true; DicConsole.DebugWriteLine("DiscImageChef format plugin", "Took {0} seconds to decompress DDT", (ddtEnd - ddtStart).TotalSeconds); @@ -2312,7 +2306,7 @@ namespace DiscImageChef.DiscImages // CICM XML metadata block case BlockType.CicmBlock: CicmMetadataBlock cicmBlock = new CicmMetadataBlock(); - structureBytes = new byte[Marshal.SizeOf(cicmBlock)]; + structureBytes = new byte[Marshal.SizeOf(cicmBlock)]; imageStream.Read(structureBytes, 0, structureBytes.Length); structurePointer = Marshal.AllocHGlobal(Marshal.SizeOf(cicmBlock)); Marshal.Copy(structureBytes, 0, structurePointer, Marshal.SizeOf(cicmBlock)); @@ -2331,7 +2325,7 @@ namespace DiscImageChef.DiscImages try { StreamReader sr = new StreamReader(cicmMs); - CicmMetadata = (CICMMetadataType)cicmXs.Deserialize(sr); + CicmMetadata = (CICMMetadataType)cicmXs.Deserialize(sr); sr.Close(); } catch(XmlException ex) @@ -2346,7 +2340,7 @@ namespace DiscImageChef.DiscImages // Dump hardware block case BlockType.DumpHardwareBlock: DumpHardwareHeader dumpBlock = new DumpHardwareHeader(); - structureBytes = new byte[Marshal.SizeOf(dumpBlock)]; + structureBytes = new byte[Marshal.SizeOf(dumpBlock)]; imageStream.Read(structureBytes, 0, structureBytes.Length); structurePointer = Marshal.AllocHGlobal(Marshal.SizeOf(dumpBlock)); Marshal.Copy(structureBytes, 0, structurePointer, Marshal.SizeOf(dumpBlock)); @@ -2376,7 +2370,7 @@ namespace DiscImageChef.DiscImages for(ushort i = 0; i < dumpBlock.entries; i++) { DumpHardwareEntry dumpEntry = new DumpHardwareEntry(); - structureBytes = new byte[Marshal.SizeOf(dumpEntry)]; + structureBytes = new byte[Marshal.SizeOf(dumpEntry)]; imageStream.Read(structureBytes, 0, structureBytes.Length); structurePointer = Marshal.AllocHGlobal(Marshal.SizeOf(dumpEntry)); Marshal.Copy(structureBytes, 0, structurePointer, Marshal.SizeOf(dumpEntry)); @@ -2546,7 +2540,7 @@ namespace DiscImageChef.DiscImages // Initialize compressors properties (all maxed) lzmaEncoderProperties = new LzmaEncoderProperties(true, (int)dictionary, 273); - flakeWriterSettings = new FlakeWriterSettings + flakeWriterSettings = new FlakeWriterSettings { PCM = AudioPCMConfig.RedBook, DoMD5 = false, @@ -2571,7 +2565,7 @@ namespace DiscImageChef.DiscImages // Check if FLAKE's block size is bigger than what we want if(flakeWriterSettings.BlockSize > MAX_FLAKE_BLOCK) flakeWriterSettings.BlockSize = MAX_FLAKE_BLOCK; if(flakeWriterSettings.BlockSize < MIN_FLAKE_BLOCK) flakeWriterSettings.BlockSize = MIN_FLAKE_BLOCK; - FlakeWriter.Vendor = "DiscImageChef"; + FlakeWriter.Vendor = "DiscImageChef"; IsWriting = true; ErrorMessage = null; @@ -2656,7 +2650,7 @@ namespace DiscImageChef.DiscImages { trk = Tracks.FirstOrDefault(t => sectorAddress >= t.TrackStartSector && sectorAddress <= t.TrackEndSector); - if(trk.TrackSequence == 0) + if(trk.TrackSequence == 0) throw new ArgumentOutOfRangeException(nameof(sectorAddress), "Can't found track containing requested sector"); } @@ -2766,11 +2760,11 @@ namespace DiscImageChef.DiscImages if(currentBlockHeader.compression == CompressionType.Flac) flakeWriter = new FlakeWriter("", blockStream, flakeWriterSettings) {DoSeekTable = false}; else lzmaBlockStream = new LzmaStream(lzmaEncoderProperties, false, blockStream); - crc64 = new Crc64Context(); + crc64 = new Crc64Context(); } ulong ddtEntry = (ulong)((imageStream.Position << shift) + currentBlockOffset); - if(hash != null) deduplicationTable.Add(hashString, ddtEntry); + if(hash != null) deduplicationTable.Add(hashString, ddtEntry); if(currentBlockHeader.compression == CompressionType.Flac) { AudioBuffer audioBuffer = new AudioBuffer(AudioPCMConfig.RedBook, data, SAMPLES_PER_SECTOR); @@ -2873,7 +2867,7 @@ namespace DiscImageChef.DiscImages case TrackType.CdMode1: if(sectorPrefix == null) sectorPrefix = new byte[imageInfo.Sectors * 16]; if(sectorSuffix == null) sectorSuffix = new byte[imageInfo.Sectors * 288]; - sector = new byte[2048]; + sector = new byte[2048]; Array.Copy(data, 0, sectorPrefix, (int)sectorAddress * 16, 16); Array.Copy(data, 16, sector, 0, 2048); Array.Copy(data, 2064, sectorSuffix, (int)sectorAddress * 288, 288); @@ -2883,7 +2877,7 @@ namespace DiscImageChef.DiscImages case TrackType.CdMode2Form2: if(sectorPrefix == null) sectorPrefix = new byte[imageInfo.Sectors * 16]; if(sectorSuffix == null) sectorSuffix = new byte[imageInfo.Sectors * 288]; - sector = new byte[2336]; + sector = new byte[2336]; Array.Copy(data, 0, sectorPrefix, (int)sectorAddress * 16, 16); Array.Copy(data, 16, sector, 0, 2336); return WriteSector(sector, sectorAddress); @@ -2976,7 +2970,7 @@ namespace DiscImageChef.DiscImages if(newTag == null) return WriteSector(sector, sectorAddress); if(sectorSubchannel == null) - sectorSubchannel = new byte[newTag.Length * (int)imageInfo.Sectors]; + sectorSubchannel = new byte[newTag.Length * (int)imageInfo.Sectors]; Array.Copy(newTag, 0, sectorSubchannel, newTag.Length * (int)sectorAddress, newTag.Length); return WriteSector(sector, sectorAddress); @@ -3035,12 +3029,10 @@ namespace DiscImageChef.DiscImages case MediaType.AppleSonySS: case MediaType.AppleWidget: case MediaType.PriamDataTower: - int sectorSize = 0; + int sectorSize = 0; if(data.Length % 524 == 0) sectorSize = 524; - else if(data.Length % 532 == 0) - sectorSize = 532; - else if(data.Length % 536 == 0) - sectorSize = 536; + else if(data.Length % 532 == 0) sectorSize = 532; + else if(data.Length % 536 == 0) sectorSize = 536; if(sectorSize == 0) { @@ -3176,7 +3168,7 @@ namespace DiscImageChef.DiscImages foreach(KeyValuePair mediaTag in mediaTags) { DataType dataType = GetDataTypeForMediaTag(mediaTag.Key); - idxEntry = new IndexEntry + idxEntry = new IndexEntry { blockType = BlockType.DataBlock, dataType = dataType, @@ -3213,7 +3205,7 @@ namespace DiscImageChef.DiscImages } else { - tagData = blockStream.ToArray(); + tagData = blockStream.ToArray(); Crc64Context crc64Ctx = new Crc64Context(); crc64Ctx.Update(lzmaProperties); crc64Ctx.Update(tagData); @@ -3234,7 +3226,7 @@ namespace DiscImageChef.DiscImages imageStream.Write(structureBytes, 0, structureBytes.Length); if(tagBlock.compression == CompressionType.Lzma) imageStream.Write(lzmaProperties, 0, lzmaProperties.Length); - imageStream.Write(tagData, 0, tagData.Length); + imageStream.Write(tagData, 0, tagData.Length); index.RemoveAll(t => t.blockType == BlockType.DataBlock && t.dataType == dataType); @@ -3282,8 +3274,7 @@ namespace DiscImageChef.DiscImages byte[] dumpSoftwareOperatingSystem = null; if(!string.IsNullOrWhiteSpace(dump.Manufacturer)) - dumpManufacturer = - Encoding.UTF8.GetBytes(dump.Manufacturer); + dumpManufacturer = Encoding.UTF8.GetBytes(dump.Manufacturer); if(!string.IsNullOrWhiteSpace(dump.Model)) dumpModel = Encoding.UTF8.GetBytes(dump.Model); if(!string.IsNullOrWhiteSpace(dump.Revision)) dumpRevision = Encoding.UTF8.GetBytes(dump.Revision); if(!string.IsNullOrWhiteSpace(dump.Firmware)) dumpFirmware = Encoding.UTF8.GetBytes(dump.Firmware); @@ -3422,10 +3413,10 @@ namespace DiscImageChef.DiscImages DicConsole.DebugWriteLine("DiscImageChef format plugin", "Writing CICM XML block to position {0}", idxEntry.offset); - CicmMetadataBlock cicmBlock = + CicmMetadataBlock cicmBlock = new CicmMetadataBlock {identifier = BlockType.CicmBlock, length = (uint)cicmMs.Length}; - structurePointer = Marshal.AllocHGlobal(Marshal.SizeOf(cicmBlock)); - structureBytes = new byte[Marshal.SizeOf(cicmBlock)]; + structurePointer = Marshal.AllocHGlobal(Marshal.SizeOf(cicmBlock)); + structureBytes = new byte[Marshal.SizeOf(cicmBlock)]; Marshal.StructureToPtr(cicmBlock, structurePointer, true); Marshal.Copy(structurePointer, structureBytes, 0, structureBytes.Length); Marshal.FreeHGlobal(structurePointer); @@ -3445,11 +3436,11 @@ namespace DiscImageChef.DiscImages if(md5Provider != null) { - byte[] md5 = md5Provider.Final(); - ChecksumEntry md5Entry = + byte[] md5 = md5Provider.Final(); + ChecksumEntry md5Entry = new ChecksumEntry {type = ChecksumAlgorithm.Md5, length = (uint)md5.Length}; - structurePointer = Marshal.AllocHGlobal(Marshal.SizeOf(md5Entry)); - structureBytes = new byte[Marshal.SizeOf(md5Entry)]; + structurePointer = Marshal.AllocHGlobal(Marshal.SizeOf(md5Entry)); + structureBytes = new byte[Marshal.SizeOf(md5Entry)]; Marshal.StructureToPtr(md5Entry, structurePointer, true); Marshal.Copy(structurePointer, structureBytes, 0, structureBytes.Length); Marshal.FreeHGlobal(structurePointer); @@ -3460,11 +3451,11 @@ namespace DiscImageChef.DiscImages if(sha1Provider != null) { - byte[] sha1 = sha1Provider.Final(); - ChecksumEntry sha1Entry = + byte[] sha1 = sha1Provider.Final(); + ChecksumEntry sha1Entry = new ChecksumEntry {type = ChecksumAlgorithm.Sha1, length = (uint)sha1.Length}; - structurePointer = Marshal.AllocHGlobal(Marshal.SizeOf(sha1Entry)); - structureBytes = new byte[Marshal.SizeOf(sha1Entry)]; + structurePointer = Marshal.AllocHGlobal(Marshal.SizeOf(sha1Entry)); + structureBytes = new byte[Marshal.SizeOf(sha1Entry)]; Marshal.StructureToPtr(sha1Entry, structurePointer, true); Marshal.Copy(structurePointer, structureBytes, 0, structureBytes.Length); Marshal.FreeHGlobal(structurePointer); @@ -3475,11 +3466,11 @@ namespace DiscImageChef.DiscImages if(sha256Provider != null) { - byte[] sha256 = sha256Provider.Final(); - ChecksumEntry sha256Entry = + byte[] sha256 = sha256Provider.Final(); + ChecksumEntry sha256Entry = new ChecksumEntry {type = ChecksumAlgorithm.Sha256, length = (uint)sha256.Length}; - structurePointer = Marshal.AllocHGlobal(Marshal.SizeOf(sha256Entry)); - structureBytes = new byte[Marshal.SizeOf(sha256Entry)]; + structurePointer = Marshal.AllocHGlobal(Marshal.SizeOf(sha256Entry)); + structureBytes = new byte[Marshal.SizeOf(sha256Entry)]; Marshal.StructureToPtr(sha256Entry, structurePointer, true); Marshal.Copy(structurePointer, structureBytes, 0, structureBytes.Length); Marshal.FreeHGlobal(structurePointer); @@ -3490,11 +3481,11 @@ namespace DiscImageChef.DiscImages if(spamsumProvider != null) { - byte[] spamsum = Encoding.ASCII.GetBytes(spamsumProvider.End()); - ChecksumEntry spamsumEntry = + byte[] spamsum = Encoding.ASCII.GetBytes(spamsumProvider.End()); + ChecksumEntry spamsumEntry = new ChecksumEntry {type = ChecksumAlgorithm.SpamSum, length = (uint)spamsum.Length}; - structurePointer = Marshal.AllocHGlobal(Marshal.SizeOf(spamsumEntry)); - structureBytes = new byte[Marshal.SizeOf(spamsumEntry)]; + structurePointer = Marshal.AllocHGlobal(Marshal.SizeOf(spamsumEntry)); + structureBytes = new byte[Marshal.SizeOf(spamsumEntry)]; Marshal.StructureToPtr(spamsumEntry, structurePointer, true); Marshal.Copy(structurePointer, structureBytes, 0, structureBytes.Length); Marshal.FreeHGlobal(structurePointer); @@ -3506,7 +3497,7 @@ namespace DiscImageChef.DiscImages if(chkHeader.entries > 0) { chkHeader.length = (uint)chkMs.Length; - idxEntry = new IndexEntry + idxEntry = new IndexEntry { blockType = BlockType.ChecksumBlock, dataType = DataType.NoData, @@ -3565,7 +3556,7 @@ namespace DiscImageChef.DiscImages byte[] lzmaProperties = lzmaBlockStream.Properties; lzmaBlockStream.Close(); - ddtHeader.cmpLength = (uint)blockStream.Length + LZMA_PROPERTIES_LENGTH; + ddtHeader.cmpLength = (uint)blockStream.Length + LZMA_PROPERTIES_LENGTH; Crc64Context cmpCrc64Context = new Crc64Context(); cmpCrc64Context.Update(lzmaProperties); cmpCrc64Context.Update(blockStream.ToArray()); @@ -3592,7 +3583,7 @@ namespace DiscImageChef.DiscImages switch(imageInfo.XmlMediaType) { case XmlMediaType.OpticalDisc when Tracks != null && Tracks.Count > 0: - if(sectorPrefix != null && sectorSuffix != null) + if(sectorPrefix != null && sectorSuffix != null) { idxEntry = new IndexEntry { @@ -3650,7 +3641,7 @@ namespace DiscImageChef.DiscImages Marshal.FreeHGlobal(structurePointer); imageStream.Write(structureBytes, 0, structureBytes.Length); if(prefixBlock.compression == CompressionType.Lzma) - imageStream.Write(lzmaProperties, 0, lzmaProperties.Length); + imageStream.Write(lzmaProperties, 0, lzmaProperties.Length); imageStream.Write(blockStream.ToArray(), 0, (int)blockStream.Length); index.RemoveAll(t => t.blockType == BlockType.DataBlock && @@ -3712,7 +3703,7 @@ namespace DiscImageChef.DiscImages Marshal.FreeHGlobal(structurePointer); imageStream.Write(structureBytes, 0, structureBytes.Length); if(prefixBlock.compression == CompressionType.Lzma) - imageStream.Write(lzmaProperties, 0, lzmaProperties.Length); + imageStream.Write(lzmaProperties, 0, lzmaProperties.Length); imageStream.Write(blockStream.ToArray(), 0, (int)blockStream.Length); index.RemoveAll(t => t.blockType == BlockType.DataBlock && @@ -3780,7 +3771,7 @@ namespace DiscImageChef.DiscImages Marshal.FreeHGlobal(structurePointer); imageStream.Write(structureBytes, 0, structureBytes.Length); if(subchannelBlock.compression == CompressionType.Lzma) - imageStream.Write(lzmaProperties, 0, lzmaProperties.Length); + imageStream.Write(lzmaProperties, 0, lzmaProperties.Length); imageStream.Write(blockStream.ToArray(), 0, (int)blockStream.Length); index.RemoveAll(t => t.blockType == BlockType.DataBlock && @@ -3858,13 +3849,12 @@ namespace DiscImageChef.DiscImages break; case XmlMediaType.BlockMedia: - if(sectorSubchannel != null && - (imageInfo.MediaType == MediaType.AppleFileWare || - imageInfo.MediaType == MediaType.AppleSonySS || - imageInfo.MediaType == MediaType.AppleSonyDS || - imageInfo.MediaType == MediaType.AppleProfile || - imageInfo.MediaType == MediaType.AppleWidget || - imageInfo.MediaType == MediaType.PriamDataTower)) + if(sectorSubchannel != null && (imageInfo.MediaType == MediaType.AppleFileWare || + imageInfo.MediaType == MediaType.AppleSonySS || + imageInfo.MediaType == MediaType.AppleSonyDS || + imageInfo.MediaType == MediaType.AppleProfile || + imageInfo.MediaType == MediaType.AppleWidget || + imageInfo.MediaType == MediaType.PriamDataTower)) { DataType tagType = DataType.NoData; @@ -3955,7 +3945,7 @@ namespace DiscImageChef.DiscImages Marshal.FreeHGlobal(structurePointer); imageStream.Write(structureBytes, 0, structureBytes.Length); if(subchannelBlock.compression == CompressionType.Lzma) - imageStream.Write(lzmaProperties, 0, lzmaProperties.Length); + imageStream.Write(lzmaProperties, 0, lzmaProperties.Length); imageStream.Write(blockStream.ToArray(), 0, (int)blockStream.Length); index.RemoveAll(t => t.blockType == BlockType.DataBlock && t.dataType == tagType); @@ -3970,7 +3960,7 @@ namespace DiscImageChef.DiscImages // Write metadata if present SetMetadataFromTags(); MetadataBlock metadataBlock = new MetadataBlock(); - blockStream = new MemoryStream(); + blockStream = new MemoryStream(); blockStream.Write(new byte[Marshal.SizeOf(metadataBlock)], 0, Marshal.SizeOf(metadataBlock)); byte[] tmpUtf16Le; @@ -4252,7 +4242,7 @@ namespace DiscImageChef.DiscImages track = Tracks.FirstOrDefault(trk => sectorAddress >= trk.TrackStartSector && sectorAddress <= trk.TrackEndSector); - if(track.TrackSequence == 0) + if(track.TrackSequence == 0) { ErrorMessage = $"Can't found track containing {sectorAddress}"; return false; @@ -4367,8 +4357,7 @@ namespace DiscImageChef.DiscImages { CID decoded = Decoders.SecureDigital.Decoders.DecodeCID(sdCid); if(string.IsNullOrWhiteSpace(imageInfo.DriveManufacturer)) - imageInfo.DriveManufacturer = - VendorString.Prettify(decoded.Manufacturer); + imageInfo.DriveManufacturer = VendorString.Prettify(decoded.Manufacturer); if(string.IsNullOrWhiteSpace(imageInfo.DriveModel)) imageInfo.DriveModel = decoded.ProductName; if(string.IsNullOrWhiteSpace(imageInfo.DriveFirmwareRevision)) imageInfo.DriveFirmwareRevision = @@ -4382,8 +4371,7 @@ namespace DiscImageChef.DiscImages { Decoders.MMC.CID decoded = Decoders.MMC.Decoders.DecodeCID(mmcCid); if(string.IsNullOrWhiteSpace(imageInfo.DriveManufacturer)) - imageInfo.DriveManufacturer = - Decoders.MMC.VendorString.Prettify(decoded.Manufacturer); + imageInfo.DriveManufacturer = Decoders.MMC.VendorString.Prettify(decoded.Manufacturer); if(string.IsNullOrWhiteSpace(imageInfo.DriveModel)) imageInfo.DriveModel = decoded.ProductName; if(string.IsNullOrWhiteSpace(imageInfo.DriveFirmwareRevision)) imageInfo.DriveFirmwareRevision = @@ -4524,7 +4512,7 @@ namespace DiscImageChef.DiscImages case MediaType.GOD: case MediaType.WOD: case MediaType.WUOD: return XmlMediaType.OpticalDisc; - default: return XmlMediaType.BlockMedia; + default: return XmlMediaType.BlockMedia; } } @@ -4535,10 +4523,10 @@ namespace DiscImageChef.DiscImages if(ddtEntryCache.TryGetValue(sectorAddress, out ulong entry)) return entry; - long oldPosition = imageStream.Position; + long oldPosition = imageStream.Position; imageStream.Position = outMemoryDdtPosition + Marshal.SizeOf(typeof(DdtHeader)); imageStream.Position += (long)(sectorAddress * sizeof(ulong)); - byte[] temp = new byte[sizeof(ulong)]; + byte[] temp = new byte[sizeof(ulong)]; imageStream.Read(temp, 0, sizeof(ulong)); imageStream.Position = oldPosition; entry = BitConverter.ToUInt64(temp, 0); @@ -4558,7 +4546,7 @@ namespace DiscImageChef.DiscImages return; } - long oldPosition = imageStream.Position; + long oldPosition = imageStream.Position; imageStream.Position = outMemoryDdtPosition + Marshal.SizeOf(typeof(DdtHeader)); imageStream.Position += (long)(sectorAddress * sizeof(ulong)); imageStream.Write(BitConverter.GetBytes(pointer), 0, sizeof(ulong)); @@ -5022,9 +5010,9 @@ namespace DiscImageChef.DiscImages { /// Identifier, public BlockType identifier; - public uint cylinders; - public uint heads; - public uint sectorsPerTrack; + public uint cylinders; + public uint heads; + public uint sectorsPerTrack; } /// Metadata block, contains metadata @@ -5130,7 +5118,7 @@ namespace DiscImageChef.DiscImages { /// Identifier, public BlockType identifier; - public uint length; + public uint length; } /// Dump hardware block, contains a list of hardware used to dump the media on this image diff --git a/DiscImageChef.DiscImages/DiscJuggler.cs b/DiscImageChef.DiscImages/DiscJuggler.cs index 77f14f135..871a71f0e 100644 --- a/DiscImageChef.DiscImages/DiscJuggler.cs +++ b/DiscImageChef.DiscImages/DiscJuggler.cs @@ -140,11 +140,11 @@ namespace DiscImageChef.DiscImages int position = 1; ushort sessionSequence = 0; - Sessions = new List(); - Tracks = new List(); - Partitions = new List(); - offsetmap = new Dictionary(); - trackFlags = new Dictionary(); + Sessions = new List(); + Tracks = new List(); + Partitions = new List(); + offsetmap = new Dictionary(); + trackFlags = new Dictionary(); ushort mediumType; byte maxS = descriptor[0]; @@ -180,7 +180,7 @@ namespace DiscImageChef.DiscImages StartTrack = uint.MaxValue }; - position += 15; + position += 15; bool addedATrack = false; // Read track @@ -208,8 +208,8 @@ namespace DiscImageChef.DiscImages // Read indices track.Indexes = new Dictionary(); - ushort maxI = BitConverter.ToUInt16(descriptor, position); - position += 2; + ushort maxI = BitConverter.ToUInt16(descriptor, position); + position += 2; DicConsole.DebugWriteLine("DiscJuggler plugin", "\tmaxI = {0}", maxI); for(ushort i = 0; i < maxI; i++) { @@ -221,7 +221,7 @@ namespace DiscImageChef.DiscImages // Read CD-Text uint maxC = BitConverter.ToUInt32(descriptor, position); - position += 4; + position += 4; DicConsole.DebugWriteLine("DiscJuggler plugin", "\tmaxC = {0}", maxC); for(uint c = 0; c < maxC; c++) { @@ -244,7 +244,7 @@ namespace DiscImageChef.DiscImages } } - position += 2; + position += 2; uint trackMode = BitConverter.ToUInt32(descriptor, position); DicConsole.DebugWriteLine("DiscJuggler plugin", "\ttrackMode = {0}", trackMode); position += 4; @@ -263,8 +263,8 @@ namespace DiscImageChef.DiscImages position += 4; track.TrackStartSector = BitConverter.ToUInt32(descriptor, position); DicConsole.DebugWriteLine("DiscJuggler plugin", "\ttrackStart = {0}", track.TrackStartSector); - position += 4; - uint trackLen = BitConverter.ToUInt32(descriptor, position); + position += 4; + uint trackLen = BitConverter.ToUInt32(descriptor, position); track.TrackEndSector = track.TrackStartSector + trackLen - 1; DicConsole.DebugWriteLine("DiscJuggler plugin", "\ttrackEnd = {0}", track.TrackEndSector); position += 4; @@ -286,7 +286,7 @@ namespace DiscImageChef.DiscImages uint readMode = BitConverter.ToUInt32(descriptor, position); DicConsole.DebugWriteLine("DiscJuggler plugin", "\treadMode = {0}", readMode); - position += 4; + position += 4; uint trackCtl = BitConverter.ToUInt32(descriptor, position); DicConsole.DebugWriteLine("DiscJuggler plugin", "\ttrackCtl = {0}", trackCtl); position += 4; @@ -297,7 +297,7 @@ namespace DiscImageChef.DiscImages byte[] isrc = new byte[12]; Array.Copy(descriptor, position, isrc, 0, 12); DicConsole.DebugWriteLine("DiscJuggler plugin", "\tisrc = {0}", StringHandlers.CToString(isrc)); - position += 12; + position += 12; uint isrcValid = BitConverter.ToUInt32(descriptor, position); DicConsole.DebugWriteLine("DiscJuggler plugin", "\tisrc_valid = {0}", isrcValid); position += 4; @@ -330,32 +330,32 @@ namespace DiscImageChef.DiscImages // Audio case 0: if(imageInfo.SectorSize < 2352) imageInfo.SectorSize = 2352; - track.TrackType = TrackType.Audio; - track.TrackBytesPerSector = 2352; - track.TrackRawBytesPerSector = 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; + 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 += + 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 += + 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($"Unknown read mode {readMode}"); @@ -365,15 +365,15 @@ namespace DiscImageChef.DiscImages // Mode 1 or DVD case 1: if(imageInfo.SectorSize < 2048) imageInfo.SectorSize = 2048; - track.TrackType = TrackType.CdMode1; - track.TrackBytesPerSector = 2048; + track.TrackType = TrackType.CdMode1; + track.TrackBytesPerSector = 2048; switch(readMode) { case 0: - track.TrackRawBytesPerSector = 2048; + track.TrackRawBytesPerSector = 2048; if(firstTrack) currentOffset += 150 * (ulong)track.TrackRawBytesPerSector; - track.TrackFileOffset = currentOffset; - currentOffset += trackLen * (ulong)track.TrackRawBytesPerSector; + track.TrackFileOffset = currentOffset; + currentOffset += trackLen * (ulong)track.TrackRawBytesPerSector; break; case 1: throw @@ -395,13 +395,13 @@ namespace DiscImageChef.DiscImages imageInfo.ReadableSectorTags.Add(SectorTagType.CdSectorEdc); break; case 3: - track.TrackRawBytesPerSector = 2352; + 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 += + 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); @@ -417,13 +417,13 @@ namespace DiscImageChef.DiscImages imageInfo.ReadableSectorTags.Add(SectorTagType.CdSectorEdc); break; case 4: - track.TrackRawBytesPerSector = 2352; + 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 += + 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); @@ -445,18 +445,18 @@ namespace DiscImageChef.DiscImages // Mode 2 case 2: if(imageInfo.SectorSize < 2336) imageInfo.SectorSize = 2336; - track.TrackType = TrackType.CdMode2Formless; - track.TrackBytesPerSector = 2336; + track.TrackType = TrackType.CdMode2Formless; + track.TrackBytesPerSector = 2336; switch(readMode) { case 0: throw new ImageNotSupportedException($"Invalid read mode {readMode} for this track"); case 1: - track.TrackRawBytesPerSector = 2336; + track.TrackRawBytesPerSector = 2336; if(firstTrack) currentOffset += 150 * (ulong)track.TrackRawBytesPerSector; - track.TrackFileOffset = currentOffset; - currentOffset += trackLen * (ulong)track.TrackRawBytesPerSector; + track.TrackFileOffset = currentOffset; + currentOffset += trackLen * (ulong)track.TrackRawBytesPerSector; break; case 2: track.TrackRawBytesPerSector = 2352; @@ -467,13 +467,13 @@ namespace DiscImageChef.DiscImages imageInfo.ReadableSectorTags.Add(SectorTagType.CdSectorHeader); break; case 3: - track.TrackRawBytesPerSector = 2352; + 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 += + 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); @@ -481,13 +481,13 @@ namespace DiscImageChef.DiscImages imageInfo.ReadableSectorTags.Add(SectorTagType.CdSectorHeader); break; case 4: - track.TrackRawBytesPerSector = 2352; + 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 += + 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); @@ -548,7 +548,7 @@ namespace DiscImageChef.DiscImages byte[] filenameB = new byte[descriptor[position]]; position++; Array.Copy(descriptor, position, filenameB, 0, filenameB.Length); - position += filenameB.Length; + position += filenameB.Length; string filename = Path.GetFileName(Encoding.Default.GetString(filenameB)); DicConsole.DebugWriteLine("DiscJuggler plugin", "filename = {0}", filename); @@ -560,13 +560,13 @@ namespace DiscImageChef.DiscImages DicConsole.DebugWriteLine("DiscJuggler plugin", "mediumType = {0}", mediumType); uint discSize = BitConverter.ToUInt32(descriptor, position); - position += 4; + position += 4; DicConsole.DebugWriteLine("DiscJuggler plugin", "discSize = {0}", discSize); byte[] volidB = new byte[descriptor[position]]; position++; Array.Copy(descriptor, position, volidB, 0, volidB.Length); - position += volidB.Length; + position += volidB.Length; string volid = Path.GetFileName(Encoding.Default.GetString(volidB)); DicConsole.DebugWriteLine("DiscJuggler plugin", "volid = {0}", volid); @@ -576,7 +576,7 @@ namespace DiscImageChef.DiscImages byte[] mcn = new byte[13]; Array.Copy(descriptor, position, mcn, 0, 13); DicConsole.DebugWriteLine("DiscJuggler plugin", "mcn = {0}", StringHandlers.CToString(mcn)); - position += 13; + position += 13; uint mcnValid = BitConverter.ToUInt32(descriptor, position); DicConsole.DebugWriteLine("DiscJuggler plugin", "mcn_valid = {0}", mcnValid); position += 4; @@ -629,15 +629,11 @@ namespace DiscImageChef.DiscImages } } - 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.Application = "DiscJuggler"; @@ -703,7 +699,7 @@ namespace DiscImageChef.DiscImages .Where(kvp => sectorAddress >= kvp.Value) .Where(kvp => Tracks .Where(track => track.TrackSequence == kvp.Key) - .Any(track => sectorAddress < + .Any(track => sectorAddress < track.TrackEndSector))) return ReadSectorsTag(sectorAddress - kvp.Value, length, kvp.Key, tag); @@ -838,7 +834,7 @@ namespace DiscImageChef.DiscImages case SectorTagType.CdTrackFlags: if(trackFlags.TryGetValue(track, out byte flag)) return new[] {flag}; - throw new ArgumentException("Unsupported tag requested", nameof(tag)); + throw new ArgumentException("Unsupported tag requested", nameof(tag)); default: throw new ArgumentException("Unsupported tag requested", nameof(tag)); } @@ -1035,7 +1031,7 @@ namespace DiscImageChef.DiscImages foreach(KeyValuePair kvp in from kvp in offsetmap where sectorAddress >= kvp.Value from track in Tracks - where track.TrackSequence == kvp.Key + where track.TrackSequence == kvp.Key where sectorAddress - kvp.Value < track.TrackEndSector - track.TrackStartSector select kvp) @@ -1119,14 +1115,14 @@ namespace DiscImageChef.DiscImages return CdChecksums.CheckCdSector(buffer); } - public bool? VerifySectors(ulong sectorAddress, uint length, out List failingLbas, - out List unknownLbas) + public bool? VerifySectors(ulong sectorAddress, uint length, out List failingLbas, + out List unknownLbas) { byte[] buffer = ReadSectorsLong(sectorAddress, length); int bps = (int)(buffer.Length / length); byte[] sector = new byte[bps]; - failingLbas = new List(); - unknownLbas = new List(); + failingLbas = new List(); + unknownLbas = new List(); for(int i = 0; i < length; i++) { @@ -1149,14 +1145,14 @@ namespace DiscImageChef.DiscImages return failingLbas.Count <= 0; } - public bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List failingLbas, - out List unknownLbas) + public 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); byte[] sector = new byte[bps]; - failingLbas = new List(); - unknownLbas = new List(); + failingLbas = new List(); + unknownLbas = new List(); for(int i = 0; i < length; i++) { diff --git a/DiscImageChef.DiscImages/DiskCopy42.cs b/DiscImageChef.DiscImages/DiskCopy42.cs index 69cfdca67..39cb5e159 100644 --- a/DiscImageChef.DiscImages/DiskCopy42.cs +++ b/DiscImageChef.DiscImages/DiskCopy42.cs @@ -74,7 +74,7 @@ namespace DiscImageChef.DiscImages /// Defined by Sigma Seven's BLU const byte kSigmaFmtByteTwiggy = 0x01; /// 3.5" single side double density GCR and MFM all use same code - const byte kSonyFmtByte400K = 0x02; + const byte kSonyFmtByte400K = 0x02; const byte kSonyFmtByte720K = kSonyFmtByte400K; const byte kSonyFmtByte1440K = kSonyFmtByte400K; const byte kSonyFmtByte1680K = kSonyFmtByte400K; @@ -92,8 +92,8 @@ namespace DiscImageChef.DiscImages /// Defined by LisaEm const byte kFmtNotStandard = 0x93; /// Used incorrectly by Mac OS X with certaing disk images - const byte kMacOSXFmtByte = 0x00; - const string REGEX_DCPY = @"(?\S+)\s(?\S+)\rData checksum=\$(?\S+)$"; + const byte kMacOSXFmtByte = 0x00; + const string REGEX_DCPY = @"(?\S+)\s(?\S+)\rData checksum=\$(?\S+)$"; /// Bytes per tag, should be 12 uint bptag; @@ -103,12 +103,12 @@ namespace DiscImageChef.DiscImages IFilter dc42ImageFilter; /// Header of opened image Dc42Header header; - ImageInfo imageInfo; + ImageInfo imageInfo; /// Start of tags in disk image, after data sectors - uint tagOffset; - bool twiggy; - byte[] twiggyCache; - byte[] twiggyCacheTags; + uint tagOffset; + bool twiggy; + byte[] twiggyCache; + byte[] twiggyCacheTags; FileStream writingStream; @@ -424,14 +424,12 @@ namespace DiscImageChef.DiscImages 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, + 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); + twiggyCacheTags.Length - copiedSectors * bptag - sectorsToCopy * bptag, + sectorsToCopy * bptag); copiedSectors += sectorsToCopy; } @@ -457,9 +455,9 @@ namespace DiscImageChef.DiscImages string dev = null; string pre = null; - string major = $"{version.MajorVersion}"; - string minor = $".{version.MinorVersion / 10}"; - if(version.MinorVersion % 10 > 0) release = $".{version.MinorVersion % 10}"; + string major = $"{version.MajorVersion}"; + string minor = $".{version.MinorVersion / 10}"; + if(version.MinorVersion % 10 > 0) release = $".{version.MinorVersion % 10}"; switch(version.DevStage) { case Version.DevelopmentStage.Alpha: @@ -581,8 +579,8 @@ namespace DiscImageChef.DiscImages return null; } - public bool? VerifySectors(ulong sectorAddress, uint length, out List failingLbas, - out List unknownLbas) + public bool? VerifySectors(ulong sectorAddress, uint length, out List failingLbas, + out List unknownLbas) { failingLbas = new List(); unknownLbas = new List(); @@ -592,8 +590,8 @@ namespace DiscImageChef.DiscImages return null; } - public bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List failingLbas, - out List unknownLbas) + public bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List failingLbas, + out List unknownLbas) { failingLbas = new List(); unknownLbas = new List(); @@ -664,7 +662,7 @@ namespace DiscImageChef.DiscImages { Stream stream = dc42ImageFilter.GetDataForkStream(); stream.Seek((long)(dataOffset + sectorAddress * imageInfo.SectorSize), SeekOrigin.Begin); - stream.Read(buffer, 0, (int)(length * imageInfo.SectorSize)); + stream.Read(buffer, 0, (int)(length * imageInfo.SectorSize)); } return buffer; @@ -690,7 +688,7 @@ namespace DiscImageChef.DiscImages { Stream stream = dc42ImageFilter.GetDataForkStream(); stream.Seek((long)(tagOffset + sectorAddress * bptag), SeekOrigin.Begin); - stream.Read(buffer, 0, (int)(length * bptag)); + stream.Read(buffer, 0, (int)(length * bptag)); } return buffer; @@ -781,7 +779,7 @@ namespace DiscImageChef.DiscImages public IEnumerable SupportedMediaTags => new MediaTagType[] { }; public IEnumerable SupportedSectorTags => new[] {SectorTagType.AppleSectorTag}; - public IEnumerable SupportedMediaTypes => + public IEnumerable SupportedMediaTypes => new[] { MediaType.AppleFileWare, MediaType.AppleHD20, MediaType.AppleProfile, MediaType.AppleSonyDS, @@ -797,7 +795,7 @@ namespace DiscImageChef.DiscImages public bool Create(string path, MediaType mediaType, Dictionary options, ulong sectors, uint sectorSize) { - header = new Dc42Header(); + header = new Dc42Header(); bool tags = false; bool macosx = false; @@ -813,9 +811,9 @@ namespace DiscImageChef.DiscImages switch(mediaType) { case MediaType.AppleFileWare: - header.FmtByte = kSigmaFmtByteTwiggy; - header.Format = kSigmaFormatTwiggy; - twiggy = true; + header.FmtByte = kSigmaFmtByteTwiggy; + header.Format = kSigmaFormatTwiggy; + twiggy = true; // TODO ErrorMessage = "Twiggy write support not yet implemented"; return false; @@ -909,11 +907,11 @@ namespace DiscImageChef.DiscImages return false; } - dataOffset = 0x54; - tagOffset = header.TagSize != 0 ? 0x54 + header.DataSize : 0; - header.DiskName = "-DiscImageChef converted image-"; - header.Valid = 1; - header.DataSize = (uint)(sectors * 512); + dataOffset = 0x54; + tagOffset = header.TagSize != 0 ? 0x54 + header.DataSize : 0; + header.DiskName = "-DiscImageChef converted image-"; + header.Valid = 1; + header.DataSize = (uint)(sectors * 512); if(tags) header.TagSize = (uint)(sectors * 12); imageInfo = new ImageInfo {MediaType = mediaType, SectorSize = sectorSize, Sectors = sectors}; @@ -1055,7 +1053,7 @@ namespace DiscImageChef.DiscImages { writingStream.Seek((long)(dataOffset + (sectorAddress + i) * 512), SeekOrigin.Begin); writingStream.Write(data, (int)(i * 524 + 0), 512); - writingStream.Seek((long)(tagOffset + (sectorAddress + i) * 12), + writingStream.Seek((long)(tagOffset + (sectorAddress + i) * 12), SeekOrigin.Begin); writingStream.Write(data, (int)(i * 524 + 512), 12); diff --git a/DiscImageChef.DiscImages/DriDiskCopy.cs b/DiscImageChef.DiscImages/DriDiskCopy.cs index 7bf75b8a0..fc2c75fae 100644 --- a/DiscImageChef.DiscImages/DriDiskCopy.cs +++ b/DiscImageChef.DiscImages/DriDiskCopy.cs @@ -53,7 +53,7 @@ namespace DiscImageChef.DiscImages IFilter driImageFilter; /// Footer of opened image - DriFooter footer; + DriFooter footer; ImageInfo imageInfo; FileStream writingStream; @@ -163,7 +163,7 @@ namespace DiscImageChef.DiscImages stream.Seek(-buffer.Length, SeekOrigin.End); stream.Read(buffer, 0, buffer.Length); - footer = new DriFooter(); + footer = new DriFooter(); IntPtr ftrPtr = Marshal.AllocHGlobal(buffer.Length); Marshal.Copy(buffer, 0, ftrPtr, buffer.Length); footer = (DriFooter)Marshal.PtrToStructure(ftrPtr, typeof(DriFooter)); @@ -197,20 +197,17 @@ namespace DiscImageChef.DiscImages imageInfo.Application, imageInfo.ApplicationVersion); // 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)) + 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; } - imageInfo.MediaType = - Geometry.GetMediaType(((ushort)imageInfo.Cylinders, (byte)imageInfo.Heads, - (ushort)imageInfo.SectorsPerTrack, imageInfo.SectorSize, MediaEncoding.MFM, false - )); + imageInfo.MediaType = Geometry.GetMediaType(((ushort)imageInfo.Cylinders, (byte)imageInfo.Heads, + (ushort)imageInfo.SectorsPerTrack, imageInfo.SectorSize, + MediaEncoding.MFM, false)); switch(imageInfo.MediaType) { @@ -245,8 +242,8 @@ namespace DiscImageChef.DiscImages return null; } - public bool? VerifySectors(ulong sectorAddress, uint length, out List failingLbas, - out List unknownLbas) + public bool? VerifySectors(ulong sectorAddress, uint length, out List failingLbas, + out List unknownLbas) { failingLbas = new List(); unknownLbas = new List(); @@ -256,8 +253,8 @@ namespace DiscImageChef.DiscImages return null; } - public bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List failingLbas, - out List unknownLbas) + public bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List failingLbas, + out List unknownLbas) { failingLbas = new List(); unknownLbas = new List(); @@ -377,7 +374,7 @@ namespace DiscImageChef.DiscImages MediaType.FDFORMAT_525_HD, MediaType.RX50, MediaType.XDF_35, MediaType.XDF_525 }; public IEnumerable<(string name, Type type, string description)> SupportedOptions => - new(string name, Type type, string description)[] { }; + new (string name, Type type, string description)[] { }; public IEnumerable KnownExtensions => new[] {".dsk"}; public bool IsWriting { get; private set; } @@ -420,7 +417,7 @@ namespace DiscImageChef.DiscImages footer = new DriFooter { signature = new byte[51], - bpb = new DriBpb + bpb = new DriBpb { five = 5, driveCode = DriDriveCodes.mf2ed, diff --git a/DiscImageChef.DiscImages/GDI.cs b/DiscImageChef.DiscImages/GDI.cs index 78f566232..20fcac6fb 100644 --- a/DiscImageChef.DiscImages/GDI.cs +++ b/DiscImageChef.DiscImages/GDI.cs @@ -154,7 +154,7 @@ namespace DiscImageChef.DiscImages return false; } - gdiStream = new StreamReader(imageFilter.GetDataForkStream()); + gdiStream = new StreamReader(imageFilter.GetDataForkStream()); int lineNumber = 0; int tracksFound = 0; int tracks = 0; @@ -200,7 +200,7 @@ namespace DiscImageChef.DiscImages try { imageFilter.GetDataForkStream().Seek(0, SeekOrigin.Begin); - gdiStream = new StreamReader(imageFilter.GetDataForkStream()); + gdiStream = new StreamReader(imageFilter.GetDataForkStream()); int lineNumber = 0; bool highDensity = false; @@ -212,7 +212,7 @@ namespace DiscImageChef.DiscImages // Initialize disc discimage = new GdiDisc {Sessions = new List(), Tracks = new List()}; - ulong currentStart = 0; + ulong currentStart = 0; offsetmap = new Dictionary(); densitySeparationSectors = 0; @@ -240,8 +240,8 @@ namespace DiscImageChef.DiscImages trackMatch.Groups["filename"].Value, trackMatch.Groups["offset"].Value, lineNumber); - FiltersList filtersList = new FiltersList(); - GdiTrack currentTrack = new GdiTrack + FiltersList filtersList = new FiltersList(); + GdiTrack currentTrack = new GdiTrack { Bps = ushort.Parse(trackMatch.Groups["type"].Value), Flags = byte.Parse(trackMatch.Groups["flags"].Value), @@ -256,7 +256,7 @@ namespace DiscImageChef.DiscImages currentTrack.Trackfile = currentTrack.Trackfilter.GetFilename(); if(currentTrack.StartSector - currentStart > 0) - if(currentTrack.StartSector == 45000) + if(currentTrack.StartSector == 45000) { highDensity = true; offsetmap.Add(0, currentStart); @@ -288,21 +288,20 @@ namespace DiscImageChef.DiscImages Session[] sessions = new Session[2]; for(int s = 0; s < sessions.Length; s++) - if(s == 0) + if(s == 0) { sessions[s].SessionSequence = 1; foreach(GdiTrack trk in discimage.Tracks.Where(trk => !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].StartSector > trk.StartSector) sessions[s].StartSector = trk.StartSector; - if(sessions[s].EndSector < trk.Sectors + trk.StartSector - 1) + if(sessions[s].EndSector < trk.Sectors + trk.StartSector - 1) sessions[s].EndSector = trk.Sectors + trk.StartSector - 1; } } @@ -312,15 +311,14 @@ namespace DiscImageChef.DiscImages foreach(GdiTrack trk in discimage.Tracks.Where(trk => 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].StartSector > trk.StartSector) sessions[s].StartSector = trk.StartSector; - if(sessions[s].EndSector < trk.Sectors + trk.StartSector - 1) + if(sessions[s].EndSector < trk.Sectors + trk.StartSector - 1) sessions[s].EndSector = trk.Sectors + trk.StartSector - 1; } } @@ -371,7 +369,7 @@ namespace DiscImageChef.DiscImages DicConsole.DebugWriteLine("GDI plugin", "Building offset map"); - Partitions = new List(); + Partitions = new List(); ulong byteOffset = 0; for(int i = 0; i < discimage.Tracks.Count; i++) @@ -475,8 +473,7 @@ namespace DiscImageChef.DiscImages offsetmap.TryGetValue(0, out ulong transitionStart); if(sectorAddress >= transitionStart && sectorAddress < densitySeparationSectors + transitionStart) - return ReadSectors(sectorAddress - transitionStart, length, - 0); + return ReadSectors(sectorAddress - transitionStart, length, 0); throw new ArgumentOutOfRangeException(nameof(sectorAddress), "Sector address not found"); } @@ -493,8 +490,7 @@ namespace DiscImageChef.DiscImages offsetmap.TryGetValue(0, out ulong transitionStart); if(sectorAddress >= transitionStart && sectorAddress < densitySeparationSectors + transitionStart) - return ReadSectorsTag(sectorAddress - transitionStart, length, - 0, tag); + return ReadSectorsTag(sectorAddress - transitionStart, length, 0, tag); throw new ArgumentOutOfRangeException(nameof(sectorAddress), "Sector address not found"); } @@ -582,7 +578,7 @@ namespace DiscImageChef.DiscImages if(remainingSectors == 0) return buffer; - imageStream = dicTrack.Trackfilter.GetDataForkStream(); + imageStream = dicTrack.Trackfilter.GetDataForkStream(); BinaryReader br = new BinaryReader(imageStream); br.BaseStream .Seek(dicTrack.Offset + (long)(sectorAddress * (sectorOffset + sectorSize + sectorSkip) + dicTrack.Pregap * dicTrack.Bps), @@ -738,7 +734,7 @@ namespace DiscImageChef.DiscImages if(remainingSectors == 0) return buffer; - imageStream = dicTrack.Trackfilter.GetDataForkStream(); + imageStream = dicTrack.Trackfilter.GetDataForkStream(); BinaryReader br = new BinaryReader(imageStream); br.BaseStream .Seek(dicTrack.Offset + (long)(sectorAddress * (sectorOffset + sectorSize + sectorSkip) + dicTrack.Pregap * dicTrack.Bps), @@ -862,7 +858,7 @@ namespace DiscImageChef.DiscImages if(remainingSectors == 0) return buffer; - imageStream = dicTrack.Trackfilter.GetDataForkStream(); + imageStream = dicTrack.Trackfilter.GetDataForkStream(); BinaryReader br = new BinaryReader(imageStream); br.BaseStream .Seek(dicTrack.Offset + (long)(sectorAddress * (sectorOffset + sectorSize + sectorSkip) + dicTrack.Pregap * dicTrack.Bps), @@ -944,14 +940,14 @@ namespace DiscImageChef.DiscImages return CdChecksums.CheckCdSector(buffer); } - public bool? VerifySectors(ulong sectorAddress, uint length, out List failingLbas, - out List unknownLbas) + public bool? VerifySectors(ulong sectorAddress, uint length, out List failingLbas, + out List unknownLbas) { byte[] buffer = ReadSectorsLong(sectorAddress, length); int bps = (int)(buffer.Length / length); byte[] sector = new byte[bps]; - failingLbas = new List(); - unknownLbas = new List(); + failingLbas = new List(); + unknownLbas = new List(); for(int i = 0; i < length; i++) { @@ -974,14 +970,14 @@ namespace DiscImageChef.DiscImages return failingLbas.Count <= 0; } - public bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List failingLbas, - out List unknownLbas) + public 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); byte[] sector = new byte[bps]; - failingLbas = new List(); - unknownLbas = new List(); + failingLbas = new List(); + unknownLbas = new List(); for(int i = 0; i < length; i++) { diff --git a/DiscImageChef.DiscImages/HDCopy.cs b/DiscImageChef.DiscImages/HDCopy.cs index 12761388e..dfa411abc 100644 --- a/DiscImageChef.DiscImages/HDCopy.cs +++ b/DiscImageChef.DiscImages/HDCopy.cs @@ -84,7 +84,7 @@ namespace DiscImageChef.DiscImages /// /// The ImageFilter we're reading from, after the file has been opened /// - IFilter hdcpImageFilter; + IFilter hdcpImageFilter; ImageInfo imageInfo; /// @@ -129,7 +129,7 @@ namespace DiscImageChef.DiscImages public string Name => "HD-Copy disk image"; public Guid Id => new Guid("8D57483F-71A5-42EC-9B87-66AEC439C792"); - public string Format => "HD-Copy image"; + public string Format => "HD-Copy image"; public List Partitions => throw new FeatureUnsupportedImageException("Feature not supported by image format"); @@ -147,10 +147,10 @@ namespace DiscImageChef.DiscImages if(stream.Length < 2 + 2 * 82) return false; byte[] header = new byte[2 + 2 * 82]; - stream.Read(header, 0, 2 + 2 * 82); + stream.Read(header, 0, 2 + 2 * 82); IntPtr hdrPtr = Marshal.AllocHGlobal(2 + 2 * 82); - Marshal.Copy(header, 0, hdrPtr, 2 + 2 * 82); + Marshal.Copy(header, 0, hdrPtr, 2 + 2 * 82); HdcpFileHeader fheader = (HdcpFileHeader)Marshal.PtrToStructure(hdrPtr, typeof(HdcpFileHeader)); Marshal.FreeHGlobal(hdrPtr); @@ -166,7 +166,7 @@ namespace DiscImageChef.DiscImages 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++) + for(int i = 0; i < 2 * 82; i++) if(fheader.trackMap[i] > 1) return false; @@ -181,10 +181,10 @@ namespace DiscImageChef.DiscImages stream.Seek(0, SeekOrigin.Begin); byte[] header = new byte[2 + 2 * 82]; - stream.Read(header, 0, 2 + 2 * 82); + stream.Read(header, 0, 2 + 2 * 82); IntPtr hdrPtr = Marshal.AllocHGlobal(2 + 2 * 82); - Marshal.Copy(header, 0, hdrPtr, 2 + 2 * 82); + Marshal.Copy(header, 0, hdrPtr, 2 + 2 * 82); HdcpFileHeader fheader = (HdcpFileHeader)Marshal.PtrToStructure(hdrPtr, typeof(HdcpFileHeader)); Marshal.FreeHGlobal(hdrPtr); DicConsole.DebugWriteLine("HDCP plugin", @@ -195,23 +195,23 @@ namespace DiscImageChef.DiscImages imageInfo.SectorsPerTrack = fheader.sectorsPerTrack; imageInfo.SectorSize = 512; // only 512 bytes per sector supported imageInfo.Heads = 2; // only 2-sided floppies are supported - imageInfo.Sectors = 2 * imageInfo.Cylinders * imageInfo.SectorsPerTrack; - imageInfo.ImageSize = imageInfo.Sectors * imageInfo.SectorSize; + imageInfo.Sectors = 2 * imageInfo.Cylinders * imageInfo.SectorsPerTrack; + imageInfo.ImageSize = imageInfo.Sectors * imageInfo.SectorSize; imageInfo.XmlMediaType = XmlMediaType.BlockMedia; imageInfo.CreationTime = imageFilter.GetCreationTime(); imageInfo.LastModificationTime = imageFilter.GetLastWriteTime(); imageInfo.MediaTitle = Path.GetFileNameWithoutExtension(imageFilter.GetFilename()); - imageInfo.MediaType = - Geometry.GetMediaType(((ushort)imageInfo.Cylinders, 2, (ushort)imageInfo.SectorsPerTrack, 512, - MediaEncoding.MFM, false)); + imageInfo.MediaType = Geometry.GetMediaType(((ushort)imageInfo.Cylinders, 2, + (ushort)imageInfo.SectorsPerTrack, 512, MediaEncoding.MFM, + false)); // the start offset of the track data long 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) trackOffset[i] = -1; else @@ -356,8 +356,8 @@ namespace DiscImageChef.DiscImages throw new FeatureUnsupportedImageException("Feature not supported by image format"); } - public bool? VerifySectors(ulong sectorAddress, uint length, out List failingLbas, - out List unknownLbas) + public bool? VerifySectors(ulong sectorAddress, uint length, out List failingLbas, + out List unknownLbas) { failingLbas = new List(); unknownLbas = new List(); @@ -366,8 +366,8 @@ namespace DiscImageChef.DiscImages return null; } - public bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List failingLbas, - out List unknownLbas) + public bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List failingLbas, + out List unknownLbas) { throw new FeatureUnsupportedImageException("Feature not supported by image format"); } @@ -402,7 +402,7 @@ namespace DiscImageChef.DiscImages // 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) { sIndex++; // skip over escape byte diff --git a/DiscImageChef.DiscImages/IMD.cs b/DiscImageChef.DiscImages/IMD.cs index ab81a7aa9..b261fa79a 100644 --- a/DiscImageChef.DiscImages/IMD.cs +++ b/DiscImageChef.DiscImages/IMD.cs @@ -44,10 +44,10 @@ namespace DiscImageChef.DiscImages { public class Imd : IMediaImage { - const byte SECTOR_CYLINDER_MAP_MASK = 0x80; - const byte SECTOR_HEAD_MAP_MASK = 0x40; - const byte COMMENT_END = 0x1A; - const string REGEX_HEADER = + const byte SECTOR_CYLINDER_MAP_MASK = 0x80; + const byte SECTOR_HEAD_MAP_MASK = 0x40; + const byte COMMENT_END = 0x1A; + const string REGEX_HEADER = @"IMD (?\d.\d+):\s+(?\d+)\/\s*(?\d+)\/(?\d+)\s+(?\d+):(?\d+):(?\d+)\r\n"; ImageInfo imageInfo; @@ -129,15 +129,15 @@ namespace DiscImageChef.DiscImages sectorsData = new List(); byte currentCylinder = 0; - imageInfo.Cylinders = 1; - imageInfo.Heads = 1; - ulong currentLba = 0; + imageInfo.Cylinders = 1; + imageInfo.Heads = 1; + ulong currentLba = 0; TransferRate mode = TransferRate.TwoHundred; while(stream.Position + 5 < stream.Length) { - mode = (TransferRate)stream.ReadByte(); + mode = (TransferRate)stream.ReadByte(); byte cylinder = (byte)stream.ReadByte(); byte head = (byte)stream.ReadByte(); byte spt = (byte)stream.ReadByte(); @@ -155,9 +155,9 @@ namespace DiscImageChef.DiscImages if((head & 1) == 1) imageInfo.Heads = 2; - stream.Read(idmap, 0, idmap.Length); + stream.Read(idmap, 0, idmap.Length); if((head & SECTOR_CYLINDER_MAP_MASK) == SECTOR_CYLINDER_MAP_MASK) stream.Read(cylmap, 0, cylmap.Length); - if((head & SECTOR_HEAD_MAP_MASK) == SECTOR_HEAD_MAP_MASK) + if((head & SECTOR_HEAD_MAP_MASK) == SECTOR_HEAD_MAP_MASK) stream.Read(headmap, 0, headmap.Length); if(n == 0xFF) { @@ -226,9 +226,9 @@ namespace DiscImageChef.DiscImages if(mode == TransferRate.TwoHundred || mode == TransferRate.ThreeHundred || mode == TransferRate.FiveHundred) mediaEncoding = MediaEncoding.FM; - imageInfo.MediaType = - Geometry.GetMediaType(((ushort)imageInfo.Cylinders, (byte)imageInfo.Heads, - (ushort)imageInfo.SectorsPerTrack, imageInfo.SectorSize, mediaEncoding, false)); + imageInfo.MediaType = Geometry.GetMediaType(((ushort)imageInfo.Cylinders, (byte)imageInfo.Heads, + (ushort)imageInfo.SectorsPerTrack, imageInfo.SectorSize, + mediaEncoding, false)); switch(imageInfo.MediaType) { @@ -262,8 +262,8 @@ namespace DiscImageChef.DiscImages return null; } - public bool? VerifySectors(ulong sectorAddress, uint length, out List failingLbas, - out List unknownLbas) + public bool? VerifySectors(ulong sectorAddress, uint length, out List failingLbas, + out List unknownLbas) { failingLbas = new List(); unknownLbas = new List(); @@ -273,8 +273,8 @@ namespace DiscImageChef.DiscImages return null; } - public bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List failingLbas, - out List unknownLbas) + public bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List failingLbas, + out List unknownLbas) { failingLbas = new List(); unknownLbas = new List(); diff --git a/DiscImageChef.DiscImages/IMediaImage.cs b/DiscImageChef.DiscImages/IMediaImage.cs index 55b0bdab4..c2e768fd2 100644 --- a/DiscImageChef.DiscImages/IMediaImage.cs +++ b/DiscImageChef.DiscImages/IMediaImage.cs @@ -245,8 +245,8 @@ namespace DiscImageChef.DiscImages /// Track. /// List of incorrect sectors /// List of uncheckable sectors - bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List failingLbas, - out List unknownLbas); + bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List failingLbas, + out List unknownLbas); /// /// Verifies media image internal checksum. diff --git a/DiscImageChef.DiscImages/KryoFlux.cs b/DiscImageChef.DiscImages/KryoFlux.cs index e1925bda4..c6a8e163d 100644 --- a/DiscImageChef.DiscImages/KryoFlux.cs +++ b/DiscImageChef.DiscImages/KryoFlux.cs @@ -154,18 +154,18 @@ namespace DiscImageChef.DiscImages footer.length != 0x0D0D) return false; // TODO: This is supposing NoFilter, shouldn't - tracks = new SortedDictionary(); - byte step = 1; - byte heads = 2; - bool topHead = false; + tracks = new SortedDictionary(); + byte step = 1; + byte heads = 2; + bool topHead = false; string basename = Path.Combine(imageFilter.GetParentFolder(), 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; + int cylinder = t / heads; + int head = topHead ? 1 : t % heads; string trackfile = Directory.Exists(basename) ? Path.Combine(basename, $"{cylinder:D2}.{head:D1}.raw") : $"{basename}{cylinder:D2}.{head:D1}.raw"; @@ -360,8 +360,8 @@ namespace DiscImageChef.DiscImages throw new NotImplementedException("Flux decoding is not yet implemented."); } - public bool? VerifySectors(ulong sectorAddress, uint length, out List failingLbas, - out List unknownLbas) + public bool? VerifySectors(ulong sectorAddress, uint length, out List failingLbas, + out List unknownLbas) { throw new NotImplementedException("Flux decoding is not yet implemented."); } @@ -415,8 +415,8 @@ namespace DiscImageChef.DiscImages throw new FeatureUnsupportedImageException("Feature not supported by image format"); } - public bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List failingLbas, - out List unknownLbas) + public bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List failingLbas, + out List unknownLbas) { throw new FeatureUnsupportedImageException("Feature not supported by image format"); } diff --git a/DiscImageChef.DiscImages/MaxiDisk.cs b/DiscImageChef.DiscImages/MaxiDisk.cs index a9f4b60ba..724a0b555 100644 --- a/DiscImageChef.DiscImages/MaxiDisk.cs +++ b/DiscImageChef.DiscImages/MaxiDisk.cs @@ -46,7 +46,7 @@ namespace DiscImageChef.DiscImages public class MaxiDisk : IWritableImage { /// Disk image file - IFilter hdkImageFilter; + IFilter hdkImageFilter; ImageInfo imageInfo; FileStream writingStream; @@ -182,10 +182,9 @@ namespace DiscImageChef.DiscImages imageInfo.CreationTime = imageFilter.GetCreationTime(); imageInfo.LastModificationTime = imageFilter.GetLastWriteTime(); - imageInfo.MediaType = - Geometry.GetMediaType(((ushort)imageInfo.Cylinders, (byte)imageInfo.Heads, - (ushort)imageInfo.SectorsPerTrack, imageInfo.SectorSize, MediaEncoding.MFM, false - )); + imageInfo.MediaType = Geometry.GetMediaType(((ushort)imageInfo.Cylinders, (byte)imageInfo.Heads, + (ushort)imageInfo.SectorsPerTrack, imageInfo.SectorSize, + MediaEncoding.MFM, false)); imageInfo.XmlMediaType = XmlMediaType.BlockMedia; @@ -202,8 +201,8 @@ namespace DiscImageChef.DiscImages return null; } - public bool? VerifySectors(ulong sectorAddress, uint length, out List failingLbas, - out List unknownLbas) + public bool? VerifySectors(ulong sectorAddress, uint length, out List failingLbas, + out List unknownLbas) { failingLbas = new List(); unknownLbas = new List(); @@ -213,8 +212,8 @@ namespace DiscImageChef.DiscImages return null; } - public bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List failingLbas, - out List unknownLbas) + public bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List failingLbas, + out List unknownLbas) { failingLbas = new List(); unknownLbas = new List(); @@ -254,7 +253,7 @@ namespace DiscImageChef.DiscImages Stream stream = hdkImageFilter.GetDataForkStream(); stream.Seek((long)(8 + sectorAddress * imageInfo.SectorSize), SeekOrigin.Begin); - stream.Read(buffer, 0, (int)(length * imageInfo.SectorSize)); + stream.Read(buffer, 0, (int)(length * imageInfo.SectorSize)); return buffer; } @@ -334,7 +333,7 @@ namespace DiscImageChef.DiscImages MediaType.XDF_35, MediaType.XDF_525 }; public IEnumerable<(string name, Type type, string description)> SupportedOptions => - new(string name, Type type, string description)[] { }; + new (string name, Type type, string description)[] { }; public IEnumerable KnownExtensions => new[] {".hdk"}; public bool IsWriting { get; private set; } public string ErrorMessage { get; private set; } @@ -362,7 +361,7 @@ namespace DiscImageChef.DiscImages (ushort cylinders, byte heads, ushort sectorsPerTrack, uint bytesPerSector, MediaEncoding encoding, bool variableSectorsPerTrack, MediaType type) geometry = Geometry.GetGeometry(mediaType); - imageInfo = new ImageInfo + imageInfo = new ImageInfo { MediaType = mediaType, SectorSize = sectorSize, diff --git a/DiscImageChef.DiscImages/NDIF.cs b/DiscImageChef.DiscImages/NDIF.cs index 981321274..e935a0cba 100644 --- a/DiscImageChef.DiscImages/NDIF.cs +++ b/DiscImageChef.DiscImages/NDIF.cs @@ -72,7 +72,7 @@ namespace DiscImageChef.DiscImages /// Created by ShrinkWrap 3.5, dunno which version of the StuffIt algorithm it is using /// const byte CHUNK_TYPE_STUFFIT = 0xF0; - const byte CHUNK_TYPE_END = 0xFF; + const byte CHUNK_TYPE_END = 0xFF; const byte CHUNK_TYPE_COMPRESSED_MASK = 0x80; @@ -218,7 +218,7 @@ namespace DiscImageChef.DiscImages 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.type = bcem[128 + 3 + i * 12]; bChnk.offset = BigEndianBitConverter.ToUInt32(bcem, 128 + 4 + i * 12); bChnk.length = BigEndianBitConverter.ToUInt32(bcem, 128 + 8 + i * 12); @@ -293,9 +293,9 @@ namespace DiscImageChef.DiscImages string dev = null; string pre = null; - string major = $"{version.MajorVersion}"; - string minor = $".{version.MinorVersion / 10}"; - if(version.MinorVersion % 10 > 0) release = $".{version.MinorVersion % 10}"; + string major = $"{version.MajorVersion}"; + string minor = $".{version.MinorVersion / 10}"; + if(version.MinorVersion % 10 > 0) release = $".{version.MinorVersion % 10}"; switch(version.DevStage) { case Version.DevelopmentStage.Alpha: @@ -318,8 +318,7 @@ namespace DiscImageChef.DiscImages imageInfo.Comments = version.VersionMessage; if(version.MajorVersion == 3) imageInfo.Application = "ShrinkWrap™"; - else if(version.MajorVersion == 6) - imageInfo.Application = "DiskCopy"; + else if(version.MajorVersion == 6) imageInfo.Application = "DiskCopy"; } } @@ -334,7 +333,7 @@ namespace DiscImageChef.DiscImages imageInfo.CreationTime = imageFilter.GetCreationTime(); imageInfo.LastModificationTime = imageFilter.GetLastWriteTime(); - imageInfo.MediaTitle = + imageInfo.MediaTitle = StringHandlers.PascalToString(header.name, Encoding.GetEncoding("macintosh")); imageInfo.SectorSize = SECTOR_SIZE; imageInfo.XmlMediaType = XmlMediaType.BlockMedia; @@ -420,16 +419,16 @@ namespace DiscImageChef.DiscImages { Stream decStream = new ADCStream(cmpMs); byte[] tmpBuffer = new byte[buffersize]; - realSize = decStream.Read(tmpBuffer, 0, (int)buffersize); - buffer = new byte[realSize]; + realSize = decStream.Read(tmpBuffer, 0, (int)buffersize); + buffer = new byte[realSize]; Array.Copy(tmpBuffer, 0, buffer, 0, realSize); break; } case CHUNK_TYPE_RLE: { byte[] tmpBuffer = new byte[buffersize]; - realSize = 0; - AppleRle rle = new AppleRle(cmpMs); + realSize = 0; + AppleRle rle = new AppleRle(cmpMs); for(int i = 0; i < buffersize; i++) { int b = rle.ProduceByte(); @@ -586,8 +585,8 @@ namespace DiscImageChef.DiscImages throw new FeatureUnsupportedImageException("Feature not supported by image format"); } - public bool? VerifySectors(ulong sectorAddress, uint length, out List failingLbas, - out List unknownLbas) + public bool? VerifySectors(ulong sectorAddress, uint length, out List failingLbas, + out List unknownLbas) { failingLbas = new List(); unknownLbas = new List(); @@ -596,8 +595,8 @@ namespace DiscImageChef.DiscImages return null; } - public bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List failingLbas, - out List unknownLbas) + public bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List failingLbas, + out List unknownLbas) { throw new FeatureUnsupportedImageException("Feature not supported by image format"); } diff --git a/DiscImageChef.DiscImages/NHDr0.cs b/DiscImageChef.DiscImages/NHDr0.cs index d7dc1eb24..0127eb111 100644 --- a/DiscImageChef.DiscImages/NHDr0.cs +++ b/DiscImageChef.DiscImages/NHDr0.cs @@ -111,7 +111,7 @@ namespace DiscImageChef.DiscImages stream.Read(hdrB, 0, hdrB.Length); GCHandle handle = GCHandle.Alloc(hdrB, GCHandleType.Pinned); - nhdhdr = (Nhdr0Header)Marshal.PtrToStructure(handle.AddrOfPinnedObject(), typeof(Nhdr0Header)); + nhdhdr = (Nhdr0Header)Marshal.PtrToStructure(handle.AddrOfPinnedObject(), typeof(Nhdr0Header)); handle.Free(); if(!nhdhdr.szFileID.SequenceEqual(signature)) return false; @@ -145,7 +145,7 @@ namespace DiscImageChef.DiscImages stream.Read(hdrB, 0, hdrB.Length); GCHandle handle = GCHandle.Alloc(hdrB, GCHandleType.Pinned); - nhdhdr = (Nhdr0Header)Marshal.PtrToStructure(handle.AddrOfPinnedObject(), typeof(Nhdr0Header)); + nhdhdr = (Nhdr0Header)Marshal.PtrToStructure(handle.AddrOfPinnedObject(), typeof(Nhdr0Header)); handle.Free(); imageInfo.MediaType = MediaType.GENERIC_HDD; @@ -266,8 +266,8 @@ namespace DiscImageChef.DiscImages throw new FeatureUnsupportedImageException("Feature not supported by image format"); } - public bool? VerifySectors(ulong sectorAddress, uint length, out List failingLbas, - out List unknownLbas) + public bool? VerifySectors(ulong sectorAddress, uint length, out List failingLbas, + out List unknownLbas) { failingLbas = new List(); unknownLbas = new List(); @@ -276,8 +276,8 @@ namespace DiscImageChef.DiscImages return null; } - public bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List failingLbas, - out List unknownLbas) + public bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List failingLbas, + out List unknownLbas) { throw new FeatureUnsupportedImageException("Feature not supported by image format"); } @@ -539,14 +539,14 @@ namespace DiscImageChef.DiscImages { [MarshalAs(UnmanagedType.ByValArray, SizeConst = 15)] public byte[] szFileID; - public byte reserved1; + 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; + 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)] diff --git a/DiscImageChef.DiscImages/Nero.cs b/DiscImageChef.DiscImages/Nero.cs index 05443f96c..59e318e00 100644 --- a/DiscImageChef.DiscImages/Nero.cs +++ b/DiscImageChef.DiscImages/Nero.cs @@ -125,7 +125,7 @@ namespace DiscImageChef.DiscImages public Nero() { imageNewFormat = false; - imageInfo = new ImageInfo + imageInfo = new ImageInfo { ReadableSectorTags = new List(), ReadableMediaTags = new List() @@ -228,7 +228,7 @@ namespace DiscImageChef.DiscImages byte[] chunkHeaderBuffer = new byte[8]; imageStream.Read(chunkHeaderBuffer, 0, 8); - uint chunkId = BigEndianBitConverter.ToUInt32(chunkHeaderBuffer, 0); + uint chunkId = BigEndianBitConverter.ToUInt32(chunkHeaderBuffer, 0); uint chunkLength = BigEndianBitConverter.ToUInt32(chunkHeaderBuffer, 4); DicConsole.DebugWriteLine("Nero plugin", "ChunkID = 0x{0:X8} (\"{1}\")", chunkId, @@ -262,14 +262,13 @@ namespace DiscImageChef.DiscImages entry.Second = tmpbuffer[6]; entry.Frame = tmpbuffer[7]; - DicConsole.DebugWriteLine("Nero plugin", "Cuesheet entry {0}", i / 8 + 1); + 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); + 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, @@ -307,14 +306,13 @@ namespace DiscImageChef.DiscImages entry.Dummy = tmpbuffer[3]; entry.LbaStart = BigEndianBitConverter.ToInt32(tmpbuffer, 4); - DicConsole.DebugWriteLine("Nero plugin", "Cuesheet entry {0}", i / 8 + 1); + 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); + 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, @@ -373,7 +371,7 @@ namespace DiscImageChef.DiscImages 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", "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, @@ -381,8 +379,7 @@ namespace DiscImageChef.DiscImages 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); + 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, @@ -468,14 +465,13 @@ namespace DiscImageChef.DiscImages entry.Index1 = BigEndianBitConverter.ToUInt64(tmpbuffer, 26); entry.EndOfTrack = BigEndianBitConverter.ToUInt64(tmpbuffer, 34); - DicConsole.DebugWriteLine("Nero plugin", "Disc-At-Once entry {0}", i / 32 + 1); + 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); + 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, @@ -550,8 +546,7 @@ namespace DiscImageChef.DiscImages 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); + 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, @@ -586,14 +581,13 @@ namespace DiscImageChef.DiscImages entry.StartLba = BigEndianBitConverter.ToUInt32(tmpbuffer, 12); entry.Unknown = BigEndianBitConverter.ToUInt32(tmpbuffer, 16); - DicConsole.DebugWriteLine("Nero plugin", "Track-at-Once entry {0}", i / 20 + 1); + 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); + 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}", @@ -653,19 +647,17 @@ namespace DiscImageChef.DiscImages entry.Unknown = BigEndianBitConverter.ToUInt32(tmpbuffer, 24); entry.Sectors = BigEndianBitConverter.ToUInt32(tmpbuffer, 28); - DicConsole.DebugWriteLine("Nero plugin", "Track-at-Once entry {0}", i / 32 + 1); + 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); + 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); + i / 32 + 1, entry.Unknown); DicConsole.DebugWriteLine("Nero plugin", "\t _entry[{0}].Sectors = {1}", i / 32 + 1, entry.Sectors); @@ -737,7 +729,7 @@ namespace DiscImageChef.DiscImages DicConsole.DebugWriteLine("Nero plugin", "Found \"DINF\" chunk, parsing {0} bytes", chunkLength); - neroDiscInfo = new NeroDiscInformation {ChunkId = chunkId, ChunkSize = chunkLength}; + neroDiscInfo = new NeroDiscInformation {ChunkId = chunkId, ChunkSize = chunkLength}; byte[] tmpbuffer = new byte[4]; imageStream.Read(tmpbuffer, 0, 4); neroDiscInfo.Unknown = BigEndianBitConverter.ToUInt32(tmpbuffer, 0); @@ -752,7 +744,7 @@ namespace DiscImageChef.DiscImages DicConsole.DebugWriteLine("Nero plugin", "Found \"RELO\" chunk, parsing {0} bytes", chunkLength); - neroRelo = new NeroReloChunk {ChunkId = chunkId, ChunkSize = chunkLength}; + neroRelo = new NeroReloChunk {ChunkId = chunkId, ChunkSize = chunkLength}; byte[] tmpbuffer = new byte[4]; imageStream.Read(tmpbuffer, 0, 4); neroRelo.Unknown = BigEndianBitConverter.ToUInt32(tmpbuffer, 0); @@ -767,7 +759,7 @@ namespace DiscImageChef.DiscImages DicConsole.DebugWriteLine("Nero plugin", "Found \"TOCT\" chunk, parsing {0} bytes", chunkLength); - neroToc = new NeroTocChunk {ChunkId = chunkId, ChunkSize = chunkLength}; + neroToc = new NeroTocChunk {ChunkId = chunkId, ChunkSize = chunkLength}; byte[] tmpbuffer = new byte[2]; imageStream.Read(tmpbuffer, 0, 2); neroToc.Unknown = BigEndianBitConverter.ToUInt16(tmpbuffer, 0); @@ -852,11 +844,10 @@ namespace DiscImageChef.DiscImages track.Indexes = new Dictionary(); if(neroTrack.Index0 < neroTrack.Index1) track.Indexes.Add(0, neroTrack.Index0 / neroTrack.SectorSize); - track.Indexes.Add(1, neroTrack.Index1 / neroTrack.SectorSize); - track.TrackDescription = StringHandlers.CToString(neroTrack.Isrc); - track.TrackEndSector = neroTrack.Length / neroTrack.SectorSize + neroTrack.StartLba - 1; - track.TrackPregap = (neroTrack.Index1 - neroTrack.Index0) / - neroTrack.SectorSize; + track.Indexes.Add(1, neroTrack.Index1 / neroTrack.SectorSize); + track.TrackDescription = StringHandlers.CToString(neroTrack.Isrc); + track.TrackEndSector = neroTrack.Length / neroTrack.SectorSize + neroTrack.StartLba - 1; + track.TrackPregap = (neroTrack.Index1 - neroTrack.Index0) / neroTrack.SectorSize; track.TrackSequence = neroTrack.Sequence; track.TrackSession = currentsession; track.TrackStartSector = neroTrack.StartLba; @@ -1000,9 +991,8 @@ namespace DiscImageChef.DiscImages 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 && @@ -1015,9 +1005,8 @@ namespace DiscImageChef.DiscImages (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) { @@ -1030,15 +1019,15 @@ namespace DiscImageChef.DiscImages } } - if(!data && !firstdata) imageInfo.MediaType = MediaType.CDDA; + 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.MediaType = MediaType.CDROM; + else imageInfo.MediaType = MediaType.CD; } imageInfo.XmlMediaType = XmlMediaType.OpticalDisc; @@ -1089,7 +1078,7 @@ namespace DiscImageChef.DiscImages foreach(KeyValuePair kvp in from kvp in offsetmap where sectorAddress >= kvp.Value from track in Tracks - where track.TrackSequence == kvp.Key + where track.TrackSequence == kvp.Key where sectorAddress - kvp.Value < track.TrackEndSector - track.TrackStartSector select kvp) @@ -1103,7 +1092,7 @@ namespace DiscImageChef.DiscImages foreach(KeyValuePair kvp in from kvp in offsetmap where sectorAddress >= kvp.Value from track in Tracks - where track.TrackSequence == kvp.Key + where track.TrackSequence == kvp.Key where sectorAddress - kvp.Value < track.TrackEndSector - track.TrackStartSector select kvp) @@ -1190,7 +1179,7 @@ namespace DiscImageChef.DiscImages byte[] buffer = new byte[sectorSize * length]; - imageStream = neroFilter.GetDataForkStream(); + imageStream = neroFilter.GetDataForkStream(); BinaryReader br = new BinaryReader(imageStream); br.BaseStream.Seek((long)dicTrack.Offset + (long)(sectorAddress * (sectorOffset + sectorSize + sectorSkip)), SeekOrigin.Begin); @@ -1233,7 +1222,7 @@ namespace DiscImageChef.DiscImages case SectorTagType.CdTrackFlags: { byte[] flags = new byte[1]; - flags[0] = 0x00; + flags[0] = 0x00; if((DaoMode)dicTrack.Mode != DaoMode.Audio && (DaoMode)dicTrack.Mode != DaoMode.AudioSub) flags[0] += 0x4; @@ -1413,7 +1402,7 @@ namespace DiscImageChef.DiscImages byte[] buffer = new byte[sectorSize * length]; - imageStream = neroFilter.GetDataForkStream(); + imageStream = neroFilter.GetDataForkStream(); BinaryReader br = new BinaryReader(imageStream); br.BaseStream.Seek((long)dicTrack.Offset + (long)(sectorAddress * (sectorOffset + sectorSize + sectorSkip)), SeekOrigin.Begin); @@ -1445,7 +1434,7 @@ namespace DiscImageChef.DiscImages foreach(KeyValuePair kvp in from kvp in offsetmap where sectorAddress >= kvp.Value from track in Tracks - where track.TrackSequence == kvp.Key + where track.TrackSequence == kvp.Key where sectorAddress - kvp.Value < track.TrackEndSector - track.TrackStartSector select kvp) @@ -1507,7 +1496,7 @@ namespace DiscImageChef.DiscImages byte[] buffer = new byte[sectorSize * length]; - imageStream = neroFilter.GetDataForkStream(); + imageStream = neroFilter.GetDataForkStream(); BinaryReader br = new BinaryReader(imageStream); br.BaseStream.Seek((long)dicTrack.Offset + (long)(sectorAddress * (sectorOffset + sectorSize + sectorSkip)), @@ -1557,14 +1546,14 @@ namespace DiscImageChef.DiscImages return CdChecksums.CheckCdSector(buffer); } - public bool? VerifySectors(ulong sectorAddress, uint length, out List failingLbas, - out List unknownLbas) + public bool? VerifySectors(ulong sectorAddress, uint length, out List failingLbas, + out List unknownLbas) { byte[] buffer = ReadSectorsLong(sectorAddress, length); int bps = (int)(buffer.Length / length); byte[] sector = new byte[bps]; - failingLbas = new List(); - unknownLbas = new List(); + failingLbas = new List(); + unknownLbas = new List(); for(int i = 0; i < length; i++) { @@ -1587,14 +1576,14 @@ namespace DiscImageChef.DiscImages return failingLbas.Count <= 0; } - public bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List failingLbas, - out List unknownLbas) + public 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); byte[] sector = new byte[bps]; - failingLbas = new List(); - unknownLbas = new List(); + failingLbas = new List(); + unknownLbas = new List(); for(int i = 0; i < length; i++) { @@ -1633,32 +1622,32 @@ namespace DiscImageChef.DiscImages case NeroMediaTypes.NeroMtypDvdM: case NeroMediaTypes.NeroMtypDvdMR: return MediaType.DVDR; case NeroMediaTypes.NeroMtypDvdP: - case NeroMediaTypes.NeroMtypDvdPR: return MediaType.DVDPR; + case NeroMediaTypes.NeroMtypDvdPR: return MediaType.DVDPR; case NeroMediaTypes.NeroMtypDvdRam: return MediaType.DVDRAM; case NeroMediaTypes.NeroMtypMl: case NeroMediaTypes.NeroMtypMrw: case NeroMediaTypes.NeroMtypCdrw: return MediaType.CDRW; - case NeroMediaTypes.NeroMtypCdr: return MediaType.CDR; + case NeroMediaTypes.NeroMtypCdr: return MediaType.CDR; case NeroMediaTypes.NeroMtypDvdRom: case NeroMediaTypes.NeroMtypDvdAny: case NeroMediaTypes.NeroMtypDvdAnyR9: case NeroMediaTypes.NeroMtypDvdAnyOld: return MediaType.DVDROM; - case NeroMediaTypes.NeroMtypCdrom: return MediaType.CDROM; - case NeroMediaTypes.NeroMtypDvdMRw: return MediaType.DVDRW; - case NeroMediaTypes.NeroMtypDvdPRw: return MediaType.DVDPRW; - case NeroMediaTypes.NeroMtypDvdPR9: return MediaType.DVDPRDL; - case NeroMediaTypes.NeroMtypDvdMR9: return MediaType.DVDRDL; + case NeroMediaTypes.NeroMtypCdrom: return MediaType.CDROM; + case NeroMediaTypes.NeroMtypDvdMRw: return MediaType.DVDRW; + case NeroMediaTypes.NeroMtypDvdPRw: return MediaType.DVDPRW; + case NeroMediaTypes.NeroMtypDvdPR9: return MediaType.DVDPRDL; + case NeroMediaTypes.NeroMtypDvdMR9: return MediaType.DVDRDL; case NeroMediaTypes.NeroMtypBd: case NeroMediaTypes.NeroMtypBdAny: case NeroMediaTypes.NeroMtypBdRom: return MediaType.BDROM; - case NeroMediaTypes.NeroMtypBdR: return MediaType.BDR; - case NeroMediaTypes.NeroMtypBdRe: return MediaType.BDRE; + case NeroMediaTypes.NeroMtypBdR: return MediaType.BDR; + case NeroMediaTypes.NeroMtypBdRe: return MediaType.BDRE; case NeroMediaTypes.NeroMtypHdDvd: case NeroMediaTypes.NeroMtypHdDvdAny: case NeroMediaTypes.NeroMtypHdDvdRom: return MediaType.HDDVDROM; - case NeroMediaTypes.NeroMtypHdDvdR: return MediaType.HDDVDR; - case NeroMediaTypes.NeroMtypHdDvdRw: return MediaType.HDDVDRW; - default: return MediaType.CD; + case NeroMediaTypes.NeroMtypHdDvdR: return MediaType.HDDVDR; + case NeroMediaTypes.NeroMtypHdDvdRw: return MediaType.HDDVDRW; + default: return MediaType.CD; } } @@ -1669,13 +1658,13 @@ namespace DiscImageChef.DiscImages 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.DataM2F1: return TrackType.CdMode2Form1; + case DaoMode.DataM2F2: return TrackType.CdMode2Form2; case DaoMode.DataM2RawSub: case DaoMode.DataM2Raw: return TrackType.CdMode2Formless; case DaoMode.Audio: case DaoMode.AudioSub: return TrackType.Audio; - default: return TrackType.Data; + default: return TrackType.Data; } } @@ -1692,7 +1681,7 @@ namespace DiscImageChef.DiscImages case DaoMode.DataM2RawSub: case DaoMode.DataRawSub: case DaoMode.AudioSub: return 2448; - default: return 2352; + default: return 2352; } } diff --git a/DiscImageChef.DiscImages/Parallels.cs b/DiscImageChef.DiscImages/Parallels.cs index dfbd4b96e..18b6979a7 100644 --- a/DiscImageChef.DiscImages/Parallels.cs +++ b/DiscImageChef.DiscImages/Parallels.cs @@ -51,10 +51,10 @@ namespace DiscImageChef.DiscImages const uint PARALLELS_EMPTY = 0x00000001; - const uint MAX_CACHE_SIZE = 16777216; - const uint MAX_CACHED_SECTORS = MAX_CACHE_SIZE / 512; - const uint DEFAULT_CLUSTER_SIZE = 1048576; - readonly byte[] parallelsExtMagic = + const uint MAX_CACHE_SIZE = 16777216; + const uint MAX_CACHED_SECTORS = MAX_CACHE_SIZE / 512; + const uint DEFAULT_CLUSTER_SIZE = 1048576; + 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}; @@ -123,7 +123,7 @@ namespace DiscImageChef.DiscImages byte[] pHdrB = new byte[Marshal.SizeOf(pHdr)]; stream.Read(pHdrB, 0, Marshal.SizeOf(pHdr)); - pHdr = new ParallelsHeader(); + pHdr = new ParallelsHeader(); IntPtr headerPtr = Marshal.AllocHGlobal(Marshal.SizeOf(pHdr)); Marshal.Copy(pHdrB, 0, headerPtr, Marshal.SizeOf(pHdr)); pHdr = (ParallelsHeader)Marshal.PtrToStructure(headerPtr, typeof(ParallelsHeader)); @@ -141,7 +141,7 @@ namespace DiscImageChef.DiscImages byte[] pHdrB = new byte[Marshal.SizeOf(pHdr)]; stream.Read(pHdrB, 0, Marshal.SizeOf(pHdr)); - pHdr = new ParallelsHeader(); + pHdr = new ParallelsHeader(); IntPtr headerPtr = Marshal.AllocHGlobal(Marshal.SizeOf(pHdr)); Marshal.Copy(pHdrB, 0, headerPtr, Marshal.SizeOf(pHdr)); pHdr = (ParallelsHeader)Marshal.PtrToStructure(headerPtr, typeof(ParallelsHeader)); @@ -164,13 +164,13 @@ namespace DiscImageChef.DiscImages DicConsole.DebugWriteLine("Parallels plugin", "pHdr.extended = {0}", extended); DicConsole.DebugWriteLine("Parallels plugin", "Reading BAT"); - bat = new uint[pHdr.bat_entries]; + bat = new uint[pHdr.bat_entries]; byte[] batB = new byte[pHdr.bat_entries * 4]; stream.Read(batB, 0, batB.Length); for(int i = 0; i < bat.Length; i++) bat[i] = BitConverter.ToUInt32(batB, i * 4); - clusterBytes = pHdr.cluster_size * 512; - if(pHdr.data_off > 0) dataOffset = pHdr.data_off * 512; + clusterBytes = pHdr.cluster_size * 512; + if(pHdr.data_off > 0) dataOffset = pHdr.data_off * 512; else dataOffset = (stream.Position / clusterBytes + stream.Position % clusterBytes) * clusterBytes; @@ -326,8 +326,8 @@ namespace DiscImageChef.DiscImages throw new FeatureUnsupportedImageException("Feature not supported by image format"); } - public bool? VerifySectors(ulong sectorAddress, uint length, out List failingLbas, - out List unknownLbas) + public bool? VerifySectors(ulong sectorAddress, uint length, out List failingLbas, + out List unknownLbas) { failingLbas = new List(); unknownLbas = new List(); @@ -336,8 +336,8 @@ namespace DiscImageChef.DiscImages return null; } - public bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List failingLbas, - out List unknownLbas) + public bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List failingLbas, + out List unknownLbas) { throw new FeatureUnsupportedImageException("Feature not supported by image format"); } @@ -352,7 +352,7 @@ namespace DiscImageChef.DiscImages public IEnumerable SupportedMediaTags => new MediaTagType[] { }; public IEnumerable SupportedSectorTags => new SectorTagType[] { }; - public IEnumerable SupportedMediaTypes => + public IEnumerable SupportedMediaTypes => new[] { MediaType.Unknown, MediaType.GENERIC_HDD, MediaType.FlashDrive, MediaType.CompactFlash, @@ -397,12 +397,10 @@ namespace DiscImageChef.DiscImages return false; } - uint batEntries = (uint)(sectors * sectorSize / - DEFAULT_CLUSTER_SIZE); - if(sectors * sectorSize % - DEFAULT_CLUSTER_SIZE > 0) batEntries++; + uint batEntries = (uint)(sectors * sectorSize / DEFAULT_CLUSTER_SIZE); + if(sectors * sectorSize % DEFAULT_CLUSTER_SIZE > 0) batEntries++; uint headerSectors = (uint)Marshal.SizeOf(typeof(ParallelsHeader)) + batEntries * 4; - if((uint)Marshal.SizeOf(typeof(ParallelsHeader)) + batEntries % 4 > 0) headerSectors++; + if((uint)Marshal.SizeOf(typeof(ParallelsHeader)) + batEntries % 4 > 0) headerSectors++; pHdr = new ParallelsHeader { diff --git a/DiscImageChef.DiscImages/PartClone.cs b/DiscImageChef.DiscImages/PartClone.cs index 3c6f2c4da..22e0d8827 100644 --- a/DiscImageChef.DiscImages/PartClone.cs +++ b/DiscImageChef.DiscImages/PartClone.cs @@ -50,7 +50,7 @@ namespace DiscImageChef.DiscImages const uint MAX_CACHE_SIZE = 16777216; const uint MAX_CACHED_SECTORS = MAX_CACHE_SIZE / 512; readonly byte[] biTmAgIc = {0x42, 0x69, 0x54, 0x6D, 0x41, 0x67, 0x49, 0x63}; - readonly byte[] partCloneMagic = + readonly byte[] partCloneMagic = {0x70, 0x61, 0x72, 0x74, 0x63, 0x6C, 0x6F, 0x6E, 0x65, 0x2D, 0x69, 0x6D, 0x61, 0x67, 0x65}; // The used block "bitmap" uses one byte per block // TODO: Convert on-image bytemap to on-memory bitmap @@ -116,7 +116,7 @@ namespace DiscImageChef.DiscImages byte[] pHdrB = new byte[Marshal.SizeOf(pHdr)]; stream.Read(pHdrB, 0, Marshal.SizeOf(pHdr)); - pHdr = new PartCloneHeader(); + pHdr = new PartCloneHeader(); IntPtr headerPtr = Marshal.AllocHGlobal(Marshal.SizeOf(pHdr)); Marshal.Copy(pHdrB, 0, headerPtr, Marshal.SizeOf(pHdr)); pHdr = (PartCloneHeader)Marshal.PtrToStructure(headerPtr, typeof(PartCloneHeader)); @@ -141,7 +141,7 @@ namespace DiscImageChef.DiscImages byte[] pHdrB = new byte[Marshal.SizeOf(pHdr)]; stream.Read(pHdrB, 0, Marshal.SizeOf(pHdr)); - pHdr = new PartCloneHeader(); + pHdr = new PartCloneHeader(); IntPtr headerPtr = Marshal.AllocHGlobal(Marshal.SizeOf(pHdr)); Marshal.Copy(pHdrB, 0, headerPtr, Marshal.SizeOf(pHdr)); pHdr = (PartCloneHeader)Marshal.PtrToStructure(headerPtr, typeof(PartCloneHeader)); @@ -173,9 +173,9 @@ namespace DiscImageChef.DiscImages DicConsole.DebugWriteLine("PartClone plugin", "pHdr.dataOff = {0}", dataOff); DicConsole.DebugWriteLine("PartClone plugin", "Filling extents"); - DateTime start = DateTime.Now; - extents = new ExtentsULong(); - extentsOff = new Dictionary(); + DateTime start = DateTime.Now; + extents = new ExtentsULong(); + extentsOff = new Dictionary(); bool current = byteMap[0] > 0; ulong blockOff = 0; ulong extentStart = 0; @@ -256,7 +256,7 @@ namespace DiscImageChef.DiscImages MemoryStream ms = new MemoryStream(); bool allEmpty = true; - for(uint i = 0; i < length; i++) + for(uint i = 0; i < length; i++) if(byteMap[sectorAddress + i] != 0) { allEmpty = false; @@ -349,8 +349,8 @@ namespace DiscImageChef.DiscImages throw new FeatureUnsupportedImageException("Feature not supported by image format"); } - public bool? VerifySectors(ulong sectorAddress, uint length, out List failingLbas, - out List unknownLbas) + public bool? VerifySectors(ulong sectorAddress, uint length, out List failingLbas, + out List unknownLbas) { failingLbas = new List(); unknownLbas = new List(); @@ -359,8 +359,8 @@ namespace DiscImageChef.DiscImages return null; } - public bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List failingLbas, - out List unknownLbas) + public bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List failingLbas, + out List unknownLbas) { throw new FeatureUnsupportedImageException("Feature not supported by image format"); } diff --git a/DiscImageChef.DiscImages/Partimage.cs b/DiscImageChef.DiscImages/Partimage.cs index 242852cd0..fcf2ef344 100644 --- a/DiscImageChef.DiscImages/Partimage.cs +++ b/DiscImageChef.DiscImages/Partimage.cs @@ -74,9 +74,9 @@ namespace DiscImageChef.DiscImages const string MAGIC_BEGIN_EXT009 = "MAGIC-BEGIN-EXT009"; // reserved for future use const string MAGIC_BEGIN_VOLUME = "PaRtImAgE-VoLuMe"; - const uint MAX_CACHE_SIZE = 16777216; - const uint MAX_CACHED_SECTORS = MAX_CACHE_SIZE / 512; - readonly byte[] partimageMagic = + const uint MAX_CACHE_SIZE = 16777216; + const uint MAX_CACHED_SECTORS = MAX_CACHE_SIZE / 512; + 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 @@ -145,7 +145,7 @@ namespace DiscImageChef.DiscImages byte[] pHdrB = new byte[Marshal.SizeOf(cVolumeHeader)]; stream.Read(pHdrB, 0, Marshal.SizeOf(cVolumeHeader)); - cVolumeHeader = new PartimageHeader(); + cVolumeHeader = new PartimageHeader(); IntPtr headerPtr = Marshal.AllocHGlobal(Marshal.SizeOf(cVolumeHeader)); Marshal.Copy(pHdrB, 0, headerPtr, Marshal.SizeOf(cVolumeHeader)); cVolumeHeader = (PartimageHeader)Marshal.PtrToStructure(headerPtr, typeof(PartimageHeader)); @@ -163,7 +163,7 @@ namespace DiscImageChef.DiscImages byte[] hdrB = new byte[Marshal.SizeOf(cVolumeHeader)]; stream.Read(hdrB, 0, Marshal.SizeOf(cVolumeHeader)); - cVolumeHeader = new PartimageHeader(); + cVolumeHeader = new PartimageHeader(); IntPtr headerPtr = Marshal.AllocHGlobal(Marshal.SizeOf(cVolumeHeader)); Marshal.Copy(hdrB, 0, headerPtr, Marshal.SizeOf(cVolumeHeader)); cVolumeHeader = (PartimageHeader)Marshal.PtrToStructure(headerPtr, typeof(PartimageHeader)); @@ -356,9 +356,9 @@ namespace DiscImageChef.DiscImages 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(); + DateTime start = DateTime.Now; + extents = new ExtentsULong(); + extentsOff = new Dictionary(); bool current = (bitmap[0] & (1 << (0 % 8))) != 0; ulong blockOff = 0; ulong extentStart = 0; @@ -400,7 +400,7 @@ namespace DiscImageChef.DiscImages imageInfo.MediaType = MediaType.GENERIC_HDD; imageInfo.Version = StringHandlers.CToString(cMainHeader.szVersion); imageInfo.Comments = StringHandlers.CToString(cMainHeader.szPartDescription); - imageInfo.ImageSize = + imageInfo.ImageSize = (ulong)(stream.Length - (dataOff + Marshal.SizeOf(typeof(CMainTail)) + MAGIC_BEGIN_TAIL.Length)); imageStream = stream; @@ -456,7 +456,7 @@ namespace DiscImageChef.DiscImages MemoryStream ms = new MemoryStream(); bool allEmpty = true; - for(uint i = 0; i < length; i++) + for(uint i = 0; i < length; i++) if((bitmap[sectorAddress / 8] & (1 << (int)(sectorAddress % 8))) != 0) { allEmpty = false; @@ -549,8 +549,8 @@ namespace DiscImageChef.DiscImages throw new FeatureUnsupportedImageException("Feature not supported by image format"); } - public bool? VerifySectors(ulong sectorAddress, uint length, out List failingLbas, - out List unknownLbas) + public bool? VerifySectors(ulong sectorAddress, uint length, out List failingLbas, + out List unknownLbas) { failingLbas = new List(); unknownLbas = new List(); @@ -559,8 +559,8 @@ namespace DiscImageChef.DiscImages return null; } - public bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List failingLbas, - out List unknownLbas) + public bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List failingLbas, + out List unknownLbas) { throw new FeatureUnsupportedImageException("Feature not supported by image format"); } @@ -709,7 +709,7 @@ namespace DiscImageChef.DiscImages { [MarshalAs(UnmanagedType.ByValArray, SizeConst = MBR_SIZE_WHOLE)] public byte[] cData; - public uint dwDataCRC; + public uint dwDataCRC; [MarshalAs(UnmanagedType.ByValArray, SizeConst = MAX_DEVICENAMELEN)] public byte[] szDevice; // ex: "hda" @@ -729,9 +729,9 @@ namespace DiscImageChef.DiscImages 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 + 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)] diff --git a/DiscImageChef.DiscImages/QCOW.cs b/DiscImageChef.DiscImages/QCOW.cs index b88b5bd4f..e78dec2c7 100644 --- a/DiscImageChef.DiscImages/QCOW.cs +++ b/DiscImageChef.DiscImages/QCOW.cs @@ -49,7 +49,7 @@ namespace DiscImageChef.DiscImages /// /// Magic number: 'Q', 'F', 'I', 0xFB /// - const uint QCOW_MAGIC = 0x514649FB; + const uint QCOW_MAGIC = 0x514649FB; const uint QCOW_VERSION = 1; const uint QCOW_ENCRYPTION_NONE = 0; const uint QCOW_ENCRYPTION_AES = 1; @@ -187,8 +187,8 @@ namespace DiscImageChef.DiscImages clusterSize = 1 << qHdr.cluster_bits; clusterSectors = 1 << (qHdr.cluster_bits - 9); - l1Size = (uint)((qHdr.size + (ulong)(1 << shift) - 1) >> shift); - l2Size = 1 << qHdr.l2_bits; + l1Size = (uint)((qHdr.size + (ulong)(1 << shift) - 1) >> shift); + l2Size = 1 << qHdr.l2_bits; DicConsole.DebugWriteLine("QCOW plugin", "qHdr.clusterSize = {0}", clusterSize); DicConsole.DebugWriteLine("QCOW plugin", "qHdr.clusterSectors = {0}", clusterSectors); @@ -206,8 +206,8 @@ namespace DiscImageChef.DiscImages for(long i = 0; i < l1Table.LongLength; i++) l1Table[i] = BigEndianBitConverter.ToUInt64(l1TableB, (int)(i * 8)); - l1Mask = 0; - int c = 0; + l1Mask = 0; + int c = 0; l1Shift = qHdr.l2_bits + qHdr.cluster_bits; for(int i = 0; i < 64; i++) @@ -220,12 +220,12 @@ namespace DiscImageChef.DiscImages c++; } - l2Mask = 0; + l2Mask = 0; for(int i = 0; i < qHdr.l2_bits; i++) l2Mask = (l2Mask << 1) + 1; l2Mask <<= qHdr.cluster_bits; - sectorMask = 0; + sectorMask = 0; for(int i = 0; i < qHdr.cluster_bits; i++) sectorMask = (sectorMask << 1) + 1; DicConsole.DebugWriteLine("QCOW plugin", "qHdr.l1Mask = {0:X}", l1Mask); @@ -242,7 +242,7 @@ namespace DiscImageChef.DiscImages l2TableCache = new Dictionary(); clusterCache = new Dictionary(); - imageInfo.CreationTime = imageFilter.GetCreationTime(); + imageInfo.CreationTime = imageFilter.GetCreationTime(); imageInfo.LastModificationTime = qHdr.mtime > 0 ? DateHandlers.UnixUnsignedToDateTime(qHdr.mtime) : imageFilter.GetLastWriteTime(); @@ -284,7 +284,7 @@ namespace DiscImageChef.DiscImages { l2Table = new ulong[l2Size]; imageStream.Seek((long)l1Table[l1Off], SeekOrigin.Begin); - byte[] l2TableB = new byte[l2Size * 8]; + byte[] l2TableB = new byte[l2Size * 8]; imageStream.Read(l2TableB, 0, l2Size * 8); DicConsole.DebugWriteLine("QCOW plugin", "Reading L2 table #{0}", l1Off); for(long i = 0; i < l2Table.LongLength; i++) @@ -308,10 +308,10 @@ namespace DiscImageChef.DiscImages if((offset & QCOW_COMPRESSED) == QCOW_COMPRESSED) { ulong compSizeMask = (ulong)(1 << qHdr.cluster_bits) - 1; - compSizeMask <<= 63 - qHdr.cluster_bits; - ulong offMask = ~compSizeMask ^ QCOW_COMPRESSED; + compSizeMask <<= 63 - qHdr.cluster_bits; + ulong offMask = ~compSizeMask ^ QCOW_COMPRESSED; - ulong realOff = offset & offMask; + ulong realOff = offset & offMask; ulong compSize = (offset & compSizeMask) >> (63 - qHdr.cluster_bits); byte[] zCluster = new byte[compSize]; @@ -320,7 +320,7 @@ namespace DiscImageChef.DiscImages DeflateStream zStream = new DeflateStream(new MemoryStream(zCluster), CompressionMode.Decompress); - cluster = new byte[clusterSize]; + cluster = new byte[clusterSize]; int read = zStream.Read(cluster, 0, clusterSize); if(read != clusterSize) @@ -444,8 +444,8 @@ namespace DiscImageChef.DiscImages throw new FeatureUnsupportedImageException("Feature not supported by image format"); } - public bool? VerifySectors(ulong sectorAddress, uint length, out List failingLbas, - out List unknownLbas) + public bool? VerifySectors(ulong sectorAddress, uint length, out List failingLbas, + out List unknownLbas) { failingLbas = new List(); unknownLbas = new List(); @@ -454,8 +454,8 @@ namespace DiscImageChef.DiscImages return null; } - public bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List failingLbas, - out List unknownLbas) + public bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List failingLbas, + out List unknownLbas) { throw new FeatureUnsupportedImageException("Feature not supported by image format"); } @@ -470,7 +470,7 @@ namespace DiscImageChef.DiscImages public IEnumerable SupportedMediaTags => new MediaTagType[] { }; public IEnumerable SupportedSectorTags => new SectorTagType[] { }; - public IEnumerable SupportedMediaTypes => + public IEnumerable SupportedMediaTypes => new[] { MediaType.Unknown, MediaType.GENERIC_HDD, MediaType.FlashDrive, MediaType.CompactFlash, @@ -524,16 +524,16 @@ namespace DiscImageChef.DiscImages l1_table_offset = (ulong)Marshal.SizeOf(typeof(QCowHeader)) }; - int shift = qHdr.cluster_bits + qHdr.l2_bits; + int shift = qHdr.cluster_bits + qHdr.l2_bits; clusterSize = 1 << qHdr.cluster_bits; clusterSectors = 1 << (qHdr.cluster_bits - 9); - l1Size = (uint)((qHdr.size + (ulong)(1 << shift) - 1) >> shift); - l2Size = 1 << qHdr.l2_bits; + l1Size = (uint)((qHdr.size + (ulong)(1 << shift) - 1) >> shift); + l2Size = 1 << qHdr.l2_bits; l1Table = new ulong[l1Size]; - l1Mask = 0; - int c = 0; + l1Mask = 0; + int c = 0; l1Shift = qHdr.l2_bits + qHdr.cluster_bits; for(int i = 0; i < 64; i++) @@ -546,12 +546,12 @@ namespace DiscImageChef.DiscImages c++; } - l2Mask = 0; + l2Mask = 0; for(int i = 0; i < qHdr.l2_bits; i++) l2Mask = (l2Mask << 1) + 1; l2Mask <<= qHdr.cluster_bits; - sectorMask = 0; + sectorMask = 0; for(int i = 0; i < qHdr.cluster_bits; i++) sectorMask = (sectorMask << 1) + 1; byte[] empty = new byte[qHdr.l1_table_offset + l1Size * 8]; @@ -602,7 +602,7 @@ namespace DiscImageChef.DiscImages if(l1Table[l1Off] == 0) { writingStream.Seek(0, SeekOrigin.End); - l1Table[l1Off] = (ulong)writingStream.Position; + l1Table[l1Off] = (ulong)writingStream.Position; byte[] l2TableB = new byte[l2Size * 8]; writingStream.Seek(0, SeekOrigin.End); writingStream.Write(l2TableB, 0, l2TableB.Length); @@ -622,9 +622,9 @@ namespace DiscImageChef.DiscImages if(offset == 0) { - offset = (ulong)writingStream.Length; + offset = (ulong)writingStream.Length; byte[] cluster = new byte[clusterSize]; - entry = BigEndianBitConverter.GetBytes(offset); + entry = BigEndianBitConverter.GetBytes(offset); writingStream.Seek((long)(l1Table[l1Off] + l2Off * 8), SeekOrigin.Begin); writingStream.Write(entry, 0, 8); writingStream.Seek(0, SeekOrigin.End); diff --git a/DiscImageChef.DiscImages/QCOW2.cs b/DiscImageChef.DiscImages/QCOW2.cs index c377fc89b..33214841f 100644 --- a/DiscImageChef.DiscImages/QCOW2.cs +++ b/DiscImageChef.DiscImages/QCOW2.cs @@ -49,7 +49,7 @@ namespace DiscImageChef.DiscImages /// /// Magic number: 'Q', 'F', 'I', 0xFB /// - const uint QCOW_MAGIC = 0x514649FB; + const uint QCOW_MAGIC = 0x514649FB; const uint QCOW_VERSION2 = 2; const uint QCOW_VERSION3 = 3; const uint QCOW_ENCRYPTION_NONE = 0; @@ -233,8 +233,8 @@ namespace DiscImageChef.DiscImages for(long i = 0; i < l1Table.LongLength; i++) l1Table[i] = BigEndianBitConverter.ToUInt64(l1TableB, (int)(i * 8)); - l1Mask = 0; - int c = 0; + l1Mask = 0; + int c = 0; l1Shift = (int)(l2Bits + qHdr.cluster_bits); for(int i = 0; i < 64; i++) @@ -247,12 +247,12 @@ namespace DiscImageChef.DiscImages c++; } - l2Mask = 0; + l2Mask = 0; for(int i = 0; i < l2Bits; i++) l2Mask = (l2Mask << 1) + 1; l2Mask <<= (int)qHdr.cluster_bits; - sectorMask = 0; + sectorMask = 0; for(int i = 0; i < qHdr.cluster_bits; i++) sectorMask = (sectorMask << 1) + 1; DicConsole.DebugWriteLine("QCOW plugin", "qHdr.l1Mask = {0:X}", l1Mask); @@ -310,7 +310,7 @@ namespace DiscImageChef.DiscImages { l2Table = new ulong[l2Size]; imageStream.Seek((long)(l1Table[l1Off] & QCOW_FLAGS_MASK), SeekOrigin.Begin); - byte[] l2TableB = new byte[l2Size * 8]; + byte[] l2TableB = new byte[l2Size * 8]; imageStream.Read(l2TableB, 0, l2Size * 8); DicConsole.DebugWriteLine("QCOW plugin", "Reading L2 table #{0}", l1Off); for(long i = 0; i < l2Table.LongLength; i++) @@ -334,11 +334,11 @@ namespace DiscImageChef.DiscImages if((offset & QCOW_COMPRESSED) == QCOW_COMPRESSED) { ulong compSizeMask = (ulong)(1 << (int)(qHdr.cluster_bits - 8)) - 1; - byte countbits = (byte)(qHdr.cluster_bits - 8); - compSizeMask <<= 62 - countbits; - ulong offMask = ~compSizeMask & QCOW_FLAGS_MASK; + byte countbits = (byte)(qHdr.cluster_bits - 8); + compSizeMask <<= 62 - countbits; + ulong offMask = ~compSizeMask & QCOW_FLAGS_MASK; - ulong realOff = offset & offMask; + ulong realOff = offset & offMask; ulong compSize = (((offset & compSizeMask) >> (62 - countbits)) + 1) * 512; byte[] zCluster = new byte[compSize]; @@ -347,7 +347,7 @@ namespace DiscImageChef.DiscImages DeflateStream zStream = new DeflateStream(new MemoryStream(zCluster), CompressionMode.Decompress); - cluster = new byte[clusterSize]; + cluster = new byte[clusterSize]; int read = zStream.Read(cluster, 0, clusterSize); if(read != clusterSize) @@ -471,8 +471,8 @@ namespace DiscImageChef.DiscImages throw new FeatureUnsupportedImageException("Feature not supported by image format"); } - public bool? VerifySectors(ulong sectorAddress, uint length, out List failingLbas, - out List unknownLbas) + public bool? VerifySectors(ulong sectorAddress, uint length, out List failingLbas, + out List unknownLbas) { failingLbas = new List(); unknownLbas = new List(); @@ -481,8 +481,8 @@ namespace DiscImageChef.DiscImages return null; } - public bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List failingLbas, - out List unknownLbas) + public bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List failingLbas, + out List unknownLbas) { throw new FeatureUnsupportedImageException("Feature not supported by image format"); } @@ -497,7 +497,7 @@ namespace DiscImageChef.DiscImages public IEnumerable SupportedMediaTags => new MediaTagType[] { }; public IEnumerable SupportedSectorTags => new SectorTagType[] { }; - public IEnumerable SupportedMediaTypes => + public IEnumerable SupportedMediaTypes => new[] { MediaType.Unknown, MediaType.GENERIC_HDD, MediaType.FlashDrive, MediaType.CompactFlash, @@ -558,8 +558,8 @@ namespace DiscImageChef.DiscImages l2Bits = (int)(qHdr.cluster_bits - 3); l2Size = 1 << l2Bits; - l1Mask = 0; - int c = 0; + l1Mask = 0; + int c = 0; l1Shift = (int)(l2Bits + qHdr.cluster_bits); for(int i = 0; i < 64; i++) @@ -572,29 +572,27 @@ namespace DiscImageChef.DiscImages c++; } - l2Mask = 0; + l2Mask = 0; for(int i = 0; i < l2Bits; i++) l2Mask = (l2Mask << 1) + 1; l2Mask <<= (int)qHdr.cluster_bits; - sectorMask = 0; + sectorMask = 0; for(int i = 0; i < qHdr.cluster_bits; i++) sectorMask = (sectorMask << 1) + 1; - qHdr.l1_size = (uint)(qHdr.size >> l1Shift); + qHdr.l1_size = (uint)(qHdr.size >> l1Shift); if(qHdr.l1_size == 0) qHdr.l1_size = 1; - l1Table = new ulong[qHdr.l1_size]; + l1Table = new ulong[qHdr.l1_size]; - ulong clusters = qHdr.size / (ulong)clusterSize; - ulong refCountBlocks = clusters * 2 / (ulong)clusterSize; + ulong clusters = qHdr.size / (ulong)clusterSize; + ulong refCountBlocks = clusters * 2 / (ulong)clusterSize; if(refCountBlocks == 0) refCountBlocks = 1; qHdr.refcount_table_offset = (ulong)clusterSize; - qHdr.refcount_table_clusters = - (uint)(refCountBlocks * 8 / (ulong)clusterSize); + qHdr.refcount_table_clusters = (uint)(refCountBlocks * 8 / (ulong)clusterSize); if(qHdr.refcount_table_clusters == 0) qHdr.refcount_table_clusters = 1; - refCountTable = new ulong[refCountBlocks]; - qHdr.l1_table_offset = - qHdr.refcount_table_offset + (ulong)(qHdr.refcount_table_clusters * clusterSize); + refCountTable = new ulong[refCountBlocks]; + qHdr.l1_table_offset = qHdr.refcount_table_offset + (ulong)(qHdr.refcount_table_clusters * clusterSize); ulong l1TableClusters = qHdr.l1_size * 8 / (ulong)clusterSize; if(l1TableClusters == 0) l1TableClusters = 1; @@ -647,7 +645,7 @@ namespace DiscImageChef.DiscImages if(l1Table[l1Off] == 0) { writingStream.Seek(0, SeekOrigin.End); - l1Table[l1Off] = (ulong)writingStream.Position; + l1Table[l1Off] = (ulong)writingStream.Position; byte[] l2TableB = new byte[l2Size * 8]; writingStream.Seek(0, SeekOrigin.End); writingStream.Write(l2TableB, 0, l2TableB.Length); @@ -667,9 +665,9 @@ namespace DiscImageChef.DiscImages if(offset == 0) { - offset = (ulong)writingStream.Length; + offset = (ulong)writingStream.Length; byte[] cluster = new byte[clusterSize]; - entry = BigEndianBitConverter.GetBytes(offset); + entry = BigEndianBitConverter.GetBytes(offset); writingStream.Seek((long)(l1Table[l1Off] + l2Off * 8), SeekOrigin.Begin); writingStream.Write(entry, 0, 8); writingStream.Seek(0, SeekOrigin.End); @@ -681,7 +679,7 @@ namespace DiscImageChef.DiscImages int refCountBlockEntries = clusterSize * 8 / 16; ulong refCountBlockIndex = offset / (ulong)clusterSize % (ulong)refCountBlockEntries; - ulong refCountTableIndex = offset / (ulong)clusterSize / (ulong)refCountBlockEntries; + ulong refCountTableIndex = offset / (ulong)clusterSize / (ulong)refCountBlockEntries; ulong refBlockOffset = refCountTable[refCountTableIndex]; @@ -689,7 +687,7 @@ namespace DiscImageChef.DiscImages { refBlockOffset = (ulong)writingStream.Length; refCountTable[refCountTableIndex] = refBlockOffset; - byte[] cluster = new byte[clusterSize]; + byte[] cluster = new byte[clusterSize]; writingStream.Seek(0, SeekOrigin.End); writingStream.Write(cluster, 0, cluster.Length); } diff --git a/DiscImageChef.DiscImages/QED.cs b/DiscImageChef.DiscImages/QED.cs index 9dff8fea8..2a6d3882b 100644 --- a/DiscImageChef.DiscImages/QED.cs +++ b/DiscImageChef.DiscImages/QED.cs @@ -146,7 +146,7 @@ namespace DiscImageChef.DiscImages byte[] qHdrB = new byte[64]; stream.Read(qHdrB, 0, 64); - qHdr = new QedHeader(); + qHdr = new QedHeader(); IntPtr headerPtr = Marshal.AllocHGlobal(64); Marshal.Copy(qHdrB, 0, headerPtr, 64); qHdr = (QedHeader)Marshal.PtrToStructure(headerPtr, typeof(QedHeader)); @@ -164,7 +164,7 @@ namespace DiscImageChef.DiscImages byte[] qHdrB = new byte[64]; stream.Read(qHdrB, 0, 64); - qHdr = new QedHeader(); + qHdr = new QedHeader(); IntPtr headerPtr = Marshal.AllocHGlobal(64); Marshal.Copy(qHdrB, 0, headerPtr, 64); qHdr = (QedHeader)Marshal.PtrToStructure(headerPtr, typeof(QedHeader)); @@ -206,7 +206,7 @@ namespace DiscImageChef.DiscImages if((qHdr.features & QED_FEATURE_BACKING_FILE) == QED_FEATURE_BACKING_FILE) throw new NotImplementedException("Differencing images not yet supported"); - clusterSectors = qHdr.cluster_size / 512; + clusterSectors = qHdr.cluster_size / 512; tableSize = qHdr.cluster_size * qHdr.table_size / 8; DicConsole.DebugWriteLine("QED plugin", "qHdr.clusterSectors = {0}", clusterSectors); @@ -219,10 +219,10 @@ namespace DiscImageChef.DiscImages DicConsole.DebugWriteLine("QED plugin", "Reading L1 table"); for(long i = 0; i < l1Table.LongLength; i++) l1Table[i] = BitConverter.ToUInt64(l1TableB, (int)(i * 8)); - l1Mask = 0; - int c = 0; + l1Mask = 0; + int c = 0; clusterBits = Ctz32(qHdr.cluster_size); - l2Mask = (tableSize - 1) << clusterBits; + l2Mask = (tableSize - 1) << clusterBits; l1Shift = clusterBits + Ctz32(tableSize); for(int i = 0; i < 64; i++) @@ -235,7 +235,7 @@ namespace DiscImageChef.DiscImages c++; } - sectorMask = 0; + sectorMask = 0; for(int i = 0; i < clusterBits; i++) sectorMask = (sectorMask << 1) + 1; DicConsole.DebugWriteLine("QED plugin", "qHdr.clusterBits = {0}", clusterBits); @@ -293,7 +293,7 @@ namespace DiscImageChef.DiscImages { l2Table = new ulong[tableSize]; imageStream.Seek((long)l1Table[l1Off], SeekOrigin.Begin); - byte[] l2TableB = new byte[tableSize * 8]; + byte[] l2TableB = new byte[tableSize * 8]; imageStream.Read(l2TableB, 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(l2TableB, (int)(i * 8)); @@ -427,8 +427,8 @@ namespace DiscImageChef.DiscImages throw new FeatureUnsupportedImageException("Feature not supported by image format"); } - public bool? VerifySectors(ulong sectorAddress, uint length, out List failingLbas, - out List unknownLbas) + public bool? VerifySectors(ulong sectorAddress, uint length, out List failingLbas, + out List unknownLbas) { failingLbas = new List(); unknownLbas = new List(); @@ -437,8 +437,8 @@ namespace DiscImageChef.DiscImages return null; } - public bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List failingLbas, - out List unknownLbas) + public bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List failingLbas, + out List unknownLbas) { throw new FeatureUnsupportedImageException("Feature not supported by image format"); } @@ -453,7 +453,7 @@ namespace DiscImageChef.DiscImages public IEnumerable SupportedMediaTags => new MediaTagType[] { }; public IEnumerable SupportedSectorTags => new SectorTagType[] { }; - public IEnumerable SupportedMediaTypes => + public IEnumerable SupportedMediaTypes => new[] { MediaType.Unknown, MediaType.GENERIC_HDD, MediaType.FlashDrive, MediaType.CompactFlash, @@ -508,14 +508,14 @@ namespace DiscImageChef.DiscImages image_size = sectors * sectorSize }; - clusterSectors = qHdr.cluster_size / 512; + clusterSectors = qHdr.cluster_size / 512; tableSize = qHdr.cluster_size * qHdr.table_size / 8; - l1Table = new ulong[tableSize]; - l1Mask = 0; - int c = 0; + l1Table = new ulong[tableSize]; + l1Mask = 0; + int c = 0; clusterBits = Ctz32(qHdr.cluster_size); - l2Mask = (tableSize - 1) << clusterBits; + l2Mask = (tableSize - 1) << clusterBits; l1Shift = clusterBits + Ctz32(tableSize); for(int i = 0; i < 64; i++) @@ -528,7 +528,7 @@ namespace DiscImageChef.DiscImages c++; } - sectorMask = 0; + sectorMask = 0; for(int i = 0; i < clusterBits; i++) sectorMask = (sectorMask << 1) + 1; byte[] empty = new byte[qHdr.l1_table_offset + tableSize * 8]; @@ -579,7 +579,7 @@ namespace DiscImageChef.DiscImages if(l1Table[l1Off] == 0) { writingStream.Seek(0, SeekOrigin.End); - l1Table[l1Off] = (ulong)writingStream.Position; + l1Table[l1Off] = (ulong)writingStream.Position; byte[] l2TableB = new byte[tableSize * 8]; writingStream.Seek(0, SeekOrigin.End); writingStream.Write(l2TableB, 0, l2TableB.Length); @@ -597,9 +597,9 @@ namespace DiscImageChef.DiscImages if(offset == 0) { - offset = (ulong)writingStream.Length; + offset = (ulong)writingStream.Length; byte[] cluster = new byte[qHdr.cluster_size]; - entry = BitConverter.GetBytes(offset); + entry = BitConverter.GetBytes(offset); writingStream.Seek((long)(l1Table[l1Off] + l2Off * 8), SeekOrigin.Begin); writingStream.Write(entry, 0, 8); writingStream.Seek(0, SeekOrigin.End); diff --git a/DiscImageChef.DiscImages/RayDIM.cs b/DiscImageChef.DiscImages/RayDIM.cs index 1bfc9c233..e2cbd2146 100644 --- a/DiscImageChef.DiscImages/RayDIM.cs +++ b/DiscImageChef.DiscImages/RayDIM.cs @@ -158,7 +158,7 @@ namespace DiscImageChef.DiscImages imageInfo.SectorSize = 512; byte[] sectors = new byte[imageInfo.SectorsPerTrack * imageInfo.SectorSize]; - disk = new MemoryStream(); + disk = new MemoryStream(); for(int i = 0; i < imageInfo.SectorsPerTrack * imageInfo.SectorSize; i++) { @@ -167,18 +167,18 @@ namespace DiscImageChef.DiscImages disk.Write(sectors, 0, sectors.Length); } - imageInfo.MediaType = - Geometry.GetMediaType(((ushort)imageInfo.Cylinders, (byte)imageInfo.Heads, - (ushort)imageInfo.SectorsPerTrack, 512, MediaEncoding.MFM, false)); + imageInfo.MediaType = Geometry.GetMediaType(((ushort)imageInfo.Cylinders, (byte)imageInfo.Heads, + (ushort)imageInfo.SectorsPerTrack, 512, MediaEncoding.MFM, + false)); switch(imageInfo.MediaType) { - case MediaType.NEC_525_HD when header.diskType == RayDiskTypes.Mf2hd || - header.diskType == RayDiskTypes.Mf2ed: + case MediaType.NEC_525_HD + when header.diskType == RayDiskTypes.Mf2hd || header.diskType == RayDiskTypes.Mf2ed: imageInfo.MediaType = MediaType.NEC_35_HD_8; break; - case MediaType.DOS_525_HD when header.diskType == RayDiskTypes.Mf2hd || - header.diskType == RayDiskTypes.Mf2ed: + case MediaType.DOS_525_HD + when header.diskType == RayDiskTypes.Mf2hd || header.diskType == RayDiskTypes.Mf2ed: imageInfo.MediaType = MediaType.NEC_35_HD_15; break; case MediaType.RX50 when header.diskType == RayDiskTypes.Md2dd || header.diskType == RayDiskTypes.Md2hd: @@ -201,8 +201,8 @@ namespace DiscImageChef.DiscImages return null; } - public bool? VerifySectors(ulong sectorAddress, uint length, out List failingLbas, - out List unknownLbas) + public bool? VerifySectors(ulong sectorAddress, uint length, out List failingLbas, + out List unknownLbas) { failingLbas = new List(); unknownLbas = new List(); @@ -212,8 +212,8 @@ namespace DiscImageChef.DiscImages return null; } - public bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List failingLbas, - out List unknownLbas) + public bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List failingLbas, + out List unknownLbas) { failingLbas = new List(); unknownLbas = new List(); @@ -332,7 +332,7 @@ namespace DiscImageChef.DiscImages MediaType.XDF_35, MediaType.XDF_525 }; public IEnumerable<(string name, Type type, string description)> SupportedOptions => - new(string name, Type type, string description)[] { }; + new (string name, Type type, string description)[] { }; public IEnumerable KnownExtensions => new[] {".dim"}; public bool IsWriting { get; private set; } public string ErrorMessage { get; private set; } @@ -360,7 +360,7 @@ namespace DiscImageChef.DiscImages (ushort cylinders, byte heads, ushort sectorsPerTrack, uint bytesPerSector, MediaEncoding encoding, bool variableSectorsPerTrack, MediaType type) geometry = Geometry.GetGeometry(mediaType); - imageInfo = new ImageInfo + imageInfo = new ImageInfo { MediaType = mediaType, SectorSize = sectorSize, @@ -538,7 +538,7 @@ namespace DiscImageChef.DiscImages struct RayHdr { [MarshalAs(UnmanagedType.ByValArray, SizeConst = 80)] - public byte[] signature; + public byte[] signature; public RayDiskTypes diskType; public byte cylinders; public byte sectorsPerTrack; diff --git a/DiscImageChef.DiscImages/RsIde.cs b/DiscImageChef.DiscImages/RsIde.cs index b19527231..644f8630c 100644 --- a/DiscImageChef.DiscImages/RsIde.cs +++ b/DiscImageChef.DiscImages/RsIde.cs @@ -40,6 +40,7 @@ using DiscImageChef.CommonTypes; using DiscImageChef.Filters; using Schemas; using static DiscImageChef.Decoders.ATA.Identify; +using Version = DiscImageChef.Interop.Version; namespace DiscImageChef.DiscImages { @@ -269,8 +270,8 @@ namespace DiscImageChef.DiscImages throw new FeatureUnsupportedImageException("Feature not supported by image format"); } - public bool? VerifySectors(ulong sectorAddress, uint length, out List failingLbas, - out List unknownLbas) + public bool? VerifySectors(ulong sectorAddress, uint length, out List failingLbas, + out List unknownLbas) { failingLbas = new List(); unknownLbas = new List(); @@ -279,8 +280,8 @@ namespace DiscImageChef.DiscImages return null; } - public bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List failingLbas, - out List unknownLbas) + public bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List failingLbas, + out List unknownLbas) { throw new FeatureUnsupportedImageException("Feature not supported by image format"); } @@ -295,7 +296,7 @@ namespace DiscImageChef.DiscImages public IEnumerable SupportedMediaTags => new[] {MediaTagType.ATA_IDENTIFY}; public IEnumerable SupportedSectorTags => new SectorTagType[] { }; - public IEnumerable SupportedMediaTypes => + public IEnumerable SupportedMediaTypes => new[] { MediaType.GENERIC_HDD, MediaType.Unknown, MediaType.FlashDrive, MediaType.CompactFlash, @@ -489,7 +490,7 @@ namespace DiscImageChef.DiscImages Heads = (ushort)imageInfo.Heads, SectorsPerTrack = (ushort)imageInfo.SectorsPerTrack, VendorWord47 = 0x80, - Capabilities = + Capabilities = CapabilitiesBit.DMASupport | CapabilitiesBit.IORDY | CapabilitiesBit.LBASupport, ExtendedIdentify = ExtendedIdentifyBit.Words54to58Valid, CurrentCylinders = (ushort)imageInfo.Cylinders, @@ -505,7 +506,7 @@ namespace DiscImageChef.DiscImages if(string.IsNullOrEmpty(imageInfo.DriveModel)) imageInfo.DriveModel = ""; - if(string.IsNullOrEmpty(imageInfo.DriveFirmwareRevision)) Interop.Version.GetVersion(); + if(string.IsNullOrEmpty(imageInfo.DriveFirmwareRevision)) Version.GetVersion(); if(string.IsNullOrEmpty(imageInfo.DriveSerialNumber)) imageInfo.DriveSerialNumber = $"{new Random().NextDouble():16X}"; @@ -517,7 +518,7 @@ namespace DiscImageChef.DiscImages Marshal.FreeHGlobal(ptr); Array.Copy(ScrambleAtaString(imageInfo.DriveManufacturer + " " + imageInfo.DriveModel, 40), 0, - ataIdBytes, 27 * 2, 40); + ataIdBytes, 27 * 2, 40); Array.Copy(ScrambleAtaString(imageInfo.DriveFirmwareRevision, 8), 0, ataIdBytes, 23 * 2, 8); Array.Copy(ScrambleAtaString(imageInfo.DriveSerialNumber, 20), 0, ataIdBytes, 10 * 2, 20); Array.Copy(ataIdBytes, 0, header.identify, 0, 106); @@ -632,7 +633,7 @@ namespace DiscImageChef.DiscImages struct RsIdeHeader { [MarshalAs(UnmanagedType.ByValArray, SizeConst = 7)] - public byte[] magic; + public byte[] magic; public byte revision; public RsIdeFlags flags; public ushort dataOff; diff --git a/DiscImageChef.DiscImages/SaveDskF.cs b/DiscImageChef.DiscImages/SaveDskF.cs index 01eb98ec4..b52a3547f 100644 --- a/DiscImageChef.DiscImages/SaveDskF.cs +++ b/DiscImageChef.DiscImages/SaveDskF.cs @@ -106,15 +106,16 @@ namespace DiscImageChef.DiscImages byte[] hdr = new byte[40]; stream.Read(hdr, 0, 40); - header = new SaveDskFHeader(); + 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; + 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 bool Open(IFilter imageFilter) @@ -125,7 +126,7 @@ namespace DiscImageChef.DiscImages byte[] hdr = new byte[40]; stream.Read(hdr, 0, 40); - header = new SaveDskFHeader(); + header = new SaveDskFHeader(); IntPtr hdrPtr = Marshal.AllocHGlobal(40); Marshal.Copy(hdr, 0, hdrPtr, 40); header = (SaveDskFHeader)Marshal.PtrToStructure(hdrPtr, typeof(SaveDskFHeader)); @@ -164,7 +165,7 @@ namespace DiscImageChef.DiscImages int b; do { - b = stream.ReadByte(); + b = stream.ReadByte(); if(b >= 0) calculatedChk += (uint)b; } while(b >= 0); @@ -180,9 +181,8 @@ namespace DiscImageChef.DiscImages imageInfo.Sectors = (ulong)(header.sectorsPerTrack * header.heads * header.cylinders); imageInfo.SectorSize = header.sectorSize; - imageInfo.MediaType = - Geometry.GetMediaType((header.cylinders, (byte)header.heads, header.sectorsPerTrack, header.sectorSize, - MediaEncoding.MFM, false)); + imageInfo.MediaType = Geometry.GetMediaType((header.cylinders, (byte)header.heads, header.sectorsPerTrack, + header.sectorSize, MediaEncoding.MFM, false)); imageInfo.XmlMediaType = XmlMediaType.BlockMedia; @@ -217,8 +217,8 @@ namespace DiscImageChef.DiscImages return null; } - public bool? VerifySectors(ulong sectorAddress, uint length, out List failingLbas, - out List unknownLbas) + public bool? VerifySectors(ulong sectorAddress, uint length, out List failingLbas, + out List unknownLbas) { failingLbas = new List(); unknownLbas = new List(); @@ -228,8 +228,8 @@ namespace DiscImageChef.DiscImages return null; } - public bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List failingLbas, - out List unknownLbas) + public bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List failingLbas, + out List unknownLbas) { failingLbas = new List(); unknownLbas = new List(); @@ -348,7 +348,7 @@ namespace DiscImageChef.DiscImages MediaType.FDFORMAT_525_HD, MediaType.RX50, MediaType.XDF_35, MediaType.XDF_525 }; public IEnumerable<(string name, Type type, string description)> SupportedOptions => - new(string name, Type type, string description)[] { }; + new (string name, Type type, string description)[] { }; public IEnumerable KnownExtensions => new[] {".dsk"}; public bool IsWriting { get; private set; } @@ -447,7 +447,7 @@ namespace DiscImageChef.DiscImages writingStream.Seek(header.commentOffset, SeekOrigin.Begin); writingStream.Write(commentsBytes, 0, commentsBytes.Length >= 512 - header.commentOffset - ? 512 - header.commentOffset + ? 512 - header.commentOffset : commentsBytes.Length); } @@ -466,7 +466,7 @@ namespace DiscImageChef.DiscImages int b; do { - b = writingStream.ReadByte(); + b = writingStream.ReadByte(); if(b >= 0) header.checksum += (uint)b; } while(b >= 0); diff --git a/DiscImageChef.DiscImages/SuperCardPro.cs b/DiscImageChef.DiscImages/SuperCardPro.cs index bb3bbb8f0..e2baa0fad 100644 --- a/DiscImageChef.DiscImages/SuperCardPro.cs +++ b/DiscImageChef.DiscImages/SuperCardPro.cs @@ -165,7 +165,7 @@ namespace DiscImageChef.DiscImages public bool Identify(IFilter imageFilter) { - Header = new ScpHeader(); + Header = new ScpHeader(); Stream stream = imageFilter.GetDataForkStream(); stream.Seek(0, SeekOrigin.Begin); if(stream.Length < Marshal.SizeOf(Header)) return false; @@ -199,7 +199,7 @@ namespace DiscImageChef.DiscImages 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); + 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); @@ -218,8 +218,8 @@ namespace DiscImageChef.DiscImages { if(t >= Header.offsets.Length) break; - scpStream.Position = Header.offsets[t]; - TrackHeader trk = + scpStream.Position = Header.offsets[t]; + TrackHeader trk = new TrackHeader {Signature = new byte[3], Entries = new TrackEntry[Header.revolutions]}; scpStream.Read(trk.Signature, 0, trk.Signature.Length); trk.TrackNumber = (byte)scpStream.ReadByte(); @@ -299,7 +299,7 @@ namespace DiscImageChef.DiscImages footer.modificationTime); DicConsole.DebugWriteLine("SuperCardPro plugin", "footer.applicationVersion = {0}.{1}", (footer.applicationVersion & 0xF0) >> 4, - footer.applicationVersion & 0xF); + 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}", @@ -345,8 +345,8 @@ namespace DiscImageChef.DiscImages imageInfo.ApplicationVersion = $"{(footer.applicationVersion & 0xF0) >> 4}.{footer.applicationVersion & 0xF}"; imageInfo.DriveFirmwareRevision = - $"{(footer.firmwareVersion & 0xF0) >> 4}.{footer.firmwareVersion & 0xF}"; - imageInfo.Version = $"{(footer.imageVersion & 0xF0) >> 4}.{footer.imageVersion & 0xF}"; + $"{(footer.firmwareVersion & 0xF0) >> 4}.{footer.firmwareVersion & 0xF}"; + imageInfo.Version = $"{(footer.imageVersion & 0xF0) >> 4}.{footer.imageVersion & 0xF}"; break; } @@ -411,8 +411,8 @@ namespace DiscImageChef.DiscImages throw new NotImplementedException("Flux decoding is not yet implemented."); } - public bool? VerifySectors(ulong sectorAddress, uint length, out List failingLbas, - out List unknownLbas) + public bool? VerifySectors(ulong sectorAddress, uint length, out List failingLbas, + out List unknownLbas) { throw new NotImplementedException("Flux decoding is not yet implemented."); } @@ -475,8 +475,8 @@ namespace DiscImageChef.DiscImages throw new FeatureUnsupportedImageException("Feature not supported by image format"); } - public bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List failingLbas, - out List unknownLbas) + public bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List failingLbas, + out List unknownLbas) { throw new FeatureUnsupportedImageException("Feature not supported by image format"); } @@ -486,7 +486,7 @@ namespace DiscImageChef.DiscImages if(position == 0) return null; stream.Position = position; - byte[] lenB = new byte[2]; + byte[] lenB = new byte[2]; stream.Read(lenB, 0, 2); ushort len = BitConverter.ToUInt16(lenB, 0); @@ -502,7 +502,7 @@ namespace DiscImageChef.DiscImages public struct ScpHeader { [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] - public byte[] signature; + public byte[] signature; public byte version; public ScpDiskType type; public byte revolutions; @@ -520,7 +520,7 @@ namespace DiscImageChef.DiscImages public struct TrackHeader { [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] - public byte[] Signature; + public byte[] Signature; public byte TrackNumber; public TrackEntry[] Entries; } diff --git a/DiscImageChef.DiscImages/T98.cs b/DiscImageChef.DiscImages/T98.cs index f0131f366..7073eaae3 100644 --- a/DiscImageChef.DiscImages/T98.cs +++ b/DiscImageChef.DiscImages/T98.cs @@ -100,7 +100,7 @@ namespace DiscImageChef.DiscImages stream.Read(hdrB, 0, hdrB.Length); for(int i = 4; i < 256; i++) - if(hdrB[i] != 0) + if(hdrB[i] != 0) return false; int cylinders = BitConverter.ToInt32(hdrB, 0); @@ -123,7 +123,7 @@ namespace DiscImageChef.DiscImages stream.Read(hdrB, 0, hdrB.Length); for(int i = 4; i < 256; i++) - if(hdrB[i] != 0) + if(hdrB[i] != 0) return false; int cylinders = BitConverter.ToInt32(hdrB, 0); @@ -245,8 +245,8 @@ namespace DiscImageChef.DiscImages throw new FeatureUnsupportedImageException("Feature not supported by image format"); } - public bool? VerifySectors(ulong sectorAddress, uint length, out List failingLbas, - out List unknownLbas) + public bool? VerifySectors(ulong sectorAddress, uint length, out List failingLbas, + out List unknownLbas) { failingLbas = new List(); unknownLbas = new List(); @@ -255,8 +255,8 @@ namespace DiscImageChef.DiscImages return null; } - public bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List failingLbas, - out List unknownLbas) + public bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List failingLbas, + out List unknownLbas) { throw new FeatureUnsupportedImageException("Feature not supported by image format"); } @@ -271,7 +271,7 @@ namespace DiscImageChef.DiscImages public IEnumerable SupportedMediaTags => new MediaTagType[] { }; public IEnumerable SupportedSectorTags => new SectorTagType[] { }; - public IEnumerable SupportedMediaTypes => + public IEnumerable SupportedMediaTypes => new[] { MediaType.GENERIC_HDD, MediaType.Unknown, MediaType.FlashDrive, MediaType.CompactFlash, diff --git a/DiscImageChef.DiscImages/TeleDisk.cs b/DiscImageChef.DiscImages/TeleDisk.cs index a03923db1..6b2eaea8f 100644 --- a/DiscImageChef.DiscImages/TeleDisk.cs +++ b/DiscImageChef.DiscImages/TeleDisk.cs @@ -166,7 +166,7 @@ namespace DiscImageChef.DiscImages public bool Identify(IFilter imageFilter) { - header = new TeleDiskHeader(); + header = new TeleDiskHeader(); byte[] headerBytes = new byte[12]; Stream stream = imageFilter.GetDataForkStream(); stream.Seek(0, SeekOrigin.Begin); @@ -222,9 +222,9 @@ namespace DiscImageChef.DiscImages public bool Open(IFilter imageFilter) { - header = new TeleDiskHeader(); - byte[] headerBytes = new byte[12]; - inStream = imageFilter.GetDataForkStream(); + header = new TeleDiskHeader(); + byte[] headerBytes = new byte[12]; + inStream = imageFilter.GetDataForkStream(); MemoryStream stream = new MemoryStream(); inStream.Seek(0, SeekOrigin.Begin); @@ -365,7 +365,7 @@ namespace DiscImageChef.DiscImages } if(imageInfo.CreationTime == DateTime.MinValue) imageInfo.CreationTime = imageFilter.GetCreationTime(); - imageInfo.LastModificationTime = imageFilter.GetLastWriteTime(); + imageInfo.LastModificationTime = imageFilter.GetLastWriteTime(); DicConsole.DebugWriteLine("TeleDisk plugin", "Image created on {0}", imageInfo.CreationTime); DicConsole.DebugWriteLine("TeleDisk plugin", "Image modified on {0}", imageInfo.LastModificationTime); @@ -375,11 +375,11 @@ namespace DiscImageChef.DiscImages totalDiskSize = 0; imageInfo.ImageSize = 0; - int totalCylinders = -1; - int totalHeads = -1; - int maxSector = -1; - int totalSectors = 0; - long currentPos = stream.Position; + int totalCylinders = -1; + int totalHeads = -1; + int maxSector = -1; + int totalSectors = 0; + long currentPos = stream.Position; imageInfo.SectorSize = uint.MaxValue; imageInfo.SectorsPerTrack = uint.MaxValue; @@ -422,11 +422,11 @@ namespace DiscImageChef.DiscImages teleDiskData.DataSize = BitConverter.ToUInt16(dataSizeBytes, 0); teleDiskData.DataSize--; // Sydex decided to including dataEncoding byte as part of it teleDiskData.DataEncoding = (byte)stream.ReadByte(); - byte[] data = new byte[teleDiskData.DataSize]; + byte[] data = new byte[teleDiskData.DataSize]; stream.Read(data, 0, teleDiskData.DataSize); } - if(128 << teleDiskSector.SectorSize < imageInfo.SectorSize) + if(128 << teleDiskSector.SectorSize < imageInfo.SectorSize) imageInfo.SectorSize = (uint)(128 << teleDiskSector.SectorSize); totalSectors++; @@ -441,8 +441,8 @@ namespace DiscImageChef.DiscImages bool hasLeadOutOnHead0 = false; bool hasLeadOutOnHead1 = false; - imageInfo.Cylinders = (ushort)totalCylinders; - imageInfo.Heads = (byte)totalHeads; + imageInfo.Cylinders = (ushort)totalCylinders; + imageInfo.Heads = (byte)totalHeads; // Count sectors per track stream.Seek(currentPos, SeekOrigin.Begin); @@ -459,12 +459,12 @@ namespace DiscImageChef.DiscImages if(teleDiskTrack.Sectors == 0xFF) // End of disk image break; - if(teleDiskTrack.Sectors < imageInfo.SectorsPerTrack) + if(teleDiskTrack.Sectors < imageInfo.SectorsPerTrack) if(teleDiskTrack.Cylinder + 1 == totalCylinders) { hasLeadOutOnHead0 |= teleDiskTrack.Head == 0; hasLeadOutOnHead1 |= teleDiskTrack.Head == 1; - if(imageInfo.Cylinders == totalCylinders) imageInfo.Cylinders--; + if(imageInfo.Cylinders == totalCylinders) imageInfo.Cylinders--; } else imageInfo.SectorsPerTrack = teleDiskTrack.Sectors; @@ -489,7 +489,7 @@ namespace DiscImageChef.DiscImages teleDiskData.DataSize = BitConverter.ToUInt16(dataSizeBytes, 0); teleDiskData.DataSize--; // Sydex decided to including dataEncoding byte as part of it teleDiskData.DataEncoding = (byte)stream.ReadByte(); - byte[] data = new byte[teleDiskData.DataSize]; + byte[] data = new byte[teleDiskData.DataSize]; stream.Read(data, 0, teleDiskData.DataSize); } } @@ -574,8 +574,8 @@ namespace DiscImageChef.DiscImages teleDiskSector.Crc); uint lba = (uint)(teleDiskSector.Cylinder * header.Sides * imageInfo.SectorsPerTrack + - teleDiskSector.Head * imageInfo.SectorsPerTrack + - (teleDiskSector.SectorNumber - 1)); + teleDiskSector.Head * imageInfo.SectorsPerTrack + + (teleDiskSector.SectorNumber - 1)); if((teleDiskSector.Flags & FLAGS_SECTOR_DATALESS) != FLAGS_SECTOR_DATALESS && (teleDiskSector.Flags & FLAGS_SECTOR_SKIPPED) != FLAGS_SECTOR_SKIPPED) { @@ -584,7 +584,7 @@ namespace DiscImageChef.DiscImages teleDiskData.DataSize--; // Sydex decided to including dataEncoding byte as part of it imageInfo.ImageSize += teleDiskData.DataSize; teleDiskData.DataEncoding = (byte)stream.ReadByte(); - byte[] data = new byte[teleDiskData.DataSize]; + byte[] data = new byte[teleDiskData.DataSize]; stream.Read(data, 0, teleDiskData.DataSize); DicConsole.DebugWriteLine("TeleDisk plugin", "\t\tData size (in-image): {0}", teleDiskData.DataSize); @@ -630,13 +630,13 @@ namespace DiscImageChef.DiscImages MemoryStream leadOutMs = new MemoryStream(); if(hasLeadOutOnHead0) - for(int i = 0; i < sectorsData[totalCylinders - 1][0].Length; i++) - if(sectorsData[totalCylinders - 1][0][i] != null) + 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) + 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); @@ -715,8 +715,8 @@ namespace DiscImageChef.DiscImages return null; } - public bool? VerifySectors(ulong sectorAddress, uint length, out List failingLbas, - out List unknownLbas) + public bool? VerifySectors(ulong sectorAddress, uint length, out List failingLbas, + out List unknownLbas) { failingLbas = new List(); unknownLbas = new List(); @@ -728,8 +728,8 @@ namespace DiscImageChef.DiscImages return failingLbas.Count <= 0; } - public bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List failingLbas, - out List unknownLbas) + public bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List failingLbas, + out List unknownLbas) { failingLbas = new List(); unknownLbas = new List(); @@ -809,9 +809,9 @@ namespace DiscImageChef.DiscImages (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); + 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); } @@ -824,7 +824,7 @@ namespace DiscImageChef.DiscImages { crc ^= (ushort)((buffer[counter] & 0xFF) << 8); - for(int i = 0; i < 8; i++) + for(int i = 0; i < 8; i++) if((crc & 0x8000) > 0) crc = (ushort)((crc << 1) ^ TELE_DISK_CRC_POLY); else @@ -908,14 +908,14 @@ namespace DiscImageChef.DiscImages byte encoding = encodedData[ins]; if(encoding == 0x00) { - length = encodedData[ins + 1]; + length = encodedData[ins + 1]; Array.Copy(encodedData, ins + 2, decodedData, outs, length); - ins += 2 + length; + ins += 2 + length; outs += length; } else { - length = (byte)(encoding * 2); + length = (byte)(encoding * 2); byte run = encodedData[ins + 1]; byte[] part = new byte[length]; Array.Copy(encodedData, ins + 2, part, 0, length); @@ -1108,12 +1108,12 @@ namespace DiscImageChef.DiscImages public ushort Crc; /// Length of comment public ushort Length; - public byte Year; - public byte Month; - public byte Day; - public byte Hour; - public byte Minute; - public byte Second; + public byte Year; + public byte Month; + public byte Day; + public byte Hour; + public byte Minute; + public byte Second; } struct TeleDiskTrackHeader diff --git a/DiscImageChef.DiscImages/UDIF.cs b/DiscImageChef.DiscImages/UDIF.cs index 7438fdc00..40af6c9e7 100644 --- a/DiscImageChef.DiscImages/UDIF.cs +++ b/DiscImageChef.DiscImages/UDIF.cs @@ -233,7 +233,7 @@ namespace DiscImageChef.DiscImages // Block chunks and headers List blkxList = new List(); - chunks = new Dictionary(); + chunks = new Dictionary(); bool fakeBlockChunks = false; @@ -330,9 +330,9 @@ namespace DiscImageChef.DiscImages string dev = null; string pre = null; - string major = $"{version.MajorVersion}"; - string minor = $".{version.MinorVersion / 10}"; - if(version.MinorVersion % 10 > 0) release = $".{version.MinorVersion % 10}"; + string major = $"{version.MajorVersion}"; + string minor = $".{version.MinorVersion / 10}"; + if(version.MinorVersion % 10 > 0) release = $".{version.MinorVersion % 10}"; switch(version.DevStage) { case Version.DevelopmentStage.Alpha: @@ -355,8 +355,7 @@ namespace DiscImageChef.DiscImages imageInfo.Comments = version.VersionMessage; if(version.MajorVersion == 3) imageInfo.Application = "ShrinkWrap™"; - else if(version.MajorVersion == 6) - imageInfo.Application = "DiskCopy"; + else if(version.MajorVersion == 6) imageInfo.Application = "DiskCopy"; } else imageInfo.Application = "DiskCopy"; @@ -478,13 +477,13 @@ namespace DiscImageChef.DiscImages if(sectorCache.TryGetValue(sectorAddress, out byte[] sector)) return sector; - BlockChunk readChunk = new BlockChunk(); + BlockChunk readChunk = new BlockChunk(); bool chunkFound = false; ulong chunkStartSector = 0; foreach(KeyValuePair kvp in chunks.Where(kvp => sectorAddress >= kvp.Key)) { - readChunk = kvp.Value; + readChunk = kvp.Value; chunkFound = true; chunkStartSector = kvp.Key; } @@ -522,8 +521,7 @@ namespace DiscImageChef.DiscImages break; case CHUNK_TYPE_RLE: break; default: - throw new - ImageNotSupportedException($"Unsupported chunk type 0x{readChunk.type:X8} found"); + throw new ImageNotSupportedException($"Unsupported chunk type 0x{readChunk.type:X8} found"); } #if DEBUG @@ -552,8 +550,8 @@ namespace DiscImageChef.DiscImages currentChunkCacheSize += (uint)realSize; break; case CHUNK_TYPE_RLE: - tmpBuffer = new byte[buffersize]; - realSize = 0; + tmpBuffer = new byte[buffersize]; + realSize = 0; AppleRle rle = new AppleRle(cmpMs); for(int i = 0; i < buffersize; i++) { @@ -707,8 +705,8 @@ namespace DiscImageChef.DiscImages throw new FeatureUnsupportedImageException("Feature not supported by image format"); } - public bool? VerifySectors(ulong sectorAddress, uint length, out List failingLbas, - out List unknownLbas) + public bool? VerifySectors(ulong sectorAddress, uint length, out List failingLbas, + out List unknownLbas) { failingLbas = new List(); unknownLbas = new List(); @@ -717,8 +715,8 @@ namespace DiscImageChef.DiscImages return null; } - public bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List failingLbas, - out List unknownLbas) + public bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List failingLbas, + out List unknownLbas) { throw new FeatureUnsupportedImageException("Feature not supported by image format"); } @@ -733,7 +731,7 @@ namespace DiscImageChef.DiscImages public IEnumerable SupportedMediaTags => new MediaTagType[] { }; public IEnumerable SupportedSectorTags => new SectorTagType[] { }; - public IEnumerable SupportedMediaTypes => + public IEnumerable SupportedMediaTypes => new[] { MediaType.Unknown, MediaType.GENERIC_HDD, MediaType.FlashDrive, MediaType.CompactFlash, @@ -940,7 +938,7 @@ namespace DiscImageChef.DiscImages }; BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian; - MemoryStream chunkMs = new MemoryStream(); + MemoryStream chunkMs = new MemoryStream(); chunkMs.Write(BigEndianBitConverter.GetBytes(bHdr.signature), 0, 4); chunkMs.Write(BigEndianBitConverter.GetBytes(bHdr.version), 0, 4); chunkMs.Write(BigEndianBitConverter.GetBytes(bHdr.sectorStart), 0, 8); @@ -1110,17 +1108,17 @@ namespace DiscImageChef.DiscImages public uint dataForkChk; [MarshalAs(UnmanagedType.ByValArray, SizeConst = 124)] public byte[] reserved1; - public ulong plistOff; - public ulong plistLen; + public ulong plistOff; + public ulong plistLen; [MarshalAs(UnmanagedType.ByValArray, SizeConst = 120)] public byte[] reserved2; - public uint masterChkType; - public uint masterChkLen; - public uint masterChk; + public uint masterChkType; + public uint masterChkLen; + public uint masterChk; [MarshalAs(UnmanagedType.ByValArray, SizeConst = 124)] public byte[] reserved3; - public uint imageVariant; - public ulong sectorCount; + public uint imageVariant; + public ulong sectorCount; [MarshalAs(UnmanagedType.ByValArray, SizeConst = 12)] public byte[] reserved4; } @@ -1146,7 +1144,7 @@ namespace DiscImageChef.DiscImages public uint checksum; [MarshalAs(UnmanagedType.ByValArray, SizeConst = 124)] public byte[] reservedChk; - public uint chunks; + public uint chunks; } [StructLayout(LayoutKind.Sequential, Pack = 1)] diff --git a/DiscImageChef.DiscImages/UkvFdi.cs b/DiscImageChef.DiscImages/UkvFdi.cs index 31473332d..5fd063f5b 100644 --- a/DiscImageChef.DiscImages/UkvFdi.cs +++ b/DiscImageChef.DiscImages/UkvFdi.cs @@ -105,7 +105,7 @@ namespace DiscImageChef.DiscImages stream.Read(hdrB, 0, hdrB.Length); GCHandle handle = GCHandle.Alloc(hdrB, GCHandleType.Pinned); - hdr = (FdiHeader)Marshal.PtrToStructure(handle.AddrOfPinnedObject(), typeof(FdiHeader)); + hdr = (FdiHeader)Marshal.PtrToStructure(handle.AddrOfPinnedObject(), typeof(FdiHeader)); handle.Free(); return hdr.magic.SequenceEqual(signature); @@ -124,7 +124,7 @@ namespace DiscImageChef.DiscImages stream.Read(hdrB, 0, hdrB.Length); GCHandle handle = GCHandle.Alloc(hdrB, GCHandleType.Pinned); - hdr = (FdiHeader)Marshal.PtrToStructure(handle.AddrOfPinnedObject(), typeof(FdiHeader)); + hdr = (FdiHeader)Marshal.PtrToStructure(handle.AddrOfPinnedObject(), typeof(FdiHeader)); handle.Free(); DicConsole.DebugWriteLine("UkvFdi plugin", "hdr.addInfoLen = {0}", hdr.addInfoLen); @@ -145,7 +145,7 @@ namespace DiscImageChef.DiscImages long spt = long.MaxValue; uint[][][] sectorsOff = new uint[hdr.cylinders][][]; - sectorsData = new byte[hdr.cylinders][][][]; + sectorsData = new byte[hdr.cylinders][][][]; imageInfo.Cylinders = hdr.cylinders; imageInfo.Heads = hdr.heads; @@ -224,7 +224,7 @@ namespace DiscImageChef.DiscImages // Create empty sectors else { - sectorsData[cyl][head] = new byte[spt][]; + sectorsData[cyl][head] = new byte[spt][]; for(int i = 0; i < spt; i++) sectorsData[cyl][head][i] = new byte[imageInfo.SectorSize]; } } @@ -354,8 +354,8 @@ namespace DiscImageChef.DiscImages throw new FeatureUnsupportedImageException("Feature not supported by image format"); } - public bool? VerifySectors(ulong sectorAddress, uint length, out List failingLbas, - out List unknownLbas) + public bool? VerifySectors(ulong sectorAddress, uint length, out List failingLbas, + out List unknownLbas) { failingLbas = new List(); unknownLbas = new List(); @@ -364,8 +364,8 @@ namespace DiscImageChef.DiscImages return null; } - public bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List failingLbas, - out List unknownLbas) + public bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List failingLbas, + out List unknownLbas) { throw new FeatureUnsupportedImageException("Feature not supported by image format"); } @@ -380,9 +380,9 @@ namespace DiscImageChef.DiscImages (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); + 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); } @@ -409,7 +409,7 @@ namespace DiscImageChef.DiscImages struct FdiHeader { [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] - public byte[] magic; + public byte[] magic; public DiskFlags flags; public ushort cylinders; public ushort heads; diff --git a/DiscImageChef.DiscImages/VDI.cs b/DiscImageChef.DiscImages/VDI.cs index f81edb3e7..b38100e9d 100644 --- a/DiscImageChef.DiscImages/VDI.cs +++ b/DiscImageChef.DiscImages/VDI.cs @@ -123,7 +123,7 @@ namespace DiscImageChef.DiscImages byte[] vHdrB = new byte[Marshal.SizeOf(vHdr)]; stream.Read(vHdrB, 0, Marshal.SizeOf(vHdr)); - vHdr = new VdiHeader(); + vHdr = new VdiHeader(); IntPtr headerPtr = Marshal.AllocHGlobal(Marshal.SizeOf(vHdr)); Marshal.Copy(vHdrB, 0, headerPtr, Marshal.SizeOf(vHdr)); vHdr = (VdiHeader)Marshal.PtrToStructure(headerPtr, typeof(VdiHeader)); @@ -141,7 +141,7 @@ namespace DiscImageChef.DiscImages byte[] vHdrB = new byte[Marshal.SizeOf(vHdr)]; stream.Read(vHdrB, 0, Marshal.SizeOf(vHdr)); - vHdr = new VdiHeader(); + vHdr = new VdiHeader(); IntPtr headerPtr = Marshal.AllocHGlobal(Marshal.SizeOf(vHdr)); Marshal.Copy(vHdrB, 0, headerPtr, Marshal.SizeOf(vHdr)); vHdr = (VdiHeader)Marshal.PtrToStructure(headerPtr, typeof(VdiHeader)); @@ -177,7 +177,7 @@ namespace DiscImageChef.DiscImages DicConsole.DebugWriteLine("VirtualBox plugin", "Reading Image Block Map"); stream.Seek(vHdr.offsetBlocks, SeekOrigin.Begin); - ibm = new uint[vHdr.blocks]; + ibm = new uint[vHdr.blocks]; byte[] ibmB = new byte[vHdr.blocks * 4]; stream.Read(ibmB, 0, ibmB.Length); for(int i = 0; i < ibm.Length; i++) ibm[i] = BitConverter.ToUInt32(ibmB, i * 4); @@ -353,8 +353,8 @@ namespace DiscImageChef.DiscImages throw new FeatureUnsupportedImageException("Feature not supported by image format"); } - public bool? VerifySectors(ulong sectorAddress, uint length, out List failingLbas, - out List unknownLbas) + public bool? VerifySectors(ulong sectorAddress, uint length, out List failingLbas, + out List unknownLbas) { failingLbas = new List(); unknownLbas = new List(); @@ -363,8 +363,8 @@ namespace DiscImageChef.DiscImages return null; } - public bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List failingLbas, - out List unknownLbas) + public bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List failingLbas, + out List unknownLbas) { throw new FeatureUnsupportedImageException("Feature not supported by image format"); } @@ -379,7 +379,7 @@ namespace DiscImageChef.DiscImages public IEnumerable SupportedMediaTags => new MediaTagType[] { }; public IEnumerable SupportedSectorTags => new SectorTagType[] { }; - public IEnumerable SupportedMediaTypes => + public IEnumerable SupportedMediaTypes => new[] { MediaType.Unknown, MediaType.GENERIC_HDD, MediaType.FlashDrive, MediaType.CompactFlash, @@ -424,10 +424,10 @@ namespace DiscImageChef.DiscImages } uint ibmEntries = (uint)(sectors * sectorSize / DEFAULT_BLOCK_SIZE); - if(sectors * sectorSize % DEFAULT_BLOCK_SIZE > 0) ibmEntries++; + if(sectors * sectorSize % DEFAULT_BLOCK_SIZE > 0) ibmEntries++; uint headerSectors = 1 + ibmEntries * 4 / sectorSize; - if(ibmEntries * 4 % sectorSize != 0) headerSectors++; + if(ibmEntries * 4 % sectorSize != 0) headerSectors++; ibm = new uint[ibmEntries]; currentWritingPosition = headerSectors * sectorSize; @@ -669,29 +669,29 @@ namespace DiscImageChef.DiscImages /// /// Version /// - public ushort majorVersion; + public ushort majorVersion; public ushort minorVersion; public int headerSize; public VdiImageType imageType; public VdiImageFlags imageFlags; [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)] public string comments; - public uint offsetBlocks; - public uint offsetData; - public uint cylinders; - public uint heads; - public uint spt; - public uint sectorSize; - public uint unused; - public ulong size; - public uint blockSize; - public uint blockExtraData; - public uint blocks; - public uint allocatedBlocks; - public Guid uuid; - public Guid snapshotUuid; - public Guid linkUuid; - public Guid parentUuid; + public uint offsetBlocks; + public uint offsetData; + public uint cylinders; + public uint heads; + public uint spt; + public uint sectorSize; + public uint unused; + public ulong size; + public uint blockSize; + public uint blockExtraData; + public uint blocks; + public uint allocatedBlocks; + public Guid uuid; + public Guid snapshotUuid; + public Guid linkUuid; + public Guid parentUuid; } enum VdiImageType : uint diff --git a/DiscImageChef.DiscImages/VHD.cs b/DiscImageChef.DiscImages/VHD.cs index 084a6625b..e409c2c2a 100644 --- a/DiscImageChef.DiscImages/VHD.cs +++ b/DiscImageChef.DiscImages/VHD.cs @@ -190,7 +190,7 @@ namespace DiscImageChef.DiscImages /// /// Stores a Mac OS X URI (RFC-2396) absolute path in UTF-8, "MacX" /// - const uint PLATFORM_CODE_MACINTOSH_URI = 0x4D616358; + const uint PLATFORM_CODE_MACINTOSH_URI = 0x4D616358; uint bitmapSize; uint[] blockAllocationTable; ImageInfo imageInfo; @@ -391,7 +391,7 @@ namespace DiscImageChef.DiscImages 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); + 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); @@ -500,7 +500,7 @@ namespace DiscImageChef.DiscImages } case CREATOR_DISCIMAGECHEF: { - imageInfo.Application = "DiscImageChef"; + imageInfo.Application = "DiscImageChef"; imageInfo.ApplicationVersion = $"{(thisFooter.CreatorVersion & 0xFF000000) >> 24}.{(thisFooter.CreatorVersion & 0xFF0000) >> 16}.{(thisFooter.CreatorVersion & 0xFF00) >> 8}.{thisFooter.CreatorVersion & 0xFF}"; } @@ -525,7 +525,7 @@ namespace DiscImageChef.DiscImages imageInfo.Cylinders = (thisFooter.DiskGeometry & 0xFFFF0000) >> 16; imageInfo.Heads = (thisFooter.DiskGeometry & 0xFF00) >> 8; - imageInfo.SectorsPerTrack = thisFooter.DiskGeometry & 0xFF; + imageInfo.SectorsPerTrack = thisFooter.DiskGeometry & 0xFF; if(thisFooter.DiskType == TYPE_DYNAMIC || thisFooter.DiskType == TYPE_DIFFERENCING) { @@ -550,7 +550,7 @@ namespace DiscImageChef.DiscImages throw new ImageNotSupportedException("(VirtualPC plugin): Both header and footer are corrupt, image cannot be opened."); - thisDynamic = + thisDynamic = new DynamicDiskHeader {LocatorEntries = new ParentLocatorEntry[8], Reserved2 = new byte[256]}; for(int i = 0; i < 8; i++) thisDynamic.LocatorEntries[i] = new ParentLocatorEntry(); @@ -658,17 +658,17 @@ namespace DiscImageChef.DiscImages imageStream.Read(batSectorBytes, 0, 512); // This does the big-endian trick but reverses the order of elements also Array.Reverse(batSectorBytes); - GCHandle handle = GCHandle.Alloc(batSectorBytes, GCHandleType.Pinned); + GCHandle handle = GCHandle.Alloc(batSectorBytes, GCHandleType.Pinned); BatSector batSector = (BatSector)Marshal.PtrToStructure(handle.AddrOfPinnedObject(), typeof(BatSector)); handle.Free(); // This restores the order of elements Array.Reverse(batSector.blockPointer); - if(blockAllocationTable.Length >= i * 512 / 4 + 512 / 4) - Array.Copy(batSector.blockPointer, 0, blockAllocationTable, i * 512 / 4, 512 / 4); + 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); + blockAllocationTable.Length - i * 512 / 4); } DateTime endTime = DateTime.UtcNow; @@ -703,7 +703,7 @@ namespace DiscImageChef.DiscImages case TYPE_DIFFERENCING: { locatorEntriesData = new byte[8][]; - for(int i = 0; i < 8; i++) + for(int i = 0; i < 8; i++) if(thisDynamic.LocatorEntries[i].PlatformCode != 0x00000000) { locatorEntriesData[i] = new byte[thisDynamic.LocatorEntries[i].PlatformDataLength]; @@ -789,7 +789,7 @@ namespace DiscImageChef.DiscImages FileNotFoundException("(VirtualPC plugin): Cannot find parent file for differencing disk image"); { - parentImage = new Vhd(); + parentImage = new Vhd(); IFilter parentFilter = new FiltersList().GetFilter(Path.Combine(imageFilter.GetParentFolder(), parentPath)); @@ -853,7 +853,7 @@ namespace DiscImageChef.DiscImages uint blockOffset = blockAllocationTable[blockNumber] * 512; int bitmapByte = (int)Math.Floor((double)sectorInBlock / 8); - int bitmapBit = (int)(sectorInBlock % 8); + int bitmapBit = (int)(sectorInBlock % 8); Stream thisStream = thisFilter.GetDataForkStream(); @@ -884,7 +884,7 @@ namespace DiscImageChef.DiscImages byte[] data = new byte[512]; uint sectorOffset = blockAllocationTable[blockNumber] + bitmapSize + sectorInBlock; - thisStream = thisFilter.GetDataForkStream(); + thisStream = thisFilter.GetDataForkStream(); thisStream.Seek(sectorOffset * 512, SeekOrigin.Begin); thisStream.Read(data, 0, 512); @@ -951,7 +951,7 @@ namespace DiscImageChef.DiscImages if(blockAllocationTable[blockNumber] != 0xFFFFFFFF) { Stream thisStream = thisFilter.GetDataForkStream(); - thisStream.Seek(sectorOffset * 512, SeekOrigin.Begin); + thisStream.Seek(sectorOffset * 512, SeekOrigin.Begin); thisStream.Read(prefix, 0, (int)(512 * sectorsToReadHere)); } // If it is unallocated, just fill with zeroes @@ -1068,8 +1068,8 @@ namespace DiscImageChef.DiscImages throw new FeatureUnsupportedImageException("Feature not supported by image format"); } - public bool? VerifySectors(ulong sectorAddress, uint length, out List failingLbas, - out List unknownLbas) + public bool? VerifySectors(ulong sectorAddress, uint length, out List failingLbas, + out List unknownLbas) { failingLbas = new List(); unknownLbas = new List(); @@ -1078,8 +1078,8 @@ namespace DiscImageChef.DiscImages return null; } - public bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List failingLbas, - out List unknownLbas) + public bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List failingLbas, + out List unknownLbas) { throw new FeatureUnsupportedImageException("Feature not supported by image format"); } @@ -1094,7 +1094,7 @@ namespace DiscImageChef.DiscImages public IEnumerable SupportedMediaTags => new MediaTagType[] { }; public IEnumerable SupportedSectorTags => new SectorTagType[] { }; - public IEnumerable SupportedMediaTypes => + public IEnumerable SupportedMediaTypes => new[] { MediaType.GENERIC_HDD, MediaType.Unknown, MediaType.FlashDrive, MediaType.CompactFlash, @@ -1250,20 +1250,20 @@ namespace DiscImageChef.DiscImages HardDiskFooter footer = new HardDiskFooter { - Cookie = IMAGE_COOKIE, - Features = FEATURES_RESERVED, - Version = VERSION1, + Cookie = IMAGE_COOKIE, + Features = FEATURES_RESERVED, + Version = VERSION1, Timestamp = (uint)(DateTime.Now - new DateTime(2000, 1, 1, 0, 0, 0, DateTimeKind.Utc)).TotalSeconds, CreatorApplication = CREATOR_DISCIMAGECHEF, - CreatorVersion = - (uint)(((thisVersion.Major & 0xFF) << 24) + ((thisVersion.Minor & 0xFF) << 16) + + CreatorVersion = + (uint)(((thisVersion.Major & 0xFF) << 24) + ((thisVersion.Minor & 0xFF) << 16) + ((thisVersion.Build & 0xFF) << 8) + (thisVersion.Revision & 0xFF)), CreatorHostOs = DetectOS.GetRealPlatformID() == PlatformID.MacOSX ? CREATOR_MACINTOSH : CREATOR_WINDOWS, DiskType = TYPE_FIXED, UniqueId = Guid.NewGuid(), - DiskGeometry = - ((imageInfo.Cylinders & 0xFFFF) << 16) + ((imageInfo.Heads & 0xFF) << 8) + + DiskGeometry = + ((imageInfo.Cylinders & 0xFFFF) << 16) + ((imageInfo.Heads & 0xFF) << 8) + (imageInfo.SectorsPerTrack & 0xFF), OriginalSize = imageInfo.Sectors * 512, CurrentSize = imageInfo.Sectors * 512 @@ -1271,7 +1271,7 @@ namespace DiscImageChef.DiscImages footer.Offset = footer.DiskType == TYPE_FIXED ? ulong.MaxValue : 512; BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian; - byte[] footerBytes = new byte[512]; + byte[] footerBytes = new byte[512]; Array.Copy(BigEndianBitConverter.GetBytes(footer.Cookie), 0, footerBytes, 0x00, 8); Array.Copy(BigEndianBitConverter.GetBytes(footer.Features), 0, footerBytes, 0x08, 4); Array.Copy(BigEndianBitConverter.GetBytes(footer.Version), 0, footerBytes, 0x0C, 4); diff --git a/DiscImageChef.DiscImages/VHDX.cs b/DiscImageChef.DiscImages/VHDX.cs index ec35c4f81..1b557c6fa 100644 --- a/DiscImageChef.DiscImages/VHDX.cs +++ b/DiscImageChef.DiscImages/VHDX.cs @@ -182,7 +182,7 @@ namespace DiscImageChef.DiscImages byte[] vhdxIdB = new byte[Marshal.SizeOf(vhdxId)]; stream.Read(vhdxIdB, 0, Marshal.SizeOf(vhdxId)); - vhdxId = new VhdxIdentifier(); + vhdxId = new VhdxIdentifier(); IntPtr idPtr = Marshal.AllocHGlobal(Marshal.SizeOf(vhdxId)); Marshal.Copy(vhdxIdB, 0, idPtr, Marshal.SizeOf(vhdxId)); vhdxId = (VhdxIdentifier)Marshal.PtrToStructure(idPtr, typeof(VhdxIdentifier)); @@ -200,7 +200,7 @@ namespace DiscImageChef.DiscImages byte[] vhdxIdB = new byte[Marshal.SizeOf(vhdxId)]; stream.Read(vhdxIdB, 0, Marshal.SizeOf(vhdxId)); - vhdxId = new VhdxIdentifier(); + vhdxId = new VhdxIdentifier(); IntPtr idPtr = Marshal.AllocHGlobal(Marshal.SizeOf(vhdxId)); Marshal.Copy(vhdxIdB, 0, idPtr, Marshal.SizeOf(vhdxId)); vhdxId = (VhdxIdentifier)Marshal.PtrToStructure(idPtr, typeof(VhdxIdentifier)); @@ -213,7 +213,7 @@ namespace DiscImageChef.DiscImages stream.Seek(64 * 1024, SeekOrigin.Begin); byte[] vHdrB = new byte[Marshal.SizeOf(vHdr)]; stream.Read(vHdrB, 0, Marshal.SizeOf(vHdr)); - vHdr = new VhdxHeader(); + vHdr = new VhdxHeader(); IntPtr headerPtr = Marshal.AllocHGlobal(Marshal.SizeOf(vHdr)); Marshal.Copy(vHdrB, 0, headerPtr, Marshal.SizeOf(vHdr)); vHdr = (VhdxHeader)Marshal.PtrToStructure(headerPtr, typeof(VhdxHeader)); @@ -236,7 +236,7 @@ namespace DiscImageChef.DiscImages stream.Seek(192 * 1024, SeekOrigin.Begin); byte[] vRegTableB = new byte[Marshal.SizeOf(vRegHdr)]; stream.Read(vRegTableB, 0, Marshal.SizeOf(vRegHdr)); - vRegHdr = new VhdxRegionTableHeader(); + vRegHdr = new VhdxRegionTableHeader(); IntPtr vRegTabPtr = Marshal.AllocHGlobal(Marshal.SizeOf(vRegHdr)); Marshal.Copy(vRegTableB, 0, vRegTabPtr, Marshal.SizeOf(vRegHdr)); vRegHdr = (VhdxRegionTableHeader)Marshal.PtrToStructure(vRegTabPtr, typeof(VhdxRegionTableHeader)); @@ -262,13 +262,14 @@ namespace DiscImageChef.DiscImages { byte[] vRegB = new byte[Marshal.SizeOf(vRegs[i])]; stream.Read(vRegB, 0, Marshal.SizeOf(vRegs[i])); - vRegs[i] = new VhdxRegionTableEntry(); + vRegs[i] = new VhdxRegionTableEntry(); IntPtr vRegPtr = Marshal.AllocHGlobal(Marshal.SizeOf(vRegs[i])); Marshal.Copy(vRegB, 0, vRegPtr, Marshal.SizeOf(vRegs[i])); vRegs[i] = (VhdxRegionTableEntry)Marshal.PtrToStructure(vRegPtr, typeof(VhdxRegionTableEntry)); Marshal.FreeHGlobal(vRegPtr); - if(vRegs[i].guid == batGuid) batOffset = (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 & REGION_FLAGS_REQUIRED) == REGION_FLAGS_REQUIRED) @@ -285,7 +286,7 @@ namespace DiscImageChef.DiscImages stream.Seek(metadataOffset, SeekOrigin.Begin); byte[] metTableB = new byte[Marshal.SizeOf(vMetHdr)]; stream.Read(metTableB, 0, Marshal.SizeOf(vMetHdr)); - vMetHdr = new VhdxMetadataTableHeader(); + vMetHdr = new VhdxMetadataTableHeader(); IntPtr metTablePtr = Marshal.AllocHGlobal(Marshal.SizeOf(vMetHdr)); Marshal.Copy(metTableB, 0, metTablePtr, Marshal.SizeOf(vMetHdr)); vMetHdr = (VhdxMetadataTableHeader)Marshal.PtrToStructure(metTablePtr, typeof(VhdxMetadataTableHeader)); @@ -296,13 +297,14 @@ namespace DiscImageChef.DiscImages { byte[] vMetB = new byte[Marshal.SizeOf(vMets[i])]; stream.Read(vMetB, 0, Marshal.SizeOf(vMets[i])); - vMets[i] = new VhdxMetadataTableEntry(); + vMets[i] = new VhdxMetadataTableEntry(); IntPtr vMetPtr = Marshal.AllocHGlobal(Marshal.SizeOf(vMets[i])); Marshal.Copy(vMetB, 0, vMetPtr, Marshal.SizeOf(vMets[i])); vMets[i] = (VhdxMetadataTableEntry)Marshal.PtrToStructure(vMetPtr, typeof(VhdxMetadataTableEntry)); Marshal.FreeHGlobal(vMetPtr); - if(vMets[i].itemId == fileParametersGuid) fileParamsOff = 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) @@ -373,7 +375,7 @@ namespace DiscImageChef.DiscImages stream.Seek(parentOff + metadataOffset, SeekOrigin.Begin); byte[] vParHdrB = new byte[Marshal.SizeOf(vMetHdr)]; stream.Read(vParHdrB, 0, Marshal.SizeOf(vMetHdr)); - vParHdr = new VhdxParentLocatorHeader(); + vParHdr = new VhdxParentLocatorHeader(); IntPtr vParHdrPtr = Marshal.AllocHGlobal(Marshal.SizeOf(vMetHdr)); Marshal.Copy(vParHdrB, 0, vParHdrPtr, Marshal.SizeOf(vMetHdr)); vParHdr = (VhdxParentLocatorHeader)Marshal.PtrToStructure(vParHdrPtr, typeof(VhdxParentLocatorHeader)); @@ -388,7 +390,7 @@ namespace DiscImageChef.DiscImages { byte[] vParB = new byte[Marshal.SizeOf(vPars[i])]; stream.Read(vParB, 0, Marshal.SizeOf(vPars[i])); - vPars[i] = new VhdxParentLocatorEntry(); + vPars[i] = new VhdxParentLocatorEntry(); IntPtr vParPtr = Marshal.AllocHGlobal(Marshal.SizeOf(vPars[i])); Marshal.Copy(vParB, 0, vParPtr, Marshal.SizeOf(vPars[i])); vPars[i] = (VhdxParentLocatorEntry)Marshal.PtrToStructure(vParPtr, typeof(VhdxParentLocatorEntry)); @@ -401,7 +403,7 @@ namespace DiscImageChef.DiscImages if((vFileParms.flags & FILE_FLAGS_HAS_PARENT) == FILE_FLAGS_HAS_PARENT && vParHdr.locatorType == parentTypeVhdxGuid) { - parentImage = new Vhdx(); + parentImage = new Vhdx(); bool parentWorks = false; foreach(VhdxParentLocatorEntry parentEntry in vPars) @@ -478,14 +480,14 @@ namespace DiscImageChef.DiscImages } chunkRatio = (long)(Math.Pow(2, 23) * logicalSectorSize / vFileParms.blockSize); - dataBlocks = virtualDiskSize / vFileParms.blockSize; - if(virtualDiskSize % vFileParms.blockSize > 0) dataBlocks++; + dataBlocks = virtualDiskSize / vFileParms.blockSize; + 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); @@ -494,15 +496,15 @@ namespace DiscImageChef.DiscImages DicConsole.DebugWriteLine("VHDX plugin", "Reading BAT"); - long readChunks = 0; + long readChunks = 0; blockAllocationTable = new ulong[dataBlocks]; - byte[] batB = new byte[batEntries * 8]; + byte[] batB = new byte[batEntries * 8]; stream.Seek(batOffset, SeekOrigin.Begin); stream.Read(batB, 0, batB.Length); ulong skipSize = 0; for(ulong i = 0; i < dataBlocks; i++) - if(readChunks == chunkRatio) + if(readChunks == chunkRatio) { if(hasParent) sectorBitmapPointers[skipSize / 8] = BitConverter.ToUInt64(batB, (int)(i * 8 + skipSize)); @@ -721,8 +723,8 @@ namespace DiscImageChef.DiscImages throw new FeatureUnsupportedImageException("Feature not supported by image format"); } - public bool? VerifySectors(ulong sectorAddress, uint length, out List failingLbas, - out List unknownLbas) + public bool? VerifySectors(ulong sectorAddress, uint length, out List failingLbas, + out List unknownLbas) { failingLbas = new List(); unknownLbas = new List(); @@ -731,8 +733,8 @@ namespace DiscImageChef.DiscImages return null; } - public bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List failingLbas, - out List unknownLbas) + public bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List failingLbas, + out List unknownLbas) { throw new FeatureUnsupportedImageException("Feature not supported by image format"); } @@ -935,7 +937,7 @@ namespace DiscImageChef.DiscImages /// /// Type of parent virtual disk /// - public Guid locatorType; + public Guid locatorType; public ushort reserved; /// /// How many KVPs are in this parent locator diff --git a/DiscImageChef.DiscImages/VMware.cs b/DiscImageChef.DiscImages/VMware.cs index 040bd7cec..180f1ed19 100644 --- a/DiscImageChef.DiscImages/VMware.cs +++ b/DiscImageChef.DiscImages/VMware.cs @@ -73,7 +73,7 @@ namespace DiscImageChef.DiscImages const string REGEX_VERSION = @"^\s*version\s*=\s*(?\d+)$"; const string REGEX_CID = @"^\s*CID\s*=\s*(?[0123456789abcdef]{8})$"; const string REGEX_CID_PARENT = @"^\s*parentCID\s*=\s*(?[0123456789abcdef]{8})$"; - const string REGEX_TYPE = + const string REGEX_TYPE = @"^\s*createType\s*=\s*\""(?custom|monolithicSparse|monolithicFlat|twoGbMaxExtentSparse|twoGbMaxExtentFlat|fullDevice|partitionedDevice|vmfs|vmfsPreallocated|vmfsEagerZeroedThick|vmfsThin|vmfsSparse|vmfsRDM|vmfsRawDeviceMap|vmfsRDMP|vmfsPassthroughRawDeviceMap|vmfsRaw|streamOptimized)\""$"; const string REGEX_EXTENT = @"^\s*(?(RW|RDONLY|NOACCESS))\s+(?\d+)\s+(?(FLAT|SPARSE|ZERO|VMFS|VMFSSPARSE|VMFSRDM|VMFSRAW))\s+\""(?.+)\""(\s*(?\d+))?$"; @@ -93,10 +93,10 @@ namespace DiscImageChef.DiscImages const ushort COMPRESSION_NONE = 0; const ushort COMPRESSION_DEFLATE = 1; - const uint MAX_CACHE_SIZE = 16777216; - const uint SECTOR_SIZE = 512; - const uint MAX_CACHED_SECTORS = MAX_CACHE_SIZE / SECTOR_SIZE; - readonly byte[] ddfMagicBytes = + const uint MAX_CACHE_SIZE = 16777216; + const uint SECTOR_SIZE = 512; + const uint MAX_CACHED_SECTORS = MAX_CACHE_SIZE / SECTOR_SIZE; + readonly byte[] ddfMagicBytes = { 0x23, 0x20, 0x44, 0x69, 0x73, 0x6B, 0x20, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6F, 0x72, 0x46, 0x69, 0x6C, 0x65 @@ -183,7 +183,7 @@ namespace DiscImageChef.DiscImages stream.Seek(0, SeekOrigin.Begin); byte[] vmEHdrB = new byte[Marshal.SizeOf(vmEHdr)]; stream.Read(vmEHdrB, 0, Marshal.SizeOf(vmEHdr)); - vmEHdr = new VMwareExtentHeader(); + vmEHdr = new VMwareExtentHeader(); IntPtr headerPtr = Marshal.AllocHGlobal(Marshal.SizeOf(vmEHdr)); Marshal.Copy(vmEHdrB, 0, headerPtr, Marshal.SizeOf(vmEHdr)); vmEHdr = (VMwareExtentHeader)Marshal.PtrToStructure(headerPtr, typeof(VMwareExtentHeader)); @@ -193,7 +193,7 @@ namespace DiscImageChef.DiscImages stream.Read(ddfMagic, 0, 0x15); vmCHdr = new VMwareCowHeader(); - if(stream.Length <= Marshal.SizeOf(vmCHdr)) + if(stream.Length <= Marshal.SizeOf(vmCHdr)) return ddfMagicBytes.SequenceEqual(ddfMagic) || vmEHdr.magic == VMWARE_EXTENT_MAGIC || vmCHdr.magic == VMWARE_COW_MAGIC; @@ -219,8 +219,8 @@ namespace DiscImageChef.DiscImages { Stream stream = imageFilter.GetDataForkStream(); - vmEHdr = new VMwareExtentHeader(); - vmCHdr = new VMwareCowHeader(); + vmEHdr = new VMwareExtentHeader(); + vmCHdr = new VMwareCowHeader(); bool embedded = false; if(stream.Length > Marshal.SizeOf(vmEHdr)) @@ -284,7 +284,7 @@ namespace DiscImageChef.DiscImages ddfStream.Write(ddfExternal, 0, ddfExternal.Length); } - extents = new Dictionary(); + extents = new Dictionary(); ulong currentSector = 0; bool matchedCyls = false, matchedHds = false, matchedSpt = false; @@ -542,7 +542,7 @@ namespace DiscImageChef.DiscImages grainSize = vmEHdr.grainSize; grains = (uint)(imageInfo.Sectors / vmEHdr.grainSize) + 1; - gdEntries = grains / vmEHdr.GTEsPerGT; + gdEntries = grains / vmEHdr.GTEsPerGT; gtEsPerGt = vmEHdr.GTEsPerGT; if((vmEHdr.flags & FLAGS_USE_REDUNDANT_TABLE) == FLAGS_USE_REDUNDANT_TABLE) @@ -599,11 +599,11 @@ namespace DiscImageChef.DiscImages DicConsole.DebugWriteLine("VMware plugin", "Reading grain tables"); uint currentGrain = 0; - gTable = new uint[grains]; + gTable = new uint[grains]; foreach(uint gtOff in gd) { byte[] gtBytes = new byte[gtEsPerGt * 4]; - gdStream.Seek(gtOff * SECTOR_SIZE, SeekOrigin.Begin); + gdStream.Seek(gtOff * SECTOR_SIZE, SeekOrigin.Begin); gdStream.Read(gtBytes, 0, gtBytes.Length); for(int i = 0; i < gtEsPerGt; i++) { @@ -704,7 +704,7 @@ namespace DiscImageChef.DiscImages return sector; } - ulong index = sectorAddress / grainSize; + ulong index = sectorAddress / grainSize; ulong secOff = sectorAddress % grainSize * SECTOR_SIZE; uint grainOff = gTable[index]; @@ -838,8 +838,8 @@ namespace DiscImageChef.DiscImages throw new FeatureUnsupportedImageException("Feature not supported by image format"); } - public bool? VerifySectors(ulong sectorAddress, uint length, out List failingLbas, - out List unknownLbas) + public bool? VerifySectors(ulong sectorAddress, uint length, out List failingLbas, + out List unknownLbas) { failingLbas = new List(); unknownLbas = new List(); @@ -848,8 +848,8 @@ namespace DiscImageChef.DiscImages return null; } - public bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List failingLbas, - out List unknownLbas) + public bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List failingLbas, + out List unknownLbas) { throw new FeatureUnsupportedImageException("Feature not supported by image format"); } @@ -864,7 +864,7 @@ namespace DiscImageChef.DiscImages public IEnumerable SupportedMediaTags => new MediaTagType[] { }; public IEnumerable SupportedSectorTags => new SectorTagType[] { }; - public IEnumerable SupportedMediaTypes => + public IEnumerable SupportedMediaTypes => new[] { MediaType.GENERIC_HDD, MediaType.Unknown, MediaType.FlashDrive, MediaType.CompactFlash, @@ -875,7 +875,7 @@ namespace DiscImageChef.DiscImages new[] { ("adapter_type", typeof(string), - "Type of adapter type. Possible values: ide, lsilogic, buslogic, legacyESX."), + "Type of adapter type. Possible values: ide, lsilogic, buslogic, legacyESX."), ("hwversion", typeof(uint), "VDMK hardware version."), ("sparse", typeof(bool), "Use sparse extents."), ("split", typeof(bool), "Split data file at 2GiB.") }; @@ -1220,16 +1220,16 @@ namespace DiscImageChef.DiscImages // It stats on cylinders, above, but, don't care [MarshalAs(UnmanagedType.ByValArray, SizeConst = 1024 - 12)] public byte[] parentFileName; - public uint parentGeneration; - public uint generation; + public uint parentGeneration; + public uint generation; [MarshalAs(UnmanagedType.ByValArray, SizeConst = 60)] public byte[] name; [MarshalAs(UnmanagedType.ByValArray, SizeConst = 512)] public byte[] description; - public uint savedGeneration; + public uint savedGeneration; [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] - public byte[] reserved; - [MarshalAs(UnmanagedType.U1)] public bool uncleanShutdown; + public byte[] reserved; + [MarshalAs(UnmanagedType.U1)] public bool uncleanShutdown; [MarshalAs(UnmanagedType.ByValArray, SizeConst = 396)] public byte[] padding; } diff --git a/DiscImageChef.DiscImages/Virtual98.cs b/DiscImageChef.DiscImages/Virtual98.cs index daaf566c5..0d2a83f08 100644 --- a/DiscImageChef.DiscImages/Virtual98.cs +++ b/DiscImageChef.DiscImages/Virtual98.cs @@ -111,8 +111,7 @@ namespace DiscImageChef.DiscImages stream.Read(hdrB, 0, hdrB.Length); GCHandle handle = GCHandle.Alloc(hdrB, GCHandleType.Pinned); - v98Hdr = - (Virtual98Header)Marshal.PtrToStructure(handle.AddrOfPinnedObject(), typeof(Virtual98Header)); + v98Hdr = (Virtual98Header)Marshal.PtrToStructure(handle.AddrOfPinnedObject(), typeof(Virtual98Header)); handle.Free(); if(!v98Hdr.signature.SequenceEqual(signature)) return false; @@ -147,8 +146,7 @@ namespace DiscImageChef.DiscImages stream.Read(hdrB, 0, hdrB.Length); GCHandle handle = GCHandle.Alloc(hdrB, GCHandleType.Pinned); - v98Hdr = - (Virtual98Header)Marshal.PtrToStructure(handle.AddrOfPinnedObject(), typeof(Virtual98Header)); + v98Hdr = (Virtual98Header)Marshal.PtrToStructure(handle.AddrOfPinnedObject(), typeof(Virtual98Header)); handle.Free(); imageInfo.MediaType = MediaType.GENERIC_HDD; @@ -276,8 +274,8 @@ namespace DiscImageChef.DiscImages throw new FeatureUnsupportedImageException("Feature not supported by image format"); } - public bool? VerifySectors(ulong sectorAddress, uint length, out List failingLbas, - out List unknownLbas) + public bool? VerifySectors(ulong sectorAddress, uint length, out List failingLbas, + out List unknownLbas) { failingLbas = new List(); unknownLbas = new List(); @@ -286,8 +284,8 @@ namespace DiscImageChef.DiscImages return null; } - public bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List failingLbas, - out List unknownLbas) + public bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List failingLbas, + out List unknownLbas) { throw new FeatureUnsupportedImageException("Feature not supported by image format"); } @@ -302,7 +300,7 @@ namespace DiscImageChef.DiscImages public IEnumerable SupportedMediaTags => new MediaTagType[] { }; public IEnumerable SupportedSectorTags => new SectorTagType[] { }; - public IEnumerable SupportedMediaTypes => + public IEnumerable SupportedMediaTypes => new[] { MediaType.GENERIC_HDD, MediaType.Unknown, MediaType.FlashDrive, MediaType.CompactFlash, diff --git a/DiscImageChef.DiscImages/ZZZRawImage.cs b/DiscImageChef.DiscImages/ZZZRawImage.cs index bd727654c..715c7a06d 100644 --- a/DiscImageChef.DiscImages/ZZZRawImage.cs +++ b/DiscImageChef.DiscImages/ZZZRawImage.cs @@ -50,8 +50,7 @@ namespace DiscImageChef.DiscImages { public class ZZZRawImage : IWritableImage { - readonly byte[] cdSync = - {0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00}; + readonly byte[] cdSync = {0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00}; readonly (MediaTagType tag, string name)[] readWriteSidecars = { (MediaTagType.ATA_IDENTIFY, ".identify.bin"), (MediaTagType.BD_DI, ".di.bin"), @@ -142,11 +141,11 @@ namespace DiscImageChef.DiscImages TrackRawBytesPerSector = rawCompactDisc ? 2352 : (int)imageInfo.SectorSize, TrackSequence = 1, TrackStartSector = 0, - TrackSubchannelType = + TrackSubchannelType = hasSubchannel ? TrackSubchannelType.RawInterleaved : TrackSubchannelType.None, TrackType = rawCompactDisc - ? (mode2 ? TrackType.CdMode2Formless : TrackType.CdMode1) - : TrackType.Data, + ? (mode2 ? TrackType.CdMode2Formless : TrackType.CdMode1) + : TrackType.Data, TrackSession = 1 }; List lst = new List {trk}; @@ -182,7 +181,7 @@ namespace DiscImageChef.DiscImages throw new FeatureUnsupportedImageException("Feature not supported by image format"); List parts = new List(); - Partition part = new Partition + Partition part = new Partition { Start = 0, Length = imageInfo.Sectors, @@ -209,8 +208,8 @@ namespace DiscImageChef.DiscImages if(imageFilter.GetDataForkLength() % 2352 == 0 && imageFilter.GetDataForkLength() <= 846720000 || imageFilter.GetDataForkLength() % 2448 == 0 && imageFilter.GetDataForkLength() <= 881280000) { - byte[] sync = new byte[12]; - Stream stream = imageFilter.GetDataForkStream(); + byte[] sync = new byte[12]; + Stream stream = imageFilter.GetDataForkStream(); stream.Position = 0; stream.Read(sync, 0, 12); return cdSync.SequenceEqual(sync); @@ -242,7 +241,7 @@ namespace DiscImageChef.DiscImages case 1222400: case 1304320: case 1255168: return true; - default: return false; + default: return false; } } @@ -261,12 +260,10 @@ namespace DiscImageChef.DiscImages imageInfo.SectorSize = 256; break; default: - 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) + 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()) @@ -448,7 +445,7 @@ namespace DiscImageChef.DiscImages } // Sharp X68000 SASI hard disks - if(extension == ".hdf") + if(extension == ".hdf") if(imageInfo.ImageSize % 256 == 0) { imageInfo.SectorSize = 256; @@ -458,7 +455,7 @@ namespace DiscImageChef.DiscImages // Search for known tags string basename = imageFilter.GetBasePath(); - basename = basename.Substring(0, basename.Length - extension.Length); + basename = basename.Substring(0, basename.Length - extension.Length); mediaTags = new Dictionary(); foreach((MediaTagType tag, string name) sidecar in readWriteSidecars) @@ -1005,8 +1002,8 @@ namespace DiscImageChef.DiscImages Modes.ModePage_04? mode04 = Modes.DecodeModePage_04(page.PageResponse); if(!mode04.HasValue) continue; - imageInfo.Cylinders = mode04.Value.Cylinders; - imageInfo.Heads = mode04.Value.Heads; + imageInfo.Cylinders = mode04.Value.Cylinders; + imageInfo.Heads = mode04.Value.Heads; imageInfo.SectorsPerTrack = (uint)(imageInfo.Sectors / (mode04.Value.Cylinders * mode04.Value.Heads)); } @@ -1026,8 +1023,7 @@ namespace DiscImageChef.DiscImages { imageInfo.DriveManufacturer = VendorString.Prettify(StringHandlers.CToString(scsiInq.Value.VendorIdentification).Trim()); - imageInfo.DriveModel = - StringHandlers.CToString(scsiInq.Value.ProductIdentification).Trim(); + imageInfo.DriveModel = StringHandlers.CToString(scsiInq.Value.ProductIdentification).Trim(); imageInfo.DriveFirmwareRevision = StringHandlers.CToString(scsiInq.Value.ProductRevisionLevel).Trim(); imageInfo.MediaType = MediaTypeFromScsi.Get((byte)devType, imageInfo.DriveManufacturer, @@ -1035,7 +1031,7 @@ namespace DiscImageChef.DiscImages imageInfo.Sectors, imageInfo.SectorSize); } - if(imageInfo.MediaType == MediaType.Unknown) + if(imageInfo.MediaType == MediaType.Unknown) imageInfo.MediaType = devType == PeripheralDeviceTypes.OpticalDevice ? MediaType.UnknownMO : MediaType.GENERIC_HDD; @@ -1115,7 +1111,7 @@ namespace DiscImageChef.DiscImages try { StreamReader sr = new StreamReader(basename + "cicm.xml"); - CicmMetadata = (CICMMetadataType)sidecarXs.Deserialize(sr); + CicmMetadata = (CICMMetadataType)sidecarXs.Deserialize(sr); sr.Close(); } catch @@ -1196,9 +1192,7 @@ namespace DiscImageChef.DiscImages byte[] buffer = new byte[sectorSize * length]; BinaryReader br = new BinaryReader(stream); - br.BaseStream - .Seek((long)(sectorAddress * (sectorOffset + sectorSize + sectorSkip)), - SeekOrigin.Begin); + br.BaseStream.Seek((long)(sectorAddress * (sectorOffset + sectorSize + sectorSkip)), SeekOrigin.Begin); if(sectorOffset == 0 && sectorSkip == 0) buffer = br.ReadBytes((int)(sectorSize * length)); else for(int i = 0; i < length; i++) @@ -1228,8 +1222,8 @@ namespace DiscImageChef.DiscImages return CdChecksums.CheckCdSector(buffer); } - public bool? VerifySectors(ulong sectorAddress, uint length, out List failingLbas, - out List unknownLbas) + public bool? VerifySectors(ulong sectorAddress, uint length, out List failingLbas, + out List unknownLbas) { if(!rawCompactDisc) { @@ -1244,8 +1238,8 @@ namespace DiscImageChef.DiscImages byte[] buffer = ReadSectorsLong(sectorAddress, length); int bps = (int)(buffer.Length / length); byte[] sector = new byte[bps]; - failingLbas = new List(); - unknownLbas = new List(); + failingLbas = new List(); + unknownLbas = new List(); for(int i = 0; i < length; i++) { @@ -1268,8 +1262,8 @@ namespace DiscImageChef.DiscImages return failingLbas.Count <= 0; } - public bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List failingLbas, - out List unknownLbas) + public bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List failingLbas, + out List unknownLbas) { if(!rawCompactDisc) { @@ -1284,8 +1278,8 @@ namespace DiscImageChef.DiscImages byte[] buffer = ReadSectorsLong(sectorAddress, length, track); int bps = (int)(buffer.Length / length); byte[] sector = new byte[bps]; - failingLbas = new List(); - unknownLbas = new List(); + failingLbas = new List(); + unknownLbas = new List(); for(int i = 0; i < length; i++) { @@ -1505,9 +1499,7 @@ namespace DiscImageChef.DiscImages Stream stream = rawImageFilter.GetDataForkStream(); BinaryReader br = new BinaryReader(stream); - br.BaseStream - .Seek((long)(sectorAddress * (sectorOffset + sectorSize + sectorSkip)), - SeekOrigin.Begin); + br.BaseStream.Seek((long)(sectorAddress * (sectorOffset + sectorSize + sectorSkip)), SeekOrigin.Begin); if(sectorOffset == 0 && sectorSkip == 0) buffer = br.ReadBytes((int)(sectorSize * length)); else for(int i = 0; i < length; i++) @@ -1593,7 +1585,7 @@ namespace DiscImageChef.DiscImages readWriteSidecars.Concat(writeOnlySidecars).OrderBy(t => t.tag).Select(t => t.tag).ToArray(); public IEnumerable SupportedSectorTags => new SectorTagType[] { }; - public IEnumerable SupportedMediaTypes + public IEnumerable SupportedMediaTypes { get { @@ -1874,7 +1866,7 @@ namespace DiscImageChef.DiscImages 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) + if((extension == ".adf" || extension == ".adl") && imageInfo.SectorSize == 1024) return MediaType.ACORN_35_DS_DD; if(extension == ".st") return MediaType.ATARI_35_DS_DD; diff --git a/DiscImageChef.Filesystems/AODOS.cs b/DiscImageChef.Filesystems/AODOS.cs index 1900a467d..936e87fb7 100644 --- a/DiscImageChef.Filesystems/AODOS.cs +++ b/DiscImageChef.Filesystems/AODOS.cs @@ -44,11 +44,11 @@ namespace DiscImageChef.Filesystems // This may be missing fields, or not, I don't know russian so any help is appreciated public class AODOS : IFilesystem { - readonly byte[] AODOSIdentifier = {0x20, 0x41, 0x4F, 0x2D, 0x44, 0x4F, 0x53, 0x20}; - public FileSystemType XmlFsType { get; private set; } - public string Name => "Alexander Osipov DOS file system"; - public Guid Id => new Guid("668E5039-9DDD-442A-BE1B-A315D6E38E26"); - public Encoding Encoding { get; private set; } + readonly byte[] AODOSIdentifier = {0x20, 0x41, 0x4F, 0x2D, 0x44, 0x4F, 0x53, 0x20}; + public FileSystemType XmlFsType { get; private set; } + public string Name => "Alexander Osipov DOS file system"; + public Guid Id => new Guid("668E5039-9DDD-442A-BE1B-A315D6E38E26"); + public Encoding Encoding { get; private set; } public bool Identify(IMediaImage imagePlugin, Partition partition) { @@ -61,9 +61,9 @@ namespace DiscImageChef.Filesystems // Does AO-DOS support any other kind of disk? if(imagePlugin.Info.Sectors != 800 && imagePlugin.Info.Sectors != 1600) return false; - byte[] sector = imagePlugin.ReadSector(0); - AODOS_BootBlock bb = new AODOS_BootBlock(); - IntPtr bbPtr = Marshal.AllocHGlobal(Marshal.SizeOf(bb)); + byte[] sector = imagePlugin.ReadSector(0); + AODOS_BootBlock bb = new AODOS_BootBlock(); + IntPtr bbPtr = Marshal.AllocHGlobal(Marshal.SizeOf(bb)); Marshal.Copy(sector, 0, bbPtr, Marshal.SizeOf(bb)); bb = (AODOS_BootBlock)Marshal.PtrToStructure(bbPtr, typeof(AODOS_BootBlock)); Marshal.FreeHGlobal(bbPtr); @@ -72,12 +72,12 @@ namespace DiscImageChef.Filesystems } public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information, - Encoding encoding) + Encoding encoding) { Encoding = Encoding.GetEncoding("koi8-r"); - byte[] sector = imagePlugin.ReadSector(0); - AODOS_BootBlock bb = new AODOS_BootBlock(); - IntPtr bbPtr = Marshal.AllocHGlobal(Marshal.SizeOf(bb)); + byte[] sector = imagePlugin.ReadSector(0); + AODOS_BootBlock bb = new AODOS_BootBlock(); + IntPtr bbPtr = Marshal.AllocHGlobal(Marshal.SizeOf(bb)); Marshal.Copy(sector, 0, bbPtr, Marshal.SizeOf(bb)); bb = (AODOS_BootBlock)Marshal.PtrToStructure(bbPtr, typeof(AODOS_BootBlock)); Marshal.FreeHGlobal(bbPtr); @@ -88,15 +88,15 @@ namespace DiscImageChef.Filesystems XmlFsType = new FileSystemType { - Type = "Alexander Osipov DOS file system", - Clusters = (long)imagePlugin.Info.Sectors, - ClusterSize = (int)imagePlugin.Info.SectorSize, - Files = bb.files, - FilesSpecified = true, - FreeClusters = (long)(imagePlugin.Info.Sectors - bb.usedSectors), + Type = "Alexander Osipov DOS file system", + Clusters = (long)imagePlugin.Info.Sectors, + ClusterSize = (int)imagePlugin.Info.SectorSize, + Files = bb.files, + FilesSpecified = true, + FreeClusters = (long)(imagePlugin.Info.Sectors - bb.usedSectors), FreeClustersSpecified = true, - VolumeName = StringHandlers.SpacePaddedToString(bb.volumeLabel, Encoding), - Bootable = true + VolumeName = StringHandlers.SpacePaddedToString(bb.volumeLabel, Encoding), + Bootable = true }; sbInformation.AppendFormat("{0} files on volume", bb.files).AppendLine(); @@ -125,11 +125,13 @@ namespace DiscImageChef.Filesystems /// /// " AO-DOS " /// - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] public byte[] identifier; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] + public byte[] identifier; /// /// Volume label /// - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 12)] public byte[] volumeLabel; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 12)] + public byte[] volumeLabel; /// /// How many files are present in disk /// diff --git a/DiscImageChef.Filesystems/APFS.cs b/DiscImageChef.Filesystems/APFS.cs index ee0c0c057..b786dd336 100644 --- a/DiscImageChef.Filesystems/APFS.cs +++ b/DiscImageChef.Filesystems/APFS.cs @@ -42,18 +42,18 @@ namespace DiscImageChef.Filesystems public class APFS : IFilesystem { const uint APFS_CONTAINER_MAGIC = 0x4253584E; // "NXSB" - const uint APFS_VOLUME_MAGIC = 0x42535041; // "APSB" + const uint APFS_VOLUME_MAGIC = 0x42535041; // "APSB" public FileSystemType XmlFsType { get; private set; } - public Encoding Encoding { get; private set; } - public string Name => "Apple File System"; - public Guid Id => new Guid("A4060F9D-2909-42E2-9D95-DB31FA7EA797"); + public Encoding Encoding { get; private set; } + public string Name => "Apple File System"; + public Guid Id => new Guid("A4060F9D-2909-42E2-9D95-DB31FA7EA797"); public bool Identify(IMediaImage imagePlugin, Partition partition) { if(partition.Start >= partition.End) return false; - byte[] sector = imagePlugin.ReadSector(partition.Start); + byte[] sector = imagePlugin.ReadSector(partition.Start); ApfsContainerSuperBlock nxSb; try @@ -69,16 +69,16 @@ namespace DiscImageChef.Filesystems } public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information, - Encoding encoding) + Encoding encoding) { Encoding = Encoding.UTF8; StringBuilder sbInformation = new StringBuilder(); - XmlFsType = new FileSystemType(); + XmlFsType = new FileSystemType(); information = ""; if(partition.Start >= partition.End) return; - byte[] sector = imagePlugin.ReadSector(partition.Start); + byte[] sector = imagePlugin.ReadSector(partition.Start); ApfsContainerSuperBlock nxSb; try @@ -102,10 +102,10 @@ namespace DiscImageChef.Filesystems XmlFsType = new FileSystemType { - Bootable = false, - Clusters = (long)nxSb.containerBlocks, + Bootable = false, + Clusters = (long)nxSb.containerBlocks, ClusterSize = (int)nxSb.blockSize, - Type = "Apple File System" + Type = "Apple File System" }; } @@ -116,8 +116,8 @@ namespace DiscImageChef.Filesystems public ulong unknown2; public ulong unknown3; // Varies by 1 between copies of the superblock public ulong unknown4; - public uint magic; - public uint blockSize; + public uint magic; + public uint blockSize; public ulong containerBlocks; } } diff --git a/DiscImageChef.Filesystems/Acorn.cs b/DiscImageChef.Filesystems/Acorn.cs index 46873795a..7a571356c 100644 --- a/DiscImageChef.Filesystems/Acorn.cs +++ b/DiscImageChef.Filesystems/Acorn.cs @@ -78,9 +78,9 @@ namespace DiscImageChef.Filesystems const uint OLD_DIR_MAGIC = 0x6F677548; public FileSystemType XmlFsType { get; private set; } - public string Name => "Acorn Advanced Disc Filing System"; - public Guid Id => new Guid("BAFC1E50-9C64-4CD3-8400-80628CC27AFA"); - public Encoding Encoding { get; private set; } + public string Name => "Acorn Advanced Disc Filing System"; + public Guid Id => new Guid("BAFC1E50-9C64-4CD3-8400-80628CC27AFA"); + public Encoding Encoding { get; private set; } // TODO: BBC Master hard disks are untested... public bool Identify(IMediaImage imagePlugin, Partition partition) @@ -88,11 +88,11 @@ namespace DiscImageChef.Filesystems if(partition.Start >= partition.End) return false; ulong sbSector; - uint sectorsToRead; + uint sectorsToRead; if(imagePlugin.Info.SectorSize < 256) return false; - byte[] sector; + byte[] sector; GCHandle ptr; // ADFS-S, ADFS-M, ADFS-L, ADFS-D without partitions @@ -111,7 +111,7 @@ namespace DiscImageChef.Filesystems (OldMapSector1)Marshal.PtrToStructure(ptr.AddrOfPinnedObject(), typeof(OldMapSector1)); DicConsole.DebugWriteLine("ADFS Plugin", "oldMap0.checksum = {0}", oldMap0.checksum); - DicConsole.DebugWriteLine("ADFS Plugin", "oldChk0 = {0}", oldChk0); + DicConsole.DebugWriteLine("ADFS Plugin", "oldChk0 = {0}", oldChk0); // According to documentation map1 MUST start on sector 1. On ADFS-D it starts at 0x100, not on sector 1 (0x400) if(oldMap0.checksum == oldChk0 && oldMap1.checksum != oldChk1 && sector.Length >= 512) @@ -120,28 +120,29 @@ namespace DiscImageChef.Filesystems byte[] tmp = new byte[256]; Array.Copy(sector, 256, tmp, 0, 256); oldChk1 = AcornMapChecksum(tmp, 255); - ptr = GCHandle.Alloc(tmp, GCHandleType.Pinned); + ptr = GCHandle.Alloc(tmp, GCHandleType.Pinned); oldMap1 = (OldMapSector1)Marshal.PtrToStructure(ptr.AddrOfPinnedObject(), typeof(OldMapSector1)); } DicConsole.DebugWriteLine("ADFS Plugin", "oldMap1.checksum = {0}", oldMap1.checksum); - DicConsole.DebugWriteLine("ADFS Plugin", "oldChk1 = {0}", oldChk1); + DicConsole.DebugWriteLine("ADFS Plugin", "oldChk1 = {0}", oldChk1); if(oldMap0.checksum == oldChk0 && oldMap1.checksum == oldChk1 && oldMap0.checksum != 0 && oldMap1.checksum != 0) { - sbSector = OLD_DIRECTORY_LOCATION / imagePlugin.Info.SectorSize; - sectorsToRead = OLD_DIRECTORY_SIZE / imagePlugin.Info.SectorSize; - if(OLD_DIRECTORY_SIZE % imagePlugin.Info.SectorSize > 0) sectorsToRead++; + sbSector = OLD_DIRECTORY_LOCATION / imagePlugin.Info.SectorSize; + sectorsToRead = OLD_DIRECTORY_SIZE / imagePlugin.Info.SectorSize; + if(OLD_DIRECTORY_SIZE % imagePlugin.Info.SectorSize > 0) sectorsToRead++; sector = imagePlugin.ReadSectors(sbSector, sectorsToRead); if(sector.Length > OLD_DIRECTORY_SIZE) { byte[] tmp = new byte[OLD_DIRECTORY_SIZE]; Array.Copy(sector, 0, tmp, 0, OLD_DIRECTORY_SIZE - 53); - Array.Copy(sector, sector.Length - 54, tmp, OLD_DIRECTORY_SIZE - 54, 53); + Array.Copy(sector, sector.Length - 54, tmp, OLD_DIRECTORY_SIZE - 54, 53); sector = tmp; } + ptr = GCHandle.Alloc(sector, GCHandleType.Pinned); OldDirectory oldRoot = (OldDirectory)Marshal.PtrToStructure(ptr.AddrOfPinnedObject(), typeof(OldDirectory)); @@ -158,21 +159,22 @@ namespace DiscImageChef.Filesystems oldRoot.header.magic == NEW_DIR_MAGIC && oldRoot.tail.magic == NEW_DIR_MAGIC) 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 = NEW_DIRECTORY_LOCATION / imagePlugin.Info.SectorSize; - sectorsToRead = NEW_DIRECTORY_SIZE / imagePlugin.Info.SectorSize; - if(NEW_DIRECTORY_SIZE % imagePlugin.Info.SectorSize > 0) sectorsToRead++; + sbSector = NEW_DIRECTORY_LOCATION / imagePlugin.Info.SectorSize; + sectorsToRead = NEW_DIRECTORY_SIZE / imagePlugin.Info.SectorSize; + if(NEW_DIRECTORY_SIZE % imagePlugin.Info.SectorSize > 0) sectorsToRead++; sector = imagePlugin.ReadSectors(sbSector, sectorsToRead); if(sector.Length > OLD_DIRECTORY_SIZE) { byte[] tmp = new byte[OLD_DIRECTORY_SIZE]; Array.Copy(sector, 0, tmp, 0, OLD_DIRECTORY_SIZE - 53); - Array.Copy(sector, sector.Length - 54, tmp, OLD_DIRECTORY_SIZE - 54, 53); + Array.Copy(sector, sector.Length - 54, tmp, OLD_DIRECTORY_SIZE - 54, 53); sector = tmp; } - ptr = GCHandle.Alloc(sector, GCHandleType.Pinned); + + ptr = GCHandle.Alloc(sector, GCHandleType.Pinned); oldRoot = (OldDirectory)Marshal.PtrToStructure(ptr.AddrOfPinnedObject(), typeof(OldDirectory)); - dirChk = AcornDirectoryChecksum(sector, (int)OLD_DIRECTORY_SIZE - 1); + dirChk = AcornDirectoryChecksum(sector, (int)OLD_DIRECTORY_SIZE - 1); DicConsole.DebugWriteLine("ADFS Plugin", "oldRoot.header.magic at 0x400 = {0}", oldRoot.header.magic); @@ -191,20 +193,20 @@ namespace DiscImageChef.Filesystems sector = imagePlugin.ReadSector(partition.Start); byte newChk = NewMapChecksum(sector); - DicConsole.DebugWriteLine("ADFS Plugin", "newChk = {0}", newChk); + DicConsole.DebugWriteLine("ADFS Plugin", "newChk = {0}", newChk); DicConsole.DebugWriteLine("ADFS Plugin", "map.zoneChecksum = {0}", sector[0]); - sbSector = BOOT_BLOCK_LOCATION / imagePlugin.Info.SectorSize; - sectorsToRead = BOOT_BLOCK_SIZE / imagePlugin.Info.SectorSize; - if(BOOT_BLOCK_SIZE % imagePlugin.Info.SectorSize > 0) sectorsToRead++; + sbSector = BOOT_BLOCK_LOCATION / imagePlugin.Info.SectorSize; + sectorsToRead = BOOT_BLOCK_SIZE / imagePlugin.Info.SectorSize; + if(BOOT_BLOCK_SIZE % imagePlugin.Info.SectorSize > 0) sectorsToRead++; if(sbSector + partition.Start + sectorsToRead >= partition.End) return false; - byte[] bootSector = imagePlugin.ReadSectors(sbSector + partition.Start, sectorsToRead); - int bootChk = 0; + 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]; - DicConsole.DebugWriteLine("ADFS Plugin", "bootChk = {0}", bootChk); + DicConsole.DebugWriteLine("ADFS Plugin", "bootChk = {0}", bootChk); DicConsole.DebugWriteLine("ADFS Plugin", "bBlock.checksum = {0}", bootSector[0x1FF]); if(newChk == sector[0] && newChk != 0) @@ -223,10 +225,10 @@ namespace DiscImageChef.Filesystems } 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.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", "drSb.disc_size = {0}", drSb.disc_size); DicConsole.DebugWriteLine("ADFS Plugin", "IsNullOrEmpty(drSb.reserved) = {0}", ArrayHelpers.ArrayIsNullOrEmpty(drSb.reserved)); @@ -249,18 +251,18 @@ namespace DiscImageChef.Filesystems // 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 void GetInformation(IMediaImage imagePlugin, Partition partition, out string information, - Encoding encoding) + Encoding encoding) { Encoding = encoding ?? Encoding.GetEncoding("iso-8859-1"); StringBuilder sbInformation = new StringBuilder(); - XmlFsType = new FileSystemType(); + XmlFsType = new FileSystemType(); information = ""; - ulong sbSector; - byte[] sector; - uint sectorsToRead; + ulong sbSector; + byte[] sector; + uint sectorsToRead; GCHandle ptr; - ulong bytes; + ulong bytes; // ADFS-S, ADFS-M, ADFS-L, ADFS-D without partitions if(partition.Start == 0) @@ -284,7 +286,7 @@ namespace DiscImageChef.Filesystems byte[] tmp = new byte[256]; Array.Copy(sector, 256, tmp, 0, 256); oldChk1 = AcornMapChecksum(tmp, 255); - ptr = GCHandle.Alloc(tmp, GCHandleType.Pinned); + ptr = GCHandle.Alloc(tmp, GCHandleType.Pinned); oldMap1 = (OldMapSector1)Marshal.PtrToStructure(ptr.AddrOfPinnedObject(), typeof(OldMapSector1)); } @@ -295,32 +297,33 @@ namespace DiscImageChef.Filesystems byte[] namebytes = new byte[10]; for(int i = 0; i < 5; i++) { - namebytes[i * 2] = oldMap0.name[i]; + namebytes[i * 2] = oldMap0.name[i]; namebytes[i * 2 + 1] = oldMap1.name[i]; } XmlFsType = new FileSystemType { - Bootable = oldMap1.boot != 0, // Or not? - Clusters = (long)(bytes / imagePlugin.Info.SectorSize), + Bootable = oldMap1.boot != 0, // Or not? + Clusters = (long)(bytes / imagePlugin.Info.SectorSize), ClusterSize = (int)imagePlugin.Info.SectorSize, - Type = "Acorn Advanced Disc Filing System" + Type = "Acorn Advanced Disc Filing System" }; if(ArrayHelpers.ArrayIsNullOrEmpty(namebytes)) { - sbSector = OLD_DIRECTORY_LOCATION / imagePlugin.Info.SectorSize; - sectorsToRead = OLD_DIRECTORY_SIZE / imagePlugin.Info.SectorSize; - if(OLD_DIRECTORY_SIZE % imagePlugin.Info.SectorSize > 0) sectorsToRead++; + sbSector = OLD_DIRECTORY_LOCATION / imagePlugin.Info.SectorSize; + sectorsToRead = OLD_DIRECTORY_SIZE / imagePlugin.Info.SectorSize; + if(OLD_DIRECTORY_SIZE % imagePlugin.Info.SectorSize > 0) sectorsToRead++; sector = imagePlugin.ReadSectors(sbSector, sectorsToRead); if(sector.Length > OLD_DIRECTORY_SIZE) { byte[] tmp = new byte[OLD_DIRECTORY_SIZE]; Array.Copy(sector, 0, tmp, 0, OLD_DIRECTORY_SIZE - 53); - Array.Copy(sector, sector.Length - 54, tmp, OLD_DIRECTORY_SIZE - 54, 53); + Array.Copy(sector, sector.Length - 54, tmp, OLD_DIRECTORY_SIZE - 54, 53); sector = tmp; } + ptr = GCHandle.Alloc(sector, GCHandleType.Pinned); OldDirectory oldRoot = (OldDirectory)Marshal.PtrToStructure(ptr.AddrOfPinnedObject(), typeof(OldDirectory)); @@ -330,18 +333,20 @@ namespace DiscImageChef.Filesystems else { // RISC OS says the old directory can't be in the new location, hard disks created by RISC OS 3.10 do that... - sbSector = NEW_DIRECTORY_LOCATION / imagePlugin.Info.SectorSize; - sectorsToRead = NEW_DIRECTORY_SIZE / imagePlugin.Info.SectorSize; - if(NEW_DIRECTORY_SIZE % imagePlugin.Info.SectorSize > 0) sectorsToRead++; + sbSector = NEW_DIRECTORY_LOCATION / imagePlugin.Info.SectorSize; + sectorsToRead = NEW_DIRECTORY_SIZE / imagePlugin.Info.SectorSize; + if(NEW_DIRECTORY_SIZE % imagePlugin.Info.SectorSize > 0) sectorsToRead++; sector = imagePlugin.ReadSectors(sbSector, sectorsToRead); if(sector.Length > OLD_DIRECTORY_SIZE) { byte[] tmp = new byte[OLD_DIRECTORY_SIZE]; Array.Copy(sector, 0, tmp, 0, OLD_DIRECTORY_SIZE - 53); - Array.Copy(sector, sector.Length - 54, tmp, OLD_DIRECTORY_SIZE - 54, 53); + Array.Copy(sector, sector.Length - 54, tmp, OLD_DIRECTORY_SIZE - 54, + 53); sector = tmp; } + ptr = GCHandle.Alloc(sector, GCHandleType.Pinned); oldRoot = (OldDirectory)Marshal.PtrToStructure(ptr.AddrOfPinnedObject(), typeof(OldDirectory)); @@ -355,9 +360,11 @@ namespace DiscImageChef.Filesystems { byte[] tmp = new byte[NEW_DIRECTORY_SIZE]; Array.Copy(sector, 0, tmp, 0, NEW_DIRECTORY_SIZE - 41); - Array.Copy(sector, sector.Length - 42, tmp, NEW_DIRECTORY_SIZE - 42, 41); + Array.Copy(sector, sector.Length - 42, tmp, NEW_DIRECTORY_SIZE - 42, + 41); sector = tmp; } + ptr = GCHandle.Alloc(sector, GCHandleType.Pinned); NewDirectory newRoot = (NewDirectory)Marshal.PtrToStructure(ptr.AddrOfPinnedObject(), @@ -379,6 +386,7 @@ namespace DiscImageChef.Filesystems XmlFsType.VolumeSerial = $"{oldMap1.discId:X4}"; sbInformation.AppendFormat("Volume ID: {0:X4}", oldMap1.discId).AppendLine(); } + if(!ArrayHelpers.ArrayIsNullOrEmpty(namebytes)) XmlFsType.VolumeName = StringHandlers.CToString(namebytes, Encoding); @@ -393,18 +401,18 @@ namespace DiscImageChef.Filesystems sector = imagePlugin.ReadSector(partition.Start); byte newChk = NewMapChecksum(sector); - DicConsole.DebugWriteLine("ADFS Plugin", "newChk = {0}", newChk); + DicConsole.DebugWriteLine("ADFS Plugin", "newChk = {0}", newChk); DicConsole.DebugWriteLine("ADFS Plugin", "map.zoneChecksum = {0}", sector[0]); - sbSector = BOOT_BLOCK_LOCATION / imagePlugin.Info.SectorSize; - sectorsToRead = BOOT_BLOCK_SIZE / imagePlugin.Info.SectorSize; - if(BOOT_BLOCK_SIZE % imagePlugin.Info.SectorSize > 0) sectorsToRead++; + sbSector = BOOT_BLOCK_LOCATION / imagePlugin.Info.SectorSize; + sectorsToRead = BOOT_BLOCK_SIZE / imagePlugin.Info.SectorSize; + if(BOOT_BLOCK_SIZE % imagePlugin.Info.SectorSize > 0) sectorsToRead++; - byte[] bootSector = imagePlugin.ReadSectors(sbSector + partition.Start, sectorsToRead); - int bootChk = 0; + 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]; - DicConsole.DebugWriteLine("ADFS Plugin", "bootChk = {0}", bootChk); + DicConsole.DebugWriteLine("ADFS Plugin", "bootChk = {0}", bootChk); DicConsole.DebugWriteLine("ADFS Plugin", "bBlock.checksum = {0}", bootSector[0x1FF]); if(newChk == sector[0] && newChk != 0) @@ -424,27 +432,27 @@ namespace DiscImageChef.Filesystems else return; DicConsole.DebugWriteLine("ADFS Plugin", "drSb.log2secsize = {0}", drSb.log2secsize); - DicConsole.DebugWriteLine("ADFS Plugin", "drSb.spt = {0}", drSb.spt); - DicConsole.DebugWriteLine("ADFS Plugin", "drSb.heads = {0}", drSb.heads); - DicConsole.DebugWriteLine("ADFS Plugin", "drSb.density = {0}", drSb.density); - DicConsole.DebugWriteLine("ADFS Plugin", "drSb.idlen = {0}", drSb.idlen); - DicConsole.DebugWriteLine("ADFS Plugin", "drSb.log2bpmb = {0}", drSb.log2bpmb); - DicConsole.DebugWriteLine("ADFS Plugin", "drSb.skew = {0}", drSb.skew); - DicConsole.DebugWriteLine("ADFS Plugin", "drSb.bootoption = {0}", drSb.bootoption); - DicConsole.DebugWriteLine("ADFS Plugin", "drSb.lowsector = {0}", drSb.lowsector); - DicConsole.DebugWriteLine("ADFS Plugin", "drSb.nzones = {0}", drSb.nzones); - DicConsole.DebugWriteLine("ADFS Plugin", "drSb.zone_spare = {0}", drSb.zone_spare); - 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.spt = {0}", drSb.spt); + DicConsole.DebugWriteLine("ADFS Plugin", "drSb.heads = {0}", drSb.heads); + DicConsole.DebugWriteLine("ADFS Plugin", "drSb.density = {0}", drSb.density); + DicConsole.DebugWriteLine("ADFS Plugin", "drSb.idlen = {0}", drSb.idlen); + DicConsole.DebugWriteLine("ADFS Plugin", "drSb.log2bpmb = {0}", drSb.log2bpmb); + DicConsole.DebugWriteLine("ADFS Plugin", "drSb.skew = {0}", drSb.skew); + DicConsole.DebugWriteLine("ADFS Plugin", "drSb.bootoption = {0}", drSb.bootoption); + DicConsole.DebugWriteLine("ADFS Plugin", "drSb.lowsector = {0}", drSb.lowsector); + DicConsole.DebugWriteLine("ADFS Plugin", "drSb.nzones = {0}", drSb.nzones); + DicConsole.DebugWriteLine("ADFS Plugin", "drSb.zone_spare = {0}", drSb.zone_spare); + 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, Encoding)); - DicConsole.DebugWriteLine("ADFS Plugin", "drSb.disc_type = {0}", drSb.disc_type); + 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); - DicConsole.DebugWriteLine("ADFS Plugin", "drSb.nzones_high = {0}", drSb.nzones_high); + DicConsole.DebugWriteLine("ADFS Plugin", "drSb.flags = {0}", drSb.flags); + DicConsole.DebugWriteLine("ADFS Plugin", "drSb.nzones_high = {0}", drSb.nzones_high); DicConsole.DebugWriteLine("ADFS Plugin", "drSb.format_version = {0}", drSb.format_version); - DicConsole.DebugWriteLine("ADFS Plugin", "drSb.root_size = {0}", drSb.root_size); + DicConsole.DebugWriteLine("ADFS Plugin", "drSb.root_size = {0}", drSb.root_size); if(drSb.log2secsize < 8 || drSb.log2secsize > 10) return; @@ -454,7 +462,7 @@ namespace DiscImageChef.Filesystems if(!ArrayHelpers.ArrayIsNullOrEmpty(drSb.reserved)) return; - bytes = drSb.disc_size_high; + bytes = drSb.disc_size_high; bytes *= 0x100000000; bytes += drSb.disc_size; @@ -485,6 +493,7 @@ namespace DiscImageChef.Filesystems XmlFsType.VolumeSerial = $"{drSb.disc_id:X4}"; sbInformation.AppendFormat("Volume ID: {0:X4}", drSb.disc_id).AppendLine(); } + if(!ArrayHelpers.ArrayIsNullOrEmpty(drSb.disc_name)) { string discname = StringHandlers.CToString(drSb.disc_name, Encoding); @@ -494,15 +503,15 @@ namespace DiscImageChef.Filesystems information = sbInformation.ToString(); - XmlFsType.Bootable |= drSb.bootoption != 0; // Or not? - XmlFsType.Clusters = (long)(bytes / (ulong)(1 << drSb.log2secsize)); - XmlFsType.ClusterSize = 1 << drSb.log2secsize; - XmlFsType.Type = "Acorn Advanced Disc Filing System"; + XmlFsType.Bootable |= drSb.bootoption != 0; // Or not? + XmlFsType.Clusters = (long)(bytes / (ulong)(1 << drSb.log2secsize)); + XmlFsType.ClusterSize = 1 << drSb.log2secsize; + XmlFsType.Type = "Acorn Advanced Disc Filing System"; } byte AcornMapChecksum(byte[] data, int length) { - int sum = 0; + int sum = 0; int carry = 0; if(length > data.Length) length = data.Length; @@ -515,8 +524,8 @@ namespace DiscImageChef.Filesystems sum += data[i] + carry; if(sum > 0xFF) { - carry = 1; - sum &= 0xFF; + carry = 1; + sum &= 0xFF; } else carry = 0; } @@ -567,8 +576,8 @@ namespace DiscImageChef.Filesystems { uint carry = sum & 0x1FFF; sum >>= 13; - sum ^= data[i]; - sum += carry << 19; + sum ^= data[i]; + sum += carry << 19; } return (byte)(((sum & 0xFF000000) >> 24) ^ ((sum & 0xFF0000) >> 16) ^ ((sum & 0xFF00) >> 8) ^ (sum & 0xFF)); @@ -580,11 +589,12 @@ 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; - public byte checksum; + public byte flags; + public ushort startCylinder; + public byte checksum; } /// @@ -593,28 +603,30 @@ namespace DiscImageChef.Filesystems [StructLayout(LayoutKind.Sequential, Pack = 1)] struct DiscRecord { - public byte log2secsize; - public byte spt; - public byte heads; - public byte density; - public byte idlen; - public byte log2bpmb; - public byte skew; - public byte bootoption; - public byte lowsector; - public byte nzones; + public byte log2secsize; + public byte spt; + public byte heads; + public byte density; + public byte idlen; + public byte log2bpmb; + public byte skew; + public byte bootoption; + public byte lowsector; + public byte nzones; public ushort zone_spare; - public uint root; - public uint disc_size; + 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; } /// @@ -623,10 +635,13 @@ 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; } @@ -636,12 +651,14 @@ 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; - public byte checksum; + public byte boot; + public byte freeEnd; + public byte checksum; } /// @@ -650,9 +667,9 @@ namespace DiscImageChef.Filesystems [StructLayout(LayoutKind.Sequential, Pack = 1)] struct NewMap { - public byte zoneChecksum; - public ushort freeLink; - public byte crossChecksum; + public byte zoneChecksum; + public ushort freeLink; + public byte crossChecksum; public DiscRecord discRecord; } @@ -672,11 +689,13 @@ 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; } @@ -686,11 +705,14 @@ namespace DiscImageChef.Filesystems [StructLayout(LayoutKind.Sequential, Pack = 1)] struct NewDirectoryTail { - public byte lastMark; + 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; @@ -703,10 +725,14 @@ 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; @@ -719,7 +745,8 @@ 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; } @@ -730,7 +757,8 @@ 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; } } diff --git a/DiscImageChef.Filesystems/AmigaDOS.cs b/DiscImageChef.Filesystems/AmigaDOS.cs index c65fe0a8e..5d81276f7 100644 --- a/DiscImageChef.Filesystems/AmigaDOS.cs +++ b/DiscImageChef.Filesystems/AmigaDOS.cs @@ -83,7 +83,7 @@ namespace DiscImageChef.Filesystems // Clear checksum on sector sector[4] = sector[5] = sector[6] = sector[7] = 0; - uint bsum = AmigaBootChecksum(sector); + uint bsum = AmigaBootChecksum(sector); DicConsole.DebugWriteLine("AmigaDOS plugin", "bblk.checksum = 0x{0:X8}", bblk.checksum); DicConsole.DebugWriteLine("AmigaDOS plugin", "bsum = 0x{0:X8}", bsum); @@ -99,10 +99,11 @@ namespace DiscImageChef.Filesystems ulong[] rootPtrs = { - bRootPtr + 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 + bRootPtr + 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(); @@ -123,7 +124,7 @@ namespace DiscImageChef.Filesystems DicConsole.DebugWriteLine("AmigaDOS plugin", "rblk.hashTableSize = {0}", rblk.hashTableSize); uint blockSize = (rblk.hashTableSize + 56) * 4; - uint sectorsPerBlock = (uint)(blockSize / sector.Length); + uint sectorsPerBlock = (uint)(blockSize / sector.Length); DicConsole.DebugWriteLine("AmigaDOS plugin", "blockSize = {0}", blockSize); DicConsole.DebugWriteLine("AmigaDOS plugin", "sectorsPerBlock = {0}", sectorsPerBlock); @@ -137,7 +138,7 @@ namespace DiscImageChef.Filesystems // Clear checksum on sector rblk.checksum = BigEndianBitConverter.ToUInt32(sector, 20); sector[20] = sector[21] = sector[22] = sector[23] = 0; - uint rsum = AmigaChecksum(sector); + uint rsum = AmigaChecksum(sector); DicConsole.DebugWriteLine("AmigaDOS plugin", "rblk.checksum = 0x{0:X8}", rblk.checksum); DicConsole.DebugWriteLine("AmigaDOS plugin", "rsum = 0x{0:X8}", rsum); @@ -154,8 +155,8 @@ namespace DiscImageChef.Filesystems public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information, Encoding encoding) { - Encoding = encoding ?? Encoding.GetEncoding("iso-8859-1"); - StringBuilder sbInformation = new StringBuilder(); + Encoding = encoding ?? Encoding.GetEncoding("iso-8859-1"); + StringBuilder sbInformation = new StringBuilder(); XmlFsType = new FileSystemType(); information = null; BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian; @@ -163,10 +164,10 @@ namespace DiscImageChef.Filesystems byte[] bootBlockSectors = imagePlugin.ReadSectors(0 + partition.Start, 2); BootBlock bootBlk = BigEndianMarshal.ByteArrayToStructureBigEndian(bootBlockSectors); - bootBlk.bootCode = new byte[bootBlockSectors.Length - 12]; + bootBlk.bootCode = new byte[bootBlockSectors.Length - 12]; Array.Copy(bootBlockSectors, 12, bootBlk.bootCode, 0, bootBlk.bootCode.Length); bootBlockSectors[4] = bootBlockSectors[5] = bootBlockSectors[6] = bootBlockSectors[7] = 0; - uint bsum = AmigaBootChecksum(bootBlockSectors); + uint bsum = AmigaBootChecksum(bootBlockSectors); ulong bRootPtr = 0; @@ -179,10 +180,11 @@ namespace DiscImageChef.Filesystems ulong[] rootPtrs = { - bRootPtr + 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 + bRootPtr + 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(); @@ -206,8 +208,8 @@ namespace DiscImageChef.Filesystems DicConsole.DebugWriteLine("AmigaDOS plugin", "rootBlk.hashTableSize = {0}", rootBlk.hashTableSize); - blockSize = (rootBlk.hashTableSize + 56) * 4; - uint sectorsPerBlock = (uint)(blockSize / rootBlockSector.Length); + blockSize = (rootBlk.hashTableSize + 56) * 4; + uint sectorsPerBlock = (uint)(blockSize / rootBlockSector.Length); DicConsole.DebugWriteLine("AmigaDOS plugin", "blockSize = {0}", blockSize); DicConsole.DebugWriteLine("AmigaDOS plugin", "sectorsPerBlock = {0}", sectorsPerBlock); @@ -221,7 +223,7 @@ namespace DiscImageChef.Filesystems // Clear checksum on sector rootBlk.checksum = BigEndianBitConverter.ToUInt32(rootBlockSector, 20); rootBlockSector[20] = rootBlockSector[21] = rootBlockSector[22] = rootBlockSector[23] = 0; - uint rsum = AmigaChecksum(rootBlockSector); + uint rsum = AmigaChecksum(rootBlockSector); DicConsole.DebugWriteLine("AmigaDOS plugin", "rootBlk.checksum = 0x{0:X8}", rootBlk.checksum); DicConsole.DebugWriteLine("AmigaDOS plugin", "rsum = 0x{0:X8}", rsum); @@ -303,7 +305,7 @@ namespace DiscImageChef.Filesystems long blocks = (long)((partition.End - partition.Start + 1) * imagePlugin.Info.SectorSize / blockSize); sbInformation.AppendFormat("Volume block size is {0} bytes", blockSize).AppendLine(); - sbInformation.AppendFormat("Volume has {0} blocks", blocks).AppendLine(); + sbInformation.AppendFormat("Volume has {0} blocks", blocks).AppendLine(); sbInformation.AppendFormat("Volume created on {0}", DateHandlers.AmigaToDateTime(rootBlk.cDays, rootBlk.cMins, rootBlk.cTicks)) .AppendLine(); @@ -319,7 +321,7 @@ namespace DiscImageChef.Filesystems XmlFsType.CreationDate = DateHandlers.AmigaToDateTime(rootBlk.cDays, rootBlk.cMins, rootBlk.cTicks); XmlFsType.CreationDateSpecified = true; - XmlFsType.ModificationDate = + XmlFsType.ModificationDate = DateHandlers.AmigaToDateTime(rootBlk.vDays, rootBlk.vMins, rootBlk.vTicks); XmlFsType.ModificationDateSpecified = true; XmlFsType.Dirty = rootBlk.bitmapFlag != 0xFFFFFFFF; @@ -336,7 +338,7 @@ namespace DiscImageChef.Filesystems byte[] tmp = new byte[228]; Array.Copy(block, 0, tmp, 0, 24); Array.Copy(block, block.Length - 200, tmp, 28, 200); - RootBlock root = BigEndianMarshal.ByteArrayToStructureBigEndian(tmp); + RootBlock root = BigEndianMarshal.ByteArrayToStructureBigEndian(tmp); root.hashTable = new uint[(block.Length - 224) / 4]; BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian; for(int i = 0; i < root.hashTable.Length; i++) diff --git a/DiscImageChef.Filesystems/AppleDOS/AppleDOS.cs b/DiscImageChef.Filesystems/AppleDOS/AppleDOS.cs index c6ed8697d..398302074 100644 --- a/DiscImageChef.Filesystems/AppleDOS/AppleDOS.cs +++ b/DiscImageChef.Filesystems/AppleDOS/AppleDOS.cs @@ -58,7 +58,7 @@ namespace DiscImageChef.Filesystems.AppleDOS public Guid Id => new Guid("8658A1E9-B2E7-4BCC-9638-157A31B0A700\n"); public IEnumerable<(string name, Type type, string description)> SupportedOptions => - new(string name, Type type, string description)[] { }; + new (string name, Type type, string description)[] { }; static Dictionary GetDefaultOptions() { diff --git a/DiscImageChef.Filesystems/AppleDOS/Dir.cs b/DiscImageChef.Filesystems/AppleDOS/Dir.cs index 1eaacc6fb..af9b641f0 100644 --- a/DiscImageChef.Filesystems/AppleDOS/Dir.cs +++ b/DiscImageChef.Filesystems/AppleDOS/Dir.cs @@ -80,12 +80,12 @@ namespace DiscImageChef.Filesystems.AppleDOS Errno ReadCatalog() { MemoryStream catalogMs = new MemoryStream(); - ulong lba = (ulong)(vtoc.catalogTrack * sectorsPerTrack + vtoc.catalogSector); + ulong lba = (ulong)(vtoc.catalogTrack * sectorsPerTrack + vtoc.catalogSector); totalFileEntries = 0; - catalogCache = new Dictionary(); - fileTypeCache = new Dictionary(); - fileSizeCache = new Dictionary(); - lockedFiles = new List(); + catalogCache = new Dictionary(); + fileTypeCache = new Dictionary(); + fileSizeCache = new Dictionary(); + lockedFiles = new List(); if(lba == 0 || lba > device.Info.Sectors) return Errno.InvalidArgument; @@ -108,7 +108,7 @@ namespace DiscImageChef.Filesystems.AppleDOS track2UsedByFiles |= entry.extentTrack == 2; byte[] filenameB = new byte[30]; - ushort ts = (ushort)((entry.extentTrack << 8) | entry.extentSector); + ushort ts = (ushort)((entry.extentTrack << 8) | entry.extentSector); // Apple DOS has high byte set over ASCII. for(int i = 0; i < 30; i++) filenameB[i] = (byte)(entry.filename[i] & 0x7F); diff --git a/DiscImageChef.Filesystems/AppleDOS/File.cs b/DiscImageChef.Filesystems/AppleDOS/File.cs index f36a6d34d..cb7b15bf5 100644 --- a/DiscImageChef.Filesystems/AppleDOS/File.cs +++ b/DiscImageChef.Filesystems/AppleDOS/File.cs @@ -52,11 +52,11 @@ namespace DiscImageChef.Filesystems.AppleDOS if(!fileCache.ContainsKey(filename)) return Errno.NoSuchFile; - attributes = FileAttributes.Extents; + attributes = FileAttributes.Extents; attributes |= FileAttributes.File; if(lockedFiles.Contains(filename)) attributes |= FileAttributes.ReadOnly; - if(debug && (string.Compare(path, "$", 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; @@ -75,12 +75,13 @@ namespace DiscImageChef.Filesystems.AppleDOS string filename = pathElements[0].ToUpperInvariant(); if(filename.Length > 30) return Errno.NameTooLong; - if(debug && (string.Compare(path, "$", 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, "$", StringComparison.InvariantCulture) == 0) + file = catalogBlocks; else if(string.Compare(path, "$Vtoc", StringComparison.InvariantCulture) == 0) file = vtocBlocks; - else file = bootBlocks; + else file = bootBlocks; else { if(!fileCache.TryGetValue(filename, out file)) @@ -121,7 +122,7 @@ namespace DiscImageChef.Filesystems.AppleDOS fileSizeCache.TryGetValue(filename, out int filesize); GetAttributes(path, out FileAttributes attrs); - if(debug && (string.Compare(path, "$", 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)) { @@ -141,8 +142,8 @@ namespace DiscImageChef.Filesystems.AppleDOS } stat.Attributes = attrs; - stat.BlockSize = vtoc.bytesPerSector; - stat.Links = 1; + stat.BlockSize = vtoc.bytesPerSector; + stat.Links = 1; return Errno.NoError; } @@ -164,10 +165,10 @@ namespace DiscImageChef.Filesystems.AppleDOS if(!catalogCache.TryGetValue(filename, out ushort ts)) return Errno.NoSuchFile; - ulong lba = (ulong)(((ts & 0xFF00) >> 8) * sectorsPerTrack + (ts & 0xFF)); - MemoryStream fileMs = new MemoryStream(); - MemoryStream tsListMs = new MemoryStream(); - ushort expectedBlock = 0; + ulong lba = (ulong)(((ts & 0xFF00) >> 8) * sectorsPerTrack + (ts & 0xFF)); + MemoryStream fileMs = new MemoryStream(); + MemoryStream tsListMs = new MemoryStream(); + ushort expectedBlock = 0; while(lba != 0) { @@ -216,7 +217,7 @@ namespace DiscImageChef.Filesystems.AppleDOS Errno CacheAllFiles() { - fileCache = new Dictionary(); + fileCache = new Dictionary(); extentCache = new Dictionary(); foreach(Errno error in catalogCache.Keys.Select(CacheFile).Where(error => error != Errno.NoError)) @@ -226,7 +227,7 @@ namespace DiscImageChef.Filesystems.AppleDOS if(!track1UsedByFiles) tracksOnBoot++; if(!track2UsedByFiles) tracksOnBoot++; - bootBlocks = device.ReadSectors(0, (uint)(tracksOnBoot * sectorsPerTrack)); + bootBlocks = device.ReadSectors(0, (uint)(tracksOnBoot * sectorsPerTrack)); usedSectors += bootBlocks.Length / vtoc.bytesPerSector; return Errno.NoError; diff --git a/DiscImageChef.Filesystems/AppleDOS/Info.cs b/DiscImageChef.Filesystems/AppleDOS/Info.cs index a1212065c..072a09c4b 100644 --- a/DiscImageChef.Filesystems/AppleDOS/Info.cs +++ b/DiscImageChef.Filesystems/AppleDOS/Info.cs @@ -58,14 +58,14 @@ 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 void GetInformation(IMediaImage imagePlugin, Partition partition, out string information, - Encoding encoding) + Encoding encoding) { - Encoding = encoding ?? new Apple2(); + Encoding = encoding ?? new Apple2(); information = ""; StringBuilder sb = new StringBuilder(); @@ -96,10 +96,10 @@ namespace DiscImageChef.Filesystems.AppleDOS XmlFsType = new FileSystemType { - Bootable = true, - Clusters = (long)imagePlugin.Info.Sectors, + Bootable = true, + Clusters = (long)imagePlugin.Info.Sectors, ClusterSize = (int)imagePlugin.Info.SectorSize, - Type = "Apple DOS" + Type = "Apple DOS" }; } } diff --git a/DiscImageChef.Filesystems/AppleDOS/Structs.cs b/DiscImageChef.Filesystems/AppleDOS/Structs.cs index 77a51bb4f..6ede4fbfc 100644 --- a/DiscImageChef.Filesystems/AppleDOS/Structs.cs +++ b/DiscImageChef.Filesystems/AppleDOS/Structs.cs @@ -43,18 +43,23 @@ 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; - public byte lastAllocatedSector; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] + public byte[] unused4; + public byte lastAllocatedSector; public sbyte allocationDirection; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)] public byte[] unused5; - public byte tracks; - public byte sectorsPerTrack; + [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)] @@ -63,8 +68,10 @@ 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)] @@ -73,7 +80,8 @@ 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; } @@ -83,10 +91,13 @@ 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)] diff --git a/DiscImageChef.Filesystems/AppleDOS/Super.cs b/DiscImageChef.Filesystems/AppleDOS/Super.cs index 8a3712e0f..514d2e1f8 100644 --- a/DiscImageChef.Filesystems/AppleDOS/Super.cs +++ b/DiscImageChef.Filesystems/AppleDOS/Super.cs @@ -75,8 +75,8 @@ namespace DiscImageChef.Filesystems.AppleDOS sectorsPerTrack = device.Info.Sectors == 455 ? 13 : 16; // Read the VTOC - vtocBlocks = device.ReadSector((ulong)(17 * sectorsPerTrack)); - vtoc = new Vtoc(); + vtocBlocks = device.ReadSector((ulong)(17 * sectorsPerTrack)); + vtoc = new Vtoc(); IntPtr vtocPtr = Marshal.AllocHGlobal(256); Marshal.Copy(vtocBlocks, 0, vtocPtr, 256); vtoc = (Vtoc)Marshal.PtrToStructure(vtocPtr, typeof(Vtoc)); diff --git a/DiscImageChef.Filesystems/AppleDOS/Xattr.cs b/DiscImageChef.Filesystems/AppleDOS/Xattr.cs index e249761e9..524dfdd26 100644 --- a/DiscImageChef.Filesystems/AppleDOS/Xattr.cs +++ b/DiscImageChef.Filesystems/AppleDOS/Xattr.cs @@ -56,7 +56,7 @@ namespace DiscImageChef.Filesystems.AppleDOS xattrs = new List(); - if(debug && (string.Compare(path, "$", 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 @@ -88,7 +88,7 @@ namespace DiscImageChef.Filesystems.AppleDOS string filename = pathElements[0].ToUpperInvariant(); if(filename.Length > 30) return Errno.NameTooLong; - if(debug && (string.Compare(path, "$", 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; @@ -99,7 +99,7 @@ namespace DiscImageChef.Filesystems.AppleDOS { if(!fileTypeCache.TryGetValue(filename, out byte type)) return Errno.InvalidArgument; - buf = new byte[1]; + buf = new byte[1]; buf[0] = type; return Errno.NoError; } diff --git a/DiscImageChef.Filesystems/AppleHFS.cs b/DiscImageChef.Filesystems/AppleHFS.cs index 14ca58380..93c7f6e5c 100644 --- a/DiscImageChef.Filesystems/AppleHFS.cs +++ b/DiscImageChef.Filesystems/AppleHFS.cs @@ -57,9 +57,9 @@ namespace DiscImageChef.Filesystems const ushort HFSBB_MAGIC = 0x4C4B; public FileSystemType XmlFsType { get; private set; } - public Encoding Encoding { get; private set; } - public string Name => "Apple Hierarchical File System"; - public Guid Id => new Guid("36405F8D-0D26-6ECC-0BBB-1D5225FF404F"); + public Encoding Encoding { get; private set; } + public string Name => "Apple Hierarchical File System"; + public Guid Id => new Guid("36405F8D-0D26-6ECC-0BBB-1D5225FF404F"); public bool Identify(IMediaImage imagePlugin, Partition partition) { @@ -100,14 +100,14 @@ namespace DiscImageChef.Filesystems } public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information, - Encoding encoding) + Encoding encoding) { - Encoding = encoding ?? Encoding.GetEncoding("macintosh"); + Encoding = encoding ?? Encoding.GetEncoding("macintosh"); information = ""; StringBuilder sb = new StringBuilder(); - byte[] bbSector = null; + byte[] bbSector = null; byte[] mdbSector = null; ushort drSigWord; @@ -123,7 +123,7 @@ namespace DiscImageChef.Filesystems drSigWord = BigEndianBitConverter.ToUInt16(tmpSector, offset); if(drSigWord != HFS_MAGIC) continue; - bbSector = new byte[1024]; + bbSector = new byte[1024]; mdbSector = new byte[512]; if(offset >= 0x400) Array.Copy(tmpSector, offset - 0x400, bbSector, 0, 1024); Array.Copy(tmpSector, offset, mdbSector, 0, 512); @@ -162,9 +162,9 @@ namespace DiscImageChef.Filesystems if((mdb.drAtrb & 0x80) == 0x80) sb.AppendLine("Volume is locked by hardware."); sb.AppendLine((mdb.drAtrb & 0x100) == 0x100 ? "Volume was unmonted." : "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 & 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."); @@ -223,7 +223,7 @@ namespace DiscImageChef.Filesystems 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."); + 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, Encoding)) @@ -256,29 +256,32 @@ namespace DiscImageChef.Filesystems XmlFsType = new FileSystemType(); if(mdb.drVolBkUp > 0) { - XmlFsType.BackupDate = DateHandlers.MacToDateTime(mdb.drVolBkUp); + XmlFsType.BackupDate = DateHandlers.MacToDateTime(mdb.drVolBkUp); XmlFsType.BackupDateSpecified = true; } - XmlFsType.Bootable = bb.signature == HFSBB_MAGIC || mdb.drFndrInfo0 != 0 || mdb.drFndrInfo3 != 0 || + + XmlFsType.Bootable = bb.signature == HFSBB_MAGIC || mdb.drFndrInfo0 != 0 || mdb.drFndrInfo3 != 0 || mdb.drFndrInfo5 != 0; - XmlFsType.Clusters = mdb.drNmAlBlks; + XmlFsType.Clusters = mdb.drNmAlBlks; XmlFsType.ClusterSize = (int)mdb.drAlBlkSiz; if(mdb.drCrDate > 0) { - XmlFsType.CreationDate = DateHandlers.MacToDateTime(mdb.drCrDate); + XmlFsType.CreationDate = DateHandlers.MacToDateTime(mdb.drCrDate); XmlFsType.CreationDateSpecified = true; } - XmlFsType.Dirty = (mdb.drAtrb & 0x100) != 0x100; - XmlFsType.Files = mdb.drFilCnt; - XmlFsType.FilesSpecified = true; - XmlFsType.FreeClusters = mdb.drFreeBks; + + XmlFsType.Dirty = (mdb.drAtrb & 0x100) != 0x100; + XmlFsType.Files = mdb.drFilCnt; + XmlFsType.FilesSpecified = true; + XmlFsType.FreeClusters = mdb.drFreeBks; XmlFsType.FreeClustersSpecified = true; if(mdb.drLsMod > 0) { - XmlFsType.ModificationDate = DateHandlers.MacToDateTime(mdb.drLsMod); + XmlFsType.ModificationDate = DateHandlers.MacToDateTime(mdb.drLsMod); XmlFsType.ModificationDateSpecified = true; } - XmlFsType.Type = "HFS"; + + XmlFsType.Type = "HFS"; XmlFsType.VolumeName = StringHandlers.PascalToString(mdb.drVN, Encoding); if(mdb.drFndrInfo6 != 0 && mdb.drFndrInfo7 != 0) XmlFsType.VolumeSerial = $"{mdb.drFndrInfo6:X8}{mdb.drFndrInfo7:X8}"; @@ -286,8 +289,8 @@ namespace DiscImageChef.Filesystems static byte[] Read2048SectorAs512(IMediaImage imagePlugin, ulong lba) { - ulong lba2K = lba / 4; - int remainder = (int)(lba % 4); + ulong lba2K = lba / 4; + int remainder = (int)(lba % 4); byte[] buffer = imagePlugin.ReadSector(lba2K); byte[] sector = new byte[512]; @@ -330,7 +333,8 @@ namespace DiscImageChef.Filesystems /// 0x022, Free allocation blocks public ushort drFreeBks; /// 0x024, Volume name (28 bytes) - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 28)] public byte[] drVN; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 28)] + public byte[] drVN; /// 0x040, Volume last backup time public uint drVolBkUp; /// 0x044, Volume backup sequence number @@ -405,19 +409,26 @@ namespace DiscImageChef.Filesystems /// 0x006, Boot block flags public short boot_flags; /// 0x00A, System file name (16 bytes) - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] public byte[] system_name; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] + public byte[] system_name; /// 0x01A, Finder file name (16 bytes) - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] public byte[] finder_name; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] + public byte[] finder_name; /// 0x02A, Debugger file name (16 bytes) - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] public byte[] debug_name; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] + public byte[] debug_name; /// 0x03A, Disassembler file name (16 bytes) - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] public byte[] disasm_name; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] + public byte[] disasm_name; /// 0x04A, Startup screen file name (16 bytes) - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] public byte[] stupscr_name; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] + public byte[] stupscr_name; /// 0x05A, First program to execute on boot (16 bytes) - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] public byte[] bootup_name; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] + public byte[] bootup_name; /// 0x06A, Clipboard file name (16 bytes) - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] public byte[] clipbrd_name; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] + public byte[] clipbrd_name; /// 0x07A, 1/4 of maximum opened at a time files public ushort max_files; /// 0x07C, Event queue size diff --git a/DiscImageChef.Filesystems/AppleHFSPlus.cs b/DiscImageChef.Filesystems/AppleHFSPlus.cs index ae9b649c6..a73a4a005 100644 --- a/DiscImageChef.Filesystems/AppleHFSPlus.cs +++ b/DiscImageChef.Filesystems/AppleHFSPlus.cs @@ -56,9 +56,9 @@ namespace DiscImageChef.Filesystems const ushort HFSX_MAGIC = 0x4858; public FileSystemType XmlFsType { get; private set; } - public Encoding Encoding { get; private set; } - public string Name => "Apple HFS+ filesystem"; - public Guid Id => new Guid("36405F8D-0D26-6EBE-436F-62F0586B4F08"); + public Encoding Encoding { get; private set; } + public string Name => "Apple HFS+ filesystem"; + public Guid Id => new Guid("36405F8D-0D26-6EBE-436F-62F0586B4F08"); public bool Identify(IMediaImage imagePlugin, Partition partition) { @@ -98,15 +98,15 @@ namespace DiscImageChef.Filesystems } public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information, - Encoding encoding) + Encoding encoding) { - Encoding = Encoding.BigEndianUnicode; + Encoding = Encoding.BigEndianUnicode; information = ""; HfsPlusVolumeHeader vh = new HfsPlusVolumeHeader(); ulong hfspOffset; - bool wrapped; + bool wrapped; uint sectorsToRead = 0x800 / imagePlugin.Info.SectorSize; if(0x800 % imagePlugin.Info.SectorSize > 0) sectorsToRead++; @@ -128,24 +128,24 @@ namespace DiscImageChef.Filesystems ushort drAlBlSt = BigEndianBitConverter.ToUInt16(vhSector, 0x41C); hfspOffset = (ulong)((drAlBlSt * 512 + xdrStABNt * drAlBlkSiz) / imagePlugin.Info.SectorSize); - wrapped = true; + wrapped = true; } else { hfspOffset = 0; - wrapped = false; + wrapped = false; } } else { hfspOffset = 0; - wrapped = false; + wrapped = false; } vhSector = imagePlugin.ReadSectors(partition.Start + hfspOffset, sectorsToRead); // Read volume header vh.signature = BigEndianBitConverter.ToUInt16(vhSector, 0x400); - + if(vh.signature != HFSP_MAGIC && vh.signature != HFSX_MAGIC) return; StringBuilder sb = new StringBuilder(); @@ -178,15 +178,12 @@ namespace DiscImageChef.Filesystems if((vh.attributes & 0x2000) == 0x2000) sb.AppendFormat("Journal starts at allocation block {0}.", vh.journalInfoBlock).AppendLine(); sb.AppendFormat("Creation date: {0}", DateHandlers.MacToDateTime(vh.createDate)).AppendLine(); - sb.AppendFormat("Last modification date: {0}", DateHandlers.MacToDateTime(vh.modifyDate)) - .AppendLine(); + sb.AppendFormat("Last modification date: {0}", DateHandlers.MacToDateTime(vh.modifyDate)).AppendLine(); if(vh.backupDate > 0) - sb.AppendFormat("Last backup date: {0}", DateHandlers.MacToDateTime(vh.backupDate)) - .AppendLine(); + sb.AppendFormat("Last backup date: {0}", DateHandlers.MacToDateTime(vh.backupDate)).AppendLine(); else sb.AppendLine("Volume has never been backed up"); if(vh.backupDate > 0) - sb.AppendFormat("Last check date: {0}", DateHandlers.MacToDateTime(vh.checkedDate)) - .AppendLine(); + sb.AppendFormat("Last check date: {0}", DateHandlers.MacToDateTime(vh.checkedDate)).AppendLine(); else sb.AppendLine("Volume has never been checked up"); sb.AppendFormat("{0} files on volume.", vh.fileCount).AppendLine(); sb.AppendFormat("{0} folders on volume.", vh.folderCount).AppendLine(); @@ -210,8 +207,7 @@ namespace DiscImageChef.Filesystems sb.AppendFormat("CNID of bootable Mac OS 8 or 9 directory: {0}", vh.drFndrInfo3).AppendLine(); sb.AppendFormat("CNID of bootable Mac OS X directory: {0}", vh.drFndrInfo5).AppendLine(); if(vh.drFndrInfo6 != 0 && vh.drFndrInfo7 != 0) - sb.AppendFormat("Mac OS X Volume ID: {0:X8}{1:X8}", vh.drFndrInfo6, vh.drFndrInfo7) - .AppendLine(); + sb.AppendFormat("Mac OS X Volume ID: {0:X8}{1:X8}", vh.drFndrInfo6, vh.drFndrInfo7).AppendLine(); XmlFsType = new FileSystemType(); if(vh.backupDate > 0) @@ -219,6 +215,7 @@ namespace DiscImageChef.Filesystems XmlFsType.BackupDate = DateHandlers.MacToDateTime(vh.backupDate); XmlFsType.BackupDateSpecified = true; } + XmlFsType.Bootable |= vh.drFndrInfo0 != 0 || vh.drFndrInfo3 != 0 || vh.drFndrInfo5 != 0; XmlFsType.Clusters = vh.totalBlocks; XmlFsType.ClusterSize = (int)vh.blockSize; @@ -227,6 +224,7 @@ namespace DiscImageChef.Filesystems XmlFsType.CreationDate = DateHandlers.MacToDateTime(vh.createDate); XmlFsType.CreationDateSpecified = true; } + XmlFsType.Dirty = (vh.attributes & 0x100) != 0x100; XmlFsType.Files = vh.fileCount; XmlFsType.FilesSpecified = true; @@ -237,6 +235,7 @@ namespace DiscImageChef.Filesystems XmlFsType.ModificationDate = DateHandlers.MacToDateTime(vh.modifyDate); XmlFsType.ModificationDateSpecified = true; } + if(vh.signature == 0x482B) XmlFsType.Type = "HFS+"; if(vh.signature == 0x4858) XmlFsType.Type = "HFSX"; if(vh.drFndrInfo6 != 0 && vh.drFndrInfo7 != 0) @@ -272,7 +271,8 @@ namespace DiscImageChef.Filesystems /// "HFSJ" Journaled implementation /// "fsck" /sbin/fsck /// - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)] public byte[] lastMountedVersion; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)] + public byte[] lastMountedVersion; /// 0x00C, Allocation block number containing the journal public uint journalInfoBlock; /// 0x010, Date of volume creation diff --git a/DiscImageChef.Filesystems/AppleMFS/AppleMFS.cs b/DiscImageChef.Filesystems/AppleMFS/AppleMFS.cs index a631a819f..c484ab7e0 100644 --- a/DiscImageChef.Filesystems/AppleMFS/AppleMFS.cs +++ b/DiscImageChef.Filesystems/AppleMFS/AppleMFS.cs @@ -69,7 +69,7 @@ namespace DiscImageChef.Filesystems.AppleMFS // TODO: Implement Finder namespace (requires decoding Desktop database) public IEnumerable<(string name, Type type, string description)> SupportedOptions => - new(string name, Type type, string description)[] { }; + new (string name, Type type, string description)[] { }; static Dictionary GetDefaultOptions() { diff --git a/DiscImageChef.Filesystems/AppleMFS/Consts.cs b/DiscImageChef.Filesystems/AppleMFS/Consts.cs index 51bc79510..6316d3d16 100644 --- a/DiscImageChef.Filesystems/AppleMFS/Consts.cs +++ b/DiscImageChef.Filesystems/AppleMFS/Consts.cs @@ -39,13 +39,13 @@ namespace DiscImageChef.Filesystems.AppleMFS // "LK" const ushort MFSBB_MAGIC = 0x4C4B; - const short DIRID_TRASH = -3; - const short DIRID_DESKTOP = -2; + const short DIRID_TRASH = -3; + const short DIRID_DESKTOP = -2; const short DIRID_TEMPLATE = -1; - const short DIRID_ROOT = 0; + const short DIRID_ROOT = 0; const int BMAP_FREE = 0; const int BMAP_LAST = 1; - const int BMAP_DIR = 0xFFF; + 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 77cbc118f..f1def39db 100644 --- a/DiscImageChef.Filesystems/AppleMFS/Dir.cs +++ b/DiscImageChef.Filesystems/AppleMFS/Dir.cs @@ -65,7 +65,7 @@ namespace DiscImageChef.Filesystems.AppleMFS bool FillDirectory() { idToFilename = new Dictionary(); - idToEntry = new Dictionary(); + idToEntry = new Dictionary(); filenameToId = new Dictionary(); int offset = 0; @@ -74,29 +74,29 @@ namespace DiscImageChef.Filesystems.AppleMFS MFS_FileEntry entry = new MFS_FileEntry { flUsrWds = new byte[16], - flFlags = (MFS_FileFlags)directoryBlocks[offset + 0] + flFlags = (MFS_FileFlags)directoryBlocks[offset + 0] }; 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); - entry.flStBlk = BigEndianBitConverter.ToUInt16(directoryBlocks, offset + 22); - entry.flLgLen = BigEndianBitConverter.ToUInt32(directoryBlocks, offset + 24); - entry.flPyLen = BigEndianBitConverter.ToUInt32(directoryBlocks, offset + 28); + entry.flFlNum = BigEndianBitConverter.ToUInt32(directoryBlocks, offset + 18); + entry.flStBlk = BigEndianBitConverter.ToUInt16(directoryBlocks, offset + 22); + entry.flLgLen = BigEndianBitConverter.ToUInt32(directoryBlocks, offset + 24); + entry.flPyLen = BigEndianBitConverter.ToUInt32(directoryBlocks, offset + 28); entry.flRStBlk = BigEndianBitConverter.ToUInt16(directoryBlocks, offset + 32); entry.flRLgLen = BigEndianBitConverter.ToUInt32(directoryBlocks, offset + 34); entry.flRPyLen = BigEndianBitConverter.ToUInt32(directoryBlocks, offset + 38); - entry.flCrDat = BigEndianBitConverter.ToUInt32(directoryBlocks, offset + 42); - entry.flMdDat = BigEndianBitConverter.ToUInt32(directoryBlocks, offset + 46); - entry.flNam = new byte[directoryBlocks[offset + 50] + 1]; + entry.flCrDat = BigEndianBitConverter.ToUInt32(directoryBlocks, offset + 42); + 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); string lowerFilename = StringHandlers - .PascalToString(entry.flNam, Encoding).ToLowerInvariant().Replace('/', ':'); + .PascalToString(entry.flNam, Encoding).ToLowerInvariant().Replace('/', ':'); if(entry.flFlags.HasFlag(MFS_FileFlags.Used) && !idToFilename.ContainsKey(entry.flFlNum) && - !idToEntry.ContainsKey(entry.flFlNum) && !filenameToId.ContainsKey(lowerFilename) && + !idToEntry.ContainsKey(entry.flFlNum) && !filenameToId.ContainsKey(lowerFilename) && entry.flFlNum > 0) { idToEntry.Add(entry.flFlNum, entry); @@ -104,12 +104,12 @@ namespace DiscImageChef.Filesystems.AppleMFS StringHandlers.PascalToString(entry.flNam, Encoding).Replace('/', ':')); filenameToId.Add(lowerFilename, entry.flFlNum); - DicConsole.DebugWriteLine("DEBUG (AppleMFS plugin)", "entry.flFlags = {0}", entry.flFlags); - DicConsole.DebugWriteLine("DEBUG (AppleMFS plugin)", "entry.flTyp = {0}", entry.flTyp); - DicConsole.DebugWriteLine("DEBUG (AppleMFS plugin)", "entry.flFlNum = {0}", entry.flFlNum); - DicConsole.DebugWriteLine("DEBUG (AppleMFS plugin)", "entry.flStBlk = {0}", entry.flStBlk); - DicConsole.DebugWriteLine("DEBUG (AppleMFS plugin)", "entry.flLgLen = {0}", entry.flLgLen); - DicConsole.DebugWriteLine("DEBUG (AppleMFS plugin)", "entry.flPyLen = {0}", entry.flPyLen); + DicConsole.DebugWriteLine("DEBUG (AppleMFS plugin)", "entry.flFlags = {0}", entry.flFlags); + DicConsole.DebugWriteLine("DEBUG (AppleMFS plugin)", "entry.flTyp = {0}", entry.flTyp); + DicConsole.DebugWriteLine("DEBUG (AppleMFS plugin)", "entry.flFlNum = {0}", entry.flFlNum); + DicConsole.DebugWriteLine("DEBUG (AppleMFS plugin)", "entry.flStBlk = {0}", entry.flStBlk); + DicConsole.DebugWriteLine("DEBUG (AppleMFS plugin)", "entry.flLgLen = {0}", entry.flLgLen); + DicConsole.DebugWriteLine("DEBUG (AppleMFS plugin)", "entry.flPyLen = {0}", entry.flPyLen); 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); diff --git a/DiscImageChef.Filesystems/AppleMFS/File.cs b/DiscImageChef.Filesystems/AppleMFS/File.cs index f30d45cd4..cc82b6d2a 100644 --- a/DiscImageChef.Filesystems/AppleMFS/File.cs +++ b/DiscImageChef.Filesystems/AppleMFS/File.cs @@ -56,7 +56,7 @@ namespace DiscImageChef.Filesystems.AppleMFS if(fileBlock > entry.flPyLen / volMDB.drAlBlkSiz) return Errno.InvalidArgument; uint nextBlock = entry.flStBlk; - long relBlock = 0; + long relBlock = 0; while(true) { @@ -89,16 +89,16 @@ namespace DiscImageChef.Filesystems.AppleMFS 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.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.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; @@ -113,15 +113,18 @@ namespace DiscImageChef.Filesystems.AppleMFS if(!mounted) return Errno.AccessDenied; byte[] file; - Errno error = Errno.NoError; + 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; + 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; + file = blockMapBytes; else if(debug && string.Compare(path, "$MDB", StringComparison.InvariantCulture) == 0) file = mdbBlocks; - else error = ReadFile(path, out file, false, false); + else + error = + ReadFile(path, out file, false, false); if(error != Errno.NoError) return error; @@ -151,20 +154,20 @@ namespace DiscImageChef.Filesystems.AppleMFS if(pathElements.Length != 1) return Errno.NotSupported; if(debug) - if(string.Compare(path, "$", StringComparison.InvariantCulture) == 0 || - string.Compare(path, "$Boot", StringComparison.InvariantCulture) == 0 || + if(string.Compare(path, "$", StringComparison.InvariantCulture) == 0 || + string.Compare(path, "$Boot", StringComparison.InvariantCulture) == 0 || string.Compare(path, "$Bitmap", StringComparison.InvariantCulture) == 0 || - string.Compare(path, "$MDB", StringComparison.InvariantCulture) == 0) + string.Compare(path, "$MDB", StringComparison.InvariantCulture) == 0) { stat = new FileEntryInfo { - BlockSize = device.Info.SectorSize, - DeviceNo = 0, - GID = 0, - Inode = 0, - Links = 1, - Mode = 0x124, - UID = 0, + BlockSize = device.Info.SectorSize, + DeviceNo = 0, + GID = 0, + Inode = 0, + Links = 1, + Mode = 0x124, + UID = 0, Attributes = FileAttributes.System }; @@ -202,18 +205,18 @@ namespace DiscImageChef.Filesystems.AppleMFS stat = new FileEntryInfo { - Attributes = attr, - Blocks = entry.flLgLen / volMDB.drAlBlkSiz, - BlockSize = volMDB.drAlBlkSiz, - CreationTime = DateHandlers.MacToDateTime(entry.flCrDat), - DeviceNo = 0, - GID = 0, - Inode = entry.flFlNum, + Attributes = attr, + Blocks = entry.flLgLen / volMDB.drAlBlkSiz, + BlockSize = volMDB.drAlBlkSiz, + CreationTime = DateHandlers.MacToDateTime(entry.flCrDat), + DeviceNo = 0, + GID = 0, + Inode = entry.flFlNum, LastWriteTime = DateHandlers.MacToDateTime(entry.flMdDat), - Length = entry.flPyLen, - Links = 1, - Mode = 0x124, - UID = 0 + Length = entry.flPyLen, + Links = 1, + Mode = 0x124, + UID = 0 }; return Errno.NoError; @@ -291,7 +294,8 @@ namespace DiscImageChef.Filesystems.AppleMFS 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]; diff --git a/DiscImageChef.Filesystems/AppleMFS/Info.cs b/DiscImageChef.Filesystems/AppleMFS/Info.cs index c5e03bfb5..dcb2c9e09 100644 --- a/DiscImageChef.Filesystems/AppleMFS/Info.cs +++ b/DiscImageChef.Filesystems/AppleMFS/Info.cs @@ -57,39 +57,39 @@ namespace DiscImageChef.Filesystems.AppleMFS } public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information, - Encoding encoding) + Encoding encoding) { - Encoding = encoding ?? new MacRoman(); + Encoding = encoding ?? new MacRoman(); information = ""; StringBuilder sb = new StringBuilder(); MFS_MasterDirectoryBlock mdb = new MFS_MasterDirectoryBlock(); - MFS_BootBlock bb = new MFS_BootBlock(); + MFS_BootBlock bb = new MFS_BootBlock(); byte[] pString = new byte[16]; byte[] mdbSector = imagePlugin.ReadSector(2 + partition.Start); - byte[] bbSector = imagePlugin.ReadSector(0 + partition.Start); + byte[] bbSector = imagePlugin.ReadSector(0 + partition.Start); BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian; mdb.drSigWord = BigEndianBitConverter.ToUInt16(mdbSector, 0x000); if(mdb.drSigWord != MFS_MAGIC) return; - mdb.drCrDate = BigEndianBitConverter.ToUInt32(mdbSector, 0x002); - mdb.drLsBkUp = BigEndianBitConverter.ToUInt32(mdbSector, 0x006); - mdb.drAtrb = BigEndianBitConverter.ToUInt16(mdbSector, 0x00A); - mdb.drNmFls = BigEndianBitConverter.ToUInt16(mdbSector, 0x00C); - mdb.drDirSt = BigEndianBitConverter.ToUInt16(mdbSector, 0x00E); - mdb.drBlLen = BigEndianBitConverter.ToUInt16(mdbSector, 0x010); + mdb.drCrDate = BigEndianBitConverter.ToUInt32(mdbSector, 0x002); + mdb.drLsBkUp = BigEndianBitConverter.ToUInt32(mdbSector, 0x006); + mdb.drAtrb = BigEndianBitConverter.ToUInt16(mdbSector, 0x00A); + mdb.drNmFls = BigEndianBitConverter.ToUInt16(mdbSector, 0x00C); + mdb.drDirSt = BigEndianBitConverter.ToUInt16(mdbSector, 0x00E); + mdb.drBlLen = BigEndianBitConverter.ToUInt16(mdbSector, 0x010); mdb.drNmAlBlks = BigEndianBitConverter.ToUInt16(mdbSector, 0x012); mdb.drAlBlkSiz = BigEndianBitConverter.ToUInt32(mdbSector, 0x014); - mdb.drClpSiz = BigEndianBitConverter.ToUInt32(mdbSector, 0x018); - mdb.drAlBlSt = BigEndianBitConverter.ToUInt16(mdbSector, 0x01C); - mdb.drNxtFNum = BigEndianBitConverter.ToUInt32(mdbSector, 0x01E); - mdb.drFreeBks = BigEndianBitConverter.ToUInt16(mdbSector, 0x022); - mdb.drVNSiz = mdbSector[0x024]; + mdb.drClpSiz = BigEndianBitConverter.ToUInt32(mdbSector, 0x018); + mdb.drAlBlSt = BigEndianBitConverter.ToUInt16(mdbSector, 0x01C); + mdb.drNxtFNum = BigEndianBitConverter.ToUInt32(mdbSector, 0x01E); + mdb.drFreeBks = BigEndianBitConverter.ToUInt16(mdbSector, 0x022); + mdb.drVNSiz = mdbSector[0x024]; byte[] variableSize = new byte[mdb.drVNSiz + 1]; Array.Copy(mdbSector, 0x024, variableSize, 0, mdb.drVNSiz + 1); mdb.drVN = StringHandlers.PascalToString(variableSize, Encoding); @@ -98,8 +98,8 @@ namespace DiscImageChef.Filesystems.AppleMFS if(bb.signature == MFSBB_MAGIC) { - bb.branch = BigEndianBitConverter.ToUInt32(bbSector, 0x002); - bb.boot_flags = bbSector[0x006]; + bb.branch = BigEndianBitConverter.ToUInt32(bbSector, 0x002); + bb.boot_flags = bbSector[0x006]; bb.boot_version = bbSector[0x007]; bb.sec_sv_pages = BigEndianBitConverter.ToInt16(bbSector, 0x008); @@ -119,11 +119,11 @@ namespace DiscImageChef.Filesystems.AppleMFS Array.Copy(mdbSector, 0x06A, pString, 0, 16); bb.clipbrd_name = StringHandlers.PascalToString(pString, Encoding); - bb.max_files = BigEndianBitConverter.ToUInt16(bbSector, 0x07A); + bb.max_files = BigEndianBitConverter.ToUInt16(bbSector, 0x07A); bb.queue_size = BigEndianBitConverter.ToUInt16(bbSector, 0x07C); - bb.heap_128k = BigEndianBitConverter.ToUInt32(bbSector, 0x07E); - bb.heap_256k = BigEndianBitConverter.ToUInt32(bbSector, 0x082); - bb.heap_512k = BigEndianBitConverter.ToUInt32(bbSector, 0x086); + bb.heap_128k = BigEndianBitConverter.ToUInt32(bbSector, 0x07E); + bb.heap_256k = BigEndianBitConverter.ToUInt32(bbSector, 0x082); + bb.heap_512k = BigEndianBitConverter.ToUInt32(bbSector, 0x086); } else bb.signature = 0x0000; @@ -132,7 +132,7 @@ namespace DiscImageChef.Filesystems.AppleMFS 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 & 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(); @@ -154,7 +154,7 @@ namespace DiscImageChef.Filesystems.AppleMFS 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."); + 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(); @@ -178,23 +178,25 @@ namespace DiscImageChef.Filesystems.AppleMFS XmlFsType = new FileSystemType(); if(mdb.drLsBkUp > 0) { - XmlFsType.BackupDate = DateHandlers.MacToDateTime(mdb.drLsBkUp); + XmlFsType.BackupDate = DateHandlers.MacToDateTime(mdb.drLsBkUp); XmlFsType.BackupDateSpecified = true; } - XmlFsType.Bootable = bb.signature == MFSBB_MAGIC; - XmlFsType.Clusters = mdb.drNmAlBlks; + + XmlFsType.Bootable = bb.signature == MFSBB_MAGIC; + XmlFsType.Clusters = mdb.drNmAlBlks; XmlFsType.ClusterSize = (int)mdb.drAlBlkSiz; if(mdb.drCrDate > 0) { - XmlFsType.CreationDate = DateHandlers.MacToDateTime(mdb.drCrDate); + XmlFsType.CreationDate = DateHandlers.MacToDateTime(mdb.drCrDate); XmlFsType.CreationDateSpecified = true; } - XmlFsType.Files = mdb.drNmFls; - XmlFsType.FilesSpecified = true; - XmlFsType.FreeClusters = mdb.drFreeBks; + + XmlFsType.Files = mdb.drNmFls; + XmlFsType.FilesSpecified = true; + XmlFsType.FreeClusters = mdb.drFreeBks; XmlFsType.FreeClustersSpecified = true; - XmlFsType.Type = "MFS"; - XmlFsType.VolumeName = mdb.drVN; + XmlFsType.Type = "MFS"; + XmlFsType.VolumeName = mdb.drVN; } } } \ No newline at end of file diff --git a/DiscImageChef.Filesystems/AppleMFS/Structs.cs b/DiscImageChef.Filesystems/AppleMFS/Structs.cs index 5f18435b6..6b8312610 100644 --- a/DiscImageChef.Filesystems/AppleMFS/Structs.cs +++ b/DiscImageChef.Filesystems/AppleMFS/Structs.cs @@ -124,26 +124,26 @@ namespace DiscImageChef.Filesystems.AppleMFS enum MFS_FileFlags : byte { Locked = 0x01, - Used = 0x80 + Used = 0x80 } [Flags] enum MFS_FinderFlags : ushort { - kIsOnDesk = 0x0001, - kColor = 0x000E, + kIsOnDesk = 0x0001, + kColor = 0x000E, kRequireSwitchLaunch = 0x0020, - kIsShared = 0x0040, - kHasNoINITs = 0x0080, - kHasBeenInited = 0x0100, - kHasCustomIcon = 0x0400, - kLetter = 0x0200, - kChanged = 0x0200, - kIsStationery = 0x0800, - kNameLocked = 0x1000, - kHasBundle = 0x2000, - kIsInvisible = 0x4000, - kIsAlias = 0x8000 + kIsShared = 0x0040, + kHasNoINITs = 0x0080, + kHasBeenInited = 0x0100, + kHasCustomIcon = 0x0400, + kLetter = 0x0200, + kChanged = 0x0200, + kIsStationery = 0x0800, + kNameLocked = 0x1000, + kHasBundle = 0x2000, + kIsInvisible = 0x4000, + kIsAlias = 0x8000 } struct MFS_Point @@ -154,11 +154,11 @@ namespace DiscImageChef.Filesystems.AppleMFS struct MFS_FinderInfo { - public uint fdType; - public uint fdCreator; + public uint fdType; + public uint fdCreator; public MFS_FinderFlags fdFlags; - public MFS_Point fdLocation; - public short fdFldr; + public MFS_Point fdLocation; + public short fdFldr; } struct MFS_FileEntry diff --git a/DiscImageChef.Filesystems/AppleMFS/Super.cs b/DiscImageChef.Filesystems/AppleMFS/Super.cs index e5a5f189a..4a334a3d8 100644 --- a/DiscImageChef.Filesystems/AppleMFS/Super.cs +++ b/DiscImageChef.Filesystems/AppleMFS/Super.cs @@ -45,9 +45,9 @@ namespace DiscImageChef.Filesystems.AppleMFS public Errno Mount(IMediaImage imagePlugin, Partition partition, Encoding encoding, Dictionary options) { - device = imagePlugin; - partitionStart = partition.Start; - Encoding = encoding ?? Encoding.GetEncoding("macintosh"); + device = imagePlugin; + partitionStart = partition.Start; + Encoding = encoding ?? Encoding.GetEncoding("macintosh"); if(options == null) options = GetDefaultOptions(); if(options.TryGetValue("debug", out string debugString)) bool.TryParse(debugString, out debug); volMDB = new MFS_MasterDirectoryBlock(); @@ -60,64 +60,63 @@ namespace DiscImageChef.Filesystems.AppleMFS volMDB.drSigWord = BigEndianBitConverter.ToUInt16(mdbBlocks, 0x000); if(volMDB.drSigWord != MFS_MAGIC) return Errno.InvalidArgument; - volMDB.drCrDate = BigEndianBitConverter.ToUInt32(mdbBlocks, 0x002); - volMDB.drLsBkUp = BigEndianBitConverter.ToUInt32(mdbBlocks, 0x006); - volMDB.drAtrb = BigEndianBitConverter.ToUInt16(mdbBlocks, 0x00A); - volMDB.drNmFls = BigEndianBitConverter.ToUInt16(mdbBlocks, 0x00C); - volMDB.drDirSt = BigEndianBitConverter.ToUInt16(mdbBlocks, 0x00E); - volMDB.drBlLen = BigEndianBitConverter.ToUInt16(mdbBlocks, 0x010); - volMDB.drNmAlBlks = BigEndianBitConverter.ToUInt16(mdbBlocks, 0x012); - volMDB.drAlBlkSiz = BigEndianBitConverter.ToUInt32(mdbBlocks, 0x014); - volMDB.drClpSiz = BigEndianBitConverter.ToUInt32(mdbBlocks, 0x018); - volMDB.drAlBlSt = BigEndianBitConverter.ToUInt16(mdbBlocks, 0x01C); - volMDB.drNxtFNum = BigEndianBitConverter.ToUInt32(mdbBlocks, 0x01E); - volMDB.drFreeBks = BigEndianBitConverter.ToUInt16(mdbBlocks, 0x022); - volMDB.drVNSiz = mdbBlocks[0x024]; - byte[] variableSize = new byte[volMDB.drVNSiz + 1]; + volMDB.drCrDate = BigEndianBitConverter.ToUInt32(mdbBlocks, 0x002); + volMDB.drLsBkUp = BigEndianBitConverter.ToUInt32(mdbBlocks, 0x006); + volMDB.drAtrb = BigEndianBitConverter.ToUInt16(mdbBlocks, 0x00A); + volMDB.drNmFls = BigEndianBitConverter.ToUInt16(mdbBlocks, 0x00C); + volMDB.drDirSt = BigEndianBitConverter.ToUInt16(mdbBlocks, 0x00E); + volMDB.drBlLen = BigEndianBitConverter.ToUInt16(mdbBlocks, 0x010); + volMDB.drNmAlBlks = BigEndianBitConverter.ToUInt16(mdbBlocks, 0x012); + volMDB.drAlBlkSiz = BigEndianBitConverter.ToUInt32(mdbBlocks, 0x014); + volMDB.drClpSiz = BigEndianBitConverter.ToUInt32(mdbBlocks, 0x018); + volMDB.drAlBlSt = BigEndianBitConverter.ToUInt16(mdbBlocks, 0x01C); + volMDB.drNxtFNum = BigEndianBitConverter.ToUInt32(mdbBlocks, 0x01E); + volMDB.drFreeBks = BigEndianBitConverter.ToUInt16(mdbBlocks, 0x022); + volMDB.drVNSiz = mdbBlocks[0x024]; + byte[] variableSize = new byte[volMDB.drVNSiz + 1]; Array.Copy(mdbBlocks, 0x024, variableSize, 0, volMDB.drVNSiz + 1); volMDB.drVN = StringHandlers.PascalToString(variableSize, Encoding); - directoryBlocks = device.ReadSectors(volMDB.drDirSt + partitionStart, volMDB.drBlLen); - int bytesInBlockMap = volMDB.drNmAlBlks * 12 / 8 + volMDB.drNmAlBlks * 12 % 8; + directoryBlocks = device.ReadSectors(volMDB.drDirSt + partitionStart, volMDB.drBlLen); + int bytesInBlockMap = volMDB.drNmAlBlks * 12 / 8 + volMDB.drNmAlBlks * 12 % 8; const int BYTES_BEFORE_BLOCK_MAP = 64; - int bytesInWholeMdb = bytesInBlockMap + BYTES_BEFORE_BLOCK_MAP; - int sectorsInWholeMdb = bytesInWholeMdb / (int)device.Info.SectorSize + - bytesInWholeMdb % (int)device.Info.SectorSize; + int bytesInWholeMdb = bytesInBlockMap + BYTES_BEFORE_BLOCK_MAP; + int sectorsInWholeMdb = bytesInWholeMdb / (int)device.Info.SectorSize + + bytesInWholeMdb % (int)device.Info.SectorSize; byte[] wholeMdb = device.ReadSectors(partitionStart + 2, (uint)sectorsInWholeMdb); - blockMapBytes = new byte[bytesInBlockMap]; + blockMapBytes = new byte[bytesInBlockMap]; Array.Copy(wholeMdb, BYTES_BEFORE_BLOCK_MAP, blockMapBytes, 0, blockMapBytes.Length); int offset = 0; - blockMap = new uint[volMDB.drNmAlBlks + 2 + 1]; - for(int i = 2; i < volMDB.drNmAlBlks + 2; i += 8) + blockMap = new uint[volMDB.drNmAlBlks + 2 + 1]; + 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 + 4 <= blockMapBytes.Length) + 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) + 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; } if(device.Info.ReadableSectorTags.Contains(SectorTagType.AppleSectorTag)) { - mdbTags = device.ReadSectorTag(2 + partitionStart, SectorTagType.AppleSectorTag); - bootTags = device.ReadSectorTag(0 + partitionStart, SectorTagType.AppleSectorTag); + mdbTags = device.ReadSectorTag(2 + partitionStart, SectorTagType.AppleSectorTag); + bootTags = device.ReadSectorTag(0 + partitionStart, SectorTagType.AppleSectorTag); directoryTags = device.ReadSectorsTag(volMDB.drDirSt + partitionStart, volMDB.drBlLen, SectorTagType.AppleSectorTag); bitmapTags = device.ReadSectorsTag(partitionStart + 2, (uint)sectorsInWholeMdb, diff --git a/DiscImageChef.Filesystems/AppleMFS/Xattr.cs b/DiscImageChef.Filesystems/AppleMFS/Xattr.cs index b5f9a1944..8c9ba917f 100644 --- a/DiscImageChef.Filesystems/AppleMFS/Xattr.cs +++ b/DiscImageChef.Filesystems/AppleMFS/Xattr.cs @@ -51,10 +51,10 @@ namespace DiscImageChef.Filesystems.AppleMFS xattrs = new List(); if(debug) - if(string.Compare(path, "$", StringComparison.InvariantCulture) == 0 || + if(string.Compare(path, "$", StringComparison.InvariantCulture) == 0 || string.Compare(path, "$Bitmap", StringComparison.InvariantCulture) == 0 || - string.Compare(path, "$Boot", StringComparison.InvariantCulture) == 0 || - string.Compare(path, "$MDB", StringComparison.InvariantCulture) == 0) + string.Compare(path, "$Boot", StringComparison.InvariantCulture) == 0 || + string.Compare(path, "$MDB", StringComparison.InvariantCulture) == 0) { if(device.Info.ReadableSectorTags.Contains(SectorTagType.AppleSectorTag)) xattrs.Add("com.apple.macintosh.tags"); @@ -91,10 +91,10 @@ namespace DiscImageChef.Filesystems.AppleMFS if(pathElements.Length != 1) return Errno.NotSupported; if(debug) - if(string.Compare(path, "$", StringComparison.InvariantCulture) == 0 || + if(string.Compare(path, "$", StringComparison.InvariantCulture) == 0 || string.Compare(path, "$Bitmap", StringComparison.InvariantCulture) == 0 || - string.Compare(path, "$Boot", StringComparison.InvariantCulture) == 0 || - string.Compare(path, "$MDB", StringComparison.InvariantCulture) == 0) + string.Compare(path, "$Boot", StringComparison.InvariantCulture) == 0 || + string.Compare(path, "$MDB", StringComparison.InvariantCulture) == 0) if(device.Info.ReadableSectorTags.Contains(SectorTagType.AppleSectorTag) && string.Compare(xattr, "com.apple.macintosh.tags", StringComparison.InvariantCulture) == 0) { @@ -126,7 +126,8 @@ namespace DiscImageChef.Filesystems.AppleMFS return Errno.NoError; } } - else return Errno.NoSuchExtendedAttribute; + else + return Errno.NoSuchExtendedAttribute; Errno error; @@ -134,14 +135,14 @@ namespace DiscImageChef.Filesystems.AppleMFS if(!idToEntry.TryGetValue(fileId, out MFS_FileEntry entry)) return Errno.NoSuchFile; - if(entry.flRLgLen > 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 && + if(entry.flRLgLen > 0 && string.Compare(xattr, "com.apple.ResourceFork.tags", StringComparison.InvariantCulture) == 0) { error = ReadFile(path, out buf, true, true); diff --git a/DiscImageChef.Filesystems/AtheOS.cs b/DiscImageChef.Filesystems/AtheOS.cs index 47a374282..d217c871f 100644 --- a/DiscImageChef.Filesystems/AtheOS.cs +++ b/DiscImageChef.Filesystems/AtheOS.cs @@ -47,25 +47,25 @@ namespace DiscImageChef.Filesystems const uint AFS_MAGIC3 = 0x15B6830E; // Common constants const uint AFS_SUPERBLOCK_SIZE = 1024; - const uint AFS_BOOTBLOCK_SIZE = AFS_SUPERBLOCK_SIZE; + const uint AFS_BOOTBLOCK_SIZE = AFS_SUPERBLOCK_SIZE; public FileSystemType XmlFsType { get; private set; } - public Encoding Encoding { get; private set; } - public string Name => "AtheOS Filesystem"; - public Guid Id => new Guid("AAB2C4F1-DC07-49EE-A948-576CC51B58C5"); + public Encoding Encoding { get; private set; } + public string Name => "AtheOS Filesystem"; + public Guid Id => new Guid("AAB2C4F1-DC07-49EE-A948-576CC51B58C5"); public bool Identify(IMediaImage imagePlugin, Partition partition) { ulong sector = AFS_BOOTBLOCK_SIZE / imagePlugin.Info.SectorSize; - uint offset = AFS_BOOTBLOCK_SIZE % imagePlugin.Info.SectorSize; - uint run = 1; + uint offset = AFS_BOOTBLOCK_SIZE % imagePlugin.Info.SectorSize; + uint run = 1; if(imagePlugin.Info.SectorSize < AFS_SUPERBLOCK_SIZE) run = AFS_SUPERBLOCK_SIZE / imagePlugin.Info.SectorSize; if(sector + partition.Start >= partition.End) return false; - byte[] tmp = imagePlugin.ReadSectors(sector + partition.Start, run); + byte[] tmp = imagePlugin.ReadSectors(sector + partition.Start, run); byte[] sbSector = new byte[AFS_SUPERBLOCK_SIZE]; Array.Copy(tmp, offset, sbSector, 0, AFS_SUPERBLOCK_SIZE); @@ -75,21 +75,21 @@ namespace DiscImageChef.Filesystems } public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information, - Encoding encoding) + Encoding encoding) { - Encoding = encoding ?? Encoding.GetEncoding("iso-8859-15"); + Encoding = encoding ?? Encoding.GetEncoding("iso-8859-15"); information = ""; StringBuilder sb = new StringBuilder(); ulong sector = AFS_BOOTBLOCK_SIZE / imagePlugin.Info.SectorSize; - uint offset = AFS_BOOTBLOCK_SIZE % imagePlugin.Info.SectorSize; - uint run = 1; + uint offset = AFS_BOOTBLOCK_SIZE % imagePlugin.Info.SectorSize; + uint run = 1; if(imagePlugin.Info.SectorSize < AFS_SUPERBLOCK_SIZE) run = AFS_SUPERBLOCK_SIZE / imagePlugin.Info.SectorSize; - byte[] tmp = imagePlugin.ReadSectors(sector + partition.Start, run); + byte[] tmp = imagePlugin.ReadSectors(sector + partition.Start, run); byte[] sbSector = new byte[AFS_SUPERBLOCK_SIZE]; Array.Copy(tmp, offset, sbSector, 0, AFS_SUPERBLOCK_SIZE); @@ -118,17 +118,17 @@ namespace DiscImageChef.Filesystems sb.AppendFormat("Journal starts in byte {0} and has {1} bytes in {2} blocks", afsSb.log_start, afsSb.log_size, afsSb.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)", - afsSb.root_dir_start, afsSb.root_dir_ag, afsSb.root_dir_len, - afsSb.root_dir_len * afsSb.block_size).AppendLine(); + .AppendFormat("Root folder's i-node resides in block {0} of allocation group {1} and runs for {2} blocks ({3} bytes)", + afsSb.root_dir_start, afsSb.root_dir_ag, afsSb.root_dir_len, + afsSb.root_dir_len * afsSb.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)", - afsSb.deleted_start, afsSb.deleted_ag, afsSb.deleted_len, - afsSb.deleted_len * afsSb.block_size).AppendLine(); + .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)", + afsSb.deleted_start, afsSb.deleted_ag, afsSb.deleted_len, + afsSb.deleted_len * afsSb.block_size).AppendLine(); sb - .AppendFormat("Indices' i-node resides in block {0} of allocation group {1} and runs for {2} blocks ({3} bytes)", - afsSb.indices_start, afsSb.indices_ag, afsSb.indices_len, - afsSb.indices_len * afsSb.block_size).AppendLine(); + .AppendFormat("Indices' i-node resides in block {0} of allocation group {1} and runs for {2} blocks ({3} bytes)", + afsSb.indices_start, afsSb.indices_ag, afsSb.indices_len, + afsSb.indices_len * afsSb.block_size).AppendLine(); sb.AppendFormat("{0} blocks for bootloader ({1} bytes)", afsSb.boot_size, afsSb.boot_size * afsSb.block_size).AppendLine(); @@ -136,13 +136,13 @@ namespace DiscImageChef.Filesystems XmlFsType = new FileSystemType { - Clusters = afsSb.num_blocks, - ClusterSize = (int)afsSb.block_size, - Dirty = false, - FreeClusters = afsSb.num_blocks - afsSb.used_blocks, + Clusters = afsSb.num_blocks, + ClusterSize = (int)afsSb.block_size, + Dirty = false, + FreeClusters = afsSb.num_blocks - afsSb.used_blocks, FreeClustersSpecified = true, - Type = "AtheOS filesystem", - VolumeName = StringHandlers.CToString(afsSb.name, Encoding) + Type = "AtheOS filesystem", + VolumeName = StringHandlers.CToString(afsSb.name, Encoding) }; } @@ -153,7 +153,8 @@ namespace DiscImageChef.Filesystems struct AtheosSuperBlock { /// 0x000, Volume name, 32 bytes - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] public byte[] name; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] + public byte[] name; /// 0x020, "AFS1", 0x41465331 public uint magic1; /// 0x024, "BIGE", 0x42494745 diff --git a/DiscImageChef.Filesystems/BFS.cs b/DiscImageChef.Filesystems/BFS.cs index 5022882bc..9fb928572 100644 --- a/DiscImageChef.Filesystems/BFS.cs +++ b/DiscImageChef.Filesystems/BFS.cs @@ -55,9 +55,9 @@ namespace DiscImageChef.Filesystems const uint BEFS_DIRTY = 0x44495254; public FileSystemType XmlFsType { get; private set; } - public Encoding Encoding { get; private set; } - public string Name => "Be Filesystem"; - public Guid Id => new Guid("dc8572b3-b6ad-46e4-8de9-cbe123ff6672"); + public Encoding Encoding { get; private set; } + public string Name => "Be Filesystem"; + public Guid Id => new Guid("dc8572b3-b6ad-46e4-8de9-cbe123ff6672"); public bool Identify(IMediaImage imagePlugin, Partition partition) { @@ -65,14 +65,14 @@ namespace DiscImageChef.Filesystems byte[] sbSector = imagePlugin.ReadSector(0 + partition.Start); - uint magic = BitConverter.ToUInt32(sbSector, 0x20); + uint magic = BitConverter.ToUInt32(sbSector, 0x20); uint magicBe = BigEndianBitConverter.ToUInt32(sbSector, 0x20); if(magic == BEFS_MAGIC1 || magicBe == BEFS_MAGIC1) return true; if(sbSector.Length >= 0x400) { - magic = BitConverter.ToUInt32(sbSector, 0x220); + magic = BitConverter.ToUInt32(sbSector, 0x220); magicBe = BigEndianBitConverter.ToUInt32(sbSector, 0x220); } @@ -80,16 +80,16 @@ namespace DiscImageChef.Filesystems sbSector = imagePlugin.ReadSector(1 + partition.Start); - magic = BitConverter.ToUInt32(sbSector, 0x20); + magic = BitConverter.ToUInt32(sbSector, 0x20); magicBe = BigEndianBitConverter.ToUInt32(sbSector, 0x20); return magic == BEFS_MAGIC1 || magicBe == BEFS_MAGIC1; } public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information, - Encoding encoding) + Encoding encoding) { - Encoding = encoding ?? Encoding.GetEncoding("iso-8859-15"); + Encoding = encoding ?? Encoding.GetEncoding("iso-8859-15"); information = ""; StringBuilder sb = new StringBuilder(); @@ -105,7 +105,7 @@ namespace DiscImageChef.Filesystems littleEndian = besb.magic1 == BEFS_CIGAM1; else { - sbSector = imagePlugin.ReadSector(1 + partition.Start); + sbSector = imagePlugin.ReadSector(1 + partition.Start); besb.magic1 = BigEndianBitConverter.ToUInt32(sbSector, 0x20); if(besb.magic1 == BEFS_MAGIC1 || besb.magic1 == BEFS_CIGAM1) // There is a boot sector @@ -118,7 +118,7 @@ namespace DiscImageChef.Filesystems if(besb.magic1 == BEFS_MAGIC1 || besb.magic1 == BEFS_CIGAM1) // There is a boot sector { littleEndian = besb.magic1 == BEFS_CIGAM1; - sbSector = new byte[0x200]; + sbSector = new byte[0x200]; Array.Copy(temp, 0x200, sbSector, 0, 0x200); } else return; @@ -136,8 +136,10 @@ namespace DiscImageChef.Filesystems sb.AppendLine(littleEndian ? "Little-endian BeFS" : "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 || + 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"); @@ -181,25 +183,25 @@ namespace DiscImageChef.Filesystems 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(); + .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(); + .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(); XmlFsType = new FileSystemType { - Clusters = besb.num_blocks, - ClusterSize = (int)besb.block_size, - Dirty = besb.flags == BEFS_DIRTY, - FreeClusters = besb.num_blocks - besb.used_blocks, + Clusters = besb.num_blocks, + ClusterSize = (int)besb.block_size, + Dirty = besb.flags == BEFS_DIRTY, + FreeClusters = besb.num_blocks - besb.used_blocks, FreeClustersSpecified = true, - Type = "BeFS", - VolumeName = StringHandlers.CToString(besb.name, Encoding) + Type = "BeFS", + VolumeName = StringHandlers.CToString(besb.name, Encoding) }; } @@ -210,7 +212,8 @@ namespace DiscImageChef.Filesystems struct BeSuperBlock { /// 0x000, Volume name, 32 bytes - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] public byte[] name; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] + public byte[] name; /// 0x020, "BFS1", 0x42465331 public uint magic1; /// 0x024, "BIGE", 0x42494745 diff --git a/DiscImageChef.Filesystems/BTRFS.cs b/DiscImageChef.Filesystems/BTRFS.cs index 8cb380691..871ee452f 100644 --- a/DiscImageChef.Filesystems/BTRFS.cs +++ b/DiscImageChef.Filesystems/BTRFS.cs @@ -48,20 +48,20 @@ namespace DiscImageChef.Filesystems const ulong BTRFS_MAGIC = 0x4D5F53665248425F; public FileSystemType XmlFsType { get; private set; } - public Encoding Encoding { get; private set; } - public string Name => "B-tree file system"; - public Guid Id => new Guid("C904CF15-5222-446B-B7DB-02EAC5D781B3"); + public Encoding Encoding { get; private set; } + public string Name => "B-tree file system"; + public Guid Id => new Guid("C904CF15-5222-446B-B7DB-02EAC5D781B3"); public bool Identify(IMediaImage imagePlugin, Partition partition) { if(partition.Start >= partition.End) return false; - ulong sbSectorOff = 0x10000 / imagePlugin.Info.SectorSize; - uint sbSectorSize = 0x1000 / imagePlugin.Info.SectorSize; + ulong sbSectorOff = 0x10000 / imagePlugin.Info.SectorSize; + uint sbSectorSize = 0x1000 / imagePlugin.Info.SectorSize; if(sbSectorOff + partition.Start >= partition.End) return false; - byte[] sector = imagePlugin.ReadSectors(sbSectorOff + partition.Start, sbSectorSize); + byte[] sector = imagePlugin.ReadSectors(sbSectorOff + partition.Start, sbSectorSize); SuperBlock btrfsSb; try @@ -72,79 +72,79 @@ namespace DiscImageChef.Filesystems } catch { return false; } - DicConsole.DebugWriteLine("BTRFS Plugin", "sbSectorOff = {0}", sbSectorOff); - DicConsole.DebugWriteLine("BTRFS Plugin", "sbSectorSize = {0}", sbSectorSize); + DicConsole.DebugWriteLine("BTRFS Plugin", "sbSectorOff = {0}", sbSectorOff); + DicConsole.DebugWriteLine("BTRFS Plugin", "sbSectorSize = {0}", sbSectorSize); DicConsole.DebugWriteLine("BTRFS Plugin", "partition.PartitionStartSector = {0}", partition.Start); - DicConsole.DebugWriteLine("BTRFS Plugin", "btrfsSb.magic = 0x{0:X16}", btrfsSb.magic); + DicConsole.DebugWriteLine("BTRFS Plugin", "btrfsSb.magic = 0x{0:X16}", btrfsSb.magic); return btrfsSb.magic == BTRFS_MAGIC; } public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information, - Encoding encoding) + Encoding encoding) { Encoding = encoding ?? Encoding.GetEncoding("iso-8859-15"); StringBuilder sbInformation = new StringBuilder(); - XmlFsType = new FileSystemType(); + XmlFsType = new FileSystemType(); information = ""; - ulong sbSectorOff = 0x10000 / imagePlugin.Info.SectorSize; - uint sbSectorSize = 0x1000 / imagePlugin.Info.SectorSize; + ulong sbSectorOff = 0x10000 / imagePlugin.Info.SectorSize; + uint sbSectorSize = 0x1000 / imagePlugin.Info.SectorSize; byte[] sector = imagePlugin.ReadSectors(sbSectorOff + partition.Start, sbSectorSize); - GCHandle handle = GCHandle.Alloc(sector, GCHandleType.Pinned); + GCHandle handle = GCHandle.Alloc(sector, GCHandleType.Pinned); SuperBlock btrfsSb = (SuperBlock)Marshal.PtrToStructure(handle.AddrOfPinnedObject(), typeof(SuperBlock)); handle.Free(); - DicConsole.DebugWriteLine("BTRFS Plugin", "btrfsSb.checksum = {0}", btrfsSb.checksum); - DicConsole.DebugWriteLine("BTRFS Plugin", "btrfsSb.uuid = {0}", btrfsSb.uuid); - DicConsole.DebugWriteLine("BTRFS Plugin", "btrfsSb.pba = {0}", btrfsSb.pba); - DicConsole.DebugWriteLine("BTRFS Plugin", "btrfsSb.flags = {0}", btrfsSb.flags); - DicConsole.DebugWriteLine("BTRFS Plugin", "btrfsSb.magic = {0}", btrfsSb.magic); - DicConsole.DebugWriteLine("BTRFS Plugin", "btrfsSb.generation = {0}", btrfsSb.generation); - DicConsole.DebugWriteLine("BTRFS Plugin", "btrfsSb.root_lba = {0}", btrfsSb.root_lba); - DicConsole.DebugWriteLine("BTRFS Plugin", "btrfsSb.chunk_lba = {0}", btrfsSb.chunk_lba); - DicConsole.DebugWriteLine("BTRFS Plugin", "btrfsSb.log_lba = {0}", btrfsSb.log_lba); - DicConsole.DebugWriteLine("BTRFS Plugin", "btrfsSb.log_root_transid = {0}", btrfsSb.log_root_transid); - DicConsole.DebugWriteLine("BTRFS Plugin", "btrfsSb.total_bytes = {0}", btrfsSb.total_bytes); - DicConsole.DebugWriteLine("BTRFS Plugin", "btrfsSb.bytes_used = {0}", btrfsSb.bytes_used); + DicConsole.DebugWriteLine("BTRFS Plugin", "btrfsSb.checksum = {0}", btrfsSb.checksum); + DicConsole.DebugWriteLine("BTRFS Plugin", "btrfsSb.uuid = {0}", btrfsSb.uuid); + DicConsole.DebugWriteLine("BTRFS Plugin", "btrfsSb.pba = {0}", btrfsSb.pba); + DicConsole.DebugWriteLine("BTRFS Plugin", "btrfsSb.flags = {0}", btrfsSb.flags); + DicConsole.DebugWriteLine("BTRFS Plugin", "btrfsSb.magic = {0}", btrfsSb.magic); + DicConsole.DebugWriteLine("BTRFS Plugin", "btrfsSb.generation = {0}", btrfsSb.generation); + DicConsole.DebugWriteLine("BTRFS Plugin", "btrfsSb.root_lba = {0}", btrfsSb.root_lba); + DicConsole.DebugWriteLine("BTRFS Plugin", "btrfsSb.chunk_lba = {0}", btrfsSb.chunk_lba); + DicConsole.DebugWriteLine("BTRFS Plugin", "btrfsSb.log_lba = {0}", btrfsSb.log_lba); + DicConsole.DebugWriteLine("BTRFS Plugin", "btrfsSb.log_root_transid = {0}", btrfsSb.log_root_transid); + DicConsole.DebugWriteLine("BTRFS Plugin", "btrfsSb.total_bytes = {0}", btrfsSb.total_bytes); + DicConsole.DebugWriteLine("BTRFS Plugin", "btrfsSb.bytes_used = {0}", btrfsSb.bytes_used); DicConsole.DebugWriteLine("BTRFS Plugin", "btrfsSb.root_dir_objectid = {0}", btrfsSb.root_dir_objectid); - DicConsole.DebugWriteLine("BTRFS Plugin", "btrfsSb.num_devices = {0}", btrfsSb.num_devices); - DicConsole.DebugWriteLine("BTRFS Plugin", "btrfsSb.sectorsize = {0}", btrfsSb.sectorsize); - DicConsole.DebugWriteLine("BTRFS Plugin", "btrfsSb.nodesize = {0}", btrfsSb.nodesize); - 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.num_devices = {0}", btrfsSb.num_devices); + DicConsole.DebugWriteLine("BTRFS Plugin", "btrfsSb.sectorsize = {0}", btrfsSb.sectorsize); + DicConsole.DebugWriteLine("BTRFS Plugin", "btrfsSb.nodesize = {0}", btrfsSb.nodesize); + 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.compat_flags = 0x{0:X16}", btrfsSb.compat_flags); + 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); - DicConsole.DebugWriteLine("BTRFS Plugin", "btrfsSb.csum_type = {0}", btrfsSb.csum_type); - DicConsole.DebugWriteLine("BTRFS Plugin", "btrfsSb.root_level = {0}", btrfsSb.root_level); - DicConsole.DebugWriteLine("BTRFS Plugin", "btrfsSb.chunk_root_level = {0}", btrfsSb.chunk_root_level); - DicConsole.DebugWriteLine("BTRFS Plugin", "btrfsSb.log_root_level = {0}", btrfsSb.log_root_level); - 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.incompat_flags = 0x{0:X16}", btrfsSb.incompat_flags); + DicConsole.DebugWriteLine("BTRFS Plugin", "btrfsSb.csum_type = {0}", btrfsSb.csum_type); + DicConsole.DebugWriteLine("BTRFS Plugin", "btrfsSb.root_level = {0}", btrfsSb.root_level); + DicConsole.DebugWriteLine("BTRFS Plugin", "btrfsSb.chunk_root_level = {0}", btrfsSb.chunk_root_level); + DicConsole.DebugWriteLine("BTRFS Plugin", "btrfsSb.log_root_level = {0}", btrfsSb.log_root_level); + 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.type = {0}", btrfsSb.dev_item.type); + 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.dev_group = {0}", btrfsSb.dev_item.dev_group); + 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.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.uuid = {0}", btrfsSb.dev_item.uuid); - DicConsole.DebugWriteLine("BTRFS Plugin", "btrfsSb.label = {0}", btrfsSb.label); + DicConsole.DebugWriteLine("BTRFS Plugin", "btrfsSb.label = {0}", btrfsSb.label); sbInformation.AppendLine("B-tree filesystem"); sbInformation.AppendFormat("UUID: {0}", btrfsSb.uuid).AppendLine(); @@ -170,13 +170,13 @@ namespace DiscImageChef.Filesystems XmlFsType = new FileSystemType { - Clusters = (long)(btrfsSb.total_bytes / btrfsSb.sectorsize), - ClusterSize = (int)btrfsSb.sectorsize, + Clusters = (long)(btrfsSb.total_bytes / btrfsSb.sectorsize), + ClusterSize = (int)btrfsSb.sectorsize, FreeClustersSpecified = true, - VolumeName = btrfsSb.label, - VolumeSerial = $"{btrfsSb.uuid}", - VolumeSetIdentifier = $"{btrfsSb.dev_item.device_uuid}", - Type = Name + VolumeName = btrfsSb.label, + VolumeSerial = $"{btrfsSb.uuid}", + VolumeSetIdentifier = $"{btrfsSb.dev_item.device_uuid}", + Type = Name }; XmlFsType.FreeClusters = XmlFsType.Clusters - (long)(btrfsSb.bytes_used / btrfsSb.sectorsize); } @@ -184,38 +184,43 @@ namespace DiscImageChef.Filesystems [StructLayout(LayoutKind.Sequential, Pack = 1)] struct SuperBlock { - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 0x20)] public byte[] checksum; - public Guid uuid; - public ulong pba; - public ulong flags; - public ulong magic; - public ulong generation; - public ulong root_lba; - public ulong chunk_lba; - public ulong log_lba; - public ulong log_root_transid; - public ulong total_bytes; - public ulong bytes_used; - public ulong root_dir_objectid; - public ulong num_devices; - public uint sectorsize; - public uint nodesize; - public uint leafsize; - public uint stripesize; - public uint n; - public ulong chunk_root_generation; - public ulong compat_flags; - public ulong compat_ro_flags; - public ulong incompat_flags; - public ushort csum_type; - public byte root_level; - public byte chunk_root_level; - public byte log_root_level; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 0x20)] + public byte[] checksum; + public Guid uuid; + public ulong pba; + public ulong flags; + public ulong magic; + public ulong generation; + public ulong root_lba; + public ulong chunk_lba; + public ulong log_lba; + public ulong log_root_transid; + public ulong total_bytes; + public ulong bytes_used; + public ulong root_dir_objectid; + public ulong num_devices; + public uint sectorsize; + public uint nodesize; + public uint leafsize; + public uint stripesize; + public uint n; + public ulong chunk_root_generation; + public ulong compat_flags; + public ulong compat_ro_flags; + public ulong incompat_flags; + public ushort csum_type; + public byte root_level; + 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)] @@ -224,17 +229,17 @@ namespace DiscImageChef.Filesystems public ulong id; public ulong bytes; public ulong used; - public uint optimal_align; - public uint optimal_width; - public uint minimal_size; + public uint optimal_align; + public uint optimal_width; + public uint minimal_size; public ulong type; public ulong generation; public ulong start_offset; - public uint dev_group; - public byte seek_speed; - public byte bandwitdh; - public Guid device_uuid; - public Guid uuid; + public uint dev_group; + public byte seek_speed; + public byte bandwitdh; + public Guid device_uuid; + public Guid uuid; } } } \ No newline at end of file diff --git a/DiscImageChef.Filesystems/CBM.cs b/DiscImageChef.Filesystems/CBM.cs index cd442b687..338d20fb6 100644 --- a/DiscImageChef.Filesystems/CBM.cs +++ b/DiscImageChef.Filesystems/CBM.cs @@ -44,9 +44,9 @@ namespace DiscImageChef.Filesystems public class CBM : IFilesystem { public FileSystemType XmlFsType { get; private set; } - public string Name => "Commodore file system"; - public Guid Id => new Guid("D104744E-A376-450C-BAC0-1347C93F983B"); - public Encoding Encoding { get; private set; } + public string Name => "Commodore file system"; + public Guid Id => new Guid("D104744E-A376-450C-BAC0-1347C93F983B"); + public Encoding Encoding { get; private set; } public bool Identify(IMediaImage imagePlugin, Partition partition) { @@ -62,8 +62,8 @@ namespace DiscImageChef.Filesystems if(imagePlugin.Info.Sectors == 3200) { sector = imagePlugin.ReadSector(1560); - CommodoreHeader cbmHdr = new CommodoreHeader(); - IntPtr cbmHdrPtr = Marshal.AllocHGlobal(Marshal.SizeOf(cbmHdr)); + CommodoreHeader cbmHdr = new CommodoreHeader(); + IntPtr cbmHdrPtr = Marshal.AllocHGlobal(Marshal.SizeOf(cbmHdr)); Marshal.Copy(sector, 0, cbmHdrPtr, Marshal.SizeOf(cbmHdr)); cbmHdr = (CommodoreHeader)Marshal.PtrToStructure(cbmHdrPtr, typeof(CommodoreHeader)); Marshal.FreeHGlobal(cbmHdrPtr); @@ -74,21 +74,21 @@ namespace DiscImageChef.Filesystems else { sector = imagePlugin.ReadSector(357); - CommodoreBam cbmBam = new CommodoreBam(); - IntPtr cbmBamPtr = Marshal.AllocHGlobal(Marshal.SizeOf(cbmBam)); + CommodoreBam cbmBam = new CommodoreBam(); + IntPtr cbmBamPtr = Marshal.AllocHGlobal(Marshal.SizeOf(cbmBam)); Marshal.Copy(sector, 0, cbmBamPtr, Marshal.SizeOf(cbmBam)); 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; + cbmBam.unused1 == 0x00 && cbmBam.directoryTrack == 0x12) return true; } return false; } public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information, - Encoding encoding) + Encoding encoding) { Encoding = new PETSCII(); byte[] sector; @@ -99,16 +99,16 @@ namespace DiscImageChef.Filesystems XmlFsType = new FileSystemType { - Type = "Commodore file system", - Clusters = (long)imagePlugin.Info.Sectors, + Type = "Commodore file system", + Clusters = (long)imagePlugin.Info.Sectors, ClusterSize = 256 }; if(imagePlugin.Info.Sectors == 3200) { sector = imagePlugin.ReadSector(1560); - CommodoreHeader cbmHdr = new CommodoreHeader(); - IntPtr cbmHdrPtr = Marshal.AllocHGlobal(Marshal.SizeOf(cbmHdr)); + CommodoreHeader cbmHdr = new CommodoreHeader(); + IntPtr cbmHdrPtr = Marshal.AllocHGlobal(Marshal.SizeOf(cbmHdr)); Marshal.Copy(sector, 0, cbmHdrPtr, Marshal.SizeOf(cbmHdr)); cbmHdr = (CommodoreHeader)Marshal.PtrToStructure(cbmHdrPtr, typeof(CommodoreHeader)); Marshal.FreeHGlobal(cbmHdrPtr); @@ -116,8 +116,8 @@ namespace DiscImageChef.Filesystems sbInformation.AppendFormat("Directory starts at track {0} sector {1}", cbmHdr.directoryTrack, cbmHdr.directorySector).AppendLine(); sbInformation - .AppendFormat("Disk DOS Version: {0}", Encoding.ASCII.GetString(new[] {cbmHdr.diskDosVersion})) - .AppendLine(); + .AppendFormat("Disk DOS Version: {0}", Encoding.ASCII.GetString(new[] {cbmHdr.diskDosVersion})) + .AppendLine(); sbInformation.AppendFormat("DOS Version: {0}", Encoding.ASCII.GetString(new[] {cbmHdr.dosVersion})) .AppendLine(); sbInformation.AppendFormat("Disk Version: {0}", Encoding.ASCII.GetString(new[] {cbmHdr.diskVersion})) @@ -126,14 +126,14 @@ namespace DiscImageChef.Filesystems sbInformation.AppendFormat("Disk name: {0}", StringHandlers.CToString(cbmHdr.name, Encoding)) .AppendLine(); - XmlFsType.VolumeName = StringHandlers.CToString(cbmHdr.name, Encoding); + XmlFsType.VolumeName = StringHandlers.CToString(cbmHdr.name, Encoding); XmlFsType.VolumeSerial = $"{cbmHdr.diskId}"; } else { sector = imagePlugin.ReadSector(357); - CommodoreBam cbmBam = new CommodoreBam(); - IntPtr cbmBamPtr = Marshal.AllocHGlobal(Marshal.SizeOf(cbmBam)); + CommodoreBam cbmBam = new CommodoreBam(); + IntPtr cbmBamPtr = Marshal.AllocHGlobal(Marshal.SizeOf(cbmBam)); Marshal.Copy(sector, 0, cbmBamPtr, Marshal.SizeOf(cbmBam)); cbmBam = (CommodoreBam)Marshal.PtrToStructure(cbmBamPtr, typeof(CommodoreBam)); Marshal.FreeHGlobal(cbmBamPtr); @@ -149,7 +149,7 @@ namespace DiscImageChef.Filesystems sbInformation.AppendFormat("Disk name: {0}", StringHandlers.CToString(cbmBam.name, Encoding)) .AppendLine(); - XmlFsType.VolumeName = StringHandlers.CToString(cbmBam.name, Encoding); + XmlFsType.VolumeName = StringHandlers.CToString(cbmBam.name, Encoding); XmlFsType.VolumeSerial = $"{cbmBam.diskId}"; } @@ -178,11 +178,13 @@ namespace DiscImageChef.Filesystems /// /// Block allocation map /// - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 140)] public byte[] bam; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 140)] + public byte[] bam; /// /// Disk name /// - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] public byte[] name; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] + public byte[] name; /// /// Filled with 0xA0 /// @@ -210,19 +212,23 @@ namespace DiscImageChef.Filesystems /// /// Block allocation map for Dolphin DOS extended tracks /// - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 20)] public byte[] dolphinBam; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 20)] + public byte[] dolphinBam; /// /// Block allocation map for Speed DOS extended tracks /// - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 20)] public byte[] speedBam; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 20)] + public byte[] speedBam; /// /// Unused /// - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 9)] public byte[] unused2; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 9)] + public byte[] unused2; /// /// Free sector count for second side in 1571 /// - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 9)] public byte[] freeCount; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 9)] + public byte[] freeCount; } [StructLayout(LayoutKind.Sequential, Pack = 1)] @@ -247,7 +253,8 @@ namespace DiscImageChef.Filesystems /// /// Disk name /// - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] public byte[] name; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] + public byte[] name; /// /// Filled with 0xA0 /// diff --git a/DiscImageChef.Filesystems/CPM/CPM.cs b/DiscImageChef.Filesystems/CPM/CPM.cs index 8ee55704b..1e1f64536 100644 --- a/DiscImageChef.Filesystems/CPM/CPM.cs +++ b/DiscImageChef.Filesystems/CPM/CPM.cs @@ -60,7 +60,7 @@ namespace DiscImageChef.Filesystems.CPM /// Stores all known CP/M disk definitions /// CpmDefinitions definitions; - IMediaImage device; + IMediaImage device; /// /// Cached directory listing /// @@ -84,7 +84,7 @@ namespace DiscImageChef.Filesystems.CPM /// /// Timestamp in volume label for update /// - byte[] labelUpdateDate; + byte[] labelUpdateDate; bool mounted; Partition partition; /// @@ -118,7 +118,7 @@ namespace DiscImageChef.Filesystems.CPM public Guid Id => new Guid("AA2B8585-41DF-4E3B-8A35-D1A935E2F8A1"); public IEnumerable<(string name, Type type, string description)> SupportedOptions => - new(string name, Type type, string description)[] { }; + new (string name, Type type, string description)[] { }; static Dictionary GetDefaultOptions() { diff --git a/DiscImageChef.Filesystems/CPM/Dir.cs b/DiscImageChef.Filesystems/CPM/Dir.cs index 1ae1a2f93..006a7777b 100644 --- a/DiscImageChef.Filesystems/CPM/Dir.cs +++ b/DiscImageChef.Filesystems/CPM/Dir.cs @@ -78,30 +78,36 @@ namespace DiscImageChef.Filesystems.CPM if((entry.statusUser & 0x7F) < 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; 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(); + label = Encoding.ASCII.GetString(directory, off + 1, 11).Trim(); labelCreationDate = new byte[4]; - labelUpdateDate = new byte[4]; + labelUpdateDate = new byte[4]; Array.Copy(directory, off + 24, labelCreationDate, 0, 4); - Array.Copy(directory, off + 28, labelUpdateDate, 0, 4); + Array.Copy(directory, off + 28, labelUpdateDate, 0, 4); } else if(entry.statusUser == 0x21) - if(directory[off + 1] == 0x00) thirdPartyTimestamps = true; - else standardTimestamps |= directory[off + 21] == 0x00 && directory[off + 31] == 0x00; + if(directory[off + 1] == 0x00) + thirdPartyTimestamps = true; + else + standardTimestamps |= directory[off + 21] == 0x00 && directory[off + 31] == 0x00; } return fileCount > 0; diff --git a/DiscImageChef.Filesystems/CPM/File.cs b/DiscImageChef.Filesystems/CPM/File.cs index 23b4a9044..5de578d43 100644 --- a/DiscImageChef.Filesystems/CPM/File.cs +++ b/DiscImageChef.Filesystems/CPM/File.cs @@ -112,8 +112,8 @@ namespace DiscImageChef.Filesystems.CPM : Errno.NoSuchFile; stat = new FileEntryInfo {Attributes = FileAttributes.Directory, BlockSize = XmlFsType.ClusterSize}; - 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); return Errno.NoError; } } diff --git a/DiscImageChef.Filesystems/CPM/Info.cs b/DiscImageChef.Filesystems/CPM/Info.cs index 61728e76d..66e377720 100644 --- a/DiscImageChef.Filesystems/CPM/Info.cs +++ b/DiscImageChef.Filesystems/CPM/Info.cs @@ -159,11 +159,11 @@ namespace DiscImageChef.Filesystems.CPM try { byte[] sector; - ulong sectorSize; - ulong firstDirectorySector; + ulong sectorSize; + ulong firstDirectorySector; byte[] directory = null; workingDefinition = null; - label = null; + label = null; // Try Amstrad superblock if(!cpmFound) @@ -182,7 +182,8 @@ namespace DiscImageChef.Filesystems.CPM // Read the superblock IntPtr amsPtr = Marshal.AllocHGlobal(16); Marshal.Copy(sector, amsSbOffset, amsPtr, 16); - AmstradSuperBlock amsSb = (AmstradSuperBlock)Marshal.PtrToStructure(amsPtr, typeof(AmstradSuperBlock)); + AmstradSuperBlock amsSb = + (AmstradSuperBlock)Marshal.PtrToStructure(amsPtr, typeof(AmstradSuperBlock)); Marshal.FreeHGlobal(amsPtr); // Check that format byte and sidedness indicate the same number of sizes @@ -191,14 +192,14 @@ namespace DiscImageChef.Filesystems.CPM amsSb.format == 2 && (amsSb.sidedness & 0x02) == 2) { // Calculate device limits - ulong sides = (ulong)(amsSb.format == 0 ? 1 : 2); + ulong sides = (ulong)(amsSb.format == 0 ? 1 : 2); ulong sectorCount = (ulong)(amsSb.tps * amsSb.spt * (byte)sides); sectorSize = (ulong)(128 << amsSb.psh); // Compare device limits from superblock to real limits if(sectorSize == imagePlugin.Info.SectorSize && sectorCount == imagePlugin.Info.Sectors) { - cpmFound = true; + cpmFound = true; firstDirectorySector = (ulong)(amsSb.off * amsSb.spt); // Build a DiscParameterBlock @@ -220,13 +221,14 @@ namespace DiscImageChef.Filesystems.CPM dpb.cks = 0x10; dpb.drm = 0x3F; } + dpb.dsm = 0; // I don't care 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); - dpb.spt = (ushort)(amsSb.spt * (sectorSize / 128)); + dpb.spt = (ushort)(amsSb.spt * (sectorSize / 128)); uint directoryLength = (uint)(((ulong)dpb.drm + 1) * 32 / sectorSize); directory = imagePlugin.ReadSectors(firstDirectorySector + partition.Start, directoryLength); @@ -234,23 +236,23 @@ namespace DiscImageChef.Filesystems.CPM // Build a CP/M disk definition workingDefinition = new CpmDefinition { - al0 = dpb.al0, - al1 = dpb.al1, - bitrate = "LOW", - blm = dpb.blm, - bsh = dpb.bsh, - bytesPerSector = 512, - cylinders = amsSb.tps, - drm = dpb.drm, - dsm = dpb.dsm, - encoding = "MFM", - evenOdd = false, - exm = dpb.exm, - label = null, - comment = "Amstrad PCW superblock", - ofs = dpb.off, + al0 = dpb.al0, + al1 = dpb.al1, + bitrate = "LOW", + blm = dpb.blm, + bsh = dpb.bsh, + bytesPerSector = 512, + cylinders = amsSb.tps, + drm = dpb.drm, + dsm = dpb.dsm, + encoding = "MFM", + evenOdd = false, + exm = dpb.exm, + label = null, + comment = "Amstrad PCW superblock", + ofs = dpb.off, sectorsPerTrack = amsSb.spt, - side1 = new Side {sideId = 0, sectorIds = new int[amsSb.spt]} + side1 = new Side {sideId = 0, sectorIds = new int[amsSb.spt]} }; for(int si = 0; si < amsSb.spt; si++) workingDefinition.side1.sectorIds[si] = si + 1; @@ -298,8 +300,8 @@ namespace DiscImageChef.Filesystems.CPM if(sum == 0) { // Read the superblock - HardDiskSuperBlock hddSb = new HardDiskSuperBlock(); - IntPtr hddPtr = Marshal.AllocHGlobal(Marshal.SizeOf(hddSb)); + HardDiskSuperBlock hddSb = new HardDiskSuperBlock(); + IntPtr hddPtr = Marshal.AllocHGlobal(Marshal.SizeOf(hddSb)); Marshal.Copy(sector, 0, hddPtr, Marshal.SizeOf(hddSb)); hddSb = (HardDiskSuperBlock)Marshal.PtrToStructure(hddPtr, typeof(HardDiskSuperBlock)); Marshal.FreeHGlobal(hddPtr); @@ -311,10 +313,11 @@ namespace DiscImageChef.Filesystems.CPM (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.Info.SectorSize && startingSector == partition.Start && + if(sectorSize == imagePlugin.Info.SectorSize && + startingSector == partition.Start && sectorsInPartition + partition.Start <= partition.End) { - cpmFound = true; + cpmFound = true; firstDirectorySector = (ulong)(hddSb.off * hddSb.sectorsPerTrack); // Build a DiscParameterBlock @@ -344,27 +347,27 @@ namespace DiscImageChef.Filesystems.CPM // Build a CP/M disk definition workingDefinition = new CpmDefinition { - al0 = dpb.al0, - al1 = dpb.al1, - bitrate = "HIGH", - blm = dpb.blm, - bsh = dpb.bsh, - bytesPerSector = 512, - cylinders = hddSb.cylinders, - drm = dpb.drm, - dsm = dpb.dsm, - encoding = "MFM", - evenOdd = false, - exm = dpb.exm, - label = null, - comment = "CP/M-86 hard disk superblock", - ofs = dpb.off, + al0 = dpb.al0, + al1 = dpb.al1, + bitrate = "HIGH", + blm = dpb.blm, + bsh = dpb.bsh, + bytesPerSector = 512, + cylinders = hddSb.cylinders, + drm = dpb.drm, + dsm = dpb.dsm, + encoding = "MFM", + evenOdd = false, + exm = dpb.exm, + label = null, + comment = "CP/M-86 hard disk superblock", + ofs = dpb.off, sectorsPerTrack = hddSb.sectorsPerTrack, - side1 = new Side {sideId = 0, sectorIds = new int[hddSb.sectorsPerTrack]}, - order = "SIDES", - side2 = new Side {sideId = 1, sectorIds = new int[hddSb.sectorsPerTrack]}, - skew = 0, - sofs = 0 + side1 = new Side {sideId = 0, sectorIds = new int[hddSb.sectorsPerTrack]}, + order = "SIDES", + side2 = new Side {sideId = 1, sectorIds = new int[hddSb.sectorsPerTrack]}, + skew = 0, + sofs = 0 }; for(int si = 0; si < hddSb.sectorsPerTrack; si++) @@ -383,8 +386,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(); uint firstDirectorySector86 = 0; @@ -399,7 +404,7 @@ namespace DiscImageChef.Filesystems.CPM case FormatByte.k160: if(imagePlugin.Info.SectorSize == 512 && imagePlugin.Info.Sectors == 320) { - cpmFound = true; + cpmFound = true; firstDirectorySector86 = 8; dpb = new DiscParameterBlock { @@ -419,25 +424,25 @@ namespace DiscImageChef.Filesystems.CPM workingDefinition = new CpmDefinition { - al0 = dpb.al0, - al1 = dpb.al1, - bitrate = "LOW", - blm = dpb.blm, - bsh = dpb.bsh, - bytesPerSector = 512, - cylinders = 40, - drm = dpb.drm, - dsm = dpb.dsm, - encoding = "MFM", - evenOdd = false, - exm = dpb.exm, - label = null, - comment = "CP/M-86 floppy identifier", - ofs = dpb.off, + al0 = dpb.al0, + al1 = dpb.al1, + bitrate = "LOW", + blm = dpb.blm, + bsh = dpb.bsh, + bytesPerSector = 512, + cylinders = 40, + drm = dpb.drm, + dsm = dpb.dsm, + encoding = "MFM", + evenOdd = false, + exm = dpb.exm, + label = null, + comment = "CP/M-86 floppy identifier", + ofs = dpb.off, sectorsPerTrack = 8, - side1 = new Side {sideId = 0, sectorIds = new int[8]}, - skew = 0, - sofs = 0 + side1 = new Side {sideId = 0, sectorIds = new int[8]}, + skew = 0, + sofs = 0 }; for(int si = 0; si < 8; si++) workingDefinition.side1.sectorIds[si] = si + 1; @@ -447,7 +452,7 @@ namespace DiscImageChef.Filesystems.CPM case FormatByte.k320: if(imagePlugin.Info.SectorSize == 512 && imagePlugin.Info.Sectors == 640) { - cpmFound = true; + cpmFound = true; firstDirectorySector86 = 16; dpb = new DiscParameterBlock { @@ -467,27 +472,27 @@ namespace DiscImageChef.Filesystems.CPM workingDefinition = new CpmDefinition { - al0 = dpb.al0, - al1 = dpb.al1, - bitrate = "LOW", - blm = dpb.blm, - bsh = dpb.bsh, - bytesPerSector = 512, - cylinders = 40, - drm = dpb.drm, - dsm = dpb.dsm, - encoding = "MFM", - evenOdd = false, - exm = dpb.exm, - label = null, - comment = "CP/M-86 floppy identifier", - ofs = dpb.off, + al0 = dpb.al0, + al1 = dpb.al1, + bitrate = "LOW", + blm = dpb.blm, + bsh = dpb.bsh, + bytesPerSector = 512, + cylinders = 40, + drm = dpb.drm, + dsm = dpb.dsm, + encoding = "MFM", + evenOdd = false, + exm = dpb.exm, + label = null, + comment = "CP/M-86 floppy identifier", + ofs = dpb.off, sectorsPerTrack = 8, - side1 = new Side {sideId = 0, sectorIds = new int[8]}, - order = "SIDES", - side2 = new Side {sideId = 1, sectorIds = new int[8]}, - skew = 0, - sofs = 0 + side1 = new Side {sideId = 0, sectorIds = new int[8]}, + order = "SIDES", + side2 = new Side {sideId = 1, sectorIds = new int[8]}, + skew = 0, + sofs = 0 }; for(int si = 0; si < 8; si++) workingDefinition.side1.sectorIds[si] = si + 1; @@ -500,7 +505,7 @@ namespace DiscImageChef.Filesystems.CPM case FormatByte.k360Alt2: if(imagePlugin.Info.SectorSize == 512 && imagePlugin.Info.Sectors == 720) { - cpmFound = true; + cpmFound = true; firstDirectorySector86 = 36; dpb = new DiscParameterBlock { @@ -520,27 +525,27 @@ namespace DiscImageChef.Filesystems.CPM workingDefinition = new CpmDefinition { - al0 = dpb.al0, - al1 = dpb.al1, - bitrate = "LOW", - blm = dpb.blm, - bsh = dpb.bsh, - bytesPerSector = 512, - cylinders = 40, - drm = dpb.drm, - dsm = dpb.dsm, - encoding = "MFM", - evenOdd = false, - exm = dpb.exm, - label = null, - comment = "CP/M-86 floppy identifier", - ofs = dpb.off, + al0 = dpb.al0, + al1 = dpb.al1, + bitrate = "LOW", + blm = dpb.blm, + bsh = dpb.bsh, + bytesPerSector = 512, + cylinders = 40, + drm = dpb.drm, + dsm = dpb.dsm, + encoding = "MFM", + evenOdd = false, + exm = dpb.exm, + label = null, + comment = "CP/M-86 floppy identifier", + ofs = dpb.off, sectorsPerTrack = 9, - side1 = new Side {sideId = 0, sectorIds = new int[9]}, - order = "SIDES", - side2 = new Side {sideId = 1, sectorIds = new int[9]}, - skew = 0, - sofs = 0 + side1 = new Side {sideId = 0, sectorIds = new int[9]}, + order = "SIDES", + side2 = new Side {sideId = 1, sectorIds = new int[9]}, + skew = 0, + sofs = 0 }; for(int si = 0; si < 9; si++) workingDefinition.side1.sectorIds[si] = si + 1; @@ -552,7 +557,7 @@ namespace DiscImageChef.Filesystems.CPM case FormatByte.k720Alt: if(imagePlugin.Info.SectorSize == 512 && imagePlugin.Info.Sectors == 1440) { - cpmFound = true; + cpmFound = true; firstDirectorySector86 = 36; dpb = new DiscParameterBlock { @@ -572,27 +577,27 @@ namespace DiscImageChef.Filesystems.CPM workingDefinition = new CpmDefinition { - al0 = dpb.al0, - al1 = dpb.al1, - bitrate = "LOW", - blm = dpb.blm, - bsh = dpb.bsh, - bytesPerSector = 512, - cylinders = 80, - drm = dpb.drm, - dsm = dpb.dsm, - encoding = "MFM", - evenOdd = false, - exm = dpb.exm, - label = null, - comment = "CP/M-86 floppy identifier", - ofs = dpb.off, + al0 = dpb.al0, + al1 = dpb.al1, + bitrate = "LOW", + blm = dpb.blm, + bsh = dpb.bsh, + bytesPerSector = 512, + cylinders = 80, + drm = dpb.drm, + dsm = dpb.dsm, + encoding = "MFM", + evenOdd = false, + exm = dpb.exm, + label = null, + comment = "CP/M-86 floppy identifier", + ofs = dpb.off, sectorsPerTrack = 9, - side1 = new Side {sideId = 0, sectorIds = new int[9]}, - order = "SIDES", - side2 = new Side {sideId = 1, sectorIds = new int[9]}, - skew = 0, - sofs = 0 + side1 = new Side {sideId = 0, sectorIds = new int[9]}, + order = "SIDES", + side2 = new Side {sideId = 1, sectorIds = new int[9]}, + skew = 0, + sofs = 0 }; for(int si = 0; si < 9; si++) workingDefinition.side1.sectorIds[si] = si + 1; @@ -603,7 +608,7 @@ namespace DiscImageChef.Filesystems.CPM case FormatByte.f720: if(imagePlugin.Info.SectorSize == 512 && imagePlugin.Info.Sectors == 1440) { - cpmFound = true; + cpmFound = true; firstDirectorySector86 = 18; dpb = new DiscParameterBlock { @@ -623,27 +628,27 @@ namespace DiscImageChef.Filesystems.CPM workingDefinition = new CpmDefinition { - al0 = dpb.al0, - al1 = dpb.al1, - bitrate = "LOW", - blm = dpb.blm, - bsh = dpb.bsh, - bytesPerSector = 512, - cylinders = 80, - drm = dpb.drm, - dsm = dpb.dsm, - encoding = "MFM", - evenOdd = false, - exm = dpb.exm, - label = null, - comment = "CP/M-86 floppy identifier", - ofs = dpb.off, + al0 = dpb.al0, + al1 = dpb.al1, + bitrate = "LOW", + blm = dpb.blm, + bsh = dpb.bsh, + bytesPerSector = 512, + cylinders = 80, + drm = dpb.drm, + dsm = dpb.dsm, + encoding = "MFM", + evenOdd = false, + exm = dpb.exm, + label = null, + comment = "CP/M-86 floppy identifier", + ofs = dpb.off, sectorsPerTrack = 9, - side1 = new Side {sideId = 0, sectorIds = new int[9]}, - order = "CYLINDERS", - side2 = new Side {sideId = 1, sectorIds = new int[9]}, - skew = 0, - sofs = 0 + side1 = new Side {sideId = 0, sectorIds = new int[9]}, + order = "CYLINDERS", + side2 = new Side {sideId = 1, sectorIds = new int[9]}, + skew = 0, + sofs = 0 }; for(int si = 0; si < 9; si++) workingDefinition.side1.sectorIds[si] = si + 1; @@ -654,7 +659,7 @@ namespace DiscImageChef.Filesystems.CPM case FormatByte.f1200: if(imagePlugin.Info.SectorSize == 512 && imagePlugin.Info.Sectors == 2400) { - cpmFound = true; + cpmFound = true; firstDirectorySector86 = 30; dpb = new DiscParameterBlock { @@ -674,27 +679,27 @@ namespace DiscImageChef.Filesystems.CPM workingDefinition = new CpmDefinition { - al0 = dpb.al0, - al1 = dpb.al1, - bitrate = "HIGH", - blm = dpb.blm, - bsh = dpb.bsh, - bytesPerSector = 512, - cylinders = 80, - drm = dpb.drm, - dsm = dpb.dsm, - encoding = "MFM", - evenOdd = false, - exm = dpb.exm, - label = null, - comment = "CP/M-86 floppy identifier", - ofs = dpb.off, + al0 = dpb.al0, + al1 = dpb.al1, + bitrate = "HIGH", + blm = dpb.blm, + bsh = dpb.bsh, + bytesPerSector = 512, + cylinders = 80, + drm = dpb.drm, + dsm = dpb.dsm, + encoding = "MFM", + evenOdd = false, + exm = dpb.exm, + label = null, + comment = "CP/M-86 floppy identifier", + ofs = dpb.off, sectorsPerTrack = 15, - side1 = new Side {sideId = 0, sectorIds = new int[15]}, - order = "CYLINDERS", - side2 = new Side {sideId = 1, sectorIds = new int[15]}, - skew = 0, - sofs = 0 + side1 = new Side {sideId = 0, sectorIds = new int[15]}, + order = "CYLINDERS", + side2 = new Side {sideId = 1, sectorIds = new int[15]}, + skew = 0, + sofs = 0 }; for(int si = 0; si < 15; si++) workingDefinition.side1.sectorIds[si] = si + 1; @@ -705,7 +710,7 @@ namespace DiscImageChef.Filesystems.CPM case FormatByte.f1440: if(imagePlugin.Info.SectorSize == 512 && imagePlugin.Info.Sectors == 2880) { - cpmFound = true; + cpmFound = true; firstDirectorySector86 = 36; dpb = new DiscParameterBlock { @@ -725,27 +730,27 @@ namespace DiscImageChef.Filesystems.CPM workingDefinition = new CpmDefinition { - al0 = dpb.al0, - al1 = dpb.al1, - bitrate = "LOW", - blm = dpb.blm, - bsh = dpb.bsh, - bytesPerSector = 512, - cylinders = 80, - drm = dpb.drm, - dsm = dpb.dsm, - encoding = "MFM", - evenOdd = false, - exm = dpb.exm, - label = null, - comment = "CP/M-86 floppy identifier", - ofs = dpb.off, + al0 = dpb.al0, + al1 = dpb.al1, + bitrate = "LOW", + blm = dpb.blm, + bsh = dpb.bsh, + bytesPerSector = 512, + cylinders = 80, + drm = dpb.drm, + dsm = dpb.dsm, + encoding = "MFM", + evenOdd = false, + exm = dpb.exm, + label = null, + comment = "CP/M-86 floppy identifier", + ofs = dpb.off, sectorsPerTrack = 18, - side1 = new Side {sideId = 0, sectorIds = new int[18]}, - order = "CYLINDERS", - side2 = new Side {sideId = 1, sectorIds = new int[18]}, - skew = 0, - sofs = 0 + side1 = new Side {sideId = 0, sectorIds = new int[18]}, + order = "CYLINDERS", + side2 = new Side {sideId = 1, sectorIds = new int[18]}, + skew = 0, + sofs = 0 }; for(int si = 0; si < 18; si++) workingDefinition.side1.sectorIds[si] = si + 1; @@ -786,7 +791,7 @@ namespace DiscImageChef.Filesystems.CPM foreach(CpmDefinition def in from def in definitions.definitions let sectors = (ulong)(def.cylinders * def.sides * def.sectorsPerTrack) - where sectors == imagePlugin.Info.Sectors && + where sectors == imagePlugin.Info.Sectors && def.bytesPerSector == imagePlugin.Info.SectorSize select def) { @@ -794,7 +799,7 @@ 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); + else offset = (ulong)(def.ofs * def.sectorsPerTrack); int dirLen = (def.drm + 1) * 32 / def.bytesPerSector; @@ -828,7 +833,8 @@ namespace DiscImageChef.Filesystems.CPM 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; + def.side1.sectorIds.Length + + def.side2.sectorIds.Length; } // TODO: Implement COLUMBIA ordering else if(string.Compare(def.order, "COLUMBIA", @@ -839,9 +845,8 @@ namespace DiscImageChef.Filesystems.CPM 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."); @@ -861,7 +866,8 @@ namespace DiscImageChef.Filesystems.CPM for(int p = 0; p < dirLen; p++) { byte[] dirSector = - imagePlugin.ReadSector((ulong)((int)offset + (int)partition.Start + + imagePlugin.ReadSector((ulong)((int)offset + + (int)partition.Start + p / sectorMask.Length * sectorMask.Length + sectorMask[p % sectorMask.Length])); ms.Write(dirSector, 0, dirSector.Length); @@ -875,7 +881,8 @@ namespace DiscImageChef.Filesystems.CPM // Complement of the directory bytes if needed if(def.complement) - for(int b = 0; b < directory.Length; b++) directory[b] = (byte)(~directory[b] & 0xFF); + for(int b = 0; b < directory.Length; b++) + directory[b] = (byte)(~directory[b] & 0xFF); // Check the directory if(CheckDir(directory)) @@ -939,25 +946,25 @@ namespace DiscImageChef.Filesystems.CPM break; } - cpmFound = true; + cpmFound = true; workingDefinition = def; return true; } - label = null; + label = null; labelCreationDate = null; - labelUpdateDate = null; + labelUpdateDate = null; } } } // Clear class variables - cpmFound = false; - workingDefinition = null; - dpb = null; - label = null; - standardTimestamps = false; + cpmFound = false; + workingDefinition = null; + dpb = null; + label = null; + standardTimestamps = false; thirdPartyTimestamps = false; return false; } @@ -969,9 +976,9 @@ namespace DiscImageChef.Filesystems.CPM } public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information, - Encoding encoding) + Encoding encoding) { - Encoding = encoding ?? Encoding.GetEncoding("IBM437"); + Encoding = encoding ?? Encoding.GetEncoding("IBM437"); 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; @@ -1007,6 +1014,7 @@ namespace DiscImageChef.Filesystems.CPM if(interleaveSide2 > 1) sb.AppendFormat("Side 1 uses {0}:1 software interleaving", interleaveSide2).AppendLine(); } + switch(workingDefinition.order) { case "SIDES": @@ -1044,22 +1052,24 @@ namespace DiscImageChef.Filesystems.CPM if(labelUpdateDate != null) sb.AppendFormat("Volume updated on {0}", DateHandlers.CpmToDateTime(labelUpdateDate)).AppendLine(); - XmlFsType = new FileSystemType(); - XmlFsType.Bootable |= workingDefinition.sofs > 0 || workingDefinition.ofs > 0; - XmlFsType.ClusterSize = 128 << dpb.bsh; + XmlFsType = new 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); + else XmlFsType.Clusters = (long)(partition.End - partition.Start); if(labelCreationDate != null) { - XmlFsType.CreationDate = DateHandlers.CpmToDateTime(labelCreationDate); + XmlFsType.CreationDate = DateHandlers.CpmToDateTime(labelCreationDate); XmlFsType.CreationDateSpecified = true; } + if(labelUpdateDate != null) { - XmlFsType.ModificationDate = DateHandlers.CpmToDateTime(labelUpdateDate); + XmlFsType.ModificationDate = DateHandlers.CpmToDateTime(labelUpdateDate); XmlFsType.ModificationDateSpecified = true; } - XmlFsType.Type = "CP/M"; + + XmlFsType.Type = "CP/M"; XmlFsType.VolumeName = label; information = sb.ToString(); diff --git a/DiscImageChef.Filesystems/CPM/Structs.cs b/DiscImageChef.Filesystems/CPM/Structs.cs index 8c76d536f..c8eb62544 100644 --- a/DiscImageChef.Filesystems/CPM/Structs.cs +++ b/DiscImageChef.Filesystems/CPM/Structs.cs @@ -176,7 +176,8 @@ namespace DiscImageChef.Filesystems.CPM /// /// Copyright string /// - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 0x1F)] public byte[] copyright; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 0x1F)] + public byte[] copyright; /// /// First cylinder of disk where this volume resides /// @@ -288,7 +289,8 @@ namespace DiscImageChef.Filesystems.CPM /// /// Label in ASCII /// - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 11)] public byte[] label; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 11)] + public byte[] label; /// /// Label flags. Bit 0 = label exists, bit 4 = creation timestamp, bit 5 = modification timestamp, bit 6 = access /// timestamp, bit 7 = password enabled @@ -305,15 +307,18 @@ namespace DiscImageChef.Filesystems.CPM /// /// Password XOR'ed with /// - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] public byte[] password; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] + public byte[] password; /// /// Label creation time /// - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)] public byte[] ctime; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)] + public byte[] ctime; /// /// Label modification time /// - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)] public byte[] mtime; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)] + public byte[] mtime; } /// @@ -329,11 +334,13 @@ namespace DiscImageChef.Filesystems.CPM /// /// File 1 create/access timestamp /// - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)] public byte[] date1; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)] + public byte[] date1; /// /// File 1 modification timestamp /// - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)] public byte[] date2; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)] + public byte[] date2; /// /// File 1 password mode /// @@ -342,11 +349,13 @@ namespace DiscImageChef.Filesystems.CPM /// /// File 2 create/access timestamp /// - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)] public byte[] date3; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)] + public byte[] date3; /// /// File 2 modification timestamp /// - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)] public byte[] date4; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)] + public byte[] date4; /// /// File 2 password mode /// @@ -355,11 +364,13 @@ namespace DiscImageChef.Filesystems.CPM /// /// File 3 create/access timestamp /// - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)] public byte[] date5; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)] + public byte[] date5; /// /// File 3 modification timestamp /// - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)] public byte[] date6; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)] + public byte[] date6; /// /// File 3 password mode /// @@ -380,11 +391,13 @@ namespace DiscImageChef.Filesystems.CPM /// /// Filename /// - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] public byte[] filename; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] + public byte[] filename; /// /// Extension /// - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] public byte[] extension; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] + public byte[] extension; /// /// Password mode. Bit 7 = required for read, bit 6 = required for write, bit 5 = required for delete /// @@ -393,12 +406,15 @@ namespace DiscImageChef.Filesystems.CPM /// Password decoder byte /// public byte passwordDecoder; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)] public byte[] reserved; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)] + public byte[] reserved; /// /// Password XOR'ed with /// - [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; } /// @@ -415,39 +431,48 @@ namespace DiscImageChef.Filesystems.CPM /// /// Creation year for file 1 /// - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)] public byte[] create1; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)] + public byte[] create1; /// /// Modification time for file 1 /// - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)] public byte[] modify1; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)] + public byte[] modify1; /// /// Access time for file 1 /// - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)] public byte[] access1; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)] + public byte[] access1; /// /// Creation year for file 2 /// - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)] public byte[] create2; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)] + public byte[] create2; /// /// Modification time for file 2 /// - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)] public byte[] modify2; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)] + public byte[] modify2; /// /// Access time for file 2 /// - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)] public byte[] access2; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)] + public byte[] access2; /// /// Creation year for file 3 /// - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)] public byte[] create3; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)] + public byte[] create3; /// /// Modification time for file 3 /// - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)] public byte[] modify3; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)] + public byte[] modify3; /// /// Access time for file 3 /// - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)] public byte[] access3; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)] + public byte[] access3; } /// @@ -463,11 +488,13 @@ namespace DiscImageChef.Filesystems.CPM /// /// Filename and bit 7 as flags /// - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] public byte[] filename; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] + public byte[] filename; /// /// Extension and bit 7 as flags /// - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] public byte[] extension; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] + public byte[] extension; /// /// Low byte of extent number /// @@ -489,7 +516,8 @@ namespace DiscImageChef.Filesystems.CPM /// /// Allocation blocks /// - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] public byte[] allocations; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] + public byte[] allocations; } /// @@ -505,11 +533,13 @@ namespace DiscImageChef.Filesystems.CPM /// /// Filename and bit 7 as flags /// - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] public byte[] filename; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] + public byte[] filename; /// /// Extension and bit 7 as flags /// - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] public byte[] extension; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] + public byte[] extension; /// /// Low byte of extent number /// @@ -531,7 +561,8 @@ namespace DiscImageChef.Filesystems.CPM /// /// Allocation blocks /// - [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 ffc179593..301073759 100644 --- a/DiscImageChef.Filesystems/CPM/Super.cs +++ b/DiscImageChef.Filesystems/CPM/Super.cs @@ -76,7 +76,7 @@ namespace DiscImageChef.Filesystems.CPM 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] = + sectorMask[m + workingDefinition.side1.sectorIds.Length] = workingDefinition.side2.sectorIds[m] - workingDefinition.side2.sectorIds[0] + workingDefinition.side1.sectorIds.Length; } @@ -88,9 +88,10 @@ namespace DiscImageChef.Filesystems.CPM 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."); @@ -132,7 +133,7 @@ namespace DiscImageChef.Filesystems.CPM { byte[] readSector = device.ReadSector((ulong)((int)partition.Start + p / sectorMask.Length * sectorMask.Length + - sectorMask[p % sectorMask.Length])); + sectorMask[p % sectorMask.Length])); if(workingDefinition.complement) for(int b = 0; b < readSector.Length; b++) readSector[b] = (byte)(~readSector[b] & 0xFF); @@ -155,7 +156,7 @@ namespace DiscImageChef.Filesystems.CPM deinterleavedSectors.TryGetValue(a, out byte[] sector); // May it happen? Just in case, CP/M blocks are smaller than physical sectors - if(sector.Length > blockSize) + if(sector.Length > blockSize) for(int i = 0; i < sector.Length / blockSize; i++) { byte[] tmp = new byte[blockSize]; @@ -175,14 +176,13 @@ namespace DiscImageChef.Filesystems.CPM blockMs = new MemoryStream(); } // 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; + int dirSectors = (dpb.drm + 1) * 32 / workingDefinition.bytesPerSector; if(workingDefinition.sofs > 0) dirOff = workingDefinition.sofs; else dirOff = workingDefinition.ofs * workingDefinition.sectorsPerTrack; @@ -198,15 +198,15 @@ namespace DiscImageChef.Filesystems.CPM if(directory == null) return Errno.InvalidArgument; - int dirCnt = 0; - string file1 = null; - string file2 = null; - string file3 = null; + int dirCnt = 0; + string file1 = null; + string file2 = null; + string file3 = null; Dictionary>> fileExtents = new Dictionary>>(); - statCache = new Dictionary(); - cpmStat = new FileSystemInfo(); - bool atime = false; + statCache = new Dictionary(); + cpmStat = new FileSystemInfo(); + bool atime = false; dirList = new List(); labelCreationDate = null; labelUpdateDate = null; @@ -218,7 +218,7 @@ namespace DiscImageChef.Filesystems.CPM // For each directory entry for(int dOff = 0; dOff < directory.Length; dOff += 32) // Describes a file (does not support PDOS entries with user >= 16, because they're identical to password entries - if((directory[dOff] & 0x7F) < 0x10) + if((directory[dOff] & 0x7F) < 0x10) if(allocationBlocks.Count > 256) { dirPtr = Marshal.AllocHGlobal(32); @@ -227,7 +227,7 @@ namespace DiscImageChef.Filesystems.CPM (DirectoryEntry16)Marshal.PtrToStructure(dirPtr, typeof(DirectoryEntry16)); Marshal.FreeHGlobal(dirPtr); - bool hidden = (entry.statusUser & 0x80) == 0x80; + bool hidden = (entry.statusUser & 0x80) == 0x80; bool rdOnly = (entry.filename[0] & 0x80) == 0x80 || (entry.extension[0] & 0x80) == 0x80; bool system = (entry.filename[1] & 0x80) == 0x80 || (entry.extension[2] & 0x80) == 0x80; //bool backed = (entry.filename[3] & 0x80) == 0x80 || (entry.extension[3] & 0x80) == 0x80; @@ -316,7 +316,7 @@ namespace DiscImageChef.Filesystems.CPM DirectoryEntry entry = (DirectoryEntry)Marshal.PtrToStructure(dirPtr, typeof(DirectoryEntry)); Marshal.FreeHGlobal(dirPtr); - bool hidden = (entry.statusUser & 0x80) == 0x80; + bool hidden = (entry.statusUser & 0x80) == 0x80; bool rdOnly = (entry.filename[0] & 0x80) == 0x80 || (entry.extension[0] & 0x80) == 0x80; bool system = (entry.filename[1] & 0x80) == 0x80 || (entry.extension[2] & 0x80) == 0x80; //bool backed = (entry.filename[3] & 0x80) == 0x80 || (entry.extension[3] & 0x80) == 0x80; @@ -553,8 +553,8 @@ namespace DiscImageChef.Filesystems.CPM else fInfo = new FileEntryInfo(); byte[] ctime = new byte[4]; - ctime[0] = trdPartyDateEntry.create1[0]; - ctime[1] = trdPartyDateEntry.create1[1]; + ctime[0] = trdPartyDateEntry.create1[0]; + ctime[1] = trdPartyDateEntry.create1[1]; fInfo.AccessTime = DateHandlers.CpmToDateTime(trdPartyDateEntry.access1); fInfo.CreationTime = DateHandlers.CpmToDateTime(ctime); @@ -569,8 +569,8 @@ namespace DiscImageChef.Filesystems.CPM else fInfo = new FileEntryInfo(); byte[] ctime = new byte[4]; - ctime[0] = trdPartyDateEntry.create2[0]; - ctime[1] = trdPartyDateEntry.create2[1]; + ctime[0] = trdPartyDateEntry.create2[0]; + ctime[1] = trdPartyDateEntry.create2[1]; fInfo.AccessTime = DateHandlers.CpmToDateTime(trdPartyDateEntry.access2); fInfo.CreationTime = DateHandlers.CpmToDateTime(ctime); @@ -585,8 +585,8 @@ namespace DiscImageChef.Filesystems.CPM else fInfo = new FileEntryInfo(); byte[] ctime = new byte[4]; - ctime[0] = trdPartyDateEntry.create3[0]; - ctime[1] = trdPartyDateEntry.create3[1]; + ctime[0] = trdPartyDateEntry.create3[0]; + ctime[1] = trdPartyDateEntry.create3[1]; fInfo.AccessTime = DateHandlers.CpmToDateTime(trdPartyDateEntry.access3); fInfo.CreationTime = DateHandlers.CpmToDateTime(ctime); @@ -608,7 +608,7 @@ namespace DiscImageChef.Filesystems.CPM // this should not be a problem DicConsole.DebugWriteLine("CP/M Plugin", "Reading files."); long usedBlocks = 0; - fileCache = new Dictionary(); + fileCache = new Dictionary(); foreach(string filename in dirList) { MemoryStream fileMs = new MemoryStream(); diff --git a/DiscImageChef.Filesystems/CPM/Xattr.cs b/DiscImageChef.Filesystems/CPM/Xattr.cs index 367ea89d5..95bce2868 100644 --- a/DiscImageChef.Filesystems/CPM/Xattr.cs +++ b/DiscImageChef.Filesystems/CPM/Xattr.cs @@ -54,7 +54,8 @@ namespace DiscImageChef.Filesystems.CPM 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) return Errno.NoSuchExtendedAttribute; diff --git a/DiscImageChef.Filesystems/Cram.cs b/DiscImageChef.Filesystems/Cram.cs index 48fa901af..e073018cb 100644 --- a/DiscImageChef.Filesystems/Cram.cs +++ b/DiscImageChef.Filesystems/Cram.cs @@ -48,9 +48,9 @@ namespace DiscImageChef.Filesystems const uint CRAM_CIGAM = 0x453DCD28; public FileSystemType XmlFsType { get; private set; } - public Encoding Encoding { get; private set; } - public string Name => "Cram filesystem"; - public Guid Id => new Guid("F8F6E46F-7A2A-48E3-9C0A-46AF4DC29E09"); + public Encoding Encoding { get; private set; } + public string Name => "Cram filesystem"; + public Guid Id => new Guid("F8F6E46F-7A2A-48E3-9C0A-46AF4DC29E09"); public bool Identify(IMediaImage imagePlugin, Partition partition) { @@ -64,14 +64,14 @@ namespace DiscImageChef.Filesystems } public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information, - Encoding encoding) + Encoding encoding) { Encoding = encoding ?? Encoding.GetEncoding("iso-8859-15"); byte[] sector = imagePlugin.ReadSector(partition.Start); - uint magic = BitConverter.ToUInt32(sector, 0x00); + uint magic = BitConverter.ToUInt32(sector, 0x00); - CramSuperBlock crSb = new CramSuperBlock(); - bool littleEndian = true; + CramSuperBlock crSb = new CramSuperBlock(); + bool littleEndian = true; switch(magic) { @@ -82,7 +82,7 @@ namespace DiscImageChef.Filesystems Marshal.FreeHGlobal(crSbPtr); break; case CRAM_CIGAM: - crSb = BigEndianMarshal.ByteArrayToStructureBigEndian(sector); + crSb = BigEndianMarshal.ByteArrayToStructureBigEndian(sector); littleEndian = false; break; } @@ -101,12 +101,12 @@ namespace DiscImageChef.Filesystems XmlFsType = new FileSystemType { - VolumeName = StringHandlers.CToString(crSb.name, Encoding), - Type = "Cram file system", - Clusters = crSb.blocks, - Files = crSb.files, - FilesSpecified = true, - FreeClusters = 0, + VolumeName = StringHandlers.CToString(crSb.name, Encoding), + Type = "Cram file system", + Clusters = crSb.blocks, + Files = crSb.files, + FilesSpecified = true, + FreeClusters = 0, FreeClustersSpecified = true }; } @@ -115,9 +115,9 @@ namespace DiscImageChef.Filesystems { Zlib = 1, Lzma = 2, - Lzo = 3, - Xz = 4, - Lz4 = 5 + Lzo = 3, + Xz = 4, + Lz4 = 5 } [StructLayout(LayoutKind.Sequential, Pack = 1)] @@ -127,12 +127,14 @@ 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; } } } \ No newline at end of file diff --git a/DiscImageChef.Filesystems/ECMA67.cs b/DiscImageChef.Filesystems/ECMA67.cs index ad9908933..c131e91cb 100644 --- a/DiscImageChef.Filesystems/ECMA67.cs +++ b/DiscImageChef.Filesystems/ECMA67.cs @@ -44,9 +44,9 @@ namespace DiscImageChef.Filesystems { readonly byte[] ecma67_magic = {0x56, 0x4F, 0x4C}; - public Encoding Encoding { get; private set; } - public string Name => "ECMA-67"; - public Guid Id => new Guid("62A2D44A-CBC1-4377-B4B6-28C5C92034A1"); + public Encoding Encoding { get; private set; } + public string Name => "ECMA-67"; + public Guid Id => new Guid("62A2D44A-CBC1-4377-B4B6-28C5C92034A1"); public FileSystemType XmlFsType { get; private set; } public bool Identify(IMediaImage imagePlugin, Partition partition) @@ -59,8 +59,8 @@ namespace DiscImageChef.Filesystems if(sector.Length != 128) return false; - VolumeLabel vol = new VolumeLabel(); - IntPtr volPtr = Marshal.AllocHGlobal(Marshal.SizeOf(vol)); + VolumeLabel vol = new VolumeLabel(); + IntPtr volPtr = Marshal.AllocHGlobal(Marshal.SizeOf(vol)); Marshal.Copy(sector, 0, volPtr, Marshal.SizeOf(vol)); vol = (VolumeLabel)Marshal.PtrToStructure(volPtr, typeof(VolumeLabel)); Marshal.FreeHGlobal(volPtr); @@ -69,15 +69,15 @@ namespace DiscImageChef.Filesystems } public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information, - Encoding encoding) + Encoding encoding) { Encoding = encoding ?? Encoding.GetEncoding("iso-8859-1"); byte[] sector = imagePlugin.ReadSector(6); StringBuilder sbInformation = new StringBuilder(); - VolumeLabel vol = new VolumeLabel(); - IntPtr volPtr = Marshal.AllocHGlobal(Marshal.SizeOf(vol)); + VolumeLabel vol = new VolumeLabel(); + IntPtr volPtr = Marshal.AllocHGlobal(Marshal.SizeOf(vol)); Marshal.Copy(sector, 0, volPtr, Marshal.SizeOf(vol)); vol = (VolumeLabel)Marshal.PtrToStructure(volPtr, typeof(VolumeLabel)); Marshal.FreeHGlobal(volPtr); @@ -89,10 +89,10 @@ namespace DiscImageChef.Filesystems XmlFsType = new FileSystemType { - Type = "ECMA-67", + Type = "ECMA-67", ClusterSize = 256, - Clusters = (long)(partition.End - partition.Start + 1), - VolumeName = Encoding.ASCII.GetString(vol.volumeIdentifier) + Clusters = (long)(partition.End - partition.Start + 1), + VolumeName = Encoding.ASCII.GetString(vol.volumeIdentifier) }; information = sbInformation.ToString(); @@ -101,20 +101,28 @@ namespace DiscImageChef.Filesystems [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; } } } \ No newline at end of file diff --git a/DiscImageChef.Filesystems/EFS.cs b/DiscImageChef.Filesystems/EFS.cs index 2a67f0eb0..ad59467aa 100644 --- a/DiscImageChef.Filesystems/EFS.cs +++ b/DiscImageChef.Filesystems/EFS.cs @@ -43,13 +43,13 @@ namespace DiscImageChef.Filesystems { public class EFS : IFilesystem { - const uint EFS_MAGIC = 0x00072959; + const uint EFS_MAGIC = 0x00072959; const uint EFS_MAGIC_NEW = 0x0007295A; public FileSystemType XmlFsType { get; private set; } - public Encoding Encoding { get; private set; } - public string Name => "Extent File System Plugin"; - public Guid Id => new Guid("52A43F90-9AF3-4391-ADFE-65598DEEABAB"); + public Encoding Encoding { get; private set; } + public string Name => "Extent File System Plugin"; + public Guid Id => new Guid("52A43F90-9AF3-4391-ADFE-65598DEEABAB"); public bool Identify(IMediaImage imagePlugin, Partition partition) { @@ -99,9 +99,9 @@ namespace DiscImageChef.Filesystems } public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information, - Encoding encoding) + Encoding encoding) { - Encoding = encoding ?? Encoding.GetEncoding("iso-8859-15"); + Encoding = encoding ?? Encoding.GetEncoding("iso-8859-15"); information = ""; if(imagePlugin.Info.SectorSize < 512) return; @@ -160,7 +160,7 @@ namespace DiscImageChef.Filesystems 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_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, Encoding)).AppendLine(); sb.AppendFormat("Volume pack: {0}", StringHandlers.CToString(efsSb.sb_fpack, Encoding)).AppendLine(); @@ -169,15 +169,15 @@ namespace DiscImageChef.Filesystems XmlFsType = new FileSystemType { - Type = "Extent File System", - ClusterSize = 512, - Clusters = efsSb.sb_size, - FreeClusters = efsSb.sb_tfree, + Type = "Extent File System", + ClusterSize = 512, + Clusters = efsSb.sb_size, + FreeClusters = efsSb.sb_tfree, FreeClustersSpecified = true, - Dirty = efsSb.sb_dirty > 0, - VolumeName = StringHandlers.CToString(efsSb.sb_fname, Encoding), - VolumeSerial = $"{efsSb.sb_checksum:X8}", - CreationDate = DateHandlers.UnixToDateTime(efsSb.sb_time), + Dirty = efsSb.sb_dirty > 0, + VolumeName = StringHandlers.CToString(efsSb.sb_fname, Encoding), + VolumeSerial = $"{efsSb.sb_checksum:X8}", + CreationDate = DateHandlers.UnixToDateTime(efsSb.sb_time), CreationDateSpecified = true }; } @@ -209,9 +209,11 @@ 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 */ @@ -225,7 +227,8 @@ 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; } diff --git a/DiscImageChef.Filesystems/F2FS.cs b/DiscImageChef.Filesystems/F2FS.cs index 6fa6b4391..7516ab5fb 100644 --- a/DiscImageChef.Filesystems/F2FS.cs +++ b/DiscImageChef.Filesystems/F2FS.cs @@ -42,23 +42,23 @@ namespace DiscImageChef.Filesystems { public class F2FS : IFilesystem { - const uint F2FS_MAGIC = 0xF2F52010; + const uint F2FS_MAGIC = 0xF2F52010; const uint F2FS_SUPER_OFFSET = 1024; - const uint F2FS_MIN_SECTOR = 512; - const uint F2FS_MAX_SECTOR = 4096; - const uint F2FS_BLOCK_SIZE = 4096; + const uint F2FS_MIN_SECTOR = 512; + const uint F2FS_MAX_SECTOR = 4096; + const uint F2FS_BLOCK_SIZE = 4096; public FileSystemType XmlFsType { get; private set; } - public Encoding Encoding { get; private set; } - public string Name => "F2FS Plugin"; - public Guid Id => new Guid("82B0920F-5F0D-4063-9F57-ADE0AE02ECE5"); + public Encoding Encoding { get; private set; } + public string Name => "F2FS Plugin"; + public Guid Id => new Guid("82B0920F-5F0D-4063-9F57-ADE0AE02ECE5"); public bool Identify(IMediaImage imagePlugin, Partition partition) { if(imagePlugin.Info.SectorSize < F2FS_MIN_SECTOR || imagePlugin.Info.SectorSize > F2FS_MAX_SECTOR) return false; - uint sbAddr = F2FS_SUPER_OFFSET / imagePlugin.Info.SectorSize; + uint sbAddr = F2FS_SUPER_OFFSET / imagePlugin.Info.SectorSize; if(sbAddr == 0) sbAddr = 1; F2FS_Superblock f2fsSb = new F2FS_Superblock(); @@ -80,13 +80,13 @@ namespace DiscImageChef.Filesystems } public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information, - Encoding encoding) + Encoding encoding) { - Encoding = Encoding.Unicode; + Encoding = Encoding.Unicode; information = ""; if(imagePlugin.Info.SectorSize < F2FS_MIN_SECTOR || imagePlugin.Info.SectorSize > F2FS_MAX_SECTOR) return; - uint sbAddr = F2FS_SUPER_OFFSET / imagePlugin.Info.SectorSize; + uint sbAddr = F2FS_SUPER_OFFSET / imagePlugin.Info.SectorSize; if(sbAddr == 0) sbAddr = 1; F2FS_Superblock f2fsSb = new F2FS_Superblock(); @@ -110,7 +110,7 @@ namespace DiscImageChef.Filesystems 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(); + 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(); @@ -130,13 +130,13 @@ namespace DiscImageChef.Filesystems XmlFsType = new FileSystemType { - Type = "F2FS filesystem", - SystemIdentifier = Encoding.ASCII.GetString(f2fsSb.version), - Clusters = (long)f2fsSb.block_count, - ClusterSize = 1 << (int)f2fsSb.log_blocksize, + Type = "F2FS filesystem", + SystemIdentifier = Encoding.ASCII.GetString(f2fsSb.version), + Clusters = (long)f2fsSb.block_count, + ClusterSize = 1 << (int)f2fsSb.log_blocksize, DataPreparerIdentifier = Encoding.ASCII.GetString(f2fsSb.init_version), - VolumeName = StringHandlers.CToString(f2fsSb.volume_name, Encoding.Unicode, true), - VolumeSerial = f2fsSb.uuid.ToString() + VolumeName = StringHandlers.CToString(f2fsSb.volume_name, Encoding.Unicode, true), + VolumeSerial = f2fsSb.uuid.ToString() }; } @@ -144,51 +144,64 @@ namespace DiscImageChef.Filesystems [SuppressMessage("ReSharper", "InconsistentNaming")] struct F2FS_Superblock { - public uint magic; + public uint magic; public ushort major_ver; public ushort minor_ver; - public uint log_sectorsize; - public uint log_sectors_per_block; - public uint log_blocksize; - public uint log_blocks_per_seg; - public uint segs_per_sec; - public uint secs_per_zone; - public uint checksum_offset; - public ulong block_count; - public uint section_count; - public uint segment_count; - public uint segment_count_ckpt; - public uint segment_count_sit; - public uint segment_count_nat; - public uint segment_count_ssa; - public uint segment_count_main; - public uint segment0_blkaddr; - public uint cp_blkaddr; - public uint sit_blkaddr; - public uint nat_blkaddr; - public uint ssa_blkaddr; - public uint main_blkaddr; - public uint root_ino; - public uint node_ino; - public uint meta_ino; - public Guid uuid; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 1024)] public byte[] volume_name; + public uint log_sectorsize; + public uint log_sectors_per_block; + public uint log_blocksize; + public uint log_blocks_per_seg; + public uint segs_per_sec; + public uint secs_per_zone; + public uint checksum_offset; + public ulong block_count; + public uint section_count; + public uint segment_count; + public uint segment_count_ckpt; + public uint segment_count_sit; + public uint segment_count_nat; + public uint segment_count_ssa; + public uint segment_count_main; + public uint segment0_blkaddr; + public uint cp_blkaddr; + public uint sit_blkaddr; + public uint nat_blkaddr; + public uint ssa_blkaddr; + public uint main_blkaddr; + public uint root_ino; + public uint node_ino; + public uint meta_ino; + public Guid uuid; + [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; } } } \ No newline at end of file diff --git a/DiscImageChef.Filesystems/FATX.cs b/DiscImageChef.Filesystems/FATX.cs index a1f442b7c..daa14b9f0 100644 --- a/DiscImageChef.Filesystems/FATX.cs +++ b/DiscImageChef.Filesystems/FATX.cs @@ -44,9 +44,9 @@ namespace DiscImageChef.Filesystems const uint FATX_MAGIC = 0x58544146; public FileSystemType XmlFsType { get; private set; } - public Encoding Encoding { get; private set; } - public string Name => "FATX Filesystem Plugin"; - public Guid Id => new Guid("ED27A721-4A17-4649-89FD-33633B46E228"); + public Encoding Encoding { get; private set; } + public string Name => "FATX Filesystem Plugin"; + public Guid Id => new Guid("ED27A721-4A17-4649-89FD-33633B46E228"); public bool Identify(IMediaImage imagePlugin, Partition partition) { @@ -60,9 +60,9 @@ namespace DiscImageChef.Filesystems } public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information, - Encoding encoding) + Encoding encoding) { - Encoding = Encoding.UTF8; + Encoding = Encoding.UTF8; information = ""; if(imagePlugin.Info.SectorSize < 512) return; @@ -84,7 +84,7 @@ namespace DiscImageChef.Filesystems XmlFsType = new FileSystemType { - Type = "FATX filesystem", + Type = "FATX filesystem", ClusterSize = (int)(fatxSb.sectorsPerCluster * imagePlugin.Info.SectorSize) }; XmlFsType.Clusters = (long)((partition.End - partition.Start + 1) * imagePlugin.Info.SectorSize / diff --git a/DiscImageChef.Filesystems/FFS.cs b/DiscImageChef.Filesystems/FFS.cs index 192c8381e..1d74a4e6d 100644 --- a/DiscImageChef.Filesystems/FFS.cs +++ b/DiscImageChef.Filesystems/FFS.cs @@ -81,9 +81,9 @@ namespace DiscImageChef.Filesystems const uint UFS_BAD_CIGAM = 0x08049619; public FileSystemType XmlFsType { get; private set; } - public Encoding Encoding { get; private set; } - public string Name => "BSD Fast File System (aka UNIX File System, UFS)"; - public Guid Id => new Guid("CC90D342-05DB-48A8-988C-C1FE000034A3"); + public Encoding Encoding { get; private set; } + public string Name => "BSD Fast File System (aka UNIX File System, UFS)"; + public Guid Id => new Guid("CC90D342-05DB-48A8-988C-C1FE000034A3"); public bool Identify(IMediaImage imagePlugin, Partition partition) { @@ -93,59 +93,59 @@ namespace DiscImageChef.Filesystems if(imagePlugin.Info.SectorSize == 2336 || imagePlugin.Info.SectorSize == 2352 || imagePlugin.Info.SectorSize == 2448) sbSizeInSectors = block_size / 2048; - else sbSizeInSectors = block_size / imagePlugin.Info.SectorSize; + else sbSizeInSectors = block_size / imagePlugin.Info.SectorSize; ulong[] locations = { sb_start_floppy, sb_start_boot, sb_start_long_boot, sb_start_piggy, sb_start_att_dsdd, - 8192 / imagePlugin.Info.SectorSize, 65536 / imagePlugin.Info.SectorSize, + 8192 / imagePlugin.Info.SectorSize, 65536 / imagePlugin.Info.SectorSize, 262144 / imagePlugin.Info.SectorSize }; return locations.Where(loc => partition.End > partition.Start + loc + sbSizeInSectors) .Select(loc => imagePlugin.ReadSectors(partition.Start + loc, sbSizeInSectors)) .Select(ufsSbSectors => BitConverter.ToUInt32(ufsSbSectors, 0x055C)) - .Any(magic => magic == UFS_MAGIC || magic == UFS_CIGAM || magic == UFS_MAGIC_BW || - magic == UFS_CIGAM_BW || magic == UFS2_MAGIC || magic == UFS2_CIGAM || + .Any(magic => 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); } public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information, - Encoding encoding) + Encoding encoding) { - Encoding = encoding ?? Encoding.GetEncoding("iso-8859-15"); + Encoding = encoding ?? Encoding.GetEncoding("iso-8859-15"); information = ""; StringBuilder sbInformation = new StringBuilder(); - uint magic = 0; - uint sb_size_in_sectors; + uint magic = 0; + uint sb_size_in_sectors; byte[] ufs_sb_sectors; - ulong sb_offset = partition.Start; - bool fs_type_42bsd = false; - bool fs_type_43bsd = false; - bool fs_type_44bsd = false; - bool fs_type_ufs = false; - bool fs_type_ufs2 = false; - bool fs_type_sun = false; - bool fs_type_sun86 = false; + ulong sb_offset = partition.Start; + bool fs_type_42bsd = false; + bool fs_type_43bsd = false; + bool fs_type_44bsd = false; + bool fs_type_ufs = false; + bool fs_type_ufs2 = false; + bool fs_type_sun = false; + bool fs_type_sun86 = false; if(imagePlugin.Info.SectorSize == 2336 || imagePlugin.Info.SectorSize == 2352 || imagePlugin.Info.SectorSize == 2448) sb_size_in_sectors = block_size / 2048; - else sb_size_in_sectors = block_size / imagePlugin.Info.SectorSize; + else sb_size_in_sectors = block_size / imagePlugin.Info.SectorSize; ulong[] locations = { sb_start_floppy, sb_start_boot, sb_start_long_boot, sb_start_piggy, sb_start_att_dsdd, - 8192 / imagePlugin.Info.SectorSize, 65536 / imagePlugin.Info.SectorSize, + 8192 / imagePlugin.Info.SectorSize, 65536 / imagePlugin.Info.SectorSize, 262144 / imagePlugin.Info.SectorSize }; foreach(ulong loc in locations.Where(loc => partition.End > partition.Start + loc + sb_size_in_sectors)) { ufs_sb_sectors = imagePlugin.ReadSectors(partition.Start + loc, sb_size_in_sectors); - magic = BitConverter.ToUInt32(ufs_sb_sectors, 0x055C); + magic = BitConverter.ToUInt32(ufs_sb_sectors, 0x055C); - if(magic == UFS_MAGIC || magic == UFS_CIGAM || magic == UFS_MAGIC_BW || magic == UFS_CIGAM_BW || + 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; @@ -210,65 +210,65 @@ namespace DiscImageChef.Filesystems Marshal.FreeHGlobal(sbPtr); UFSSuperBlock bs_sfu = BigEndianMarshal.ByteArrayToStructureBigEndian(ufs_sb_sectors); - if(bs_sfu.fs_magic == UFS_MAGIC && ufs_sb.fs_magic == UFS_CIGAM || - bs_sfu.fs_magic == UFS_MAGIC_BW && ufs_sb.fs_magic == UFS_CIGAM_BW || - bs_sfu.fs_magic == UFS2_MAGIC && ufs_sb.fs_magic == UFS2_CIGAM || + if(bs_sfu.fs_magic == UFS_MAGIC && ufs_sb.fs_magic == UFS_CIGAM || + bs_sfu.fs_magic == UFS_MAGIC_BW && ufs_sb.fs_magic == UFS_CIGAM_BW || + bs_sfu.fs_magic == UFS2_MAGIC && ufs_sb.fs_magic == UFS2_CIGAM || bs_sfu.fs_magic == UFS_BAD_MAGIC && ufs_sb.fs_magic == UFS_BAD_CIGAM) { - ufs_sb = bs_sfu; - ufs_sb.fs_old_cstotal.cs_nbfree = Swapping.Swap(ufs_sb.fs_old_cstotal.cs_nbfree); - ufs_sb.fs_old_cstotal.cs_ndir = Swapping.Swap(ufs_sb.fs_old_cstotal.cs_ndir); - ufs_sb.fs_old_cstotal.cs_nffree = Swapping.Swap(ufs_sb.fs_old_cstotal.cs_nffree); - ufs_sb.fs_old_cstotal.cs_nifree = Swapping.Swap(ufs_sb.fs_old_cstotal.cs_nifree); + ufs_sb = bs_sfu; + ufs_sb.fs_old_cstotal.cs_nbfree = Swapping.Swap(ufs_sb.fs_old_cstotal.cs_nbfree); + ufs_sb.fs_old_cstotal.cs_ndir = Swapping.Swap(ufs_sb.fs_old_cstotal.cs_ndir); + ufs_sb.fs_old_cstotal.cs_nffree = Swapping.Swap(ufs_sb.fs_old_cstotal.cs_nffree); + ufs_sb.fs_old_cstotal.cs_nifree = Swapping.Swap(ufs_sb.fs_old_cstotal.cs_nifree); ufs_sb.fs_cstotal.cs_numclusters = Swapping.Swap(ufs_sb.fs_cstotal.cs_numclusters); - ufs_sb.fs_cstotal.cs_nbfree = Swapping.Swap(ufs_sb.fs_cstotal.cs_nbfree); - ufs_sb.fs_cstotal.cs_ndir = Swapping.Swap(ufs_sb.fs_cstotal.cs_ndir); - ufs_sb.fs_cstotal.cs_nffree = Swapping.Swap(ufs_sb.fs_cstotal.cs_nffree); - ufs_sb.fs_cstotal.cs_nifree = Swapping.Swap(ufs_sb.fs_cstotal.cs_nifree); - ufs_sb.fs_cstotal.cs_spare[0] = Swapping.Swap(ufs_sb.fs_cstotal.cs_spare[0]); - ufs_sb.fs_cstotal.cs_spare[1] = Swapping.Swap(ufs_sb.fs_cstotal.cs_spare[1]); - ufs_sb.fs_cstotal.cs_spare[2] = Swapping.Swap(ufs_sb.fs_cstotal.cs_spare[2]); + ufs_sb.fs_cstotal.cs_nbfree = Swapping.Swap(ufs_sb.fs_cstotal.cs_nbfree); + ufs_sb.fs_cstotal.cs_ndir = Swapping.Swap(ufs_sb.fs_cstotal.cs_ndir); + ufs_sb.fs_cstotal.cs_nffree = Swapping.Swap(ufs_sb.fs_cstotal.cs_nffree); + ufs_sb.fs_cstotal.cs_nifree = Swapping.Swap(ufs_sb.fs_cstotal.cs_nifree); + ufs_sb.fs_cstotal.cs_spare[0] = Swapping.Swap(ufs_sb.fs_cstotal.cs_spare[0]); + ufs_sb.fs_cstotal.cs_spare[1] = Swapping.Swap(ufs_sb.fs_cstotal.cs_spare[1]); + ufs_sb.fs_cstotal.cs_spare[2] = Swapping.Swap(ufs_sb.fs_cstotal.cs_spare[2]); } DicConsole.DebugWriteLine("FFS plugin", "ufs_sb offset: 0x{0:X8}", sb_offset); - DicConsole.DebugWriteLine("FFS plugin", "fs_rlink: 0x{0:X8}", ufs_sb.fs_rlink); - DicConsole.DebugWriteLine("FFS plugin", "fs_sblkno: 0x{0:X8}", ufs_sb.fs_sblkno); - DicConsole.DebugWriteLine("FFS plugin", "fs_cblkno: 0x{0:X8}", ufs_sb.fs_cblkno); - DicConsole.DebugWriteLine("FFS plugin", "fs_iblkno: 0x{0:X8}", ufs_sb.fs_iblkno); - DicConsole.DebugWriteLine("FFS plugin", "fs_dblkno: 0x{0:X8}", ufs_sb.fs_dblkno); - DicConsole.DebugWriteLine("FFS plugin", "fs_size: 0x{0:X8}", ufs_sb.fs_size); - DicConsole.DebugWriteLine("FFS plugin", "fs_dsize: 0x{0:X8}", ufs_sb.fs_dsize); - DicConsole.DebugWriteLine("FFS plugin", "fs_ncg: 0x{0:X8}", ufs_sb.fs_ncg); - DicConsole.DebugWriteLine("FFS plugin", "fs_bsize: 0x{0:X8}", ufs_sb.fs_bsize); - DicConsole.DebugWriteLine("FFS plugin", "fs_fsize: 0x{0:X8}", ufs_sb.fs_fsize); - DicConsole.DebugWriteLine("FFS plugin", "fs_frag: 0x{0:X8}", ufs_sb.fs_frag); - DicConsole.DebugWriteLine("FFS plugin", "fs_minfree: 0x{0:X8}", ufs_sb.fs_minfree); - DicConsole.DebugWriteLine("FFS plugin", "fs_bmask: 0x{0:X8}", ufs_sb.fs_bmask); - DicConsole.DebugWriteLine("FFS plugin", "fs_fmask: 0x{0:X8}", ufs_sb.fs_fmask); - DicConsole.DebugWriteLine("FFS plugin", "fs_bshift: 0x{0:X8}", ufs_sb.fs_bshift); - DicConsole.DebugWriteLine("FFS plugin", "fs_fshift: 0x{0:X8}", ufs_sb.fs_fshift); - DicConsole.DebugWriteLine("FFS plugin", "fs_maxcontig: 0x{0:X8}", ufs_sb.fs_maxcontig); - DicConsole.DebugWriteLine("FFS plugin", "fs_maxbpg: 0x{0:X8}", ufs_sb.fs_maxbpg); - DicConsole.DebugWriteLine("FFS plugin", "fs_fragshift: 0x{0:X8}", ufs_sb.fs_fragshift); - DicConsole.DebugWriteLine("FFS plugin", "fs_fsbtodb: 0x{0:X8}", ufs_sb.fs_fsbtodb); - DicConsole.DebugWriteLine("FFS plugin", "fs_sbsize: 0x{0:X8}", ufs_sb.fs_sbsize); - DicConsole.DebugWriteLine("FFS plugin", "fs_csmask: 0x{0:X8}", ufs_sb.fs_csmask); - DicConsole.DebugWriteLine("FFS plugin", "fs_csshift: 0x{0:X8}", ufs_sb.fs_csshift); - DicConsole.DebugWriteLine("FFS plugin", "fs_nindir: 0x{0:X8}", ufs_sb.fs_nindir); - DicConsole.DebugWriteLine("FFS plugin", "fs_inopb: 0x{0:X8}", ufs_sb.fs_inopb); - DicConsole.DebugWriteLine("FFS plugin", "fs_optim: 0x{0:X8}", ufs_sb.fs_optim); - DicConsole.DebugWriteLine("FFS plugin", "fs_id_1: 0x{0:X8}", ufs_sb.fs_id_1); - DicConsole.DebugWriteLine("FFS plugin", "fs_id_2: 0x{0:X8}", ufs_sb.fs_id_2); - DicConsole.DebugWriteLine("FFS plugin", "fs_csaddr: 0x{0:X8}", ufs_sb.fs_csaddr); - DicConsole.DebugWriteLine("FFS plugin", "fs_cssize: 0x{0:X8}", ufs_sb.fs_cssize); - DicConsole.DebugWriteLine("FFS plugin", "fs_cgsize: 0x{0:X8}", ufs_sb.fs_cgsize); - DicConsole.DebugWriteLine("FFS plugin", "fs_ipg: 0x{0:X8}", ufs_sb.fs_ipg); - DicConsole.DebugWriteLine("FFS plugin", "fs_fpg: 0x{0:X8}", ufs_sb.fs_fpg); - DicConsole.DebugWriteLine("FFS plugin", "fs_fmod: 0x{0:X2}", ufs_sb.fs_fmod); - DicConsole.DebugWriteLine("FFS plugin", "fs_clean: 0x{0:X2}", ufs_sb.fs_clean); - DicConsole.DebugWriteLine("FFS plugin", "fs_ronly: 0x{0:X2}", ufs_sb.fs_ronly); - 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); + DicConsole.DebugWriteLine("FFS plugin", "fs_rlink: 0x{0:X8}", ufs_sb.fs_rlink); + DicConsole.DebugWriteLine("FFS plugin", "fs_sblkno: 0x{0:X8}", ufs_sb.fs_sblkno); + DicConsole.DebugWriteLine("FFS plugin", "fs_cblkno: 0x{0:X8}", ufs_sb.fs_cblkno); + DicConsole.DebugWriteLine("FFS plugin", "fs_iblkno: 0x{0:X8}", ufs_sb.fs_iblkno); + DicConsole.DebugWriteLine("FFS plugin", "fs_dblkno: 0x{0:X8}", ufs_sb.fs_dblkno); + DicConsole.DebugWriteLine("FFS plugin", "fs_size: 0x{0:X8}", ufs_sb.fs_size); + DicConsole.DebugWriteLine("FFS plugin", "fs_dsize: 0x{0:X8}", ufs_sb.fs_dsize); + DicConsole.DebugWriteLine("FFS plugin", "fs_ncg: 0x{0:X8}", ufs_sb.fs_ncg); + DicConsole.DebugWriteLine("FFS plugin", "fs_bsize: 0x{0:X8}", ufs_sb.fs_bsize); + DicConsole.DebugWriteLine("FFS plugin", "fs_fsize: 0x{0:X8}", ufs_sb.fs_fsize); + DicConsole.DebugWriteLine("FFS plugin", "fs_frag: 0x{0:X8}", ufs_sb.fs_frag); + DicConsole.DebugWriteLine("FFS plugin", "fs_minfree: 0x{0:X8}", ufs_sb.fs_minfree); + DicConsole.DebugWriteLine("FFS plugin", "fs_bmask: 0x{0:X8}", ufs_sb.fs_bmask); + DicConsole.DebugWriteLine("FFS plugin", "fs_fmask: 0x{0:X8}", ufs_sb.fs_fmask); + DicConsole.DebugWriteLine("FFS plugin", "fs_bshift: 0x{0:X8}", ufs_sb.fs_bshift); + DicConsole.DebugWriteLine("FFS plugin", "fs_fshift: 0x{0:X8}", ufs_sb.fs_fshift); + DicConsole.DebugWriteLine("FFS plugin", "fs_maxcontig: 0x{0:X8}", ufs_sb.fs_maxcontig); + DicConsole.DebugWriteLine("FFS plugin", "fs_maxbpg: 0x{0:X8}", ufs_sb.fs_maxbpg); + DicConsole.DebugWriteLine("FFS plugin", "fs_fragshift: 0x{0:X8}", ufs_sb.fs_fragshift); + DicConsole.DebugWriteLine("FFS plugin", "fs_fsbtodb: 0x{0:X8}", ufs_sb.fs_fsbtodb); + DicConsole.DebugWriteLine("FFS plugin", "fs_sbsize: 0x{0:X8}", ufs_sb.fs_sbsize); + DicConsole.DebugWriteLine("FFS plugin", "fs_csmask: 0x{0:X8}", ufs_sb.fs_csmask); + DicConsole.DebugWriteLine("FFS plugin", "fs_csshift: 0x{0:X8}", ufs_sb.fs_csshift); + DicConsole.DebugWriteLine("FFS plugin", "fs_nindir: 0x{0:X8}", ufs_sb.fs_nindir); + DicConsole.DebugWriteLine("FFS plugin", "fs_inopb: 0x{0:X8}", ufs_sb.fs_inopb); + DicConsole.DebugWriteLine("FFS plugin", "fs_optim: 0x{0:X8}", ufs_sb.fs_optim); + DicConsole.DebugWriteLine("FFS plugin", "fs_id_1: 0x{0:X8}", ufs_sb.fs_id_1); + DicConsole.DebugWriteLine("FFS plugin", "fs_id_2: 0x{0:X8}", ufs_sb.fs_id_2); + DicConsole.DebugWriteLine("FFS plugin", "fs_csaddr: 0x{0:X8}", ufs_sb.fs_csaddr); + DicConsole.DebugWriteLine("FFS plugin", "fs_cssize: 0x{0:X8}", ufs_sb.fs_cssize); + DicConsole.DebugWriteLine("FFS plugin", "fs_cgsize: 0x{0:X8}", ufs_sb.fs_cgsize); + DicConsole.DebugWriteLine("FFS plugin", "fs_ipg: 0x{0:X8}", ufs_sb.fs_ipg); + DicConsole.DebugWriteLine("FFS plugin", "fs_fpg: 0x{0:X8}", ufs_sb.fs_fpg); + DicConsole.DebugWriteLine("FFS plugin", "fs_fmod: 0x{0:X2}", ufs_sb.fs_fmod); + DicConsole.DebugWriteLine("FFS plugin", "fs_clean: 0x{0:X2}", ufs_sb.fs_clean); + DicConsole.DebugWriteLine("FFS plugin", "fs_ronly: 0x{0:X2}", ufs_sb.fs_ronly); + 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; else @@ -286,30 +286,30 @@ namespace DiscImageChef.Filesystems fs_type_43bsd = false; } - if((ufs_sb.fs_maxfilesize & 0xFFFFFFFF) > SunOSEpoch && + if((ufs_sb.fs_maxfilesize & 0xFFFFFFFF) > SunOSEpoch && DateHandlers.UnixUnsignedToDateTime(ufs_sb.fs_maxfilesize & 0xFFFFFFFF) < DateTime.Now) { fs_type_42bsd = false; - fs_type_sun = true; + fs_type_sun = true; fs_type_43bsd = false; } // 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; - fs_type_sun = false; + fs_type_sun = false; fs_type_43bsd = false; } if(ufs_sb.fs_cgrotor > 0x00000000 && (uint)ufs_sb.fs_cgrotor < 0xFFFFFFFF) { fs_type_42bsd = false; - fs_type_sun = false; + fs_type_sun = false; fs_type_sun86 = false; - fs_type_ufs = true; + fs_type_ufs = true; fs_type_43bsd = false; } @@ -324,7 +324,7 @@ namespace DiscImageChef.Filesystems { 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"); + .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"); @@ -343,11 +343,11 @@ namespace DiscImageChef.Filesystems 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(); - XmlFsType.ModificationDate = DateHandlers.UnixToDateTime(ufs_sb.fs_old_time); + 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(); - XmlFsType.Clusters = ufs_sb.fs_old_size; + XmlFsType.Clusters = ufs_sb.fs_old_size; XmlFsType.ClusterSize = 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(); @@ -395,6 +395,7 @@ namespace DiscImageChef.Filesystems sbInformation.AppendFormat("{0} µsec for head switch", ufs_sb.fs_id_1).AppendLine(); sbInformation.AppendFormat("{0} µsec for track-to-track seek", ufs_sb.fs_id_2).AppendLine(); } + sbInformation.AppendFormat("Cylinder group summary LBA: {0}", ufs_sb.fs_old_csaddr).AppendLine(); sbInformation.AppendFormat("{0} bytes in cylinder group summary", ufs_sb.fs_cssize).AppendLine(); sbInformation.AppendFormat("{0} bytes in cylinder group", ufs_sb.fs_cgsize).AppendLine(); @@ -408,7 +409,7 @@ namespace DiscImageChef.Filesystems 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(); - XmlFsType.FreeClusters = ufs_sb.fs_old_cstotal.cs_nbfree; + 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(); sbInformation.AppendFormat("{0} free frags", ufs_sb.fs_old_cstotal.cs_nffree).AppendLine(); @@ -417,6 +418,7 @@ 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"); sbInformation.AppendFormat("Volume flags: 0x{0:X2}", ufs_sb.fs_flags).AppendLine(); @@ -438,25 +440,26 @@ namespace DiscImageChef.Filesystems 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(); - XmlFsType.FreeClusters = ufs_sb.fs_cstotal.cs_nbfree; + XmlFsType.FreeClusters = 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(); - XmlFsType.ModificationDate = DateHandlers.UnixToDateTime(ufs_sb.fs_time); + 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(); XmlFsType.Clusters = ufs_sb.fs_size; sbInformation - .AppendFormat("{0} data blocks ({1} bytes)", ufs_sb.fs_dsize, ufs_sb.fs_dsize * ufs_sb.fs_fsize) - .AppendLine(); + .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(); @@ -470,6 +473,7 @@ namespace DiscImageChef.Filesystems 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(); if(ufs_sb.fs_old_rotbloff > 0) @@ -505,7 +509,8 @@ namespace DiscImageChef.Filesystems /// number of free clusters public long cs_numclusters; /// future expansion - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] public long[] cs_spare; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] + public long[] cs_spare; } [StructLayout(LayoutKind.Sequential, Pack = 1)] @@ -644,9 +649,11 @@ namespace DiscImageChef.Filesystems /// old FS_ flags public sbyte fs_old_flags; /// name mounted on - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 468)] public byte[] fs_fsmnt; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 468)] + public byte[] fs_fsmnt; /// volume name - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] public byte[] fs_volname; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] + public byte[] fs_volname; /// system-wide uid public ulong fs_swuid; /// due to alignment of fs_swuid @@ -655,7 +662,8 @@ namespace DiscImageChef.Filesystems /// last cg searched public int fs_cgrotor; /// padding; was list of fs_cs buffers - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 28)] public uint[] fs_ocsp; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 28)] + public uint[] fs_ocsp; /// (u) # of contig. allocated dirs public uint fs_contigdirs; /// (u) cg summary info buffer @@ -675,7 +683,8 @@ namespace DiscImageChef.Filesystems /// size of area reserved for metadata public long fs_metaspace; /// old rotation block list head - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 14)] public long[] fs_sparecon64; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 14)] + public long[] fs_sparecon64; /// byte offset of standard superblock public long fs_sblockloc; /// (u) cylinder summary information @@ -693,7 +702,8 @@ namespace DiscImageChef.Filesystems /// (u) inodes being freed public uint fs_pendinginodes; /// list of snapshot inode numbers - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 20)] public uint[] fs_snapinum; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 20)] + public uint[] fs_snapinum; /// expected average file size public uint fs_avgfilesize; /// expected # of files per directory @@ -705,7 +715,8 @@ namespace DiscImageChef.Filesystems /// SUJ free list public int fs_sujfree; /// reserved for future constants - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 23)] public int[] fs_sparecon32; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 23)] + public int[] fs_sparecon32; /// see FS_ flags below public int fs_flags; /// size of cluster summary array @@ -733,7 +744,8 @@ namespace DiscImageChef.Filesystems /// magic number public uint fs_magic; /// list of blocks for each rotation - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 1)] public byte[] fs_rotbl; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 1)] + public byte[] fs_rotbl; } } } \ No newline at end of file diff --git a/DiscImageChef.Filesystems/Fossil.cs b/DiscImageChef.Filesystems/Fossil.cs index 722c0b69e..dae9cb63a 100644 --- a/DiscImageChef.Filesystems/Fossil.cs +++ b/DiscImageChef.Filesystems/Fossil.cs @@ -43,14 +43,14 @@ namespace DiscImageChef.Filesystems public class Fossil : IFilesystem { const uint FOSSIL_HDR_MAGIC = 0x3776AE89; - const uint FOSSIL_SB_MAGIC = 0x2340A3B1; + const uint FOSSIL_SB_MAGIC = 0x2340A3B1; // Fossil header starts at 128KiB const ulong HEADER_POS = 128 * 1024; public FileSystemType XmlFsType { get; private set; } - public Encoding Encoding { get; private set; } - public string Name => "Fossil Filesystem Plugin"; - public Guid Id => new Guid("932BF104-43F6-494F-973C-45EF58A51DA9"); + public Encoding Encoding { get; private set; } + public string Name => "Fossil Filesystem Plugin"; + public Guid Id => new Guid("932BF104-43F6-494F-973C-45EF58A51DA9"); public bool Identify(IMediaImage imagePlugin, Partition partition) { @@ -58,8 +58,8 @@ namespace DiscImageChef.Filesystems if(partition.Start + hdrSector > imagePlugin.Info.Sectors) return false; - byte[] sector = imagePlugin.ReadSector(partition.Start + hdrSector); - FossilHeader hdr = BigEndianMarshal.ByteArrayToStructureBigEndian(sector); + byte[] sector = imagePlugin.ReadSector(partition.Start + hdrSector); + FossilHeader hdr = BigEndianMarshal.ByteArrayToStructureBigEndian(sector); DicConsole.DebugWriteLine("Fossil plugin", "magic at 0x{0:X8} (expected 0x{1:X8})", hdr.magic, FOSSIL_HDR_MAGIC); @@ -68,17 +68,17 @@ namespace DiscImageChef.Filesystems } public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information, - Encoding encoding) + Encoding encoding) { // Technically everything on Plan 9 from Bell Labs is in UTF-8 - Encoding = Encoding.UTF8; + Encoding = Encoding.UTF8; information = ""; if(imagePlugin.Info.SectorSize < 512) return; ulong hdrSector = HEADER_POS / imagePlugin.Info.SectorSize; - byte[] sector = imagePlugin.ReadSector(partition.Start + hdrSector); - FossilHeader hdr = BigEndianMarshal.ByteArrayToStructureBigEndian(sector); + byte[] sector = imagePlugin.ReadSector(partition.Start + hdrSector); + FossilHeader hdr = BigEndianMarshal.ByteArrayToStructureBigEndian(sector); DicConsole.DebugWriteLine("Fossil plugin", "magic at 0x{0:X8} (expected 0x{1:X8})", hdr.magic, FOSSIL_HDR_MAGIC); @@ -97,9 +97,9 @@ namespace DiscImageChef.Filesystems XmlFsType = new FileSystemType { - Type = "Fossil filesystem", + Type = "Fossil filesystem", ClusterSize = hdr.blockSize, - Clusters = hdr.end + Clusters = hdr.end }; if(sbLocation <= partition.End) @@ -197,11 +197,13 @@ namespace DiscImageChef.Filesystems /// /// Venti score of last successful archive /// - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 20)] public byte[] last; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 20)] + public byte[] last; /// /// name of file system(just a comment) /// - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] public byte[] name; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] + public byte[] name; } } } \ No newline at end of file diff --git a/DiscImageChef.Filesystems/HAMMER.cs b/DiscImageChef.Filesystems/HAMMER.cs index 9acba33ca..16f63f2b7 100644 --- a/DiscImageChef.Filesystems/HAMMER.cs +++ b/DiscImageChef.Filesystems/HAMMER.cs @@ -47,15 +47,15 @@ namespace DiscImageChef.Filesystems { public class HAMMER : IFilesystem { - const ulong HAMMER_FSBUF_VOLUME = 0xC8414D4DC5523031; + const ulong HAMMER_FSBUF_VOLUME = 0xC8414D4DC5523031; const ulong HAMMER_FSBUF_VOLUME_REV = 0x313052C54D4D41C8; - const uint HAMMER_VOLHDR_SIZE = 1928; - const int HAMMER_BIGBLOCK_SIZE = 8192 * 1024; + const uint HAMMER_VOLHDR_SIZE = 1928; + const int HAMMER_BIGBLOCK_SIZE = 8192 * 1024; public FileSystemType XmlFsType { get; private set; } - public Encoding Encoding { get; private set; } - public string Name => "HAMMER Filesystem"; - public Guid Id => new Guid("91A188BF-5FD7-4677-BBD3-F59EBA9C864D"); + public Encoding Encoding { get; private set; } + public string Name => "HAMMER Filesystem"; + public Guid Id => new Guid("91A188BF-5FD7-4677-BBD3-F59EBA9C864D"); public bool Identify(IMediaImage imagePlugin, Partition partition) { @@ -73,9 +73,9 @@ namespace DiscImageChef.Filesystems } public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information, - Encoding encoding) + Encoding encoding) { - Encoding = encoding ?? Encoding.GetEncoding("iso-8859-15"); + Encoding = encoding ?? Encoding.GetEncoding("iso-8859-15"); information = ""; StringBuilder sb = new StringBuilder(); @@ -114,11 +114,11 @@ namespace DiscImageChef.Filesystems XmlFsType = new FileSystemType { - Clusters = (long)(partition.Size / HAMMER_BIGBLOCK_SIZE), - ClusterSize = HAMMER_BIGBLOCK_SIZE, - Dirty = false, - Type = "HAMMER", - VolumeName = StringHandlers.CToString(hammerSb.vol_label, Encoding), + Clusters = (long)(partition.Size / HAMMER_BIGBLOCK_SIZE), + ClusterSize = HAMMER_BIGBLOCK_SIZE, + Dirty = false, + Type = "HAMMER", + VolumeName = StringHandlers.CToString(hammerSb.vol_label, Encoding), VolumeSerial = hammerSb.vol_fsid.ToString() }; @@ -130,11 +130,11 @@ namespace DiscImageChef.Filesystems hammerSb.vol0_stat_freebigblocks * HAMMER_BIGBLOCK_SIZE).AppendLine(); sb.AppendFormat("Filesystem has {0} inode used", hammerSb.vol0_stat_inodes).AppendLine(); - XmlFsType.Clusters = hammerSb.vol0_stat_bigblocks; - XmlFsType.FreeClusters = hammerSb.vol0_stat_freebigblocks; + XmlFsType.Clusters = hammerSb.vol0_stat_bigblocks; + XmlFsType.FreeClusters = hammerSb.vol0_stat_freebigblocks; XmlFsType.FreeClustersSpecified = true; - XmlFsType.Files = hammerSb.vol0_stat_inodes; - XmlFsType.FilesSpecified = true; + XmlFsType.Files = hammerSb.vol0_stat_inodes; + XmlFsType.FilesSpecified = true; } // 0 ? //sb.AppendFormat("Volume header CRC: 0x{0:X8}", afs_sb.vol_crc).AppendLine(); @@ -168,7 +168,8 @@ namespace DiscImageChef.Filesystems /// identify filesystem type public Guid vol_fstype; /// filesystem label - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 64)] public byte[] vol_label; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 64)] + public byte[] vol_label; /// volume number within filesystem public int vol_no; @@ -184,7 +185,8 @@ namespace DiscImageChef.Filesystems /// the root volume number (must be 0) 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 @@ -211,10 +213,12 @@ namespace DiscImageChef.Filesystems /// Blockmaps for zones. Not all zones use a blockmap. Note that the entire root blockmap is cached in the /// hammer_mount structure. /// - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] public HammerBlockMap[] vol0_blockmap; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] + public HammerBlockMap[] vol0_blockmap; /// Array of zone-2 addresses for undo FIFO. - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] public hammer_off_t[] vol0_undo_array; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] + public hammer_off_t[] vol0_undo_array; } [SuppressMessage("ReSharper", "InconsistentNaming")] @@ -229,7 +233,7 @@ namespace DiscImageChef.Filesystems public hammer_off_t next_offset; /// zone-X offset only used by zone-3 public hammer_off_t alloc_offset; - public uint reserved01; + public uint reserved01; public hammer_crc_t entry_crc; } } diff --git a/DiscImageChef.Filesystems/HPFS.cs b/DiscImageChef.Filesystems/HPFS.cs index fabfd2edc..20d7e0bf6 100644 --- a/DiscImageChef.Filesystems/HPFS.cs +++ b/DiscImageChef.Filesystems/HPFS.cs @@ -103,7 +103,7 @@ namespace DiscImageChef.Filesystems sb.AppendFormat("Spareblock magic2: 0x{0:X8} (Should be 0xFA5229C5)", hpfsSp.magic2).AppendLine(); } - sb.AppendFormat("OEM name: {0}", StringHandlers.CToString(hpfsBpb.oem_name)).AppendLine(); + sb.AppendFormat("OEM name: {0}", StringHandlers.CToString(hpfsBpb.oem_name)).AppendLine(); sb.AppendFormat("{0} bytes per sector", hpfsBpb.bps).AppendLine(); // sb.AppendFormat("{0} sectors per cluster", hpfs_bpb.spc).AppendLine(); // sb.AppendFormat("{0} reserved sectors", hpfs_bpb.rsectors).AppendLine(); @@ -114,70 +114,63 @@ namespace DiscImageChef.Filesystems // sb.AppendFormat("{0} sectors per FAT", hpfs_bpb.spfat).AppendLine(); // 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", hpfsBpb.hsectors).AppendLine(); + sb.AppendFormat("{0} sectors hidden before BPB", hpfsBpb.hsectors).AppendLine(); sb.AppendFormat("{0} sectors on volume ({1} bytes)", hpfsSb.sectors, hpfsSb.sectors * hpfsBpb.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}", hpfsBpb.drive_no).AppendLine(); - sb.AppendFormat("NT Flags: 0x{0:X2}", hpfsBpb.nt_flags).AppendLine(); - sb.AppendFormat("Signature: 0x{0:X2}", hpfsBpb.signature).AppendLine(); - sb.AppendFormat("Serial number: 0x{0:X8}", hpfsBpb.serial_no).AppendLine(); - sb.AppendFormat("Volume label: {0}", StringHandlers.CToString(hpfsBpb.volume_label, Encoding)) - .AppendLine(); + sb.AppendFormat("NT Flags: 0x{0:X2}", hpfsBpb.nt_flags).AppendLine(); + sb.AppendFormat("Signature: 0x{0:X2}", hpfsBpb.signature).AppendLine(); + sb.AppendFormat("Serial number: 0x{0:X8}", hpfsBpb.serial_no).AppendLine(); + sb.AppendFormat("Volume label: {0}", StringHandlers.CToString(hpfsBpb.volume_label, Encoding)).AppendLine(); // sb.AppendFormat("Filesystem type: \"{0}\"", hpfs_bpb.fs_type).AppendLine(); DateTime lastChk = DateHandlers.UnixToDateTime(hpfsSb.last_chkdsk); DateTime lastOptim = DateHandlers.UnixToDateTime(hpfsSb.last_optim); - sb.AppendFormat("HPFS version: {0}", hpfsSb.version) - .AppendLine(); - sb.AppendFormat("Functional version: {0}", hpfsSb.func_version) - .AppendLine(); - sb.AppendFormat("Sector of root directory FNode: {0}", hpfsSb.root_fnode) - .AppendLine(); - sb.AppendFormat("{0} sectors are marked bad", hpfsSb.badblocks) - .AppendLine(); - sb.AppendFormat("Sector of free space bitmaps: {0}", hpfsSb.bitmap_lsn) - .AppendLine(); - sb.AppendFormat("Sector of bad blocks list: {0}", hpfsSb.badblock_lsn) - .AppendLine(); + sb.AppendFormat("HPFS version: {0}", hpfsSb.version).AppendLine(); + sb.AppendFormat("Functional version: {0}", hpfsSb.func_version).AppendLine(); + sb.AppendFormat("Sector of root directory FNode: {0}", hpfsSb.root_fnode).AppendLine(); + sb.AppendFormat("{0} sectors are marked bad", hpfsSb.badblocks).AppendLine(); + sb.AppendFormat("Sector of free space bitmaps: {0}", hpfsSb.bitmap_lsn).AppendLine(); + sb.AppendFormat("Sector of bad blocks list: {0}", hpfsSb.badblock_lsn).AppendLine(); if(hpfsSb.last_chkdsk > 0) sb.AppendFormat("Date of last integrity check: {0}", lastChk).AppendLine(); else sb.AppendLine("Filesystem integrity has never been checked"); if(hpfsSb.last_optim > 0) sb.AppendFormat("Date of last optimization {0}", lastOptim).AppendLine(); else sb.AppendLine("Filesystem has never been optimized"); - sb.AppendFormat("Directory band has {0} sectors", hpfsSb.dband_sectors).AppendLine(); - sb.AppendFormat("Directory band starts at sector {0}", hpfsSb.dband_start).AppendLine(); - sb.AppendFormat("Directory band ends at sector {0}", hpfsSb.dband_last).AppendLine(); + sb.AppendFormat("Directory band has {0} sectors", hpfsSb.dband_sectors).AppendLine(); + sb.AppendFormat("Directory band starts at sector {0}", hpfsSb.dband_start).AppendLine(); + sb.AppendFormat("Directory band ends at sector {0}", hpfsSb.dband_last).AppendLine(); sb.AppendFormat("Sector of directory band bitmap: {0}", hpfsSb.dband_bitmap).AppendLine(); - sb.AppendFormat("Sector of ACL directory: {0}", hpfsSb.acl_start).AppendLine(); + sb.AppendFormat("Sector of ACL directory: {0}", hpfsSb.acl_start).AppendLine(); - sb.AppendFormat("Sector of Hotfix directory: {0}", hpfsSp.hotfix_start).AppendLine(); - sb.AppendFormat("{0} used Hotfix entries", hpfsSp.hotfix_used).AppendLine(); - sb.AppendFormat("{0} total Hotfix entries", hpfsSp.hotfix_entries).AppendLine(); - sb.AppendFormat("{0} free spare DNodes", hpfsSp.spare_dnodes_free).AppendLine(); - sb.AppendFormat("{0} total spare DNodes", hpfsSp.spare_dnodes).AppendLine(); + sb.AppendFormat("Sector of Hotfix directory: {0}", hpfsSp.hotfix_start).AppendLine(); + sb.AppendFormat("{0} used Hotfix entries", hpfsSp.hotfix_used).AppendLine(); + sb.AppendFormat("{0} total Hotfix entries", hpfsSp.hotfix_entries).AppendLine(); + sb.AppendFormat("{0} free spare DNodes", hpfsSp.spare_dnodes_free).AppendLine(); + sb.AppendFormat("{0} total spare DNodes", hpfsSp.spare_dnodes).AppendLine(); sb.AppendFormat("Sector of codepage directory: {0}", hpfsSp.codepage_lsn).AppendLine(); - sb.AppendFormat("{0} codepages used in the volume", hpfsSp.codepages).AppendLine(); - sb.AppendFormat("SuperBlock CRC32: {0:X8}", hpfsSp.sb_crc32).AppendLine(); - sb.AppendFormat("SpareBlock CRC32: {0:X8}", hpfsSp.sp_crc32).AppendLine(); + sb.AppendFormat("{0} codepages used in the volume", hpfsSp.codepages).AppendLine(); + sb.AppendFormat("SuperBlock CRC32: {0:X8}", hpfsSp.sb_crc32).AppendLine(); + sb.AppendFormat("SpareBlock CRC32: {0:X8}", hpfsSp.sp_crc32).AppendLine(); sb.AppendLine("Flags:"); sb.AppendLine((hpfsSp.flags1 & 0x01) == 0x01 ? "Filesystem is dirty." : "Filesystem is clean."); - if((hpfsSp.flags1 & 0x02) == 0x02) sb.AppendLine("Spare directory blocks are in use"); - if((hpfsSp.flags1 & 0x04) == 0x04) sb.AppendLine("Hotfixes are in use"); - if((hpfsSp.flags1 & 0x08) == 0x08) sb.AppendLine("Disk contains bad sectors"); - if((hpfsSp.flags1 & 0x10) == 0x10) sb.AppendLine("Disk has a bad bitmap"); - if((hpfsSp.flags1 & 0x20) == 0x20) sb.AppendLine("Filesystem was formatted fast"); - if((hpfsSp.flags1 & 0x40) == 0x40) sb.AppendLine("Unknown flag 0x40 on flags1 is active"); - if((hpfsSp.flags1 & 0x80) == 0x80) sb.AppendLine("Filesystem has been mounted by an old IFS"); - if((hpfsSp.flags2 & 0x01) == 0x01) sb.AppendLine("Install DASD limits"); - if((hpfsSp.flags2 & 0x02) == 0x02) sb.AppendLine("Resync DASD limits"); - if((hpfsSp.flags2 & 0x04) == 0x04) sb.AppendLine("DASD limits are operational"); - if((hpfsSp.flags2 & 0x08) == 0x08) sb.AppendLine("Multimedia is active"); - if((hpfsSp.flags2 & 0x10) == 0x10) sb.AppendLine("DCE ACLs are active"); - if((hpfsSp.flags2 & 0x20) == 0x20) sb.AppendLine("DASD limits are dirty"); - if((hpfsSp.flags2 & 0x40) == 0x40) sb.AppendLine("Unknown flag 0x40 on flags2 is active"); - if((hpfsSp.flags2 & 0x80) == 0x80) sb.AppendLine("Unknown flag 0x80 on flags2 is active"); + if((hpfsSp.flags1 & 0x02) == 0x02) sb.AppendLine("Spare directory blocks are in use"); + if((hpfsSp.flags1 & 0x04) == 0x04) sb.AppendLine("Hotfixes are in use"); + if((hpfsSp.flags1 & 0x08) == 0x08) sb.AppendLine("Disk contains bad sectors"); + if((hpfsSp.flags1 & 0x10) == 0x10) sb.AppendLine("Disk has a bad bitmap"); + if((hpfsSp.flags1 & 0x20) == 0x20) sb.AppendLine("Filesystem was formatted fast"); + if((hpfsSp.flags1 & 0x40) == 0x40) sb.AppendLine("Unknown flag 0x40 on flags1 is active"); + if((hpfsSp.flags1 & 0x80) == 0x80) sb.AppendLine("Filesystem has been mounted by an old IFS"); + if((hpfsSp.flags2 & 0x01) == 0x01) sb.AppendLine("Install DASD limits"); + if((hpfsSp.flags2 & 0x02) == 0x02) sb.AppendLine("Resync DASD limits"); + if((hpfsSp.flags2 & 0x04) == 0x04) sb.AppendLine("DASD limits are operational"); + if((hpfsSp.flags2 & 0x08) == 0x08) sb.AppendLine("Multimedia is active"); + if((hpfsSp.flags2 & 0x10) == 0x10) sb.AppendLine("DCE ACLs are active"); + if((hpfsSp.flags2 & 0x20) == 0x20) sb.AppendLine("DASD limits are dirty"); + if((hpfsSp.flags2 & 0x40) == 0x40) sb.AppendLine("Unknown flag 0x40 on flags2 is active"); + if((hpfsSp.flags2 & 0x80) == 0x80) sb.AppendLine("Unknown flag 0x80 on flags2 is active"); XmlFsType = new FileSystemType(); @@ -185,8 +178,8 @@ namespace DiscImageChef.Filesystems if(hpfsBpb.jump[0] == 0xEB && hpfsBpb.jump[1] > 0x3C && hpfsBpb.jump[1] < 0x80 && hpfsBpb.signature2 == 0xAA55) { - XmlFsType.Bootable = true; - string bootChk = Sha1Context.Data(hpfsBpb.boot_code, out byte[] _); + XmlFsType.Bootable = true; + string bootChk = Sha1Context.Data(hpfsBpb.boot_code, out byte[] _); sb.AppendLine("Volume is bootable"); sb.AppendFormat("Boot code's SHA1: {0}", bootChk).AppendLine(); } diff --git a/DiscImageChef.Filesystems/IFilesystem.cs b/DiscImageChef.Filesystems/IFilesystem.cs index 4c801c1a0..fe074e974 100644 --- a/DiscImageChef.Filesystems/IFilesystem.cs +++ b/DiscImageChef.Filesystems/IFilesystem.cs @@ -31,7 +31,6 @@ // ****************************************************************************/ using System; -using System.Collections.Generic; using System.Text; using DiscImageChef.CommonTypes; using DiscImageChef.DiscImages; diff --git a/DiscImageChef.Filesystems/ISO9660/Consts/AAIP.cs b/DiscImageChef.Filesystems/ISO9660/Consts/AAIP.cs index 3503dd08a..fde3d5457 100644 --- a/DiscImageChef.Filesystems/ISO9660/Consts/AAIP.cs +++ b/DiscImageChef.Filesystems/ISO9660/Consts/AAIP.cs @@ -36,7 +36,7 @@ namespace DiscImageChef.Filesystems.ISO9660 { public partial class ISO9660 { - const ushort AAIP_MAGIC = 0x414C; // "AL" + const ushort AAIP_MAGIC = 0x414C; // "AL" const ushort AAIP_MAGIC_OLD = 0x4141; // "AA" [Flags] diff --git a/DiscImageChef.Filesystems/ISO9660/Consts/Amiga.cs b/DiscImageChef.Filesystems/ISO9660/Consts/Amiga.cs index 143bce65a..c5a310df9 100644 --- a/DiscImageChef.Filesystems/ISO9660/Consts/Amiga.cs +++ b/DiscImageChef.Filesystems/ISO9660/Consts/Amiga.cs @@ -41,8 +41,8 @@ namespace DiscImageChef.Filesystems.ISO9660 [Flags] enum AmigaFlags : byte { - Protection = 1 << 0, - Comment = 1 << 1, + Protection = 1 << 0, + Comment = 1 << 1, CommentContinues = 1 << 2 } @@ -50,26 +50,26 @@ namespace DiscImageChef.Filesystems.ISO9660 enum AmigaMultiuser : byte { GroupDelete = 1 << 0, - GroupExec = 1 << 1, - GroupWrite = 1 << 2, - GroupRead = 1 << 3, + GroupExec = 1 << 1, + GroupWrite = 1 << 2, + GroupRead = 1 << 3, OtherDelete = 1 << 4, - OtherExec = 1 << 5, - OtherWrite = 1 << 6, - OtherRead = 1 << 7 + OtherExec = 1 << 5, + OtherWrite = 1 << 6, + OtherRead = 1 << 7 } [Flags] enum AmigaAttributes : byte { OwnerDelete = 1 << 0, - OwnerExec = 1 << 1, - OwnerWrite = 1 << 2, - OwnerRead = 1 << 3, - Archive = 1 << 4, - Reentrant = 1 << 5, - Script = 1 << 6, - Reserved = 1 << 7 + OwnerExec = 1 << 1, + OwnerWrite = 1 << 2, + OwnerRead = 1 << 3, + Archive = 1 << 4, + Reentrant = 1 << 5, + Script = 1 << 6, + 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 9b52d3eba..bdaee0005 100644 --- a/DiscImageChef.Filesystems/ISO9660/Consts/Apple.cs +++ b/DiscImageChef.Filesystems/ISO9660/Consts/Apple.cs @@ -34,23 +34,23 @@ namespace DiscImageChef.Filesystems.ISO9660 { public partial class ISO9660 { - const ushort APPLE_MAGIC = 0x4141; // "AA" + const ushort APPLE_MAGIC = 0x4141; // "AA" const ushort APPLE_MAGIC_OLD = 0x4241; // "BA" enum AppleId : byte { ProDOS = 1, - HFS = 2 + HFS = 2 } enum AppleOldId : byte { - ProDOS = 1, - TypeCreator = 2, - TypeCreatorBundle = 3, - TypeCreatorIcon = 4, + ProDOS = 1, + TypeCreator = 2, + TypeCreatorBundle = 3, + TypeCreatorIcon = 4, TypeCreatorIconBundle = 5, - HFS = 6 + 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 e39bd3335..881db51f3 100644 --- a/DiscImageChef.Filesystems/ISO9660/Consts/CDi.cs +++ b/DiscImageChef.Filesystems/ISO9660/Consts/CDi.cs @@ -54,14 +54,14 @@ namespace DiscImageChef.Filesystems.ISO9660 [Flags] enum CdiAttributes : ushort { - OwnerRead = 1 << 0, + OwnerRead = 1 << 0, OwnerExecute = 1 << 2, - GroupRead = 1 << 4, + GroupRead = 1 << 4, GroupExecute = 1 << 6, - OtherRead = 1 << 8, + OtherRead = 1 << 8, OtherExecute = 1 << 10, DigitalAudio = 1 << 14, - Directory = 1 << 15 + 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 ad172f01e..510f3d4f7 100644 --- a/DiscImageChef.Filesystems/ISO9660/Consts/ElTorito.cs +++ b/DiscImageChef.Filesystems/ISO9660/Consts/ElTorito.cs @@ -36,42 +36,42 @@ namespace DiscImageChef.Filesystems.ISO9660 { public partial class ISO9660 { - const ushort EL_TORITO_MAGIC = 0xAA55; - const int EL_TORITO_ENTRY_SIZE = 32; + const ushort EL_TORITO_MAGIC = 0xAA55; + const int EL_TORITO_ENTRY_SIZE = 32; enum ElToritoIndicator : byte { - Header = 1, - Extension = 0x44, - Bootable = 0x88, + Header = 1, + Extension = 0x44, + Bootable = 0x88, MoreHeaders = 0x90, - LastHeader = 0x91 + LastHeader = 0x91 } enum ElToritoPlatform : byte { - x86 = 0, - PowerPC = 1, + x86 = 0, + PowerPC = 1, Macintosh = 2, - EFI = 0xef + EFI = 0xef } enum ElToritoEmulation : byte { - None = 0, + None = 0, Md2hd = 1, Mf2hd = 2, Mf2ed = 3, - Hdd = 4 + Hdd = 4 } [Flags] enum ElToritoFlags : byte { - Reserved = 0x10, + Reserved = 0x10, Continued = 0x20, - ATAPI = 0x40, - SCSI = 0x08 + ATAPI = 0x40, + SCSI = 0x08 } } } \ No newline at end of file diff --git a/DiscImageChef.Filesystems/ISO9660/Consts/ISO.cs b/DiscImageChef.Filesystems/ISO9660/Consts/ISO.cs index 9ac442612..8462d58bf 100644 --- a/DiscImageChef.Filesystems/ISO9660/Consts/ISO.cs +++ b/DiscImageChef.Filesystems/ISO9660/Consts/ISO.cs @@ -41,39 +41,39 @@ namespace DiscImageChef.Filesystems.ISO9660 [Flags] enum FileFlags : byte { - Hidden = 0x01, - Directory = 0x02, - Associated = 0x04, - Record = 0x08, - Protected = 0x10, + Hidden = 0x01, + Directory = 0x02, + Associated = 0x04, + Record = 0x08, + Protected = 0x10, MultiExtent = 0x80 } [Flags] enum Permissions : ushort { - SystemRead = 0x01, + SystemRead = 0x01, SystemExecute = 0x04, - OwnerRead = 0x10, - OwnerExecute = 0x40, - GroupRead = 0x100, - GroupExecute = 0x400, - OtherRead = 0x1000, - OtherExecute = 0x4000 + OwnerRead = 0x10, + OwnerExecute = 0x40, + GroupRead = 0x100, + GroupExecute = 0x400, + OtherRead = 0x1000, + OtherExecute = 0x4000 } enum RecordFormat : byte { - Unspecified = 0, - FixedLength = 1, - VariableLength = 2, + Unspecified = 0, + FixedLength = 1, + VariableLength = 2, VariableLengthAlternate = 3 } enum RecordAttribute : byte { - LFCR = 0, - ISO1539 = 1, + LFCR = 0, + ISO1539 = 1, ControlContained = 2 } } diff --git a/DiscImageChef.Filesystems/ISO9660/Consts/RRIP.cs b/DiscImageChef.Filesystems/ISO9660/Consts/RRIP.cs index add93aa44..9a2ac9d04 100644 --- a/DiscImageChef.Filesystems/ISO9660/Consts/RRIP.cs +++ b/DiscImageChef.Filesystems/ISO9660/Consts/RRIP.cs @@ -36,39 +36,39 @@ namespace DiscImageChef.Filesystems.ISO9660 { public partial class ISO9660 { - const ushort RRIP_MAGIC = 0x5252; // "RR" + const ushort RRIP_MAGIC = 0x5252; // "RR" const ushort RRIP_POSIX_ATTRIBUTES = 0x5058; // "PX" - const ushort RRIP_POSIX_DEV_NO = 0x504E; // "PN" - const ushort RRIP_SYMLINK = 0x534C; // "SL" - const ushort RRIP_NAME = 0x4E4D; // "NM" - const ushort RRIP_CHILDLINK = 0x434C; // "CL" - const ushort RRIP_PARENTLINK = 0x504C; // "PL" - const ushort RRIP_RELOCATED_DIR = 0x5245; // "RE" - const ushort RRIP_TIMESTAMPS = 0x5446; // "TF" - const ushort RRIP_SPARSE = 0x5346; // "SF" + const ushort RRIP_POSIX_DEV_NO = 0x504E; // "PN" + const ushort RRIP_SYMLINK = 0x534C; // "SL" + const ushort RRIP_NAME = 0x4E4D; // "NM" + const ushort RRIP_CHILDLINK = 0x434C; // "CL" + const ushort RRIP_PARENTLINK = 0x504C; // "PL" + const ushort RRIP_RELOCATED_DIR = 0x5245; // "RE" + const ushort RRIP_TIMESTAMPS = 0x5446; // "TF" + const ushort RRIP_SPARSE = 0x5346; // "SF" [Flags] enum PosixMode : uint { - OwnerRead = 0x100, - OwnerWrite = 0x80, + OwnerRead = 0x100, + OwnerWrite = 0x80, OwnerExecute = 0x40, - GroupRead = 0x20, - GroupWrite = 0x10, + GroupRead = 0x20, + GroupWrite = 0x10, GroupExecute = 0x8, - OtherRead = 0x4, - OtherWrite = 0x2, + OtherRead = 0x4, + OtherWrite = 0x2, OtherExecute = 0x1, - SetUID = 0x800, - SetGid = 0x400, - IsVTX = 0x200, - Socket = 0xC000, - Symlink = 0xA000, - Regular = 0x8000, - Block = 0x6000, - Character = 0x2000, - Directory = 0x4000, - Pipe = 0x1000 + SetUID = 0x800, + SetGid = 0x400, + IsVTX = 0x200, + Socket = 0xC000, + Symlink = 0xA000, + Regular = 0x8000, + Block = 0x6000, + Character = 0x2000, + Directory = 0x4000, + Pipe = 0x1000 } [Flags] @@ -80,34 +80,34 @@ namespace DiscImageChef.Filesystems.ISO9660 [Flags] enum SymlinkComponentFlags : byte { - Continue = 1, - Current = 2, - Parent = 4, - Root = 8, - Mountpoint = 16, + Continue = 1, + Current = 2, + Parent = 4, + Root = 8, + Mountpoint = 16, Networkname = 32 } [Flags] enum AlternateNameFlags : byte { - Continue = 1, - Current = 2, - Parent = 4, + Continue = 1, + Current = 2, + Parent = 4, Networkname = 32 } [Flags] enum TimestampFlags : byte { - Creation = 1 << 0, - Modification = 1 << 1, - Access = 1 << 2, + Creation = 1 << 0, + Modification = 1 << 1, + Access = 1 << 2, AttributeChange = 1 << 3, - Backup = 1 << 4, - Expiration = 1 << 5, - Effective = 1 << 6, - LongFormat = 1 << 7 + Backup = 1 << 4, + Expiration = 1 << 5, + Effective = 1 << 6, + 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 40914a5b0..d891afd88 100644 --- a/DiscImageChef.Filesystems/ISO9660/Consts/SUSP.cs +++ b/DiscImageChef.Filesystems/ISO9660/Consts/SUSP.cs @@ -35,11 +35,11 @@ namespace DiscImageChef.Filesystems.ISO9660 public partial class ISO9660 { const ushort SUSP_CONTINUATION = 0x4345; // "CE" - const ushort SUSP_PADDING = 0x5044; // "PD" - const ushort SUSP_INDICATOR = 0x5350; // "SP" - const ushort SUSP_TERMINATOR = 0x5354; // "ST" - const ushort SUSP_REFERENCE = 0x4552; // "ER" - const ushort SUSP_SELECTOR = 0x4553; // "ES" - const ushort SUSP_MAGIC = 0xBEEF; + const ushort SUSP_PADDING = 0x5044; // "PD" + const ushort SUSP_INDICATOR = 0x5350; // "SP" + const ushort SUSP_TERMINATOR = 0x5354; // "ST" + const ushort SUSP_REFERENCE = 0x4552; // "ER" + 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 44f5db7a1..32d49c313 100644 --- a/DiscImageChef.Filesystems/ISO9660/Consts/XA.cs +++ b/DiscImageChef.Filesystems/ISO9660/Consts/XA.cs @@ -41,17 +41,17 @@ namespace DiscImageChef.Filesystems.ISO9660 [Flags] enum XaAttributes : ushort { - SystemRead = 0x01, + SystemRead = 0x01, SystemExecute = 0x04, - OwnerRead = 0x10, - OwnerExecute = 0x40, - GroupRead = 0x100, - GroupExecute = 0x400, - Mode2Form1 = 0x800, - Mode2Form2 = 0x1000, - Interleaved = 0x2000, - Cdda = 0x4000, - Directory = 0x8000 + OwnerRead = 0x10, + OwnerExecute = 0x40, + GroupRead = 0x100, + GroupExecute = 0x400, + Mode2Form1 = 0x800, + Mode2Form2 = 0x1000, + Interleaved = 0x2000, + Cdda = 0x4000, + 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 f422b8a4e..05b6d854f 100644 --- a/DiscImageChef.Filesystems/ISO9660/Consts/Ziso.cs +++ b/DiscImageChef.Filesystems/ISO9660/Consts/Ziso.cs @@ -34,9 +34,9 @@ namespace DiscImageChef.Filesystems.ISO9660 { public partial class ISO9660 { - const ulong ZISO_HEADER_MAGIC = 0x37E45396C9DBD607; - const ulong ZISO_HEADER_CIGAM = 0x07D6DBC99653E437; - const ushort ZISO_MAGIC = 0x5A46; // "ZF" - const ushort ZISO_PAGED_ZLIB = 0x707A; // "pz" + const ulong ZISO_HEADER_MAGIC = 0x37E45396C9DBD607; + const ulong ZISO_HEADER_CIGAM = 0x07D6DBC99653E437; + const ushort ZISO_MAGIC = 0x5A46; // "ZF" + const ushort ZISO_PAGED_ZLIB = 0x707A; // "pz" } } \ No newline at end of file diff --git a/DiscImageChef.Filesystems/ISO9660/ISO9660.cs b/DiscImageChef.Filesystems/ISO9660/ISO9660.cs index 7ef6d22c2..1c00d7847 100644 --- a/DiscImageChef.Filesystems/ISO9660/ISO9660.cs +++ b/DiscImageChef.Filesystems/ISO9660/ISO9660.cs @@ -40,8 +40,8 @@ namespace DiscImageChef.Filesystems.ISO9660 public partial class ISO9660 : IFilesystem { public FileSystemType XmlFsType { get; private set; } - public Encoding Encoding { get; private set; } - public string Name => "ISO9660 Filesystem"; - public Guid Id => new Guid("d812f4d3-c357-400d-90fd-3b22ef786aa8"); + public Encoding Encoding { get; private set; } + public string Name => "ISO9660 Filesystem"; + public Guid Id => new Guid("d812f4d3-c357-400d-90fd-3b22ef786aa8"); } } \ No newline at end of file diff --git a/DiscImageChef.Filesystems/ISO9660/Info.cs b/DiscImageChef.Filesystems/ISO9660/Info.cs index bef7e5d62..0f360a3ae 100644 --- a/DiscImageChef.Filesystems/ISO9660/Info.cs +++ b/DiscImageChef.Filesystems/ISO9660/Info.cs @@ -80,8 +80,8 @@ namespace DiscImageChef.Filesystems.ISO9660 public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information, Encoding encoding) { - Encoding = encoding ?? Encoding.ASCII; - information = ""; + Encoding = encoding ?? Encoding.ASCII; + information = ""; StringBuilder isoMetadata = new StringBuilder(); byte[] vdMagic = new byte[5]; // Volume Descriptor magic "CD001" byte[] hsMagic = new byte[5]; // Volume Descriptor magic "CDROM" @@ -116,8 +116,8 @@ namespace DiscImageChef.Filesystems.ISO9660 DicConsole.DebugWriteLine("ISO9660 plugin", "Processing VD loop no. {0}", counter); // Seek to Volume Descriptor DicConsole.DebugWriteLine("ISO9660 plugin", "Reading sector {0}", 16 + counter + partition.Start); - byte[] vdSectorTmp = imagePlugin.ReadSector(16 + counter + partition.Start); - vdSector = new byte[vdSectorTmp.Length - xaOff]; + byte[] vdSectorTmp = imagePlugin.ReadSector(16 + counter + partition.Start); + vdSector = new byte[vdSectorTmp.Length - xaOff]; Array.Copy(vdSectorTmp, xaOff, vdSector, 0, vdSector.Length); byte vdType = vdSector[0 + hsOff]; // Volume Descriptor Type, should be 1 or 2. @@ -199,7 +199,7 @@ namespace DiscImageChef.Filesystems.ISO9660 Marshal.FreeHGlobal(ptr); // Check if this is Joliet - if(svd.escape_sequences[0] == '%' && svd.escape_sequences[1] == '/') + 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; @@ -225,10 +225,8 @@ namespace DiscImageChef.Filesystems.ISO9660 } if(highSierra) decodedVd = DecodeVolumeDescriptor(hsvd.Value); - else if(cdi) - decodedVd = DecodeVolumeDescriptor(fsvd.Value); - else - decodedVd = DecodeVolumeDescriptor(pvd.Value); + else if(cdi) decodedVd = DecodeVolumeDescriptor(fsvd.Value); + else decodedVd = DecodeVolumeDescriptor(pvd.Value); if(jolietvd != null) decodedJolietVd = DecodeJolietDescriptor(jolietvd.Value); @@ -282,7 +280,7 @@ namespace DiscImageChef.Filesystems.ISO9660 Marshal.FreeHGlobal(ptr); int saOff = Marshal.SizeOf(record) + record.name_len; - saOff += saOff % 2; + saOff += saOff % 2; int saLen = record.length - saOff; if(saLen > 0 && rootOff + saOff + saLen <= rootDir.Length) @@ -320,9 +318,9 @@ namespace DiscImageChef.Filesystems.ISO9660 break; // Not easy, contains size field case APPLE_MAGIC_OLD: - apple = true; + apple = true; AppleOldId appleId = (AppleOldId)sa[saOff + 2]; - noneFound = false; + noneFound = false; switch(appleId) { @@ -366,7 +364,7 @@ namespace DiscImageChef.Filesystems.ISO9660 .ByteArrayToStructureBigEndian(ce); contareas.Add(ca); break; - case SUSP_REFERENCE when saOff + sa[saOff + 2] <= saLen: + case SUSP_REFERENCE when saOff + sa[saOff + 2] <= saLen: byte[] er = new byte[sa[saOff + 2]]; Array.Copy(sa, saOff, er, 0, er.Length); refareas.Add(er); @@ -385,9 +383,9 @@ namespace DiscImageChef.Filesystems.ISO9660 ziso |= nextSignature == ZISO_MAGIC; amiga |= nextSignature == AMIGA_MAGIC; - aaip |= nextSignature == AAIP_MAGIC || nextSignature == AAIP_MAGIC_OLD && - sa[saOff + 3] == 1 && - sa[saOff + 2] >= 9; + aaip |= nextSignature == AAIP_MAGIC || nextSignature == AAIP_MAGIC_OLD && + sa[saOff + 3] == 1 && + sa[saOff + 2] >= 9; saOff += sa[saOff + 2]; @@ -429,7 +427,7 @@ namespace DiscImageChef.Filesystems.ISO9660 if(caData[caOff + 3] == 1 && caData[caOff + 2] == 7) apple = true; else apple |= caData[caOff + 3] != 1; break; - case SUSP_REFERENCE when caOff + caData[caOff + 2] <= ca.ca_length_be: + case SUSP_REFERENCE when caOff + caData[caOff + 2] <= ca.ca_length_be: byte[] er = new byte[caData[caOff + 2]]; Array.Copy(caData, caOff, er, 0, er.Length); refareas.Add(er); @@ -444,8 +442,8 @@ namespace DiscImageChef.Filesystems.ISO9660 ziso |= nextSignature == ZISO_MAGIC; amiga |= nextSignature == AMIGA_MAGIC; - aaip |= nextSignature == AAIP_MAGIC || nextSignature == AAIP_MAGIC_OLD && caData[caOff + 3] == 1 && - caData[caOff + 2] >= 9; + aaip |= nextSignature == AAIP_MAGIC || nextSignature == AAIP_MAGIC_OLD && caData[caOff + 3] == 1 && + caData[caOff + 2] >= 9; caOff += caData[caOff + 2]; } @@ -460,17 +458,17 @@ namespace DiscImageChef.Filesystems.ISO9660 counter = 1; foreach(byte[] erb in refareas) { - ReferenceArea er = BigEndianMarshal.ByteArrayToStructureBigEndian(erb); - string extId = + ReferenceArea er = BigEndianMarshal.ByteArrayToStructureBigEndian(erb); + string extId = Encoding.GetString(erb, Marshal.SizeOf(er), er.id_len); string extDes = Encoding.GetString(erb, Marshal.SizeOf(er) + er.id_len, er.des_len); string extSrc = Encoding.GetString(erb, Marshal.SizeOf(er) + er.id_len + er.des_len, er.src_len); - suspInformation.AppendFormat("Extension: {0}", counter).AppendLine(); + suspInformation.AppendFormat("Extension: {0}", counter).AppendLine(); suspInformation.AppendFormat("\tID: {0}, version {1}", extId, er.ext_ver).AppendLine(); - suspInformation.AppendFormat("\tDescription: {0}", extDes).AppendLine(); - suspInformation.AppendFormat("\tSource: {0}", extSrc).AppendLine(); + suspInformation.AppendFormat("\tDescription: {0}", extDes).AppendLine(); + suspInformation.AppendFormat("\tSource: {0}", extSrc).AppendLine(); counter++; } } @@ -482,10 +480,8 @@ namespace DiscImageChef.Filesystems.ISO9660 string fsFormat; if(highSierra) fsFormat = "High Sierra Format"; - else if(cdi) - fsFormat = "CD-i"; - else - fsFormat = "ISO9660"; + else if(cdi) fsFormat = "CD-i"; + else fsFormat = "ISO9660"; isoMetadata.AppendFormat("{0} file system", fsFormat).AppendLine(); if(xaExtensions) isoMetadata.AppendLine("CD-ROM XA extensions present."); @@ -519,14 +515,13 @@ namespace DiscImageChef.Filesystems.ISO9660 isoMetadata.AppendFormat("{0}------------------------------", cdi ? "---------------" : "").AppendLine(); isoMetadata.AppendFormat("{0}VOLUME DESCRIPTOR INFORMATION:", cdi ? "FILE STRUCTURE " : "").AppendLine(); isoMetadata.AppendFormat("{0}------------------------------", cdi ? "---------------" : "").AppendLine(); - isoMetadata.AppendFormat("System identifier: {0}", decodedVd.SystemIdentifier).AppendLine(); - isoMetadata.AppendFormat("Volume identifier: {0}", decodedVd.VolumeIdentifier).AppendLine(); - isoMetadata.AppendFormat("Volume set identifier: {0}", decodedVd.VolumeSetIdentifier).AppendLine(); - isoMetadata.AppendFormat("Publisher identifier: {0}", decodedVd.PublisherIdentifier).AppendLine(); - isoMetadata.AppendFormat("Data preparer identifier: {0}", decodedVd.DataPreparerIdentifier) - .AppendLine(); + isoMetadata.AppendFormat("System identifier: {0}", decodedVd.SystemIdentifier).AppendLine(); + isoMetadata.AppendFormat("Volume identifier: {0}", decodedVd.VolumeIdentifier).AppendLine(); + isoMetadata.AppendFormat("Volume set identifier: {0}", decodedVd.VolumeSetIdentifier).AppendLine(); + isoMetadata.AppendFormat("Publisher identifier: {0}", decodedVd.PublisherIdentifier).AppendLine(); + isoMetadata.AppendFormat("Data preparer identifier: {0}", decodedVd.DataPreparerIdentifier).AppendLine(); isoMetadata.AppendFormat("Application identifier: {0}", decodedVd.ApplicationIdentifier).AppendLine(); - isoMetadata.AppendFormat("Volume creation date: {0}", decodedVd.CreationTime).AppendLine(); + 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(); @@ -544,12 +539,11 @@ namespace DiscImageChef.Filesystems.ISO9660 isoMetadata.AppendLine("-------------------------------------"); isoMetadata.AppendLine("JOLIET VOLUME DESCRIPTOR INFORMATION:"); isoMetadata.AppendLine("-------------------------------------"); - isoMetadata.AppendFormat("System identifier: {0}", decodedJolietVd.SystemIdentifier).AppendLine(); - isoMetadata.AppendFormat("Volume identifier: {0}", decodedJolietVd.VolumeIdentifier).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("Publisher identifier: {0}", decodedJolietVd.PublisherIdentifier) - .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) @@ -599,8 +593,7 @@ namespace DiscImageChef.Filesystems.ISO9660 initialEntry.sector_count); byte[] bootImage = - initialEntry.load_rba + partition.Start + initialEntry.sector_count - - 1 <= partition.End + initialEntry.load_rba + partition.Start + initialEntry.sector_count - 1 <= partition.End ? imagePlugin.ReadSectors(initialEntry.load_rba + partition.Start, initialEntry.sector_count) : null; @@ -653,9 +646,8 @@ namespace DiscImageChef.Filesystems.ISO9660 const int SECTION_COUNTER = 2; - while(toritoOff < vdSector.Length && - (vdSector[toritoOff] == (byte)ElToritoIndicator.Header || - vdSector[toritoOff] == (byte)ElToritoIndicator.LastHeader)) + while(toritoOff < vdSector.Length && (vdSector[toritoOff] == (byte)ElToritoIndicator.Header || + vdSector[toritoOff] == (byte)ElToritoIndicator.LastHeader)) { ptr = Marshal.AllocHGlobal(EL_TORITO_ENTRY_SIZE); Marshal.Copy(vdSector, toritoOff, ptr, EL_TORITO_ENTRY_SIZE); @@ -682,8 +674,7 @@ namespace DiscImageChef.Filesystems.ISO9660 if(sectionEntry.bootable == ElToritoIndicator.Bootable) { bootImage = - sectionEntry.load_rba + partition.Start + - sectionEntry.sector_count - 1 <= partition.End + sectionEntry.load_rba + partition.Start + sectionEntry.sector_count - 1 <= partition.End ? imagePlugin.ReadSectors(sectionEntry.load_rba + partition.Start, sectionEntry.sector_count) : null; diff --git a/DiscImageChef.Filesystems/ISO9660/Structs/Amiga.cs b/DiscImageChef.Filesystems/ISO9660/Structs/Amiga.cs index 8ad254ccb..e4492da1e 100644 --- a/DiscImageChef.Filesystems/ISO9660/Structs/Amiga.cs +++ b/DiscImageChef.Filesystems/ISO9660/Structs/Amiga.cs @@ -39,9 +39,9 @@ namespace DiscImageChef.Filesystems.ISO9660 [StructLayout(LayoutKind.Sequential, Pack = 1)] struct AmigaEntry { - public ushort signature; - public byte length; - public byte version; + public ushort signature; + public byte length; + public byte version; public AmigaFlags flags; // Followed by AmigaProtection if present // Followed by length-prefixed string for comment if present @@ -50,9 +50,9 @@ namespace DiscImageChef.Filesystems.ISO9660 [StructLayout(LayoutKind.Sequential, Pack = 1)] struct AmigaProtection { - public byte User; - public byte Reserved; - public AmigaMultiuser Multiuser; + public byte User; + public byte Reserved; + public AmigaMultiuser Multiuser; public AmigaAttributes Protection; } } diff --git a/DiscImageChef.Filesystems/ISO9660/Structs/Apple.cs b/DiscImageChef.Filesystems/ISO9660/Structs/Apple.cs index eb619c8f9..0e7c346d4 100644 --- a/DiscImageChef.Filesystems/ISO9660/Structs/Apple.cs +++ b/DiscImageChef.Filesystems/ISO9660/Structs/Apple.cs @@ -40,65 +40,66 @@ namespace DiscImageChef.Filesystems.ISO9660 [StructLayout(LayoutKind.Sequential, Pack = 1)] struct AppleProDOSSystemUse { - public ushort signature; - public byte length; + public ushort signature; + public byte length; public AppleId id; - public byte type; - public ushort aux_type; + public byte type; + public ushort aux_type; } // Big-endian [StructLayout(LayoutKind.Sequential, Pack = 1)] struct AppleHFSSystemUse { - public ushort signature; - public byte length; + public ushort signature; + public byte length; public AppleId id; - public ushort type; - public ushort creator; - public ushort finder_flags; + public ushort type; + public ushort creator; + public ushort finder_flags; } // Little-endian [StructLayout(LayoutKind.Sequential, Pack = 1)] struct AppleProDOSOldSystemUse { - public ushort signature; + public ushort signature; public AppleOldId id; - public byte type; - public ushort aux_type; + public byte type; + public ushort aux_type; } // Big-endian [StructLayout(LayoutKind.Sequential, Pack = 1)] struct AppleHFSTypeCreatorSystemUse { - public ushort signature; + public ushort signature; public AppleOldId id; - public ushort type; - public ushort creator; + public ushort type; + public ushort creator; } // Big-endian [StructLayout(LayoutKind.Sequential, Pack = 1)] struct AppleHFSIconSystemUse { - public ushort signature; + public ushort signature; public AppleOldId id; - public ushort type; - public ushort creator; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] public byte[] icon; + public ushort type; + public ushort creator; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] + public byte[] icon; } // Big-endian [StructLayout(LayoutKind.Sequential, Pack = 1)] struct AppleHFSOldSystemUse { - public ushort signature; + public ushort signature; public AppleOldId id; - public ushort type; - public ushort creator; - public ushort finder_flags; + public ushort type; + public ushort creator; + 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 9275dce82..c9207b2a6 100644 --- a/DiscImageChef.Filesystems/ISO9660/Structs/CDi.cs +++ b/DiscImageChef.Filesystems/ISO9660/Structs/CDi.cs @@ -32,7 +32,6 @@ using System; using System.Runtime.InteropServices; -using System.Text; namespace DiscImageChef.Filesystems.ISO9660 { @@ -42,40 +41,42 @@ namespace DiscImageChef.Filesystems.ISO9660 { DecodedVolumeDescriptor decodedVD = new DecodedVolumeDescriptor { - SystemIdentifier = StringHandlers.CToString(pvd.system_id).TrimEnd(), - VolumeIdentifier = StringHandlers.CToString(pvd.volume_id).TrimEnd(), - VolumeSetIdentifier = StringHandlers.CToString(pvd.volume_set_id).TrimEnd(), - PublisherIdentifier = StringHandlers.CToString(pvd.publisher_id).TrimEnd(), + SystemIdentifier = StringHandlers.CToString(pvd.system_id).TrimEnd(), + VolumeIdentifier = StringHandlers.CToString(pvd.volume_id).TrimEnd(), + VolumeSetIdentifier = StringHandlers.CToString(pvd.volume_set_id).TrimEnd(), + PublisherIdentifier = StringHandlers.CToString(pvd.publisher_id).TrimEnd(), DataPreparerIdentifier = StringHandlers.CToString(pvd.preparer_id).TrimEnd(), - ApplicationIdentifier = StringHandlers.CToString(pvd.application_data).TrimEnd() + ApplicationIdentifier = StringHandlers.CToString(pvd.application_data).TrimEnd() }; if(pvd.creation_date[0] == '0' || pvd.creation_date[0] == 0x00) decodedVD.CreationTime = 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) decodedVD.HasModificationTime = false; else { decodedVD.HasModificationTime = true; - decodedVD.ModificationTime = DateHandlers.HighSierraToDateTime(pvd.modification_date); + decodedVD.ModificationTime = DateHandlers.HighSierraToDateTime(pvd.modification_date); } 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); + decodedVD.ExpirationTime = DateHandlers.HighSierraToDateTime(pvd.expiration_date); } if(pvd.effective_date[0] == '0' || pvd.effective_date[0] == 0x00) decodedVD.HasEffectiveTime = false; else { decodedVD.HasEffectiveTime = true; - decodedVD.EffectiveTime = DateHandlers.HighSierraToDateTime(pvd.effective_date); + decodedVD.EffectiveTime = DateHandlers.HighSierraToDateTime(pvd.effective_date); } - decodedVD.Blocks = pvd.volume_space_size; + decodedVD.Blocks = pvd.volume_space_size; decodedVD.BlockSize = pvd.logical_block_size; return decodedVD; @@ -85,48 +86,70 @@ namespace DiscImageChef.Filesystems.ISO9660 struct FileStructureVolumeDescriptor { public byte type; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 5)] public byte[] id; - public byte version; + [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; public ushort volume_sequence_number; public ushort reserved4; public ushort logical_block_size; - public uint reserved5; - 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; + public uint reserved5; + 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; 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)] @@ -138,13 +161,14 @@ namespace DiscImageChef.Filesystems.ISO9660 public uint start_lbn; public uint reserved2; public uint size; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)] public byte[] date; - public byte reserved3; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)] + public byte[] date; + public byte reserved3; public CdiFileFlags flags; - public ushort file_unit_size; - public ushort reserved4; - public ushort volume_sequence_number; - public byte name_len; + public ushort file_unit_size; + public ushort reserved4; + public ushort volume_sequence_number; + public byte name_len; // Followed by name[name_len] and then CdiSystemArea until length arrives } @@ -152,11 +176,11 @@ namespace DiscImageChef.Filesystems.ISO9660 [StructLayout(LayoutKind.Sequential, Pack = 1)] struct CdiSystemArea { - public uint owner; + public uint owner; public CdiAttributes attributes; - public ushort reserved1; - public byte file_no; - public byte reserved2; + public ushort reserved1; + public byte file_no; + public byte reserved2; } } } \ No newline at end of file diff --git a/DiscImageChef.Filesystems/ISO9660/Structs/Common.cs b/DiscImageChef.Filesystems/ISO9660/Structs/Common.cs index 3d6302fcb..6209a6678 100644 --- a/DiscImageChef.Filesystems/ISO9660/Structs/Common.cs +++ b/DiscImageChef.Filesystems/ISO9660/Structs/Common.cs @@ -38,21 +38,21 @@ namespace DiscImageChef.Filesystems.ISO9660 { struct DecodedVolumeDescriptor { - public string SystemIdentifier; - public string VolumeIdentifier; - public string VolumeSetIdentifier; - public string PublisherIdentifier; - public string DataPreparerIdentifier; - public string ApplicationIdentifier; + public string SystemIdentifier; + public string VolumeIdentifier; + public string VolumeSetIdentifier; + public string PublisherIdentifier; + public string DataPreparerIdentifier; + public string ApplicationIdentifier; public DateTime CreationTime; - public bool HasModificationTime; + public bool HasModificationTime; public DateTime ModificationTime; - public bool HasExpirationTime; + public bool HasExpirationTime; public DateTime ExpirationTime; - public bool HasEffectiveTime; + public bool HasEffectiveTime; public DateTime EffectiveTime; - public ushort BlockSize; - public uint Blocks; + public ushort BlockSize; + 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 b1a01f347..e6e5d096a 100644 --- a/DiscImageChef.Filesystems/ISO9660/Structs/ElTorito.cs +++ b/DiscImageChef.Filesystems/ISO9660/Structs/ElTorito.cs @@ -40,21 +40,26 @@ 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)] struct ElToritoValidationEntry { public ElToritoIndicator header_id; - public ElToritoPlatform platform_id; - public ushort reserved; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 24)] public byte[] developer_id; + public ElToritoPlatform platform_id; + public ushort reserved; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 24)] + public byte[] developer_id; public ushort checksum; public ushort signature; } @@ -64,21 +69,23 @@ namespace DiscImageChef.Filesystems.ISO9660 { public ElToritoIndicator bootable; public ElToritoEmulation boot_type; - public ushort load_seg; - public byte system_type; - public byte reserved1; - public ushort sector_count; - public uint load_rba; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 20)] public byte[] reserved2; + public ushort load_seg; + public byte system_type; + public byte reserved1; + public ushort sector_count; + public uint load_rba; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 20)] + public byte[] reserved2; } [StructLayout(LayoutKind.Sequential, Pack = 1)] struct ElToritoSectionHeaderEntry { public ElToritoIndicator header_id; - public ElToritoPlatform platform_id; - public ushort entries; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 28)] public byte[] identifier; + public ElToritoPlatform platform_id; + public ushort entries; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 28)] + public byte[] identifier; } [StructLayout(LayoutKind.Sequential, Pack = 1)] @@ -86,21 +93,23 @@ namespace DiscImageChef.Filesystems.ISO9660 { public ElToritoIndicator bootable; public ElToritoEmulation boot_type; - public ushort load_seg; - public byte system_type; - public byte reserved1; - public ushort sector_count; - public uint load_rba; - public byte selection_criteria_type; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 19)] public byte[] selection_criterias; + public ushort load_seg; + public byte system_type; + public byte reserved1; + public ushort sector_count; + public uint load_rba; + public byte selection_criteria_type; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 19)] + public byte[] selection_criterias; } [StructLayout(LayoutKind.Sequential, Pack = 1)] struct ElToritoSectionEntryExtension { public ElToritoIndicator extension_indicator; - public ElToritoFlags extension_flags; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 30)] public byte[] selection_criterias; + public ElToritoFlags extension_flags; + [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 1efae0454..f49c94976 100644 --- a/DiscImageChef.Filesystems/ISO9660/Structs/HighSierra.cs +++ b/DiscImageChef.Filesystems/ISO9660/Structs/HighSierra.cs @@ -42,40 +42,42 @@ namespace DiscImageChef.Filesystems.ISO9660 { DecodedVolumeDescriptor decodedVD = new DecodedVolumeDescriptor { - SystemIdentifier = Encoding.ASCII.GetString(pvd.system_id).TrimEnd().Trim('\0'), - VolumeIdentifier = Encoding.ASCII.GetString(pvd.volume_id).TrimEnd().Trim('\0'), - VolumeSetIdentifier = Encoding.ASCII.GetString(pvd.volume_set_id).TrimEnd().Trim('\0'), - PublisherIdentifier = Encoding.ASCII.GetString(pvd.publisher_id).TrimEnd().Trim('\0'), + SystemIdentifier = Encoding.ASCII.GetString(pvd.system_id).TrimEnd().Trim('\0'), + VolumeIdentifier = Encoding.ASCII.GetString(pvd.volume_id).TrimEnd().Trim('\0'), + VolumeSetIdentifier = Encoding.ASCII.GetString(pvd.volume_set_id).TrimEnd().Trim('\0'), + PublisherIdentifier = Encoding.ASCII.GetString(pvd.publisher_id).TrimEnd().Trim('\0'), DataPreparerIdentifier = Encoding.ASCII.GetString(pvd.preparer_id).TrimEnd().Trim('\0'), - ApplicationIdentifier = Encoding.ASCII.GetString(pvd.application_data).TrimEnd().Trim('\0') + ApplicationIdentifier = Encoding.ASCII.GetString(pvd.application_data).TrimEnd().Trim('\0') }; if(pvd.creation_date[0] == '0' || pvd.creation_date[0] == 0x00) decodedVD.CreationTime = 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) decodedVD.HasModificationTime = false; else { decodedVD.HasModificationTime = true; - decodedVD.ModificationTime = DateHandlers.HighSierraToDateTime(pvd.modification_date); + decodedVD.ModificationTime = DateHandlers.HighSierraToDateTime(pvd.modification_date); } 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); + decodedVD.ExpirationTime = DateHandlers.HighSierraToDateTime(pvd.expiration_date); } if(pvd.effective_date[0] == '0' || pvd.effective_date[0] == 0x00) decodedVD.HasEffectiveTime = false; else { decodedVD.HasEffectiveTime = true; - decodedVD.EffectiveTime = DateHandlers.HighSierraToDateTime(pvd.effective_date); + decodedVD.EffectiveTime = DateHandlers.HighSierraToDateTime(pvd.effective_date); } - decodedVD.Blocks = pvd.volume_space_size; + decodedVD.Blocks = pvd.volume_space_size; decodedVD.BlockSize = pvd.logical_block_size; return decodedVD; @@ -87,48 +89,64 @@ 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; - public ushort volume_set_size; - public ushort volume_set_size_be; - public ushort volume_sequence_number; - public ushort volume_sequence_number_be; - public ushort logical_block_size; - public ushort logical_block_size_be; - public uint path_table_size; - public uint path_table_size_be; - public uint manditory_path_table_lsb; - public uint opt_path_table_lsb_1; - public uint opt_path_table_lsb_2; - public uint opt_path_table_lsb_3; - public uint manditory_path_table_msb; - public uint opt_path_table_msb_1; - public uint opt_path_table_msb_2; - public uint opt_path_table_msb_3; + public uint volume_space_size; + public uint volume_space_size_be; + [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; + public ushort volume_sequence_number_be; + public ushort logical_block_size; + public ushort logical_block_size_be; + public uint path_table_size; + public uint path_table_size_be; + public uint manditory_path_table_lsb; + public uint opt_path_table_lsb_1; + public uint opt_path_table_lsb_2; + public uint opt_path_table_lsb_3; + public uint manditory_path_table_msb; + public uint opt_path_table_msb_1; + public uint opt_path_table_msb_2; + 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; + 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; 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)] @@ -140,14 +158,15 @@ 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; - public byte interleave; - public ushort volume_sequence_number; - public ushort volume_sequence_number_be; - public byte name_len; + public byte reserved; + public byte interleave_size; + public byte interleave; + public ushort volume_sequence_number; + public ushort volume_sequence_number_be; + public byte name_len; // Followed by name[name_len] and then system area until length arrives } } diff --git a/DiscImageChef.Filesystems/ISO9660/Structs/ISO.cs b/DiscImageChef.Filesystems/ISO9660/Structs/ISO.cs index 8cee591bc..fa6aea27a 100644 --- a/DiscImageChef.Filesystems/ISO9660/Structs/ISO.cs +++ b/DiscImageChef.Filesystems/ISO9660/Structs/ISO.cs @@ -32,7 +32,6 @@ using System; using System.Runtime.InteropServices; -using System.Text; namespace DiscImageChef.Filesystems.ISO9660 { @@ -42,40 +41,42 @@ namespace DiscImageChef.Filesystems.ISO9660 { DecodedVolumeDescriptor decodedVD = new DecodedVolumeDescriptor { - SystemIdentifier = StringHandlers.CToString(pvd.system_id).TrimEnd(), - VolumeIdentifier = StringHandlers.CToString(pvd.volume_id).TrimEnd(), - VolumeSetIdentifier = StringHandlers.CToString(pvd.volume_set_id).TrimEnd(), - PublisherIdentifier = StringHandlers.CToString(pvd.publisher_id).TrimEnd(), + SystemIdentifier = StringHandlers.CToString(pvd.system_id).TrimEnd(), + VolumeIdentifier = StringHandlers.CToString(pvd.volume_id).TrimEnd(), + VolumeSetIdentifier = StringHandlers.CToString(pvd.volume_set_id).TrimEnd(), + PublisherIdentifier = StringHandlers.CToString(pvd.publisher_id).TrimEnd(), DataPreparerIdentifier = StringHandlers.CToString(pvd.preparer_id).TrimEnd(), - ApplicationIdentifier = StringHandlers.CToString(pvd.application_data).TrimEnd() + ApplicationIdentifier = StringHandlers.CToString(pvd.application_data).TrimEnd() }; if(pvd.creation_date[0] == '0' || pvd.creation_date[0] == 0x00) decodedVD.CreationTime = 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) decodedVD.HasModificationTime = false; else { decodedVD.HasModificationTime = true; - decodedVD.ModificationTime = DateHandlers.Iso9660ToDateTime(pvd.modification_date); + decodedVD.ModificationTime = DateHandlers.Iso9660ToDateTime(pvd.modification_date); } 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); + decodedVD.ExpirationTime = DateHandlers.Iso9660ToDateTime(pvd.expiration_date); } if(pvd.effective_date[0] == '0' || pvd.effective_date[0] == 0x00) decodedVD.HasEffectiveTime = false; else { decodedVD.HasEffectiveTime = true; - decodedVD.EffectiveTime = DateHandlers.Iso9660ToDateTime(pvd.effective_date); + decodedVD.EffectiveTime = DateHandlers.Iso9660ToDateTime(pvd.effective_date); } - decodedVD.Blocks = pvd.volume_space_size; + decodedVD.Blocks = pvd.volume_space_size; decodedVD.BlockSize = pvd.logical_block_size; return decodedVD; @@ -85,73 +86,98 @@ 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; + public uint volume_space_size; + public uint volume_space_size_be; // Only used in SVDs - [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; - public ushort volume_sequence_number_be; - public ushort logical_block_size; - public ushort logical_block_size_be; - public uint path_table_size; - public uint path_table_size_be; - public uint type_1_path_table; - public uint opt_type_1_path_table; - public uint type_m_path_table; - public uint opt_type_m_path_table; + [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; + public ushort volume_sequence_number_be; + public ushort logical_block_size; + public ushort logical_block_size_be; + public uint path_table_size; + public uint path_table_size_be; + public uint type_1_path_table; + public uint opt_type_1_path_table; + public uint type_m_path_table; + 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; + 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; 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)] @@ -163,37 +189,45 @@ 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; - public ushort volume_sequence_number; - public ushort volume_sequence_number_be; - public byte name_len; + public byte file_unit_size; + public byte interleave; + public ushort volume_sequence_number; + public ushort volume_sequence_number_be; + public byte name_len; // Followed by name[name_len] and then system area until length arrives } [StructLayout(LayoutKind.Sequential, Pack = 1)] struct ExtendedAttributeRecord { - public ushort owner; - public ushort owner_be; - public ushort group; - public ushort group_be; + public ushort owner; + public ushort owner_be; + 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; - public RecordFormat record_format; + [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; + 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; 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,9 +236,9 @@ namespace DiscImageChef.Filesystems.ISO9660 [StructLayout(LayoutKind.Sequential, Pack = 1)] struct PathTableEntry { - public byte name_len; - public byte xattr_len; - public uint start_lbn; + public byte name_len; + public byte xattr_len; + public uint start_lbn; public ushort parent_dirno; // Followed by name[name_len] } diff --git a/DiscImageChef.Filesystems/ISO9660/Structs/Joliet.cs b/DiscImageChef.Filesystems/ISO9660/Structs/Joliet.cs index 9680d435b..1594067ef 100644 --- a/DiscImageChef.Filesystems/ISO9660/Structs/Joliet.cs +++ b/DiscImageChef.Filesystems/ISO9660/Structs/Joliet.cs @@ -54,7 +54,7 @@ namespace DiscImageChef.Filesystems.ISO9660 }; if(jolietvd.creation_date[0] < 0x31 || jolietvd.creation_date[0] > 0x39) - decodedVD.CreationTime = DateTime.MinValue; + decodedVD.CreationTime = DateTime.MinValue; else decodedVD.CreationTime = DateHandlers.Iso9660ToDateTime(jolietvd.creation_date); if(jolietvd.modification_date[0] < 0x31 || jolietvd.modification_date[0] > 0x39) @@ -62,7 +62,7 @@ namespace DiscImageChef.Filesystems.ISO9660 else { decodedVD.HasModificationTime = true; - decodedVD.ModificationTime = DateHandlers.Iso9660ToDateTime(jolietvd.modification_date); + decodedVD.ModificationTime = DateHandlers.Iso9660ToDateTime(jolietvd.modification_date); } if(jolietvd.expiration_date[0] < 0x31 || jolietvd.expiration_date[0] > 0x39) @@ -70,7 +70,7 @@ namespace DiscImageChef.Filesystems.ISO9660 else { decodedVD.HasExpirationTime = true; - decodedVD.ExpirationTime = DateHandlers.Iso9660ToDateTime(jolietvd.expiration_date); + decodedVD.ExpirationTime = DateHandlers.Iso9660ToDateTime(jolietvd.expiration_date); } if(jolietvd.effective_date[0] < 0x31 || jolietvd.effective_date[0] > 0x39) @@ -78,10 +78,10 @@ namespace DiscImageChef.Filesystems.ISO9660 else { decodedVD.HasEffectiveTime = true; - decodedVD.EffectiveTime = DateHandlers.Iso9660ToDateTime(jolietvd.effective_date); + decodedVD.EffectiveTime = DateHandlers.Iso9660ToDateTime(jolietvd.effective_date); } - decodedVD.Blocks = jolietvd.volume_space_size; + decodedVD.Blocks = jolietvd.volume_space_size; decodedVD.BlockSize = jolietvd.logical_block_size; return decodedVD; diff --git a/DiscImageChef.Filesystems/ISO9660/Structs/RRIP.cs b/DiscImageChef.Filesystems/ISO9660/Structs/RRIP.cs index f01e0c6d9..5af8ee082 100644 --- a/DiscImageChef.Filesystems/ISO9660/Structs/RRIP.cs +++ b/DiscImageChef.Filesystems/ISO9660/Structs/RRIP.cs @@ -39,39 +39,39 @@ namespace DiscImageChef.Filesystems.ISO9660 [StructLayout(LayoutKind.Sequential, Pack = 1)] struct PosixAttributes { - public ushort signature; - public byte length; - public byte version; + public ushort signature; + public byte length; + public byte version; public PosixMode st_mode; public PosixMode st_mode_be; - public uint st_nlink; - public uint st_nlink_be; - public uint st_uid; - public uint st_uid_be; - public uint st_gid; - public uint st_gid_be; - public uint st_ino; - public uint st_ino_be; + public uint st_nlink; + public uint st_nlink_be; + public uint st_uid; + public uint st_uid_be; + public uint st_gid; + public uint st_gid_be; + public uint st_ino; + public uint st_ino_be; } [StructLayout(LayoutKind.Sequential, Pack = 1)] struct PosixDeviceNumber { public ushort signature; - public byte length; - public byte version; - public uint dev_t_high; - public uint dev_t_high_be; - public uint dev_t_low; - public uint dev_t_low_be; + public byte length; + public byte version; + public uint dev_t_high; + public uint dev_t_high_be; + public uint dev_t_low; + public uint dev_t_low_be; } [StructLayout(LayoutKind.Sequential, Pack = 1)] struct SymbolicLink { - public ushort signature; - public byte length; - public byte version; + public ushort signature; + public byte length; + public byte version; public SymlinkFlags flags; // Followed by SymbolicLinkComponent (link to /bar/foo uses at least two of these structs) } @@ -80,16 +80,16 @@ namespace DiscImageChef.Filesystems.ISO9660 struct SymbolicLinkComponent { public SymlinkComponentFlags flags; - public byte length; + public byte length; // Followed by component content } [StructLayout(LayoutKind.Sequential, Pack = 1)] struct AlternateName { - public ushort signature; - public byte length; - public byte version; + public ushort signature; + public byte length; + public byte version; public AlternateNameFlags flags; // Folowed by name, can be divided in pieces } @@ -98,36 +98,36 @@ namespace DiscImageChef.Filesystems.ISO9660 struct ChildLink { public ushort signature; - public byte length; - public byte version; - public uint child_dir_lba; - public uint child_dir_lba_be; + public byte length; + public byte version; + public uint child_dir_lba; + public uint child_dir_lba_be; } [StructLayout(LayoutKind.Sequential, Pack = 1)] struct ParentLink { public ushort signature; - public byte length; - public byte version; - public uint parent_dir_lba; - public uint parent_dir_lba_be; + public byte length; + public byte version; + public uint parent_dir_lba; + public uint parent_dir_lba_be; } [StructLayout(LayoutKind.Sequential, Pack = 1)] struct RelocatedDirectory { public ushort signature; - public byte length; - public byte version; + public byte length; + public byte version; } [StructLayout(LayoutKind.Sequential, Pack = 1)] struct Timestamps { - public ushort signature; - public byte length; - public byte version; + public ushort signature; + public byte length; + public byte version; public TimestampFlags flags; // If flags indicate long format, timestamps are 17 bytes, if not, 7 bytes // Followed by creation time if present @@ -143,13 +143,13 @@ namespace DiscImageChef.Filesystems.ISO9660 struct SparseFile { public ushort signature; - public byte length; - public byte version; - public uint virtual_size_high; - public uint virtual_size_high_be; - public uint virtual_size_low; - public uint virtual_size_low_be; - public byte table_depth; + public byte length; + public byte version; + public uint virtual_size_high; + public uint virtual_size_high_be; + public uint virtual_size_low; + public uint virtual_size_low_be; + 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 dd3bf6241..794052dd5 100644 --- a/DiscImageChef.Filesystems/ISO9660/Structs/SUSP.cs +++ b/DiscImageChef.Filesystems/ISO9660/Structs/SUSP.cs @@ -40,52 +40,52 @@ namespace DiscImageChef.Filesystems.ISO9660 struct ContinuationArea { public ushort signature; - public byte length; - public byte version; - public uint block; - public uint block_be; - public uint offset; - public uint offset_be; - public uint ca_length; - public uint ca_length_be; + public byte length; + public byte version; + public uint block; + public uint block_be; + public uint offset; + public uint offset_be; + public uint ca_length; + public uint ca_length_be; } [StructLayout(LayoutKind.Sequential, Pack = 1)] struct PaddingArea { public ushort signature; - public byte length; - public byte version; + public byte length; + public byte version; } [StructLayout(LayoutKind.Sequential, Pack = 1)] struct IndicatorArea { public ushort signature; - public byte length; - public byte version; + public byte length; + public byte version; public ushort magic; - public byte skipped; + public byte skipped; } [StructLayout(LayoutKind.Sequential, Pack = 1)] struct TerminatorArea { public ushort signature; - public byte length; - public byte version; + public byte length; + public byte version; } [StructLayout(LayoutKind.Sequential, Pack = 1)] struct ReferenceArea { public ushort signature; - public byte length; - public byte version; - public byte id_len; - public byte des_len; - public byte src_len; - public byte ext_ver; + public byte length; + public byte version; + public byte id_len; + public byte des_len; + public byte src_len; + public byte ext_ver; // Follows extension identifier for id_len bytes // Follows extension descriptor for des_len bytes // Follows extension source for src_len bytes @@ -95,9 +95,9 @@ namespace DiscImageChef.Filesystems.ISO9660 struct SelectorArea { public ushort signature; - public byte length; - public byte version; - public byte sequence; + public byte length; + public byte version; + 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 acfe92f00..661109ca4 100644 --- a/DiscImageChef.Filesystems/ISO9660/Structs/XA.cs +++ b/DiscImageChef.Filesystems/ISO9660/Structs/XA.cs @@ -40,12 +40,13 @@ namespace DiscImageChef.Filesystems.ISO9660 [StructLayout(LayoutKind.Sequential, Pack = 1)] struct CdromXa { - public ushort group; - public ushort user; + public ushort group; + public ushort user; public XaAttributes attributes; - public ushort signature; - public byte filenumber; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 5)] public byte[] reserved; + public ushort signature; + public byte filenumber; + [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 115073c7a..b2ed447c3 100644 --- a/DiscImageChef.Filesystems/ISO9660/Structs/Ziso.cs +++ b/DiscImageChef.Filesystems/ISO9660/Structs/Ziso.cs @@ -40,23 +40,23 @@ namespace DiscImageChef.Filesystems.ISO9660 struct ZisofsHeader { public ulong magic; - public uint uncomp_len; - public uint uncomp_len_be; - public byte header_size; // Shifted >> 2 - public byte block_size_log; // log2(block_size) + public uint uncomp_len; + public uint uncomp_len_be; + public byte header_size; // Shifted >> 2 + public byte block_size_log; // log2(block_size) } [StructLayout(LayoutKind.Sequential, Pack = 1)] struct ZisofsEntry { public ushort signature; - public byte length; - public byte version; + public byte length; + public byte version; public ushort alogirhtm; - public byte header_size; // Shifted >> 2 - public byte block_size_log; // log2(block_size) - public uint uncomp_len; - public uint uncomp_len_be; + public byte header_size; // Shifted >> 2 + public byte block_size_log; // log2(block_size) + public uint uncomp_len; + public uint uncomp_len_be; } } } \ No newline at end of file diff --git a/DiscImageChef.Filesystems/JFS.cs b/DiscImageChef.Filesystems/JFS.cs index 072a2d3c4..ab3ba55ea 100644 --- a/DiscImageChef.Filesystems/JFS.cs +++ b/DiscImageChef.Filesystems/JFS.cs @@ -42,12 +42,12 @@ namespace DiscImageChef.Filesystems public class JFS : IFilesystem { const uint JFS_BOOT_BLOCKS_SIZE = 0x8000; - const uint JFS_MAGIC = 0x3153464A; + const uint JFS_MAGIC = 0x3153464A; public FileSystemType XmlFsType { get; private set; } - public Encoding Encoding { get; private set; } - public string Name => "JFS Plugin"; - public Guid Id => new Guid("D3BE2A41-8F28-4055-94DC-BB6C72A0E9C4"); + public Encoding Encoding { get; private set; } + public string Name => "JFS Plugin"; + public Guid Id => new Guid("D3BE2A41-8F28-4055-94DC-BB6C72A0E9C4"); public bool Identify(IMediaImage imagePlugin, Partition partition) { @@ -58,7 +58,7 @@ namespace DiscImageChef.Filesystems if(sector.Length < 512) return false; JfsSuperBlock jfsSb = new JfsSuperBlock(); - IntPtr sbPtr = Marshal.AllocHGlobal(Marshal.SizeOf(jfsSb)); + IntPtr sbPtr = Marshal.AllocHGlobal(Marshal.SizeOf(jfsSb)); Marshal.Copy(sector, 0, sbPtr, Marshal.SizeOf(jfsSb)); jfsSb = (JfsSuperBlock)Marshal.PtrToStructure(sbPtr, typeof(JfsSuperBlock)); Marshal.FreeHGlobal(sbPtr); @@ -67,17 +67,17 @@ namespace DiscImageChef.Filesystems } public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information, - Encoding encoding) + Encoding encoding) { - Encoding = encoding ?? Encoding.GetEncoding("iso-8859-15"); + Encoding = encoding ?? Encoding.GetEncoding("iso-8859-15"); information = ""; - StringBuilder sb = new StringBuilder(); - uint bootSectors = JFS_BOOT_BLOCKS_SIZE / imagePlugin.Info.SectorSize; - byte[] sector = imagePlugin.ReadSector(partition.Start + bootSectors); + StringBuilder sb = new StringBuilder(); + uint bootSectors = JFS_BOOT_BLOCKS_SIZE / imagePlugin.Info.SectorSize; + byte[] sector = imagePlugin.ReadSector(partition.Start + bootSectors); if(sector.Length < 512) return; JfsSuperBlock jfsSb = new JfsSuperBlock(); - IntPtr sbPtr = Marshal.AllocHGlobal(Marshal.SizeOf(jfsSb)); + IntPtr sbPtr = Marshal.AllocHGlobal(Marshal.SizeOf(jfsSb)); Marshal.Copy(sector, 0, sbPtr, Marshal.SizeOf(jfsSb)); jfsSb = (JfsSuperBlock)Marshal.PtrToStructure(sbPtr, typeof(JfsSuperBlock)); Marshal.FreeHGlobal(sbPtr); @@ -123,13 +123,14 @@ namespace DiscImageChef.Filesystems XmlFsType = new FileSystemType { - Type = "JFS filesystem", - Clusters = (long)jfsSb.s_size, - ClusterSize = (int)jfsSb.s_bsize, - Bootable = true, - VolumeName = Encoding.GetString(jfsSb.s_version == 1 ? jfsSb.s_fpack : jfsSb.s_label), + Type = "JFS filesystem", + Clusters = (long)jfsSb.s_size, + ClusterSize = (int)jfsSb.s_bsize, + Bootable = true, + VolumeName = Encoding.GetString(jfsSb.s_version == 1 ? jfsSb.s_fpack : jfsSb.s_label), VolumeSerial = $"{jfsSb.s_uuid}", - ModificationDate = DateHandlers.UnixUnsignedToDateTime(jfsSb.s_time.tv_sec, jfsSb.s_time.tv_nsec), + ModificationDate = + DateHandlers.UnixUnsignedToDateTime(jfsSb.s_time.tv_sec, jfsSb.s_time.tv_nsec), ModificationDateSpecified = true }; if(jfsSb.s_state != 0) XmlFsType.Dirty = true; @@ -140,38 +141,38 @@ namespace DiscImageChef.Filesystems [Flags] enum JfsFlags : 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] enum JfsState : uint { - Clean = 0, - Mounted = 1, - Dirty = 2, - Logredo = 4, + Clean = 0, + Mounted = 1, + Dirty = 2, + Logredo = 4, Extendfs = 8 } @@ -195,34 +196,36 @@ namespace DiscImageChef.Filesystems [StructLayout(LayoutKind.Sequential, Pack = 1)] struct JfsSuperBlock { - public uint s_magic; - public uint s_version; - public ulong s_size; - public uint s_bsize; - public ushort s_l2bsize; - public ushort s_l2bfactor; - public uint s_pbsize; - public ushort s_l1pbsize; - public ushort pad; - public uint s_agsize; - public JfsFlags s_flags; - public JfsState s_state; - public uint s_compress; - public JfsExtent s_ait2; - public JfsExtent s_aim2; - public uint s_logdev; - public uint s_logserial; - public JfsExtent s_logpxd; - public JfsExtent s_fsckpxd; + public uint s_magic; + public uint s_version; + public ulong s_size; + public uint s_bsize; + public ushort s_l2bsize; + public ushort s_l2bfactor; + public uint s_pbsize; + public ushort s_l1pbsize; + public ushort pad; + public uint s_agsize; + public JfsFlags s_flags; + public JfsState s_state; + public uint s_compress; + public JfsExtent s_ait2; + public JfsExtent s_aim2; + public uint s_logdev; + public uint s_logserial; + public JfsExtent s_logpxd; + public JfsExtent s_fsckpxd; public JfsTimeStruct s_time; - public uint s_fsckloglen; - public sbyte s_fscklog; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 11)] public byte[] s_fpack; - public ulong s_xsize; + public uint s_fsckloglen; + public sbyte s_fscklog; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 11)] + public byte[] s_fpack; + public ulong s_xsize; public JfsExtent s_xfsckpxd; public JfsExtent s_xlogpxd; - public Guid s_uuid; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] public byte[] s_label; + public Guid s_uuid; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] + public byte[] s_label; public Guid s_loguuid; } } diff --git a/DiscImageChef.Filesystems/LIF.cs b/DiscImageChef.Filesystems/LIF.cs index 5b5a97180..57804b83b 100644 --- a/DiscImageChef.Filesystems/LIF.cs +++ b/DiscImageChef.Filesystems/LIF.cs @@ -46,31 +46,31 @@ namespace DiscImageChef.Filesystems const uint LIF_MAGIC = 0x8000; public FileSystemType XmlFsType { get; private set; } - public Encoding Encoding { get; private set; } - public string Name => "HP Logical Interchange Format Plugin"; - public Guid Id => new Guid("41535647-77A5-477B-9206-DA727ACDC704"); + public Encoding Encoding { get; private set; } + public string Name => "HP Logical Interchange Format Plugin"; + public Guid Id => new Guid("41535647-77A5-477B-9206-DA727ACDC704"); public bool Identify(IMediaImage imagePlugin, Partition partition) { if(imagePlugin.Info.SectorSize < 256) return false; - byte[] sector = imagePlugin.ReadSector(partition.Start); - LifSystemBlock lifSb = BigEndianMarshal.ByteArrayToStructureBigEndian(sector); + byte[] sector = imagePlugin.ReadSector(partition.Start); + LifSystemBlock lifSb = BigEndianMarshal.ByteArrayToStructureBigEndian(sector); DicConsole.DebugWriteLine("LIF plugin", "magic 0x{0:X8} (expected 0x{1:X8})", lifSb.magic, LIF_MAGIC); return lifSb.magic == LIF_MAGIC; } public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information, - Encoding encoding) + Encoding encoding) { - Encoding = encoding ?? Encoding.GetEncoding("iso-8859-15"); + Encoding = encoding ?? Encoding.GetEncoding("iso-8859-15"); information = ""; if(imagePlugin.Info.SectorSize < 256) return; - byte[] sector = imagePlugin.ReadSector(partition.Start); - LifSystemBlock lifSb = BigEndianMarshal.ByteArrayToStructureBigEndian(sector); + byte[] sector = imagePlugin.ReadSector(partition.Start); + LifSystemBlock lifSb = BigEndianMarshal.ByteArrayToStructureBigEndian(sector); if(lifSb.magic != LIF_MAGIC) return; @@ -92,12 +92,12 @@ namespace DiscImageChef.Filesystems XmlFsType = new FileSystemType { - Type = "HP Logical Interchange Format", - ClusterSize = 256, - Clusters = (long)(partition.Size / 256), - CreationDate = DateHandlers.LifToDateTime(lifSb.creationDate), + Type = "HP Logical Interchange Format", + ClusterSize = 256, + Clusters = (long)(partition.Size / 256), + CreationDate = DateHandlers.LifToDateTime(lifSb.creationDate), CreationDateSpecified = true, - VolumeName = StringHandlers.CToString(lifSb.volumeLabel, Encoding) + VolumeName = StringHandlers.CToString(lifSb.volumeLabel, Encoding) }; } @@ -105,17 +105,19 @@ namespace DiscImageChef.Filesystems struct LifSystemBlock { public ushort magic; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)] public byte[] volumeLabel; - public uint directoryStart; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)] + public byte[] volumeLabel; + public uint directoryStart; public ushort lifId; public ushort unused; - public uint directorySize; + public uint directorySize; public ushort lifVersion; public ushort unused2; - public uint tracks; - public uint heads; - public uint sectors; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)] public byte[] creationDate; + public uint tracks; + public uint heads; + public uint sectors; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)] + public byte[] creationDate; } } } \ No newline at end of file diff --git a/DiscImageChef.Filesystems/LisaFS/Consts.cs b/DiscImageChef.Filesystems/LisaFS/Consts.cs index 5e003206a..337516073 100644 --- a/DiscImageChef.Filesystems/LisaFS/Consts.cs +++ b/DiscImageChef.Filesystems/LisaFS/Consts.cs @@ -81,7 +81,7 @@ namespace DiscImageChef.Filesystems.LisaFS const ushort FILEID_SRECORD = 0x0003; /// The root catalog const ushort FILEID_CATALOG = 0x0004; - const short FILEID_BOOT_SIGNED = -21846; + const short FILEID_BOOT_SIGNED = -21846; const short FILEID_LOADER_SIGNED = -17477; /// /// A file that has been erased diff --git a/DiscImageChef.Filesystems/LisaFS/Dir.cs b/DiscImageChef.Filesystems/LisaFS/Dir.cs index 2b87c8b21..d437706e8 100644 --- a/DiscImageChef.Filesystems/LisaFS/Dir.cs +++ b/DiscImageChef.Filesystems/LisaFS/Dir.cs @@ -114,7 +114,7 @@ namespace DiscImageChef.Filesystems.LisaFS Errno error = ReadFile((short)FILEID_CATALOG, out byte[] buf); if(error != Errno.NoError) return error; - int offset = 0; + int offset = 0; List catalogV2 = new List(); // For each entry on the catalog @@ -123,12 +123,12 @@ namespace DiscImageChef.Filesystems.LisaFS CatalogEntryV2 entV2 = new CatalogEntryV2 { filenameLen = buf[offset], - filename = new byte[E_NAME], - unknown1 = buf[offset + 0x21], - fileType = buf[offset + 0x22], - unknown2 = buf[offset + 0x23], - fileID = BigEndianBitConverter.ToInt16(buf, offset + 0x24), - unknown3 = new byte[16] + filename = new byte[E_NAME], + unknown1 = buf[offset + 0x21], + fileType = buf[offset + 0x22], + unknown2 = buf[offset + 0x23], + fileID = BigEndianBitConverter.ToInt16(buf, offset + 0x24), + unknown3 = new byte[16] }; Array.Copy(buf, offset + 0x01, entV2.filename, 0, E_NAME); Array.Copy(buf, offset + 0x26, entV2.unknown3, 0, 16); @@ -148,12 +148,12 @@ namespace DiscImageChef.Filesystems.LisaFS CatalogEntry entV3 = new CatalogEntry { - fileID = entV2.fileID, + fileID = entV2.fileID, filename = new byte[32], fileType = entV2.fileType, - length = (int)srecords[entV2.fileID].filesize, - dtc = ext.dtc, - dtm = ext.dtm + length = (int)srecords[entV2.fileID].filesize, + dtc = ext.dtc, + dtm = ext.dtm }; Array.Copy(entV2.filename, 0, entV3.filename, 0, entV2.filenameLen); @@ -192,7 +192,7 @@ namespace DiscImageChef.Filesystems.LisaFS if(prevTag.FileId != FILEID_CATALOG) return Errno.InvalidArgument; - firstCatalogBlock = device.ReadSectors(prevCatalogPointer + mddf.mddf_block + volumePrefix, 4); + firstCatalogBlock = device.ReadSectors(prevCatalogPointer + mddf.mddf_block + volumePrefix, 4); prevCatalogPointer = BigEndianBitConverter.ToUInt32(firstCatalogBlock, 0x7F6); } @@ -222,7 +222,8 @@ namespace DiscImageChef.Filesystems.LisaFS // Traverse all entries 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; // Apparently reserved to indicate end of catalog? @@ -232,21 +233,21 @@ namespace DiscImageChef.Filesystems.LisaFS { CatalogEntry entry = new CatalogEntry { - marker = buf[offset], - parentID = BigEndianBitConverter.ToUInt16(buf, offset + 0x01), - filename = new byte[E_NAME], - terminator = buf[offset + 0x23], - fileType = buf[offset + 0x24], - unknown = buf[offset + 0x25], - fileID = BigEndianBitConverter.ToInt16(buf, offset + 0x26), - dtc = BigEndianBitConverter.ToUInt32(buf, offset + 0x28), - dtm = BigEndianBitConverter.ToUInt32(buf, offset + 0x2C), - length = BigEndianBitConverter.ToInt32(buf, offset + 0x30), - wasted = BigEndianBitConverter.ToInt32(buf, offset + 0x34), - tail = new byte[8] + marker = buf[offset], + parentID = BigEndianBitConverter.ToUInt16(buf, offset + 0x01), + filename = new byte[E_NAME], + terminator = buf[offset + 0x23], + fileType = buf[offset + 0x24], + unknown = buf[offset + 0x25], + fileID = BigEndianBitConverter.ToInt16(buf, offset + 0x26), + dtc = BigEndianBitConverter.ToUInt32(buf, offset + 0x28), + dtm = BigEndianBitConverter.ToUInt32(buf, offset + 0x2C), + length = BigEndianBitConverter.ToInt32(buf, offset + 0x30), + wasted = BigEndianBitConverter.ToInt32(buf, offset + 0x34), + tail = new byte[8] }; Array.Copy(buf, offset + 0x03, entry.filename, 0, E_NAME); - Array.Copy(buf, offset + 0x38, entry.tail, 0, 8); + Array.Copy(buf, offset + 0x38, entry.tail, 0, 8); if(ReadExtentsFile(entry.fileID, out _) == Errno.NoError) if(!fileSizeCache.ContainsKey(entry.fileID)) @@ -262,18 +263,18 @@ namespace DiscImageChef.Filesystems.LisaFS { CatalogEntry entry = new CatalogEntry { - marker = buf[offset], - parentID = BigEndianBitConverter.ToUInt16(buf, offset + 0x01), - filename = new byte[E_NAME], - terminator = buf[offset + 0x23], - fileType = buf[offset + 0x24], - unknown = buf[offset + 0x25], - fileID = BigEndianBitConverter.ToInt16(buf, offset + 0x26), - dtc = BigEndianBitConverter.ToUInt32(buf, offset + 0x28), - dtm = BigEndianBitConverter.ToUInt32(buf, offset + 0x2C), - length = 0, - wasted = 0, - tail = null + marker = buf[offset], + parentID = BigEndianBitConverter.ToUInt16(buf, offset + 0x01), + filename = new byte[E_NAME], + terminator = buf[offset + 0x23], + fileType = buf[offset + 0x24], + unknown = buf[offset + 0x25], + fileID = BigEndianBitConverter.ToInt16(buf, offset + 0x26), + dtc = BigEndianBitConverter.ToUInt32(buf, offset + 0x28), + dtm = BigEndianBitConverter.ToUInt32(buf, offset + 0x2C), + length = 0, + wasted = 0, + tail = null }; Array.Copy(buf, offset + 0x03, entry.filename, 0, E_NAME); @@ -299,15 +300,15 @@ namespace DiscImageChef.Filesystems.LisaFS stat = new FileEntryInfo { Attributes = new FileAttributes(), - Inode = FILEID_CATALOG, - Mode = 0x16D, - Links = 0, - UID = 0, - GID = 0, - DeviceNo = 0, - Length = 0, - BlockSize = mddf.datasize, - Blocks = 0 + Inode = FILEID_CATALOG, + Mode = 0x16D, + Links = 0, + UID = 0, + GID = 0, + DeviceNo = 0, + Length = 0, + BlockSize = mddf.datasize, + Blocks = 0 }; directoryDtcCache.TryGetValue(dirId, out DateTime tmp); diff --git a/DiscImageChef.Filesystems/LisaFS/Extent.cs b/DiscImageChef.Filesystems/LisaFS/Extent.cs index 660daeebd..d23ff7b52 100644 --- a/DiscImageChef.Filesystems/LisaFS/Extent.cs +++ b/DiscImageChef.Filesystems/LisaFS/Extent.cs @@ -88,7 +88,7 @@ namespace DiscImageChef.Filesystems.LisaFS DecodeTag(device.ReadSectorTag(i, SectorTagType.AppleSectorTag), out extTag); if(extTag.FileId != fileId * -1) continue; - ptr = i; + ptr = i; found = true; break; } @@ -106,36 +106,36 @@ namespace DiscImageChef.Filesystems.LisaFS if(sector[0] >= 32 || sector[0] == 0) return Errno.InvalidArgument; file.filenameLen = sector[0]; - file.filename = new byte[file.filenameLen]; + file.filename = new byte[file.filenameLen]; Array.Copy(sector, 0x01, file.filename, 0, file.filenameLen); - file.unknown1 = BigEndianBitConverter.ToUInt16(sector, 0x20); - file.file_uid = BigEndianBitConverter.ToUInt64(sector, 0x22); - file.unknown2 = sector[0x2A]; - file.etype = sector[0x2B]; - file.ftype = (FileType)sector[0x2C]; - file.unknown3 = sector[0x2D]; - file.dtc = BigEndianBitConverter.ToUInt32(sector, 0x2E); - file.dta = BigEndianBitConverter.ToUInt32(sector, 0x32); - file.dtm = BigEndianBitConverter.ToUInt32(sector, 0x36); - file.dtb = BigEndianBitConverter.ToUInt32(sector, 0x3A); - file.dts = BigEndianBitConverter.ToUInt32(sector, 0x3E); - file.serial = BigEndianBitConverter.ToUInt32(sector, 0x42); - file.unknown4 = sector[0x46]; - file.locked = sector[0x47]; - file.protect = sector[0x48]; - file.master = sector[0x49]; + file.unknown1 = BigEndianBitConverter.ToUInt16(sector, 0x20); + file.file_uid = BigEndianBitConverter.ToUInt64(sector, 0x22); + file.unknown2 = sector[0x2A]; + file.etype = sector[0x2B]; + file.ftype = (FileType)sector[0x2C]; + file.unknown3 = sector[0x2D]; + file.dtc = BigEndianBitConverter.ToUInt32(sector, 0x2E); + file.dta = BigEndianBitConverter.ToUInt32(sector, 0x32); + file.dtm = BigEndianBitConverter.ToUInt32(sector, 0x36); + file.dtb = BigEndianBitConverter.ToUInt32(sector, 0x3A); + file.dts = BigEndianBitConverter.ToUInt32(sector, 0x3E); + file.serial = BigEndianBitConverter.ToUInt32(sector, 0x42); + file.unknown4 = sector[0x46]; + file.locked = sector[0x47]; + file.protect = sector[0x48]; + file.master = sector[0x49]; file.scavenged = sector[0x4A]; - file.closed = sector[0x4B]; - file.open = sector[0x4C]; - file.unknown5 = new byte[11]; + file.closed = sector[0x4B]; + file.open = sector[0x4C]; + file.unknown5 = new byte[11]; Array.Copy(sector, 0x4D, file.unknown5, 0, 11); - file.release = BigEndianBitConverter.ToUInt16(sector, 0x58); - file.build = BigEndianBitConverter.ToUInt16(sector, 0x5A); - file.compatibility = BigEndianBitConverter.ToUInt16(sector, 0x5C); - file.revision = BigEndianBitConverter.ToUInt16(sector, 0x5E); - file.unknown6 = BigEndianBitConverter.ToUInt16(sector, 0x60); + file.release = BigEndianBitConverter.ToUInt16(sector, 0x58); + file.build = BigEndianBitConverter.ToUInt16(sector, 0x5A); + file.compatibility = BigEndianBitConverter.ToUInt16(sector, 0x5C); + file.revision = BigEndianBitConverter.ToUInt16(sector, 0x5E); + file.unknown6 = BigEndianBitConverter.ToUInt16(sector, 0x60); file.password_valid = sector[0x62]; - file.password = new byte[8]; + file.password = new byte[8]; Array.Copy(sector, 0x63, file.password, 0, 8); file.unknown7 = new byte[3]; Array.Copy(sector, 0x6B, file.unknown7, 0, 3); @@ -143,7 +143,7 @@ namespace DiscImageChef.Filesystems.LisaFS file.unknown8 = new byte[16]; Array.Copy(sector, 0x70, file.unknown8, 0, 16); file.unknown10 = BigEndianBitConverter.ToInt16(sector, 0x17E); - file.LisaInfo = new byte[128]; + file.LisaInfo = new byte[128]; Array.Copy(sector, 0x180, file.LisaInfo, 0, 128); int extentsCount = 0; @@ -151,13 +151,13 @@ namespace DiscImageChef.Filesystems.LisaFS if(mddf.fsversion == LISA_V1) { - file.length = BigEndianBitConverter.ToInt32(sector, 0x200); + file.length = BigEndianBitConverter.ToInt32(sector, 0x200); file.unknown9 = BigEndianBitConverter.ToInt32(sector, 0x204); extentsOffset = 0x208; } else { - file.length = BigEndianBitConverter.ToInt32(sector, 0x80); + file.length = BigEndianBitConverter.ToInt32(sector, 0x80); file.unknown9 = BigEndianBitConverter.ToInt32(sector, 0x84); extentsOffset = 0x88; } @@ -174,7 +174,7 @@ namespace DiscImageChef.Filesystems.LisaFS for(int j = 0; j < extentsCount; j++) file.extents[j] = new Extent { - start = BigEndianBitConverter.ToInt32(sector, extentsOffset + j * 6), + start = BigEndianBitConverter.ToInt32(sector, extentsOffset + j * 6), length = BigEndianBitConverter.ToInt16(sector, extentsOffset + j * 6 + 4) }; @@ -187,35 +187,41 @@ namespace DiscImageChef.Filesystems.LisaFS DicConsole.DebugWriteLine("LisaFS plugin", "ExtentFile[{0}].filenameLen = {1}", fileId, file.filenameLen); DicConsole.DebugWriteLine("LisaFS plugin", "ExtentFile[{0}].filename = {1}", fileId, StringHandlers.CToString(file.filename, Encoding)); - DicConsole.DebugWriteLine("LisaFS plugin", "ExtentFile[{0}].unknown1 = 0x{1:X4}", fileId, file.unknown1); + 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}].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}].open = {1}", fileId, file.open > 0); + 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}].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}].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}].build = {1}", fileId, file.build); + 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}].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); @@ -231,7 +237,7 @@ namespace DiscImageChef.Filesystems.LisaFS 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}].length = {1}", fileId, file.length); DicConsole.DebugWriteLine("LisaFS plugin", "ExtentFile[{0}].unknown9 = 0x{1:X8}", fileId, file.unknown9); for(int ext = 0; ext < file.extents.Length; ext++) { @@ -265,9 +271,9 @@ namespace DiscImageChef.Filesystems.LisaFS srecords[s] = new SRecord { extent_ptr = BigEndianBitConverter.ToUInt32(sectors, 0x00 + 14 * s), - unknown = BigEndianBitConverter.ToUInt32(sectors, 0x04 + 14 * s), - filesize = BigEndianBitConverter.ToUInt32(sectors, 0x08 + 14 * s), - flags = BigEndianBitConverter.ToUInt16(sectors, 0x0C + 14 * s) + unknown = BigEndianBitConverter.ToUInt32(sectors, 0x04 + 14 * s), + filesize = BigEndianBitConverter.ToUInt32(sectors, 0x08 + 14 * s), + flags = BigEndianBitConverter.ToUInt16(sectors, 0x0C + 14 * s) }; return Errno.NoError; diff --git a/DiscImageChef.Filesystems/LisaFS/File.cs b/DiscImageChef.Filesystems/LisaFS/File.cs index 7075d10c2..5c2dd2805 100644 --- a/DiscImageChef.Filesystems/LisaFS/File.cs +++ b/DiscImageChef.Filesystems/LisaFS/File.cs @@ -113,8 +113,8 @@ namespace DiscImageChef.Filesystems.LisaFS { if(!debug) return Errno.NoSuchFile; - attributes = new FileAttributes(); - attributes = FileAttributes.System; + attributes = new FileAttributes(); + attributes = FileAttributes.System; attributes |= FileAttributes.Hidden; attributes |= FileAttributes.File; @@ -145,8 +145,8 @@ namespace DiscImageChef.Filesystems.LisaFS break; } - if(extFile.protect > 0) attributes |= FileAttributes.Immutable; - if(extFile.locked > 0) attributes |= FileAttributes.ReadOnly; + 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; @@ -163,7 +163,8 @@ namespace DiscImageChef.Filesystems.LisaFS 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; @@ -223,11 +224,12 @@ namespace DiscImageChef.Filesystems.LisaFS if(!mounted) return Errno.AccessDenied; - Errno error; + 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 {Attributes = new FileAttributes()}; @@ -240,20 +242,20 @@ namespace DiscImageChef.Filesystems.LisaFS error = ReadExtentsFile((short)(fileId * -1), out file); if(error != Errno.NoError) return error; - stat.CreationTime = DateHandlers.LisaToDateTime(file.dtc); - stat.AccessTime = DateHandlers.LisaToDateTime(file.dta); - stat.BackupTime = DateHandlers.LisaToDateTime(file.dtb); + stat.CreationTime = DateHandlers.LisaToDateTime(file.dtc); + stat.AccessTime = DateHandlers.LisaToDateTime(file.dta); + stat.BackupTime = DateHandlers.LisaToDateTime(file.dtb); stat.LastWriteTime = DateHandlers.LisaToDateTime(file.dtm); - stat.Inode = (ulong)fileId; - stat.Mode = 0x124; - stat.Links = 0; - stat.UID = 0; - stat.GID = 0; - stat.DeviceNo = 0; - stat.Length = mddf.datasize; + stat.Inode = (ulong)fileId; + stat.Mode = 0x124; + stat.Links = 0; + stat.UID = 0; + stat.GID = 0; + stat.DeviceNo = 0; + stat.Length = mddf.datasize; stat.BlockSize = mddf.datasize; - stat.Blocks = 1; + stat.Blocks = 1; } else { @@ -264,42 +266,42 @@ namespace DiscImageChef.Filesystems.LisaFS stat.BackupTime = mddf.dtvb; - stat.Inode = (ulong)fileId; - stat.Mode = 0x124; - stat.Links = 0; - stat.UID = 0; - stat.GID = 0; - stat.DeviceNo = 0; - stat.Length = buf.Length; + stat.Inode = (ulong)fileId; + stat.Mode = 0x124; + stat.Links = 0; + stat.UID = 0; + stat.GID = 0; + stat.DeviceNo = 0; + stat.Length = buf.Length; stat.BlockSize = mddf.datasize; - stat.Blocks = buf.Length / mddf.datasize; + stat.Blocks = buf.Length / mddf.datasize; } return Errno.NoError; } - stat = new FileEntryInfo {Attributes = new FileAttributes()}; + stat = new FileEntryInfo {Attributes = new FileAttributes()}; error = GetAttributes(fileId, out stat.Attributes); if(error != Errno.NoError) return error; error = ReadExtentsFile(fileId, out file); if(error != Errno.NoError) return error; - stat.CreationTime = DateHandlers.LisaToDateTime(file.dtc); - stat.AccessTime = DateHandlers.LisaToDateTime(file.dta); - stat.BackupTime = DateHandlers.LisaToDateTime(file.dtb); + stat.CreationTime = DateHandlers.LisaToDateTime(file.dtc); + stat.AccessTime = DateHandlers.LisaToDateTime(file.dta); + stat.BackupTime = DateHandlers.LisaToDateTime(file.dtb); stat.LastWriteTime = DateHandlers.LisaToDateTime(file.dtm); - stat.Inode = (ulong)fileId; - stat.Mode = 0x1B6; - stat.Links = 1; - stat.UID = 0; - stat.GID = 0; + stat.Inode = (ulong)fileId; + stat.Mode = 0x1B6; + stat.Links = 1; + stat.UID = 0; + stat.GID = 0; stat.DeviceNo = 0; if(!fileSizeCache.TryGetValue(fileId, out int len)) stat.Length = srecords[fileId].filesize; - else stat.Length = len; + else stat.Length = len; stat.BlockSize = mddf.datasize; - stat.Blocks = file.length; + stat.Blocks = file.length; return Errno.NoError; } @@ -326,7 +328,7 @@ namespace DiscImageChef.Filesystems.LisaFS int sectorSize; if(tags) sectorSize = devTagSize; - else sectorSize = (int)device.Info.SectorSize; + else sectorSize = (int)device.Info.SectorSize; byte[] temp = new byte[file.length * sectorSize]; @@ -349,7 +351,8 @@ namespace DiscImageChef.Filesystems.LisaFS if(!tags) { if(fileSizeCache.TryGetValue(fileId, out int 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); @@ -362,7 +365,7 @@ namespace DiscImageChef.Filesystems.LisaFS Errno LookupFileId(string path, out short fileId, out bool isDir) { fileId = 0; - isDir = false; + isDir = false; if(!mounted) return Errno.AccessDenied; @@ -371,7 +374,7 @@ namespace DiscImageChef.Filesystems.LisaFS if(pathElements.Length == 0) { fileId = DIRID_ROOT; - isDir = true; + isDir = true; return Errno.NoError; } @@ -413,7 +416,7 @@ namespace DiscImageChef.Filesystems.LisaFS if(string.Compare(pathElements[0], "$", StringComparison.InvariantCulture) == 0) { fileId = DIRID_ROOT; - isDir = true; + isDir = true; return Errno.NoError; } } @@ -428,10 +431,11 @@ namespace DiscImageChef.Filesystems.LisaFS // LisaOS is case insensitive if(string.Compare(wantedFilename, filename, StringComparison.InvariantCultureIgnoreCase) != 0 || - entry.parentID != fileId) continue; + entry.parentID != + fileId) continue; fileId = entry.fileID; - isDir = entry.fileType == 0x01; + isDir = entry.fileType == 0x01; // Not last path element, and it's not a directory if(lvl != pathElements.Length - 1 && !isDir) return Errno.NotDirectory; diff --git a/DiscImageChef.Filesystems/LisaFS/Info.cs b/DiscImageChef.Filesystems/LisaFS/Info.cs index f2fceead1..ddfa3920a 100644 --- a/DiscImageChef.Filesystems/LisaFS/Info.cs +++ b/DiscImageChef.Filesystems/LisaFS/Info.cs @@ -75,24 +75,26 @@ namespace DiscImageChef.Filesystems.LisaFS byte[] sector = imagePlugin.ReadSector((ulong)i); MDDF infoMddf = new MDDF { - mddf_block = BigEndianBitConverter.ToUInt32(sector, 0x6C), - volsize_minus_one = BigEndianBitConverter.ToUInt32(sector, 0x70), + mddf_block = BigEndianBitConverter.ToUInt32(sector, 0x6C), + volsize_minus_one = BigEndianBitConverter.ToUInt32(sector, 0x70), volsize_minus_mddf_minus_one = BigEndianBitConverter.ToUInt32(sector, 0x74), - vol_size = BigEndianBitConverter.ToUInt32(sector, 0x78), - blocksize = BigEndianBitConverter.ToUInt16(sector, 0x7C), - datasize = BigEndianBitConverter.ToUInt16(sector, 0x7E) + vol_size = BigEndianBitConverter.ToUInt32(sector, 0x78), + blocksize = BigEndianBitConverter.ToUInt16(sector, 0x7C), + datasize = BigEndianBitConverter.ToUInt16(sector, 0x7E) }; - DicConsole.DebugWriteLine("LisaFS plugin", "Current sector = {0}", i); - DicConsole.DebugWriteLine("LisaFS plugin", "mddf.mddf_block = {0}", infoMddf.mddf_block); - DicConsole.DebugWriteLine("LisaFS plugin", "Disk size = {0} sectors", imagePlugin.Info.Sectors); + DicConsole.DebugWriteLine("LisaFS plugin", "Current sector = {0}", i); + DicConsole.DebugWriteLine("LisaFS plugin", "mddf.mddf_block = {0}", infoMddf.mddf_block); + DicConsole.DebugWriteLine("LisaFS plugin", "Disk size = {0} sectors", imagePlugin.Info.Sectors); DicConsole.DebugWriteLine("LisaFS plugin", "mddf.vol_size = {0} sectors", infoMddf.vol_size); - DicConsole.DebugWriteLine("LisaFS plugin", "mddf.vol_size - 1 = {0}", infoMddf.volsize_minus_one); + DicConsole.DebugWriteLine("LisaFS plugin", "mddf.vol_size - 1 = {0}", + infoMddf.volsize_minus_one); DicConsole.DebugWriteLine("LisaFS plugin", "mddf.vol_size - mddf.mddf_block -1 = {0}", infoMddf.volsize_minus_mddf_minus_one); - DicConsole.DebugWriteLine("LisaFS plugin", "Disk sector = {0} bytes", imagePlugin.Info.SectorSize); + DicConsole.DebugWriteLine("LisaFS plugin", "Disk sector = {0} bytes", + imagePlugin.Info.SectorSize); DicConsole.DebugWriteLine("LisaFS plugin", "mddf.blocksize = {0} bytes", infoMddf.blocksize); - DicConsole.DebugWriteLine("LisaFS plugin", "mddf.datasize = {0} bytes", infoMddf.datasize); + DicConsole.DebugWriteLine("LisaFS plugin", "mddf.datasize = {0} bytes", infoMddf.datasize); if(infoMddf.mddf_block != i - beforeMddf) return false; @@ -119,9 +121,9 @@ namespace DiscImageChef.Filesystems.LisaFS } public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information, - Encoding encoding) + Encoding encoding) { - Encoding = new LisaRoman(); + Encoding = new LisaRoman(); information = ""; StringBuilder sb = new StringBuilder(); @@ -151,97 +153,97 @@ namespace DiscImageChef.Filesystems.LisaFS if(searchTag.FileId != FILEID_MDDF) continue; - byte[] sector = imagePlugin.ReadSector((ulong)i); - MDDF infoMddf = new MDDF(); - byte[] pString = new byte[33]; + byte[] sector = imagePlugin.ReadSector((ulong)i); + MDDF infoMddf = new MDDF(); + byte[] pString = new byte[33]; infoMddf.fsversion = BigEndianBitConverter.ToUInt16(sector, 0x00); - infoMddf.volid = BigEndianBitConverter.ToUInt64(sector, 0x02); - infoMddf.volnum = BigEndianBitConverter.ToUInt16(sector, 0x0A); + infoMddf.volid = BigEndianBitConverter.ToUInt64(sector, 0x02); + infoMddf.volnum = BigEndianBitConverter.ToUInt16(sector, 0x0A); Array.Copy(sector, 0x0C, pString, 0, 33); - infoMddf.volname = StringHandlers.PascalToString(pString, Encoding); + infoMddf.volname = StringHandlers.PascalToString(pString, Encoding); infoMddf.unknown1 = sector[0x2D]; Array.Copy(sector, 0x2E, pString, 0, 33); // Prevent garbage - infoMddf.password = pString[0] <= 32 ? StringHandlers.PascalToString(pString, Encoding) : ""; - infoMddf.unknown2 = sector[0x4F]; - infoMddf.machine_id = BigEndianBitConverter.ToUInt32(sector, 0x50); + infoMddf.password = pString[0] <= 32 ? StringHandlers.PascalToString(pString, Encoding) : ""; + infoMddf.unknown2 = sector[0x4F]; + infoMddf.machine_id = BigEndianBitConverter.ToUInt32(sector, 0x50); infoMddf.master_copy_id = BigEndianBitConverter.ToUInt32(sector, 0x54); uint lisaTime = BigEndianBitConverter.ToUInt32(sector, 0x58); - infoMddf.dtvc = DateHandlers.LisaToDateTime(lisaTime); - lisaTime = BigEndianBitConverter.ToUInt32(sector, 0x5C); - infoMddf.dtcc = DateHandlers.LisaToDateTime(lisaTime); - lisaTime = BigEndianBitConverter.ToUInt32(sector, 0x60); - infoMddf.dtvb = DateHandlers.LisaToDateTime(lisaTime); - lisaTime = BigEndianBitConverter.ToUInt32(sector, 0x64); - infoMddf.dtvs = DateHandlers.LisaToDateTime(lisaTime); - infoMddf.unknown3 = BigEndianBitConverter.ToUInt32(sector, 0x68); - infoMddf.mddf_block = BigEndianBitConverter.ToUInt32(sector, 0x6C); - infoMddf.volsize_minus_one = BigEndianBitConverter.ToUInt32(sector, 0x70); + infoMddf.dtvc = DateHandlers.LisaToDateTime(lisaTime); + lisaTime = BigEndianBitConverter.ToUInt32(sector, 0x5C); + infoMddf.dtcc = DateHandlers.LisaToDateTime(lisaTime); + lisaTime = BigEndianBitConverter.ToUInt32(sector, 0x60); + infoMddf.dtvb = DateHandlers.LisaToDateTime(lisaTime); + lisaTime = BigEndianBitConverter.ToUInt32(sector, 0x64); + infoMddf.dtvs = DateHandlers.LisaToDateTime(lisaTime); + infoMddf.unknown3 = BigEndianBitConverter.ToUInt32(sector, 0x68); + infoMddf.mddf_block = BigEndianBitConverter.ToUInt32(sector, 0x6C); + infoMddf.volsize_minus_one = BigEndianBitConverter.ToUInt32(sector, 0x70); infoMddf.volsize_minus_mddf_minus_one = BigEndianBitConverter.ToUInt32(sector, 0x74); - infoMddf.vol_size = BigEndianBitConverter.ToUInt32(sector, 0x78); - infoMddf.blocksize = BigEndianBitConverter.ToUInt16(sector, 0x7C); - infoMddf.datasize = BigEndianBitConverter.ToUInt16(sector, 0x7E); - infoMddf.unknown4 = BigEndianBitConverter.ToUInt16(sector, 0x80); - infoMddf.unknown5 = BigEndianBitConverter.ToUInt32(sector, 0x82); - infoMddf.unknown6 = BigEndianBitConverter.ToUInt32(sector, 0x86); - infoMddf.clustersize = BigEndianBitConverter.ToUInt16(sector, 0x8A); - infoMddf.fs_size = BigEndianBitConverter.ToUInt32(sector, 0x8C); - infoMddf.unknown7 = BigEndianBitConverter.ToUInt32(sector, 0x90); - infoMddf.srec_ptr = BigEndianBitConverter.ToUInt32(sector, 0x94); - infoMddf.unknown9 = BigEndianBitConverter.ToUInt16(sector, 0x98); - infoMddf.srec_len = BigEndianBitConverter.ToUInt16(sector, 0x9A); - infoMddf.unknown10 = BigEndianBitConverter.ToUInt32(sector, 0x9C); - infoMddf.unknown11 = BigEndianBitConverter.ToUInt32(sector, 0xA0); - infoMddf.unknown12 = BigEndianBitConverter.ToUInt32(sector, 0xA4); - infoMddf.unknown13 = BigEndianBitConverter.ToUInt32(sector, 0xA8); - infoMddf.unknown14 = BigEndianBitConverter.ToUInt32(sector, 0xAC); - infoMddf.filecount = BigEndianBitConverter.ToUInt16(sector, 0xB0); - infoMddf.unknown15 = BigEndianBitConverter.ToUInt32(sector, 0xB2); - infoMddf.unknown16 = BigEndianBitConverter.ToUInt32(sector, 0xB6); - infoMddf.freecount = BigEndianBitConverter.ToUInt32(sector, 0xBA); - infoMddf.unknown17 = BigEndianBitConverter.ToUInt16(sector, 0xBE); - infoMddf.unknown18 = BigEndianBitConverter.ToUInt32(sector, 0xC0); - infoMddf.overmount_stamp = BigEndianBitConverter.ToUInt64(sector, 0xC4); - infoMddf.serialization = BigEndianBitConverter.ToUInt32(sector, 0xCC); - infoMddf.unknown19 = BigEndianBitConverter.ToUInt32(sector, 0xD0); - infoMddf.unknown_timestamp = BigEndianBitConverter.ToUInt32(sector, 0xD4); - infoMddf.unknown20 = BigEndianBitConverter.ToUInt32(sector, 0xD8); - infoMddf.unknown21 = BigEndianBitConverter.ToUInt32(sector, 0xDC); - infoMddf.unknown22 = BigEndianBitConverter.ToUInt32(sector, 0xE0); - infoMddf.unknown23 = BigEndianBitConverter.ToUInt32(sector, 0xE4); - infoMddf.unknown24 = BigEndianBitConverter.ToUInt32(sector, 0xE8); - infoMddf.unknown25 = BigEndianBitConverter.ToUInt32(sector, 0xEC); - infoMddf.unknown26 = BigEndianBitConverter.ToUInt32(sector, 0xF0); - infoMddf.unknown27 = BigEndianBitConverter.ToUInt32(sector, 0xF4); - infoMddf.unknown28 = BigEndianBitConverter.ToUInt32(sector, 0xF8); - infoMddf.unknown29 = BigEndianBitConverter.ToUInt32(sector, 0xFC); - infoMddf.unknown30 = BigEndianBitConverter.ToUInt32(sector, 0x100); - infoMddf.unknown31 = BigEndianBitConverter.ToUInt32(sector, 0x104); - infoMddf.unknown32 = BigEndianBitConverter.ToUInt32(sector, 0x108); - infoMddf.unknown33 = BigEndianBitConverter.ToUInt32(sector, 0x10C); - infoMddf.unknown34 = BigEndianBitConverter.ToUInt32(sector, 0x110); - infoMddf.unknown35 = BigEndianBitConverter.ToUInt32(sector, 0x114); - infoMddf.backup_volid = BigEndianBitConverter.ToUInt64(sector, 0x118); - infoMddf.label_size = BigEndianBitConverter.ToUInt16(sector, 0x120); - infoMddf.fs_overhead = BigEndianBitConverter.ToUInt16(sector, 0x122); - infoMddf.result_scavenge = BigEndianBitConverter.ToUInt16(sector, 0x124); - infoMddf.boot_code = BigEndianBitConverter.ToUInt16(sector, 0x126); - infoMddf.boot_environ = BigEndianBitConverter.ToUInt16(sector, 0x6C); - infoMddf.unknown36 = BigEndianBitConverter.ToUInt32(sector, 0x12A); - infoMddf.unknown37 = BigEndianBitConverter.ToUInt32(sector, 0x12E); - infoMddf.unknown38 = BigEndianBitConverter.ToUInt32(sector, 0x132); - infoMddf.vol_sequence = BigEndianBitConverter.ToUInt16(sector, 0x136); - infoMddf.vol_left_mounted = sector[0x138]; + infoMddf.vol_size = BigEndianBitConverter.ToUInt32(sector, 0x78); + infoMddf.blocksize = BigEndianBitConverter.ToUInt16(sector, 0x7C); + infoMddf.datasize = BigEndianBitConverter.ToUInt16(sector, 0x7E); + infoMddf.unknown4 = BigEndianBitConverter.ToUInt16(sector, 0x80); + infoMddf.unknown5 = BigEndianBitConverter.ToUInt32(sector, 0x82); + infoMddf.unknown6 = BigEndianBitConverter.ToUInt32(sector, 0x86); + infoMddf.clustersize = BigEndianBitConverter.ToUInt16(sector, 0x8A); + infoMddf.fs_size = BigEndianBitConverter.ToUInt32(sector, 0x8C); + infoMddf.unknown7 = BigEndianBitConverter.ToUInt32(sector, 0x90); + infoMddf.srec_ptr = BigEndianBitConverter.ToUInt32(sector, 0x94); + infoMddf.unknown9 = BigEndianBitConverter.ToUInt16(sector, 0x98); + infoMddf.srec_len = BigEndianBitConverter.ToUInt16(sector, 0x9A); + infoMddf.unknown10 = BigEndianBitConverter.ToUInt32(sector, 0x9C); + infoMddf.unknown11 = BigEndianBitConverter.ToUInt32(sector, 0xA0); + infoMddf.unknown12 = BigEndianBitConverter.ToUInt32(sector, 0xA4); + infoMddf.unknown13 = BigEndianBitConverter.ToUInt32(sector, 0xA8); + infoMddf.unknown14 = BigEndianBitConverter.ToUInt32(sector, 0xAC); + infoMddf.filecount = BigEndianBitConverter.ToUInt16(sector, 0xB0); + infoMddf.unknown15 = BigEndianBitConverter.ToUInt32(sector, 0xB2); + infoMddf.unknown16 = BigEndianBitConverter.ToUInt32(sector, 0xB6); + infoMddf.freecount = BigEndianBitConverter.ToUInt32(sector, 0xBA); + infoMddf.unknown17 = BigEndianBitConverter.ToUInt16(sector, 0xBE); + infoMddf.unknown18 = BigEndianBitConverter.ToUInt32(sector, 0xC0); + infoMddf.overmount_stamp = BigEndianBitConverter.ToUInt64(sector, 0xC4); + infoMddf.serialization = BigEndianBitConverter.ToUInt32(sector, 0xCC); + infoMddf.unknown19 = BigEndianBitConverter.ToUInt32(sector, 0xD0); + infoMddf.unknown_timestamp = BigEndianBitConverter.ToUInt32(sector, 0xD4); + infoMddf.unknown20 = BigEndianBitConverter.ToUInt32(sector, 0xD8); + infoMddf.unknown21 = BigEndianBitConverter.ToUInt32(sector, 0xDC); + infoMddf.unknown22 = BigEndianBitConverter.ToUInt32(sector, 0xE0); + infoMddf.unknown23 = BigEndianBitConverter.ToUInt32(sector, 0xE4); + infoMddf.unknown24 = BigEndianBitConverter.ToUInt32(sector, 0xE8); + infoMddf.unknown25 = BigEndianBitConverter.ToUInt32(sector, 0xEC); + infoMddf.unknown26 = BigEndianBitConverter.ToUInt32(sector, 0xF0); + infoMddf.unknown27 = BigEndianBitConverter.ToUInt32(sector, 0xF4); + infoMddf.unknown28 = BigEndianBitConverter.ToUInt32(sector, 0xF8); + infoMddf.unknown29 = BigEndianBitConverter.ToUInt32(sector, 0xFC); + infoMddf.unknown30 = BigEndianBitConverter.ToUInt32(sector, 0x100); + infoMddf.unknown31 = BigEndianBitConverter.ToUInt32(sector, 0x104); + infoMddf.unknown32 = BigEndianBitConverter.ToUInt32(sector, 0x108); + infoMddf.unknown33 = BigEndianBitConverter.ToUInt32(sector, 0x10C); + infoMddf.unknown34 = BigEndianBitConverter.ToUInt32(sector, 0x110); + infoMddf.unknown35 = BigEndianBitConverter.ToUInt32(sector, 0x114); + infoMddf.backup_volid = BigEndianBitConverter.ToUInt64(sector, 0x118); + infoMddf.label_size = BigEndianBitConverter.ToUInt16(sector, 0x120); + infoMddf.fs_overhead = BigEndianBitConverter.ToUInt16(sector, 0x122); + infoMddf.result_scavenge = BigEndianBitConverter.ToUInt16(sector, 0x124); + infoMddf.boot_code = BigEndianBitConverter.ToUInt16(sector, 0x126); + infoMddf.boot_environ = BigEndianBitConverter.ToUInt16(sector, 0x6C); + infoMddf.unknown36 = BigEndianBitConverter.ToUInt32(sector, 0x12A); + infoMddf.unknown37 = BigEndianBitConverter.ToUInt32(sector, 0x12E); + infoMddf.unknown38 = BigEndianBitConverter.ToUInt32(sector, 0x132); + infoMddf.vol_sequence = BigEndianBitConverter.ToUInt16(sector, 0x136); + infoMddf.vol_left_mounted = sector[0x138]; - DicConsole.DebugWriteLine("LisaFS plugin", "mddf.unknown1 = 0x{0:X2} ({0})", infoMddf.unknown1); - DicConsole.DebugWriteLine("LisaFS plugin", "mddf.unknown2 = 0x{0:X2} ({0})", infoMddf.unknown2); - DicConsole.DebugWriteLine("LisaFS plugin", "mddf.unknown3 = 0x{0:X8} ({0})", infoMddf.unknown3); - DicConsole.DebugWriteLine("LisaFS plugin", "mddf.unknown4 = 0x{0:X4} ({0})", infoMddf.unknown4); - DicConsole.DebugWriteLine("LisaFS plugin", "mddf.unknown5 = 0x{0:X8} ({0})", infoMddf.unknown5); - DicConsole.DebugWriteLine("LisaFS plugin", "mddf.unknown6 = 0x{0:X8} ({0})", infoMddf.unknown6); - DicConsole.DebugWriteLine("LisaFS plugin", "mddf.unknown7 = 0x{0:X8} ({0})", infoMddf.unknown7); - DicConsole.DebugWriteLine("LisaFS plugin", "mddf.unknown9 = 0x{0:X4} ({0})", infoMddf.unknown9); + DicConsole.DebugWriteLine("LisaFS plugin", "mddf.unknown1 = 0x{0:X2} ({0})", infoMddf.unknown1); + DicConsole.DebugWriteLine("LisaFS plugin", "mddf.unknown2 = 0x{0:X2} ({0})", infoMddf.unknown2); + DicConsole.DebugWriteLine("LisaFS plugin", "mddf.unknown3 = 0x{0:X8} ({0})", infoMddf.unknown3); + DicConsole.DebugWriteLine("LisaFS plugin", "mddf.unknown4 = 0x{0:X4} ({0})", infoMddf.unknown4); + DicConsole.DebugWriteLine("LisaFS plugin", "mddf.unknown5 = 0x{0:X8} ({0})", infoMddf.unknown5); + DicConsole.DebugWriteLine("LisaFS plugin", "mddf.unknown6 = 0x{0:X8} ({0})", infoMddf.unknown6); + DicConsole.DebugWriteLine("LisaFS plugin", "mddf.unknown7 = 0x{0:X8} ({0})", infoMddf.unknown7); + DicConsole.DebugWriteLine("LisaFS plugin", "mddf.unknown9 = 0x{0:X4} ({0})", infoMddf.unknown9); DicConsole.DebugWriteLine("LisaFS plugin", "mddf.unknown10 = 0x{0:X8} ({0})", infoMddf.unknown10); DicConsole.DebugWriteLine("LisaFS plugin", "mddf.unknown11 = 0x{0:X8} ({0})", infoMddf.unknown11); DicConsole.DebugWriteLine("LisaFS plugin", "mddf.unknown12 = 0x{0:X8} ({0})", infoMddf.unknown12); @@ -352,24 +354,26 @@ namespace DiscImageChef.Filesystems.LisaFS XmlFsType = new FileSystemType(); if(DateTime.Compare(infoMddf.dtvb, DateHandlers.LisaToDateTime(0)) > 0) { - XmlFsType.BackupDate = infoMddf.dtvb; + XmlFsType.BackupDate = infoMddf.dtvb; XmlFsType.BackupDateSpecified = true; } - XmlFsType.Clusters = infoMddf.vol_size; + + XmlFsType.Clusters = infoMddf.vol_size; XmlFsType.ClusterSize = infoMddf.clustersize * infoMddf.datasize; if(DateTime.Compare(infoMddf.dtvc, DateHandlers.LisaToDateTime(0)) > 0) { - XmlFsType.CreationDate = infoMddf.dtvc; + XmlFsType.CreationDate = infoMddf.dtvc; XmlFsType.CreationDateSpecified = true; } - XmlFsType.Dirty = infoMddf.vol_left_mounted != 0; - XmlFsType.Files = infoMddf.filecount; - XmlFsType.FilesSpecified = true; - XmlFsType.FreeClusters = infoMddf.freecount; + + XmlFsType.Dirty = infoMddf.vol_left_mounted != 0; + XmlFsType.Files = infoMddf.filecount; + XmlFsType.FilesSpecified = true; + XmlFsType.FreeClusters = infoMddf.freecount; XmlFsType.FreeClustersSpecified = true; - XmlFsType.Type = "LisaFS"; - XmlFsType.VolumeName = infoMddf.volname; - XmlFsType.VolumeSerial = $"{infoMddf.volid:X16}"; + XmlFsType.Type = "LisaFS"; + XmlFsType.VolumeName = infoMddf.volname; + XmlFsType.VolumeSerial = $"{infoMddf.volid:X16}"; return; } diff --git a/DiscImageChef.Filesystems/LisaFS/LisaFS.cs b/DiscImageChef.Filesystems/LisaFS/LisaFS.cs index 1378a8980..0514a2db5 100644 --- a/DiscImageChef.Filesystems/LisaFS/LisaFS.cs +++ b/DiscImageChef.Filesystems/LisaFS/LisaFS.cs @@ -58,7 +58,7 @@ namespace DiscImageChef.Filesystems.LisaFS // TODO: Implement Lisa 7/7 namespace (needs decoding {!CATALOG} file) public IEnumerable<(string name, Type type, string description)> SupportedOptions => - new(string name, Type type, string description)[] { }; + new (string name, Type type, string description)[] { }; static Dictionary GetDefaultOptions() { diff --git a/DiscImageChef.Filesystems/LisaFS/Structs.cs b/DiscImageChef.Filesystems/LisaFS/Structs.cs index a7d218c54..2125420f2 100644 --- a/DiscImageChef.Filesystems/LisaFS/Structs.cs +++ b/DiscImageChef.Filesystems/LisaFS/Structs.cs @@ -253,7 +253,7 @@ namespace DiscImageChef.Filesystems.LisaFS /// struct Extent { - public int start; + public int start; public short length; } diff --git a/DiscImageChef.Filesystems/LisaFS/Super.cs b/DiscImageChef.Filesystems/LisaFS/Super.cs index 659ea5f5b..0aaace37c 100644 --- a/DiscImageChef.Filesystems/LisaFS/Super.cs +++ b/DiscImageChef.Filesystems/LisaFS/Super.cs @@ -92,8 +92,8 @@ namespace DiscImageChef.Filesystems.LisaFS devTagSize = device.ReadSectorTag(i, SectorTagType.AppleSectorTag).Length; - byte[] sector = device.ReadSector(i); - mddf = new MDDF(); + byte[] sector = device.ReadSector(i); + mddf = new MDDF(); byte[] pString = new byte[33]; mddf.fsversion = BigEndianBitConverter.ToUInt16(sector, 0x00); @@ -104,11 +104,10 @@ namespace DiscImageChef.Filesystems.LisaFS mddf.unknown1 = sector[0x2D]; Array.Copy(sector, 0x2E, pString, 0, 33); // Prevent garbage - mddf.password = - pString[0] <= 32 ? StringHandlers.PascalToString(pString, Encoding) : ""; - mddf.unknown2 = sector[0x4F]; - mddf.machine_id = BigEndianBitConverter.ToUInt32(sector, 0x50); - mddf.master_copy_id = BigEndianBitConverter.ToUInt32(sector, 0x54); + mddf.password = pString[0] <= 32 ? StringHandlers.PascalToString(pString, Encoding) : ""; + mddf.unknown2 = sector[0x4F]; + mddf.machine_id = BigEndianBitConverter.ToUInt32(sector, 0x50); + mddf.master_copy_id = BigEndianBitConverter.ToUInt32(sector, 0x54); uint lisaTime = BigEndianBitConverter.ToUInt32(sector, 0x58); mddf.dtvc = DateHandlers.LisaToDateTime(lisaTime); lisaTime = BigEndianBitConverter.ToUInt32(sector, 0x5C); @@ -177,13 +176,13 @@ 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.Info.Sectors || + if(mddf.mddf_block != i - volumePrefix || + mddf.vol_size > device.Info.Sectors || mddf.vol_size - 1 != mddf.volsize_minus_one || - mddf.vol_size - i - 1 != + mddf.vol_size - i - 1 != mddf.volsize_minus_mddf_minus_one - volumePrefix || - mddf.datasize > + mddf.datasize > mddf.blocksize || mddf.blocksize < device.Info.SectorSize || mddf.datasize != device.Info.SectorSize) { @@ -215,7 +214,7 @@ namespace DiscImageChef.Filesystems.LisaFS //catalogCache = new Dictionary>(); fileSizeCache = new Dictionary(); - mounted = true; + mounted = true; if(options == null) options = GetDefaultOptions(); if(options.TryGetValue("debug", out string debugString)) bool.TryParse(debugString, out debug); diff --git a/DiscImageChef.Filesystems/Locus.cs b/DiscImageChef.Filesystems/Locus.cs index 6c5d0361e..3c647e86c 100644 --- a/DiscImageChef.Filesystems/Locus.cs +++ b/DiscImageChef.Filesystems/Locus.cs @@ -57,20 +57,20 @@ namespace DiscImageChef.Filesystems { public class Locus : IFilesystem { - const int NICINOD = 325; - const int NICFREE = 600; + const int NICINOD = 325; + const int NICFREE = 600; const int OLDNICINOD = 700; const int OLDNICFREE = 500; - const uint LOCUS_MAGIC = 0xFFEEDDCD; - const uint LOCUS_CIGAM = 0xCDDDEEFF; + const uint LOCUS_MAGIC = 0xFFEEDDCD; + const uint LOCUS_CIGAM = 0xCDDDEEFF; const uint LOCUS_MAGIC_OLD = 0xFFEEDDCC; const uint LOCUS_CIGAM_OLD = 0xCCDDEEFF; public FileSystemType XmlFsType { get; private set; } - public Encoding Encoding { get; private set; } - public string Name => "Locus Filesystem Plugin"; - public Guid Id => new Guid("1A70B30A-437D-479A-88E1-D0C9C1797FF4"); + public Encoding Encoding { get; private set; } + public string Name => "Locus Filesystem Plugin"; + public Guid Id => new Guid("1A70B30A-437D-479A-88E1-D0C9C1797FF4"); public bool Identify(IMediaImage imagePlugin, Partition partition) { @@ -95,7 +95,7 @@ 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 || + if(locusSb.s_magic == LOCUS_MAGIC || locusSb.s_magic == LOCUS_CIGAM || locusSb.s_magic == LOCUS_MAGIC_OLD || locusSb.s_magic == LOCUS_CIGAM_OLD) return true; } @@ -103,14 +103,14 @@ namespace DiscImageChef.Filesystems } public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information, - Encoding encoding) + Encoding encoding) { - Encoding = encoding ?? Encoding.GetEncoding("iso-8859-15"); + Encoding = encoding ?? Encoding.GetEncoding("iso-8859-15"); information = ""; if(imagePlugin.Info.SectorSize < 512) return; Locus_Superblock locusSb = new Locus_Superblock(); - byte[] sector = null; + byte[] sector = null; for(ulong location = 0; location <= 8; location++) { @@ -125,7 +125,7 @@ namespace DiscImageChef.Filesystems locusSb = (Locus_Superblock)Marshal.PtrToStructure(sbPtr, typeof(Locus_Superblock)); Marshal.FreeHGlobal(sbPtr); - if(locusSb.s_magic == LOCUS_MAGIC || locusSb.s_magic == LOCUS_CIGAM || + if(locusSb.s_magic == LOCUS_MAGIC || locusSb.s_magic == LOCUS_CIGAM || locusSb.s_magic == LOCUS_MAGIC_OLD || locusSb.s_magic == LOCUS_CIGAM_OLD) break; } @@ -136,7 +136,7 @@ namespace DiscImageChef.Filesystems // Numerical arrays are not important for information so no need to swap them if(locusSb.s_magic == LOCUS_CIGAM || locusSb.s_magic == LOCUS_CIGAM_OLD) { - locusSb = BigEndianMarshal.ByteArrayToStructureBigEndian(sector); + locusSb = BigEndianMarshal.ByteArrayToStructureBigEndian(sector); locusSb.s_flags = (LocusFlags)Swapping.Swap((ushort)locusSb.s_flags); } @@ -150,26 +150,26 @@ namespace DiscImageChef.Filesystems string s_fpack = StringHandlers.CToString(locusSb.s_fpack, Encoding); DicConsole.DebugWriteLine("Locus plugin", "LocusSb.s_magic = 0x{0:X8}", locusSb.s_magic); - DicConsole.DebugWriteLine("Locus plugin", "LocusSb.s_gfs = {0}", locusSb.s_gfs); - DicConsole.DebugWriteLine("Locus plugin", "LocusSb.s_fsize = {0}", locusSb.s_fsize); - DicConsole.DebugWriteLine("Locus plugin", "LocusSb.s_lwm = {0}", locusSb.s_lwm); - DicConsole.DebugWriteLine("Locus plugin", "LocusSb.s_hwm = {0}", locusSb.s_hwm); - DicConsole.DebugWriteLine("Locus plugin", "LocusSb.s_llst = {0}", locusSb.s_llst); - DicConsole.DebugWriteLine("Locus plugin", "LocusSb.s_fstore = {0}", locusSb.s_fstore); - DicConsole.DebugWriteLine("Locus plugin", "LocusSb.s_time = {0}", locusSb.s_time); - DicConsole.DebugWriteLine("Locus plugin", "LocusSb.s_tfree = {0}", locusSb.s_tfree); - DicConsole.DebugWriteLine("Locus plugin", "LocusSb.s_isize = {0}", locusSb.s_isize); - DicConsole.DebugWriteLine("Locus plugin", "LocusSb.s_nfree = {0}", locusSb.s_nfree); - DicConsole.DebugWriteLine("Locus plugin", "LocusSb.s_flags = {0}", locusSb.s_flags); - DicConsole.DebugWriteLine("Locus plugin", "LocusSb.s_tinode = {0}", locusSb.s_tinode); - DicConsole.DebugWriteLine("Locus plugin", "LocusSb.s_lasti = {0}", locusSb.s_lasti); - DicConsole.DebugWriteLine("Locus plugin", "LocusSb.s_nbehind = {0}", locusSb.s_nbehind); - DicConsole.DebugWriteLine("Locus plugin", "LocusSb.s_gfspack = {0}", locusSb.s_gfspack); - DicConsole.DebugWriteLine("Locus plugin", "LocusSb.s_ninode = {0}", locusSb.s_ninode); - DicConsole.DebugWriteLine("Locus plugin", "LocusSb.s_flock = {0}", locusSb.s_flock); - DicConsole.DebugWriteLine("Locus plugin", "LocusSb.s_ilock = {0}", locusSb.s_ilock); - DicConsole.DebugWriteLine("Locus plugin", "LocusSb.s_fmod = {0}", locusSb.s_fmod); - DicConsole.DebugWriteLine("Locus plugin", "LocusSb.s_version = {0}", locusSb.s_version); + DicConsole.DebugWriteLine("Locus plugin", "LocusSb.s_gfs = {0}", locusSb.s_gfs); + DicConsole.DebugWriteLine("Locus plugin", "LocusSb.s_fsize = {0}", locusSb.s_fsize); + DicConsole.DebugWriteLine("Locus plugin", "LocusSb.s_lwm = {0}", locusSb.s_lwm); + DicConsole.DebugWriteLine("Locus plugin", "LocusSb.s_hwm = {0}", locusSb.s_hwm); + DicConsole.DebugWriteLine("Locus plugin", "LocusSb.s_llst = {0}", locusSb.s_llst); + DicConsole.DebugWriteLine("Locus plugin", "LocusSb.s_fstore = {0}", locusSb.s_fstore); + DicConsole.DebugWriteLine("Locus plugin", "LocusSb.s_time = {0}", locusSb.s_time); + DicConsole.DebugWriteLine("Locus plugin", "LocusSb.s_tfree = {0}", locusSb.s_tfree); + DicConsole.DebugWriteLine("Locus plugin", "LocusSb.s_isize = {0}", locusSb.s_isize); + DicConsole.DebugWriteLine("Locus plugin", "LocusSb.s_nfree = {0}", locusSb.s_nfree); + DicConsole.DebugWriteLine("Locus plugin", "LocusSb.s_flags = {0}", locusSb.s_flags); + DicConsole.DebugWriteLine("Locus plugin", "LocusSb.s_tinode = {0}", locusSb.s_tinode); + DicConsole.DebugWriteLine("Locus plugin", "LocusSb.s_lasti = {0}", locusSb.s_lasti); + DicConsole.DebugWriteLine("Locus plugin", "LocusSb.s_nbehind = {0}", locusSb.s_nbehind); + DicConsole.DebugWriteLine("Locus plugin", "LocusSb.s_gfspack = {0}", locusSb.s_gfspack); + DicConsole.DebugWriteLine("Locus plugin", "LocusSb.s_ninode = {0}", locusSb.s_ninode); + DicConsole.DebugWriteLine("Locus plugin", "LocusSb.s_flock = {0}", locusSb.s_flock); + DicConsole.DebugWriteLine("Locus plugin", "LocusSb.s_ilock = {0}", locusSb.s_ilock); + 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(); @@ -202,15 +202,16 @@ namespace DiscImageChef.Filesystems XmlFsType = new FileSystemType { - Type = "Locus filesystem", + Type = "Locus filesystem", ClusterSize = blockSize, - Clusters = locusSb.s_fsize, + Clusters = locusSb.s_fsize, // Sometimes it uses one, or the other. Use the bigger - VolumeName = string.IsNullOrEmpty(s_fsmnt) ? s_fpack : s_fsmnt, - ModificationDate = DateHandlers.UnixToDateTime(locusSb.s_time), + VolumeName = string.IsNullOrEmpty(s_fsmnt) ? s_fpack : s_fsmnt, + ModificationDate = DateHandlers.UnixToDateTime(locusSb.s_time), ModificationDateSpecified = true, - Dirty = !locusSb.s_flags.HasFlag(LocusFlags.SB_CLEAN) || locusSb.s_flags.HasFlag(LocusFlags.SB_DIRTY), - FreeClusters = locusSb.s_tfree, + Dirty = !locusSb.s_flags.HasFlag(LocusFlags.SB_CLEAN) || + locusSb.s_flags.HasFlag(LocusFlags.SB_DIRTY), + FreeClusters = locusSb.s_tfree, FreeClustersSpecified = true }; } @@ -222,7 +223,7 @@ namespace DiscImageChef.Filesystems { public uint s_magic; /* identifies this as a locus filesystem */ /* defined as a constant below */ - public gfs_t s_gfs; /* global filesystem number */ + 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 */ @@ -237,34 +238,37 @@ namespace DiscImageChef.Filesystems primary or backbone copy, this bit mask determines which files are stored */ - public time_t s_time; /* last super block update */ + 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 */ + 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 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 = 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 byte s_byteorder; /* byte order of integers */ } [SuppressMessage("ReSharper", "InconsistentNaming")] @@ -274,7 +278,7 @@ namespace DiscImageChef.Filesystems { public uint s_magic; /* identifies this as a locus filesystem */ /* defined as a constant below */ - public gfs_t s_gfs; /* global filesystem number */ + 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 */ @@ -289,34 +293,37 @@ namespace DiscImageChef.Filesystems primary or backbone copy, this bit mask determines which files are stored */ - public time_t s_time; /* last super block update */ + 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 */ + 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 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 = 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 byte s_byteorder; /* byte order of integers */ } [SuppressMessage("ReSharper", "InconsistentNaming")] @@ -324,18 +331,18 @@ namespace DiscImageChef.Filesystems [Flags] enum LocusFlags : ushort { - SB_RDONLY = 0x1, /* no writes on filesystem */ - 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_RDONLY = 0x1, /* no writes on filesystem */ + 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 */ } [SuppressMessage("ReSharper", "InconsistentNaming")] @@ -343,9 +350,9 @@ namespace DiscImageChef.Filesystems [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 */ } } } \ No newline at end of file diff --git a/DiscImageChef.Filesystems/MicroDOS.cs b/DiscImageChef.Filesystems/MicroDOS.cs index 83b104237..f9fc951cd 100644 --- a/DiscImageChef.Filesystems/MicroDOS.cs +++ b/DiscImageChef.Filesystems/MicroDOS.cs @@ -43,13 +43,13 @@ namespace DiscImageChef.Filesystems // Thanks to tarlabnor for translating it public class MicroDOS : IFilesystem { - const ushort MAGIC = 0xA72E; + const ushort MAGIC = 0xA72E; const ushort MAGIC2 = 0x530C; public FileSystemType XmlFsType { get; private set; } - public Encoding Encoding { get; private set; } - public string Name => "MicroDOS file system"; - public Guid Id => new Guid("9F9A364A-1A27-48A3-B730-7A7122000324"); + public Encoding Encoding { get; private set; } + public string Name => "MicroDOS file system"; + public Guid Id => new Guid("9F9A364A-1A27-48A3-B730-7A7122000324"); public bool Identify(IMediaImage imagePlugin, Partition partition) { @@ -68,9 +68,9 @@ namespace DiscImageChef.Filesystems } public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information, - Encoding encoding) + Encoding encoding) { - Encoding = encoding ?? Encoding.GetEncoding("koi8-r"); + Encoding = encoding ?? Encoding.GetEncoding("koi8-r"); information = ""; StringBuilder sb = new StringBuilder(); @@ -91,12 +91,12 @@ namespace DiscImageChef.Filesystems XmlFsType = new FileSystemType { - Type = "MicroDOS", - ClusterSize = 512, - Clusters = block0.blocks, - Files = block0.files, - FilesSpecified = true, - FreeClusters = block0.blocks - block0.usedBlocks, + Type = "MicroDOS", + ClusterSize = 512, + Clusters = block0.blocks, + Files = block0.files, + FilesSpecified = true, + FreeClusters = block0.blocks - block0.usedBlocks, FreeClustersSpecified = true }; @@ -108,19 +108,22 @@ namespace DiscImageChef.Filesystems struct MicroDosBlock0 { /// BK starts booting here - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 24)] public byte[] bootCode; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 24)] + public byte[] bootCode; /// Number of files in directory public ushort files; /// Total number of blocks in files of the directory public ushort usedBlocks; /// Unknown - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 228)] public byte[] unknown; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 228)] + public byte[] unknown; /// Ownership label (label that shows it belongs to Micro DOS format) public ushort label; /// MK-DOS directory format label public ushort mklabel; /// Unknown - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 50)] public byte[] unknown2; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 50)] + public byte[] unknown2; /// /// 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 @@ -130,7 +133,8 @@ namespace DiscImageChef.Filesystems /// Number of the first file's block. Value is changable public ushort firstUsedBlock; /// Unknown - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)] public byte[] unknown3; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)] + public byte[] unknown3; } [StructLayout(LayoutKind.Sequential, Pack = 1)] @@ -141,7 +145,8 @@ namespace DiscImageChef.Filesystems /// Directory number (0 - root) public byte directory; /// File name 14. symbols in ASCII KOI8 - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 12)] public byte[] filename; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 12)] + public byte[] filename; /// Block number public ushort blockNo; /// Length in blocks @@ -154,11 +159,11 @@ namespace DiscImageChef.Filesystems enum FileStatus : byte { - CommonFile = 0, - Protected = 1, + CommonFile = 0, + Protected = 1, LogicalDisk = 2, - BadFile = 0x80, - Deleted = 0xFF + BadFile = 0x80, + Deleted = 0xFF } } } \ No newline at end of file diff --git a/DiscImageChef.Filesystems/MinixFS.cs b/DiscImageChef.Filesystems/MinixFS.cs index 56efcaea9..31be4f3b3 100644 --- a/DiscImageChef.Filesystems/MinixFS.cs +++ b/DiscImageChef.Filesystems/MinixFS.cs @@ -65,9 +65,9 @@ namespace DiscImageChef.Filesystems const ushort MINIX3_CIGAM = 0x5A4D; public FileSystemType XmlFsType { get; private set; } - public Encoding Encoding { get; private set; } - public string Name => "Minix Filesystem"; - public Guid Id => new Guid("FE248C3B-B727-4AE5-A39F-79EA9A07D4B3"); + public Encoding Encoding { get; private set; } + public string Name => "Minix Filesystem"; + public Guid Id => new Guid("FE248C3B-B727-4AE5-A39F-79EA9A07D4B3"); public bool Identify(IMediaImage imagePlugin, Partition partition) { @@ -105,9 +105,9 @@ namespace DiscImageChef.Filesystems } public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information, - Encoding encoding) + Encoding encoding) { - Encoding = encoding ?? Encoding.GetEncoding("iso-8859-15"); + Encoding = encoding ?? Encoding.GetEncoding("iso-8859-15"); information = ""; StringBuilder sb = new StringBuilder(); @@ -121,8 +121,8 @@ namespace DiscImageChef.Filesystems offset = 0x400; } - bool minix3 = false; - int filenamesize; + bool minix3 = false; + int filenamesize; string minixVersion; byte[] minixSbSector = imagePlugin.ReadSector(sector + partition.Start); @@ -141,7 +141,7 @@ namespace DiscImageChef.Filesystems bool littleEndian; if(magic == MINIX3_MAGIC || magic == MINIX3_CIGAM || magic == MINIX2_MAGIC || magic == MINIX2_CIGAM || - magic == MINIX_MAGIC || magic == MINIX_CIGAM) + magic == MINIX_MAGIC || magic == MINIX_CIGAM) { filenamesize = 60; littleEndian = magic != MINIX3_CIGAM || magic == MINIX2_CIGAM || magic == MINIX_CIGAM; @@ -150,16 +150,16 @@ namespace DiscImageChef.Filesystems { case MINIX3_MAGIC: case MINIX3_CIGAM: - minixVersion = "Minix v3 filesystem"; + minixVersion = "Minix v3 filesystem"; XmlFsType.Type = "Minix v3"; break; case MINIX2_MAGIC: case MINIX2_CIGAM: - minixVersion = "Minix 3 v2 filesystem"; + minixVersion = "Minix 3 v2 filesystem"; XmlFsType.Type = "Minix 3 v2"; break; default: - minixVersion = "Minix 3 v1 filesystem"; + minixVersion = "Minix 3 v1 filesystem"; XmlFsType.Type = "Minix 3 v1"; break; } @@ -173,51 +173,51 @@ namespace DiscImageChef.Filesystems switch(magic) { case MINIX_MAGIC: - filenamesize = 14; - minixVersion = "Minix v1 filesystem"; - littleEndian = true; + filenamesize = 14; + minixVersion = "Minix v1 filesystem"; + littleEndian = true; XmlFsType.Type = "Minix v1"; break; case MINIX_MAGIC2: - filenamesize = 30; - minixVersion = "Minix v1 filesystem"; - littleEndian = true; + filenamesize = 30; + minixVersion = "Minix v1 filesystem"; + littleEndian = true; XmlFsType.Type = "Minix v1"; break; case MINIX2_MAGIC: - filenamesize = 14; - minixVersion = "Minix v2 filesystem"; - littleEndian = true; + filenamesize = 14; + minixVersion = "Minix v2 filesystem"; + littleEndian = true; XmlFsType.Type = "Minix v2"; break; case MINIX2_MAGIC2: - filenamesize = 30; - minixVersion = "Minix v2 filesystem"; - littleEndian = true; + filenamesize = 30; + minixVersion = "Minix v2 filesystem"; + littleEndian = true; XmlFsType.Type = "Minix v2"; break; case MINIX_CIGAM: - filenamesize = 14; - minixVersion = "Minix v1 filesystem"; - littleEndian = false; + filenamesize = 14; + minixVersion = "Minix v1 filesystem"; + littleEndian = false; XmlFsType.Type = "Minix v1"; break; case MINIX_CIGAM2: - filenamesize = 30; - minixVersion = "Minix v1 filesystem"; - littleEndian = false; + filenamesize = 30; + minixVersion = "Minix v1 filesystem"; + littleEndian = false; XmlFsType.Type = "Minix v1"; break; case MINIX2_CIGAM: - filenamesize = 14; - minixVersion = "Minix v2 filesystem"; - littleEndian = false; + filenamesize = 14; + minixVersion = "Minix v2 filesystem"; + littleEndian = false; XmlFsType.Type = "Minix v2"; break; case MINIX2_CIGAM2: - filenamesize = 30; - minixVersion = "Minix v2 filesystem"; - littleEndian = false; + filenamesize = 30; + minixVersion = "Minix v2 filesystem"; + littleEndian = false; XmlFsType.Type = "Minix v2"; break; default: return; @@ -259,7 +259,7 @@ namespace DiscImageChef.Filesystems sb.AppendFormat("On-disk filesystem version: {0}", mnxSb.s_disk_version).AppendLine(); XmlFsType.ClusterSize = mnxSb.s_blocksize; - XmlFsType.Clusters = mnxSb.s_zones > 0 ? mnxSb.s_zones : mnxSb.s_nzones; + XmlFsType.Clusters = mnxSb.s_zones > 0 ? mnxSb.s_zones : mnxSb.s_nzones; } else { @@ -292,8 +292,9 @@ namespace DiscImageChef.Filesystems sb.AppendFormat("{0} bytes maximum per file", mnxSb.s_max_size).AppendLine(); sb.AppendFormat("Filesystem state: {0:X4}", mnxSb.s_state).AppendLine(); XmlFsType.ClusterSize = 1024; - XmlFsType.Clusters = mnxSb.s_zones > 0 ? mnxSb.s_zones : mnxSb.s_nzones; + XmlFsType.Clusters = mnxSb.s_zones > 0 ? mnxSb.s_zones : mnxSb.s_nzones; } + information = sb.ToString(); } diff --git a/DiscImageChef.Filesystems/NILFS2.cs b/DiscImageChef.Filesystems/NILFS2.cs index c2a9f471a..5566b174f 100644 --- a/DiscImageChef.Filesystems/NILFS2.cs +++ b/DiscImageChef.Filesystems/NILFS2.cs @@ -41,19 +41,19 @@ namespace DiscImageChef.Filesystems { public class NILFS2 : IFilesystem { - const ushort NILFS2_MAGIC = 0x3434; - const uint NILFS2_SUPER_OFFSET = 1024; + const ushort NILFS2_MAGIC = 0x3434; + const uint NILFS2_SUPER_OFFSET = 1024; public FileSystemType XmlFsType { get; private set; } - public Encoding Encoding { get; private set; } - public string Name => "NILFS2 Plugin"; - public Guid Id => new Guid("35224226-C5CC-48B5-8FFD-3781E91E86B6"); + public Encoding Encoding { get; private set; } + public string Name => "NILFS2 Plugin"; + public Guid Id => new Guid("35224226-C5CC-48B5-8FFD-3781E91E86B6"); public bool Identify(IMediaImage imagePlugin, Partition partition) { if(imagePlugin.Info.SectorSize < 512) return false; - uint sbAddr = NILFS2_SUPER_OFFSET / imagePlugin.Info.SectorSize; + uint sbAddr = NILFS2_SUPER_OFFSET / imagePlugin.Info.SectorSize; if(sbAddr == 0) sbAddr = 1; NILFS2_Superblock nilfsSb = new NILFS2_Superblock(); @@ -75,13 +75,13 @@ namespace DiscImageChef.Filesystems } public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information, - Encoding encoding) + Encoding encoding) { - Encoding = encoding ?? Encoding.UTF8; + Encoding = encoding ?? Encoding.UTF8; information = ""; if(imagePlugin.Info.SectorSize < 512) return; - uint sbAddr = NILFS2_SUPER_OFFSET / imagePlugin.Info.SectorSize; + uint sbAddr = NILFS2_SUPER_OFFSET / imagePlugin.Info.SectorSize; if(sbAddr == 0) sbAddr = 1; NILFS2_Superblock nilfsSb = new NILFS2_Superblock(); @@ -122,13 +122,13 @@ namespace DiscImageChef.Filesystems XmlFsType = new FileSystemType { - Type = "NILFS2 filesystem", - ClusterSize = 1 << (int)(nilfsSb.log_block_size + 10), - VolumeName = StringHandlers.CToString(nilfsSb.volume_name, Encoding), - VolumeSerial = nilfsSb.uuid.ToString(), - CreationDate = DateHandlers.UnixUnsignedToDateTime(nilfsSb.ctime), - CreationDateSpecified = true, - ModificationDate = DateHandlers.UnixUnsignedToDateTime(nilfsSb.wtime), + Type = "NILFS2 filesystem", + ClusterSize = 1 << (int)(nilfsSb.log_block_size + 10), + VolumeName = StringHandlers.CToString(nilfsSb.volume_name, Encoding), + VolumeSerial = nilfsSb.uuid.ToString(), + CreationDate = DateHandlers.UnixUnsignedToDateTime(nilfsSb.ctime), + CreationDateSpecified = true, + ModificationDate = DateHandlers.UnixUnsignedToDateTime(nilfsSb.wtime), ModificationDateSpecified = true }; if(nilfsSb.creator_os == 0) XmlFsType.SystemIdentifier = "Linux"; @@ -137,52 +137,53 @@ namespace DiscImageChef.Filesystems enum NILFS2_State : ushort { - Valid = 0x0001, - Error = 0x0002, + Valid = 0x0001, + Error = 0x0002, Resize = 0x0004 } [StructLayout(LayoutKind.Sequential, Pack = 1)] struct NILFS2_Superblock { - public uint rev_level; - public ushort minor_rev_level; - public ushort magic; - public ushort bytes; - public ushort flags; - public uint crc_seed; - public uint sum; - public uint log_block_size; - public ulong nsegments; - public ulong dev_size; - public ulong first_data_block; - public uint blocks_per_segment; - public uint r_segments_percentage; - public ulong last_cno; - public ulong last_pseg; - public ulong last_seq; - public ulong free_blocks_count; - public ulong ctime; - public ulong mtime; - public ulong wtime; - public ushort mnt_count; - public ushort max_mnt_count; + public uint rev_level; + public ushort minor_rev_level; + public ushort magic; + public ushort bytes; + public ushort flags; + public uint crc_seed; + public uint sum; + public uint log_block_size; + public ulong nsegments; + public ulong dev_size; + public ulong first_data_block; + public uint blocks_per_segment; + public uint r_segments_percentage; + public ulong last_cno; + public ulong last_pseg; + public ulong last_seq; + public ulong free_blocks_count; + public ulong ctime; + public ulong mtime; + public ulong wtime; + public ushort mnt_count; + public ushort max_mnt_count; public NILFS2_State state; - public ushort errors; - public ulong lastcheck; - public uint checkinterval; - public uint creator_os; - public ushort def_resuid; - public ushort def_resgid; - public uint first_ino; - public ushort inode_size; - public ushort dat_entry_size; - public ushort checkpoint_size; - public ushort segment_usage_size; - public Guid uuid; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 80)] public byte[] volume_name; - public uint c_interval; - public uint c_block_max; + public ushort errors; + public ulong lastcheck; + public uint checkinterval; + public uint creator_os; + public ushort def_resuid; + public ushort def_resgid; + public uint first_ino; + public ushort inode_size; + public ushort dat_entry_size; + public ushort checkpoint_size; + public ushort segment_usage_size; + public Guid uuid; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 80)] + public byte[] volume_name; + public uint c_interval; + public uint c_block_max; public ulong feature_compat; public ulong feature_compat_ro; public ulong feature_incompat; diff --git a/DiscImageChef.Filesystems/NTFS.cs b/DiscImageChef.Filesystems/NTFS.cs index 448f0867c..185908ae7 100644 --- a/DiscImageChef.Filesystems/NTFS.cs +++ b/DiscImageChef.Filesystems/NTFS.cs @@ -86,7 +86,7 @@ namespace DiscImageChef.Filesystems NtfsBootBlock ntfsBb = (NtfsBootBlock)Marshal.PtrToStructure(bpbPtr, typeof(NtfsBootBlock)); Marshal.FreeHGlobal(bpbPtr); - sb.AppendFormat("{0} bytes per sector", ntfsBb.bps).AppendLine(); + sb.AppendFormat("{0} bytes per sector", ntfsBb.bps).AppendLine(); sb.AppendFormat("{0} sectors per cluster ({1} bytes)", ntfsBb.spc, ntfsBb.spc * ntfsBb.bps).AppendLine(); // sb.AppendFormat("{0} reserved sectors", ntfs_bb.rsectors).AppendLine(); // sb.AppendFormat("{0} FATs", ntfs_bb.fats_no).AppendLine(); @@ -94,8 +94,8 @@ namespace DiscImageChef.Filesystems // sb.AppendFormat("{0} sectors on volume (small)", ntfs_bb.sml_sectors).AppendLine(); sb.AppendFormat("Media descriptor: 0x{0:X2}", ntfsBb.media).AppendLine(); // sb.AppendFormat("{0} sectors per FAT", ntfs_bb.spfat).AppendLine(); - sb.AppendFormat("{0} sectors per track", ntfsBb.sptrk).AppendLine(); - sb.AppendFormat("{0} heads", ntfsBb.heads).AppendLine(); + sb.AppendFormat("{0} sectors per track", ntfsBb.sptrk).AppendLine(); + sb.AppendFormat("{0} heads", ntfsBb.heads).AppendLine(); sb.AppendFormat("{0} hidden sectors before filesystem", ntfsBb.hsectors).AppendLine(); // sb.AppendFormat("{0} sectors on volume (big)", ntfs_bb.big_sectors).AppendLine(); sb.AppendFormat("BIOS drive number: 0x{0:X2}", ntfsBb.drive_no).AppendLine(); @@ -103,7 +103,7 @@ namespace DiscImageChef.Filesystems // sb.AppendFormat("Signature 1: 0x{0:X2}", ntfs_bb.signature1).AppendLine(); sb.AppendFormat("{0} sectors on volume ({1} bytes)", ntfsBb.sectors, ntfsBb.sectors * ntfsBb.bps) .AppendLine(); - sb.AppendFormat("Cluster where $MFT starts: {0}", ntfsBb.mft_lsn).AppendLine(); + sb.AppendFormat("Cluster where $MFT starts: {0}", ntfsBb.mft_lsn).AppendLine(); sb.AppendFormat("Cluster where $MFTMirr starts: {0}", ntfsBb.mftmirror_lsn).AppendLine(); if(ntfsBb.mft_rc_clusters > 0) @@ -123,7 +123,7 @@ namespace DiscImageChef.Filesystems if(ntfsBb.jump[0] == 0xEB && ntfsBb.jump[1] > 0x4E && ntfsBb.jump[1] < 0x80 && ntfsBb.signature2 == 0xAA55) { XmlFsType.Bootable = true; - string bootChk = Sha1Context.Data(ntfsBb.boot_code, out _); + string bootChk = Sha1Context.Data(ntfsBb.boot_code, out _); sb.AppendLine("Volume is bootable"); sb.AppendFormat("Boot code's SHA1: {0}", bootChk).AppendLine(); } diff --git a/DiscImageChef.Filesystems/Nintendo.cs b/DiscImageChef.Filesystems/Nintendo.cs index 7f60609f6..5801897d7 100644 --- a/DiscImageChef.Filesystems/Nintendo.cs +++ b/DiscImageChef.Filesystems/Nintendo.cs @@ -42,9 +42,9 @@ namespace DiscImageChef.Filesystems public class NintendoPlugin : IFilesystem { public FileSystemType XmlFsType { get; private set; } - public Encoding Encoding { get; private set; } - public string Name => "Nintendo optical filesystems"; - public Guid Id => new Guid("4675fcb4-4418-4288-9e4a-33d6a4ac1126"); + public Encoding Encoding { get; private set; } + public string Name => "Nintendo optical filesystems"; + public Guid Id => new Guid("4675fcb4-4418-4288-9e4a-33d6a4ac1126"); public bool Identify(IMediaImage imagePlugin, Partition partition) { @@ -56,19 +56,19 @@ namespace DiscImageChef.Filesystems byte[] header = imagePlugin.ReadSectors(0, 0x50000 / imagePlugin.Info.SectorSize); - uint magicGc = BigEndianBitConverter.ToUInt32(header, 0x1C); + uint magicGc = BigEndianBitConverter.ToUInt32(header, 0x1C); uint magicWii = BigEndianBitConverter.ToUInt32(header, 0x18); return magicGc == 0xC2339F3D || magicWii == 0x5D1C9EA3; } public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information, - Encoding encoding) + Encoding encoding) { Encoding = encoding ?? Encoding.GetEncoding("shift_jis"); StringBuilder sbInformation = new StringBuilder(); information = ""; - XmlFsType = new FileSystemType(); + XmlFsType = new FileSystemType(); NintendoFields fields = new NintendoFields(); BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian; @@ -77,33 +77,33 @@ namespace DiscImageChef.Filesystems bool wii = false; - uint magicGc = BigEndianBitConverter.ToUInt32(header, 0x1C); + uint magicGc = BigEndianBitConverter.ToUInt32(header, 0x1C); uint magicWii = BigEndianBitConverter.ToUInt32(header, 0x18); - if(magicWii == 0x5D1C9EA3) wii = true; + if(magicWii == 0x5D1C9EA3) wii = true; else if(magicGc != 0xC2339F3D) return; - fields.DiscType = Encoding.ASCII.GetString(header, 0, 1); - fields.GameCode = Encoding.ASCII.GetString(header, 1, 2); - fields.RegionCode = Encoding.ASCII.GetString(header, 3, 1); - fields.PublisherCode = Encoding.ASCII.GetString(header, 4, 2); - fields.DiscId = Encoding.ASCII.GetString(header, 0, 6); - fields.DiscNumber = header[6]; - fields.DiscVersion = header[7]; - fields.Streaming |= header[8] > 0; - fields.StreamBufferSize = header[9]; + fields.DiscType = Encoding.ASCII.GetString(header, 0, 1); + fields.GameCode = Encoding.ASCII.GetString(header, 1, 2); + fields.RegionCode = Encoding.ASCII.GetString(header, 3, 1); + fields.PublisherCode = Encoding.ASCII.GetString(header, 4, 2); + fields.DiscId = Encoding.ASCII.GetString(header, 0, 6); + fields.DiscNumber = header[6]; + fields.DiscVersion = header[7]; + fields.Streaming |= header[8] > 0; + fields.StreamBufferSize = header[9]; byte[] temp = new byte[64]; Array.Copy(header, 0x20, temp, 0, 64); fields.Title = StringHandlers.CToString(temp, Encoding); if(!wii) { - fields.DebugOff = BigEndianBitConverter.ToUInt32(header, 0x0400); + fields.DebugOff = BigEndianBitConverter.ToUInt32(header, 0x0400); fields.DebugAddr = BigEndianBitConverter.ToUInt32(header, 0x0404); - fields.DolOff = BigEndianBitConverter.ToUInt32(header, 0x0420); - fields.FstOff = BigEndianBitConverter.ToUInt32(header, 0x0424); - fields.FstSize = BigEndianBitConverter.ToUInt32(header, 0x0428); - fields.FstMax = BigEndianBitConverter.ToUInt32(header, 0x042C); + fields.DolOff = BigEndianBitConverter.ToUInt32(header, 0x0420); + fields.FstOff = BigEndianBitConverter.ToUInt32(header, 0x0424); + fields.FstSize = BigEndianBitConverter.ToUInt32(header, 0x0428); + fields.FstMax = BigEndianBitConverter.ToUInt32(header, 0x042C); } if(wii) @@ -113,9 +113,9 @@ namespace DiscImageChef.Filesystems uint offset3 = BigEndianBitConverter.ToUInt32(header, 0x40014) << 2; uint offset4 = BigEndianBitConverter.ToUInt32(header, 0x4001C) << 2; - fields.FirstPartitions = new NintendoPartition[BigEndianBitConverter.ToUInt32(header, 0x40000)]; + fields.FirstPartitions = new NintendoPartition[BigEndianBitConverter.ToUInt32(header, 0x40000)]; fields.SecondPartitions = new NintendoPartition[BigEndianBitConverter.ToUInt32(header, 0x40008)]; - fields.ThirdPartitions = new NintendoPartition[BigEndianBitConverter.ToUInt32(header, 0x40010)]; + fields.ThirdPartitions = new NintendoPartition[BigEndianBitConverter.ToUInt32(header, 0x40010)]; fields.FourthPartitions = new NintendoPartition[BigEndianBitConverter.ToUInt32(header, 0x40018)]; for(int i = 0; i < fields.FirstPartitions.Length; i++) @@ -154,41 +154,41 @@ namespace DiscImageChef.Filesystems BigEndianBitConverter.ToUInt32(header, (int)(offset4 + i * 8 + 4)); } - fields.Region = header[0x4E000]; - fields.JapanAge = header[0x4E010]; - fields.UsaAge = header[0x4E011]; - fields.GermanAge = header[0x4E013]; - fields.PegiAge = header[0x4E014]; - fields.FinlandAge = header[0x4E015]; - fields.PortugalAge = header[0x4E016]; - fields.UkAge = header[0x4E017]; + fields.Region = header[0x4E000]; + fields.JapanAge = header[0x4E010]; + fields.UsaAge = header[0x4E011]; + fields.GermanAge = header[0x4E013]; + fields.PegiAge = header[0x4E014]; + fields.FinlandAge = header[0x4E015]; + fields.PortugalAge = header[0x4E016]; + fields.UkAge = header[0x4E017]; fields.AustraliaAge = header[0x4E018]; - fields.KoreaAge = header[0x4E019]; + fields.KoreaAge = header[0x4E019]; } else { - fields.FirstPartitions = new NintendoPartition[0]; + fields.FirstPartitions = new NintendoPartition[0]; fields.SecondPartitions = new NintendoPartition[0]; - fields.ThirdPartitions = new NintendoPartition[0]; + fields.ThirdPartitions = new NintendoPartition[0]; fields.FourthPartitions = new NintendoPartition[0]; } - DicConsole.DebugWriteLine("Nintendo plugin", "discType = {0}", fields.DiscType); - DicConsole.DebugWriteLine("Nintendo plugin", "gameCode = {0}", fields.GameCode); - DicConsole.DebugWriteLine("Nintendo plugin", "regionCode = {0}", fields.RegionCode); - DicConsole.DebugWriteLine("Nintendo plugin", "publisherCode = {0}", fields.PublisherCode); - DicConsole.DebugWriteLine("Nintendo plugin", "discID = {0}", fields.DiscId); - DicConsole.DebugWriteLine("Nintendo plugin", "discNumber = {0}", fields.DiscNumber); - DicConsole.DebugWriteLine("Nintendo plugin", "discVersion = {0}", fields.DiscVersion); - DicConsole.DebugWriteLine("Nintendo plugin", "streaming = {0}", fields.Streaming); + DicConsole.DebugWriteLine("Nintendo plugin", "discType = {0}", fields.DiscType); + DicConsole.DebugWriteLine("Nintendo plugin", "gameCode = {0}", fields.GameCode); + DicConsole.DebugWriteLine("Nintendo plugin", "regionCode = {0}", fields.RegionCode); + DicConsole.DebugWriteLine("Nintendo plugin", "publisherCode = {0}", fields.PublisherCode); + DicConsole.DebugWriteLine("Nintendo plugin", "discID = {0}", fields.DiscId); + DicConsole.DebugWriteLine("Nintendo plugin", "discNumber = {0}", fields.DiscNumber); + DicConsole.DebugWriteLine("Nintendo plugin", "discVersion = {0}", fields.DiscVersion); + DicConsole.DebugWriteLine("Nintendo plugin", "streaming = {0}", fields.Streaming); DicConsole.DebugWriteLine("Nintendo plugin", "streamBufferSize = {0}", fields.StreamBufferSize); - DicConsole.DebugWriteLine("Nintendo plugin", "title = \"{0}\"", fields.Title); - DicConsole.DebugWriteLine("Nintendo plugin", "debugOff = 0x{0:X8}", fields.DebugOff); - DicConsole.DebugWriteLine("Nintendo plugin", "debugAddr = 0x{0:X8}", fields.DebugAddr); - DicConsole.DebugWriteLine("Nintendo plugin", "dolOff = 0x{0:X8}", fields.DolOff); - DicConsole.DebugWriteLine("Nintendo plugin", "fstOff = 0x{0:X8}", fields.FstOff); - DicConsole.DebugWriteLine("Nintendo plugin", "fstSize = {0}", fields.FstSize); - DicConsole.DebugWriteLine("Nintendo plugin", "fstMax = {0}", fields.FstMax); + DicConsole.DebugWriteLine("Nintendo plugin", "title = \"{0}\"", fields.Title); + DicConsole.DebugWriteLine("Nintendo plugin", "debugOff = 0x{0:X8}", fields.DebugOff); + DicConsole.DebugWriteLine("Nintendo plugin", "debugAddr = 0x{0:X8}", fields.DebugAddr); + DicConsole.DebugWriteLine("Nintendo plugin", "dolOff = 0x{0:X8}", fields.DolOff); + DicConsole.DebugWriteLine("Nintendo plugin", "fstOff = 0x{0:X8}", fields.FstOff); + DicConsole.DebugWriteLine("Nintendo plugin", "fstSize = {0}", fields.FstSize); + 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}", @@ -196,6 +196,7 @@ namespace DiscImageChef.Filesystems 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}", @@ -203,6 +204,7 @@ namespace DiscImageChef.Filesystems 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}", @@ -210,6 +212,7 @@ namespace DiscImageChef.Filesystems 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}", @@ -218,16 +221,16 @@ namespace DiscImageChef.Filesystems 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); - DicConsole.DebugWriteLine("Nintendo plugin", "germanAge = {0}", fields.GermanAge); - DicConsole.DebugWriteLine("Nintendo plugin", "pegiAge = {0}", fields.PegiAge); - DicConsole.DebugWriteLine("Nintendo plugin", "finlandAge = {0}", fields.FinlandAge); - DicConsole.DebugWriteLine("Nintendo plugin", "portugalAge = {0}", fields.PortugalAge); - DicConsole.DebugWriteLine("Nintendo plugin", "ukAge = {0}", fields.UkAge); + DicConsole.DebugWriteLine("Nintendo plugin", "region = {0}", fields.Region); + DicConsole.DebugWriteLine("Nintendo plugin", "japanAge = {0}", fields.JapanAge); + DicConsole.DebugWriteLine("Nintendo plugin", "usaAge = {0}", fields.UsaAge); + DicConsole.DebugWriteLine("Nintendo plugin", "germanAge = {0}", fields.GermanAge); + DicConsole.DebugWriteLine("Nintendo plugin", "pegiAge = {0}", fields.PegiAge); + DicConsole.DebugWriteLine("Nintendo plugin", "finlandAge = {0}", fields.FinlandAge); + DicConsole.DebugWriteLine("Nintendo plugin", "portugalAge = {0}", fields.PortugalAge); + DicConsole.DebugWriteLine("Nintendo plugin", "ukAge = {0}", fields.UkAge); DicConsole.DebugWriteLine("Nintendo plugin", "australiaAge = {0}", fields.AustraliaAge); - DicConsole.DebugWriteLine("Nintendo plugin", "koreaAge = {0}", fields.KoreaAge); + DicConsole.DebugWriteLine("Nintendo plugin", "koreaAge = {0}", fields.KoreaAge); sbInformation.AppendLine("Nintendo optical filesystem"); sbInformation.AppendLine(wii ? "Nintendo Wii Optical Disc" : "Nintendo GameCube Optical Disc"); @@ -286,12 +289,12 @@ namespace DiscImageChef.Filesystems 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.Info.Sectors * imagePlugin.Info.SectorSize / 2048); - XmlFsType.ClusterSize = 2048; - XmlFsType.Type = wii ? "Nintendo Wii filesystem" : "Nintendo Gamecube filesystem"; - XmlFsType.VolumeName = fields.Title; + information = sbInformation.ToString(); + XmlFsType.Bootable = true; + XmlFsType.Clusters = (long)(imagePlugin.Info.Sectors * imagePlugin.Info.SectorSize / 2048); + XmlFsType.ClusterSize = 2048; + XmlFsType.Type = wii ? "Nintendo Wii filesystem" : "Nintendo Gamecube filesystem"; + XmlFsType.VolumeName = fields.Title; XmlFsType.VolumeSerial = fields.DiscId; } @@ -394,36 +397,36 @@ namespace DiscImageChef.Filesystems struct NintendoFields { - public string DiscType; - public string GameCode; - public string RegionCode; - public string PublisherCode; - public string DiscId; - public byte DiscNumber; - public byte DiscVersion; - public bool Streaming; - public byte StreamBufferSize; - public string Title; - public uint DebugOff; - public uint DebugAddr; - public uint DolOff; - public uint FstOff; - public uint FstSize; - public uint FstMax; + public string DiscType; + public string GameCode; + public string RegionCode; + public string PublisherCode; + public string DiscId; + public byte DiscNumber; + public byte DiscVersion; + public bool Streaming; + public byte StreamBufferSize; + public string Title; + public uint DebugOff; + public uint DebugAddr; + public uint DolOff; + public uint FstOff; + public uint FstSize; + public uint FstMax; public NintendoPartition[] FirstPartitions; public NintendoPartition[] SecondPartitions; public NintendoPartition[] ThirdPartitions; public NintendoPartition[] FourthPartitions; - public byte Region; - public byte JapanAge; - public byte UsaAge; - public byte GermanAge; - public byte PegiAge; - public byte FinlandAge; - public byte PortugalAge; - public byte UkAge; - public byte AustraliaAge; - public byte KoreaAge; + public byte Region; + public byte JapanAge; + public byte UsaAge; + public byte GermanAge; + public byte PegiAge; + public byte FinlandAge; + public byte PortugalAge; + public byte UkAge; + public byte AustraliaAge; + public byte KoreaAge; } struct NintendoPartition diff --git a/DiscImageChef.Filesystems/ODS.cs b/DiscImageChef.Filesystems/ODS.cs index 09f382771..254f1dff2 100644 --- a/DiscImageChef.Filesystems/ODS.cs +++ b/DiscImageChef.Filesystems/ODS.cs @@ -52,9 +52,9 @@ namespace DiscImageChef.Filesystems public class ODS : IFilesystem { public FileSystemType XmlFsType { get; private set; } - public Encoding Encoding { get; private set; } - public string Name => "Files-11 On-Disk Structure"; - public Guid Id => new Guid("de20633c-8021-4384-aeb0-83b0df14491f"); + public Encoding Encoding { get; private set; } + public string Name => "Files-11 On-Disk Structure"; + public Guid Id => new Guid("de20633c-8021-4384-aeb0-83b0df14491f"); public bool Identify(IMediaImage imagePlugin, Partition partition) { @@ -62,7 +62,7 @@ namespace DiscImageChef.Filesystems if(imagePlugin.Info.SectorSize < 512) return false; - byte[] magicB = new byte[12]; + byte[] magicB = new byte[12]; byte[] hbSector = imagePlugin.ReadSector(1 + partition.Start); Array.Copy(hbSector, 0x1F0, magicB, 0, 12); @@ -88,9 +88,9 @@ namespace DiscImageChef.Filesystems } public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information, - Encoding encoding) + Encoding encoding) { - Encoding = encoding ?? Encoding.GetEncoding("iso-8859-1"); + Encoding = encoding ?? Encoding.GetEncoding("iso-8859-1"); information = ""; StringBuilder sb = new StringBuilder(); @@ -103,8 +103,8 @@ namespace DiscImageChef.Filesystems handle.Free(); // Optical disc - if(imagePlugin.Info.XmlMediaType == XmlMediaType.OpticalDisc && - StringHandlers.CToString(homeblock.format) != "DECFILE11A " && + if(imagePlugin.Info.XmlMediaType == XmlMediaType.OpticalDisc && + StringHandlers.CToString(homeblock.format) != "DECFILE11A " && StringHandlers.CToString(homeblock.format) != "DECFILE11B ") { if(hbSector.Length < 0x400) return; @@ -113,7 +113,7 @@ namespace DiscImageChef.Filesystems hbSector = new byte[0x200]; Array.Copy(tmp, 0x200, hbSector, 0, 0x200); - handle = GCHandle.Alloc(hbSector, GCHandleType.Pinned); + handle = GCHandle.Alloc(hbSector, GCHandleType.Pinned); homeblock = (OdsHomeBlock)Marshal.PtrToStructure(handle.AddrOfPinnedObject(), typeof(OdsHomeBlock)); handle.Free(); @@ -121,7 +121,7 @@ namespace DiscImageChef.Filesystems StringHandlers.CToString(homeblock.format) != "DECFILE11B ") return; } - if((homeblock.struclev & 0xFF00) != 0x0200 || (homeblock.struclev & 0xFF) != 1 || + 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."); @@ -148,7 +148,7 @@ namespace DiscImageChef.Filesystems .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 && + 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, Encoding)).AppendLine(); @@ -206,20 +206,21 @@ namespace DiscImageChef.Filesystems XmlFsType = new FileSystemType { - Type = "FILES-11", - ClusterSize = homeblock.cluster * 512, - Clusters = (long)partition.Size / (homeblock.cluster * 512), - VolumeName = StringHandlers.SpacePaddedToString(homeblock.volname, Encoding), + Type = "FILES-11", + ClusterSize = homeblock.cluster * 512, + Clusters = (long)partition.Size / (homeblock.cluster * 512), + VolumeName = StringHandlers.SpacePaddedToString(homeblock.volname, Encoding), VolumeSerial = $"{homeblock.serialnum:X8}" }; if(homeblock.credate > 0) { - XmlFsType.CreationDate = DateHandlers.VmsToDateTime(homeblock.credate); + XmlFsType.CreationDate = DateHandlers.VmsToDateTime(homeblock.credate); XmlFsType.CreationDateSpecified = true; } + if(homeblock.revdate > 0) { - XmlFsType.ModificationDate = DateHandlers.VmsToDateTime(homeblock.revdate); + XmlFsType.ModificationDate = DateHandlers.VmsToDateTime(homeblock.revdate); XmlFsType.ModificationDateSpecified = true; } @@ -290,9 +291,11 @@ namespace DiscImageChef.Filesystems /// 0x058, Last modification date public ulong revdate; /// 0x060, Minimum security class, 20 bytes - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 20)] public byte[] min_class; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 20)] + public byte[] min_class; /// 0x074, Maximum security class, 20 bytes - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 20)] public byte[] max_class; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 20)] + public byte[] max_class; /// 0x088, File lookup table FID public ushort filetab_fid1; /// 0x08A, File lookup table FID @@ -306,17 +309,22 @@ namespace DiscImageChef.Filesystems /// 0x092, Volume copy date (??) public ulong copydate; /// 0x09A, 302 bytes - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 302)] public byte[] reserved1; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 302)] + public byte[] reserved1; /// 0x1C8, Physical drive serial number public uint serialnum; /// 0x1CC, Name of the volume set, 12 bytes - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 12)] public byte[] strucname; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 12)] + public byte[] strucname; /// 0x1D8, Volume label, 12 bytes - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 12)] public byte[] volname; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 12)] + public byte[] volname; /// 0x1E4, Name of the volume owner, 12 bytes - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 12)] public byte[] ownername; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 12)] + public byte[] ownername; /// 0x1F0, ODS-2 defines it as "DECFILE11B", 12 bytes - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 12)] public byte[] format; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 12)] + public byte[] format; /// 0x1FC, Reserved public ushort reserved2; /// 0x1FE, Checksum of preceding 255 words (16 bit units) diff --git a/DiscImageChef.Filesystems/Opera.cs b/DiscImageChef.Filesystems/Opera.cs index 6808e7529..6407969ca 100644 --- a/DiscImageChef.Filesystems/Opera.cs +++ b/DiscImageChef.Filesystems/Opera.cs @@ -42,9 +42,9 @@ namespace DiscImageChef.Filesystems public class OperaFS : IFilesystem { public FileSystemType XmlFsType { get; private set; } - public Encoding Encoding { get; private set; } - public string Name => "Opera Filesystem Plugin"; - public Guid Id => new Guid("0ec84ec7-eae6-4196-83fe-943b3fe46dbd"); + public Encoding Encoding { get; private set; } + public string Name => "Opera Filesystem Plugin"; + public Guid Id => new Guid("0ec84ec7-eae6-4196-83fe-943b3fe46dbd"); public bool Identify(IMediaImage imagePlugin, Partition partition) { @@ -64,10 +64,10 @@ namespace DiscImageChef.Filesystems } public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information, - Encoding encoding) + Encoding encoding) { // TODO: Find correct default encoding - Encoding = Encoding.ASCII; + Encoding = Encoding.ASCII; information = ""; StringBuilder superBlockMetadata = new StringBuilder(); @@ -82,12 +82,11 @@ namespace DiscImageChef.Filesystems superBlockMetadata.AppendFormat("Opera filesystem disc.").AppendLine(); if(!string.IsNullOrEmpty(StringHandlers.CToString(sb.volume_label, Encoding))) superBlockMetadata - .AppendFormat("Volume label: {0}", StringHandlers.CToString(sb.volume_label, Encoding)) - .AppendLine(); + .AppendFormat("Volume label: {0}", StringHandlers.CToString(sb.volume_label, Encoding)).AppendLine(); if(!string.IsNullOrEmpty(StringHandlers.CToString(sb.volume_comment, Encoding))) superBlockMetadata - .AppendFormat("Volume comment: {0}", StringHandlers.CToString(sb.volume_comment, Encoding)) - .AppendLine(); + .AppendFormat("Volume comment: {0}", StringHandlers.CToString(sb.volume_comment, Encoding)) + .AppendLine(); superBlockMetadata.AppendFormat("Volume identifier: 0x{0:X8}", sb.volume_id).AppendLine(); superBlockMetadata.AppendFormat("Block size: {0} bytes", sb.block_size).AppendLine(); if(imagePlugin.Info.SectorSize == 2336 || imagePlugin.Info.SectorSize == 2352 || @@ -95,20 +94,21 @@ namespace DiscImageChef.Filesystems { if(sb.block_size != 2048) superBlockMetadata - .AppendFormat("WARNING: Filesystem indicates {0} bytes/block while device indicates {1} bytes/block", - sb.block_size, 2048); + .AppendFormat("WARNING: Filesystem indicates {0} bytes/block while device indicates {1} bytes/block", + sb.block_size, 2048); } else if(imagePlugin.Info.SectorSize != sb.block_size) superBlockMetadata - .AppendFormat("WARNING: Filesystem indicates {0} bytes/block while device indicates {1} bytes/block", - sb.block_size, imagePlugin.Info.SectorSize); + .AppendFormat("WARNING: Filesystem indicates {0} bytes/block while device indicates {1} bytes/block", + sb.block_size, imagePlugin.Info.SectorSize); + superBlockMetadata - .AppendFormat("Volume size: {0} blocks, {1} bytes", sb.block_count, sb.block_size * sb.block_count) - .AppendLine(); + .AppendFormat("Volume size: {0} blocks, {1} bytes", sb.block_count, sb.block_size * sb.block_count) + .AppendLine(); if((ulong)sb.block_count > imagePlugin.Info.Sectors) superBlockMetadata - .AppendFormat("WARNING: Filesystem indicates {0} blocks while device indicates {1} blocks", - sb.block_count, imagePlugin.Info.Sectors); + .AppendFormat("WARNING: Filesystem indicates {0} blocks while device indicates {1} blocks", + sb.block_count, imagePlugin.Info.Sectors); 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, @@ -119,10 +119,10 @@ namespace DiscImageChef.Filesystems XmlFsType = new FileSystemType { - Type = "Opera", - VolumeName = StringHandlers.CToString(sb.volume_label, Encoding), + Type = "Opera", + VolumeName = StringHandlers.CToString(sb.volume_label, Encoding), ClusterSize = sb.block_size, - Clusters = sb.block_count + Clusters = sb.block_count }; } @@ -132,15 +132,18 @@ namespace DiscImageChef.Filesystems /// 0x000, Record type, must be 1 public byte record_type; /// 0x001, 5 bytes, "ZZZZZ" - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 5)] public byte[] sync_bytes; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 5)] + public byte[] sync_bytes; /// 0x006, Record version, must be 1 public byte record_version; /// 0x007, Volume flags public byte volume_flags; /// 0x008, 32 bytes, volume comment - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] public byte[] volume_comment; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] + public byte[] volume_comment; /// 0x028, 32 bytes, volume label - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] public byte[] volume_label; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] + public byte[] volume_label; /// 0x048, Volume ID public int volume_id; /// 0x04C, Block size in bytes diff --git a/DiscImageChef.Filesystems/PCEngine.cs b/DiscImageChef.Filesystems/PCEngine.cs index 31add053f..6d4dbc8f7 100644 --- a/DiscImageChef.Filesystems/PCEngine.cs +++ b/DiscImageChef.Filesystems/PCEngine.cs @@ -41,16 +41,16 @@ namespace DiscImageChef.Filesystems public class PCEnginePlugin : IFilesystem { public FileSystemType XmlFsType { get; private set; } - public Encoding Encoding { get; private set; } - public string Name => "PC Engine CD Plugin"; - public Guid Id => new Guid("e5ee6d7c-90fa-49bd-ac89-14ef750b8af3"); + public Encoding Encoding { get; private set; } + public string Name => "PC Engine CD Plugin"; + public Guid Id => new Guid("e5ee6d7c-90fa-49bd-ac89-14ef750b8af3"); public bool Identify(IMediaImage imagePlugin, Partition partition) { if(2 + partition.Start >= partition.End) return false; byte[] systemDescriptor = new byte[23]; - byte[] sector = imagePlugin.ReadSector(1 + partition.Start); + byte[] sector = imagePlugin.ReadSector(1 + partition.Start); Array.Copy(sector, 0x20, systemDescriptor, 0, 23); @@ -58,14 +58,14 @@ namespace DiscImageChef.Filesystems } public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information, - Encoding encoding) + Encoding encoding) { - Encoding = encoding ?? Encoding.GetEncoding("shift_jis"); + Encoding = encoding ?? Encoding.GetEncoding("shift_jis"); information = ""; XmlFsType = new FileSystemType { - Type = "PC Engine filesystem", - Clusters = (long)((partition.End - partition.Start + 1) / imagePlugin.Info.SectorSize * 2048), + Type = "PC Engine filesystem", + Clusters = (long)((partition.End - partition.Start + 1) / imagePlugin.Info.SectorSize * 2048), ClusterSize = 2048 }; } diff --git a/DiscImageChef.Filesystems/PCFX.cs b/DiscImageChef.Filesystems/PCFX.cs index cd89c4ee3..11c1205b1 100644 --- a/DiscImageChef.Filesystems/PCFX.cs +++ b/DiscImageChef.Filesystems/PCFX.cs @@ -79,28 +79,26 @@ namespace DiscImageChef.Filesystems try { - date = Encoding.GetString(header.date); + date = Encoding.GetString(header.date); int year = int.Parse(date.Substring(0, 4)); int month = int.Parse(date.Substring(4, 2)); int day = int.Parse(date.Substring(6, 2)); - dateTime = new DateTime(year, month, day); + dateTime = new DateTime(year, month, day); } catch { date = null; } StringBuilder sb = new StringBuilder(); sb.AppendLine("PC-FX executable:"); - sb.AppendFormat("Identifier: {0}", StringHandlers.CToString(header.signature, Encoding)).AppendLine(); + sb.AppendFormat("Identifier: {0}", StringHandlers.CToString(header.signature, Encoding)).AppendLine(); sb.AppendFormat("Copyright: {0}", StringHandlers.CToString(header.copyright, Encoding)).AppendLine(); sb.AppendFormat("Title: {0}", StringHandlers.CToString(header.title, Encoding)).AppendLine(); sb.AppendFormat("Maker ID: {0}", StringHandlers.CToString(header.makerId, Encoding)).AppendLine(); sb.AppendFormat("Maker name: {0}", StringHandlers.CToString(header.makerName, Encoding)).AppendLine(); sb.AppendFormat("Volume number: {0}", header.volumeNumber).AppendLine(); - sb.AppendFormat("Country code: {0}", header.country).AppendLine(); - sb.AppendFormat("Version: {0}.{1}", header.minorVersion, header.majorVersion) - .AppendLine(); - if(date != null) sb.AppendFormat("Dated {0}", dateTime).AppendLine(); - sb.AppendFormat("Load {0} sectors from sector {1}", header.loadCount, header.loadOffset) - .AppendLine(); + sb.AppendFormat("Country code: {0}", header.country).AppendLine(); + sb.AppendFormat("Version: {0}.{1}", header.minorVersion, header.majorVersion).AppendLine(); + if(date != null) sb.AppendFormat("Dated {0}", dateTime).AppendLine(); + sb.AppendFormat("Load {0} sectors from sector {1}", header.loadCount, header.loadOffset).AppendLine(); sb.AppendFormat("Load at 0x{0:X8} and jump to 0x{1:X8}", header.loadAddress, header.entryPoint) .AppendLine(); @@ -115,7 +113,7 @@ namespace DiscImageChef.Filesystems CreationDate = dateTime, CreationDateSpecified = date != null, PublisherIdentifier = StringHandlers.CToString(header.makerName, Encoding), - VolumeName = StringHandlers.CToString(header.title, Encoding), + VolumeName = StringHandlers.CToString(header.title, Encoding), SystemIdentifier = "PC-FX" }; } @@ -131,10 +129,10 @@ namespace DiscImageChef.Filesystems public byte[] unknown; [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] public byte[] title; - public uint loadOffset; - public uint loadCount; - public uint loadAddress; - public uint entryPoint; + public uint loadOffset; + public uint loadCount; + public uint loadAddress; + public uint entryPoint; [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)] public byte[] makerId; [MarshalAs(UnmanagedType.ByValArray, SizeConst = 60)] diff --git a/DiscImageChef.Filesystems/PFS.cs b/DiscImageChef.Filesystems/PFS.cs index ddbf6efd5..487475bdb 100644 --- a/DiscImageChef.Filesystems/PFS.cs +++ b/DiscImageChef.Filesystems/PFS.cs @@ -63,9 +63,9 @@ namespace DiscImageChef.Filesystems const uint MUPFS_DISK = 0x6D755046; public FileSystemType XmlFsType { get; private set; } - public Encoding Encoding { get; private set; } - public string Name => "Professional File System"; - public Guid Id => new Guid("68DE769E-D957-406A-8AE4-3781CA8CDA77"); + public Encoding Encoding { get; private set; } + public string Name => "Professional File System"; + public Guid Id => new Guid("68DE769E-D957-406A-8AE4-3781CA8CDA77"); public bool Identify(IMediaImage imagePlugin, Partition partition) { @@ -82,11 +82,11 @@ namespace DiscImageChef.Filesystems } public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information, - Encoding encoding) + Encoding encoding) { Encoding = encoding ?? Encoding.GetEncoding("iso-8859-1"); - byte[] rootBlockSector = imagePlugin.ReadSector(2 + partition.Start); - RootBlock rootBlock = BigEndianMarshal.ByteArrayToStructureBigEndian(rootBlockSector); + byte[] rootBlockSector = imagePlugin.ReadSector(2 + partition.Start); + RootBlock rootBlock = BigEndianMarshal.ByteArrayToStructureBigEndian(rootBlockSector); StringBuilder sbInformation = new StringBuilder(); XmlFsType = new FileSystemType(); @@ -130,11 +130,11 @@ namespace DiscImageChef.Filesystems XmlFsType.CreationDate = DateHandlers.AmigaToDateTime(rootBlock.creationday, rootBlock.creationminute, rootBlock.creationtick); XmlFsType.CreationDateSpecified = true; - XmlFsType.FreeClusters = rootBlock.blocksfree; + XmlFsType.FreeClusters = rootBlock.blocksfree; XmlFsType.FreeClustersSpecified = true; - XmlFsType.Clusters = rootBlock.diskSize; - XmlFsType.ClusterSize = (int)imagePlugin.Info.SectorSize; - XmlFsType.VolumeName = StringHandlers.PascalToString(rootBlock.diskname, Encoding); + XmlFsType.Clusters = rootBlock.diskSize; + XmlFsType.ClusterSize = (int)imagePlugin.Info.SectorSize; + XmlFsType.VolumeName = StringHandlers.PascalToString(rootBlock.diskname, Encoding); } /// @@ -187,7 +187,8 @@ namespace DiscImageChef.Filesystems /// /// Volume label (Pascal string) /// - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] public byte[] diskname; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] + public byte[] diskname; /// /// Last reserved block /// diff --git a/DiscImageChef.Filesystems/ProDOS.cs b/DiscImageChef.Filesystems/ProDOS.cs index 055aec46d..ac172c6b1 100644 --- a/DiscImageChef.Filesystems/ProDOS.cs +++ b/DiscImageChef.Filesystems/ProDOS.cs @@ -57,7 +57,7 @@ namespace DiscImageChef.Filesystems /// /// A file that occupies between 257 and 32768 blocks /// - const byte TREE_FILE_TYPE = 0x03; + const byte TREE_FILE_TYPE = 0x03; const byte PASCAL_AREA_TYPE = 0x04; const byte SUBDIRECTORY_TYPE = 0x0D; const byte SUBDIRECTORY_HEADER_TYPE = 0x0E; @@ -149,13 +149,13 @@ namespace DiscImageChef.Filesystems DicConsole.DebugWriteLine("ProDOS plugin", "{0} <= ({1} - {2} + 1)? {3}", totalBlocks, partition.End, partition.Start, totalBlocks <= partition.End - partition.Start + 1); - return totalBlocks <= partition.End - partition.Start + 1; + return totalBlocks <= partition.End - partition.Start + 1; } public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information, Encoding encoding) { - Encoding = encoding ?? new Apple2c(); + Encoding = encoding ?? new Apple2c(); StringBuilder sbInformation = new StringBuilder(); uint multiplier = (uint)(imagePlugin.Info.SectorSize == 256 ? 2 : 1); @@ -198,10 +198,9 @@ namespace DiscImageChef.Filesystems }; rootDirectoryKeyBlock.header.storage_type = - (byte)((rootDirectoryKeyBlockBytes[0x04] & STORAGE_TYPE_MASK) >> - 4); + (byte)((rootDirectoryKeyBlockBytes[0x04] & STORAGE_TYPE_MASK) >> 4); rootDirectoryKeyBlock.header.name_length = (byte)(rootDirectoryKeyBlockBytes[0x04] & NAME_LENGTH_MASK); - byte[] temporal = new byte[rootDirectoryKeyBlock.header.name_length]; + byte[] temporal = new byte[rootDirectoryKeyBlock.header.name_length]; Array.Copy(rootDirectoryKeyBlockBytes, 0x05, temporal, 0, rootDirectoryKeyBlock.header.name_length); rootDirectoryKeyBlock.header.volume_name = Encoding.GetString(temporal); rootDirectoryKeyBlock.header.reserved = BitConverter.ToUInt64(rootDirectoryKeyBlockBytes, 0x14); @@ -212,13 +211,13 @@ namespace DiscImageChef.Filesystems bool dateCorrect; try { - uint tempTimestamp = (uint)((tempTimestampLeft << 16) + tempTimestampRight); - int year = (int)((tempTimestamp & YEAR_MASK) >> 25); - int month = (int)((tempTimestamp & MONTH_MASK) >> 21); - int day = (int)((tempTimestamp & DAY_MASK) >> 16); - int hour = (int)((tempTimestamp & HOUR_MASK) >> 8); - int minute = (int)(tempTimestamp & MINUTE_MASK); - year += 1900; + uint tempTimestamp = (uint)((tempTimestampLeft << 16) + tempTimestampRight); + int year = (int)((tempTimestamp & YEAR_MASK) >> 25); + int month = (int)((tempTimestamp & MONTH_MASK) >> 21); + int day = (int)((tempTimestamp & DAY_MASK) >> 16); + int hour = (int)((tempTimestamp & HOUR_MASK) >> 8); + int minute = (int)(tempTimestamp & MINUTE_MASK); + year += 1900; if(year < 1940) year += 100; DicConsole.DebugWriteLine("ProDOS plugin", "temp_timestamp_left = 0x{0:X4}", tempTimestampLeft); @@ -277,8 +276,7 @@ namespace DiscImageChef.Filesystems .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("{0} blocks in volume", rootDirectoryKeyBlock.header.total_blocks).AppendLine(); sbInformation.AppendFormat("Bitmap starts at block {0}", rootDirectoryKeyBlock.header.bit_map_pointer) .AppendLine(); diff --git a/DiscImageChef.Filesystems/QNX4.cs b/DiscImageChef.Filesystems/QNX4.cs index f6ba733aa..35d6ed626 100644 --- a/DiscImageChef.Filesystems/QNX4.cs +++ b/DiscImageChef.Filesystems/QNX4.cs @@ -46,9 +46,9 @@ namespace DiscImageChef.Filesystems {0x2F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; public FileSystemType XmlFsType { get; private set; } - public Encoding Encoding { get; private set; } - public string Name => "QNX4 Plugin"; - public Guid Id => new Guid("E73A63FA-B5B0-48BF-BF82-DA5F0A8170D2"); + public Encoding Encoding { get; private set; } + public string Name => "QNX4 Plugin"; + public Guid Id => new Guid("E73A63FA-B5B0-48BF-BF82-DA5F0A8170D2"); public bool Identify(IMediaImage imagePlugin, Partition partition) { @@ -71,22 +71,22 @@ namespace DiscImageChef.Filesystems // 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.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; // 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; + (qnxSb.boot.di_status & 0x01) != 0x01) return false; // All hail filesystems without identification marks return true; } public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information, - Encoding encoding) + Encoding encoding) { - Encoding = encoding ?? Encoding.GetEncoding("iso-8859-15"); + Encoding = encoding ?? Encoding.GetEncoding("iso-8859-15"); information = ""; byte[] sector = imagePlugin.ReadSector(partition.Start + 1); if(sector.Length < 512) return; @@ -176,12 +176,12 @@ namespace DiscImageChef.Filesystems XmlFsType = new FileSystemType { - Type = "QNX4 filesystem", - Clusters = (long)partition.Length, - ClusterSize = 512, - CreationDate = DateHandlers.UnixUnsignedToDateTime(qnxSb.rootDir.di_ftime), - CreationDateSpecified = true, - ModificationDate = DateHandlers.UnixUnsignedToDateTime(qnxSb.rootDir.di_mtime), + Type = "QNX4 filesystem", + Clusters = (long)partition.Length, + ClusterSize = 512, + CreationDate = DateHandlers.UnixUnsignedToDateTime(qnxSb.rootDir.di_ftime), + CreationDateSpecified = true, + ModificationDate = DateHandlers.UnixUnsignedToDateTime(qnxSb.rootDir.di_mtime), ModificationDateSpecified = true }; XmlFsType.Bootable |= qnxSb.boot.di_size != 0 || qnxSb.altBoot.di_size != 0; @@ -196,31 +196,34 @@ namespace DiscImageChef.Filesystems [StructLayout(LayoutKind.Sequential, Pack = 1)] struct QNX4_Inode { - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] public byte[] di_fname; - public uint di_size; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] + public byte[] di_fname; + public uint di_size; public QNX4_Extent di_first_xtnt; - public uint di_xblk; - public uint di_ftime; - public uint di_mtime; - public uint di_atime; - public uint di_ctime; - public ushort di_num_xtnts; - public ushort di_mode; - public ushort di_uid; - public ushort di_gid; - public ushort di_nlink; - public uint di_zero; - public byte di_type; - public byte di_status; + public uint di_xblk; + public uint di_ftime; + public uint di_mtime; + public uint di_atime; + public uint di_ctime; + public ushort di_num_xtnts; + public ushort di_mode; + public ushort di_uid; + public ushort di_gid; + public ushort di_nlink; + public uint di_zero; + public byte di_type; + public byte di_status; } [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; } @@ -230,10 +233,13 @@ 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; } diff --git a/DiscImageChef.Filesystems/QNX6.cs b/DiscImageChef.Filesystems/QNX6.cs index eab2ae548..84e22beec 100644 --- a/DiscImageChef.Filesystems/QNX6.cs +++ b/DiscImageChef.Filesystems/QNX6.cs @@ -43,32 +43,32 @@ namespace DiscImageChef.Filesystems { const uint QNX6_SUPER_BLOCK_SIZE = 0x1000; const uint QNX6_BOOT_BLOCKS_SIZE = 0x2000; - const uint QNX6_MAGIC = 0x68191122; + const uint QNX6_MAGIC = 0x68191122; public FileSystemType XmlFsType { get; private set; } - public Encoding Encoding { get; private set; } - public string Name => "QNX6 Plugin"; - public Guid Id => new Guid("3E610EA2-4D08-4D70-8947-830CD4C74FC0"); + public Encoding Encoding { get; private set; } + public string Name => "QNX6 Plugin"; + public Guid Id => new Guid("3E610EA2-4D08-4D70-8947-830CD4C74FC0"); public bool Identify(IMediaImage imagePlugin, Partition partition) { - uint sectors = QNX6_SUPER_BLOCK_SIZE / imagePlugin.Info.SectorSize; + uint sectors = QNX6_SUPER_BLOCK_SIZE / imagePlugin.Info.SectorSize; uint bootSectors = QNX6_BOOT_BLOCKS_SIZE / imagePlugin.Info.SectorSize; if(partition.Start + bootSectors + sectors >= partition.End) return false; - byte[] audiSector = imagePlugin.ReadSectors(partition.Start, sectors); - byte[] sector = imagePlugin.ReadSectors(partition.Start + bootSectors, sectors); + byte[] audiSector = imagePlugin.ReadSectors(partition.Start, sectors); + byte[] sector = imagePlugin.ReadSectors(partition.Start + bootSectors, sectors); if(sector.Length < QNX6_SUPER_BLOCK_SIZE) return false; - QNX6_AudiSuperBlock audiSb = new QNX6_AudiSuperBlock(); - IntPtr audiPtr = Marshal.AllocHGlobal(Marshal.SizeOf(audiSb)); + QNX6_AudiSuperBlock audiSb = new QNX6_AudiSuperBlock(); + IntPtr audiPtr = Marshal.AllocHGlobal(Marshal.SizeOf(audiSb)); Marshal.Copy(audiSector, 0, audiPtr, Marshal.SizeOf(audiSb)); audiSb = (QNX6_AudiSuperBlock)Marshal.PtrToStructure(audiPtr, typeof(QNX6_AudiSuperBlock)); Marshal.FreeHGlobal(audiPtr); QNX6_SuperBlock qnxSb = new QNX6_SuperBlock(); - IntPtr sbPtr = Marshal.AllocHGlobal(Marshal.SizeOf(qnxSb)); + IntPtr sbPtr = Marshal.AllocHGlobal(Marshal.SizeOf(qnxSb)); Marshal.Copy(sector, 0, sbPtr, Marshal.SizeOf(qnxSb)); qnxSb = (QNX6_SuperBlock)Marshal.PtrToStructure(sbPtr, typeof(QNX6_SuperBlock)); Marshal.FreeHGlobal(sbPtr); @@ -77,26 +77,26 @@ namespace DiscImageChef.Filesystems } public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information, - Encoding encoding) + Encoding encoding) { - Encoding = encoding ?? Encoding.GetEncoding("iso-8859-15"); + Encoding = encoding ?? Encoding.GetEncoding("iso-8859-15"); information = ""; - StringBuilder sb = new StringBuilder(); - uint sectors = QNX6_SUPER_BLOCK_SIZE / imagePlugin.Info.SectorSize; - uint bootSectors = QNX6_BOOT_BLOCKS_SIZE / imagePlugin.Info.SectorSize; + StringBuilder sb = new StringBuilder(); + uint sectors = QNX6_SUPER_BLOCK_SIZE / imagePlugin.Info.SectorSize; + uint bootSectors = QNX6_BOOT_BLOCKS_SIZE / imagePlugin.Info.SectorSize; - byte[] audiSector = imagePlugin.ReadSectors(partition.Start, sectors); - byte[] sector = imagePlugin.ReadSectors(partition.Start + bootSectors, sectors); + byte[] audiSector = imagePlugin.ReadSectors(partition.Start, sectors); + byte[] sector = imagePlugin.ReadSectors(partition.Start + bootSectors, sectors); if(sector.Length < QNX6_SUPER_BLOCK_SIZE) return; - QNX6_AudiSuperBlock audiSb = new QNX6_AudiSuperBlock(); - IntPtr audiPtr = Marshal.AllocHGlobal(Marshal.SizeOf(audiSb)); + QNX6_AudiSuperBlock audiSb = new QNX6_AudiSuperBlock(); + IntPtr audiPtr = Marshal.AllocHGlobal(Marshal.SizeOf(audiSb)); Marshal.Copy(audiSector, 0, audiPtr, Marshal.SizeOf(audiSb)); audiSb = (QNX6_AudiSuperBlock)Marshal.PtrToStructure(audiPtr, typeof(QNX6_AudiSuperBlock)); Marshal.FreeHGlobal(audiPtr); QNX6_SuperBlock qnxSb = new QNX6_SuperBlock(); - IntPtr sbPtr = Marshal.AllocHGlobal(Marshal.SizeOf(qnxSb)); + IntPtr sbPtr = Marshal.AllocHGlobal(Marshal.SizeOf(qnxSb)); Marshal.Copy(sector, 0, sbPtr, Marshal.SizeOf(qnxSb)); qnxSb = (QNX6_SuperBlock)Marshal.PtrToStructure(sbPtr, typeof(QNX6_SuperBlock)); Marshal.FreeHGlobal(sbPtr); @@ -112,19 +112,19 @@ namespace DiscImageChef.Filesystems 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(); + audiSb.numBlocks * audiSb.blockSize).AppendLine(); XmlFsType = new FileSystemType { - Type = "QNX6 (Audi) filesystem", - Clusters = audiSb.numBlocks, - ClusterSize = (int)audiSb.blockSize, - Bootable = true, - Files = audiSb.numInodes - audiSb.freeInodes, - FilesSpecified = true, - FreeClusters = audiSb.freeBlocks, + Type = "QNX6 (Audi) filesystem", + Clusters = audiSb.numBlocks, + ClusterSize = (int)audiSb.blockSize, + Bootable = true, + Files = audiSb.numInodes - audiSb.freeInodes, + FilesSpecified = true, + FreeClusters = audiSb.freeBlocks, FreeClustersSpecified = true, - VolumeSerial = $"{audiSb.serial:X16}" + VolumeSerial = $"{audiSb.serial:X16}" }; //xmlFSType.VolumeName = CurrentEncoding.GetString(audiSb.id); @@ -149,18 +149,18 @@ namespace DiscImageChef.Filesystems XmlFsType = new FileSystemType { - Type = "QNX6 filesystem", - Clusters = qnxSb.numBlocks, - ClusterSize = (int)qnxSb.blockSize, - Bootable = true, - Files = qnxSb.numInodes - qnxSb.freeInodes, - FilesSpecified = true, - FreeClusters = qnxSb.freeBlocks, - FreeClustersSpecified = true, - VolumeSerial = $"{qnxSb.serial:X16}", - CreationDate = DateHandlers.UnixUnsignedToDateTime(qnxSb.ctime), - CreationDateSpecified = true, - ModificationDate = DateHandlers.UnixUnsignedToDateTime(qnxSb.atime), + Type = "QNX6 filesystem", + Clusters = qnxSb.numBlocks, + ClusterSize = (int)qnxSb.blockSize, + Bootable = true, + Files = qnxSb.numInodes - qnxSb.freeInodes, + FilesSpecified = true, + FreeClusters = qnxSb.freeBlocks, + FreeClustersSpecified = true, + VolumeSerial = $"{qnxSb.serial:X16}", + CreationDate = DateHandlers.UnixUnsignedToDateTime(qnxSb.ctime), + CreationDateSpecified = true, + ModificationDate = DateHandlers.UnixUnsignedToDateTime(qnxSb.atime), ModificationDateSpecified = true }; //xmlFSType.VolumeName = CurrentEncoding.GetString(qnxSb.volumeid); @@ -172,30 +172,33 @@ 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)] struct QNX6_SuperBlock { - public uint magic; - public uint checksum; - public ulong serial; - public uint ctime; - public uint atime; - public uint flags; + public uint magic; + public uint checksum; + public ulong serial; + public uint ctime; + public uint atime; + public uint flags; public ushort version1; public ushort version2; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] public byte[] volumeid; - public uint blockSize; - public uint numInodes; - public uint freeInodes; - public uint numBlocks; - public uint freeBlocks; - public uint allocationGroup; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] + public byte[] volumeid; + public uint blockSize; + public uint numInodes; + public uint freeInodes; + public uint numBlocks; + public uint freeBlocks; + public uint allocationGroup; public QNX6_RootNode inode; public QNX6_RootNode bitmap; public QNX6_RootNode longfile; @@ -205,17 +208,19 @@ namespace DiscImageChef.Filesystems [StructLayout(LayoutKind.Sequential, Pack = 1)] struct QNX6_AudiSuperBlock { - public uint magic; - public uint checksum; + 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; - public uint blockSize; - public uint numInodes; - public uint freeInodes; - public uint numBlocks; - public uint freeBlocks; - public uint spare2; + [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; + public uint numBlocks; + public uint freeBlocks; + public uint spare2; public QNX6_RootNode inode; public QNX6_RootNode bitmap; public QNX6_RootNode longfile; diff --git a/DiscImageChef.Filesystems/RBF.cs b/DiscImageChef.Filesystems/RBF.cs index 0c5daef0a..d65adb7aa 100644 --- a/DiscImageChef.Filesystems/RBF.cs +++ b/DiscImageChef.Filesystems/RBF.cs @@ -60,8 +60,8 @@ namespace DiscImageChef.Filesystems // I've read OS-9/Apple2 has it on sector 15 foreach(int i in new[] {0, 4, 15}) { - ulong location = (ulong)i; - RBF_IdSector rbfSb = new RBF_IdSector(); + ulong location = (ulong)i; + RBF_IdSector rbfSb = new RBF_IdSector(); uint sbSize = (uint)(Marshal.SizeOf(rbfSb) / imagePlugin.Info.SectorSize); if(Marshal.SizeOf(rbfSb) % imagePlugin.Info.SectorSize != 0) sbSize++; @@ -98,7 +98,7 @@ namespace DiscImageChef.Filesystems foreach(int i in new[] {0, 4, 15}) { ulong location = (ulong)i; - uint sbSize = (uint)(Marshal.SizeOf(rbfSb) / imagePlugin.Info.SectorSize); + uint sbSize = (uint)(Marshal.SizeOf(rbfSb) / imagePlugin.Info.SectorSize); if(Marshal.SizeOf(rbfSb) % imagePlugin.Info.SectorSize != 0) sbSize++; byte[] sector = imagePlugin.ReadSectors(partition.Start + location, sbSize); diff --git a/DiscImageChef.Filesystems/RT11.cs b/DiscImageChef.Filesystems/RT11.cs index 18c5e7bce..9cd5ea639 100644 --- a/DiscImageChef.Filesystems/RT11.cs +++ b/DiscImageChef.Filesystems/RT11.cs @@ -46,9 +46,9 @@ namespace DiscImageChef.Filesystems public class RT11 : IFilesystem { public FileSystemType XmlFsType { get; private set; } - public Encoding Encoding { get; private set; } - public string Name => "RT-11 file system"; - public Guid Id => new Guid("DB3E2F98-8F98-463C-8126-E937843DA024"); + public Encoding Encoding { get; private set; } + public string Name => "RT-11 file system"; + public Guid Id => new Guid("DB3E2F98-8F98-463C-8126-E937843DA024"); public bool Identify(IMediaImage imagePlugin, Partition partition) { @@ -56,7 +56,7 @@ namespace DiscImageChef.Filesystems if(imagePlugin.Info.SectorSize < 512) return false; - byte[] magicB = new byte[12]; + byte[] magicB = new byte[12]; byte[] hbSector = imagePlugin.ReadSector(1 + partition.Start); Array.Copy(hbSector, 0x1F0, magicB, 0, 12); @@ -66,9 +66,9 @@ namespace DiscImageChef.Filesystems } public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information, - Encoding encoding) + Encoding encoding) { - Encoding = new Radix50(); + Encoding = new Radix50(); information = ""; StringBuilder sb = new StringBuilder(); @@ -89,7 +89,7 @@ namespace DiscImageChef.Filesystems * SOB R2, 10$ * MOV 1,@R0 */ - ushort check = 0; + ushort check = 0; for(int i = 0; i < 512; i += 2) check += BitConverter.ToUInt16(hbSector, i); sb.AppendFormat("Volume format is {0}", @@ -105,11 +105,11 @@ namespace DiscImageChef.Filesystems XmlFsType = new FileSystemType { - Type = "RT-11", + Type = "RT-11", ClusterSize = homeblock.cluster * 512, - Clusters = homeblock.cluster, - VolumeName = StringHandlers.SpacePaddedToString(homeblock.volname, Encoding), - Bootable = !ArrayHelpers.ArrayIsNullOrEmpty(bootBlock) + Clusters = homeblock.cluster, + VolumeName = StringHandlers.SpacePaddedToString(homeblock.volname, Encoding), + Bootable = !ArrayHelpers.ArrayIsNullOrEmpty(bootBlock) }; information = sb.ToString(); @@ -119,32 +119,44 @@ namespace DiscImageChef.Filesystems struct RT11HomeBlock { /// Bad block replacement table - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 130)] public byte[] badBlockTable; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 130)] + public byte[] badBlockTable; /// Unused - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)] public byte[] unused; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)] + public byte[] unused; /// INITIALIZE/RESTORE data area - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 38)] public byte[] initArea; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 38)] + public byte[] initArea; /// BUP information area - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 18)] public byte[] bupInformation; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 18)] + public byte[] bupInformation; /// Empty - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 260)] public byte[] empty; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 260)] + public byte[] empty; /// Reserved - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)] public byte[] reserved1; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)] + public byte[] reserved1; /// Reserved - [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; /// Cluster size public ushort cluster; /// Block of the first directory segment public ushort rootBlock; /// "V3A" in Radix-50 - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)] public byte[] systemVersion; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)] + public byte[] systemVersion; /// Name of the volume, 12 bytes - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 12)] public byte[] volname; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 12)] + public byte[] volname; /// Name of the volume owner, 12 bytes - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 12)] public byte[] ownername; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 12)] + public byte[] ownername; /// RT11 defines it as "DECRT11A ", 12 bytes - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 12)] public byte[] format; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 12)] + public byte[] format; /// Unused public ushort unused2; /// Checksum of preceding 255 words (16 bit units) diff --git a/DiscImageChef.Filesystems/ReFS.cs b/DiscImageChef.Filesystems/ReFS.cs index b9a73f01d..1c8180532 100644 --- a/DiscImageChef.Filesystems/ReFS.cs +++ b/DiscImageChef.Filesystems/ReFS.cs @@ -55,7 +55,7 @@ namespace DiscImageChef.Filesystems RefsVolumeHeader refsVhdr = new RefsVolumeHeader(); uint sbSize = (uint)(Marshal.SizeOf(refsVhdr) / imagePlugin.Info.SectorSize); - if(Marshal.SizeOf(refsVhdr) % imagePlugin.Info.SectorSize != 0) sbSize++; + if(Marshal.SizeOf(refsVhdr) % imagePlugin.Info.SectorSize != 0) sbSize++; if(partition.Start + sbSize >= partition.End) return false; @@ -74,12 +74,12 @@ namespace DiscImageChef.Filesystems public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information, Encoding encoding) { - Encoding = Encoding.UTF8; - information = ""; + Encoding = Encoding.UTF8; + information = ""; RefsVolumeHeader refsVhdr = new RefsVolumeHeader(); uint sbSize = (uint)(Marshal.SizeOf(refsVhdr) / imagePlugin.Info.SectorSize); - if(Marshal.SizeOf(refsVhdr) % imagePlugin.Info.SectorSize != 0) sbSize++; + if(Marshal.SizeOf(refsVhdr) % imagePlugin.Info.SectorSize != 0) sbSize++; if(partition.Start + sbSize >= partition.End) return; diff --git a/DiscImageChef.Filesystems/Reiser.cs b/DiscImageChef.Filesystems/Reiser.cs index c6478e1d3..86b5897d9 100644 --- a/DiscImageChef.Filesystems/Reiser.cs +++ b/DiscImageChef.Filesystems/Reiser.cs @@ -49,15 +49,15 @@ namespace DiscImageChef.Filesystems readonly byte[] reiserJr_magic = {0x52, 0x65, 0x49, 0x73, 0x45, 0x72, 0x33, 0x46, 0x73, 0x00}; public FileSystemType XmlFsType { get; private set; } - public Encoding Encoding { get; private set; } - public string Name => "Reiser Filesystem Plugin"; - public Guid Id => new Guid("1D8CD8B8-27E6-410F-9973-D16409225FBA"); + public Encoding Encoding { get; private set; } + public string Name => "Reiser Filesystem Plugin"; + public Guid Id => new Guid("1D8CD8B8-27E6-410F-9973-D16409225FBA"); public bool Identify(IMediaImage imagePlugin, Partition partition) { if(imagePlugin.Info.SectorSize < 512) return false; - uint sbAddr = REISER_SUPER_OFFSET / imagePlugin.Info.SectorSize; + uint sbAddr = REISER_SUPER_OFFSET / imagePlugin.Info.SectorSize; if(sbAddr == 0) sbAddr = 1; Reiser_Superblock reiserSb = new Reiser_Superblock(); @@ -80,13 +80,13 @@ namespace DiscImageChef.Filesystems } public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information, - Encoding encoding) + Encoding encoding) { - Encoding = encoding ?? Encoding.GetEncoding("iso-8859-15"); + Encoding = encoding ?? Encoding.GetEncoding("iso-8859-15"); information = ""; if(imagePlugin.Info.SectorSize < 512) return; - uint sbAddr = REISER_SUPER_OFFSET / imagePlugin.Info.SectorSize; + uint sbAddr = REISER_SUPER_OFFSET / imagePlugin.Info.SectorSize; if(sbAddr == 0) sbAddr = 1; Reiser_Superblock reiserSb = new Reiser_Superblock(); @@ -126,17 +126,17 @@ namespace DiscImageChef.Filesystems information = sb.ToString(); XmlFsType = new FileSystemType(); - if(reiser35_magic.SequenceEqual(reiserSb.magic)) XmlFsType.Type = "Reiser 3.5 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; + XmlFsType.ClusterSize = reiserSb.blocksize; + XmlFsType.Clusters = reiserSb.block_count; + XmlFsType.FreeClusters = reiserSb.free_blocks; XmlFsType.FreeClustersSpecified = true; - XmlFsType.Dirty = reiserSb.umount_state == 2; + XmlFsType.Dirty = reiserSb.umount_state == 2; if(reiserSb.version < 2) return; - XmlFsType.VolumeName = Encoding.GetString(reiserSb.label); + XmlFsType.VolumeName = Encoding.GetString(reiserSb.label); XmlFsType.VolumeSerial = reiserSb.uuid.ToString(); } @@ -156,30 +156,33 @@ namespace DiscImageChef.Filesystems [StructLayout(LayoutKind.Sequential, Pack = 1)] struct Reiser_Superblock { - public uint block_count; - public uint free_blocks; - public uint root_block; + public uint block_count; + public uint free_blocks; + public uint root_block; public ReiserJournalParams journal; - public ushort blocksize; - public ushort oid_maxsize; - public ushort oid_cursize; - public ushort umount_state; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 10)] public byte[] magic; + public ushort blocksize; + public ushort oid_maxsize; + public ushort oid_cursize; + public ushort umount_state; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 10)] + public byte[] magic; public ushort fs_state; - public uint hash_function_code; + public uint hash_function_code; public ushort tree_height; public ushort bmap_nr; public ushort version; public ushort reserved_for_journal; - public uint inode_generation; - public uint flags; - public Guid uuid; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] public byte[] label; + public uint inode_generation; + public uint flags; + public Guid uuid; + [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; + public uint last_check; + public uint check_interval; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 76)] + public byte[] unused; } } } \ No newline at end of file diff --git a/DiscImageChef.Filesystems/Reiser4.cs b/DiscImageChef.Filesystems/Reiser4.cs index d9cf0a771..35df7ffa4 100644 --- a/DiscImageChef.Filesystems/Reiser4.cs +++ b/DiscImageChef.Filesystems/Reiser4.cs @@ -48,15 +48,15 @@ namespace DiscImageChef.Filesystems {0x52, 0x65, 0x49, 0x73, 0x45, 0x72, 0x34, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; public FileSystemType XmlFsType { get; private set; } - public Encoding Encoding { get; private set; } - public string Name => "Reiser4 Filesystem Plugin"; - public Guid Id => new Guid("301F2D00-E8D5-4F04-934E-81DFB21D15BA"); + public Encoding Encoding { get; private set; } + public string Name => "Reiser4 Filesystem Plugin"; + public Guid Id => new Guid("301F2D00-E8D5-4F04-934E-81DFB21D15BA"); public bool Identify(IMediaImage imagePlugin, Partition partition) { if(imagePlugin.Info.SectorSize < 512) return false; - uint sbAddr = REISER4_SUPER_OFFSET / imagePlugin.Info.SectorSize; + uint sbAddr = REISER4_SUPER_OFFSET / imagePlugin.Info.SectorSize; if(sbAddr == 0) sbAddr = 1; Reiser4_Superblock reiserSb = new Reiser4_Superblock(); @@ -78,13 +78,13 @@ namespace DiscImageChef.Filesystems } public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information, - Encoding encoding) + Encoding encoding) { - Encoding = encoding ?? Encoding.GetEncoding("iso-8859-15"); + Encoding = encoding ?? Encoding.GetEncoding("iso-8859-15"); information = ""; if(imagePlugin.Info.SectorSize < 512) return; - uint sbAddr = REISER4_SUPER_OFFSET / imagePlugin.Info.SectorSize; + uint sbAddr = REISER4_SUPER_OFFSET / imagePlugin.Info.SectorSize; if(sbAddr == 0) sbAddr = 1; Reiser4_Superblock reiserSb = new Reiser4_Superblock(); @@ -114,10 +114,11 @@ namespace DiscImageChef.Filesystems XmlFsType = new FileSystemType { - Type = "Reiser 4 filesystem", + Type = "Reiser 4 filesystem", ClusterSize = reiserSb.blocksize, - Clusters = (long)((partition.End - partition.Start) * imagePlugin.Info.SectorSize / reiserSb.blocksize), - VolumeName = StringHandlers.CToString(reiserSb.label, Encoding), + Clusters = + (long)((partition.End - partition.Start) * imagePlugin.Info.SectorSize / reiserSb.blocksize), + VolumeName = StringHandlers.CToString(reiserSb.label, Encoding), VolumeSerial = reiserSb.uuid.ToString() }; } @@ -125,11 +126,13 @@ 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; + public Guid uuid; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] + public byte[] label; } } } \ No newline at end of file diff --git a/DiscImageChef.Filesystems/SFS.cs b/DiscImageChef.Filesystems/SFS.cs index a9e8f04d4..aac5108ec 100644 --- a/DiscImageChef.Filesystems/SFS.cs +++ b/DiscImageChef.Filesystems/SFS.cs @@ -47,9 +47,9 @@ namespace DiscImageChef.Filesystems const uint SFS2_MAGIC = 0x53465302; public FileSystemType XmlFsType { get; private set; } - public Encoding Encoding { get; private set; } - public string Name => "SmartFileSystem"; - public Guid Id => new Guid("26550C19-3671-4A2D-BC2F-F20CEB7F48DC"); + public Encoding Encoding { get; private set; } + public string Name => "SmartFileSystem"; + public Guid Id => new Guid("26550C19-3671-4A2D-BC2F-F20CEB7F48DC"); public bool Identify(IMediaImage imagePlugin, Partition partition) { @@ -65,11 +65,11 @@ namespace DiscImageChef.Filesystems } public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information, - Encoding encoding) + Encoding encoding) { Encoding = encoding ?? Encoding.GetEncoding("iso-8859-1"); - byte[] rootBlockSector = imagePlugin.ReadSector(partition.Start); - RootBlock rootBlock = BigEndianMarshal.ByteArrayToStructureBigEndian(rootBlockSector); + byte[] rootBlockSector = imagePlugin.ReadSector(partition.Start); + RootBlock rootBlock = BigEndianMarshal.ByteArrayToStructureBigEndian(rootBlockSector); StringBuilder sbInformation = new StringBuilder(); @@ -79,8 +79,8 @@ namespace DiscImageChef.Filesystems 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(); + .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(); @@ -100,11 +100,11 @@ namespace DiscImageChef.Filesystems XmlFsType = new FileSystemType { - CreationDate = DateHandlers.UnixUnsignedToDateTime(rootBlock.datecreated).AddYears(8), + CreationDate = DateHandlers.UnixUnsignedToDateTime(rootBlock.datecreated).AddYears(8), CreationDateSpecified = true, - Clusters = rootBlock.totalblocks, - ClusterSize = (int)rootBlock.blocksize, - Type = "SmartFileSystem" + Clusters = rootBlock.totalblocks, + ClusterSize = (int)rootBlock.blocksize, + Type = "SmartFileSystem" }; } @@ -118,28 +118,32 @@ namespace DiscImageChef.Filesystems [StructLayout(LayoutKind.Sequential, Pack = 1)] struct RootBlock { - public uint blockId; - public uint blockChecksum; - public uint blockSelfPointer; - public ushort version; - public ushort sequence; - public uint datecreated; + public uint blockId; + public uint blockChecksum; + public uint blockSelfPointer; + public ushort version; + public ushort sequence; + public uint datecreated; public SFSFlags bits; - public byte padding1; - public ushort padding2; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)] public uint[] reserved1; + public byte padding1; + public ushort padding2; + [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; + public uint totalblocks; + public uint blocksize; + [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; } } } \ No newline at end of file diff --git a/DiscImageChef.Filesystems/SolarFS.cs b/DiscImageChef.Filesystems/SolarFS.cs index fe335701c..e76b0e18d 100644 --- a/DiscImageChef.Filesystems/SolarFS.cs +++ b/DiscImageChef.Filesystems/SolarFS.cs @@ -43,9 +43,9 @@ namespace DiscImageChef.Filesystems public class SolarFS : IFilesystem { public FileSystemType XmlFsType { get; private set; } - public Encoding Encoding { get; private set; } - public string Name => "Solar_OS filesystem"; - public Guid Id => new Guid("EA3101C1-E777-4B4F-B5A3-8C57F50F6E65"); + public Encoding Encoding { get; private set; } + public string Name => "Solar_OS filesystem"; + public Guid Id => new Guid("EA3101C1-E777-4B4F-B5A3-8C57F50F6E65"); public bool Identify(IMediaImage imagePlugin, Partition partition) { @@ -63,32 +63,32 @@ namespace DiscImageChef.Filesystems } public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information, - Encoding encoding) + Encoding encoding) { - Encoding = encoding ?? Encoding.GetEncoding("iso-8859-15"); + Encoding = encoding ?? Encoding.GetEncoding("iso-8859-15"); information = ""; - StringBuilder sb = new StringBuilder(); - byte[] bpbSector = imagePlugin.ReadSector(0 + partition.Start); + StringBuilder sb = new StringBuilder(); + byte[] bpbSector = imagePlugin.ReadSector(0 + partition.Start); SolarOSParameterBlock bpb = new SolarOSParameterBlock { - bps = BitConverter.ToUInt16(bpbSector, 0x0B), - root_ent = BitConverter.ToUInt16(bpbSector, 0x10), - sectors = BitConverter.ToUInt16(bpbSector, 0x12), - media = bpbSector[0x14], - spfat = BitConverter.ToUInt16(bpbSector, 0x15), - sptrk = BitConverter.ToUInt16(bpbSector, 0x17), - heads = BitConverter.ToUInt16(bpbSector, 0x19), + bps = BitConverter.ToUInt16(bpbSector, 0x0B), + root_ent = BitConverter.ToUInt16(bpbSector, 0x10), + sectors = BitConverter.ToUInt16(bpbSector, 0x12), + media = bpbSector[0x14], + spfat = BitConverter.ToUInt16(bpbSector, 0x15), + sptrk = BitConverter.ToUInt16(bpbSector, 0x17), + heads = BitConverter.ToUInt16(bpbSector, 0x19), signature = bpbSector[0x25] }; byte[] bpbStrings = new byte[8]; Array.Copy(bpbSector, 0x03, bpbStrings, 0, 8); bpb.OEMName = StringHandlers.CToString(bpbStrings); - bpbStrings = new byte[8]; + bpbStrings = new byte[8]; Array.Copy(bpbSector, 0x2A, bpbStrings, 0, 11); bpb.vol_name = StringHandlers.CToString(bpbStrings, Encoding); - bpbStrings = new byte[8]; + bpbStrings = new byte[8]; Array.Copy(bpbSector, 0x35, bpbStrings, 0, 8); bpb.fs_type = StringHandlers.CToString(bpbStrings, Encoding); @@ -103,23 +103,23 @@ namespace DiscImageChef.Filesystems 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); - DicConsole.DebugWriteLine("SolarFS plugin", "BPB.unk2: 0x{0:X4}", bpb.unk2); - DicConsole.DebugWriteLine("SolarFS plugin", "BPB.root_ent: {0}", bpb.root_ent); - DicConsole.DebugWriteLine("SolarFS plugin", "BPB.sectors: {0}", bpb.sectors); - DicConsole.DebugWriteLine("SolarFS plugin", "BPB.media: 0x{0:X2}", bpb.media); - 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.bps: {0}", bpb.bps); + DicConsole.DebugWriteLine("SolarFS plugin", "BPB.unk1: 0x{0:X2}", bpb.unk1); + DicConsole.DebugWriteLine("SolarFS plugin", "BPB.unk2: 0x{0:X4}", bpb.unk2); + DicConsole.DebugWriteLine("SolarFS plugin", "BPB.root_ent: {0}", bpb.root_ent); + DicConsole.DebugWriteLine("SolarFS plugin", "BPB.sectors: {0}", bpb.sectors); + DicConsole.DebugWriteLine("SolarFS plugin", "BPB.media: 0x{0:X2}", bpb.media); + 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.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); - DicConsole.DebugWriteLine("SolarFS plugin", "BPB.fs_type: \"{0}\"", bpb.fs_type); + DicConsole.DebugWriteLine("SolarFS plugin", "BPB.unk4: 0x{0:X8}", bpb.unk4); + DicConsole.DebugWriteLine("SolarFS plugin", "BPB.vol_name: \"{0}\"", bpb.vol_name); + DicConsole.DebugWriteLine("SolarFS plugin", "BPB.fs_type: \"{0}\"", bpb.fs_type); sb.AppendLine("Solar_OS filesystem"); sb.AppendFormat("Media descriptor: 0x{0:X2}", bpb.media).AppendLine(); @@ -129,13 +129,14 @@ namespace DiscImageChef.Filesystems { if(bpb.bps != imagePlugin.Info.SectorSize) sb - .AppendFormat("WARNING: Filesystem describes a {0} bytes/sector, while device describes a {1} bytes/sector", - bpb.bps, 2048).AppendLine(); + .AppendFormat("WARNING: Filesystem describes a {0} bytes/sector, while device describes a {1} bytes/sector", + bpb.bps, 2048).AppendLine(); } else if(bpb.bps != imagePlugin.Info.SectorSize) sb - .AppendFormat("WARNING: Filesystem describes a {0} bytes/sector, while device describes a {1} bytes/sector", - bpb.bps, imagePlugin.Info.SectorSize).AppendLine(); + .AppendFormat("WARNING: Filesystem describes a {0} bytes/sector, while device describes a {1} bytes/sector", + bpb.bps, imagePlugin.Info.SectorSize).AppendLine(); + sb.AppendFormat("{0} sectors on volume ({1} bytes)", bpb.sectors, bpb.sectors * bpb.bps).AppendLine(); if(bpb.sectors > imagePlugin.Info.Sectors) sb.AppendFormat("WARNING: Filesystem describes a {0} sectors volume, bigger than device ({1} sectors)", @@ -146,10 +147,10 @@ namespace DiscImageChef.Filesystems XmlFsType = new FileSystemType { - Type = "SolarFS", - Clusters = bpb.sectors, + Type = "SolarFS", + Clusters = bpb.sectors, ClusterSize = bpb.bps, - VolumeName = bpb.vol_name + VolumeName = bpb.vol_name }; information = sb.ToString(); diff --git a/DiscImageChef.Filesystems/Squash.cs b/DiscImageChef.Filesystems/Squash.cs index aa9ef7ac5..78bd9d3c7 100644 --- a/DiscImageChef.Filesystems/Squash.cs +++ b/DiscImageChef.Filesystems/Squash.cs @@ -48,9 +48,9 @@ namespace DiscImageChef.Filesystems const uint SQUASH_CIGAM = 0x68737173; public FileSystemType XmlFsType { get; private set; } - public Encoding Encoding { get; private set; } - public string Name => "Squash filesystem"; - public Guid Id => new Guid("F8F6E46F-7A2A-48E3-9C0A-46AF4DC29E09"); + public Encoding Encoding { get; private set; } + public string Name => "Squash filesystem"; + public Guid Id => new Guid("F8F6E46F-7A2A-48E3-9C0A-46AF4DC29E09"); public bool Identify(IMediaImage imagePlugin, Partition partition) { @@ -64,14 +64,14 @@ namespace DiscImageChef.Filesystems } public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information, - Encoding encoding) + Encoding encoding) { Encoding = encoding ?? Encoding.UTF8; byte[] sector = imagePlugin.ReadSector(partition.Start); - uint magic = BitConverter.ToUInt32(sector, 0x00); + uint magic = BitConverter.ToUInt32(sector, 0x00); - SquashSuperBlock sqSb = new SquashSuperBlock(); - bool littleEndian = true; + SquashSuperBlock sqSb = new SquashSuperBlock(); + bool littleEndian = true; switch(magic) { @@ -82,7 +82,7 @@ namespace DiscImageChef.Filesystems Marshal.FreeHGlobal(sqSbPtr); break; case SQUASH_CIGAM: - sqSb = BigEndianMarshal.ByteArrayToStructureBigEndian(sector); + sqSb = BigEndianMarshal.ByteArrayToStructureBigEndian(sector); littleEndian = false; break; } @@ -127,15 +127,15 @@ namespace DiscImageChef.Filesystems XmlFsType = new FileSystemType { - Type = "Squash file system", - CreationDate = DateHandlers.UnixUnsignedToDateTime(sqSb.mkfs_time), + Type = "Squash file system", + CreationDate = DateHandlers.UnixUnsignedToDateTime(sqSb.mkfs_time), CreationDateSpecified = true, Clusters = (long)((partition.End - partition.Start + 1) * imagePlugin.Info.SectorSize / sqSb.block_size), - ClusterSize = (int)sqSb.block_size, - Files = sqSb.inodes, - FilesSpecified = true, - FreeClusters = 0, + ClusterSize = (int)sqSb.block_size, + Files = sqSb.inodes, + FilesSpecified = true, + FreeClusters = 0, FreeClustersSpecified = true }; } @@ -144,34 +144,34 @@ namespace DiscImageChef.Filesystems { Zlib = 1, Lzma = 2, - Lzo = 3, - Xz = 4, - Lz4 = 5, + Lzo = 3, + Xz = 4, + Lz4 = 5, Zstd = 6 } [StructLayout(LayoutKind.Sequential, Pack = 1)] struct SquashSuperBlock { - public uint magic; - public uint inodes; - public uint mkfs_time; - public uint block_size; - public uint fragments; + public uint magic; + public uint inodes; + public uint mkfs_time; + public uint block_size; + public uint fragments; public ushort compression; public ushort block_log; public ushort flags; public ushort no_ids; public ushort s_major; public ushort s_minor; - public ulong root_inode; - public ulong bytes_used; - public ulong id_table_start; - public ulong xattr_id_table_start; - public ulong inode_table_start; - public ulong directory_table_start; - public ulong fragment_table_start; - public ulong lookup_table_start; + public ulong root_inode; + public ulong bytes_used; + public ulong id_table_start; + public ulong xattr_id_table_start; + public ulong inode_table_start; + public ulong directory_table_start; + public ulong fragment_table_start; + public ulong lookup_table_start; } } } \ No newline at end of file diff --git a/DiscImageChef.Filesystems/Structs.cs b/DiscImageChef.Filesystems/Structs.cs index 57f20be23..4567ec31c 100644 --- a/DiscImageChef.Filesystems/Structs.cs +++ b/DiscImageChef.Filesystems/Structs.cs @@ -245,9 +245,9 @@ namespace DiscImageChef.Filesystems [FieldOffset(1)] public bool IsLong; [FieldOffset(2)] public bool IsGuid; - [FieldOffset(3)] public uint Serial32; + [FieldOffset(3)] public uint Serial32; [FieldOffset(3)] public ulong Serial64; - [FieldOffset(3)] public Guid uuid; + [FieldOffset(3)] public Guid uuid; } /// diff --git a/DiscImageChef.Filesystems/Symbian.cs b/DiscImageChef.Filesystems/Symbian.cs index 331ad27fb..331aa70ad 100644 --- a/DiscImageChef.Filesystems/Symbian.cs +++ b/DiscImageChef.Filesystems/Symbian.cs @@ -30,8 +30,6 @@ // Copyright © 2011-2018 Natalia Portillo // ****************************************************************************/ - - // Information from http://www.thoukydides.webspace.virginmedia.com/software/psifs/sis.html // TODO: Implement support for disc images /* @@ -360,4 +358,5 @@ namespace DiscImageChef.Plugins } } -*/ \ No newline at end of file +*/ + diff --git a/DiscImageChef.Filesystems/SysV.cs b/DiscImageChef.Filesystems/SysV.cs index 2ed7c7993..efca6d7de 100644 --- a/DiscImageChef.Filesystems/SysV.cs +++ b/DiscImageChef.Filesystems/SysV.cs @@ -31,7 +31,6 @@ // ****************************************************************************/ using System; -using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; using System.Linq; using System.Text; @@ -47,8 +46,8 @@ namespace DiscImageChef.Filesystems { const uint XENIX_MAGIC = 0x002B5544; const uint XENIX_CIGAM = 0x44552B00; - const uint SYSV_MAGIC = 0xFD187E20; - const uint SYSV_CIGAM = 0x207E18FD; + const uint SYSV_MAGIC = 0xFD187E20; + const uint SYSV_CIGAM = 0x207E18FD; // Rest have no magic. // Per a Linux kernel, Coherent fs has following: const string COH_FNAME = "noname"; @@ -61,12 +60,12 @@ namespace DiscImageChef.Filesystems // UNIX 7th Edition has nothing to detect it, so check for a valid filesystem is a must :( const ushort V7_NICINOD = 100; const ushort V7_NICFREE = 100; - const uint V7_MAXSIZE = 0x00FFFFFF; + const uint V7_MAXSIZE = 0x00FFFFFF; public FileSystemType XmlFsType { get; private set; } - public Encoding Encoding { get; private set; } - public string Name => "UNIX System V filesystem"; - public Guid Id => new Guid("9B8D016A-8561-400E-A12A-A198283C211D"); + public Encoding Encoding { get; private set; } + public string Name => "UNIX System V filesystem"; + public Guid Id => new Guid("9B8D016A-8561-400E-A12A-A198283C211D"); public bool Identify(IMediaImage imagePlugin, Partition partition) { @@ -76,7 +75,7 @@ namespace DiscImageChef.Filesystems if(imagePlugin.Info.SectorSize <= 0x400 ) // Check if underlying device sector size is smaller than SuperBlock size - sb_size_in_sectors = (byte)(0x400 / imagePlugin.Info.SectorSize); + sb_size_in_sectors = (byte)(0x400 / imagePlugin.Info.SectorSize); 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 @@ -94,9 +93,11 @@ namespace DiscImageChef.Filesystems spc }; - foreach(byte[] sb_sector in locations.TakeWhile(i => (ulong)i + partition.Start + sb_size_in_sectors < imagePlugin.Info.Sectors) - .Select(i => imagePlugin.ReadSectors((ulong)i + partition.Start, - sb_size_in_sectors))) + foreach(byte[] sb_sector in locations + .TakeWhile(i => (ulong)i + partition.Start + sb_size_in_sectors < + imagePlugin.Info.Sectors) + .Select(i => imagePlugin.ReadSectors((ulong)i + partition.Start, + sb_size_in_sectors))) { uint magic = BitConverter.ToUInt32(sb_sector, 0x3F8); @@ -121,55 +122,56 @@ namespace DiscImageChef.Filesystems s_fname == COH_XXXXS && s_fpack == COH_XXXXN) return true; // Now try to identify 7th edition - uint s_fsize = BitConverter.ToUInt32(sb_sector, 0x002); - ushort s_nfree = BitConverter.ToUInt16(sb_sector, 0x006); + uint s_fsize = BitConverter.ToUInt32(sb_sector, 0x002); + ushort s_nfree = BitConverter.ToUInt16(sb_sector, 0x006); ushort s_ninode = BitConverter.ToUInt16(sb_sector, 0x0D0); - if(s_fsize <= 0 || s_fsize >= 0xFFFFFFFF || s_nfree <= 0 || s_nfree >= 0xFFFF || s_ninode <= 0 || + if(s_fsize <= 0 || s_fsize >= 0xFFFFFFFF || s_nfree <= 0 || s_nfree >= 0xFFFF || s_ninode <= 0 || s_ninode >= 0xFFFF) continue; 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 = ((s_fsize & 0xFF) << 24) + ((s_fsize & 0xFF00) << 8) + ((s_fsize & 0xFF0000) >> 8) + ((s_fsize & 0xFF000000) >> 24); - s_nfree = (ushort)(s_nfree >> 8); + s_nfree = (ushort)(s_nfree >> 8); s_ninode = (ushort)(s_ninode >> 8); } - if((s_fsize & 0xFF000000) != 0x00 || (s_nfree & 0xFF00) != 0x00 || - (s_ninode & 0xFF00) != 0x00) continue; + if((s_fsize & 0xFF000000) != 0x00 || (s_nfree & 0xFF00) != 0x00 || + (s_ninode & 0xFF00) != 0x00) continue; if(s_fsize >= V7_MAXSIZE || s_nfree >= V7_NICFREE || s_ninode >= V7_NICINOD) continue; if(s_fsize * 1024 == (partition.End - partition.Start) * imagePlugin.Info.SectorSize || - s_fsize * 512 == (partition.End - partition.Start) * imagePlugin.Info.SectorSize) return true; + s_fsize * 512 == (partition.End - partition.Start) * imagePlugin.Info.SectorSize) return true; } return false; } - public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information, Encoding encoding) + public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information, + Encoding encoding) { - Encoding = encoding ?? Encoding.GetEncoding("iso-8859-15"); + Encoding = encoding ?? Encoding.GetEncoding("iso-8859-15"); information = ""; StringBuilder sb = new StringBuilder(); BigEndianBitConverter.IsLittleEndian = true; // Start in little endian until we know what are we handling here - int start = 0; - bool xenix = false; - bool sysv = false; - bool sys7th = false; - bool coherent = false; - bool xenix3 = false; + int start = 0; + bool xenix = false; + bool sysv = false; + bool sys7th = false; + bool coherent = false; + bool xenix3 = false; byte[] sb_sector; - byte sb_size_in_sectors; - int offset = 0; + byte sb_size_in_sectors; + int offset = 0; if(imagePlugin.Info.SectorSize <= 0x400 ) // Check if underlying device sector size is smaller than SuperBlock size - sb_size_in_sectors = (byte)(0x400 / imagePlugin.Info.SectorSize); + sb_size_in_sectors = (byte)(0x400 / imagePlugin.Info.SectorSize); else sb_size_in_sectors = 1; // If not a single sector can store it // Sectors in a cylinder int spc = (int)(imagePlugin.Info.Heads * imagePlugin.Info.SectorsPerTrack); @@ -192,10 +194,11 @@ namespace DiscImageChef.Filesystems BigEndianBitConverter.IsLittleEndian = true; // Little endian if(magic == SYSV_MAGIC) { - sysv = true; + sysv = true; offset = 0x200; } else xenix = true; + start = i; break; } @@ -205,10 +208,11 @@ namespace DiscImageChef.Filesystems BigEndianBitConverter.IsLittleEndian = false; // Big endian if(magic == SYSV_CIGAM) { - sysv = true; + sysv = true; offset = 0x200; } else xenix = true; + start = i; break; } @@ -218,16 +222,16 @@ namespace DiscImageChef.Filesystems if(magic == XENIX_MAGIC) { BigEndianBitConverter.IsLittleEndian = true; // Little endian - xenix3 = true; - start = i; + xenix3 = true; + start = i; break; } if(magic == XENIX_CIGAM) { BigEndianBitConverter.IsLittleEndian = false; // Big endian - xenix3 = true; - start = i; + xenix3 = true; + start = i; break; } @@ -236,16 +240,16 @@ namespace DiscImageChef.Filesystems if(magic == SYSV_MAGIC) { BigEndianBitConverter.IsLittleEndian = true; // Little endian - sysv = true; - start = i; + sysv = true; + start = i; break; } if(magic == SYSV_CIGAM) { BigEndianBitConverter.IsLittleEndian = false; // Big endian - sysv = true; - start = i; + sysv = true; + start = i; break; } @@ -259,39 +263,39 @@ namespace DiscImageChef.Filesystems s_fname == COH_XXXXS && s_fpack == COH_XXXXN) { BigEndianBitConverter.IsLittleEndian = true; // Coherent is in PDP endianness, use helper for that - coherent = true; - start = i; + coherent = true; + start = i; break; } // Now try to identify 7th edition - uint s_fsize = BitConverter.ToUInt32(sb_sector, 0x002); - ushort s_nfree = BitConverter.ToUInt16(sb_sector, 0x006); + uint s_fsize = BitConverter.ToUInt32(sb_sector, 0x002); + ushort s_nfree = BitConverter.ToUInt16(sb_sector, 0x006); ushort s_ninode = BitConverter.ToUInt16(sb_sector, 0x0D0); - if(s_fsize <= 0 || s_fsize >= 0xFFFFFFFF || s_nfree <= 0 || s_nfree >= 0xFFFF || s_ninode <= 0 || + if(s_fsize <= 0 || s_fsize >= 0xFFFFFFFF || s_nfree <= 0 || s_nfree >= 0xFFFF || s_ninode <= 0 || s_ninode >= 0xFFFF) continue; 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 = ((s_fsize & 0xFF) << 24) + ((s_fsize & 0xFF00) << 8) + ((s_fsize & 0xFF0000) >> 8) + ((s_fsize & 0xFF000000) >> 24); - s_nfree = (ushort)(s_nfree >> 8); + s_nfree = (ushort)(s_nfree >> 8); s_ninode = (ushort)(s_ninode >> 8); } - if((s_fsize & 0xFF000000) != 0x00 || (s_nfree & 0xFF00) != 0x00 || - (s_ninode & 0xFF00) != 0x00) continue; + if((s_fsize & 0xFF000000) != 0x00 || (s_nfree & 0xFF00) != 0x00 || + (s_ninode & 0xFF00) != 0x00) continue; if(s_fsize >= V7_MAXSIZE || s_nfree >= V7_NICFREE || s_ninode >= V7_NICINOD) continue; if(s_fsize * 1024 != (partition.End - partition.Start) * imagePlugin.Info.SectorSize && - s_fsize * 512 != (partition.End - partition.Start) * imagePlugin.Info.SectorSize) continue; + s_fsize * 512 != (partition.End - partition.Start) * imagePlugin.Info.SectorSize) continue; - sys7th = true; + sys7th = true; BigEndianBitConverter.IsLittleEndian = true; - start = i; + start = i; break; } @@ -301,59 +305,59 @@ namespace DiscImageChef.Filesystems if(xenix || xenix3) { - byte[] xenix_strings = new byte[6]; - XenixSuperBlock xnx_sb = new XenixSuperBlock(); + byte[] xenix_strings = new byte[6]; + XenixSuperBlock xnx_sb = new XenixSuperBlock(); sb_sector = imagePlugin.ReadSectors((ulong)start + partition.Start, sb_size_in_sectors); if(xenix3) { - xnx_sb.s_isize = BigEndianBitConverter.ToUInt16(sb_sector, 0x000); - xnx_sb.s_fsize = BigEndianBitConverter.ToUInt32(sb_sector, 0x002); - xnx_sb.s_nfree = BigEndianBitConverter.ToUInt16(sb_sector, 0x006); - xnx_sb.s_ninode = BigEndianBitConverter.ToUInt16(sb_sector, 0x0D0); - xnx_sb.s_flock = sb_sector[0x19A]; - xnx_sb.s_ilock = sb_sector[0x19B]; - xnx_sb.s_fmod = sb_sector[0x19C]; - xnx_sb.s_ronly = sb_sector[0x19D]; - xnx_sb.s_time = BigEndianBitConverter.ToInt32(sb_sector, 0x19E); - xnx_sb.s_tfree = BigEndianBitConverter.ToUInt32(sb_sector, 0x1A2); - xnx_sb.s_tinode = BigEndianBitConverter.ToUInt16(sb_sector, 0x1A6); + xnx_sb.s_isize = BigEndianBitConverter.ToUInt16(sb_sector, 0x000); + xnx_sb.s_fsize = BigEndianBitConverter.ToUInt32(sb_sector, 0x002); + xnx_sb.s_nfree = BigEndianBitConverter.ToUInt16(sb_sector, 0x006); + xnx_sb.s_ninode = BigEndianBitConverter.ToUInt16(sb_sector, 0x0D0); + xnx_sb.s_flock = sb_sector[0x19A]; + xnx_sb.s_ilock = sb_sector[0x19B]; + xnx_sb.s_fmod = sb_sector[0x19C]; + xnx_sb.s_ronly = sb_sector[0x19D]; + xnx_sb.s_time = BigEndianBitConverter.ToInt32(sb_sector, 0x19E); + xnx_sb.s_tfree = BigEndianBitConverter.ToUInt32(sb_sector, 0x1A2); + xnx_sb.s_tinode = BigEndianBitConverter.ToUInt16(sb_sector, 0x1A6); xnx_sb.s_cylblks = BigEndianBitConverter.ToUInt16(sb_sector, 0x1A8); xnx_sb.s_gapblks = BigEndianBitConverter.ToUInt16(sb_sector, 0x1AA); - xnx_sb.s_dinfo0 = BigEndianBitConverter.ToUInt16(sb_sector, 0x1AC); - xnx_sb.s_dinfo1 = BigEndianBitConverter.ToUInt16(sb_sector, 0x1AE); + xnx_sb.s_dinfo0 = BigEndianBitConverter.ToUInt16(sb_sector, 0x1AC); + xnx_sb.s_dinfo1 = BigEndianBitConverter.ToUInt16(sb_sector, 0x1AE); Array.Copy(sb_sector, 0x1B0, xenix_strings, 0, 6); xnx_sb.s_fname = StringHandlers.CToString(xenix_strings, Encoding); Array.Copy(sb_sector, 0x1B6, xenix_strings, 0, 6); xnx_sb.s_fpack = StringHandlers.CToString(xenix_strings, Encoding); xnx_sb.s_clean = sb_sector[0x1BC]; xnx_sb.s_magic = BigEndianBitConverter.ToUInt32(sb_sector, 0x1F0); - xnx_sb.s_type = BigEndianBitConverter.ToUInt32(sb_sector, 0x1F4); + xnx_sb.s_type = BigEndianBitConverter.ToUInt32(sb_sector, 0x1F4); } else { - xnx_sb.s_isize = BigEndianBitConverter.ToUInt16(sb_sector, 0x000); - xnx_sb.s_fsize = BigEndianBitConverter.ToUInt32(sb_sector, 0x002); - xnx_sb.s_nfree = BigEndianBitConverter.ToUInt16(sb_sector, 0x006); - xnx_sb.s_ninode = BigEndianBitConverter.ToUInt16(sb_sector, 0x198); - xnx_sb.s_flock = sb_sector[0x262]; - xnx_sb.s_ilock = sb_sector[0x263]; - xnx_sb.s_fmod = sb_sector[0x264]; - xnx_sb.s_ronly = sb_sector[0x265]; - xnx_sb.s_time = BigEndianBitConverter.ToInt32(sb_sector, 0x266); - xnx_sb.s_tfree = BigEndianBitConverter.ToUInt32(sb_sector, 0x26A); - xnx_sb.s_tinode = BigEndianBitConverter.ToUInt16(sb_sector, 0x26E); + xnx_sb.s_isize = BigEndianBitConverter.ToUInt16(sb_sector, 0x000); + xnx_sb.s_fsize = BigEndianBitConverter.ToUInt32(sb_sector, 0x002); + xnx_sb.s_nfree = BigEndianBitConverter.ToUInt16(sb_sector, 0x006); + xnx_sb.s_ninode = BigEndianBitConverter.ToUInt16(sb_sector, 0x198); + xnx_sb.s_flock = sb_sector[0x262]; + xnx_sb.s_ilock = sb_sector[0x263]; + xnx_sb.s_fmod = sb_sector[0x264]; + xnx_sb.s_ronly = sb_sector[0x265]; + xnx_sb.s_time = BigEndianBitConverter.ToInt32(sb_sector, 0x266); + xnx_sb.s_tfree = BigEndianBitConverter.ToUInt32(sb_sector, 0x26A); + xnx_sb.s_tinode = BigEndianBitConverter.ToUInt16(sb_sector, 0x26E); xnx_sb.s_cylblks = BigEndianBitConverter.ToUInt16(sb_sector, 0x270); xnx_sb.s_gapblks = BigEndianBitConverter.ToUInt16(sb_sector, 0x272); - xnx_sb.s_dinfo0 = BigEndianBitConverter.ToUInt16(sb_sector, 0x274); - xnx_sb.s_dinfo1 = BigEndianBitConverter.ToUInt16(sb_sector, 0x276); + xnx_sb.s_dinfo0 = BigEndianBitConverter.ToUInt16(sb_sector, 0x274); + xnx_sb.s_dinfo1 = BigEndianBitConverter.ToUInt16(sb_sector, 0x276); Array.Copy(sb_sector, 0x278, xenix_strings, 0, 6); xnx_sb.s_fname = StringHandlers.CToString(xenix_strings, Encoding); Array.Copy(sb_sector, 0x27E, xenix_strings, 0, 6); xnx_sb.s_fpack = StringHandlers.CToString(xenix_strings, Encoding); xnx_sb.s_clean = sb_sector[0x284]; xnx_sb.s_magic = BigEndianBitConverter.ToUInt32(sb_sector, 0x3F8); - xnx_sb.s_type = BigEndianBitConverter.ToUInt32(sb_sector, 0x3FC); + xnx_sb.s_type = BigEndianBitConverter.ToUInt32(sb_sector, 0x3FC); } uint bs = 512; @@ -367,12 +371,12 @@ namespace DiscImageChef.Filesystems break; case 2: sb.AppendLine("1024 bytes per block"); - bs = 1024; + bs = 1024; XmlFsType.ClusterSize = 1024; break; case 3: sb.AppendLine("2048 bytes per block"); - bs = 2048; + bs = 2048; XmlFsType.ClusterSize = 2048; break; default: @@ -385,16 +389,17 @@ namespace DiscImageChef.Filesystems { if(bs != 2048) sb - .AppendFormat("WARNING: Filesystem indicates {0} bytes/block while device indicates {1} bytes/sector", - bs, 2048).AppendLine(); + .AppendFormat("WARNING: Filesystem indicates {0} bytes/block while device indicates {1} bytes/sector", + bs, 2048).AppendLine(); } else { if(bs != imagePlugin.Info.SectorSize) sb - .AppendFormat("WARNING: Filesystem indicates {0} bytes/block while device indicates {1} bytes/sector", - bs, imagePlugin.Info.SectorSize).AppendLine(); + .AppendFormat("WARNING: Filesystem indicates {0} bytes/block while device indicates {1} bytes/sector", + bs, imagePlugin.Info.SectorSize).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(); @@ -408,15 +413,16 @@ namespace DiscImageChef.Filesystems 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_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); + XmlFsType.ModificationDate = DateHandlers.UnixToDateTime(xnx_sb.s_time); XmlFsType.ModificationDateSpecified = true; } + 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(); @@ -444,11 +450,11 @@ namespace DiscImageChef.Filesystems XmlFsType.ClusterSize = 512; break; case 2: - bs = 1024; + bs = 1024; XmlFsType.ClusterSize = 1024; break; case 3: - bs = 2048; + bs = 2048; XmlFsType.ClusterSize = 2048; break; default: @@ -462,23 +468,23 @@ namespace DiscImageChef.Filesystems if(sysvr4) { - sysv_sb.s_isize = BigEndianBitConverter.ToUInt16(sb_sector, 0x000 + offset); - sysv_sb.s_state = BigEndianBitConverter.ToUInt32(sb_sector, 0x1F4 + offset); - sysv_sb.s_magic = BigEndianBitConverter.ToUInt32(sb_sector, 0x1F8 + offset); - sysv_sb.s_fsize = BigEndianBitConverter.ToUInt32(sb_sector, 0x004 + offset); - sysv_sb.s_nfree = BigEndianBitConverter.ToUInt16(sb_sector, 0x008 + offset); - sysv_sb.s_ninode = BigEndianBitConverter.ToUInt16(sb_sector, 0x0D4 + offset); - sysv_sb.s_flock = sb_sector[0x1A0 + offset]; - sysv_sb.s_ilock = sb_sector[0x1A1 + offset]; - sysv_sb.s_fmod = sb_sector[0x1A2 + offset]; - sysv_sb.s_ronly = sb_sector[0x1A3 + offset]; - sysv_sb.s_time = BigEndianBitConverter.ToUInt32(sb_sector, 0x1A4 + offset); + sysv_sb.s_isize = BigEndianBitConverter.ToUInt16(sb_sector, 0x000 + offset); + sysv_sb.s_state = BigEndianBitConverter.ToUInt32(sb_sector, 0x1F4 + offset); + sysv_sb.s_magic = BigEndianBitConverter.ToUInt32(sb_sector, 0x1F8 + offset); + sysv_sb.s_fsize = BigEndianBitConverter.ToUInt32(sb_sector, 0x004 + offset); + sysv_sb.s_nfree = BigEndianBitConverter.ToUInt16(sb_sector, 0x008 + offset); + sysv_sb.s_ninode = BigEndianBitConverter.ToUInt16(sb_sector, 0x0D4 + offset); + sysv_sb.s_flock = sb_sector[0x1A0 + offset]; + sysv_sb.s_ilock = sb_sector[0x1A1 + offset]; + sysv_sb.s_fmod = sb_sector[0x1A2 + offset]; + sysv_sb.s_ronly = sb_sector[0x1A3 + offset]; + sysv_sb.s_time = BigEndianBitConverter.ToUInt32(sb_sector, 0x1A4 + offset); sysv_sb.s_cylblks = BigEndianBitConverter.ToUInt16(sb_sector, 0x1A8 + offset); sysv_sb.s_gapblks = BigEndianBitConverter.ToUInt16(sb_sector, 0x1AA + offset); - sysv_sb.s_dinfo0 = BigEndianBitConverter.ToUInt16(sb_sector, 0x1AC + offset); - sysv_sb.s_dinfo1 = BigEndianBitConverter.ToUInt16(sb_sector, 0x1AE + offset); - sysv_sb.s_tfree = BigEndianBitConverter.ToUInt32(sb_sector, 0x1B0 + offset); - sysv_sb.s_tinode = BigEndianBitConverter.ToUInt16(sb_sector, 0x1B4 + offset); + sysv_sb.s_dinfo0 = BigEndianBitConverter.ToUInt16(sb_sector, 0x1AC + offset); + sysv_sb.s_dinfo1 = BigEndianBitConverter.ToUInt16(sb_sector, 0x1AE + offset); + sysv_sb.s_tfree = BigEndianBitConverter.ToUInt32(sb_sector, 0x1B0 + offset); + sysv_sb.s_tinode = BigEndianBitConverter.ToUInt16(sb_sector, 0x1B4 + offset); Array.Copy(sb_sector, 0x1B6 + offset, sysv_strings, 0, 6); sysv_sb.s_fname = StringHandlers.CToString(sysv_strings, Encoding); Array.Copy(sb_sector, 0x1BC + offset, sysv_strings, 0, 6); @@ -488,23 +494,23 @@ namespace DiscImageChef.Filesystems } else { - sysv_sb.s_isize = BigEndianBitConverter.ToUInt16(sb_sector, 0x000 + offset); - sysv_sb.s_state = BigEndianBitConverter.ToUInt32(sb_sector, 0x1F4 + offset); - sysv_sb.s_magic = BigEndianBitConverter.ToUInt32(sb_sector, 0x1F8 + offset); - sysv_sb.s_fsize = BigEndianBitConverter.ToUInt32(sb_sector, 0x002 + offset); - sysv_sb.s_nfree = BigEndianBitConverter.ToUInt16(sb_sector, 0x006 + offset); - sysv_sb.s_ninode = BigEndianBitConverter.ToUInt16(sb_sector, 0x0D0 + offset); - sysv_sb.s_flock = sb_sector[0x19A + offset]; - sysv_sb.s_ilock = sb_sector[0x19B + offset]; - sysv_sb.s_fmod = sb_sector[0x19C + offset]; - sysv_sb.s_ronly = sb_sector[0x19D + offset]; - sysv_sb.s_time = BigEndianBitConverter.ToUInt32(sb_sector, 0x19E + offset); + sysv_sb.s_isize = BigEndianBitConverter.ToUInt16(sb_sector, 0x000 + offset); + sysv_sb.s_state = BigEndianBitConverter.ToUInt32(sb_sector, 0x1F4 + offset); + sysv_sb.s_magic = BigEndianBitConverter.ToUInt32(sb_sector, 0x1F8 + offset); + sysv_sb.s_fsize = BigEndianBitConverter.ToUInt32(sb_sector, 0x002 + offset); + sysv_sb.s_nfree = BigEndianBitConverter.ToUInt16(sb_sector, 0x006 + offset); + sysv_sb.s_ninode = BigEndianBitConverter.ToUInt16(sb_sector, 0x0D0 + offset); + sysv_sb.s_flock = sb_sector[0x19A + offset]; + sysv_sb.s_ilock = sb_sector[0x19B + offset]; + sysv_sb.s_fmod = sb_sector[0x19C + offset]; + sysv_sb.s_ronly = sb_sector[0x19D + offset]; + sysv_sb.s_time = BigEndianBitConverter.ToUInt32(sb_sector, 0x19E + offset); sysv_sb.s_cylblks = BigEndianBitConverter.ToUInt16(sb_sector, 0x1A2 + offset); sysv_sb.s_gapblks = BigEndianBitConverter.ToUInt16(sb_sector, 0x1A4 + offset); - sysv_sb.s_dinfo0 = BigEndianBitConverter.ToUInt16(sb_sector, 0x1A6 + offset); - sysv_sb.s_dinfo1 = BigEndianBitConverter.ToUInt16(sb_sector, 0x1A8 + offset); - sysv_sb.s_tfree = BigEndianBitConverter.ToUInt32(sb_sector, 0x1AA + offset); - sysv_sb.s_tinode = BigEndianBitConverter.ToUInt16(sb_sector, 0x1AE + offset); + sysv_sb.s_dinfo0 = BigEndianBitConverter.ToUInt16(sb_sector, 0x1A6 + offset); + sysv_sb.s_dinfo1 = BigEndianBitConverter.ToUInt16(sb_sector, 0x1A8 + offset); + sysv_sb.s_tfree = BigEndianBitConverter.ToUInt32(sb_sector, 0x1AA + offset); + sysv_sb.s_tinode = BigEndianBitConverter.ToUInt16(sb_sector, 0x1AE + offset); Array.Copy(sb_sector, 0x1B0 + offset, sysv_strings, 0, 6); sysv_sb.s_fname = StringHandlers.CToString(sysv_strings, Encoding); Array.Copy(sb_sector, 0x1B6 + offset, sysv_strings, 0, 6); @@ -512,6 +518,7 @@ namespace DiscImageChef.Filesystems sb.AppendLine("System V Release 2 filesystem"); XmlFsType.Type = "SVR2 fs"; } + sb.AppendFormat("{0} bytes per block", bs).AppendLine(); XmlFsType.Clusters = sysv_sb.s_fsize; @@ -529,15 +536,16 @@ namespace DiscImageChef.Filesystems 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_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); + XmlFsType.ModificationDate = DateHandlers.UnixUnsignedToDateTime(sysv_sb.s_time); XmlFsType.ModificationDateSpecified = true; } + 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(); @@ -552,36 +560,36 @@ namespace DiscImageChef.Filesystems if(coherent) { sb_sector = imagePlugin.ReadSectors((ulong)start + partition.Start, sb_size_in_sectors); - CoherentSuperBlock coh_sb = new CoherentSuperBlock(); - byte[] coh_strings = new byte[6]; + CoherentSuperBlock coh_sb = new CoherentSuperBlock(); + byte[] coh_strings = new byte[6]; - coh_sb.s_isize = BitConverter.ToUInt16(sb_sector, 0x000); - coh_sb.s_fsize = Swapping.PDPFromLittleEndian(BitConverter.ToUInt32(sb_sector, 0x002)); - coh_sb.s_nfree = BitConverter.ToUInt16(sb_sector, 0x006); + coh_sb.s_isize = BitConverter.ToUInt16(sb_sector, 0x000); + coh_sb.s_fsize = Swapping.PDPFromLittleEndian(BitConverter.ToUInt32(sb_sector, 0x002)); + coh_sb.s_nfree = BitConverter.ToUInt16(sb_sector, 0x006); coh_sb.s_ninode = BitConverter.ToUInt16(sb_sector, 0x108); - coh_sb.s_flock = sb_sector[0x1D2]; - coh_sb.s_ilock = sb_sector[0x1D3]; - coh_sb.s_fmod = sb_sector[0x1D4]; - coh_sb.s_ronly = sb_sector[0x1D5]; - coh_sb.s_time = Swapping.PDPFromLittleEndian(BitConverter.ToUInt32(sb_sector, 0x1D6)); - coh_sb.s_tfree = Swapping.PDPFromLittleEndian(BitConverter.ToUInt32(sb_sector, 0x1DA)); + coh_sb.s_flock = sb_sector[0x1D2]; + coh_sb.s_ilock = sb_sector[0x1D3]; + coh_sb.s_fmod = sb_sector[0x1D4]; + coh_sb.s_ronly = sb_sector[0x1D5]; + coh_sb.s_time = Swapping.PDPFromLittleEndian(BitConverter.ToUInt32(sb_sector, 0x1D6)); + coh_sb.s_tfree = Swapping.PDPFromLittleEndian(BitConverter.ToUInt32(sb_sector, 0x1DA)); coh_sb.s_tinode = BitConverter.ToUInt16(sb_sector, 0x1DE); - coh_sb.s_int_m = BitConverter.ToUInt16(sb_sector, 0x1E0); - coh_sb.s_int_n = BitConverter.ToUInt16(sb_sector, 0x1E2); + coh_sb.s_int_m = BitConverter.ToUInt16(sb_sector, 0x1E0); + coh_sb.s_int_n = BitConverter.ToUInt16(sb_sector, 0x1E2); Array.Copy(sb_sector, 0x1E4, coh_strings, 0, 6); coh_sb.s_fname = StringHandlers.CToString(coh_strings, Encoding); Array.Copy(sb_sector, 0x1EA, coh_strings, 0, 6); coh_sb.s_fpack = StringHandlers.CToString(coh_strings, Encoding); - XmlFsType.Type = "Coherent fs"; + XmlFsType.Type = "Coherent fs"; XmlFsType.ClusterSize = 512; - XmlFsType.Clusters = coh_sb.s_fsize; + XmlFsType.Clusters = coh_sb.s_fsize; sb.AppendLine("Coherent UNIX filesystem"); if(imagePlugin.Info.SectorSize != 512) sb - .AppendFormat("WARNING: Filesystem indicates {0} bytes/block while device indicates {1} bytes/sector", - 512, 2048).AppendLine(); + .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(); @@ -592,15 +600,16 @@ namespace DiscImageChef.Filesystems 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_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); + XmlFsType.ModificationDate = DateHandlers.UnixUnsignedToDateTime(coh_sb.s_time); XmlFsType.ModificationDateSpecified = true; } + sb.AppendFormat("Volume name: {0}", coh_sb.s_fname).AppendLine(); XmlFsType.VolumeName = coh_sb.s_fname; sb.AppendFormat("Pack name: {0}", coh_sb.s_fpack).AppendLine(); @@ -609,35 +618,35 @@ namespace DiscImageChef.Filesystems if(sys7th) { sb_sector = imagePlugin.ReadSectors((ulong)start + partition.Start, sb_size_in_sectors); - UNIX7thEditionSuperBlock v7_sb = new UNIX7thEditionSuperBlock(); - byte[] sys7_strings = new byte[6]; + UNIX7thEditionSuperBlock v7_sb = new UNIX7thEditionSuperBlock(); + byte[] sys7_strings = new byte[6]; - v7_sb.s_isize = BigEndianBitConverter.ToUInt16(sb_sector, 0x000); - v7_sb.s_fsize = BigEndianBitConverter.ToUInt32(sb_sector, 0x002); - v7_sb.s_nfree = BigEndianBitConverter.ToUInt16(sb_sector, 0x006); + v7_sb.s_isize = BigEndianBitConverter.ToUInt16(sb_sector, 0x000); + v7_sb.s_fsize = BigEndianBitConverter.ToUInt32(sb_sector, 0x002); + v7_sb.s_nfree = BigEndianBitConverter.ToUInt16(sb_sector, 0x006); v7_sb.s_ninode = BigEndianBitConverter.ToUInt16(sb_sector, 0x0D0); - v7_sb.s_flock = sb_sector[0x19A]; - v7_sb.s_ilock = sb_sector[0x19B]; - v7_sb.s_fmod = sb_sector[0x19C]; - v7_sb.s_ronly = sb_sector[0x19D]; - v7_sb.s_time = BigEndianBitConverter.ToUInt32(sb_sector, 0x19E); - v7_sb.s_tfree = BigEndianBitConverter.ToUInt32(sb_sector, 0x1A2); + v7_sb.s_flock = sb_sector[0x19A]; + v7_sb.s_ilock = sb_sector[0x19B]; + v7_sb.s_fmod = sb_sector[0x19C]; + v7_sb.s_ronly = sb_sector[0x19D]; + v7_sb.s_time = BigEndianBitConverter.ToUInt32(sb_sector, 0x19E); + v7_sb.s_tfree = BigEndianBitConverter.ToUInt32(sb_sector, 0x1A2); v7_sb.s_tinode = BigEndianBitConverter.ToUInt16(sb_sector, 0x1A6); - v7_sb.s_int_m = BigEndianBitConverter.ToUInt16(sb_sector, 0x1A8); - v7_sb.s_int_n = BigEndianBitConverter.ToUInt16(sb_sector, 0x1AA); + v7_sb.s_int_m = BigEndianBitConverter.ToUInt16(sb_sector, 0x1A8); + v7_sb.s_int_n = BigEndianBitConverter.ToUInt16(sb_sector, 0x1AA); Array.Copy(sb_sector, 0x1AC, sys7_strings, 0, 6); v7_sb.s_fname = StringHandlers.CToString(sys7_strings, Encoding); Array.Copy(sb_sector, 0x1B2, sys7_strings, 0, 6); v7_sb.s_fpack = StringHandlers.CToString(sys7_strings, Encoding); - XmlFsType.Type = "UNIX 7th Edition fs"; + XmlFsType.Type = "UNIX 7th Edition fs"; XmlFsType.ClusterSize = 512; - XmlFsType.Clusters = v7_sb.s_fsize; + XmlFsType.Clusters = v7_sb.s_fsize; sb.AppendLine("UNIX 7th Edition filesystem"); if(imagePlugin.Info.SectorSize != 512) sb - .AppendFormat("WARNING: Filesystem indicates {0} bytes/block while device indicates {1} bytes/sector", - 512, 2048).AppendLine(); + .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(); @@ -647,15 +656,16 @@ namespace DiscImageChef.Filesystems 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_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); + XmlFsType.ModificationDate = DateHandlers.UnixUnsignedToDateTime(v7_sb.s_time); XmlFsType.ModificationDateSpecified = true; } + sb.AppendFormat("Volume name: {0}", v7_sb.s_fname).AppendLine(); XmlFsType.VolumeName = v7_sb.s_fname; sb.AppendFormat("Pack name: {0}", v7_sb.s_fpack).AppendLine(); diff --git a/DiscImageChef.Filesystems/UCSDPascal/File.cs b/DiscImageChef.Filesystems/UCSDPascal/File.cs index d98661ef4..9b28d74ed 100644 --- a/DiscImageChef.Filesystems/UCSDPascal/File.cs +++ b/DiscImageChef.Filesystems/UCSDPascal/File.cs @@ -72,19 +72,16 @@ namespace DiscImageChef.Filesystems.UCSDPascal if(debug && (string.Compare(path, "$", StringComparison.InvariantCulture) == 0 || string.Compare(path, "$Boot", StringComparison.InvariantCulture) == 0)) - file = string.Compare(path, "$", StringComparison.InvariantCulture) == 0 - ? catalogBlocks - : bootBlocks; + file = string.Compare(path, "$", StringComparison.InvariantCulture) == 0 ? catalogBlocks : bootBlocks; else { Errno error = GetFileEntry(path, out PascalFileEntry entry); if(error != Errno.NoError) return error; - byte[] tmp = device.ReadSectors((ulong)entry.FirstBlock * multiplier, - (uint)(entry.LastBlock - entry.FirstBlock) * multiplier); - file = new byte[(entry.LastBlock - entry.FirstBlock - 1) * - device.Info.SectorSize * multiplier + + byte[] tmp = device.ReadSectors((ulong)entry.FirstBlock * multiplier, + (uint)(entry.LastBlock - entry.FirstBlock) * multiplier); + file = new byte[(entry.LastBlock - entry.FirstBlock - 1) * device.Info.SectorSize * multiplier + entry.LastBytes]; Array.Copy(tmp, 0, file, 0, file.Length); } @@ -150,7 +147,7 @@ namespace DiscImageChef.Filesystems.UCSDPascal GID = 0, Inode = 0, LastWriteTimeUtc = DateHandlers.UcsdPascalToDateTime(entry.ModificationTime), - Length = (entry.LastBlock - entry.FirstBlock) * device.Info.SectorSize * multiplier + + Length = (entry.LastBlock - entry.FirstBlock) * device.Info.SectorSize * multiplier + entry.LastBytes, Links = 1, Mode = 0x124, diff --git a/DiscImageChef.Filesystems/UCSDPascal/Info.cs b/DiscImageChef.Filesystems/UCSDPascal/Info.cs index 752955d63..deab10c28 100644 --- a/DiscImageChef.Filesystems/UCSDPascal/Info.cs +++ b/DiscImageChef.Filesystems/UCSDPascal/Info.cs @@ -59,8 +59,8 @@ namespace DiscImageChef.Filesystems.UCSDPascal BigEndianBitConverter.IsLittleEndian = multiplier == 2 ? !BitConverter.IsLittleEndian : BitConverter.IsLittleEndian; - volEntry.FirstBlock = BigEndianBitConverter.ToInt16(volBlock, 0x00); - volEntry.LastBlock = BigEndianBitConverter.ToInt16(volBlock, 0x02); + volEntry.FirstBlock = BigEndianBitConverter.ToInt16(volBlock, 0x00); + volEntry.LastBlock = BigEndianBitConverter.ToInt16(volBlock, 0x02); volEntry.EntryType = (PascalFileKind)BigEndianBitConverter.ToInt16(volBlock, 0x04); volEntry.VolumeName = new byte[8]; Array.Copy(volBlock, 0x06, volEntry.VolumeName, 0, 8); @@ -103,10 +103,10 @@ namespace DiscImageChef.Filesystems.UCSDPascal public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information, Encoding encoding) { - Encoding = encoding ?? new Apple2(); + Encoding = encoding ?? new Apple2(); StringBuilder sbInformation = new StringBuilder(); - information = ""; - multiplier = (uint)(imagePlugin.Info.SectorSize == 256 ? 2 : 1); + information = ""; + multiplier = (uint)(imagePlugin.Info.SectorSize == 256 ? 2 : 1); if(imagePlugin.Info.Sectors < 3) return; @@ -119,8 +119,8 @@ namespace DiscImageChef.Filesystems.UCSDPascal BigEndianBitConverter.IsLittleEndian = multiplier == 2 ? !BitConverter.IsLittleEndian : BitConverter.IsLittleEndian; - volEntry.FirstBlock = BigEndianBitConverter.ToInt16(volBlock, 0x00); - volEntry.LastBlock = BigEndianBitConverter.ToInt16(volBlock, 0x02); + volEntry.FirstBlock = BigEndianBitConverter.ToInt16(volBlock, 0x00); + volEntry.LastBlock = BigEndianBitConverter.ToInt16(volBlock, 0x02); volEntry.EntryType = (PascalFileKind)BigEndianBitConverter.ToInt16(volBlock, 0x04); volEntry.VolumeName = new byte[8]; Array.Copy(volBlock, 0x06, volEntry.VolumeName, 0, 8); @@ -154,7 +154,7 @@ namespace DiscImageChef.Filesystems.UCSDPascal sbInformation.AppendFormat("Volume name: {0}", StringHandlers.PascalToString(volEntry.VolumeName, Encoding)) .AppendLine(); sbInformation.AppendFormat("Volume has {0} blocks", volEntry.Blocks).AppendLine(); - sbInformation.AppendFormat("Volume has {0} files", volEntry.Files).AppendLine(); + sbInformation.AppendFormat("Volume has {0} files", volEntry.Files).AppendLine(); sbInformation .AppendFormat("Volume last booted at {0}", DateHandlers.UcsdPascalToDateTime(volEntry.LastBoot)) .AppendLine(); diff --git a/DiscImageChef.Filesystems/UCSDPascal/Super.cs b/DiscImageChef.Filesystems/UCSDPascal/Super.cs index d93572f9c..bcf23115a 100644 --- a/DiscImageChef.Filesystems/UCSDPascal/Super.cs +++ b/DiscImageChef.Filesystems/UCSDPascal/Super.cs @@ -46,8 +46,8 @@ namespace DiscImageChef.Filesystems.UCSDPascal public Errno Mount(IMediaImage imagePlugin, Partition partition, Encoding encoding, Dictionary options) { - device = imagePlugin; - Encoding = encoding ?? new Apple2(); + device = imagePlugin; + Encoding = encoding ?? new Apple2(); if(options == null) options = GetDefaultOptions(); if(options.TryGetValue("debug", out string debugString)) bool.TryParse(debugString, out debug); if(device.Info.Sectors < 3) return Errno.InvalidArgument; @@ -61,8 +61,8 @@ namespace DiscImageChef.Filesystems.UCSDPascal BigEndianBitConverter.IsLittleEndian = multiplier == 2 ? !BitConverter.IsLittleEndian : BitConverter.IsLittleEndian; - mountedVolEntry.FirstBlock = BigEndianBitConverter.ToInt16(catalogBlocks, 0x00); - mountedVolEntry.LastBlock = BigEndianBitConverter.ToInt16(catalogBlocks, 0x02); + mountedVolEntry.FirstBlock = BigEndianBitConverter.ToInt16(catalogBlocks, 0x00); + mountedVolEntry.LastBlock = BigEndianBitConverter.ToInt16(catalogBlocks, 0x02); mountedVolEntry.EntryType = (PascalFileKind)BigEndianBitConverter.ToInt16(catalogBlocks, 0x04); mountedVolEntry.VolumeName = new byte[8]; Array.Copy(catalogBlocks, 0x06, mountedVolEntry.VolumeName, 0, 8); @@ -75,14 +75,14 @@ namespace DiscImageChef.Filesystems.UCSDPascal if(mountedVolEntry.FirstBlock != 0 || mountedVolEntry.LastBlock <= mountedVolEntry.FirstBlock || (ulong)mountedVolEntry.LastBlock > device.Info.Sectors / multiplier - 2 || - mountedVolEntry.EntryType != PascalFileKind.Volume && - mountedVolEntry.EntryType != PascalFileKind.Secure || - mountedVolEntry.VolumeName[0] > 7 || - mountedVolEntry.Blocks < 0 || - (ulong)mountedVolEntry.Blocks != device.Info.Sectors / multiplier || - 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.Info.Sectors / multiplier || + mountedVolEntry.Files < 0) + return Errno.InvalidArgument; - catalogBlocks = device.ReadSectors(multiplier * 2, + catalogBlocks = device.ReadSectors(multiplier * 2, (uint)(mountedVolEntry.LastBlock - mountedVolEntry.FirstBlock - 2) * multiplier); int offset = 26; @@ -93,11 +93,11 @@ namespace DiscImageChef.Filesystems.UCSDPascal PascalFileEntry entry = new PascalFileEntry { Filename = new byte[16], - FirstBlock = BigEndianBitConverter.ToInt16(catalogBlocks, offset + 0x00), - LastBlock = BigEndianBitConverter.ToInt16(catalogBlocks, offset + 0x02), + FirstBlock = BigEndianBitConverter.ToInt16(catalogBlocks, offset + 0x00), + LastBlock = BigEndianBitConverter.ToInt16(catalogBlocks, offset + 0x02), EntryType = (PascalFileKind)BigEndianBitConverter.ToInt16(catalogBlocks, offset + 0x04), - LastBytes = BigEndianBitConverter.ToInt16(catalogBlocks, offset + 0x16), - ModificationTime = BigEndianBitConverter.ToInt16(catalogBlocks, offset + 0x18) + LastBytes = BigEndianBitConverter.ToInt16(catalogBlocks, offset + 0x16), + ModificationTime = BigEndianBitConverter.ToInt16(catalogBlocks, offset + 0x18) }; Array.Copy(catalogBlocks, offset + 0x06, entry.Filename, 0, 16); diff --git a/DiscImageChef.Filesystems/UCSDPascal/UCSDPascal.cs b/DiscImageChef.Filesystems/UCSDPascal/UCSDPascal.cs index 50ccddcf8..df0b51ec3 100644 --- a/DiscImageChef.Filesystems/UCSDPascal/UCSDPascal.cs +++ b/DiscImageChef.Filesystems/UCSDPascal/UCSDPascal.cs @@ -76,7 +76,7 @@ namespace DiscImageChef.Filesystems.UCSDPascal } public IEnumerable<(string name, Type type, string description)> SupportedOptions => - new(string name, Type type, string description)[] { }; + new (string name, Type type, string description)[] { }; static Dictionary GetDefaultOptions() { diff --git a/DiscImageChef.Filesystems/UDF.cs b/DiscImageChef.Filesystems/UDF.cs index 9085f3989..0e8c0000d 100644 --- a/DiscImageChef.Filesystems/UDF.cs +++ b/DiscImageChef.Filesystems/UDF.cs @@ -51,9 +51,9 @@ namespace DiscImageChef.Filesystems }; public FileSystemType XmlFsType { get; private set; } - public Encoding Encoding { get; private set; } - public string Name => "Universal Disk Format"; - public Guid Id => new Guid("83976FEC-A91B-464B-9293-56C719461BAB"); + public Encoding Encoding { get; private set; } + public string Name => "Universal Disk Format"; + public Guid Id => new Guid("83976FEC-A91B-464B-9293-56C719461BAB"); public bool Identify(IMediaImage imagePlugin, Partition partition) { @@ -63,11 +63,11 @@ namespace DiscImageChef.Filesystems // UDF needs at least that if(imagePlugin.Info.SectorSize < 512) return false; - byte[] sector; + byte[] sector; AnchorVolumeDescriptorPointer anchor = new AnchorVolumeDescriptorPointer(); // All positions where anchor may reside - ulong[] positions = {256, 512, partition.End - 256, partition.End}; - bool anchorFound = false; + ulong[] positions = {256, 512, partition.End - 256, partition.End}; + bool anchorFound = false; foreach(ulong position in positions.Where(position => position + partition.Start < partition.End)) { @@ -84,8 +84,9 @@ namespace DiscImageChef.Filesystems 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.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}", @@ -100,8 +101,10 @@ namespace DiscImageChef.Filesystems DicConsole.DebugWriteLine("UDF Plugin", "anchor.reserveVolumeDescriptorSequenceExtent.location = {0}", anchor.reserveVolumeDescriptorSequenceExtent.location); - if(anchor.tag.tagIdentifier != TagIdentifier.AnchorVolumeDescriptorPointer || - anchor.tag.tagLocation != position || + if(anchor.tag.tagIdentifier != + TagIdentifier.AnchorVolumeDescriptorPointer || + anchor.tag.tagLocation != + position || anchor.mainVolumeDescriptorSequenceExtent.location + partition.Start >= partition.End) continue; anchorFound = true; @@ -116,8 +119,8 @@ namespace DiscImageChef.Filesystems { sector = imagePlugin.ReadSector(partition.Start + anchor.mainVolumeDescriptorSequenceExtent.location + count); - TagIdentifier tagId = (TagIdentifier)BitConverter.ToUInt16(sector, 0); - uint location = BitConverter.ToUInt32(sector, 0x0C); + TagIdentifier tagId = (TagIdentifier)BitConverter.ToUInt16(sector, 0); + uint location = BitConverter.ToUInt32(sector, 0x0C); if(location == partition.Start + anchor.mainVolumeDescriptorSequenceExtent.location + count) { @@ -125,8 +128,8 @@ namespace DiscImageChef.Filesystems if(tagId == TagIdentifier.LogicalVolumeDescriptor) { - LogicalVolumeDescriptor lvd = new LogicalVolumeDescriptor(); - IntPtr lvdPtr = Marshal.AllocHGlobal(Marshal.SizeOf(lvd)); + LogicalVolumeDescriptor lvd = new LogicalVolumeDescriptor(); + IntPtr lvdPtr = Marshal.AllocHGlobal(Marshal.SizeOf(lvd)); Marshal.Copy(sector, 0, lvdPtr, Marshal.SizeOf(lvd)); lvd = (LogicalVolumeDescriptor)Marshal.PtrToStructure(lvdPtr, typeof(LogicalVolumeDescriptor)); Marshal.FreeHGlobal(lvdPtr); @@ -143,7 +146,7 @@ namespace DiscImageChef.Filesystems } public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information, - Encoding encoding) + Encoding encoding) { // UDF is always UTF-8 Encoding = Encoding.UTF8; @@ -168,15 +171,17 @@ namespace DiscImageChef.Filesystems typeof(AnchorVolumeDescriptorPointer)); Marshal.FreeHGlobal(anchorPtr); - if(anchor.tag.tagIdentifier == TagIdentifier.AnchorVolumeDescriptorPointer && - anchor.tag.tagLocation == position && + if(anchor.tag.tagIdentifier == + TagIdentifier.AnchorVolumeDescriptorPointer && + anchor.tag.tagLocation == + position && anchor.mainVolumeDescriptorSequenceExtent.location + partition.Start < partition.End) break; } ulong count = 0; - PrimaryVolumeDescriptor pvd = new PrimaryVolumeDescriptor(); - LogicalVolumeDescriptor lvd = new LogicalVolumeDescriptor(); + PrimaryVolumeDescriptor pvd = new PrimaryVolumeDescriptor(); + LogicalVolumeDescriptor lvd = new LogicalVolumeDescriptor(); LogicalVolumeIntegrityDescriptor lvid = new LogicalVolumeIntegrityDescriptor(); LogicalVolumeIntegrityDescriptorImplementationUse lvidiu = new LogicalVolumeIntegrityDescriptorImplementationUse(); @@ -185,8 +190,8 @@ namespace DiscImageChef.Filesystems { sector = imagePlugin.ReadSector(partition.Start + anchor.mainVolumeDescriptorSequenceExtent.location + count); - TagIdentifier tagId = (TagIdentifier)BitConverter.ToUInt16(sector, 0); - uint location = BitConverter.ToUInt32(sector, 0x0C); + TagIdentifier tagId = (TagIdentifier)BitConverter.ToUInt16(sector, 0); + uint location = BitConverter.ToUInt32(sector, 0x0C); if(location == partition.Start + anchor.mainVolumeDescriptorSequenceExtent.location + count) { @@ -224,7 +229,7 @@ namespace DiscImageChef.Filesystems Marshal.FreeHGlobal(lvidPtr); if(lvid.tag.tagIdentifier == TagIdentifier.LogicalVolumeIntegrityDescriptor && - lvid.tag.tagLocation == lvd.integritySequenceExtent.location) + 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)); @@ -242,15 +247,15 @@ namespace DiscImageChef.Filesystems sbInformation.AppendFormat("Volume set identifier: {0}", StringHandlers.DecompressUnicode(pvd.volumeSetIdentifier)).AppendLine(); sbInformation - .AppendFormat("Volume name: {0}", StringHandlers.DecompressUnicode(lvd.logicalVolumeIdentifier)) - .AppendLine(); + .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 contains {0} partitions", lvid.numberOfPartitions).AppendLine(); sbInformation - .AppendFormat("Volume contains {0} files and {1} directories", lvidiu.files, lvidiu.directories) - .AppendLine(); + .AppendFormat("Volume contains {0} files and {1} directories", lvidiu.files, lvidiu.directories) + .AppendLine(); sbInformation.AppendFormat("Volume conforms to {0}", Encoding.GetString(lvd.domainIdentifier.identifier).TrimEnd('\u0000')) .AppendLine(); @@ -259,27 +264,29 @@ namespace DiscImageChef.Filesystems .AppendLine(); sbInformation.AppendFormat("Volume requires UDF version {0}.{1:X2} to be read", Convert.ToInt32($"{(lvidiu.minimumReadUDF & 0xFF00) >> 8}", 10), - Convert.ToInt32($"{lvidiu.minimumReadUDF & 0xFF}", 10)).AppendLine(); + Convert.ToInt32($"{lvidiu.minimumReadUDF & 0xFF}", 10)).AppendLine(); sbInformation.AppendFormat("Volume requires UDF version {0}.{1:X2} to be written to", Convert.ToInt32($"{(lvidiu.minimumWriteUDF & 0xFF00) >> 8}", 10), - Convert.ToInt32($"{lvidiu.minimumWriteUDF & 0xFF}", 10)).AppendLine(); + Convert.ToInt32($"{lvidiu.minimumWriteUDF & 0xFF}", 10)).AppendLine(); sbInformation.AppendFormat("Volume cannot be written by any UDF version higher than {0}.{1:X2}", Convert.ToInt32($"{(lvidiu.maximumWriteUDF & 0xFF00) >> 8}", 10), - Convert.ToInt32($"{lvidiu.maximumWriteUDF & 0xFF}", 10)).AppendLine(); + Convert.ToInt32($"{lvidiu.maximumWriteUDF & 0xFF}", 10)).AppendLine(); XmlFsType = new FileSystemType { Type = $"UDF v{Convert.ToInt32($"{(lvidiu.maximumWriteUDF & 0xFF00) >> 8}", 10)}.{Convert.ToInt32($"{lvidiu.maximumWriteUDF & 0xFF}", 10):X2}", - ApplicationIdentifier = Encoding.GetString(pvd.implementationIdentifier.identifier).TrimEnd('\u0000'), - ClusterSize = (int)lvd.logicalBlockSize, - ModificationDate = EcmaToDateTime(lvid.recordingDateTime), + ApplicationIdentifier = + Encoding.GetString(pvd.implementationIdentifier.identifier).TrimEnd('\u0000'), + ClusterSize = (int)lvd.logicalBlockSize, + ModificationDate = EcmaToDateTime(lvid.recordingDateTime), ModificationDateSpecified = true, - Files = lvidiu.files, - FilesSpecified = true, - VolumeName = StringHandlers.DecompressUnicode(lvd.logicalVolumeIdentifier), - VolumeSetIdentifier = StringHandlers.DecompressUnicode(pvd.volumeSetIdentifier), - SystemIdentifier = Encoding.GetString(pvd.implementationIdentifier.identifier).TrimEnd('\u0000') + Files = lvidiu.files, + FilesSpecified = true, + VolumeName = StringHandlers.DecompressUnicode(lvd.logicalVolumeIdentifier), + VolumeSetIdentifier = StringHandlers.DecompressUnicode(pvd.volumeSetIdentifier), + SystemIdentifier = + Encoding.GetString(pvd.implementationIdentifier.identifier).TrimEnd('\u0000') }; XmlFsType.Clusters = (long)((partition.End - partition.Start + 1) * imagePlugin.Info.SectorSize / (ulong)XmlFsType.ClusterSize); @@ -298,7 +305,7 @@ namespace DiscImageChef.Filesystems [Flags] enum EntityFlags : byte { - Dirty = 0x01, + Dirty = 0x01, Protected = 0x02 } @@ -312,52 +319,54 @@ namespace DiscImageChef.Filesystems /// /// Structure identifier /// - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 23)] public byte[] identifier; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 23)] + public byte[] identifier; /// /// Structure data /// - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] public byte[] identifierSuffix; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] + public byte[] identifierSuffix; } [StructLayout(LayoutKind.Sequential, Pack = 1)] struct Timestamp { public ushort typeAndZone; - public short year; - public byte month; - public byte day; - public byte hour; - public byte minute; - public byte second; - public byte centiseconds; - public byte hundredsMicroseconds; - public byte microseconds; + public short year; + public byte month; + public byte day; + public byte hour; + public byte minute; + public byte second; + public byte centiseconds; + public byte hundredsMicroseconds; + public byte microseconds; } enum TagIdentifier : ushort { - PrimaryVolumeDescriptor = 1, - AnchorVolumeDescriptorPointer = 2, - VolumeDescriptorPointer = 3, + PrimaryVolumeDescriptor = 1, + AnchorVolumeDescriptorPointer = 2, + VolumeDescriptorPointer = 3, ImplementationUseVolumeDescriptor = 4, - PartitionDescriptor = 5, - LogicalVolumeDescriptor = 6, - UnallocatedSpaceDescriptor = 7, - TerminatingDescriptor = 8, - LogicalVolumeIntegrityDescriptor = 9 + PartitionDescriptor = 5, + LogicalVolumeDescriptor = 6, + UnallocatedSpaceDescriptor = 7, + TerminatingDescriptor = 8, + LogicalVolumeIntegrityDescriptor = 9 } [StructLayout(LayoutKind.Sequential, Pack = 1)] struct DescriptorTag { public TagIdentifier tagIdentifier; - public ushort descriptorVersion; - public byte tagChecksum; - public byte reserved; - public ushort tagSerialNumber; - public ushort descriptorCrc; - public ushort descriptorCrcLength; - public uint tagLocation; + public ushort descriptorVersion; + public byte tagChecksum; + public byte reserved; + public ushort tagSerialNumber; + public ushort descriptorCrc; + public ushort descriptorCrcLength; + public uint tagLocation; } [StructLayout(LayoutKind.Sequential, Pack = 1)] @@ -371,70 +380,80 @@ 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)] struct AnchorVolumeDescriptorPointer { - public DescriptorTag tag; + 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)] struct PrimaryVolumeDescriptor { public DescriptorTag tag; - public uint volumeDescriptorSequenceNumber; - public uint primaryVolumeDescriptorNumber; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] public byte[] volumeIdentifier; + public uint volumeDescriptorSequenceNumber; + public uint primaryVolumeDescriptorNumber; + [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; + public uint characterSetList; + public uint maximumCharacterSetList; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] + public byte[] volumeSetIdentifier; public CharacterSpecification descriptorCharacterSet; public CharacterSpecification explanatoryCharacterSet; - public ExtentDescriptor volumeAbstract; - public ExtentDescriptor volumeCopyright; - public EntityIdentifier applicationIdentifier; - public Timestamp recordingDateTime; - public EntityIdentifier implementationIdentifier; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 64)] public byte[] implementationUse; - public uint predecessorVolumeDescriptorSequenceLocation; + public ExtentDescriptor volumeAbstract; + public ExtentDescriptor volumeCopyright; + public EntityIdentifier applicationIdentifier; + public Timestamp recordingDateTime; + public EntityIdentifier implementationIdentifier; + [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)] struct LogicalVolumeDescriptor { - public DescriptorTag tag; - public uint volumeDescriptorSequenceNumber; + public DescriptorTag tag; + public uint volumeDescriptorSequenceNumber; public CharacterSpecification descriptorCharacterSet; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] public byte[] logicalVolumeIdentifier; - public uint logicalBlockSize; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] + public byte[] logicalVolumeIdentifier; + public uint logicalBlockSize; public EntityIdentifier domainIdentifier; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] public byte[] logicalVolumeContentsUse; - public uint mapTableLength; - public uint numberOfPartitionMaps; + [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; } [StructLayout(LayoutKind.Sequential, Pack = 1)] struct LogicalVolumeIntegrityDescriptor { - public DescriptorTag tag; - public Timestamp recordingDateTime; - public uint integrityType; + public DescriptorTag tag; + 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; @@ -446,11 +465,11 @@ namespace DiscImageChef.Filesystems struct LogicalVolumeIntegrityDescriptorImplementationUse { public EntityIdentifier implementationId; - public uint files; - public uint directories; - public ushort minimumReadUDF; - public ushort minimumWriteUDF; - public ushort maximumWriteUDF; + public uint files; + public uint directories; + public ushort minimumReadUDF; + public ushort minimumWriteUDF; + public ushort maximumWriteUDF; } } } \ No newline at end of file diff --git a/DiscImageChef.Filesystems/UNICOS.cs b/DiscImageChef.Filesystems/UNICOS.cs index 8fee2cee7..f41658903 100644 --- a/DiscImageChef.Filesystems/UNICOS.cs +++ b/DiscImageChef.Filesystems/UNICOS.cs @@ -53,13 +53,13 @@ namespace DiscImageChef.Filesystems const int NC1_MAXPART = 64; const int NC1_MAXIREG = 4; - const ulong UNICOS_MAGIC = 0x6e6331667331636e; + const ulong UNICOS_MAGIC = 0x6e6331667331636e; const ulong UNICOS_SECURE = 0xcd076d1771d670cd; public FileSystemType XmlFsType { get; private set; } - public Encoding Encoding { get; private set; } - public string Name => "UNICOS Filesystem Plugin"; - public Guid Id => new Guid("61712F04-066C-44D5-A2A0-1E44C66B33F0"); + public Encoding Encoding { get; private set; } + public string Name => "UNICOS Filesystem Plugin"; + public Guid Id => new Guid("61712F04-066C-44D5-A2A0-1E44C66B33F0"); public bool Identify(IMediaImage imagePlugin, Partition partition) { @@ -82,9 +82,9 @@ namespace DiscImageChef.Filesystems } public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information, - Encoding encoding) + Encoding encoding) { - Encoding = encoding ?? Encoding.GetEncoding("iso-8859-15"); + Encoding = encoding ?? Encoding.GetEncoding("iso-8859-15"); information = ""; if(imagePlugin.Info.SectorSize < 512) return; @@ -119,11 +119,11 @@ namespace DiscImageChef.Filesystems XmlFsType = new FileSystemType { - Type = "UNICOS filesystem", - ClusterSize = 4096, - Clusters = unicosSb.s_fsize, - VolumeName = StringHandlers.CToString(unicosSb.s_fname, Encoding), - ModificationDate = DateHandlers.UnixToDateTime(unicosSb.s_time), + Type = "UNICOS filesystem", + ClusterSize = 4096, + Clusters = unicosSb.s_fsize, + VolumeName = StringHandlers.CToString(unicosSb.s_fname, Encoding), + ModificationDate = DateHandlers.UnixToDateTime(unicosSb.s_time), ModificationDateSpecified = true }; XmlFsType.Dirty |= unicosSb.s_error > 0; @@ -134,8 +134,8 @@ namespace DiscImageChef.Filesystems 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_nblk; /* number of blocks */ + public uint i_sblk; /* start block number */ } [StructLayout(LayoutKind.Sequential, Pack = 1)] @@ -155,33 +155,35 @@ namespace DiscImageChef.Filesystems 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 */ + [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 = NC1_MAXPART)] public nc1fdev_sb[] s_part; /* Partition descriptors */ - public long s_iounit; /* Physical block size */ - public long s_numiresblks; /* number of inode reservation blocks */ + 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 */ @@ -191,7 +193,7 @@ namespace DiscImageChef.Filesystems 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 */ - public long s_secnblks; /* number of 512 wds blocks in secondary */ + 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 */ @@ -200,7 +202,7 @@ namespace DiscImageChef.Filesystems /* (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_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 */ @@ -208,7 +210,8 @@ namespace DiscImageChef.Filesystems /* 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 */ + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 91)] + public long[] s_fill; /* reserved */ } } } \ No newline at end of file diff --git a/DiscImageChef.Filesystems/UNIXBFS.cs b/DiscImageChef.Filesystems/UNIXBFS.cs index b63636302..8b7d954e4 100644 --- a/DiscImageChef.Filesystems/UNIXBFS.cs +++ b/DiscImageChef.Filesystems/UNIXBFS.cs @@ -45,9 +45,9 @@ namespace DiscImageChef.Filesystems const uint BFS_MAGIC = 0x1BADFACE; public FileSystemType XmlFsType { get; private set; } - public Encoding Encoding { get; private set; } - public string Name => "UNIX Boot filesystem"; - public Guid Id => new Guid("1E6E0DA6-F7E4-494C-80C6-CB5929E96155"); + public Encoding Encoding { get; private set; } + public string Name => "UNIX Boot filesystem"; + public Guid Id => new Guid("1E6E0DA6-F7E4-494C-80C6-CB5929E96155"); public bool Identify(IMediaImage imagePlugin, Partition partition) { @@ -59,24 +59,24 @@ namespace DiscImageChef.Filesystems } public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information, - Encoding encoding) + Encoding encoding) { - Encoding = encoding ?? Encoding.GetEncoding("iso-8859-15"); + Encoding = encoding ?? Encoding.GetEncoding("iso-8859-15"); information = ""; - StringBuilder sb = new StringBuilder(); - byte[] bfsSbSector = imagePlugin.ReadSector(0 + partition.Start); - byte[] sbStrings = new byte[6]; + StringBuilder sb = new StringBuilder(); + byte[] bfsSbSector = imagePlugin.ReadSector(0 + partition.Start); + byte[] sbStrings = new byte[6]; BFSSuperBlock bfsSb = new BFSSuperBlock { s_magic = BitConverter.ToUInt32(bfsSbSector, 0x00), s_start = BitConverter.ToUInt32(bfsSbSector, 0x04), - s_end = BitConverter.ToUInt32(bfsSbSector, 0x08), - s_from = BitConverter.ToUInt32(bfsSbSector, 0x0C), - s_to = BitConverter.ToUInt32(bfsSbSector, 0x10), + s_end = BitConverter.ToUInt32(bfsSbSector, 0x08), + s_from = BitConverter.ToUInt32(bfsSbSector, 0x0C), + s_to = BitConverter.ToUInt32(bfsSbSector, 0x10), s_bfrom = BitConverter.ToInt32(bfsSbSector, 0x14), - s_bto = BitConverter.ToInt32(bfsSbSector, 0x18) + s_bto = BitConverter.ToInt32(bfsSbSector, 0x18) }; Array.Copy(bfsSbSector, 0x1C, sbStrings, 0, 6); @@ -86,13 +86,13 @@ namespace DiscImageChef.Filesystems DicConsole.DebugWriteLine("BFS plugin", "bfs_sb.s_magic: 0x{0:X8}", bfsSb.s_magic); DicConsole.DebugWriteLine("BFS plugin", "bfs_sb.s_start: 0x{0:X8}", bfsSb.s_start); - DicConsole.DebugWriteLine("BFS plugin", "bfs_sb.s_end: 0x{0:X8}", bfsSb.s_end); - DicConsole.DebugWriteLine("BFS plugin", "bfs_sb.s_from: 0x{0:X8}", bfsSb.s_from); - DicConsole.DebugWriteLine("BFS plugin", "bfs_sb.s_to: 0x{0:X8}", bfsSb.s_to); + DicConsole.DebugWriteLine("BFS plugin", "bfs_sb.s_end: 0x{0:X8}", bfsSb.s_end); + DicConsole.DebugWriteLine("BFS plugin", "bfs_sb.s_from: 0x{0:X8}", bfsSb.s_from); + DicConsole.DebugWriteLine("BFS plugin", "bfs_sb.s_to: 0x{0:X8}", bfsSb.s_to); DicConsole.DebugWriteLine("BFS plugin", "bfs_sb.s_bfrom: 0x{0:X8}", bfsSb.s_bfrom); - DicConsole.DebugWriteLine("BFS plugin", "bfs_sb.s_bto: 0x{0:X8}", bfsSb.s_bto); - DicConsole.DebugWriteLine("BFS plugin", "bfs_sb.s_fsname: 0x{0}", bfsSb.s_fsname); - DicConsole.DebugWriteLine("BFS plugin", "bfs_sb.s_volume: 0x{0}", bfsSb.s_volume); + DicConsole.DebugWriteLine("BFS plugin", "bfs_sb.s_bto: 0x{0:X8}", bfsSb.s_bto); + DicConsole.DebugWriteLine("BFS plugin", "bfs_sb.s_fsname: 0x{0}", bfsSb.s_fsname); + DicConsole.DebugWriteLine("BFS plugin", "bfs_sb.s_volume: 0x{0}", bfsSb.s_volume); sb.AppendLine("UNIX Boot filesystem"); sb.AppendFormat("Volume goes from byte {0} to byte {1}, for {2} bytes", bfsSb.s_start, bfsSb.s_end, @@ -102,10 +102,10 @@ namespace DiscImageChef.Filesystems XmlFsType = new FileSystemType { - Type = "BFS", - VolumeName = bfsSb.s_volume, + Type = "BFS", + VolumeName = bfsSb.s_volume, ClusterSize = (int)imagePlugin.Info.SectorSize, - Clusters = (long)(partition.End - partition.Start + 1) + Clusters = (long)(partition.End - partition.Start + 1) }; information = sb.ToString(); diff --git a/DiscImageChef.Filesystems/VMfs.cs b/DiscImageChef.Filesystems/VMfs.cs index d89e5f795..2fb8f2e41 100644 --- a/DiscImageChef.Filesystems/VMfs.cs +++ b/DiscImageChef.Filesystems/VMfs.cs @@ -48,9 +48,9 @@ namespace DiscImageChef.Filesystems const uint VMFS_BASE = 0x00100000; public FileSystemType XmlFsType { get; private set; } - public Encoding Encoding { get; private set; } - public string Name => "VMware filesystem"; - public Guid Id => new Guid("EE52BDB8-B49C-4122-A3DA-AD21CBE79843"); + public Encoding Encoding { get; private set; } + public string Name => "VMware filesystem"; + public Guid Id => new Guid("EE52BDB8-B49C-4122-A3DA-AD21CBE79843"); public bool Identify(IMediaImage imagePlugin, Partition partition) { @@ -68,14 +68,14 @@ namespace DiscImageChef.Filesystems } public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information, - Encoding encoding) + Encoding encoding) { Encoding = encoding ?? Encoding.UTF8; - ulong vmfsSuperOff = VMFS_BASE / imagePlugin.Info.SectorSize; - byte[] sector = imagePlugin.ReadSector(partition.Start + vmfsSuperOff); + ulong vmfsSuperOff = VMFS_BASE / imagePlugin.Info.SectorSize; + byte[] sector = imagePlugin.ReadSector(partition.Start + vmfsSuperOff); - VolumeInfo volInfo = new VolumeInfo(); - IntPtr volInfoPtr = Marshal.AllocHGlobal(Marshal.SizeOf(volInfo)); + VolumeInfo volInfo = new VolumeInfo(); + IntPtr volInfoPtr = Marshal.AllocHGlobal(Marshal.SizeOf(volInfo)); Marshal.Copy(sector, 0, volInfoPtr, Marshal.SizeOf(volInfo)); volInfo = (VolumeInfo)Marshal.PtrToStructure(volInfoPtr, typeof(VolumeInfo)); Marshal.FreeHGlobal(volInfoPtr); @@ -84,9 +84,9 @@ namespace DiscImageChef.Filesystems sbInformation.AppendLine("VMware file system"); - uint ctimeSecs = (uint)(volInfo.ctime / 1000000); + uint ctimeSecs = (uint)(volInfo.ctime / 1000000); uint ctimeNanoSecs = (uint)(volInfo.ctime % 1000000); - uint mtimeSecs = (uint)(volInfo.mtime / 1000000); + uint mtimeSecs = (uint)(volInfo.mtime / 1000000); uint mtimeNanoSecs = (uint)(volInfo.mtime % 1000000); sbInformation.AppendFormat("Volume version {0}", volInfo.version).AppendLine(); @@ -95,8 +95,8 @@ namespace DiscImageChef.Filesystems 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(); + .AppendFormat("Volume created on {0}", DateHandlers.UnixUnsignedToDateTime(ctimeSecs, ctimeNanoSecs)) + .AppendLine(); sbInformation.AppendFormat("Volume last modified on {0}", DateHandlers.UnixUnsignedToDateTime(mtimeSecs, mtimeNanoSecs)).AppendLine(); @@ -104,14 +104,14 @@ namespace DiscImageChef.Filesystems XmlFsType = new FileSystemType { - Type = "VMware file system", - CreationDate = DateHandlers.UnixUnsignedToDateTime(ctimeSecs, ctimeNanoSecs), - CreationDateSpecified = true, - ModificationDate = DateHandlers.UnixUnsignedToDateTime(mtimeSecs, mtimeNanoSecs), + Type = "VMware file system", + CreationDate = DateHandlers.UnixUnsignedToDateTime(ctimeSecs, ctimeNanoSecs), + CreationDateSpecified = true, + ModificationDate = DateHandlers.UnixUnsignedToDateTime(mtimeSecs, mtimeNanoSecs), ModificationDateSpecified = true, - Clusters = volInfo.size * 256 / imagePlugin.Info.SectorSize, - ClusterSize = (int)imagePlugin.Info.SectorSize, - VolumeSerial = volInfo.uuid.ToString() + Clusters = volInfo.size * 256 / imagePlugin.Info.SectorSize, + ClusterSize = (int)imagePlugin.Info.SectorSize, + VolumeSerial = volInfo.uuid.ToString() }; } @@ -127,14 +127,19 @@ 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; - public Guid uuid; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 31)] + public byte[] unknown4; + public Guid uuid; public ulong ctime; public ulong mtime; } diff --git a/DiscImageChef.Filesystems/VxFS.cs b/DiscImageChef.Filesystems/VxFS.cs index 501197d69..41e38e6ca 100644 --- a/DiscImageChef.Filesystems/VxFS.cs +++ b/DiscImageChef.Filesystems/VxFS.cs @@ -48,9 +48,9 @@ namespace DiscImageChef.Filesystems const uint VXFS_BASE = 0x400; public FileSystemType XmlFsType { get; private set; } - public Encoding Encoding { get; private set; } - public string Name => "Veritas filesystem"; - public Guid Id => new Guid("EC372605-7687-453C-8BEA-7E0DFF79CB03"); + public Encoding Encoding { get; private set; } + public string Name => "Veritas filesystem"; + public Guid Id => new Guid("EC372605-7687-453C-8BEA-7E0DFF79CB03"); public bool Identify(IMediaImage imagePlugin, Partition partition) { @@ -66,14 +66,14 @@ namespace DiscImageChef.Filesystems } public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information, - Encoding encoding) + Encoding encoding) { Encoding = encoding ?? Encoding.UTF8; - ulong vmfsSuperOff = VXFS_BASE / imagePlugin.Info.SectorSize; - byte[] sector = imagePlugin.ReadSector(partition.Start + vmfsSuperOff); + ulong vmfsSuperOff = VXFS_BASE / imagePlugin.Info.SectorSize; + byte[] sector = imagePlugin.ReadSector(partition.Start + vmfsSuperOff); - VxSuperBlock vxSb = new VxSuperBlock(); - IntPtr vxSbPtr = Marshal.AllocHGlobal(Marshal.SizeOf(vxSb)); + VxSuperBlock vxSb = new VxSuperBlock(); + IntPtr vxSbPtr = Marshal.AllocHGlobal(Marshal.SizeOf(vxSb)); Marshal.Copy(sector, 0, vxSbPtr, Marshal.SizeOf(vxSb)); vxSb = (VxSuperBlock)Marshal.PtrToStructure(vxSbPtr, typeof(VxSuperBlock)); Marshal.FreeHGlobal(vxSbPtr); @@ -100,16 +100,16 @@ namespace DiscImageChef.Filesystems XmlFsType = new FileSystemType { - Type = "Veritas file system", - CreationDate = DateHandlers.UnixUnsignedToDateTime(vxSb.vs_ctime, vxSb.vs_cutime), - CreationDateSpecified = true, - ModificationDate = DateHandlers.UnixUnsignedToDateTime(vxSb.vs_wtime, vxSb.vs_wutime), + Type = "Veritas file system", + CreationDate = DateHandlers.UnixUnsignedToDateTime(vxSb.vs_ctime, vxSb.vs_cutime), + CreationDateSpecified = true, + ModificationDate = DateHandlers.UnixUnsignedToDateTime(vxSb.vs_wtime, vxSb.vs_wutime), ModificationDateSpecified = true, - Clusters = vxSb.vs_size, - ClusterSize = vxSb.vs_bsize, - Dirty = vxSb.vs_clean != 0, - FreeClusters = vxSb.vs_free, - FreeClustersSpecified = true + Clusters = vxSb.vs_size, + ClusterSize = vxSb.vs_bsize, + Dirty = vxSb.vs_clean != 0, + FreeClusters = vxSb.vs_free, + FreeClustersSpecified = true }; } @@ -217,7 +217,8 @@ namespace DiscImageChef.Filesystems /// number of free inodes public int vs_ifree; /// number of free extents by size - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] public int[] vs_efree; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] + public int[] vs_efree; /// flags ?!? public int vs_flags; /// filesystem has been changed @@ -233,15 +234,18 @@ namespace DiscImageChef.Filesystems /// last time written - usec public uint vs_wutime; /// FS name - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)] public byte[] vs_fname; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)] + public byte[] vs_fname; /// FS pack name - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)] public byte[] vs_fpack; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)] + public byte[] vs_fpack; /// log format version public int vs_logversion; /// unused public int __unused5; /// OLT extent and replica - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)] public int[] vs_oltext; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)] + public int[] vs_oltext; /// OLT extent size public int vs_oltsize; /// size of inode map diff --git a/DiscImageChef.Filesystems/XFS.cs b/DiscImageChef.Filesystems/XFS.cs index 4ef005fed..fc6d5e09d 100644 --- a/DiscImageChef.Filesystems/XFS.cs +++ b/DiscImageChef.Filesystems/XFS.cs @@ -45,9 +45,9 @@ namespace DiscImageChef.Filesystems const uint XFS_MAGIC = 0x58465342; public FileSystemType XmlFsType { get; private set; } - public Encoding Encoding { get; private set; } - public string Name => "XFS Filesystem Plugin"; - public Guid Id => new Guid("1D8CD8B8-27E6-410F-9973-D16409225FBA"); + public Encoding Encoding { get; private set; } + public string Name => "XFS Filesystem Plugin"; + public Guid Id => new Guid("1D8CD8B8-27E6-410F-9973-D16409225FBA"); public bool Identify(IMediaImage imagePlugin, Partition partition) { @@ -81,8 +81,8 @@ namespace DiscImageChef.Filesystems else foreach(int i in new[] {0, 1, 2}) { - ulong location = (ulong)i; - XFS_Superblock xfsSb = new XFS_Superblock(); + ulong location = (ulong)i; + XFS_Superblock xfsSb = new XFS_Superblock(); uint sbSize = (uint)(Marshal.SizeOf(xfsSb) / imagePlugin.Info.SectorSize); if(Marshal.SizeOf(xfsSb) % imagePlugin.Info.SectorSize != 0) sbSize++; @@ -102,9 +102,9 @@ namespace DiscImageChef.Filesystems } public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information, - Encoding encoding) + Encoding encoding) { - Encoding = encoding ?? Encoding.GetEncoding("iso-8859-15"); + Encoding = encoding ?? Encoding.GetEncoding("iso-8859-15"); information = ""; if(imagePlugin.Info.SectorSize < 512) return; @@ -137,7 +137,7 @@ namespace DiscImageChef.Filesystems foreach(int i in new[] {0, 1, 2}) { ulong location = (ulong)i; - uint sbSize = (uint)(Marshal.SizeOf(xfsSb) / imagePlugin.Info.SectorSize); + uint sbSize = (uint)(Marshal.SizeOf(xfsSb) / imagePlugin.Info.SectorSize); if(Marshal.SizeOf(xfsSb) % imagePlugin.Info.SectorSize != 0) sbSize++; byte[] sector = imagePlugin.ReadSectors(partition.Start + location, sbSize); @@ -172,78 +172,79 @@ namespace DiscImageChef.Filesystems XmlFsType = new FileSystemType { - Type = "XFS filesystem", - ClusterSize = (int)xfsSb.blocksize, - Clusters = (long)xfsSb.dblocks, - FreeClusters = (long)xfsSb.fdblocks, + Type = "XFS filesystem", + ClusterSize = (int)xfsSb.blocksize, + Clusters = (long)xfsSb.dblocks, + FreeClusters = (long)xfsSb.fdblocks, FreeClustersSpecified = true, - Files = (long)(xfsSb.icount - xfsSb.ifree), - FilesSpecified = true, - Dirty = xfsSb.inprogress > 0, - VolumeName = StringHandlers.CToString(xfsSb.fname, Encoding), - VolumeSerial = xfsSb.uuid.ToString() + Files = (long)(xfsSb.icount - xfsSb.ifree), + FilesSpecified = true, + Dirty = xfsSb.inprogress > 0, + VolumeName = StringHandlers.CToString(xfsSb.fname, Encoding), + VolumeSerial = xfsSb.uuid.ToString() }; } [StructLayout(LayoutKind.Sequential, Pack = 1)] struct XFS_Superblock { - public uint magicnum; - public uint blocksize; - public ulong dblocks; - public ulong rblocks; - public ulong rextents; - public Guid uuid; - public ulong logstat; - public ulong rootino; - public ulong rbmino; - public ulong rsumino; - public uint rextsize; - public uint agblocks; - public uint agcount; - public uint rbmblocks; - public uint logblocks; + public uint magicnum; + public uint blocksize; + public ulong dblocks; + public ulong rblocks; + public ulong rextents; + public Guid uuid; + public ulong logstat; + public ulong rootino; + public ulong rbmino; + public ulong rsumino; + public uint rextsize; + public uint agblocks; + public uint agcount; + public uint rbmblocks; + public uint logblocks; public ushort version; public ushort sectsize; public ushort inodesize; public ushort inopblock; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 12)] public byte[] fname; - public byte blocklog; - public byte sectlog; - public byte inodelog; - public byte inopblog; - public byte agblklog; - public byte rextslog; - public byte inprogress; - public byte imax_pct; - public ulong icount; - public ulong ifree; - public ulong fdblocks; - public ulong frextents; - public ulong uquotino; - public ulong gquotino; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 12)] + public byte[] fname; + public byte blocklog; + public byte sectlog; + public byte inodelog; + public byte inopblog; + public byte agblklog; + public byte rextslog; + public byte inprogress; + public byte imax_pct; + public ulong icount; + public ulong ifree; + public ulong fdblocks; + public ulong frextents; + public ulong uquotino; + public ulong gquotino; public ushort qflags; - public byte flags; - public byte shared_vn; - public ulong inoalignmt; - public ulong unit; - public ulong width; - public byte dirblklog; - public byte logsectlog; + public byte flags; + public byte shared_vn; + public ulong inoalignmt; + public ulong unit; + public ulong width; + public byte dirblklog; + public byte logsectlog; public ushort logsectsize; - public uint logsunit; - public uint features2; - public uint bad_features2; - public uint features_compat; - public uint features_ro_compat; - public uint features_incompat; - public uint features_log_incompat; + public uint logsunit; + public uint features2; + public uint bad_features2; + public uint features_compat; + public uint features_ro_compat; + public uint features_incompat; + public uint features_log_incompat; // This field is little-endian while rest of superblock is big-endian - public uint crc; - public uint spino_align; + public uint crc; + public uint spino_align; public ulong pquotino; public ulong lsn; - public Guid meta_uuid; + public Guid meta_uuid; } } } \ No newline at end of file diff --git a/DiscImageChef.Filesystems/Xia.cs b/DiscImageChef.Filesystems/Xia.cs index 2e9e4360b..fca5838c5 100644 --- a/DiscImageChef.Filesystems/Xia.cs +++ b/DiscImageChef.Filesystems/Xia.cs @@ -42,28 +42,28 @@ namespace DiscImageChef.Filesystems // Information from the Linux kernel public class Xia : IFilesystem { - const uint XIAFS_SUPER_MAGIC = 0x012FD16D; - const uint XIAFS_ROOT_INO = 1; - const uint XIAFS_BAD_INO = 2; - const int XIAFS_MAX_LINK = 64000; - const int XIAFS_DIR_SIZE = 12; - const int XIAFS_NUM_BLOCK_POINTERS = 10; - const int XIAFS_NAME_LEN = 248; + const uint XIAFS_SUPER_MAGIC = 0x012FD16D; + const uint XIAFS_ROOT_INO = 1; + const uint XIAFS_BAD_INO = 2; + const int XIAFS_MAX_LINK = 64000; + const int XIAFS_DIR_SIZE = 12; + const int XIAFS_NUM_BLOCK_POINTERS = 10; + const int XIAFS_NAME_LEN = 248; public FileSystemType XmlFsType { get; private set; } - public Encoding Encoding { get; private set; } - public string Name => "Xia filesystem"; - public Guid Id => new Guid("169E1DE5-24F2-4EF6-A04D-A4B2CA66DE9D"); + public Encoding Encoding { get; private set; } + public string Name => "Xia filesystem"; + public Guid Id => new Guid("169E1DE5-24F2-4EF6-A04D-A4B2CA66DE9D"); public bool Identify(IMediaImage imagePlugin, Partition partition) { - int sbSizeInBytes = Marshal.SizeOf(typeof(XiaSuperBlock)); + int sbSizeInBytes = Marshal.SizeOf(typeof(XiaSuperBlock)); uint sbSizeInSectors = (uint)(sbSizeInBytes / imagePlugin.Info.SectorSize); if(sbSizeInBytes % imagePlugin.Info.SectorSize > 0) sbSizeInSectors++; - if(sbSizeInSectors + partition.Start >= partition.End) return false; + if(sbSizeInSectors + partition.Start >= partition.End) return false; byte[] sbSector = imagePlugin.ReadSectors(partition.Start, sbSizeInSectors); - IntPtr sbPtr = Marshal.AllocHGlobal(sbSizeInBytes); + IntPtr sbPtr = Marshal.AllocHGlobal(sbSizeInBytes); Marshal.Copy(sbSector, 0, sbPtr, sbSizeInBytes); XiaSuperBlock supblk = (XiaSuperBlock)Marshal.PtrToStructure(sbPtr, typeof(XiaSuperBlock)); Marshal.FreeHGlobal(sbPtr); @@ -72,19 +72,19 @@ namespace DiscImageChef.Filesystems } public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information, - Encoding encoding) + Encoding encoding) { - Encoding = encoding ?? Encoding.GetEncoding("iso-8859-15"); + Encoding = encoding ?? Encoding.GetEncoding("iso-8859-15"); information = ""; StringBuilder sb = new StringBuilder(); - int sbSizeInBytes = Marshal.SizeOf(typeof(XiaSuperBlock)); + int sbSizeInBytes = Marshal.SizeOf(typeof(XiaSuperBlock)); uint sbSizeInSectors = (uint)(sbSizeInBytes / imagePlugin.Info.SectorSize); if(sbSizeInBytes % imagePlugin.Info.SectorSize > 0) sbSizeInSectors++; byte[] sbSector = imagePlugin.ReadSectors(partition.Start, sbSizeInSectors); - IntPtr sbPtr = Marshal.AllocHGlobal(sbSizeInBytes); + IntPtr sbPtr = Marshal.AllocHGlobal(sbSizeInBytes); Marshal.Copy(sbSector, 0, sbPtr, sbSizeInBytes); XiaSuperBlock supblk = (XiaSuperBlock)Marshal.PtrToStructure(sbPtr, typeof(XiaSuperBlock)); Marshal.FreeHGlobal(sbPtr); @@ -108,10 +108,10 @@ namespace DiscImageChef.Filesystems XmlFsType = new FileSystemType { - Bootable = !ArrayHelpers.ArrayIsNullOrEmpty(supblk.s_boot_segment), - Clusters = supblk.s_nzones, + Bootable = !ArrayHelpers.ArrayIsNullOrEmpty(supblk.s_boot_segment), + Clusters = supblk.s_nzones, ClusterSize = (int)supblk.s_zone_size, - Type = "Xia filesystem" + Type = "Xia filesystem" }; information = sb.ToString(); @@ -124,7 +124,8 @@ namespace DiscImageChef.Filesystems struct XiaSuperBlock { /// 1st sector reserved for boot - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 512)] public byte[] s_boot_segment; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 512)] + public byte[] s_boot_segment; /// the name says it public uint s_zone_size; /// volume size, zone aligned @@ -165,10 +166,11 @@ namespace DiscImageChef.Filesystems [StructLayout(LayoutKind.Sequential, Pack = 1)] struct XiaDirect { - public uint d_ino; + public uint d_ino; public ushort d_rec_len; - public byte d_name_len; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = XIAFS_NAME_LEN + 1)] public byte[] d_name; + public byte d_name_len; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = XIAFS_NAME_LEN + 1)] + public byte[] d_name; } /// @@ -181,11 +183,12 @@ namespace DiscImageChef.Filesystems public ushort i_nlinks; public ushort i_uid; public ushort i_gid; - public uint i_size; - public uint i_ctime; - public uint i_atime; - public uint i_mtime; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = XIAFS_NUM_BLOCK_POINTERS)] public uint[] i_zone; + public uint i_size; + public uint i_ctime; + public uint i_atime; + public uint i_mtime; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = XIAFS_NUM_BLOCK_POINTERS)] + public uint[] i_zone; } } } \ No newline at end of file diff --git a/DiscImageChef.Filesystems/ZFS.cs b/DiscImageChef.Filesystems/ZFS.cs index 3dcba1362..0459dab8f 100644 --- a/DiscImageChef.Filesystems/ZFS.cs +++ b/DiscImageChef.Filesystems/ZFS.cs @@ -68,65 +68,65 @@ namespace DiscImageChef.Filesystems // These parameters define how the nvlist is stored const byte NVS_LITTLE_ENDIAN = 1; - const byte NVS_BIG_ENDIAN = 0; - const byte NVS_NATIVE = 0; - const byte NVS_XDR = 1; + const byte NVS_BIG_ENDIAN = 0; + const byte NVS_NATIVE = 0; + const byte NVS_XDR = 1; const ulong UBERBLOCK_MAGIC = 0x00BAB10C; const uint ZFS_MAGIC = 0x58465342; public FileSystemType XmlFsType { get; private set; } - public Encoding Encoding { get; private set; } - public string Name => "ZFS Filesystem Plugin"; - public Guid Id => new Guid("0750014F-A714-4692-A369-E23F6EC3659C"); + public Encoding Encoding { get; private set; } + public string Name => "ZFS Filesystem Plugin"; + public Guid Id => new Guid("0750014F-A714-4692-A369-E23F6EC3659C"); public bool Identify(IMediaImage imagePlugin, Partition partition) { if(imagePlugin.Info.SectorSize < 512) return false; byte[] sector; - ulong magic; + ulong magic; if(partition.Start + 31 < partition.End) { sector = imagePlugin.ReadSector(partition.Start + 31); - magic = BitConverter.ToUInt64(sector, 0x1D8); + magic = BitConverter.ToUInt64(sector, 0x1D8); if(magic == ZEC_MAGIC || magic == ZEC_CIGAM) return true; } if(partition.Start + 16 >= partition.End) return false; sector = imagePlugin.ReadSector(partition.Start + 16); - magic = BitConverter.ToUInt64(sector, 0x1D8); + magic = BitConverter.ToUInt64(sector, 0x1D8); return magic == ZEC_MAGIC || magic == ZEC_CIGAM; } public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information, - Encoding encoding) + Encoding encoding) { // ZFS is always UTF-8 - Encoding = Encoding.UTF8; + Encoding = Encoding.UTF8; information = ""; if(imagePlugin.Info.SectorSize < 512) return; byte[] sector; - ulong magic; + ulong magic; ulong nvlistOff = 32; - uint nvlistLen = 114688 / imagePlugin.Info.SectorSize; + uint nvlistLen = 114688 / imagePlugin.Info.SectorSize; if(partition.Start + 31 < partition.End) { sector = imagePlugin.ReadSector(partition.Start + 31); - magic = BitConverter.ToUInt64(sector, 0x1D8); + magic = BitConverter.ToUInt64(sector, 0x1D8); 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); + magic = BitConverter.ToUInt64(sector, 0x1D8); if(magic == ZEC_MAGIC || magic == ZEC_CIGAM) nvlistOff = 17; } @@ -143,7 +143,7 @@ namespace DiscImageChef.Filesystems XmlFsType = new FileSystemType {Type = "ZFS filesystem"}; if(decodedNvList.TryGetValue("name", out NVS_Item tmpObj)) XmlFsType.VolumeName = (string)tmpObj.value; - if(decodedNvList.TryGetValue("guid", out tmpObj)) XmlFsType.VolumeSerial = $"{(ulong)tmpObj.value}"; + if(decodedNvList.TryGetValue("guid", out tmpObj)) XmlFsType.VolumeSerial = $"{(ulong)tmpObj.value}"; if(decodedNvList.TryGetValue("pool_guid", out tmpObj)) XmlFsType.VolumeSetIdentifier = $"{(ulong)tmpObj.value}"; } @@ -152,7 +152,7 @@ namespace DiscImageChef.Filesystems { byte[] tmp = new byte[nvlist.Length - 4]; Array.Copy(nvlist, 4, tmp, 0, nvlist.Length - 4); - bool xdr = nvlist[0] == 1; + bool xdr = nvlist[0] == 1; bool littleEndian = nvlist[1] == 1; return DecodeNvList(tmp, out decodedNvList, xdr, littleEndian); @@ -160,7 +160,7 @@ namespace DiscImageChef.Filesystems // TODO: Decode native nvlist static bool DecodeNvList(byte[] nvlist, out Dictionary decodedNvList, bool xdr, - bool littleEndian) + bool littleEndian) { decodedNvList = new Dictionary(); @@ -173,28 +173,28 @@ namespace DiscImageChef.Filesystems int offset = 8; while(offset < nvlist.Length) { - NVS_Item item = new NVS_Item(); - int currOff = offset; + NVS_Item item = new NVS_Item(); + int currOff = offset; item.encodedSize = BigEndianBitConverter.ToUInt32(nvlist, offset); // Finished if(item.encodedSize == 0) break; - offset += 4; - item.decodedSize = BigEndianBitConverter.ToUInt32(nvlist, offset); - offset += 4; + offset += 4; + item.decodedSize = BigEndianBitConverter.ToUInt32(nvlist, offset); + offset += 4; uint nameLength = BigEndianBitConverter.ToUInt32(nvlist, offset); offset += 4; if(nameLength % 4 > 0) nameLength += 4 - nameLength % 4; - byte[] nameBytes = new byte[nameLength]; + byte[] nameBytes = new byte[nameLength]; Array.Copy(nvlist, offset, nameBytes, 0, nameLength); - item.name = StringHandlers.CToString(nameBytes); - offset += (int)nameLength; - item.dataType = (NVS_DataTypes)BigEndianBitConverter.ToUInt32(nvlist, offset); - offset += 4; - item.elements = BigEndianBitConverter.ToUInt32(nvlist, offset); - offset += 4; + item.name = StringHandlers.CToString(nameBytes); + offset += (int)nameLength; + item.dataType = (NVS_DataTypes)BigEndianBitConverter.ToUInt32(nvlist, offset); + offset += 4; + item.elements = BigEndianBitConverter.ToUInt32(nvlist, offset); + offset += 4; if(item.elements == 0) { @@ -213,8 +213,8 @@ namespace DiscImageChef.Filesystems for(int i = 0; i < item.elements; i++) { uint temp = BigEndianBitConverter.ToUInt32(nvlist, offset); - boolArray[i] = temp > 0; - offset += 4; + boolArray[i] = temp > 0; + offset += 4; } item.value = boolArray; @@ -222,8 +222,8 @@ namespace DiscImageChef.Filesystems else { uint temp = BigEndianBitConverter.ToUInt32(nvlist, offset); - item.value = temp > 0; - offset += 4; + item.value = temp > 0; + offset += 4; } break; @@ -241,9 +241,10 @@ namespace DiscImageChef.Filesystems } else { - item.value = nvlist[offset]; - offset += 4; + item.value = nvlist[offset]; + offset += 4; } + break; case NVS_DataTypes.DATA_TYPE_DOUBLE: if(item.elements > 1) @@ -252,16 +253,16 @@ namespace DiscImageChef.Filesystems for(int i = 0; i < item.elements; i++) { double temp = BigEndianBitConverter.ToDouble(nvlist, offset); - doubleArray[i] = temp; - offset += 8; + doubleArray[i] = temp; + offset += 8; } item.value = doubleArray; } else { - item.value = BigEndianBitConverter.ToDouble(nvlist, offset); - offset += 8; + item.value = BigEndianBitConverter.ToDouble(nvlist, offset); + offset += 8; } break; @@ -273,8 +274,8 @@ namespace DiscImageChef.Filesystems { DateTime temp = DateHandlers.UnixHrTimeToDateTime(BigEndianBitConverter.ToUInt64(nvlist, offset)); - hrtimeArray[i] = temp; - offset += 8; + hrtimeArray[i] = temp; + offset += 8; } item.value = hrtimeArray; @@ -295,16 +296,16 @@ namespace DiscImageChef.Filesystems for(int i = 0; i < item.elements; i++) { short temp = BigEndianBitConverter.ToInt16(nvlist, offset); - shortArray[i] = temp; - offset += 4; + shortArray[i] = temp; + offset += 4; } item.value = shortArray; } else { - item.value = BigEndianBitConverter.ToInt16(nvlist, offset); - offset += 4; + item.value = BigEndianBitConverter.ToInt16(nvlist, offset); + offset += 4; } break; @@ -316,16 +317,16 @@ namespace DiscImageChef.Filesystems for(int i = 0; i < item.elements; i++) { int temp = BigEndianBitConverter.ToInt32(nvlist, offset); - intArray[i] = temp; - offset += 4; + intArray[i] = temp; + offset += 4; } item.value = intArray; } else { - item.value = BigEndianBitConverter.ToInt32(nvlist, offset); - offset += 4; + item.value = BigEndianBitConverter.ToInt32(nvlist, offset); + offset += 4; } break; @@ -337,16 +338,16 @@ namespace DiscImageChef.Filesystems for(int i = 0; i < item.elements; i++) { long temp = BigEndianBitConverter.ToInt64(nvlist, offset); - longArray[i] = temp; - offset += 8; + longArray[i] = temp; + offset += 8; } item.value = longArray; } else { - item.value = BigEndianBitConverter.ToInt64(nvlist, offset); - offset += 8; + item.value = BigEndianBitConverter.ToInt64(nvlist, offset); + offset += 8; } break; @@ -367,8 +368,8 @@ namespace DiscImageChef.Filesystems } else { - item.value = BigEndianBitConverter.ToInt64(nvlist, offset); - offset += 4; + item.value = BigEndianBitConverter.ToInt64(nvlist, offset); + offset += 4; } break; @@ -383,8 +384,8 @@ namespace DiscImageChef.Filesystems offset += 4; byte[] strBytes = new byte[strLength]; Array.Copy(nvlist, offset, strBytes, 0, strLength); - stringArray[i] = StringHandlers.CToString(strBytes); - offset += (int)strLength; + stringArray[i] = StringHandlers.CToString(strBytes); + offset += (int)strLength; if(strLength % 4 > 0) offset += 4 - (int)(strLength % 4); } @@ -396,8 +397,8 @@ namespace DiscImageChef.Filesystems offset += 4; byte[] strBytes = new byte[strLength]; Array.Copy(nvlist, offset, strBytes, 0, strLength); - item.value = StringHandlers.CToString(strBytes); - offset += (int)strLength; + item.value = StringHandlers.CToString(strBytes); + offset += (int)strLength; if(strLength % 4 > 0) offset += 4 - (int)(strLength % 4); } @@ -410,16 +411,16 @@ namespace DiscImageChef.Filesystems for(int i = 0; i < item.elements; i++) { ushort temp = BigEndianBitConverter.ToUInt16(nvlist, offset); - ushortArray[i] = temp; - offset += 4; + ushortArray[i] = temp; + offset += 4; } item.value = ushortArray; } else { - item.value = BigEndianBitConverter.ToUInt16(nvlist, offset); - offset += 4; + item.value = BigEndianBitConverter.ToUInt16(nvlist, offset); + offset += 4; } break; @@ -431,16 +432,16 @@ namespace DiscImageChef.Filesystems for(int i = 0; i < item.elements; i++) { uint temp = BigEndianBitConverter.ToUInt32(nvlist, offset); - uintArray[i] = temp; - offset += 4; + uintArray[i] = temp; + offset += 4; } item.value = uintArray; } else { - item.value = BigEndianBitConverter.ToUInt32(nvlist, offset); - offset += 4; + item.value = BigEndianBitConverter.ToUInt32(nvlist, offset); + offset += 4; } break; @@ -452,16 +453,16 @@ namespace DiscImageChef.Filesystems for(int i = 0; i < item.elements; i++) { ulong temp = BigEndianBitConverter.ToUInt64(nvlist, offset); - ulongArray[i] = temp; - offset += 8; + ulongArray[i] = temp; + offset += 8; } item.value = ulongArray; } else { - item.value = BigEndianBitConverter.ToUInt64(nvlist, offset); - offset += 8; + item.value = BigEndianBitConverter.ToUInt64(nvlist, offset); + offset += 8; } break; @@ -479,7 +480,7 @@ namespace DiscImageChef.Filesystems byte[] unknown = new byte[item.encodedSize - (offset - currOff)]; Array.Copy(nvlist, offset, unknown, 0, unknown.Length); item.value = unknown; - offset = (int)(currOff + item.encodedSize); + offset = (int)(currOff + item.encodedSize); break; } @@ -624,7 +625,8 @@ namespace DiscImageChef.Filesystems struct ZIO_Checksum { - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)] public ulong[] word; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)] + public ulong[] word; } /// @@ -633,8 +635,9 @@ namespace DiscImageChef.Filesystems [StructLayout(LayoutKind.Sequential, Pack = 1)] struct ZIO_Empty { - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 472)] public byte[] empty; - public ulong magic; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 472)] + public byte[] empty; + public ulong magic; public ZIO_Checksum checksum; } @@ -657,8 +660,8 @@ namespace DiscImageChef.Filesystems struct NVS_XDR_Header { public NVS_Method encodingAndEndian; - public uint version; - public uint flags; + public uint version; + public uint flags; } enum NVS_DataTypes : uint @@ -727,7 +730,8 @@ namespace DiscImageChef.Filesystems [StructLayout(LayoutKind.Sequential, Pack = 1)] struct DVA { - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)] public ulong[] word; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)] + public ulong[] word; } [StructLayout(LayoutKind.Sequential, Pack = 1)] @@ -736,7 +740,8 @@ namespace DiscImageChef.Filesystems /// /// Data virtual address /// - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] public DVA[] dataVirtualAddress; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] + public DVA[] dataVirtualAddress; /// /// Block properties /// @@ -763,13 +768,13 @@ namespace DiscImageChef.Filesystems [StructLayout(LayoutKind.Sequential, Pack = 1)] struct ZFS_Uberblock { - public ulong magic; - public ulong spaVersion; - public ulong lastTxg; - public ulong guidSum; - public ulong timestamp; + public ulong magic; + public ulong spaVersion; + public ulong lastTxg; + public ulong guidSum; + public ulong timestamp; public SPA_BlockPointer mosPtr; - public ulong softwareVersion; + public ulong softwareVersion; } } } \ No newline at end of file diff --git a/DiscImageChef.Filesystems/dump.cs b/DiscImageChef.Filesystems/dump.cs index 61db1b41c..520c968d3 100644 --- a/DiscImageChef.Filesystems/dump.cs +++ b/DiscImageChef.Filesystems/dump.cs @@ -92,15 +92,15 @@ namespace DiscImageChef.Filesystems const short TS_PCL = 8; const int TP_NINDIR = TP_BSIZE / 2; - const int LBLSIZE = 16; - const int NAMELEN = 64; + const int LBLSIZE = 16; + const int NAMELEN = 64; const int NDADDR = 12; const int NIADDR = 3; - public Encoding Encoding { get; private set; } - public string Name => "dump(8) Plugin"; - public Guid Id => new Guid("E53B4D28-C858-4800-B092-DDAE80D361B9"); + public Encoding Encoding { get; private set; } + public string Name => "dump(8) Plugin"; + public Guid Id => new Guid("E53B4D28-C858-4800-B092-DDAE80D361B9"); public FileSystemType XmlFsType { get; private set; } public bool Identify(IMediaImage imagePlugin, Partition partition) @@ -110,9 +110,9 @@ namespace DiscImageChef.Filesystems // It should be start of a tape or floppy or file if(partition.Start != 0) return false; - spcl16 oldHdr = new spcl16(); + spcl16 oldHdr = new spcl16(); spcl_aix aixHdr = new spcl_aix(); - s_spcl newHdr = new s_spcl(); + s_spcl newHdr = new s_spcl(); uint sbSize = (uint)(Marshal.SizeOf(newHdr) / imagePlugin.Info.SectorSize); if(Marshal.SizeOf(newHdr) % imagePlugin.Info.SectorSize != 0) sbSize++; @@ -139,23 +139,23 @@ namespace DiscImageChef.Filesystems DicConsole.DebugWriteLine("dump(8) plugin", "aix magic = 0x{0:X8}", aixHdr.c_magic); 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 || + 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; } public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information, - Encoding encoding) + Encoding encoding) { - Encoding = encoding ?? Encoding.GetEncoding("iso-8859-15"); + Encoding = encoding ?? Encoding.GetEncoding("iso-8859-15"); information = ""; if(imagePlugin.Info.SectorSize < 512) return; if(partition.Start != 0) return; - spcl16 oldHdr = new spcl16(); + spcl16 oldHdr = new spcl16(); spcl_aix aixHdr = new spcl_aix(); - s_spcl newHdr = new s_spcl(); + s_spcl newHdr = new s_spcl(); uint sbSize = (uint)(Marshal.SizeOf(newHdr) / imagePlugin.Info.SectorSize); if(Marshal.SizeOf(newHdr) % imagePlugin.Info.SectorSize != 0) sbSize++; @@ -181,7 +181,7 @@ namespace DiscImageChef.Filesystems bool useOld = false; bool useAix = false; - if(newHdr.c_magic == OFS_MAGIC || newHdr.c_magic == NFS_MAGIC || newHdr.c_magic == OFS_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) { if(newHdr.c_magic == OFS_CIGAM || newHdr.c_magic == NFS_CIGAM || newHdr.c_magic == UFS2_CIGAM) @@ -199,7 +199,7 @@ namespace DiscImageChef.Filesystems useOld = true; // Swap PDP-11 endian - oldHdr.c_date = (int)Swapping.PDPFromLittleEndian((uint)oldHdr.c_date); + oldHdr.c_date = (int)Swapping.PDPFromLittleEndian((uint)oldHdr.c_date); oldHdr.c_ddate = (int)Swapping.PDPFromLittleEndian((uint)oldHdr.c_ddate); } else @@ -218,16 +218,18 @@ namespace DiscImageChef.Filesystems sb.AppendLine(XmlFsType.Type); if(oldHdr.c_date > 0) { - XmlFsType.CreationDate = DateHandlers.UnixToDateTime(oldHdr.c_date); + XmlFsType.CreationDate = DateHandlers.UnixToDateTime(oldHdr.c_date); XmlFsType.CreationDateSpecified = true; sb.AppendFormat("Dump created on {0}", XmlFsType.CreationDate).AppendLine(); } + if(oldHdr.c_ddate > 0) { - XmlFsType.BackupDate = DateHandlers.UnixToDateTime(oldHdr.c_ddate); + XmlFsType.BackupDate = DateHandlers.UnixToDateTime(oldHdr.c_ddate); XmlFsType.BackupDateSpecified = true; sb.AppendFormat("Previous dump created on {0}", XmlFsType.BackupDate).AppendLine(); } + sb.AppendFormat("Dump volume number: {0}", oldHdr.c_volume).AppendLine(); } else if(useAix) @@ -236,16 +238,18 @@ namespace DiscImageChef.Filesystems sb.AppendLine(XmlFsType.Type); if(aixHdr.c_date > 0) { - XmlFsType.CreationDate = DateHandlers.UnixToDateTime(aixHdr.c_date); + XmlFsType.CreationDate = DateHandlers.UnixToDateTime(aixHdr.c_date); XmlFsType.CreationDateSpecified = true; sb.AppendFormat("Dump created on {0}", XmlFsType.CreationDate).AppendLine(); } + if(aixHdr.c_ddate > 0) { - XmlFsType.BackupDate = DateHandlers.UnixToDateTime(aixHdr.c_ddate); + XmlFsType.BackupDate = DateHandlers.UnixToDateTime(aixHdr.c_ddate); XmlFsType.BackupDateSpecified = true; sb.AppendFormat("Previous dump created on {0}", XmlFsType.BackupDate).AppendLine(); } + sb.AppendFormat("Dump volume number: {0}", aixHdr.c_volume).AppendLine(); } else @@ -254,28 +258,30 @@ namespace DiscImageChef.Filesystems sb.AppendLine(XmlFsType.Type); if(newHdr.c_ndate > 0) { - XmlFsType.CreationDate = DateHandlers.UnixToDateTime(newHdr.c_ndate); + XmlFsType.CreationDate = DateHandlers.UnixToDateTime(newHdr.c_ndate); XmlFsType.CreationDateSpecified = true; sb.AppendFormat("Dump created on {0}", XmlFsType.CreationDate).AppendLine(); } else if(newHdr.c_date > 0) { - XmlFsType.CreationDate = DateHandlers.UnixToDateTime(newHdr.c_date); + XmlFsType.CreationDate = DateHandlers.UnixToDateTime(newHdr.c_date); XmlFsType.CreationDateSpecified = true; sb.AppendFormat("Dump created on {0}", XmlFsType.CreationDate).AppendLine(); } + if(newHdr.c_nddate > 0) { - XmlFsType.BackupDate = DateHandlers.UnixToDateTime(newHdr.c_nddate); + XmlFsType.BackupDate = DateHandlers.UnixToDateTime(newHdr.c_nddate); XmlFsType.BackupDateSpecified = true; sb.AppendFormat("Previous dump created on {0}", XmlFsType.BackupDate).AppendLine(); } else if(newHdr.c_ddate > 0) { - XmlFsType.BackupDate = DateHandlers.UnixToDateTime(newHdr.c_ddate); + XmlFsType.BackupDate = DateHandlers.UnixToDateTime(newHdr.c_ddate); XmlFsType.BackupDateSpecified = true; sb.AppendFormat("Previous dump created on {0}", XmlFsType.BackupDate).AppendLine(); } + sb.AppendFormat("Dump volume number: {0}", newHdr.c_volume).AppendLine(); sb.AppendFormat("Dump level: {0}", newHdr.c_level).AppendLine(); string dumpname = StringHandlers.CToString(newHdr.c_label); @@ -340,7 +346,7 @@ namespace DiscImageChef.Filesystems public int c_tapea; public uint c_inumber; public uint c_magic; - public int c_checksum; + public int c_checksum; // Unneeded for now /* public bsd_dinode bsd_c_dinode; @@ -354,54 +360,59 @@ 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 */ + [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 */ + [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 = 32)] + public int[] c_spare; /* reserved for future uses */ } [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. */ - [MarshalAs(UnmanagedType.ByValArray, SizeConst = NDADDR)] public int[] di_db; /* 40: Direct disk blocks. */ + 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 int[] di_db; /* 40: Direct disk blocks. */ [MarshalAs(UnmanagedType.ByValArray, SizeConst = NIADDR)] - public int[] di_ib; /* 88: Indirect disk blocks. */ - public uint di_flags; /* 100: Status flags (chflags). */ + public int[] 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 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 */ } diff --git a/DiscImageChef.Filesystems/exFAT.cs b/DiscImageChef.Filesystems/exFAT.cs index d9735df9f..22db70e88 100644 --- a/DiscImageChef.Filesystems/exFAT.cs +++ b/DiscImageChef.Filesystems/exFAT.cs @@ -48,9 +48,9 @@ namespace DiscImageChef.Filesystems readonly byte[] signature = {0x45, 0x58, 0x46, 0x41, 0x54, 0x20, 0x20, 0x20}; public FileSystemType XmlFsType { get; private set; } - public Encoding Encoding { get; private set; } - public string Name => "Microsoft Extended File Allocation Table"; - public Guid Id => new Guid("8271D088-1533-4CB3-AC28-D802B68BB95C"); + public Encoding Encoding { get; private set; } + public string Name => "Microsoft Extended File Allocation Table"; + public Guid Id => new Guid("8271D088-1533-4CB3-AC28-D802B68BB95C"); public bool Identify(IMediaImage imagePlugin, Partition partition) { @@ -68,29 +68,29 @@ namespace DiscImageChef.Filesystems } public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information, - Encoding encoding) + Encoding encoding) { - Encoding = encoding ?? Encoding.GetEncoding("iso-8859-15"); + Encoding = encoding ?? Encoding.GetEncoding("iso-8859-15"); information = ""; StringBuilder sb = new StringBuilder(); XmlFsType = new FileSystemType(); byte[] vbrSector = imagePlugin.ReadSector(0 + partition.Start); - IntPtr vbrPtr = Marshal.AllocHGlobal(512); + IntPtr vbrPtr = Marshal.AllocHGlobal(512); Marshal.Copy(vbrSector, 0, vbrPtr, 512); VolumeBootRecord vbr = (VolumeBootRecord)Marshal.PtrToStructure(vbrPtr, typeof(VolumeBootRecord)); Marshal.FreeHGlobal(vbrPtr); byte[] parametersSector = imagePlugin.ReadSector(9 + partition.Start); - IntPtr parametersPtr = Marshal.AllocHGlobal(512); + IntPtr parametersPtr = Marshal.AllocHGlobal(512); Marshal.Copy(parametersSector, 0, parametersPtr, 512); OemParameterTable parametersTable = (OemParameterTable)Marshal.PtrToStructure(parametersPtr, typeof(OemParameterTable)); Marshal.FreeHGlobal(parametersPtr); byte[] chkSector = imagePlugin.ReadSector(11 + partition.Start); - IntPtr chkPtr = Marshal.AllocHGlobal(512); + IntPtr chkPtr = Marshal.AllocHGlobal(512); Marshal.Copy(chkSector, 0, chkPtr, 512); ChecksumSector chksector = (ChecksumSector)Marshal.PtrToStructure(chkPtr, typeof(ChecksumSector)); Marshal.FreeHGlobal(chkPtr); @@ -131,15 +131,16 @@ namespace DiscImageChef.Filesystems } else if(parameter.OemParameterType != Guid.Empty) sb.AppendFormat("Found unknown parameter type {0}", parameter.OemParameterType).AppendLine(); + count++; } sb.AppendFormat("Checksum 0x{0:X8}", chksector.checksum[0]).AppendLine(); - XmlFsType.ClusterSize = (1 << vbr.sectorShift) * (1 << vbr.clusterShift); - XmlFsType.Clusters = vbr.clusterHeapLength; - XmlFsType.Dirty = vbr.flags.HasFlag(VolumeFlags.VolumeDirty); - XmlFsType.Type = "exFAT"; + XmlFsType.ClusterSize = (1 << vbr.sectorShift) * (1 << vbr.clusterShift); + XmlFsType.Clusters = vbr.clusterHeapLength; + XmlFsType.Dirty = vbr.flags.HasFlag(VolumeFlags.VolumeDirty); + XmlFsType.Type = "exFAT"; XmlFsType.VolumeSerial = $"{vbr.volumeSerial:X8}"; information = sb.ToString(); @@ -149,34 +150,39 @@ namespace DiscImageChef.Filesystems enum VolumeFlags : ushort { SecondFatActive = 1, - VolumeDirty = 2, - MediaFailure = 4, - ClearToZero = 8 + VolumeDirty = 2, + MediaFailure = 4, + ClearToZero = 8 } [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; - public ulong offset; - public ulong sectors; - public uint fatOffset; - public uint fatLength; - public uint clusterHeapOffset; - public uint clusterHeapLength; - public uint rootDirectoryCluster; - public uint volumeSerial; - public ushort revision; + [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; + public uint fatLength; + public uint clusterHeapOffset; + public uint clusterHeapLength; + public uint rootDirectoryCluster; + public uint volumeSerial; + public ushort revision; public VolumeFlags flags; - public byte sectorShift; - public byte clusterShift; - 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; + public byte sectorShift; + public byte clusterShift; + 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; public ushort bootSignature; } @@ -191,20 +197,24 @@ 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; } } } \ No newline at end of file diff --git a/DiscImageChef.Filesystems/ext2FS.cs b/DiscImageChef.Filesystems/ext2FS.cs index b5531b0b5..c8b66d7a8 100644 --- a/DiscImageChef.Filesystems/ext2FS.cs +++ b/DiscImageChef.Filesystems/ext2FS.cs @@ -87,11 +87,11 @@ namespace DiscImageChef.Filesystems const ushort EXT2_ERRORS_PANIC = 3; // OS codes - const uint EXT2_OS_LINUX = 0; - const uint EXT2_OS_HURD = 1; - const uint EXT2_OS_MASIX = 2; + const uint EXT2_OS_LINUX = 0; + const uint EXT2_OS_HURD = 1; + const uint EXT2_OS_MASIX = 2; const uint EXT2_OS_FREEBSD = 3; - const uint EXT2_OS_LITES = 4; + const uint EXT2_OS_LITES = 4; // Revision levels /// The good old (original) format @@ -162,23 +162,23 @@ namespace DiscImageChef.Filesystems const uint EXT2_FLAGS_TEST_FILESYS = 0x00000004; public FileSystemType XmlFsType { get; private set; } - public Encoding Encoding { get; private set; } - public string Name => "Linux extended Filesystem 2, 3 and 4"; - public Guid Id => new Guid("6AA91B88-150B-4A7B-AD56-F84FB2DF4184"); + public Encoding Encoding { get; private set; } + public string Name => "Linux extended Filesystem 2, 3 and 4"; + public Guid Id => new Guid("6AA91B88-150B-4A7B-AD56-F84FB2DF4184"); public bool Identify(IMediaImage imagePlugin, Partition partition) { ulong sbSectorOff = SB_POS / imagePlugin.Info.SectorSize; - uint sbOff = SB_POS % imagePlugin.Info.SectorSize; + uint sbOff = SB_POS % imagePlugin.Info.SectorSize; if(sbSectorOff + partition.Start >= partition.End) return false; - int sbSizeInBytes = Marshal.SizeOf(typeof(ext2FSSuperBlock)); + int sbSizeInBytes = Marshal.SizeOf(typeof(ext2FSSuperBlock)); uint sbSizeInSectors = (uint)(sbSizeInBytes / imagePlugin.Info.SectorSize); if(sbSizeInBytes % imagePlugin.Info.SectorSize > 0) sbSizeInSectors++; byte[] sbSector = imagePlugin.ReadSectors(sbSectorOff + partition.Start, sbSizeInSectors); - byte[] sb = new byte[sbSizeInBytes]; + byte[] sb = new byte[sbSizeInBytes]; Array.Copy(sbSector, sbOff, sb, 0, sbSizeInBytes); ushort magic = BitConverter.ToUInt16(sb, 0x038); @@ -187,26 +187,26 @@ namespace DiscImageChef.Filesystems } public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information, - Encoding encoding) + Encoding encoding) { - Encoding = encoding ?? Encoding.GetEncoding("iso-8859-15"); + Encoding = encoding ?? Encoding.GetEncoding("iso-8859-15"); information = ""; StringBuilder sb = new StringBuilder(); bool newExt2 = false; - bool ext3 = false; - bool ext4 = false; + bool ext3 = false; + bool ext4 = false; - int sbSizeInBytes = Marshal.SizeOf(typeof(ext2FSSuperBlock)); + int sbSizeInBytes = Marshal.SizeOf(typeof(ext2FSSuperBlock)); uint sbSizeInSectors = (uint)(sbSizeInBytes / imagePlugin.Info.SectorSize); if(sbSizeInBytes % imagePlugin.Info.SectorSize > 0) sbSizeInSectors++; ulong sbSectorOff = SB_POS / imagePlugin.Info.SectorSize; - uint sbOff = SB_POS % imagePlugin.Info.SectorSize; + uint sbOff = SB_POS % imagePlugin.Info.SectorSize; byte[] sbSector = imagePlugin.ReadSectors(sbSectorOff + partition.Start, sbSizeInSectors); - byte[] sblock = new byte[sbSizeInBytes]; + byte[] sblock = new byte[sbSizeInBytes]; Array.Copy(sbSector, sbOff, sblock, 0, sbSizeInBytes); IntPtr sbPtr = Marshal.AllocHGlobal(sbSizeInBytes); Marshal.Copy(sblock, 0, sbPtr, sbSizeInBytes); @@ -222,21 +222,22 @@ namespace DiscImageChef.Filesystems XmlFsType.Type = "ext2"; break; case EXT2_MAGIC: - 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_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 || + 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_incompat & EXT4_FEATURE_INCOMPAT_DIRDATA) == EXT4_FEATURE_INCOMPAT_DIRDATA) { ext3 = false; ext4 = true; @@ -249,16 +250,19 @@ namespace DiscImageChef.Filesystems sb.AppendLine("ext2 filesystem"); XmlFsType.Type = "ext2"; } + if(ext3) { sb.AppendLine("ext3 filesystem"); XmlFsType.Type = "ext3"; } + if(ext4) { sb.AppendLine("ext4 filesystem"); XmlFsType.Type = "ext4"; } + break; default: information = "Not a ext2/3/4 filesystem" + Environment.NewLine; @@ -294,13 +298,13 @@ namespace DiscImageChef.Filesystems { sb.AppendFormat("Volume was created on {0} for {1}", DateHandlers.UnixUnsignedToDateTime(supblk.mkfs_t), extOs).AppendLine(); - XmlFsType.CreationDate = DateHandlers.UnixUnsignedToDateTime(supblk.mkfs_t); + XmlFsType.CreationDate = DateHandlers.UnixUnsignedToDateTime(supblk.mkfs_t); XmlFsType.CreationDateSpecified = true; } else sb.AppendFormat("Volume was created for {0}", extOs).AppendLine(); byte[] tempBytes = new byte[8]; - ulong blocks, reserved, free; + ulong blocks, reserved, free; if((supblk.ftr_incompat & EXT4_FEATURE_INCOMPAT_64BIT) == EXT4_FEATURE_INCOMPAT_64BIT) { @@ -314,10 +318,10 @@ namespace DiscImageChef.Filesystems tempBytes[5] = tempHi[1]; tempBytes[6] = tempHi[2]; tempBytes[7] = tempHi[3]; - blocks = BitConverter.ToUInt64(tempBytes, 0); + blocks = BitConverter.ToUInt64(tempBytes, 0); - tempLo = BitConverter.GetBytes(supblk.reserved_blocks); - tempHi = BitConverter.GetBytes(supblk.reserved_blocks_hi); + tempLo = BitConverter.GetBytes(supblk.reserved_blocks); + tempHi = BitConverter.GetBytes(supblk.reserved_blocks_hi); tempBytes[0] = tempLo[0]; tempBytes[1] = tempLo[1]; tempBytes[2] = tempLo[2]; @@ -326,10 +330,10 @@ namespace DiscImageChef.Filesystems tempBytes[5] = tempHi[1]; tempBytes[6] = tempHi[2]; tempBytes[7] = tempHi[3]; - reserved = BitConverter.ToUInt64(tempBytes, 0); + reserved = BitConverter.ToUInt64(tempBytes, 0); - tempLo = BitConverter.GetBytes(supblk.free_blocks); - tempHi = BitConverter.GetBytes(supblk.free_blocks_hi); + tempLo = BitConverter.GetBytes(supblk.free_blocks); + tempHi = BitConverter.GetBytes(supblk.free_blocks_hi); tempBytes[0] = tempLo[0]; tempBytes[1] = tempLo[1]; tempBytes[2] = tempLo[2]; @@ -338,13 +342,13 @@ namespace DiscImageChef.Filesystems tempBytes[5] = tempHi[1]; tempBytes[6] = tempHi[2]; tempBytes[7] = tempHi[3]; - free = BitConverter.ToUInt64(tempBytes, 0); + free = BitConverter.ToUInt64(tempBytes, 0); } else { - blocks = supblk.blocks; + blocks = supblk.blocks; reserved = supblk.reserved_blocks; - free = supblk.free_blocks; + free = supblk.free_blocks; } if(supblk.block_size == 0) // Then it is 1024 bytes @@ -353,7 +357,7 @@ namespace DiscImageChef.Filesystems 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.Clusters = (long)blocks; XmlFsType.ClusterSize = 1024 << (int)supblk.block_size; if(supblk.mount_t > 0 || supblk.mount_c > 0) { @@ -400,7 +404,7 @@ namespace DiscImageChef.Filesystems { sb.AppendFormat("Last written on {0}", DateHandlers.UnixUnsignedToDateTime(supblk.write_t)) .AppendLine(); - XmlFsType.ModificationDate = DateHandlers.UnixUnsignedToDateTime(supblk.write_t); + XmlFsType.ModificationDate = DateHandlers.UnixUnsignedToDateTime(supblk.write_t); XmlFsType.ModificationDateSpecified = true; } else sb.AppendLine("Volume has never been written"); @@ -460,12 +464,12 @@ namespace DiscImageChef.Filesystems sb.AppendFormat("{0} KiB has been written on volume", supblk.kbytes_written).AppendLine(); sb.AppendFormat("{0} reserved and {1} free blocks", reserved, free).AppendLine(); - XmlFsType.FreeClusters = (long)free; + 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(); + 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(); @@ -490,7 +494,7 @@ namespace DiscImageChef.Filesystems 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 || + 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) { sb.AppendLine("Volume is journaled"); @@ -498,7 +502,8 @@ namespace DiscImageChef.Filesystems 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(); + 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) @@ -510,9 +515,9 @@ namespace DiscImageChef.Filesystems { 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(); + .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) { @@ -708,9 +713,11 @@ namespace DiscImageChef.Filesystems /// 0x068, 16 bytes, UUID public Guid uuid; /// 0x078, 16 bytes, volume name - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] public byte[] volume_name; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] + public byte[] volume_name; /// 0x088, 64 bytes, where last mounted - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 64)] public byte[] last_mount_dir; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 64)] + public byte[] last_mount_dir; /// 0x0C8, Usage bitmap algorithm, for compression public uint algo_usage_bmp; /// 0x0CC, Block to try to preallocate @@ -754,7 +761,8 @@ namespace DiscImageChef.Filesystems public uint mkfs_t; /// Backup of the journal inode - [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 /// 0x14C, High 32bits of blocks no. @@ -807,7 +815,8 @@ namespace DiscImageChef.Filesystems /// 0x19C, block involved of first error public ulong first_error_block; /// 0x1A0, 32 bytes, function where the error happened - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] public byte[] first_error_func; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] + public byte[] first_error_func; /// 0x1B0, line number where error happened public uint first_error_line; /// 0x1B4, time of most recent error @@ -819,11 +828,13 @@ namespace DiscImageChef.Filesystems /// 0x1C0, block involved of last error public ulong last_error_block; /// 0x1C8, 32 bytes, function where the error happened - [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 - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 64)] public byte[] mount_options; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 64)] + public byte[] mount_options; /// Inode for user quota public uint usr_quota_inum; @@ -832,11 +843,14 @@ namespace DiscImageChef.Filesystems /// Overhead clusters in volume public uint overhead_clusters; /// Groups with sparse_super2 SBs - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)] public uint[] backup_bgs; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)] + public uint[] backup_bgs; /// Encryption algorithms in use - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)] public byte[] encrypt_algos; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)] + public byte[] encrypt_algos; /// Salt used for string2key algorithm - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] public byte[] encrypt_pw_salt; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] + public byte[] encrypt_pw_salt; /// Inode number of lost+found public uint lpf_inum; /// Inode number for tracking project quota @@ -844,7 +858,8 @@ namespace DiscImageChef.Filesystems /// crc32c(uuid) if csum_seed is set public uint checksum_seed; /// Reserved - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 98)] public byte[] reserved; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 98)] + public byte[] reserved; /// crc32c(superblock) public uint checksum; } diff --git a/DiscImageChef.Filesystems/extFS.cs b/DiscImageChef.Filesystems/extFS.cs index 99107d63a..45e110911 100644 --- a/DiscImageChef.Filesystems/extFS.cs +++ b/DiscImageChef.Filesystems/extFS.cs @@ -50,21 +50,21 @@ namespace DiscImageChef.Filesystems const ushort EXT_MAGIC = 0x137D; public FileSystemType XmlFsType { get; private set; } - public string Name => "Linux extended Filesystem"; - public Guid Id => new Guid("076CB3A2-08C2-4D69-BC8A-FCAA2E502BE2"); - public Encoding Encoding { get; private set; } + public string Name => "Linux extended Filesystem"; + public Guid Id => new Guid("076CB3A2-08C2-4D69-BC8A-FCAA2E502BE2"); + public Encoding Encoding { get; private set; } public bool Identify(IMediaImage imagePlugin, Partition partition) { if(imagePlugin.Info.SectorSize < 512) return false; ulong sbSectorOff = SB_POS / imagePlugin.Info.SectorSize; - uint sbOff = SB_POS % imagePlugin.Info.SectorSize; + uint sbOff = SB_POS % imagePlugin.Info.SectorSize; if(sbSectorOff + partition.Start >= partition.End) return false; byte[] sbSector = imagePlugin.ReadSector(sbSectorOff + partition.Start); - byte[] sb = new byte[512]; + byte[] sb = new byte[512]; Array.Copy(sbSector, sbOff, sb, 0, 512); ushort magic = BitConverter.ToUInt16(sb, 0x038); @@ -73,9 +73,9 @@ namespace DiscImageChef.Filesystems } public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information, - Encoding encoding) + Encoding encoding) { - Encoding = encoding ?? Encoding.GetEncoding("iso-8859-15"); + Encoding = encoding ?? Encoding.GetEncoding("iso-8859-15"); information = ""; StringBuilder sb = new StringBuilder(); @@ -83,45 +83,46 @@ namespace DiscImageChef.Filesystems if(imagePlugin.Info.SectorSize < 512) return; ulong sbSectorOff = SB_POS / imagePlugin.Info.SectorSize; - uint sbOff = SB_POS % imagePlugin.Info.SectorSize; + uint sbOff = SB_POS % imagePlugin.Info.SectorSize; if(sbSectorOff + partition.Start >= partition.End) return; - byte[] sblock = imagePlugin.ReadSector(sbSectorOff + partition.Start); + byte[] sblock = imagePlugin.ReadSector(sbSectorOff + partition.Start); byte[] sbSector = new byte[512]; Array.Copy(sblock, sbOff, sbSector, 0, 512); extFSSuperBlock extSb = new extFSSuperBlock { - inodes = BitConverter.ToUInt32(sbSector, 0x000), - zones = BitConverter.ToUInt32(sbSector, 0x004), - firstfreeblk = BitConverter.ToUInt32(sbSector, 0x008), - freecountblk = BitConverter.ToUInt32(sbSector, 0x00C), - firstfreeind = BitConverter.ToUInt32(sbSector, 0x010), - freecountind = BitConverter.ToUInt32(sbSector, 0x014), + inodes = BitConverter.ToUInt32(sbSector, 0x000), + zones = BitConverter.ToUInt32(sbSector, 0x004), + firstfreeblk = BitConverter.ToUInt32(sbSector, 0x008), + freecountblk = BitConverter.ToUInt32(sbSector, 0x00C), + firstfreeind = BitConverter.ToUInt32(sbSector, 0x010), + freecountind = BitConverter.ToUInt32(sbSector, 0x014), firstdatazone = BitConverter.ToUInt32(sbSector, 0x018), - logzonesize = BitConverter.ToUInt32(sbSector, 0x01C), - maxsize = BitConverter.ToUInt32(sbSector, 0x020) + logzonesize = BitConverter.ToUInt32(sbSector, 0x01C), + maxsize = BitConverter.ToUInt32(sbSector, 0x020) }; sb.AppendLine("ext filesystem"); - sb.AppendFormat("{0} zones on volume", extSb.zones); + sb.AppendFormat("{0} zones on volume", extSb.zones); sb.AppendFormat("{0} free blocks ({1} bytes)", extSb.freecountblk, extSb.freecountblk * 1024); sb.AppendFormat("{0} inodes on volume, {1} free ({2}%)", extSb.inodes, extSb.freecountind, extSb.freecountind * 100 / extSb.inodes); sb.AppendFormat("First free inode is {0}", extSb.firstfreeind); sb.AppendFormat("First free block is {0}", extSb.firstfreeblk); - sb.AppendFormat("First data zone is {0}", extSb.firstdatazone); - sb.AppendFormat("Log zone size: {0}", extSb.logzonesize); - sb.AppendFormat("Max zone size: {0}", extSb.maxsize); + sb.AppendFormat("First data zone is {0}", extSb.firstdatazone); + sb.AppendFormat("Log zone size: {0}", extSb.logzonesize); + sb.AppendFormat("Max zone size: {0}", extSb.maxsize); XmlFsType = new FileSystemType { - Type = "ext", - FreeClusters = extSb.freecountblk, + Type = "ext", + FreeClusters = extSb.freecountblk, FreeClustersSpecified = true, - ClusterSize = 1024, - Clusters = (long)((partition.End - partition.Start + 1) * imagePlugin.Info.SectorSize / 1024) + ClusterSize = 1024, + Clusters = + (long)((partition.End - partition.Start + 1) * imagePlugin.Info.SectorSize / 1024) }; information = sb.ToString(); diff --git a/DiscImageChef.Filters/AppleDouble.cs b/DiscImageChef.Filters/AppleDouble.cs index 8c07f1b71..839c840f5 100644 --- a/DiscImageChef.Filters/AppleDouble.cs +++ b/DiscImageChef.Filters/AppleDouble.cs @@ -42,8 +42,8 @@ namespace DiscImageChef.Filters /// public class AppleDouble : IFilter { - const uint AppleDoubleMagic = 0x00051607; - const uint AppleDoubleVersion = 0x00010000; + const uint AppleDoubleMagic = 0x00051607; + const uint AppleDoubleVersion = 0x00010000; const uint AppleDoubleVersion2 = 0x00020000; readonly byte[] DOSHome = {0x4D, 0x53, 0x2D, 0x44, 0x4F, 0x53, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20}; @@ -58,18 +58,18 @@ namespace DiscImageChef.Filters {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}; - string basePath; + string basePath; DateTime creationTime; - AppleDoubleEntry dataFork; + AppleDoubleEntry dataFork; AppleDoubleHeader header; - string headerPath; - DateTime lastWriteTime; - bool opened; - AppleDoubleEntry rsrcFork; + string headerPath; + DateTime lastWriteTime; + bool opened; + AppleDoubleEntry rsrcFork; public string Name => "AppleDouble"; - public Guid Id => new Guid("1B2165EE-C9DF-4B21-BBBB-9E5892B2DF4D"); + public Guid Id => new Guid("1B2165EE-C9DF-4B21-BBBB-9E5892B2DF4D"); public void Close() { @@ -153,12 +153,13 @@ namespace DiscImageChef.Filters public bool Identify(string path) { - string filename = Path.GetFileName(path); + string filename = Path.GetFileName(path); string filenameNoExt = Path.GetFileNameWithoutExtension(path); - string parentFolder = Path.GetDirectoryName(path); + string parentFolder = Path.GetDirectoryName(path); // Prepend data fork name with "R." - string ProDosAppleDouble = Path.Combine(parentFolder ?? throw new InvalidOperationException(), "R." + filename); + string ProDosAppleDouble = + Path.Combine(parentFolder ?? throw new InvalidOperationException(), "R." + filename); // Prepend data fork name with '%' string UNIXAppleDouble = Path.Combine(parentFolder, "%" + filename); // Change file extension to ADF @@ -166,8 +167,8 @@ namespace DiscImageChef.Filters // Change file extension to adf string DOSAppleDoubleLower = Path.Combine(parentFolder, filenameNoExt + ".adf"); // Store AppleDouble header file in ".AppleDouble" folder with same name - string NetatalkAppleDouble = Path.Combine(parentFolder, ".AppleDouble", - filename ?? throw new InvalidOperationException()); + string NetatalkAppleDouble = + Path.Combine(parentFolder, ".AppleDouble", filename ?? throw new InvalidOperationException()); // Store AppleDouble header file in "resource.frk" folder with same name string DAVEAppleDouble = Path.Combine(parentFolder, "resource.frk", filename); // Prepend data fork name with "._" @@ -313,12 +314,13 @@ namespace DiscImageChef.Filters public void Open(string path) { - string filename = Path.GetFileName(path); + string filename = Path.GetFileName(path); string filenameNoExt = Path.GetFileNameWithoutExtension(path); - string parentFolder = Path.GetDirectoryName(path); + string parentFolder = Path.GetDirectoryName(path); // Prepend data fork name with "R." - string ProDosAppleDouble = Path.Combine(parentFolder ?? throw new InvalidOperationException(), "R." + filename); + string ProDosAppleDouble = + Path.Combine(parentFolder ?? throw new InvalidOperationException(), "R." + filename); // Prepend data fork name with '%' string UNIXAppleDouble = Path.Combine(parentFolder, "%" + filename); // Change file extension to ADF @@ -326,8 +328,8 @@ namespace DiscImageChef.Filters // Change file extension to adf string DOSAppleDoubleLower = Path.Combine(parentFolder, filenameNoExt + ".adf"); // Store AppleDouble header file in ".AppleDouble" folder with same name - string NetatalkAppleDouble = Path.Combine(parentFolder, ".AppleDouble", - filename ?? throw new InvalidOperationException()); + string NetatalkAppleDouble = + Path.Combine(parentFolder, ".AppleDouble", filename ?? throw new InvalidOperationException()); // Store AppleDouble header file in "resource.frk" folder with same name string DAVEAppleDouble = Path.Combine(parentFolder, "resource.frk", filename); // Prepend data fork name with "._" @@ -478,7 +480,7 @@ namespace DiscImageChef.Filters entries[i] = BigEndianMarshal.ByteArrayToStructureBigEndian(entry); } - creationTime = DateTime.UtcNow; + creationTime = DateTime.UtcNow; lastWriteTime = creationTime; foreach(AppleDoubleEntry entry in entries) switch((AppleDoubleEntryID)entry.id) @@ -492,7 +494,7 @@ namespace DiscImageChef.Filters fs.Read(dates_b, 0, 16); AppleDoubleFileDates dates = BigEndianMarshal.ByteArrayToStructureBigEndian(dates_b); - creationTime = DateHandlers.UnixUnsignedToDateTime(dates.creationDate); + creationTime = DateHandlers.UnixUnsignedToDateTime(dates.creationDate); lastWriteTime = DateHandlers.UnixUnsignedToDateTime(dates.modificationDate); break; case AppleDoubleEntryID.FileInfo: @@ -503,21 +505,21 @@ namespace DiscImageChef.Filters { AppleDoubleMacFileInfo macinfo = BigEndianMarshal.ByteArrayToStructureBigEndian(finfo); - creationTime = DateHandlers.MacToDateTime(macinfo.creationDate); + creationTime = DateHandlers.MacToDateTime(macinfo.creationDate); lastWriteTime = DateHandlers.MacToDateTime(macinfo.modificationDate); } else if(ProDOSHome.SequenceEqual(header.homeFilesystem)) { AppleDoubleProDOSFileInfo prodosinfo = BigEndianMarshal.ByteArrayToStructureBigEndian(finfo); - creationTime = DateHandlers.MacToDateTime(prodosinfo.creationDate); + creationTime = DateHandlers.MacToDateTime(prodosinfo.creationDate); lastWriteTime = DateHandlers.MacToDateTime(prodosinfo.modificationDate); } else if(UNIXHome.SequenceEqual(header.homeFilesystem)) { AppleDoubleUNIXFileInfo unixinfo = BigEndianMarshal.ByteArrayToStructureBigEndian(finfo); - creationTime = DateHandlers.UnixUnsignedToDateTime(unixinfo.creationDate); + creationTime = DateHandlers.UnixUnsignedToDateTime(unixinfo.creationDate); lastWriteTime = DateHandlers.UnixUnsignedToDateTime(unixinfo.modificationDate); } else if(DOSHome.SequenceEqual(header.homeFilesystem)) @@ -527,6 +529,7 @@ namespace DiscImageChef.Filters lastWriteTime = DateHandlers.DosToDateTime(dosinfo.modificationDate, dosinfo.modificationTime); } + break; case AppleDoubleEntryID.ResourceFork: rsrcFork = entry; @@ -542,28 +545,28 @@ namespace DiscImageChef.Filters } fs.Close(); - opened = true; + opened = true; basePath = path; } enum AppleDoubleEntryID : uint { - Invalid = 0, - DataFork = 1, - ResourceFork = 2, - RealName = 3, - Comment = 4, - Icon = 5, - ColorIcon = 6, - FileInfo = 7, - FileDates = 8, - FinderInfo = 9, - MacFileInfo = 10, + Invalid = 0, + DataFork = 1, + ResourceFork = 2, + RealName = 3, + Comment = 4, + Icon = 5, + ColorIcon = 6, + FileInfo = 7, + FileDates = 8, + FinderInfo = 9, + MacFileInfo = 10, ProDOSFileInfo = 11, - DOSFileInfo = 12, - ShortName = 13, - AFPFileInfo = 14, - DirectoryID = 15 + DOSFileInfo = 12, + ShortName = 13, + AFPFileInfo = 14, + DirectoryID = 15 } [StructLayout(LayoutKind.Sequential, Pack = 1)] @@ -571,7 +574,8 @@ 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; } @@ -620,12 +624,12 @@ namespace DiscImageChef.Filters [StructLayout(LayoutKind.Sequential, Pack = 1)] struct AppleDoubleProDOSFileInfo { - public uint creationDate; - public uint modificationDate; - public uint backupDate; + public uint creationDate; + public uint modificationDate; + public uint backupDate; public ushort access; public ushort fileType; - public uint auxType; + public uint auxType; } } } \ No newline at end of file diff --git a/DiscImageChef.Filters/AppleSingle.cs b/DiscImageChef.Filters/AppleSingle.cs index 53cb25adb..0eea055d2 100644 --- a/DiscImageChef.Filters/AppleSingle.cs +++ b/DiscImageChef.Filters/AppleSingle.cs @@ -42,8 +42,8 @@ namespace DiscImageChef.Filters /// public class AppleSingle : IFilter { - const uint AppleSingleMagic = 0x00051600; - const uint AppleSingleVersion = 0x00010000; + const uint AppleSingleMagic = 0x00051600; + const uint AppleSingleVersion = 0x00010000; const uint AppleSingleVersion2 = 0x00020000; readonly byte[] DOSHome = {0x4D, 0x53, 0x2D, 0x44, 0x4F, 0x53, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20}; @@ -58,28 +58,28 @@ namespace DiscImageChef.Filters {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}; - string basePath; - byte[] bytes; + string basePath; + byte[] bytes; DateTime creationTime; - AppleSingleEntry dataFork; + AppleSingleEntry dataFork; AppleSingleHeader header; - bool isBytes, isStream, isPath, opened; - DateTime lastWriteTime; - AppleSingleEntry rsrcFork; - Stream stream; + bool isBytes, isStream, isPath, opened; + DateTime lastWriteTime; + AppleSingleEntry rsrcFork; + Stream stream; public string Name => "AppleSingle"; - public Guid Id => new Guid("A69B20E8-F4D3-42BB-BD2B-4A7263394A05"); + public Guid Id => new Guid("A69B20E8-F4D3-42BB-BD2B-4A7263394A05"); public void Close() { bytes = null; stream?.Close(); - isBytes = false; + isBytes = false; isStream = false; - isPath = false; - opened = false; + isPath = false; + opened = false; } public string GetBasePath() @@ -101,7 +101,7 @@ namespace DiscImageChef.Filters { if(dataFork.length == 0) return null; - if(isBytes) return new OffsetStream(bytes, 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, @@ -144,7 +144,7 @@ namespace DiscImageChef.Filters { if(rsrcFork.length == 0) return null; - if(isBytes) return new OffsetStream(bytes, 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, @@ -219,7 +219,7 @@ namespace DiscImageChef.Filters entries[i] = BigEndianMarshal.ByteArrayToStructureBigEndian(entry); } - creationTime = DateTime.UtcNow; + creationTime = DateTime.UtcNow; lastWriteTime = creationTime; foreach(AppleSingleEntry entry in entries) switch((AppleSingleEntryID)entry.id) @@ -233,7 +233,7 @@ namespace DiscImageChef.Filters ms.Read(dates_b, 0, 16); AppleSingleFileDates dates = BigEndianMarshal.ByteArrayToStructureBigEndian(dates_b); - creationTime = DateHandlers.UnixUnsignedToDateTime(dates.creationDate); + creationTime = DateHandlers.UnixUnsignedToDateTime(dates.creationDate); lastWriteTime = DateHandlers.UnixUnsignedToDateTime(dates.modificationDate); break; case AppleSingleEntryID.FileInfo: @@ -244,21 +244,21 @@ namespace DiscImageChef.Filters { AppleSingleMacFileInfo macinfo = BigEndianMarshal.ByteArrayToStructureBigEndian(finfo); - creationTime = DateHandlers.MacToDateTime(macinfo.creationDate); + creationTime = DateHandlers.MacToDateTime(macinfo.creationDate); lastWriteTime = DateHandlers.MacToDateTime(macinfo.modificationDate); } else if(ProDOSHome.SequenceEqual(header.homeFilesystem)) { AppleSingleProDOSFileInfo prodosinfo = BigEndianMarshal.ByteArrayToStructureBigEndian(finfo); - creationTime = DateHandlers.MacToDateTime(prodosinfo.creationDate); + creationTime = DateHandlers.MacToDateTime(prodosinfo.creationDate); lastWriteTime = DateHandlers.MacToDateTime(prodosinfo.modificationDate); } else if(UNIXHome.SequenceEqual(header.homeFilesystem)) { AppleSingleUNIXFileInfo unixinfo = BigEndianMarshal.ByteArrayToStructureBigEndian(finfo); - creationTime = DateHandlers.UnixUnsignedToDateTime(unixinfo.creationDate); + creationTime = DateHandlers.UnixUnsignedToDateTime(unixinfo.creationDate); lastWriteTime = DateHandlers.UnixUnsignedToDateTime(unixinfo.modificationDate); } else if(DOSHome.SequenceEqual(header.homeFilesystem)) @@ -268,6 +268,7 @@ namespace DiscImageChef.Filters lastWriteTime = DateHandlers.DosToDateTime(dosinfo.modificationDate, dosinfo.modificationTime); } + break; case AppleSingleEntryID.ResourceFork: rsrcFork = entry; @@ -275,9 +276,9 @@ namespace DiscImageChef.Filters } ms.Close(); - opened = true; + opened = true; isBytes = true; - bytes = buffer; + bytes = buffer; } public void Open(Stream stream) @@ -296,7 +297,7 @@ namespace DiscImageChef.Filters entries[i] = BigEndianMarshal.ByteArrayToStructureBigEndian(entry); } - creationTime = DateTime.UtcNow; + creationTime = DateTime.UtcNow; lastWriteTime = creationTime; foreach(AppleSingleEntry entry in entries) switch((AppleSingleEntryID)entry.id) @@ -310,7 +311,7 @@ namespace DiscImageChef.Filters stream.Read(dates_b, 0, 16); AppleSingleFileDates dates = BigEndianMarshal.ByteArrayToStructureBigEndian(dates_b); - creationTime = DateHandlers.MacToDateTime(dates.creationDate); + creationTime = DateHandlers.MacToDateTime(dates.creationDate); lastWriteTime = DateHandlers.MacToDateTime(dates.modificationDate); break; case AppleSingleEntryID.FileInfo: @@ -321,21 +322,21 @@ namespace DiscImageChef.Filters { AppleSingleMacFileInfo macinfo = BigEndianMarshal.ByteArrayToStructureBigEndian(finfo); - creationTime = DateHandlers.MacToDateTime(macinfo.creationDate); + creationTime = DateHandlers.MacToDateTime(macinfo.creationDate); lastWriteTime = DateHandlers.MacToDateTime(macinfo.modificationDate); } else if(ProDOSHome.SequenceEqual(header.homeFilesystem)) { AppleSingleProDOSFileInfo prodosinfo = BigEndianMarshal.ByteArrayToStructureBigEndian(finfo); - creationTime = DateHandlers.MacToDateTime(prodosinfo.creationDate); + creationTime = DateHandlers.MacToDateTime(prodosinfo.creationDate); lastWriteTime = DateHandlers.MacToDateTime(prodosinfo.modificationDate); } else if(UNIXHome.SequenceEqual(header.homeFilesystem)) { AppleSingleUNIXFileInfo unixinfo = BigEndianMarshal.ByteArrayToStructureBigEndian(finfo); - creationTime = DateHandlers.UnixUnsignedToDateTime(unixinfo.creationDate); + creationTime = DateHandlers.UnixUnsignedToDateTime(unixinfo.creationDate); lastWriteTime = DateHandlers.UnixUnsignedToDateTime(unixinfo.modificationDate); } else if(DOSHome.SequenceEqual(header.homeFilesystem)) @@ -345,6 +346,7 @@ namespace DiscImageChef.Filters lastWriteTime = DateHandlers.DosToDateTime(dosinfo.modificationDate, dosinfo.modificationTime); } + break; case AppleSingleEntryID.ResourceFork: rsrcFork = entry; @@ -352,8 +354,8 @@ namespace DiscImageChef.Filters } stream.Seek(0, SeekOrigin.Begin); - opened = true; - isStream = true; + opened = true; + isStream = true; this.stream = stream; } @@ -374,7 +376,7 @@ namespace DiscImageChef.Filters entries[i] = BigEndianMarshal.ByteArrayToStructureBigEndian(entry); } - creationTime = DateTime.UtcNow; + creationTime = DateTime.UtcNow; lastWriteTime = creationTime; foreach(AppleSingleEntry entry in entries) switch((AppleSingleEntryID)entry.id) @@ -388,7 +390,7 @@ namespace DiscImageChef.Filters fs.Read(dates_b, 0, 16); AppleSingleFileDates dates = BigEndianMarshal.ByteArrayToStructureBigEndian(dates_b); - creationTime = DateHandlers.MacToDateTime(dates.creationDate); + creationTime = DateHandlers.MacToDateTime(dates.creationDate); lastWriteTime = DateHandlers.MacToDateTime(dates.modificationDate); break; case AppleSingleEntryID.FileInfo: @@ -399,21 +401,21 @@ namespace DiscImageChef.Filters { AppleSingleMacFileInfo macinfo = BigEndianMarshal.ByteArrayToStructureBigEndian(finfo); - creationTime = DateHandlers.MacToDateTime(macinfo.creationDate); + creationTime = DateHandlers.MacToDateTime(macinfo.creationDate); lastWriteTime = DateHandlers.MacToDateTime(macinfo.modificationDate); } else if(ProDOSHome.SequenceEqual(header.homeFilesystem)) { AppleSingleProDOSFileInfo prodosinfo = BigEndianMarshal.ByteArrayToStructureBigEndian(finfo); - creationTime = DateHandlers.MacToDateTime(prodosinfo.creationDate); + creationTime = DateHandlers.MacToDateTime(prodosinfo.creationDate); lastWriteTime = DateHandlers.MacToDateTime(prodosinfo.modificationDate); } else if(UNIXHome.SequenceEqual(header.homeFilesystem)) { AppleSingleUNIXFileInfo unixinfo = BigEndianMarshal.ByteArrayToStructureBigEndian(finfo); - creationTime = DateHandlers.UnixUnsignedToDateTime(unixinfo.creationDate); + creationTime = DateHandlers.UnixUnsignedToDateTime(unixinfo.creationDate); lastWriteTime = DateHandlers.UnixUnsignedToDateTime(unixinfo.modificationDate); } else if(DOSHome.SequenceEqual(header.homeFilesystem)) @@ -423,6 +425,7 @@ namespace DiscImageChef.Filters lastWriteTime = DateHandlers.DosToDateTime(dosinfo.modificationDate, dosinfo.modificationTime); } + break; case AppleSingleEntryID.ResourceFork: rsrcFork = entry; @@ -430,29 +433,29 @@ namespace DiscImageChef.Filters } fs.Close(); - opened = true; - isPath = true; + opened = true; + isPath = true; basePath = path; } enum AppleSingleEntryID : uint { - Invalid = 0, - DataFork = 1, - ResourceFork = 2, - RealName = 3, - Comment = 4, - Icon = 5, - ColorIcon = 6, - FileInfo = 7, - FileDates = 8, - FinderInfo = 9, - MacFileInfo = 10, + Invalid = 0, + DataFork = 1, + ResourceFork = 2, + RealName = 3, + Comment = 4, + Icon = 5, + ColorIcon = 6, + FileInfo = 7, + FileDates = 8, + FinderInfo = 9, + MacFileInfo = 10, ProDOSFileInfo = 11, - DOSFileInfo = 12, - ShortName = 13, - AFPFileInfo = 14, - DirectoryID = 15 + DOSFileInfo = 12, + ShortName = 13, + AFPFileInfo = 14, + DirectoryID = 15 } [StructLayout(LayoutKind.Sequential, Pack = 1)] @@ -460,7 +463,8 @@ 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; } @@ -509,12 +513,12 @@ namespace DiscImageChef.Filters [StructLayout(LayoutKind.Sequential, Pack = 1)] struct AppleSingleProDOSFileInfo { - public uint creationDate; - public uint modificationDate; - public uint backupDate; + public uint creationDate; + public uint modificationDate; + public uint backupDate; public ushort access; public ushort fileType; - public uint auxType; + public uint auxType; } } } \ No newline at end of file diff --git a/DiscImageChef.Filters/BZip2.cs b/DiscImageChef.Filters/BZip2.cs index b8a93984e..022e392d4 100644 --- a/DiscImageChef.Filters/BZip2.cs +++ b/DiscImageChef.Filters/BZip2.cs @@ -42,23 +42,23 @@ namespace DiscImageChef.Filters /// public class BZip2 : IFilter { - string basePath; + string basePath; DateTime creationTime; - Stream dataStream; - long decompressedSize; - Stream innerStream; + Stream dataStream; + long decompressedSize; + Stream innerStream; DateTime lastWriteTime; - bool opened; + bool opened; public string Name => "BZip2"; - public Guid Id => new Guid("FCCFB0C3-32EF-40D8-9714-2333F6AC72A9"); + public Guid Id => new Guid("FCCFB0C3-32EF-40D8-9714-2333F6AC72A9"); public void Close() { dataStream?.Close(); dataStream = null; - basePath = null; - opened = false; + basePath = null; + opened = false; } public string GetBasePath() @@ -122,7 +122,7 @@ namespace DiscImageChef.Filters if(!File.Exists(path)) return false; FileStream stream = new FileStream(path, FileMode.Open, FileAccess.Read); - byte[] buffer = new byte[4]; + byte[] buffer = new byte[4]; stream.Seek(0, SeekOrigin.Begin); stream.Read(buffer, 0, 4); @@ -142,37 +142,37 @@ namespace DiscImageChef.Filters public void Open(byte[] buffer) { - dataStream = new MemoryStream(buffer); - basePath = null; - creationTime = DateTime.UtcNow; - lastWriteTime = creationTime; - innerStream = new ForcedSeekStream(dataStream, CompressionMode.Decompress, false, false); + dataStream = new MemoryStream(buffer); + basePath = null; + creationTime = DateTime.UtcNow; + lastWriteTime = creationTime; + innerStream = new ForcedSeekStream(dataStream, CompressionMode.Decompress, false, false); decompressedSize = innerStream.Length; - opened = true; + opened = true; } public void Open(Stream stream) { - dataStream = stream; - basePath = null; - creationTime = DateTime.UtcNow; - lastWriteTime = creationTime; - innerStream = new ForcedSeekStream(dataStream, CompressionMode.Decompress, false, false); + dataStream = stream; + basePath = null; + creationTime = DateTime.UtcNow; + lastWriteTime = creationTime; + innerStream = new ForcedSeekStream(dataStream, CompressionMode.Decompress, false, false); decompressedSize = innerStream.Length; - opened = true; + opened = true; } public void Open(string path) { dataStream = new FileStream(path, FileMode.Open, FileAccess.Read); - basePath = Path.GetFullPath(path); + basePath = Path.GetFullPath(path); FileInfo fi = new FileInfo(path); - creationTime = fi.CreationTimeUtc; - lastWriteTime = fi.LastWriteTimeUtc; - innerStream = new ForcedSeekStream(dataStream, CompressionMode.Decompress, false, false); + creationTime = fi.CreationTimeUtc; + lastWriteTime = fi.LastWriteTimeUtc; + innerStream = new ForcedSeekStream(dataStream, CompressionMode.Decompress, false, false); decompressedSize = innerStream.Length; - opened = true; + opened = true; } public DateTime GetCreationTime() diff --git a/DiscImageChef.Filters/Filters.cs b/DiscImageChef.Filters/Filters.cs index 3a9210ca3..c80ab37af 100644 --- a/DiscImageChef.Filters/Filters.cs +++ b/DiscImageChef.Filters/Filters.cs @@ -49,7 +49,7 @@ namespace DiscImageChef.Filters public FiltersList() { Assembly assembly = Assembly.GetAssembly(typeof(IFilter)); - Filters = new SortedDictionary(); + Filters = new SortedDictionary(); foreach(Type type in assembly.GetTypes().Where(t => t.GetInterfaces().Contains(typeof(IFilter)))) try diff --git a/DiscImageChef.Filters/ForcedSeekStream.cs b/DiscImageChef.Filters/ForcedSeekStream.cs index 0d3f7dd6e..102f4b923 100644 --- a/DiscImageChef.Filters/ForcedSeekStream.cs +++ b/DiscImageChef.Filters/ForcedSeekStream.cs @@ -41,11 +41,11 @@ namespace DiscImageChef.Filters /// public class ForcedSeekStream : Stream where T : Stream { - const int BUFFER_LEN = 1048576; - string backFile; + const int BUFFER_LEN = 1048576; + string backFile; FileStream backStream; - T baseStream; - long streamLength; + T baseStream; + long streamLength; /// /// Initializes a new instance of the class. @@ -55,9 +55,9 @@ namespace DiscImageChef.Filters public ForcedSeekStream(long length, params object[] args) { streamLength = length; - baseStream = (T)Activator.CreateInstance(typeof(T), args); - backFile = Path.GetTempFileName(); - backStream = new FileStream(backFile, FileMode.Open, FileAccess.ReadWrite, FileShare.None); + baseStream = (T)Activator.CreateInstance(typeof(T), args); + backFile = Path.GetTempFileName(); + backStream = new FileStream(backFile, FileMode.Open, FileAccess.ReadWrite, FileShare.None); if(length == 0) CalculateLength(); } @@ -68,7 +68,7 @@ namespace DiscImageChef.Filters public ForcedSeekStream(params object[] args) { baseStream = (T)Activator.CreateInstance(typeof(T), args); - backFile = Path.GetTempFileName(); + backFile = Path.GetTempFileName(); backStream = new FileStream(backFile, FileMode.Open, FileAccess.ReadWrite, FileShare.None); CalculateLength(); } @@ -105,7 +105,7 @@ namespace DiscImageChef.Filters } while(read == BUFFER_LEN); - streamLength = backStream.Length; + streamLength = backStream.Length; backStream.Position = 0; } @@ -120,9 +120,9 @@ namespace DiscImageChef.Filters } backStream.Position = backStream.Length; - long toposition = position - backStream.Position; - int fullBufferReads = (int)(toposition / BUFFER_LEN); - int restToRead = (int)(toposition % BUFFER_LEN); + long toposition = position - backStream.Position; + int fullBufferReads = (int)(toposition / BUFFER_LEN); + int restToRead = (int)(toposition % BUFFER_LEN); byte[] buffer; for(int i = 0; i < fullBufferReads; i++) diff --git a/DiscImageChef.Filters/GZip.cs b/DiscImageChef.Filters/GZip.cs index 5c6c59b93..789b5951c 100644 --- a/DiscImageChef.Filters/GZip.cs +++ b/DiscImageChef.Filters/GZip.cs @@ -41,23 +41,23 @@ namespace DiscImageChef.Filters /// public class GZip : IFilter { - string basePath; + string basePath; DateTime creationTime; - Stream dataStream; - uint decompressedSize; + Stream dataStream; + uint decompressedSize; DateTime lastWriteTime; - bool opened; - Stream zStream; + bool opened; + Stream zStream; public string Name => "GZip"; - public Guid Id => new Guid("F4996661-4A29-42C9-A2C7-3904EF40F3B0"); + public Guid Id => new Guid("F4996661-4A29-42C9-A2C7-3904EF40F3B0"); public void Close() { dataStream?.Close(); dataStream = null; - basePath = null; - opened = false; + basePath = null; + opened = false; } public string GetBasePath() @@ -106,7 +106,7 @@ namespace DiscImageChef.Filters if(!File.Exists(path)) return false; FileStream stream = new FileStream(path, FileMode.Open, FileAccess.Read); - byte[] buffer = new byte[3]; + byte[] buffer = new byte[3]; stream.Seek(0, SeekOrigin.Begin); stream.Read(buffer, 0, 3); @@ -121,7 +121,7 @@ namespace DiscImageChef.Filters byte[] isize_b = new byte[4]; dataStream = new MemoryStream(buffer); - basePath = null; + basePath = null; dataStream.Seek(4, SeekOrigin.Begin); dataStream.Read(mtime_b, 0, 4); @@ -133,9 +133,10 @@ namespace DiscImageChef.Filters uint isize = BitConverter.ToUInt32(isize_b, 0); decompressedSize = isize; - creationTime = DateHandlers.UnixUnsignedToDateTime(mtime); - lastWriteTime = creationTime; - zStream = new ForcedSeekStream(decompressedSize, dataStream, CompressionMode.Decompress); + creationTime = DateHandlers.UnixUnsignedToDateTime(mtime); + lastWriteTime = creationTime; + zStream = + new ForcedSeekStream(decompressedSize, dataStream, CompressionMode.Decompress); opened = true; } @@ -145,7 +146,7 @@ namespace DiscImageChef.Filters byte[] isize_b = new byte[4]; dataStream = stream; - basePath = null; + basePath = null; dataStream.Seek(4, SeekOrigin.Begin); dataStream.Read(mtime_b, 0, 4); @@ -157,9 +158,10 @@ namespace DiscImageChef.Filters uint isize = BitConverter.ToUInt32(isize_b, 0); decompressedSize = isize; - creationTime = DateHandlers.UnixUnsignedToDateTime(mtime); - lastWriteTime = creationTime; - zStream = new ForcedSeekStream(decompressedSize, dataStream, CompressionMode.Decompress); + creationTime = DateHandlers.UnixUnsignedToDateTime(mtime); + lastWriteTime = creationTime; + zStream = + new ForcedSeekStream(decompressedSize, dataStream, CompressionMode.Decompress); opened = true; } @@ -169,7 +171,7 @@ namespace DiscImageChef.Filters byte[] isize_b = new byte[4]; dataStream = new FileStream(path, FileMode.Open, FileAccess.Read); - basePath = Path.GetFullPath(path); + basePath = Path.GetFullPath(path); dataStream.Seek(4, SeekOrigin.Begin); dataStream.Read(mtime_b, 0, 4); @@ -182,10 +184,10 @@ namespace DiscImageChef.Filters decompressedSize = isize; FileInfo fi = new FileInfo(path); - creationTime = fi.CreationTimeUtc; + creationTime = fi.CreationTimeUtc; lastWriteTime = DateHandlers.UnixUnsignedToDateTime(mtime); - zStream = new ForcedSeekStream(decompressedSize, dataStream, CompressionMode.Decompress); - opened = true; + zStream = new ForcedSeekStream(decompressedSize, dataStream, CompressionMode.Decompress); + opened = true; } public DateTime GetCreationTime() diff --git a/DiscImageChef.Filters/LZip.cs b/DiscImageChef.Filters/LZip.cs index c0b8053df..60c321104 100644 --- a/DiscImageChef.Filters/LZip.cs +++ b/DiscImageChef.Filters/LZip.cs @@ -42,23 +42,23 @@ namespace DiscImageChef.Filters /// public class LZip : IFilter { - string basePath; + string basePath; DateTime creationTime; - Stream dataStream; - long decompressedSize; - Stream innerStream; + Stream dataStream; + long decompressedSize; + Stream innerStream; DateTime lastWriteTime; - bool opened; + bool opened; public string Name => "LZip"; - public Guid Id => new Guid("09D715E9-20C0-48B1-A8D9-D8897CEC57C9"); + public Guid Id => new Guid("09D715E9-20C0-48B1-A8D9-D8897CEC57C9"); public void Close() { dataStream?.Close(); dataStream = null; - basePath = null; - opened = false; + basePath = null; + opened = false; } public string GetBasePath() @@ -109,7 +109,7 @@ namespace DiscImageChef.Filters if(!File.Exists(path)) return false; FileStream stream = new FileStream(path, FileMode.Open, FileAccess.Read); - byte[] buffer = new byte[5]; + byte[] buffer = new byte[5]; stream.Seek(0, SeekOrigin.Begin); stream.Read(buffer, 0, 5); @@ -121,10 +121,10 @@ namespace DiscImageChef.Filters public void Open(byte[] buffer) { - dataStream = new MemoryStream(buffer); - basePath = null; - creationTime = DateTime.UtcNow; - lastWriteTime = creationTime; + dataStream = new MemoryStream(buffer); + basePath = null; + creationTime = DateTime.UtcNow; + lastWriteTime = creationTime; decompressedSize = BitConverter.ToInt64(buffer, buffer.Length - 16); innerStream = new ForcedSeekStream(decompressedSize, dataStream, CompressionMode.Decompress, false); @@ -133,9 +133,9 @@ namespace DiscImageChef.Filters public void Open(Stream stream) { - dataStream = stream; - basePath = null; - creationTime = DateTime.UtcNow; + dataStream = stream; + basePath = null; + creationTime = DateTime.UtcNow; lastWriteTime = creationTime; byte[] tmp = new byte[8]; dataStream.Seek(-16, SeekOrigin.End); @@ -150,10 +150,10 @@ namespace DiscImageChef.Filters public void Open(string path) { dataStream = new FileStream(path, FileMode.Open, FileAccess.Read); - basePath = Path.GetFullPath(path); + basePath = Path.GetFullPath(path); FileInfo fi = new FileInfo(path); - creationTime = fi.CreationTimeUtc; + creationTime = fi.CreationTimeUtc; lastWriteTime = fi.LastWriteTimeUtc; byte[] tmp = new byte[8]; dataStream.Seek(-16, SeekOrigin.End); diff --git a/DiscImageChef.Filters/MacBinary.cs b/DiscImageChef.Filters/MacBinary.cs index c2387651d..d68c281cd 100644 --- a/DiscImageChef.Filters/MacBinary.cs +++ b/DiscImageChef.Filters/MacBinary.cs @@ -44,29 +44,29 @@ namespace DiscImageChef.Filters public class MacBinary : IFilter { const uint MACBINARY_MAGIC = 0x6D42494E; - string basePath; - byte[] bytes; - DateTime creationTime; + string basePath; + byte[] bytes; + DateTime creationTime; - long dataForkOff; - string filename; + long dataForkOff; + string filename; MacBinaryHeader header; - bool isBytes, isStream, isPath, opened; - DateTime lastWriteTime; - long rsrcForkOff; - Stream stream; + bool isBytes, isStream, isPath, opened; + DateTime lastWriteTime; + long rsrcForkOff; + Stream stream; public string Name => "MacBinary"; - public Guid Id => new Guid("D7C321D3-E51F-45DF-A150-F6BFDF0D7704"); + public Guid Id => new Guid("D7C321D3-E51F-45DF-A150-F6BFDF0D7704"); public void Close() { bytes = null; stream?.Close(); - isBytes = false; + isBytes = false; isStream = false; - isPath = false; - opened = false; + isPath = false; + opened = false; } public string GetBasePath() @@ -88,7 +88,7 @@ namespace DiscImageChef.Filters { if(header.dataLength == 0) return null; - if(isBytes) return new OffsetStream(bytes, 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, @@ -131,7 +131,7 @@ namespace DiscImageChef.Filters { if(header.resourceLength == 0) return null; - if(isBytes) return new OffsetStream(bytes, 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, @@ -153,8 +153,9 @@ namespace DiscImageChef.Filters Array.Copy(buffer, 0, hdr_b, 0, 128); header = BigEndianMarshal.ByteArrayToStructureBigEndian(hdr_b); - return header.magic == MACBINARY_MAGIC || header.version == 0 && header.filename[0] > 0 && - header.filename[0] < 64 && header.zero1 == 0 && header.zero2 == 0 && header.reserved == 0 && + return header.magic == MACBINARY_MAGIC || 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); } @@ -167,8 +168,9 @@ namespace DiscImageChef.Filters stream.Read(hdr_b, 0, 128); header = BigEndianMarshal.ByteArrayToStructureBigEndian(hdr_b); - return header.magic == MACBINARY_MAGIC || header.version == 0 && header.filename[0] > 0 && - header.filename[0] < 64 && header.zero1 == 0 && header.zero2 == 0 && header.reserved == 0 && + return header.magic == MACBINARY_MAGIC || 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); } @@ -182,8 +184,9 @@ namespace DiscImageChef.Filters header = BigEndianMarshal.ByteArrayToStructureBigEndian(hdr_b); fstream.Close(); - return header.magic == MACBINARY_MAGIC || header.version == 0 && header.filename[0] > 0 && - header.filename[0] < 64 && header.zero1 == 0 && header.zero2 == 0 && header.reserved == 0 && + return header.magic == MACBINARY_MAGIC || 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); } @@ -203,20 +206,20 @@ namespace DiscImageChef.Filters uint blocks = 1; blocks += (uint)(header.secondaryHeaderLength / 128); - if(header.secondaryHeaderLength % 128 > 0) blocks++; - dataForkOff = blocks * 128; - blocks += header.dataLength / 128; - if(header.dataLength % 128 > 0) blocks++; - rsrcForkOff = blocks * 128; + if(header.secondaryHeaderLength % 128 > 0) blocks++; + dataForkOff = blocks * 128; + blocks += header.dataLength / 128; + if(header.dataLength % 128 > 0) blocks++; + rsrcForkOff = blocks * 128; - filename = StringHandlers.PascalToString(header.filename, Encoding.GetEncoding("macintosh")); - creationTime = DateHandlers.MacToDateTime(header.creationTime); + filename = StringHandlers.PascalToString(header.filename, Encoding.GetEncoding("macintosh")); + creationTime = DateHandlers.MacToDateTime(header.creationTime); lastWriteTime = DateHandlers.MacToDateTime(header.modificationTime); ms.Close(); - opened = true; + opened = true; isBytes = true; - bytes = buffer; + bytes = buffer; } public void Open(Stream stream) @@ -229,19 +232,19 @@ namespace DiscImageChef.Filters uint blocks = 1; blocks += (uint)(header.secondaryHeaderLength / 128); - if(header.secondaryHeaderLength % 128 > 0) blocks++; - dataForkOff = blocks * 128; - blocks += header.dataLength / 128; - if(header.dataLength % 128 > 0) blocks++; - rsrcForkOff = blocks * 128; + if(header.secondaryHeaderLength % 128 > 0) blocks++; + dataForkOff = blocks * 128; + blocks += header.dataLength / 128; + if(header.dataLength % 128 > 0) blocks++; + rsrcForkOff = blocks * 128; - filename = StringHandlers.PascalToString(header.filename, Encoding.GetEncoding("macintosh")); - creationTime = DateHandlers.MacToDateTime(header.creationTime); + filename = StringHandlers.PascalToString(header.filename, Encoding.GetEncoding("macintosh")); + creationTime = DateHandlers.MacToDateTime(header.creationTime); lastWriteTime = DateHandlers.MacToDateTime(header.modificationTime); stream.Seek(0, SeekOrigin.Begin); - opened = true; - isStream = true; + opened = true; + isStream = true; this.stream = stream; } @@ -256,19 +259,19 @@ namespace DiscImageChef.Filters uint blocks = 1; blocks += (uint)(header.secondaryHeaderLength / 128); - if(header.secondaryHeaderLength % 128 > 0) blocks++; - dataForkOff = blocks * 128; - blocks += header.dataLength / 128; - if(header.dataLength % 128 > 0) blocks++; - rsrcForkOff = blocks * 128; + if(header.secondaryHeaderLength % 128 > 0) blocks++; + dataForkOff = blocks * 128; + blocks += header.dataLength / 128; + if(header.dataLength % 128 > 0) blocks++; + rsrcForkOff = blocks * 128; - filename = StringHandlers.PascalToString(header.filename, Encoding.GetEncoding("macintosh")); - creationTime = DateHandlers.MacToDateTime(header.creationTime); + filename = StringHandlers.PascalToString(header.filename, Encoding.GetEncoding("macintosh")); + creationTime = DateHandlers.MacToDateTime(header.creationTime); lastWriteTime = DateHandlers.MacToDateTime(header.modificationTime); fs.Close(); - opened = true; - isPath = true; + opened = true; + isPath = true; basePath = path; } @@ -282,7 +285,8 @@ namespace DiscImageChef.Filters /// /// 0x01, Str63 Pascal filename /// - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 64)] public byte[] filename; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 64)] + public byte[] filename; /// /// 0x41, File type /// diff --git a/DiscImageChef.Filters/OffsetStream.cs b/DiscImageChef.Filters/OffsetStream.cs index 3d3260335..f65331ce0 100644 --- a/DiscImageChef.Filters/OffsetStream.cs +++ b/DiscImageChef.Filters/OffsetStream.cs @@ -43,8 +43,8 @@ namespace DiscImageChef.Filters public class OffsetStream : Stream { readonly Stream baseStream; - readonly long streamEnd; - readonly long streamStart; + readonly long streamEnd; + readonly long streamStart; public OffsetStream(Stream stream, long start, long end) { @@ -53,22 +53,22 @@ namespace DiscImageChef.Filters if(end < 0) throw new ArgumentOutOfRangeException(nameof(end), "End can't be a negative number."); streamStart = start; - streamEnd = end; + streamEnd = end; baseStream = stream; 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(end < 0) throw new ArgumentOutOfRangeException(nameof(end), "End can't be a negative number."); streamStart = start; - streamEnd = end; + streamEnd = end; baseStream = new FileStream(path, mode, access, share, bufferSize, options); @@ -82,7 +82,7 @@ namespace DiscImageChef.Filters if(end < 0) throw new ArgumentOutOfRangeException(nameof(end), "End can't be a negative number."); streamStart = start; - streamEnd = end; + streamEnd = end; baseStream = new FileStream(handle, access); @@ -96,7 +96,7 @@ namespace DiscImageChef.Filters if(end < 0) throw new ArgumentOutOfRangeException(nameof(end), "End can't be a negative number."); streamStart = start; - streamEnd = end; + streamEnd = end; baseStream = new FileStream(handle, access, bufferSize); @@ -104,21 +104,22 @@ namespace DiscImageChef.Filters } public OffsetStream(SafeFileHandle handle, FileAccess access, int bufferSize, bool isAsync, long start, - long end) + long end) { 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."); streamStart = start; - streamEnd = end; + streamEnd = end; baseStream = new FileStream(handle, access, bufferSize, isAsync); 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, + 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."); @@ -126,14 +127,15 @@ namespace DiscImageChef.Filters if(end < 0) throw new ArgumentOutOfRangeException(nameof(end), "End can't be a negative number."); streamStart = start; - streamEnd = end; + 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."); } - public OffsetStream(string path, FileMode mode, FileSystemRights rights, FileShare share, int bufferSize, + 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."); @@ -141,22 +143,22 @@ namespace DiscImageChef.Filters if(end < 0) throw new ArgumentOutOfRangeException(nameof(end), "End can't be a negative number."); streamStart = start; - streamEnd = end; + 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."); } - 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(end < 0) throw new ArgumentOutOfRangeException(nameof(end), "End can't be a negative number."); streamStart = start; - streamEnd = end; + streamEnd = end; baseStream = new FileStream(path, mode, access, share, bufferSize, useAsync); @@ -164,14 +166,14 @@ namespace DiscImageChef.Filters } public OffsetStream(string path, FileMode mode, FileAccess access, FileShare share, int bufferSize, long start, - long end) + long end) { 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."); streamStart = start; - streamEnd = end; + streamEnd = end; baseStream = new FileStream(path, mode, access, share, bufferSize); @@ -185,7 +187,7 @@ namespace DiscImageChef.Filters if(end < 0) throw new ArgumentOutOfRangeException(nameof(end), "End can't be a negative number."); streamStart = start; - streamEnd = end; + streamEnd = end; baseStream = new FileStream(path, mode, access, share); @@ -199,7 +201,7 @@ namespace DiscImageChef.Filters if(end < 0) throw new ArgumentOutOfRangeException(nameof(end), "End can't be a negative number."); streamStart = start; - streamEnd = end; + streamEnd = end; baseStream = new FileStream(path, mode, access); @@ -213,7 +215,7 @@ namespace DiscImageChef.Filters if(end < 0) throw new ArgumentOutOfRangeException(nameof(end), "End can't be a negative number."); streamStart = start; - streamEnd = end; + streamEnd = end; baseStream = new FileStream(path, mode); @@ -221,14 +223,14 @@ namespace DiscImageChef.Filters } public OffsetStream(byte[] buffer, int index, int count, bool writable, bool publiclyVisible, long start, - long end) + long end) { 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."); streamStart = start; - streamEnd = end; + streamEnd = end; baseStream = new MemoryStream(buffer, index, count, writable, publiclyVisible); @@ -242,7 +244,7 @@ namespace DiscImageChef.Filters if(end < 0) throw new ArgumentOutOfRangeException(nameof(end), "End can't be a negative number."); streamStart = start; - streamEnd = end; + streamEnd = end; baseStream = new MemoryStream(buffer, index, count, writable); @@ -256,7 +258,7 @@ namespace DiscImageChef.Filters if(end < 0) throw new ArgumentOutOfRangeException(nameof(end), "End can't be a negative number."); streamStart = start; - streamEnd = end; + streamEnd = end; baseStream = new MemoryStream(buffer, index, count); @@ -270,7 +272,7 @@ namespace DiscImageChef.Filters if(end < 0) throw new ArgumentOutOfRangeException(nameof(end), "End can't be a negative number."); streamStart = start; - streamEnd = end; + streamEnd = end; baseStream = new MemoryStream(buffer, writable); @@ -284,7 +286,7 @@ namespace DiscImageChef.Filters if(end < 0) throw new ArgumentOutOfRangeException(nameof(end), "End can't be a negative number."); streamStart = start; - streamEnd = end; + streamEnd = end; baseStream = new MemoryStream(buffer); diff --git a/DiscImageChef.Filters/PCExchange.cs b/DiscImageChef.Filters/PCExchange.cs index 6804b8a24..9767d84c7 100644 --- a/DiscImageChef.Filters/PCExchange.cs +++ b/DiscImageChef.Filters/PCExchange.cs @@ -44,21 +44,21 @@ namespace DiscImageChef.Filters /// public class PCExchange : IFilter { - const string FILE_ID = "FILEID.DAT"; + const string FILE_ID = "FILEID.DAT"; const string FINDER_INFO = "FINDER.DAT"; - const string RESOURCES = "RESOURCE.FRK"; - string basePath; - DateTime creationTime; - long dataLen; - string dataPath; - DateTime lastWriteTime; + const string RESOURCES = "RESOURCE.FRK"; + string basePath; + DateTime creationTime; + long dataLen; + string dataPath; + DateTime lastWriteTime; - bool opened; - long rsrcLen; + bool opened; + long rsrcLen; string rsrcPath; public string Name => "PCExchange"; - public Guid Id => new Guid("9264EB9F-D634-4F9B-BE12-C24CD44988C6"); + public Guid Id => new Guid("9264EB9F-D634-4F9B-BE12-C24CD44988C6"); public void Close() { @@ -155,16 +155,17 @@ namespace DiscImageChef.Filters while(finderDatStream.Position + 0x5C <= finderDatStream.Length) { - PCExchangeEntry datEntry = new PCExchangeEntry(); - byte[] datEntry_b = new byte[Marshal.SizeOf(datEntry)]; + PCExchangeEntry datEntry = new PCExchangeEntry(); + byte[] datEntry_b = new byte[Marshal.SizeOf(datEntry)]; finderDatStream.Read(datEntry_b, 0, Marshal.SizeOf(datEntry)); datEntry = BigEndianMarshal.ByteArrayToStructureBigEndian(datEntry_b); // TODO: Add support for encoding on filters - string macName = StringHandlers.PascalToString(datEntry.macName, Encoding.GetEncoding("macintosh")); + string macName = + StringHandlers.PascalToString(datEntry.macName, Encoding.GetEncoding("macintosh")); byte[] tmpDosName_b = new byte[8]; - byte[] tmpDosExt_b = new byte[3]; + byte[] tmpDosExt_b = new byte[3]; Array.Copy(datEntry.dosName, 0, tmpDosName_b, 0, 8); - Array.Copy(datEntry.dosName, 8, tmpDosExt_b, 0, 3); + Array.Copy(datEntry.dosName, 8, tmpDosExt_b, 0, 3); string dosName = Encoding.ASCII.GetString(tmpDosName_b).Trim() + "." + Encoding.ASCII.GetString(tmpDosExt_b).Trim(); string dosNameLow = dosName.ToLower(CultureInfo.CurrentCulture); @@ -173,7 +174,7 @@ namespace DiscImageChef.Filters dataFound |= File.Exists(Path.Combine(parentFolder, macName ?? throw new InvalidOperationException())) || - File.Exists(Path.Combine(parentFolder, dosName)) || + File.Exists(Path.Combine(parentFolder, dosName)) || File.Exists(Path.Combine(parentFolder, dosNameLow)); rsrcFound |= File.Exists(Path.Combine(parentFolder, RESOURCES, dosName)) || @@ -213,15 +214,16 @@ namespace DiscImageChef.Filters while(finderDatStream.Position + 0x5C <= finderDatStream.Length) { - PCExchangeEntry datEntry = new PCExchangeEntry(); - byte[] datEntry_b = new byte[Marshal.SizeOf(datEntry)]; + PCExchangeEntry datEntry = new PCExchangeEntry(); + byte[] datEntry_b = new byte[Marshal.SizeOf(datEntry)]; finderDatStream.Read(datEntry_b, 0, Marshal.SizeOf(datEntry)); datEntry = BigEndianMarshal.ByteArrayToStructureBigEndian(datEntry_b); - string macName = StringHandlers.PascalToString(datEntry.macName, Encoding.GetEncoding("macintosh")); + string macName = + StringHandlers.PascalToString(datEntry.macName, Encoding.GetEncoding("macintosh")); byte[] tmpDosName_b = new byte[8]; - byte[] tmpDosExt_b = new byte[3]; + byte[] tmpDosExt_b = new byte[3]; Array.Copy(datEntry.dosName, 0, tmpDosName_b, 0, 8); - Array.Copy(datEntry.dosName, 8, tmpDosExt_b, 0, 3); + Array.Copy(datEntry.dosName, 8, tmpDosExt_b, 0, 3); string dosName = Encoding.ASCII.GetString(tmpDosName_b).Trim() + "." + Encoding.ASCII.GetString(tmpDosExt_b).Trim(); string dosNameLow = dosName.ToLower(CultureInfo.CurrentCulture); @@ -233,17 +235,17 @@ namespace DiscImageChef.Filters 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); + dataPath = Path.Combine(parentFolder, dosNameLow); 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); + rsrcPath = Path.Combine(parentFolder, RESOURCES, dosNameLow); else rsrcPath = null; lastWriteTime = DateHandlers.MacToDateTime(datEntry.modificationDate); - creationTime = DateHandlers.MacToDateTime(datEntry.creationDate); + creationTime = DateHandlers.MacToDateTime(datEntry.creationDate); break; } @@ -252,7 +254,7 @@ namespace DiscImageChef.Filters rsrcLen = new FileInfo(rsrcPath ?? throw new InvalidOperationException()).Length; basePath = path; - opened = true; + opened = true; finderDatStream.Close(); } @@ -264,7 +266,8 @@ 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. /// - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] public byte[] macName; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] + public byte[] macName; /// /// File type /// @@ -288,7 +291,8 @@ namespace DiscImageChef.Filters /// /// Unknown, all bytes are empty but last, except in volume's label entry /// - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 18)] public byte[] unknown1; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 18)] + public byte[] unknown1; /// /// File's creation date /// @@ -310,7 +314,8 @@ namespace DiscImageChef.Filters /// Name as in FAT entry (not LFN). /// Resource fork file is always using this name, never LFN. /// - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 11)] public byte[] dosName; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 11)] + public byte[] dosName; /// /// Unknown, flags? /// diff --git a/DiscImageChef.Filters/XZ.cs b/DiscImageChef.Filters/XZ.cs index 8c795b9b6..2adefbf58 100644 --- a/DiscImageChef.Filters/XZ.cs +++ b/DiscImageChef.Filters/XZ.cs @@ -41,23 +41,23 @@ namespace DiscImageChef.Filters /// public class XZ : IFilter { - string basePath; + string basePath; DateTime creationTime; - Stream dataStream; - long decompressedSize; - Stream innerStream; + Stream dataStream; + long decompressedSize; + Stream innerStream; DateTime lastWriteTime; - bool opened; + bool opened; public string Name => "XZ"; - public Guid Id => new Guid("666A8617-0444-4C05-9F4F-DF0FD758D0D2"); + public Guid Id => new Guid("666A8617-0444-4C05-9F4F-DF0FD758D0D2"); public void Close() { dataStream?.Close(); dataStream = null; - basePath = null; - opened = false; + basePath = null; + opened = false; } public string GetBasePath() @@ -87,9 +87,9 @@ namespace DiscImageChef.Filters public bool Identify(byte[] buffer) { - return buffer[0] == 0xFD && buffer[1] == 0x37 && buffer[2] == 0x7A && buffer[3] == 0x58 && + 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; + buffer[buffer.Length - 1] == 0x5A; } public bool Identify(Stream stream) @@ -112,12 +112,12 @@ namespace DiscImageChef.Filters if(!File.Exists(path)) return false; FileStream stream = new FileStream(path, FileMode.Open, FileAccess.Read); - byte[] buffer = new byte[6]; - byte[] footer = new byte[2]; + byte[] buffer = new byte[6]; + byte[] footer = new byte[2]; stream.Seek(0, SeekOrigin.Begin); stream.Read(buffer, 0, 6); - stream.Seek(0, SeekOrigin.Begin); + stream.Seek(0, SeekOrigin.Begin); stream.Seek(-2, SeekOrigin.End); stream.Read(footer, 0, 2); stream.Seek(0, SeekOrigin.Begin); @@ -126,85 +126,39 @@ namespace DiscImageChef.Filters buffer[4] == 0x5A && buffer[5] == 0x00 && footer[0] == 0x59 && footer[1] == 0x5A; } - void GuessSize() - { - decompressedSize = 0; - // Seek to footer backwards size field - dataStream.Seek(-8, SeekOrigin.End); - byte[] tmp = new byte[4]; - dataStream.Read(tmp, 0, 4); - uint backwardSize = (BitConverter.ToUInt32(tmp, 0) + 1) * 4; - // Seek to first indexed record - dataStream.Seek(-12 - (backwardSize - 2), SeekOrigin.End); - - // Skip compressed size - tmp = new byte[backwardSize - 2]; - dataStream.Read(tmp, 0, tmp.Length); - ulong number = 0; - int ignore = Decode(tmp, tmp.Length, ref number); - - // Get compressed size - dataStream.Seek(-12 - (backwardSize - 2 - ignore), SeekOrigin.End); - tmp = new byte[backwardSize - 2 - ignore]; - dataStream.Read(tmp, 0, tmp.Length); - Decode(tmp, tmp.Length, ref number); - decompressedSize = (long)number; - - dataStream.Seek(0, SeekOrigin.Begin); - } - - int Decode(byte[] buf, int sizeMax, ref ulong num) - { - if(sizeMax == 0) return 0; - - if(sizeMax > 9) sizeMax = 9; - - num = (ulong)(buf[0] & 0x7F); - int i = 0; - - while((buf[i++] & 0x80) == 0x80) - { - if(i >= sizeMax || buf[i] == 0x00) return 0; - - num |= (ulong)(buf[i] & 0x7F) << (i * 7); - } - - return i; - } - public void Open(byte[] buffer) { - dataStream = new MemoryStream(buffer); - basePath = null; - creationTime = DateTime.UtcNow; + dataStream = new MemoryStream(buffer); + basePath = null; + creationTime = DateTime.UtcNow; lastWriteTime = creationTime; GuessSize(); innerStream = new ForcedSeekStream(decompressedSize, dataStream); - opened = true; + opened = true; } public void Open(Stream stream) { - dataStream = stream; - basePath = null; - creationTime = DateTime.UtcNow; + dataStream = stream; + basePath = null; + creationTime = DateTime.UtcNow; lastWriteTime = creationTime; GuessSize(); innerStream = new ForcedSeekStream(decompressedSize, dataStream); - opened = true; + opened = true; } public void Open(string path) { dataStream = new FileStream(path, FileMode.Open, FileAccess.Read); - basePath = Path.GetFullPath(path); + basePath = Path.GetFullPath(path); FileInfo fi = new FileInfo(path); - creationTime = fi.CreationTimeUtc; + creationTime = fi.CreationTimeUtc; lastWriteTime = fi.LastWriteTimeUtc; GuessSize(); innerStream = new ForcedSeekStream(decompressedSize, dataStream); - opened = true; + opened = true; } public DateTime GetCreationTime() @@ -251,5 +205,51 @@ namespace DiscImageChef.Filters { return opened; } + + void GuessSize() + { + decompressedSize = 0; + // Seek to footer backwards size field + dataStream.Seek(-8, SeekOrigin.End); + byte[] tmp = new byte[4]; + dataStream.Read(tmp, 0, 4); + uint backwardSize = (BitConverter.ToUInt32(tmp, 0) + 1) * 4; + // Seek to first indexed record + dataStream.Seek(-12 - (backwardSize - 2), SeekOrigin.End); + + // Skip compressed size + tmp = new byte[backwardSize - 2]; + dataStream.Read(tmp, 0, tmp.Length); + ulong number = 0; + int ignore = Decode(tmp, tmp.Length, ref number); + + // Get compressed size + dataStream.Seek(-12 - (backwardSize - 2 - ignore), SeekOrigin.End); + tmp = new byte[backwardSize - 2 - ignore]; + dataStream.Read(tmp, 0, tmp.Length); + Decode(tmp, tmp.Length, ref number); + decompressedSize = (long)number; + + dataStream.Seek(0, SeekOrigin.Begin); + } + + int Decode(byte[] buf, int sizeMax, ref ulong num) + { + if(sizeMax == 0) return 0; + + if(sizeMax > 9) sizeMax = 9; + + num = (ulong)(buf[0] & 0x7F); + int i = 0; + + while((buf[i++] & 0x80) == 0x80) + { + if(i >= sizeMax || buf[i] == 0x00) return 0; + + num |= (ulong)(buf[i] & 0x7F) << (i * 7); + } + + return i; + } } } \ No newline at end of file diff --git a/DiscImageChef.Filters/ZZZNoFilter.cs b/DiscImageChef.Filters/ZZZNoFilter.cs index ae45adede..f453aba1b 100644 --- a/DiscImageChef.Filters/ZZZNoFilter.cs +++ b/DiscImageChef.Filters/ZZZNoFilter.cs @@ -40,21 +40,21 @@ namespace DiscImageChef.Filters /// public class ZZZNoFilter : IFilter { - string basePath; + string basePath; DateTime creationTime; - Stream dataStream; + Stream dataStream; DateTime lastWriteTime; - bool opened; + bool opened; public string Name => "No filter"; - public Guid Id => new Guid("12345678-AAAA-BBBB-CCCC-123456789000"); + public Guid Id => new Guid("12345678-AAAA-BBBB-CCCC-123456789000"); public void Close() { dataStream?.Close(); dataStream = null; - basePath = null; - opened = false; + basePath = null; + opened = false; } public string GetBasePath() @@ -100,30 +100,30 @@ namespace DiscImageChef.Filters public void Open(byte[] buffer) { - dataStream = new MemoryStream(buffer); - basePath = null; - creationTime = DateTime.UtcNow; + dataStream = new MemoryStream(buffer); + basePath = null; + creationTime = DateTime.UtcNow; lastWriteTime = creationTime; - opened = true; + opened = true; } public void Open(Stream stream) { - dataStream = stream; - basePath = null; - creationTime = DateTime.UtcNow; + dataStream = stream; + basePath = null; + creationTime = DateTime.UtcNow; lastWriteTime = creationTime; - opened = true; + opened = true; } public void Open(string path) { dataStream = new FileStream(path, FileMode.Open, FileAccess.Read); - basePath = Path.GetFullPath(path); + basePath = Path.GetFullPath(path); FileInfo fi = new FileInfo(path); - creationTime = fi.CreationTimeUtc; + creationTime = fi.CreationTimeUtc; lastWriteTime = fi.LastWriteTimeUtc; - opened = true; + opened = true; } public DateTime GetCreationTime() diff --git a/DiscImageChef.Helpers/BigEndianBitConverter.cs b/DiscImageChef.Helpers/BigEndianBitConverter.cs index b017ce94d..33e2e713c 100644 --- a/DiscImageChef.Helpers/BigEndianBitConverter.cs +++ b/DiscImageChef.Helpers/BigEndianBitConverter.cs @@ -239,7 +239,7 @@ namespace DiscImageChef public static short ToInt16(byte[] value, int startIndex) { return !IsLittleEndian - ? BitConverter.ToInt16(value, startIndex) + ? BitConverter.ToInt16(value, startIndex) : BitConverter.ToInt16(value.Reverse().ToArray(), value.Length - sizeof(short) - startIndex); } @@ -261,7 +261,7 @@ namespace DiscImageChef public static int ToInt32(byte[] value, int startIndex) { return !IsLittleEndian - ? BitConverter.ToInt32(value, startIndex) + ? BitConverter.ToInt32(value, startIndex) : BitConverter.ToInt32(value.Reverse().ToArray(), value.Length - sizeof(int) - startIndex); } @@ -283,7 +283,7 @@ namespace DiscImageChef public static long ToInt64(byte[] value, int startIndex) { return !IsLittleEndian - ? BitConverter.ToInt64(value, startIndex) + ? BitConverter.ToInt64(value, startIndex) : BitConverter.ToInt64(value.Reverse().ToArray(), value.Length - sizeof(long) - startIndex); } @@ -306,7 +306,7 @@ namespace DiscImageChef public static float ToSingle(byte[] value, int startIndex) { return !IsLittleEndian - ? BitConverter.ToSingle(value, startIndex) + ? BitConverter.ToSingle(value, startIndex) : BitConverter.ToSingle(value.Reverse().ToArray(), value.Length - sizeof(float) - startIndex); } @@ -343,7 +343,7 @@ namespace DiscImageChef public static string ToString(byte[] value, int startIndex) { return !IsLittleEndian - ? BitConverter.ToString(value, startIndex) + ? BitConverter.ToString(value, startIndex) : BitConverter.ToString(value.Reverse().ToArray(), startIndex); } @@ -370,7 +370,7 @@ namespace DiscImageChef public static string ToString(byte[] value, int startIndex, int length) { return !IsLittleEndian - ? BitConverter.ToString(value, startIndex, length) + ? BitConverter.ToString(value, startIndex, length) : BitConverter.ToString(value.Reverse().ToArray(), startIndex, length); } @@ -389,7 +389,7 @@ namespace DiscImageChef public static ushort ToUInt16(byte[] value, int startIndex) { return !IsLittleEndian - ? BitConverter.ToUInt16(value, startIndex) + ? BitConverter.ToUInt16(value, startIndex) : BitConverter.ToUInt16(value.Reverse().ToArray(), value.Length - sizeof(ushort) - startIndex); } @@ -411,7 +411,7 @@ namespace DiscImageChef public static uint ToUInt32(byte[] value, int startIndex) { return !IsLittleEndian - ? BitConverter.ToUInt32(value, startIndex) + ? BitConverter.ToUInt32(value, startIndex) : BitConverter.ToUInt32(value.Reverse().ToArray(), value.Length - sizeof(uint) - startIndex); } @@ -433,16 +433,19 @@ namespace DiscImageChef public static ulong ToUInt64(byte[] value, int startIndex) { return !IsLittleEndian - ? BitConverter.ToUInt64(value, startIndex) + ? 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]); + 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/CHS.cs b/DiscImageChef.Helpers/CHS.cs index 29f69b35d..5f7aca7ac 100644 --- a/DiscImageChef.Helpers/CHS.cs +++ b/DiscImageChef.Helpers/CHS.cs @@ -46,7 +46,7 @@ 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 * 16 + head) * 63 + sector - 1 : (cyl * maxHead + head) * maxSector + sector - 1; } } diff --git a/DiscImageChef.Helpers/CompareBytes.cs b/DiscImageChef.Helpers/CompareBytes.cs index 321ce8f1c..e5953b81e 100644 --- a/DiscImageChef.Helpers/CompareBytes.cs +++ b/DiscImageChef.Helpers/CompareBytes.cs @@ -42,20 +42,20 @@ namespace DiscImageChef /// Left array /// Right array public static void CompareBytes(out bool different, out bool sameSize, byte[] compareArray1, - byte[] compareArray2) + byte[] compareArray2) { different = false; - sameSize = true; + sameSize = true; long leastBytes; if(compareArray1.LongLength < compareArray2.LongLength) { - sameSize = false; + sameSize = false; leastBytes = compareArray1.LongLength; } else if(compareArray1.LongLength > compareArray2.LongLength) { - sameSize = false; + sameSize = false; leastBytes = compareArray2.LongLength; } else leastBytes = compareArray1.LongLength; diff --git a/DiscImageChef.Helpers/CountBits.cs b/DiscImageChef.Helpers/CountBits.cs index 3c0b926ca..e2aae95de 100644 --- a/DiscImageChef.Helpers/CountBits.cs +++ b/DiscImageChef.Helpers/CountBits.cs @@ -42,7 +42,7 @@ namespace DiscImageChef.Helpers public static int Count(uint number) { number = number - ((number >> 1) & 0x55555555); - number = (number & 0x33333333) + ((number >> 2) & 0x33333333); + number = (number & 0x33333333) + ((number >> 2) & 0x33333333); return (int)((((number + (number >> 4)) & 0x0F0F0F0F) * 0x01010101) >> 24); } } diff --git a/DiscImageChef.Helpers/DateHandlers.cs b/DiscImageChef.Helpers/DateHandlers.cs index 6014650aa..4d3345432 100644 --- a/DiscImageChef.Helpers/DateHandlers.cs +++ b/DiscImageChef.Helpers/DateHandlers.cs @@ -39,7 +39,7 @@ namespace DiscImageChef public static class DateHandlers { static readonly DateTime LisaEpoch = new DateTime(1901, 1, 1, 0, 0, 0); - static readonly DateTime MacEpoch = new DateTime(1904, 1, 1, 0, 0, 0); + static readonly DateTime MacEpoch = new DateTime(1904, 1, 1, 0, 0, 0); static readonly DateTime UnixEpoch = new DateTime(1970, 1, 1, 0, 0, 0); /// /// Day 0 of Julian Date system @@ -138,7 +138,7 @@ namespace DiscImageChef /// .NET DateTime public static DateTime Iso9660ToDateTime(byte[] vdDateTime) { - byte[] twocharvalue = new byte[2]; + byte[] twocharvalue = new byte[2]; byte[] fourcharvalue = new byte[4]; fourcharvalue[0] = vdDateTime[0]; @@ -228,8 +228,8 @@ namespace DiscImageChef /// .NET DateTime public static DateTime UcsdPascalToDateTime(short dateRecord) { - int year = ((dateRecord & 0xFE00) >> 9) + 1900; - int day = (dateRecord & 0x01F0) >> 4; + int year = ((dateRecord & 0xFE00) >> 9) + 1900; + int day = (dateRecord & 0x01F0) >> 4; int month = dateRecord & 0x000F; DicConsole.DebugWriteLine("UCSDPascalToDateTime handler", @@ -246,11 +246,11 @@ namespace DiscImageChef /// .NET DateTime public static DateTime DosToDateTime(ushort date, ushort time) { - int year = ((date & 0xFE00) >> 9) + 1980; - int month = (date & 0x1E0) >> 5; - int day = date & 0x1F; - int hour = (time & 0xF800) >> 11; - int minute = (time & 0x7E0) >> 5; + int year = ((date & 0xFE00) >> 9) + 1980; + int month = (date & 0x1E0) >> 5; + int day = date & 0x1F; + int hour = (time & 0xF800) >> 11; + int minute = (time & 0x7E0) >> 5; int second = (time & 0x1F) * 2; DicConsole.DebugWriteLine("DOSToDateTime handler", "date = 0x{0:X4}, year = {1}, month = {2}, day = {3}", @@ -273,9 +273,9 @@ namespace DiscImageChef /// .NET DateTime public static DateTime CpmToDateTime(byte[] timestamp) { - ushort days = BitConverter.ToUInt16(timestamp, 0); - int hours = timestamp[2]; - int minutes = timestamp[3]; + ushort days = BitConverter.ToUInt16(timestamp, 0); + int hours = timestamp[2]; + int minutes = timestamp[3]; DateTime temp = AmigaEpoch.AddDays(days); temp = temp.AddHours(hours); @@ -298,20 +298,23 @@ namespace DiscImageChef /// Hundreds of microseconds /// 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) + 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; + long ticks = (long)centiseconds * 100000 + (long)hundredsOfMicroseconds * 1000 + + (long)microseconds * 10; if(specification == 0) return new DateTime(year, month, day, hour, minute, second, DateTimeKind.Utc).AddTicks(ticks); ushort preOffset = (ushort)(typeAndTimeZone & 0xFFF); - short offset; + short offset; if((preOffset & 0x800) == 0x800) offset = (short)(preOffset | 0xF000); - else offset = (short)(preOffset & 0x7FF); + else offset = (short)(preOffset & 0x7FF); if(offset == -2047) return new DateTime(year, month, day, hour, minute, second, DateTimeKind.Unspecified).AddTicks(ticks); @@ -319,7 +322,7 @@ namespace DiscImageChef if(offset < -1440 || offset > 1440) offset = 0; return new DateTimeOffset(year, month, day, hour, minute, second, new TimeSpan(0, offset, 0)) - .AddTicks(ticks).DateTime; + .AddTicks(ticks).DateTime; } /// @@ -347,7 +350,7 @@ namespace DiscImageChef { 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); + : new DateTime(1900 + date[0], date[1], date[2], 0, 0, 0); } catch(ArgumentOutOfRangeException) { os9Date = new DateTime(1900, 0, 0, 0, 0, 0); } @@ -380,15 +383,15 @@ namespace DiscImageChef { try { - int iyear = (year >> 4) * 10 + (year & 0xF); - int imonth = (month >> 4) * 10 + (month & 0xF); - int iday = (day >> 4) * 10 + (day & 0xF); + int iyear = (year >> 4) * 10 + (year & 0xF); + int imonth = (month >> 4) * 10 + (month & 0xF); + int iday = (day >> 4) * 10 + (day & 0xF); int iminute = (minute >> 4) * 10 + (minute & 0xF); - int ihour = (hour >> 4) * 10 + (hour & 0xF); + int ihour = (hour >> 4) * 10 + (hour & 0xF); int isecond = (second >> 4) * 10 + (second & 0xF); if(iyear >= 70) iyear += 1900; - else iyear += 2000; + else iyear += 2000; return new DateTime(iyear, imonth, iday, ihour, iminute, isecond); } diff --git a/DiscImageChef.Helpers/Extents/ExtentsByte.cs b/DiscImageChef.Helpers/Extents/ExtentsByte.cs index 7d52a69a9..ba2b3c678 100644 --- a/DiscImageChef.Helpers/Extents/ExtentsByte.cs +++ b/DiscImageChef.Helpers/Extents/ExtentsByte.cs @@ -135,7 +135,7 @@ namespace Extents { byte realEnd; if(run) realEnd = (byte)(start + end - 1); - else realEnd = end; + else realEnd = end; // TODO: Optimize this for(byte t = start; t <= realEnd; t++) Add(t); @@ -177,7 +177,7 @@ namespace Extents { toRemove = extent; toAddOne = new Tuple(extent.Item1, (byte)(item - 1)); - toAddTwo = new Tuple((byte)(item + 1), extent.Item2); + toAddTwo = new Tuple((byte)(item + 1), extent.Item2); break; } diff --git a/DiscImageChef.Helpers/Extents/ExtentsInt.cs b/DiscImageChef.Helpers/Extents/ExtentsInt.cs index 8d4006347..39b8dbae6 100644 --- a/DiscImageChef.Helpers/Extents/ExtentsInt.cs +++ b/DiscImageChef.Helpers/Extents/ExtentsInt.cs @@ -135,7 +135,7 @@ namespace Extents { int realEnd; if(run) realEnd = start + end - 1; - else realEnd = end; + else realEnd = end; // TODO: Optimize this for(int t = start; t <= realEnd; t++) Add(t); @@ -177,7 +177,7 @@ namespace Extents { toRemove = extent; toAddOne = new Tuple(extent.Item1, item - 1); - toAddTwo = new Tuple(item + 1, extent.Item2); + toAddTwo = new Tuple(item + 1, extent.Item2); break; } diff --git a/DiscImageChef.Helpers/Extents/ExtentsLong.cs b/DiscImageChef.Helpers/Extents/ExtentsLong.cs index b70c85a98..5ccef4389 100644 --- a/DiscImageChef.Helpers/Extents/ExtentsLong.cs +++ b/DiscImageChef.Helpers/Extents/ExtentsLong.cs @@ -135,7 +135,7 @@ namespace Extents { long realEnd; if(run) realEnd = start + end - 1; - else realEnd = end; + else realEnd = end; // TODO: Optimize this for(long t = start; t <= realEnd; t++) Add(t); @@ -177,7 +177,7 @@ namespace Extents { toRemove = extent; toAddOne = new Tuple(extent.Item1, item - 1); - toAddTwo = new Tuple(item + 1, extent.Item2); + toAddTwo = new Tuple(item + 1, extent.Item2); break; } diff --git a/DiscImageChef.Helpers/Extents/ExtentsSByte.cs b/DiscImageChef.Helpers/Extents/ExtentsSByte.cs index b7479683d..f77c2848e 100644 --- a/DiscImageChef.Helpers/Extents/ExtentsSByte.cs +++ b/DiscImageChef.Helpers/Extents/ExtentsSByte.cs @@ -135,7 +135,7 @@ namespace Extents { sbyte realEnd; if(run) realEnd = (sbyte)(start + end - 1); - else realEnd = end; + else realEnd = end; // TODO: Optimize this for(sbyte t = start; t <= realEnd; t++) Add(t); @@ -177,7 +177,7 @@ namespace Extents { toRemove = extent; toAddOne = new Tuple(extent.Item1, (sbyte)(item - 1)); - toAddTwo = new Tuple((sbyte)(item + 1), extent.Item2); + toAddTwo = new Tuple((sbyte)(item + 1), extent.Item2); break; } diff --git a/DiscImageChef.Helpers/Extents/ExtentsShort.cs b/DiscImageChef.Helpers/Extents/ExtentsShort.cs index 0a26ee0b5..ae92ee891 100644 --- a/DiscImageChef.Helpers/Extents/ExtentsShort.cs +++ b/DiscImageChef.Helpers/Extents/ExtentsShort.cs @@ -135,7 +135,7 @@ namespace Extents { short realEnd; if(run) realEnd = (short)(start + end - 1); - else realEnd = end; + else realEnd = end; // TODO: Optimize this for(short t = start; t <= realEnd; t++) Add(t); @@ -177,7 +177,7 @@ namespace Extents { toRemove = extent; toAddOne = new Tuple(extent.Item1, (short)(item - 1)); - toAddTwo = new Tuple((short)(item + 1), extent.Item2); + toAddTwo = new Tuple((short)(item + 1), extent.Item2); break; } diff --git a/DiscImageChef.Helpers/Extents/ExtentsUInt.cs b/DiscImageChef.Helpers/Extents/ExtentsUInt.cs index 874173c0a..6a917d69d 100644 --- a/DiscImageChef.Helpers/Extents/ExtentsUInt.cs +++ b/DiscImageChef.Helpers/Extents/ExtentsUInt.cs @@ -135,7 +135,7 @@ namespace Extents { uint realEnd; if(run) realEnd = start + end - 1; - else realEnd = end; + else realEnd = end; // TODO: Optimize this for(uint t = start; t <= realEnd; t++) Add(t); @@ -177,7 +177,7 @@ namespace Extents { toRemove = extent; toAddOne = new Tuple(extent.Item1, item - 1); - toAddTwo = new Tuple(item + 1, extent.Item2); + toAddTwo = new Tuple(item + 1, extent.Item2); break; } diff --git a/DiscImageChef.Helpers/Extents/ExtentsULong.cs b/DiscImageChef.Helpers/Extents/ExtentsULong.cs index 71a82200c..09c76e8c8 100644 --- a/DiscImageChef.Helpers/Extents/ExtentsULong.cs +++ b/DiscImageChef.Helpers/Extents/ExtentsULong.cs @@ -135,7 +135,7 @@ namespace Extents { ulong realEnd; if(run) realEnd = start + end - 1; - else realEnd = end; + else realEnd = end; // TODO: Optimize this for(ulong t = start; t <= realEnd; t++) Add(t); @@ -177,7 +177,7 @@ namespace Extents { toRemove = extent; toAddOne = new Tuple(extent.Item1, item - 1); - toAddTwo = new Tuple(item + 1, extent.Item2); + toAddTwo = new Tuple(item + 1, extent.Item2); break; } diff --git a/DiscImageChef.Helpers/Extents/ExtentsUShort.cs b/DiscImageChef.Helpers/Extents/ExtentsUShort.cs index fa6122c1f..6a8689cf0 100644 --- a/DiscImageChef.Helpers/Extents/ExtentsUShort.cs +++ b/DiscImageChef.Helpers/Extents/ExtentsUShort.cs @@ -135,7 +135,7 @@ namespace Extents { ushort realEnd; if(run) realEnd = (ushort)(start + end - 1); - else realEnd = end; + else realEnd = end; // TODO: Optimize this for(ushort t = start; t <= realEnd; t++) Add(t); @@ -177,7 +177,7 @@ namespace Extents { toRemove = extent; toAddOne = new Tuple(extent.Item1, (ushort)(item - 1)); - toAddTwo = new Tuple((ushort)(item + 1), extent.Item2); + toAddTwo = new Tuple((ushort)(item + 1), extent.Item2); break; } diff --git a/DiscImageChef.Helpers/PrintHex.cs b/DiscImageChef.Helpers/PrintHex.cs index 0cd4f144b..551beefaa 100644 --- a/DiscImageChef.Helpers/PrintHex.cs +++ b/DiscImageChef.Helpers/PrintHex.cs @@ -57,7 +57,7 @@ namespace DiscImageChef { StringBuilder sb = new StringBuilder(); - int counter = 0; + int counter = 0; int subcounter = 0; for(long i = 0; i < array.LongLength; i++) { @@ -84,7 +84,7 @@ namespace DiscImageChef if(counter == width - 1) { - counter = 0; + counter = 0; subcounter = 0; } else counter++; diff --git a/DiscImageChef.Helpers/StringHandlers.cs b/DiscImageChef.Helpers/StringHandlers.cs index 8ab0e350f..ad2fb0cb5 100644 --- a/DiscImageChef.Helpers/StringHandlers.cs +++ b/DiscImageChef.Helpers/StringHandlers.cs @@ -71,10 +71,12 @@ namespace DiscImageChef len++; break; } + // if((i + 1) == CString.Length) // break; } - else break; + else + break; len++; } @@ -107,7 +109,7 @@ namespace DiscImageChef if(PascalString == null) return null; byte length = PascalString[start]; - int len = 0; + int len = 0; for(int i = start + 1; i < length + 1 && i < PascalString.Length; i++) { @@ -166,15 +168,15 @@ namespace DiscImageChef public static string DecompressUnicode(byte[] dstring) { ushort unicode; - byte compId = dstring[0]; - string temp = ""; + byte compId = dstring[0]; + string temp = ""; 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; + else unicode = 0; if(byteIndex < dstring.Length) unicode |= dstring[byteIndex++]; diff --git a/DiscImageChef.Helpers/Swapping.cs b/DiscImageChef.Helpers/Swapping.cs index 75bec257e..cf52121eb 100644 --- a/DiscImageChef.Helpers/Swapping.cs +++ b/DiscImageChef.Helpers/Swapping.cs @@ -107,7 +107,7 @@ namespace DiscImageChef { x = ((x & 0x00000000FFFFFFFF) << 32) | ((x & 0xFFFFFFFF00000000) >> 32); x = ((x & 0x0000FFFF0000FFFF) << 16) | ((x & 0xFFFF0000FFFF0000) >> 16); - x = ((x & 0x00FF00FF00FF00FF) << 8) | ((x & 0xFF00FF00FF00FF00) >> 8); + x = ((x & 0x00FF00FF00FF00FF) << 8) | ((x & 0xFF00FF00FF00FF00) >> 8); return x; } diff --git a/DiscImageChef.Interop/DetectOS.cs b/DiscImageChef.Interop/DetectOS.cs index 599ded262..43a8cecf0 100644 --- a/DiscImageChef.Interop/DetectOS.cs +++ b/DiscImageChef.Interop/DetectOS.cs @@ -89,8 +89,8 @@ namespace DiscImageChef.Interop } case "Darwin": { - IntPtr pLen = Marshal.AllocHGlobal(sizeof(int)); - int osxError = OSX_sysctlbyname("hw.machine", IntPtr.Zero, pLen, IntPtr.Zero, 0); + IntPtr pLen = Marshal.AllocHGlobal(sizeof(int)); + int osxError = OSX_sysctlbyname("hw.machine", IntPtr.Zero, pLen, IntPtr.Zero, 0); if(osxError != 0) { Marshal.FreeHGlobal(pLen); diff --git a/DiscImageChef.Metadata/DeviceReport.cs b/DiscImageChef.Metadata/DeviceReport.cs index 3e2a68e1e..bb98eece2 100644 --- a/DiscImageChef.Metadata/DeviceReport.cs +++ b/DiscImageChef.Metadata/DeviceReport.cs @@ -45,15 +45,15 @@ namespace DiscImageChef.Metadata [XmlRoot("DicDeviceReport", Namespace = "", IsNullable = false)] public class DeviceReport { - public usbType USB { get; set; } - public firewireType FireWire { get; set; } - public pcmciaType PCMCIA { get; set; } - public bool CompactFlash { get; set; } - public ataType ATA { get; set; } - public ataType ATAPI { get; set; } - public scsiType SCSI { get; set; } - public mmcsdType MultiMediaCard { get; set; } - public mmcsdType SecureDigital { get; set; } + public usbType USB { get; set; } + public firewireType FireWire { get; set; } + public pcmciaType PCMCIA { get; set; } + public bool CompactFlash { get; set; } + public ataType ATA { get; set; } + public ataType ATAPI { get; set; } + public scsiType SCSI { get; set; } + public mmcsdType MultiMediaCard { get; set; } + public mmcsdType SecureDigital { get; set; } [XmlIgnore] public bool CompactFlashSpecified { get; set; } @@ -61,109 +61,109 @@ namespace DiscImageChef.Metadata public class usbType { - public ushort VendorID { get; set; } - public ushort ProductID { get; set; } - public string Manufacturer { get; set; } - public string Product { get; set; } - public bool RemovableMedia { get; set; } - public byte[] Descriptors { get; set; } + public ushort VendorID { get; set; } + public ushort ProductID { get; set; } + public string Manufacturer { get; set; } + public string Product { get; set; } + public bool RemovableMedia { get; set; } + public byte[] Descriptors { get; set; } } public class firewireType { - public uint VendorID { get; set; } - public uint ProductID { get; set; } - public string Manufacturer { get; set; } - public string Product { get; set; } - public bool RemovableMedia { get; set; } + public uint VendorID { get; set; } + public uint ProductID { get; set; } + public string Manufacturer { get; set; } + public string Product { get; set; } + public bool RemovableMedia { get; set; } } public class ataType { - public string AdditionalPID { get; set; } - public Identify.TransferMode APIOSupported { get; set; } - public ushort ATAPIByteCount { get; set; } - public ushort BufferType { get; set; } - public ushort BufferSize { get; set; } - public Identify.CapabilitiesBit Capabilities { get; set; } - public Identify.CapabilitiesBit2 Capabilities2 { get; set; } - public Identify.CapabilitiesBit3 Capabilities3 { get; set; } - public ushort CFAPowerMode { get; set; } - public Identify.CommandSetBit CommandSet { get; set; } - public Identify.CommandSetBit2 CommandSet2 { get; set; } - public Identify.CommandSetBit3 CommandSet3 { get; set; } - public Identify.CommandSetBit4 CommandSet4 { get; set; } - public Identify.CommandSetBit5 CommandSet5 { get; set; } - public byte CurrentAAM { get; set; } - public ushort CurrentAPM { get; set; } - public Identify.DataSetMgmtBit DataSetMgmt { get; set; } - public ushort DataSetMgmtSize { get; set; } - public Identify.DeviceFormFactorEnum DeviceFormFactor { get; set; } - public Identify.TransferMode DMAActive { get; set; } - public Identify.TransferMode DMASupported { get; set; } - public byte DMATransferTimingMode { get; set; } - public ushort EnhancedSecurityEraseTime { get; set; } - public Identify.CommandSetBit EnabledCommandSet { get; set; } - public Identify.CommandSetBit2 EnabledCommandSet2 { get; set; } - public Identify.CommandSetBit3 EnabledCommandSet3 { get; set; } - public Identify.CommandSetBit4 EnabledCommandSet4 { get; set; } - public Identify.SATAFeaturesBit EnabledSATAFeatures { get; set; } - public ulong ExtendedUserSectors { get; set; } - public byte FreeFallSensitivity { get; set; } - public string FirmwareRevision { get; set; } - public Identify.GeneralConfigurationBit GeneralConfiguration { get; set; } - public ushort HardwareResetResult { get; set; } - public ushort InterseekDelay { get; set; } - public Identify.MajorVersionBit MajorVersion { get; set; } - public ushort MasterPasswordRevisionCode { get; set; } - public ushort MaxDownloadMicroMode3 { get; set; } - public ushort MaxQueueDepth { get; set; } - public Identify.TransferMode MDMAActive { get; set; } - public Identify.TransferMode MDMASupported { get; set; } - public ushort MinDownloadMicroMode3 { get; set; } - public ushort MinMDMACycleTime { get; set; } - public ushort MinorVersion { get; set; } - public ushort MinPIOCycleTimeNoFlow { get; set; } - public ushort MinPIOCycleTimeFlow { get; set; } - public string Model { get; set; } - public byte MultipleMaxSectors { get; set; } - public byte MultipleSectorNumber { get; set; } - public ushort NVCacheCaps { get; set; } - public uint NVCacheSize { get; set; } - public ushort NVCacheWriteSpeed { get; set; } - public byte NVEstimatedSpinUp { get; set; } - public ushort PacketBusRelease { get; set; } - public byte PIOTransferTimingMode { get; set; } - public byte RecommendedAAM { get; set; } - public ushort RecommendedMDMACycleTime { get; set; } - public ushort RemovableStatusSet { get; set; } - public Identify.SATACapabilitiesBit SATACapabilities { get; set; } - public Identify.SATACapabilitiesBit2 SATACapabilities2 { get; set; } - public Identify.SATAFeaturesBit SATAFeatures { get; set; } - public Identify.SCTCommandTransportBit SCTCommandTransport { get; set; } - public uint SectorsPerCard { get; set; } - public ushort SecurityEraseTime { get; set; } - public Identify.SecurityStatusBit SecurityStatus { get; set; } - public ushort ServiceBusyClear { get; set; } - public Identify.SpecificConfigurationEnum SpecificConfiguration { get; set; } - public ushort StreamAccessLatency { get; set; } - public ushort StreamMinReqSize { get; set; } - public uint StreamPerformanceGranularity { get; set; } - public ushort StreamTransferTimeDMA { get; set; } - public ushort StreamTransferTimePIO { get; set; } - public ushort TransportMajorVersion { get; set; } - public ushort TransportMinorVersion { get; set; } - public Identify.TrustedComputingBit TrustedComputing { get; set; } - public Identify.TransferMode UDMAActive { get; set; } - public Identify.TransferMode UDMASupported { get; set; } - public byte WRVMode { get; set; } - public uint WRVSectorCountMode3 { get; set; } - public uint WRVSectorCountMode2 { get; set; } + public string AdditionalPID { get; set; } + public Identify.TransferMode APIOSupported { get; set; } + public ushort ATAPIByteCount { get; set; } + public ushort BufferType { get; set; } + public ushort BufferSize { get; set; } + public Identify.CapabilitiesBit Capabilities { get; set; } + public Identify.CapabilitiesBit2 Capabilities2 { get; set; } + public Identify.CapabilitiesBit3 Capabilities3 { get; set; } + public ushort CFAPowerMode { get; set; } + public Identify.CommandSetBit CommandSet { get; set; } + public Identify.CommandSetBit2 CommandSet2 { get; set; } + public Identify.CommandSetBit3 CommandSet3 { get; set; } + public Identify.CommandSetBit4 CommandSet4 { get; set; } + public Identify.CommandSetBit5 CommandSet5 { get; set; } + public byte CurrentAAM { get; set; } + public ushort CurrentAPM { get; set; } + public Identify.DataSetMgmtBit DataSetMgmt { get; set; } + public ushort DataSetMgmtSize { get; set; } + public Identify.DeviceFormFactorEnum DeviceFormFactor { get; set; } + public Identify.TransferMode DMAActive { get; set; } + public Identify.TransferMode DMASupported { get; set; } + public byte DMATransferTimingMode { get; set; } + public ushort EnhancedSecurityEraseTime { get; set; } + public Identify.CommandSetBit EnabledCommandSet { get; set; } + public Identify.CommandSetBit2 EnabledCommandSet2 { get; set; } + public Identify.CommandSetBit3 EnabledCommandSet3 { get; set; } + public Identify.CommandSetBit4 EnabledCommandSet4 { get; set; } + public Identify.SATAFeaturesBit EnabledSATAFeatures { get; set; } + public ulong ExtendedUserSectors { get; set; } + public byte FreeFallSensitivity { get; set; } + public string FirmwareRevision { get; set; } + public Identify.GeneralConfigurationBit GeneralConfiguration { get; set; } + public ushort HardwareResetResult { get; set; } + public ushort InterseekDelay { get; set; } + public Identify.MajorVersionBit MajorVersion { get; set; } + public ushort MasterPasswordRevisionCode { get; set; } + public ushort MaxDownloadMicroMode3 { get; set; } + public ushort MaxQueueDepth { get; set; } + public Identify.TransferMode MDMAActive { get; set; } + public Identify.TransferMode MDMASupported { get; set; } + public ushort MinDownloadMicroMode3 { get; set; } + public ushort MinMDMACycleTime { get; set; } + public ushort MinorVersion { get; set; } + public ushort MinPIOCycleTimeNoFlow { get; set; } + public ushort MinPIOCycleTimeFlow { get; set; } + public string Model { get; set; } + public byte MultipleMaxSectors { get; set; } + public byte MultipleSectorNumber { get; set; } + public ushort NVCacheCaps { get; set; } + public uint NVCacheSize { get; set; } + public ushort NVCacheWriteSpeed { get; set; } + public byte NVEstimatedSpinUp { get; set; } + public ushort PacketBusRelease { get; set; } + public byte PIOTransferTimingMode { get; set; } + public byte RecommendedAAM { get; set; } + public ushort RecommendedMDMACycleTime { get; set; } + public ushort RemovableStatusSet { get; set; } + public Identify.SATACapabilitiesBit SATACapabilities { get; set; } + public Identify.SATACapabilitiesBit2 SATACapabilities2 { get; set; } + public Identify.SATAFeaturesBit SATAFeatures { get; set; } + public Identify.SCTCommandTransportBit SCTCommandTransport { get; set; } + public uint SectorsPerCard { get; set; } + public ushort SecurityEraseTime { get; set; } + public Identify.SecurityStatusBit SecurityStatus { get; set; } + public ushort ServiceBusyClear { get; set; } + public Identify.SpecificConfigurationEnum SpecificConfiguration { get; set; } + public ushort StreamAccessLatency { get; set; } + public ushort StreamMinReqSize { get; set; } + public uint StreamPerformanceGranularity { get; set; } + public ushort StreamTransferTimeDMA { get; set; } + public ushort StreamTransferTimePIO { get; set; } + public ushort TransportMajorVersion { get; set; } + public ushort TransportMinorVersion { get; set; } + public Identify.TrustedComputingBit TrustedComputing { get; set; } + public Identify.TransferMode UDMAActive { get; set; } + public Identify.TransferMode UDMASupported { get; set; } + public byte WRVMode { get; set; } + public uint WRVSectorCountMode3 { get; set; } + public uint WRVSectorCountMode2 { get; set; } public byte[] Identify { get; set; } - public testedMediaType ReadCapabilities { get; set; } - public testedMediaType[] RemovableMedias { get; set; } + public testedMediaType ReadCapabilities { get; set; } + public testedMediaType[] RemovableMedias { get; set; } [XmlIgnore] public bool AdditionalPIDSpecified { get; set; } @@ -330,24 +330,24 @@ namespace DiscImageChef.Metadata public class chsType { public ushort Cylinders { get; set; } - public ushort Heads { get; set; } - public ushort Sectors { get; set; } + public ushort Heads { get; set; } + public ushort Sectors { get; set; } } public class scsiType { - public scsiInquiryType Inquiry { get; set; } - public pageType[] EVPDPages { get; set; } - public bool SupportsModeSense6 { get; set; } - public bool SupportsModeSense10 { get; set; } - public bool SupportsModeSubpages { get; set; } - public modeType ModeSense { get; set; } - public mmcType MultiMediaDevice { get; set; } - public testedMediaType ReadCapabilities { get; set; } - public testedMediaType[] RemovableMedias { get; set; } - public sscType SequentialDevice { get; set; } - public byte[] ModeSense6Data { get; set; } - public byte[] ModeSense10Data { get; set; } + public scsiInquiryType Inquiry { get; set; } + public pageType[] EVPDPages { get; set; } + public bool SupportsModeSense6 { get; set; } + public bool SupportsModeSense10 { get; set; } + public bool SupportsModeSubpages { get; set; } + public modeType ModeSense { get; set; } + public mmcType MultiMediaDevice { get; set; } + public testedMediaType ReadCapabilities { get; set; } + public testedMediaType[] RemovableMedias { get; set; } + public sscType SequentialDevice { get; set; } + public byte[] ModeSense6Data { get; set; } + public byte[] ModeSense10Data { get; set; } [XmlIgnore] public bool ReadCapabilitiesSpecified { get; set; } @@ -355,46 +355,46 @@ namespace DiscImageChef.Metadata public class scsiInquiryType { - public bool AccessControlCoordinator { get; set; } - public bool ACKRequests { get; set; } - public bool AERCSupported { get; set; } - public bool Address16 { get; set; } - public bool Address32 { get; set; } - public byte ANSIVersion { get; set; } - public TGPSValues AsymmetricalLUNAccess { get; set; } - public bool BasicQueueing { get; set; } - public byte DeviceTypeModifier { get; set; } - public byte ECMAVersion { get; set; } - public bool EnclosureServices { get; set; } - public bool HierarchicalLUN { get; set; } - public bool IUS { get; set; } - public byte ISOVersion { get; set; } - public bool LinkedCommands { get; set; } - public bool MediumChanger { get; set; } - public bool MultiPortDevice { get; set; } - public bool NormalACA { get; set; } - public PeripheralDeviceTypes PeripheralDeviceType { get; set; } - public PeripheralQualifiers PeripheralQualifier { get; set; } - public string ProductIdentification { get; set; } - public string ProductRevisionLevel { get; set; } - public bool Protection { get; set; } - public bool QAS { get; set; } - public bool RelativeAddressing { get; set; } - public bool Removable { get; set; } - public byte ResponseDataFormat { get; set; } - public bool TaggedCommandQueue { get; set; } - public bool TerminateTaskSupported { get; set; } - public bool ThirdPartyCopy { get; set; } - public bool TranferDisable { get; set; } - public bool SoftReset { get; set; } - public SPIClocking SPIClocking { get; set; } - public bool StorageArrayController { get; set; } - public bool SyncTransfer { get; set; } - public string VendorIdentification { get; set; } - public ushort[] VersionDescriptors { get; set; } - public bool WideBus16 { get; set; } - public bool WideBus32 { get; set; } - public byte[] Data { get; set; } + public bool AccessControlCoordinator { get; set; } + public bool ACKRequests { get; set; } + public bool AERCSupported { get; set; } + public bool Address16 { get; set; } + public bool Address32 { get; set; } + public byte ANSIVersion { get; set; } + public TGPSValues AsymmetricalLUNAccess { get; set; } + public bool BasicQueueing { get; set; } + public byte DeviceTypeModifier { get; set; } + public byte ECMAVersion { get; set; } + public bool EnclosureServices { get; set; } + public bool HierarchicalLUN { get; set; } + public bool IUS { get; set; } + public byte ISOVersion { get; set; } + public bool LinkedCommands { get; set; } + public bool MediumChanger { get; set; } + public bool MultiPortDevice { get; set; } + public bool NormalACA { get; set; } + public PeripheralDeviceTypes PeripheralDeviceType { get; set; } + public PeripheralQualifiers PeripheralQualifier { get; set; } + public string ProductIdentification { get; set; } + public string ProductRevisionLevel { get; set; } + public bool Protection { get; set; } + public bool QAS { get; set; } + public bool RelativeAddressing { get; set; } + public bool Removable { get; set; } + public byte ResponseDataFormat { get; set; } + public bool TaggedCommandQueue { get; set; } + public bool TerminateTaskSupported { get; set; } + public bool ThirdPartyCopy { get; set; } + public bool TranferDisable { get; set; } + public bool SoftReset { get; set; } + public SPIClocking SPIClocking { get; set; } + public bool StorageArrayController { get; set; } + public bool SyncTransfer { get; set; } + public string VendorIdentification { get; set; } + public ushort[] VersionDescriptors { get; set; } + public bool WideBus16 { get; set; } + public bool WideBus32 { get; set; } + public byte[] Data { get; set; } [XmlIgnore] public bool ANSIVersionSpecified { get; set; } @@ -426,14 +426,14 @@ namespace DiscImageChef.Metadata public class modeType { - public byte MediumType { get; set; } - public bool WriteProtected { get; set; } - public blockDescriptorType[] BlockDescriptors { get; set; } - public byte Speed { get; set; } - public byte BufferedMode { get; set; } - public bool BlankCheckEnabled { get; set; } - public bool DPOandFUA { get; set; } - public modePageType[] ModePages { get; set; } + public byte MediumType { get; set; } + public bool WriteProtected { get; set; } + public blockDescriptorType[] BlockDescriptors { get; set; } + public byte Speed { get; set; } + public byte BufferedMode { get; set; } + public bool BlankCheckEnabled { get; set; } + public bool DPOandFUA { get; set; } + public modePageType[] ModePages { get; set; } [XmlIgnore] public bool MediumTypeSpecified { get; set; } @@ -445,9 +445,9 @@ namespace DiscImageChef.Metadata public class blockDescriptorType { - public byte Density { get; set; } - public ulong Blocks { get; set; } - public uint BlockLength { get; set; } + public byte Density { get; set; } + public ulong Blocks { get; set; } + public uint BlockLength { get; set; } [XmlIgnore] public bool BlocksSpecified { get; set; } @@ -470,63 +470,63 @@ namespace DiscImageChef.Metadata public class mmcType { - public mmcModeType ModeSense2A { get; set; } - public mmcFeaturesType Features { get; set; } + public mmcModeType ModeSense2A { get; set; } + public mmcFeaturesType Features { get; set; } public testedMediaType[] TestedMedia { get; set; } } public class mmcModeType { - public bool AccurateCDDA { get; set; } - public bool BCK { get; set; } - public ushort BufferSize { get; set; } - public bool BufferUnderRunProtection { get; set; } - public bool CanEject { get; set; } - public bool CanLockMedia { get; set; } - public bool CDDACommand { get; set; } - public bool CompositeAudioVideo { get; set; } - public bool CSSandCPPMSupported { get; set; } - public ushort CurrentSpeed { get; set; } - public ushort CurrentWriteSpeed { get; set; } - public ushort CurrentWriteSpeedSelected { get; set; } - public bool DeterministicSlotChanger { get; set; } - public bool DigitalPort1 { get; set; } - public bool DigitalPort2 { get; set; } - public bool LeadInPW { get; set; } - public byte LoadingMechanismType { get; set; } - public bool LockStatus { get; set; } - public bool LSBF { get; set; } - public ushort MaximumSpeed { get; set; } - public ushort MaximumWriteSpeed { get; set; } - public bool PlaysAudio { get; set; } - public bool PreventJumperStatus { get; set; } - public bool RCK { get; set; } - public bool ReadsBarcode { get; set; } - public bool ReadsBothSides { get; set; } - public bool ReadsCDR { get; set; } - public bool ReadsCDRW { get; set; } - public bool ReadsDeinterlavedSubchannel { get; set; } - public bool ReadsDVDR { get; set; } - public bool ReadsDVDRAM { get; set; } - public bool ReadsDVDROM { get; set; } - public bool ReadsISRC { get; set; } - public bool ReadsMode2Form2 { get; set; } - public bool ReadsMode2Form1 { get; set; } - public bool ReadsPacketCDR { get; set; } - public bool ReadsSubchannel { get; set; } - public bool ReadsUPC { get; set; } - public bool ReturnsC2Pointers { get; set; } - public byte RotationControlSelected { get; set; } - public bool SeparateChannelMute { get; set; } - public bool SeparateChannelVolume { get; set; } - public bool SSS { get; set; } - public bool SupportsMultiSession { get; set; } - public ushort SupportedVolumeLevels { get; set; } - public bool TestWrite { get; set; } - public bool WritesCDR { get; set; } - public bool WritesCDRW { get; set; } - public bool WritesDVDR { get; set; } - public bool WritesDVDRAM { get; set; } + public bool AccurateCDDA { get; set; } + public bool BCK { get; set; } + public ushort BufferSize { get; set; } + public bool BufferUnderRunProtection { get; set; } + public bool CanEject { get; set; } + public bool CanLockMedia { get; set; } + public bool CDDACommand { get; set; } + public bool CompositeAudioVideo { get; set; } + public bool CSSandCPPMSupported { get; set; } + public ushort CurrentSpeed { get; set; } + public ushort CurrentWriteSpeed { get; set; } + public ushort CurrentWriteSpeedSelected { get; set; } + public bool DeterministicSlotChanger { get; set; } + public bool DigitalPort1 { get; set; } + public bool DigitalPort2 { get; set; } + public bool LeadInPW { get; set; } + public byte LoadingMechanismType { get; set; } + public bool LockStatus { get; set; } + public bool LSBF { get; set; } + public ushort MaximumSpeed { get; set; } + public ushort MaximumWriteSpeed { get; set; } + public bool PlaysAudio { get; set; } + public bool PreventJumperStatus { get; set; } + public bool RCK { get; set; } + public bool ReadsBarcode { get; set; } + public bool ReadsBothSides { get; set; } + public bool ReadsCDR { get; set; } + public bool ReadsCDRW { get; set; } + public bool ReadsDeinterlavedSubchannel { get; set; } + public bool ReadsDVDR { get; set; } + public bool ReadsDVDRAM { get; set; } + public bool ReadsDVDROM { get; set; } + public bool ReadsISRC { get; set; } + public bool ReadsMode2Form2 { get; set; } + public bool ReadsMode2Form1 { get; set; } + public bool ReadsPacketCDR { get; set; } + public bool ReadsSubchannel { get; set; } + public bool ReadsUPC { get; set; } + public bool ReturnsC2Pointers { get; set; } + public byte RotationControlSelected { get; set; } + public bool SeparateChannelMute { get; set; } + public bool SeparateChannelVolume { get; set; } + public bool SSS { get; set; } + public bool SupportsMultiSession { get; set; } + public ushort SupportedVolumeLevels { get; set; } + public bool TestWrite { get; set; } + public bool WritesCDR { get; set; } + public bool WritesCDRW { get; set; } + public bool WritesDVDR { get; set; } + public bool WritesDVDRAM { get; set; } public Modes.ModePage_2A_WriteDescriptor[] WriteSpeedPerformanceDescriptors { get; set; } [XmlIgnore] @@ -549,131 +549,131 @@ namespace DiscImageChef.Metadata public class mmcFeaturesType { - public byte AACSVersion { get; set; } - public byte AGIDs { get; set; } - public byte BindingNonceBlocks { get; set; } - public ushort BlocksPerReadableUnit { get; set; } - public bool BufferUnderrunFreeInDVD { get; set; } - public bool BufferUnderrunFreeInSAO { get; set; } - public bool BufferUnderrunFreeInTAO { get; set; } - public bool CanAudioScan { get; set; } - public bool CanEject { get; set; } - public bool CanEraseSector { get; set; } - public bool CanExpandBDRESpareArea { get; set; } - public bool CanFormat { get; set; } - public bool CanFormatBDREWithoutSpare { get; set; } - public bool CanFormatCert { get; set; } - public bool CanFormatFRF { get; set; } - public bool CanFormatQCert { get; set; } - public bool CanFormatRRM { get; set; } - public bool CanGenerateBindingNonce { get; set; } - public bool CanLoad { get; set; } - public bool CanMuteSeparateChannels { get; set; } - public bool CanOverwriteSAOTrack { get; set; } - public bool CanOverwriteTAOTrack { get; set; } - public bool CanPlayCDAudio { get; set; } - public bool CanPseudoOverwriteBDR { get; set; } - public bool CanReadAllDualR { get; set; } - public bool CanReadAllDualRW { get; set; } - public bool CanReadBD { get; set; } - public bool CanReadBDR { get; set; } - public bool CanReadBDRE1 { get; set; } - public bool CanReadBDRE2 { get; set; } - public bool CanReadBDROM { get; set; } - public bool CanReadBluBCA { get; set; } - public bool CanReadCD { get; set; } - public bool CanReadCDMRW { get; set; } - public bool CanReadCPRM_MKB { get; set; } - public bool CanReadDDCD { get; set; } - public bool CanReadDVD { get; set; } - public bool CanReadDVDPlusMRW { get; set; } - public bool CanReadDVDPlusR { get; set; } - public bool CanReadDVDPlusRDL { get; set; } - public bool CanReadDVDPlusRW { get; set; } - public bool CanReadDVDPlusRWDL { get; set; } - public bool CanReadDriveAACSCertificate { get; set; } - public bool CanReadHDDVD { get; set; } - public bool CanReadHDDVDR { get; set; } - public bool CanReadHDDVDRAM { get; set; } - public bool CanReadLeadInCDText { get; set; } - public bool CanReadOldBDR { get; set; } - public bool CanReadOldBDRE { get; set; } - public bool CanReadOldBDROM { get; set; } - public bool CanReadSpareAreaInformation { get; set; } - public bool CanReportDriveSerial { get; set; } - public bool CanReportMediaSerial { get; set; } - public bool CanTestWriteDDCDR { get; set; } - public bool CanTestWriteDVD { get; set; } - public bool CanTestWriteInSAO { get; set; } - public bool CanTestWriteInTAO { get; set; } - public bool CanUpgradeFirmware { get; set; } - public bool CanWriteBD { get; set; } - public bool CanWriteBDR { get; set; } - public bool CanWriteBDRE1 { get; set; } - public bool CanWriteBDRE2 { get; set; } - public bool CanWriteBusEncryptedBlocks { get; set; } - public bool CanWriteCDMRW { get; set; } - public bool CanWriteCDRW { get; set; } - public bool CanWriteCDRWCAV { get; set; } - public bool CanWriteCDSAO { get; set; } - public bool CanWriteCDTAO { get; set; } - public bool CanWriteCSSManagedDVD { get; set; } - public bool CanWriteDDCDR { get; set; } - public bool CanWriteDDCDRW { get; set; } - public bool CanWriteDVDPlusMRW { get; set; } - public bool CanWriteDVDPlusR { get; set; } - public bool CanWriteDVDPlusRDL { get; set; } - public bool CanWriteDVDPlusRW { get; set; } - public bool CanWriteDVDPlusRWDL { get; set; } - public bool CanWriteDVDR { get; set; } - public bool CanWriteDVDRDL { get; set; } - public bool CanWriteDVDRW { get; set; } - public bool CanWriteHDDVDR { get; set; } - public bool CanWriteHDDVDRAM { get; set; } - public bool CanWriteOldBDR { get; set; } - public bool CanWriteOldBDRE { get; set; } - public bool CanWritePackedSubchannelInTAO { get; set; } - public bool CanWriteRWSubchannelInSAO { get; set; } - public bool CanWriteRWSubchannelInTAO { get; set; } - public bool CanWriteRaw { get; set; } - public bool CanWriteRawMultiSession { get; set; } - public bool CanWriteRawSubchannelInTAO { get; set; } - public bool ChangerIsSideChangeCapable { get; set; } - public byte ChangerSlots { get; set; } - public bool ChangerSupportsDiscPresent { get; set; } - public byte CPRMVersion { get; set; } - public byte CSSVersion { get; set; } - public bool DBML { get; set; } - public bool DVDMultiRead { get; set; } - public bool EmbeddedChanger { get; set; } - public bool ErrorRecoveryPage { get; set; } + public byte AACSVersion { get; set; } + public byte AGIDs { get; set; } + public byte BindingNonceBlocks { get; set; } + public ushort BlocksPerReadableUnit { get; set; } + public bool BufferUnderrunFreeInDVD { get; set; } + public bool BufferUnderrunFreeInSAO { get; set; } + public bool BufferUnderrunFreeInTAO { get; set; } + public bool CanAudioScan { get; set; } + public bool CanEject { get; set; } + public bool CanEraseSector { get; set; } + public bool CanExpandBDRESpareArea { get; set; } + public bool CanFormat { get; set; } + public bool CanFormatBDREWithoutSpare { get; set; } + public bool CanFormatCert { get; set; } + public bool CanFormatFRF { get; set; } + public bool CanFormatQCert { get; set; } + public bool CanFormatRRM { get; set; } + public bool CanGenerateBindingNonce { get; set; } + public bool CanLoad { get; set; } + public bool CanMuteSeparateChannels { get; set; } + public bool CanOverwriteSAOTrack { get; set; } + public bool CanOverwriteTAOTrack { get; set; } + public bool CanPlayCDAudio { get; set; } + public bool CanPseudoOverwriteBDR { get; set; } + public bool CanReadAllDualR { get; set; } + public bool CanReadAllDualRW { get; set; } + public bool CanReadBD { get; set; } + public bool CanReadBDR { get; set; } + public bool CanReadBDRE1 { get; set; } + public bool CanReadBDRE2 { get; set; } + public bool CanReadBDROM { get; set; } + public bool CanReadBluBCA { get; set; } + public bool CanReadCD { get; set; } + public bool CanReadCDMRW { get; set; } + public bool CanReadCPRM_MKB { get; set; } + public bool CanReadDDCD { get; set; } + public bool CanReadDVD { get; set; } + public bool CanReadDVDPlusMRW { get; set; } + public bool CanReadDVDPlusR { get; set; } + public bool CanReadDVDPlusRDL { get; set; } + public bool CanReadDVDPlusRW { get; set; } + public bool CanReadDVDPlusRWDL { get; set; } + public bool CanReadDriveAACSCertificate { get; set; } + public bool CanReadHDDVD { get; set; } + public bool CanReadHDDVDR { get; set; } + public bool CanReadHDDVDRAM { get; set; } + public bool CanReadLeadInCDText { get; set; } + public bool CanReadOldBDR { get; set; } + public bool CanReadOldBDRE { get; set; } + public bool CanReadOldBDROM { get; set; } + public bool CanReadSpareAreaInformation { get; set; } + public bool CanReportDriveSerial { get; set; } + public bool CanReportMediaSerial { get; set; } + public bool CanTestWriteDDCDR { get; set; } + public bool CanTestWriteDVD { get; set; } + public bool CanTestWriteInSAO { get; set; } + public bool CanTestWriteInTAO { get; set; } + public bool CanUpgradeFirmware { get; set; } + public bool CanWriteBD { get; set; } + public bool CanWriteBDR { get; set; } + public bool CanWriteBDRE1 { get; set; } + public bool CanWriteBDRE2 { get; set; } + public bool CanWriteBusEncryptedBlocks { get; set; } + public bool CanWriteCDMRW { get; set; } + public bool CanWriteCDRW { get; set; } + public bool CanWriteCDRWCAV { get; set; } + public bool CanWriteCDSAO { get; set; } + public bool CanWriteCDTAO { get; set; } + public bool CanWriteCSSManagedDVD { get; set; } + public bool CanWriteDDCDR { get; set; } + public bool CanWriteDDCDRW { get; set; } + public bool CanWriteDVDPlusMRW { get; set; } + public bool CanWriteDVDPlusR { get; set; } + public bool CanWriteDVDPlusRDL { get; set; } + public bool CanWriteDVDPlusRW { get; set; } + public bool CanWriteDVDPlusRWDL { get; set; } + public bool CanWriteDVDR { get; set; } + public bool CanWriteDVDRDL { get; set; } + public bool CanWriteDVDRW { get; set; } + public bool CanWriteHDDVDR { get; set; } + public bool CanWriteHDDVDRAM { get; set; } + public bool CanWriteOldBDR { get; set; } + public bool CanWriteOldBDRE { get; set; } + public bool CanWritePackedSubchannelInTAO { get; set; } + public bool CanWriteRWSubchannelInSAO { get; set; } + public bool CanWriteRWSubchannelInTAO { get; set; } + public bool CanWriteRaw { get; set; } + public bool CanWriteRawMultiSession { get; set; } + public bool CanWriteRawSubchannelInTAO { get; set; } + public bool ChangerIsSideChangeCapable { get; set; } + public byte ChangerSlots { get; set; } + public bool ChangerSupportsDiscPresent { get; set; } + public byte CPRMVersion { get; set; } + public byte CSSVersion { get; set; } + public bool DBML { get; set; } + public bool DVDMultiRead { get; set; } + public bool EmbeddedChanger { get; set; } + public bool ErrorRecoveryPage { get; set; } [XmlElement(DataType = "date")] - public DateTime FirmwareDate { get; set; } - public byte LoadingMechanismType { get; set; } - public bool Locked { get; set; } - public uint LogicalBlockSize { get; set; } - public bool MultiRead { get; set; } - public PhysicalInterfaces PhysicalInterfaceStandard { get; set; } - public uint PhysicalInterfaceStandardNumber { get; set; } - public bool PreventJumper { get; set; } - public bool SupportsAACS { get; set; } - public bool SupportsBusEncryption { get; set; } - public bool SupportsC2 { get; set; } - public bool SupportsCPRM { get; set; } - public bool SupportsCSS { get; set; } - public bool SupportsDAP { get; set; } - public bool SupportsDeviceBusyEvent { get; set; } - public bool SupportsHybridDiscs { get; set; } - public bool SupportsModePage1Ch { get; set; } - public bool SupportsOSSC { get; set; } - public bool SupportsPWP { get; set; } - public bool SupportsSWPP { get; set; } - public bool SupportsSecurDisc { get; set; } - public bool SupportsSeparateVolume { get; set; } - public bool SupportsVCPS { get; set; } - public bool SupportsWriteInhibitDCB { get; set; } - public bool SupportsWriteProtectPAC { get; set; } - public ushort VolumeLevels { get; set; } + public DateTime FirmwareDate { get; set; } + public byte LoadingMechanismType { get; set; } + public bool Locked { get; set; } + public uint LogicalBlockSize { get; set; } + public bool MultiRead { get; set; } + public PhysicalInterfaces PhysicalInterfaceStandard { get; set; } + public uint PhysicalInterfaceStandardNumber { get; set; } + public bool PreventJumper { get; set; } + public bool SupportsAACS { get; set; } + public bool SupportsBusEncryption { get; set; } + public bool SupportsC2 { get; set; } + public bool SupportsCPRM { get; set; } + public bool SupportsCSS { get; set; } + public bool SupportsDAP { get; set; } + public bool SupportsDeviceBusyEvent { get; set; } + public bool SupportsHybridDiscs { get; set; } + public bool SupportsModePage1Ch { get; set; } + public bool SupportsOSSC { get; set; } + public bool SupportsPWP { get; set; } + public bool SupportsSWPP { get; set; } + public bool SupportsSecurDisc { get; set; } + public bool SupportsSeparateVolume { get; set; } + public bool SupportsVCPS { get; set; } + public bool SupportsWriteInhibitDCB { get; set; } + public bool SupportsWriteProtectPAC { get; set; } + public ushort VolumeLevels { get; set; } [XmlIgnore] public bool PhysicalInterfaceStandardSpecified { get; set; } @@ -705,65 +705,65 @@ namespace DiscImageChef.Metadata public class testedMediaType { - public ulong Blocks { get; set; } - public uint BlockSize { get; set; } - public bool CanReadAACS { get; set; } - public bool CanReadADIP { get; set; } - public bool CanReadATIP { get; set; } - public bool CanReadBCA { get; set; } - public bool CanReadC2Pointers { get; set; } - public bool CanReadCMI { get; set; } - public bool CanReadCorrectedSubchannel { get; set; } - public bool CanReadCorrectedSubchannelWithC2 { get; set; } - public bool CanReadDCB { get; set; } - public bool CanReadDDS { get; set; } - public bool CanReadDMI { get; set; } - public bool CanReadDiscInformation { get; set; } - public bool CanReadFullTOC { get; set; } - public bool CanReadHDCMI { get; set; } - public bool CanReadLayerCapacity { get; set; } - public bool CanReadLeadIn { get; set; } - public bool CanReadLeadOut { get; set; } - public bool CanReadMediaID { get; set; } - public bool CanReadMediaSerial { get; set; } - public bool CanReadPAC { get; set; } - public bool CanReadPFI { get; set; } - public bool CanReadPMA { get; set; } - public bool CanReadPQSubchannel { get; set; } - public bool CanReadPQSubchannelWithC2 { get; set; } - public bool CanReadPRI { get; set; } - public bool CanReadRWSubchannel { get; set; } - public bool CanReadRWSubchannelWithC2 { get; set; } - public bool CanReadRecordablePFI { get; set; } - public bool CanReadSpareAreaInformation { get; set; } - public bool CanReadTOC { get; set; } - public byte Density { get; set; } - public uint LongBlockSize { get; set; } - public string Manufacturer { get; set; } - public bool MediaIsRecognized { get; set; } - public byte MediumType { get; set; } - public string MediumTypeName { get; set; } - public string Model { get; set; } - public bool SupportsHLDTSTReadRawDVD { get; set; } - public bool SupportsNECReadCDDA { get; set; } - public bool SupportsPioneerReadCDDA { get; set; } - public bool SupportsPioneerReadCDDAMSF { get; set; } - public bool SupportsPlextorReadCDDA { get; set; } - public bool SupportsPlextorReadRawDVD { get; set; } - public bool SupportsRead10 { get; set; } - public bool SupportsRead12 { get; set; } - public bool SupportsRead16 { get; set; } - public bool SupportsRead { get; set; } - public bool SupportsReadCapacity16 { get; set; } - public bool SupportsReadCapacity { get; set; } - public bool SupportsReadCd { get; set; } - public bool SupportsReadCdMsf { get; set; } - public bool SupportsReadCdRaw { get; set; } - public bool SupportsReadCdMsfRaw { get; set; } - public bool SupportsReadLong16 { get; set; } - public bool SupportsReadLong { get; set; } + public ulong Blocks { get; set; } + public uint BlockSize { get; set; } + public bool CanReadAACS { get; set; } + public bool CanReadADIP { get; set; } + public bool CanReadATIP { get; set; } + public bool CanReadBCA { get; set; } + public bool CanReadC2Pointers { get; set; } + public bool CanReadCMI { get; set; } + public bool CanReadCorrectedSubchannel { get; set; } + public bool CanReadCorrectedSubchannelWithC2 { get; set; } + public bool CanReadDCB { get; set; } + public bool CanReadDDS { get; set; } + public bool CanReadDMI { get; set; } + public bool CanReadDiscInformation { get; set; } + public bool CanReadFullTOC { get; set; } + public bool CanReadHDCMI { get; set; } + public bool CanReadLayerCapacity { get; set; } + public bool CanReadLeadIn { get; set; } + public bool CanReadLeadOut { get; set; } + public bool CanReadMediaID { get; set; } + public bool CanReadMediaSerial { get; set; } + public bool CanReadPAC { get; set; } + public bool CanReadPFI { get; set; } + public bool CanReadPMA { get; set; } + public bool CanReadPQSubchannel { get; set; } + public bool CanReadPQSubchannelWithC2 { get; set; } + public bool CanReadPRI { get; set; } + public bool CanReadRWSubchannel { get; set; } + public bool CanReadRWSubchannelWithC2 { get; set; } + public bool CanReadRecordablePFI { get; set; } + public bool CanReadSpareAreaInformation { get; set; } + public bool CanReadTOC { get; set; } + public byte Density { get; set; } + public uint LongBlockSize { get; set; } + public string Manufacturer { get; set; } + public bool MediaIsRecognized { get; set; } + public byte MediumType { get; set; } + public string MediumTypeName { get; set; } + public string Model { get; set; } + public bool SupportsHLDTSTReadRawDVD { get; set; } + public bool SupportsNECReadCDDA { get; set; } + public bool SupportsPioneerReadCDDA { get; set; } + public bool SupportsPioneerReadCDDAMSF { get; set; } + public bool SupportsPlextorReadCDDA { get; set; } + public bool SupportsPlextorReadRawDVD { get; set; } + public bool SupportsRead10 { get; set; } + public bool SupportsRead12 { get; set; } + public bool SupportsRead16 { get; set; } + public bool SupportsRead { get; set; } + public bool SupportsReadCapacity16 { get; set; } + public bool SupportsReadCapacity { get; set; } + public bool SupportsReadCd { get; set; } + public bool SupportsReadCdMsf { get; set; } + public bool SupportsReadCdRaw { get; set; } + public bool SupportsReadCdMsfRaw { get; set; } + public bool SupportsReadLong16 { get; set; } + public bool SupportsReadLong { get; set; } - public byte[] ModeSense6Data { get; set; } + public byte[] ModeSense6Data { get; set; } public byte[] ModeSense10Data { get; set; } [XmlIgnore] @@ -877,16 +877,16 @@ namespace DiscImageChef.Metadata [XmlIgnore] public bool SupportsReadLongSpecified { get; set; } - public chsType CHS { get; set; } - public chsType CurrentCHS { get; set; } - public uint LBASectors { get; set; } - public ulong LBA48Sectors { get; set; } - public ushort LogicalAlignment { get; set; } - public ushort NominalRotationRate { get; set; } - public uint PhysicalBlockSize { get; set; } - public bool SolidStateDevice { get; set; } - public ushort UnformattedBPT { get; set; } - public ushort UnformattedBPS { get; set; } + public chsType CHS { get; set; } + public chsType CurrentCHS { get; set; } + public uint LBASectors { get; set; } + public ulong LBA48Sectors { get; set; } + public ushort LogicalAlignment { get; set; } + public ushort NominalRotationRate { get; set; } + public uint PhysicalBlockSize { get; set; } + public bool SolidStateDevice { get; set; } + public ushort UnformattedBPT { get; set; } + public ushort UnformattedBPS { get; set; } [XmlIgnore] public bool LBASectorsSpecified { get; set; } @@ -905,22 +905,22 @@ namespace DiscImageChef.Metadata [XmlIgnore] public bool UnformattedBPSSpecified { get; set; } - public bool SupportsReadDmaLba { get; set; } - public bool SupportsReadDmaRetryLba { get; set; } - public bool SupportsReadLba { get; set; } - public bool SupportsReadRetryLba { get; set; } - public bool SupportsReadLongLba { get; set; } + public bool SupportsReadDmaLba { get; set; } + public bool SupportsReadDmaRetryLba { get; set; } + public bool SupportsReadLba { get; set; } + public bool SupportsReadRetryLba { get; set; } + public bool SupportsReadLongLba { get; set; } public bool SupportsReadLongRetryLba { get; set; } - public bool SupportsSeekLba { get; set; } + public bool SupportsSeekLba { get; set; } public bool SupportsReadDmaLba48 { get; set; } - public bool SupportsReadLba48 { get; set; } + public bool SupportsReadLba48 { get; set; } - public bool SupportsReadDma { get; set; } - public bool SupportsReadDmaRetry { get; set; } - public bool SupportsReadRetry { get; set; } + public bool SupportsReadDma { get; set; } + public bool SupportsReadDmaRetry { get; set; } + public bool SupportsReadRetry { get; set; } public bool SupportsReadLongRetry { get; set; } - public bool SupportsSeek { get; set; } + public bool SupportsSeek { get; set; } [XmlIgnore] public bool SupportsReadDmaLbaSpecified { get; set; } @@ -957,12 +957,12 @@ namespace DiscImageChef.Metadata public class sscType { public byte BlockSizeGranularity { get; set; } - public uint MaxBlockLength { get; set; } - public uint MinBlockLength { get; set; } + public uint MaxBlockLength { get; set; } + public uint MinBlockLength { get; set; } - public SupportedDensity[] SupportedDensities { get; set; } - public SupportedMedia[] SupportedMediaTypes { get; set; } - public SequentialMedia[] TestedMedia { get; set; } + public SupportedDensity[] SupportedDensities { get; set; } + public SupportedMedia[] SupportedMediaTypes { get; set; } + public SequentialMedia[] TestedMedia { get; set; } [XmlIgnore] public bool BlockSizeGranularitySpecified { get; set; } @@ -974,44 +974,44 @@ namespace DiscImageChef.Metadata public struct SupportedDensity { - public byte PrimaryCode { get; set; } - public byte SecondaryCode { get; set; } - public bool Writable { get; set; } - public bool Duplicate { get; set; } - public bool DefaultDensity { get; set; } - public uint BitsPerMm { get; set; } - public ushort Width { get; set; } - public ushort Tracks { get; set; } - public uint Capacity { get; set; } - public string Organization { get; set; } - public string Name { get; set; } - public string Description { get; set; } + public byte PrimaryCode { get; set; } + public byte SecondaryCode { get; set; } + public bool Writable { get; set; } + public bool Duplicate { get; set; } + public bool DefaultDensity { get; set; } + public uint BitsPerMm { get; set; } + public ushort Width { get; set; } + public ushort Tracks { get; set; } + public uint Capacity { get; set; } + public string Organization { get; set; } + public string Name { get; set; } + public string Description { get; set; } } public struct SupportedMedia { - public byte MediumType { get; set; } - public int[] DensityCodes { get; set; } - public ushort Width { get; set; } - public ushort Length { get; set; } + public byte MediumType { get; set; } + public int[] DensityCodes { get; set; } + public ushort Width { get; set; } + public ushort Length { get; set; } public string Organization { get; set; } - public string Name { get; set; } - public string Description { get; set; } + public string Name { get; set; } + public string Description { get; set; } } public struct SequentialMedia { - public bool CanReadMediaSerial { get; set; } - public byte Density { get; set; } - public string Manufacturer { get; set; } - public bool MediaIsRecognized { get; set; } - public byte MediumType { get; set; } - public string MediumTypeName { get; set; } - public string Model { get; set; } - public SupportedDensity[] SupportedDensities { get; set; } - public SupportedMedia[] SupportedMediaTypes { get; set; } + public bool CanReadMediaSerial { get; set; } + public byte Density { get; set; } + public string Manufacturer { get; set; } + public bool MediaIsRecognized { get; set; } + public byte MediumType { get; set; } + public string MediumTypeName { get; set; } + public string Model { get; set; } + public SupportedDensity[] SupportedDensities { get; set; } + public SupportedMedia[] SupportedMediaTypes { get; set; } - public byte[] ModeSense6Data { get; set; } + public byte[] ModeSense6Data { get; set; } public byte[] ModeSense10Data { get; set; } [XmlIgnore] @@ -1025,12 +1025,12 @@ namespace DiscImageChef.Metadata [Serializable] public class pcmciaType { - public byte[] CIS { get; set; } - public string Compliance { get; set; } - public ushort ManufacturerCode { get; set; } - public ushort CardCode { get; set; } - public string Manufacturer { get; set; } - public string ProductName { get; set; } + public byte[] CIS { get; set; } + public string Compliance { get; set; } + public ushort ManufacturerCode { get; set; } + public ushort CardCode { get; set; } + public string Manufacturer { get; set; } + public string ProductName { get; set; } public string[] AdditionalInformation { get; set; } [XmlIgnore] @@ -1042,10 +1042,10 @@ namespace DiscImageChef.Metadata [Serializable] public class mmcsdType { - public byte[] CID { get; set; } - public byte[] CSD { get; set; } - public byte[] OCR { get; set; } - public byte[] SCR { get; set; } + public byte[] CID { get; set; } + public byte[] CSD { get; set; } + public byte[] OCR { get; set; } + 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 51bf4d7bb..f832a1cf8 100644 --- a/DiscImageChef.Metadata/Dimensions.cs +++ b/DiscImageChef.Metadata/Dimensions.cs @@ -76,11 +76,11 @@ namespace DiscImageChef.Metadata case CommonTypes.MediaType.FDFORMAT_525_DD: case CommonTypes.MediaType.FDFORMAT_525_HD: // According to ECMA-99 et al - dmns.Height = 133.3; + dmns.Height = 133.3; dmns.HeightSpecified = true; - dmns.Width = 133.3; - dmns.WidthSpecified = true; - dmns.Thickness = 1.65; + dmns.Width = 133.3; + dmns.WidthSpecified = true; + dmns.Thickness = 1.65; return dmns; #endregion 5.25" floppy disk @@ -110,11 +110,11 @@ namespace DiscImageChef.Metadata case CommonTypes.MediaType.Apricot_35: case CommonTypes.MediaType.FD32MB: // According to ECMA-100 et al - dmns.Height = 94; + dmns.Height = 94; dmns.HeightSpecified = true; - dmns.Width = 90; - dmns.WidthSpecified = true; - dmns.Thickness = 3.3; + dmns.Width = 90; + dmns.WidthSpecified = true; + dmns.Thickness = 3.3; return dmns; #endregion 3.5" floppy disk @@ -138,11 +138,11 @@ namespace DiscImageChef.Metadata case CommonTypes.MediaType.ECMA_69_15: case CommonTypes.MediaType.ECMA_69_26: // According to ECMA-59 et al - dmns.Height = 203.2; + dmns.Height = 203.2; dmns.HeightSpecified = true; - dmns.Width = 203.2; - dmns.WidthSpecified = true; - dmns.Thickness = 1.65; + dmns.Width = 203.2; + dmns.WidthSpecified = true; + dmns.Thickness = 1.65; return dmns; #endregion 8" floppy disk @@ -150,11 +150,11 @@ namespace DiscImageChef.Metadata case CommonTypes.MediaType.ECMA_260: case CommonTypes.MediaType.ECMA_260_Double: // According to ECMA-260 et al - dmns.Height = 421.84; + dmns.Height = 421.84; dmns.HeightSpecified = true; - dmns.Width = 443.76; - dmns.WidthSpecified = true; - dmns.Thickness = 25.4; + dmns.Width = 443.76; + dmns.WidthSpecified = true; + dmns.Thickness = 25.4; return dmns; #endregion 356mm magneto optical @@ -163,11 +163,11 @@ namespace DiscImageChef.Metadata case CommonTypes.MediaType.ECMA_190: case CommonTypes.MediaType.ECMA_317: // According to ECMA-317 et al - dmns.Height = 340; + dmns.Height = 340; dmns.HeightSpecified = true; - dmns.Width = 320; - dmns.WidthSpecified = true; - dmns.Thickness = 17; + dmns.Width = 320; + dmns.WidthSpecified = true; + dmns.Thickness = 17; return dmns; #endregion 300mm magneto optical @@ -188,11 +188,11 @@ namespace DiscImageChef.Metadata case CommonTypes.MediaType.UDO2: case CommonTypes.MediaType.UDO2_WORM: // According to ECMA-183 et al - dmns.Height = 153; + dmns.Height = 153; dmns.HeightSpecified = true; - dmns.Width = 135; - dmns.WidthSpecified = true; - dmns.Thickness = 11; + dmns.Width = 135; + dmns.WidthSpecified = true; + dmns.Thickness = 11; return dmns; #endregion 5.25" magneto optical @@ -205,56 +205,56 @@ namespace DiscImageChef.Metadata case CommonTypes.MediaType.GigaMo: case CommonTypes.MediaType.GigaMo2: // According to ECMA-154 et al - dmns.Height = 94; + dmns.Height = 94; dmns.HeightSpecified = true; - dmns.Width = 90; - dmns.WidthSpecified = true; - dmns.Thickness = 6; + dmns.Width = 90; + dmns.WidthSpecified = true; + dmns.Thickness = 6; return dmns; #endregion 3.5" magneto optical case CommonTypes.MediaType.PD650: case CommonTypes.MediaType.PD650_WORM: - dmns.Height = 135; + dmns.Height = 135; dmns.HeightSpecified = true; - dmns.Width = 124; - dmns.WidthSpecified = true; - dmns.Thickness = 7.8; + dmns.Width = 124; + dmns.WidthSpecified = true; + dmns.Thickness = 7.8; return dmns; case CommonTypes.MediaType.ECMA_239: - dmns.Height = 97; + dmns.Height = 97; dmns.HeightSpecified = true; - dmns.Width = 92; - dmns.WidthSpecified = true; - dmns.Thickness = 5; + dmns.Width = 92; + dmns.WidthSpecified = true; + dmns.Thickness = 5; return dmns; case CommonTypes.MediaType.MMCmicro: - dmns.Height = 14; + dmns.Height = 14; dmns.HeightSpecified = true; - dmns.Width = 12; - dmns.WidthSpecified = true; - dmns.Thickness = 1.1; + dmns.Width = 12; + dmns.WidthSpecified = true; + dmns.Thickness = 1.1; return dmns; case CommonTypes.MediaType.MemoryStickMicro: - dmns.Height = 15; + dmns.Height = 15; dmns.HeightSpecified = true; - dmns.Width = 12.5; - dmns.WidthSpecified = true; - dmns.Thickness = 1.2; + dmns.Width = 12.5; + dmns.WidthSpecified = true; + dmns.Thickness = 1.2; return dmns; case CommonTypes.MediaType.microSD: - dmns.Height = 11; + dmns.Height = 11; dmns.HeightSpecified = true; - dmns.Width = 15; - dmns.WidthSpecified = true; - dmns.Thickness = 1; + dmns.Width = 15; + dmns.WidthSpecified = true; + dmns.Thickness = 1; return dmns; case CommonTypes.MediaType.miniSD: - dmns.Height = 21.5; + dmns.Height = 21.5; dmns.HeightSpecified = true; - dmns.Width = 20; - dmns.WidthSpecified = true; - dmns.Thickness = 1.4; + dmns.Width = 20; + dmns.WidthSpecified = true; + dmns.Thickness = 1.4; return dmns; case CommonTypes.MediaType.QIC3010: case CommonTypes.MediaType.QIC3020: @@ -263,232 +263,232 @@ namespace DiscImageChef.Metadata case CommonTypes.MediaType.QIC320: case CommonTypes.MediaType.QIC40: case CommonTypes.MediaType.QIC80: - dmns.Height = 20; + dmns.Height = 20; dmns.HeightSpecified = true; - dmns.Width = 21.5; - dmns.WidthSpecified = true; - dmns.Thickness = 1.6; + dmns.Width = 21.5; + dmns.WidthSpecified = true; + dmns.Thickness = 1.6; return dmns; case CommonTypes.MediaType.RSMMC: - dmns.Height = 18; + dmns.Height = 18; dmns.HeightSpecified = true; - dmns.Width = 24; - dmns.WidthSpecified = true; - dmns.Thickness = 1.4; + dmns.Width = 24; + dmns.WidthSpecified = true; + dmns.Thickness = 1.4; return dmns; case CommonTypes.MediaType.MMC: - dmns.Height = 32; + dmns.Height = 32; dmns.HeightSpecified = true; - dmns.Width = 24; - dmns.WidthSpecified = true; - dmns.Thickness = 1.4; + dmns.Width = 24; + dmns.WidthSpecified = true; + dmns.Thickness = 1.4; return dmns; case CommonTypes.MediaType.SecureDigital: - dmns.Height = 32; + dmns.Height = 32; dmns.HeightSpecified = true; - dmns.Width = 24; - dmns.WidthSpecified = true; - dmns.Thickness = 2.1; + dmns.Width = 24; + dmns.WidthSpecified = true; + dmns.Thickness = 2.1; return dmns; case CommonTypes.MediaType.xD: - dmns.Height = 20; + dmns.Height = 20; dmns.HeightSpecified = true; - dmns.Width = 25; - dmns.WidthSpecified = true; - dmns.Thickness = 1.78; + dmns.Width = 25; + dmns.WidthSpecified = true; + dmns.Thickness = 1.78; return dmns; case CommonTypes.MediaType.XQD: - dmns.Height = 38.5; + dmns.Height = 38.5; dmns.HeightSpecified = true; - dmns.Width = 29.8; - dmns.WidthSpecified = true; - dmns.Thickness = 3.8; + dmns.Width = 29.8; + dmns.WidthSpecified = true; + dmns.Thickness = 3.8; return dmns; case CommonTypes.MediaType.MemoryStickDuo: case CommonTypes.MediaType.MemoryStickProDuo: - dmns.Height = 20; + dmns.Height = 20; dmns.HeightSpecified = true; - dmns.Width = 31; - dmns.WidthSpecified = true; - dmns.Thickness = 1.6; + dmns.Width = 31; + dmns.WidthSpecified = true; + dmns.Thickness = 1.6; return dmns; case CommonTypes.MediaType.Nintendo3DSGameCard: case CommonTypes.MediaType.NintendoDSGameCard: case CommonTypes.MediaType.NintendoDSiGameCard: - dmns.Height = 35; + dmns.Height = 35; dmns.HeightSpecified = true; - dmns.Width = 33; - dmns.WidthSpecified = true; - dmns.Thickness = 3.8; + dmns.Width = 33; + dmns.WidthSpecified = true; + dmns.Thickness = 3.8; return dmns; case CommonTypes.MediaType.DataPlay: - dmns.Height = 42; + dmns.Height = 42; dmns.HeightSpecified = true; - dmns.Width = 33.5; - dmns.WidthSpecified = true; - dmns.Thickness = 3; + dmns.Width = 33.5; + dmns.WidthSpecified = true; + dmns.Thickness = 3; return dmns; case CommonTypes.MediaType.Microdrive: - dmns.Height = 44; + dmns.Height = 44; dmns.HeightSpecified = true; - dmns.Width = 34; - dmns.WidthSpecified = true; - dmns.Thickness = 8; + dmns.Width = 34; + dmns.WidthSpecified = true; + dmns.Thickness = 8; return dmns; case CommonTypes.MediaType.ExpressCard34: - dmns.Height = 75; + dmns.Height = 75; dmns.HeightSpecified = true; - dmns.Width = 34; - dmns.WidthSpecified = true; - dmns.Thickness = 5; + dmns.Width = 34; + dmns.WidthSpecified = true; + dmns.Thickness = 5; return dmns; case CommonTypes.MediaType.SmartMedia: - dmns.Height = 45; + dmns.Height = 45; dmns.HeightSpecified = true; - dmns.Width = 37; - dmns.WidthSpecified = true; - dmns.Thickness = 0.76; + dmns.Width = 37; + dmns.WidthSpecified = true; + dmns.Thickness = 0.76; return dmns; case CommonTypes.MediaType.MiniCard: - dmns.Height = 45; + dmns.Height = 45; dmns.HeightSpecified = true; - dmns.Width = 37; - dmns.WidthSpecified = true; - dmns.Thickness = 3.5; + dmns.Width = 37; + dmns.WidthSpecified = true; + dmns.Thickness = 3.5; return dmns; case CommonTypes.MediaType.PlayStationMemoryCard: case CommonTypes.MediaType.PlayStationMemoryCard2: - dmns.Height = 55.7; + dmns.Height = 55.7; dmns.HeightSpecified = true; - dmns.Width = 41.5; - dmns.WidthSpecified = true; - dmns.Thickness = 7; + dmns.Width = 41.5; + dmns.WidthSpecified = true; + dmns.Thickness = 7; return dmns; case CommonTypes.MediaType.CFast: case CommonTypes.MediaType.CompactFlash: - dmns.Height = 36; + dmns.Height = 36; dmns.HeightSpecified = true; - dmns.Width = 43; - dmns.WidthSpecified = true; - dmns.Thickness = 3.3; + dmns.Width = 43; + dmns.WidthSpecified = true; + dmns.Thickness = 3.3; return dmns; case CommonTypes.MediaType.CompactFlashType2: - dmns.Height = 36; + dmns.Height = 36; dmns.HeightSpecified = true; - dmns.Width = 43; - dmns.WidthSpecified = true; - dmns.Thickness = 5; + dmns.Width = 43; + dmns.WidthSpecified = true; + dmns.Thickness = 5; return dmns; case CommonTypes.MediaType.ZXMicrodrive: - dmns.Height = 36; + dmns.Height = 36; dmns.HeightSpecified = true; - dmns.Width = 43; - dmns.WidthSpecified = true; - dmns.Thickness = 5; + dmns.Width = 43; + dmns.WidthSpecified = true; + dmns.Thickness = 5; return dmns; case CommonTypes.MediaType.MemoryStick: case CommonTypes.MediaType.MemoryStickPro: - dmns.Height = 21; + dmns.Height = 21; dmns.HeightSpecified = true; - dmns.Width = 50; - dmns.WidthSpecified = true; - dmns.Thickness = 2.6; + dmns.Width = 50; + dmns.WidthSpecified = true; + dmns.Thickness = 2.6; return dmns; case CommonTypes.MediaType.PocketZip: - dmns.Height = 54.5; + dmns.Height = 54.5; dmns.HeightSpecified = true; - dmns.Width = 50; - dmns.WidthSpecified = true; - dmns.Thickness = 2; + dmns.Width = 50; + dmns.WidthSpecified = true; + dmns.Thickness = 2; return dmns; case CommonTypes.MediaType.ExpressCard54: - dmns.Height = 75; + dmns.Height = 75; dmns.HeightSpecified = true; - dmns.Width = 54; - dmns.WidthSpecified = true; - dmns.Thickness = 5; + dmns.Width = 54; + dmns.WidthSpecified = true; + dmns.Thickness = 5; return dmns; case CommonTypes.MediaType.PCCardTypeI: - dmns.Height = 85.6; + dmns.Height = 85.6; dmns.HeightSpecified = true; - dmns.Width = 54; - dmns.WidthSpecified = true; - dmns.Thickness = 3.3; + dmns.Width = 54; + dmns.WidthSpecified = true; + dmns.Thickness = 3.3; return dmns; case CommonTypes.MediaType.PCCardTypeII: - dmns.Height = 85.6; + dmns.Height = 85.6; dmns.HeightSpecified = true; - dmns.Width = 54; - dmns.WidthSpecified = true; - dmns.Thickness = 5; + dmns.Width = 54; + dmns.WidthSpecified = true; + dmns.Thickness = 5; return dmns; case CommonTypes.MediaType.PCCardTypeIII: - dmns.Height = 85.6; + dmns.Height = 85.6; dmns.HeightSpecified = true; - dmns.Width = 54; - dmns.WidthSpecified = true; - dmns.Thickness = 10.5; + dmns.Width = 54; + dmns.WidthSpecified = true; + dmns.Thickness = 10.5; return dmns; case CommonTypes.MediaType.PCCardTypeIV: - dmns.Height = 85.6; + dmns.Height = 85.6; dmns.HeightSpecified = true; - dmns.Width = 54; - dmns.WidthSpecified = true; - dmns.Thickness = 16; + dmns.Width = 54; + dmns.WidthSpecified = true; + dmns.Thickness = 16; return dmns; case CommonTypes.MediaType.DataStore: - dmns.Height = 86.5; + dmns.Height = 86.5; dmns.HeightSpecified = true; - dmns.Width = 54; - dmns.WidthSpecified = true; - dmns.Thickness = 2.5; + dmns.Width = 54; + dmns.WidthSpecified = true; + dmns.Thickness = 2.5; return dmns; case CommonTypes.MediaType.VideoFloppy: - dmns.Height = 54; + dmns.Height = 54; dmns.HeightSpecified = true; - dmns.Width = 60; - dmns.WidthSpecified = true; - dmns.Thickness = 3.5; + dmns.Width = 60; + dmns.WidthSpecified = true; + dmns.Thickness = 3.5; return dmns; case CommonTypes.MediaType.VXA1: case CommonTypes.MediaType.VXA2: case CommonTypes.MediaType.VXA3: - dmns.Height = 95; + dmns.Height = 95; dmns.HeightSpecified = true; - dmns.Width = 62.5; - dmns.WidthSpecified = true; - dmns.Thickness = 15; + dmns.Width = 62.5; + dmns.WidthSpecified = true; + dmns.Thickness = 15; return dmns; case CommonTypes.MediaType.MiniDV: - dmns.Height = 47.5; + dmns.Height = 47.5; dmns.HeightSpecified = true; - dmns.Width = 66; - dmns.WidthSpecified = true; - dmns.Thickness = 12; + dmns.Width = 66; + dmns.WidthSpecified = true; + dmns.Thickness = 12; return dmns; case CommonTypes.MediaType.Wafer: - dmns.Height = 46.8; + dmns.Height = 46.8; dmns.HeightSpecified = true; - dmns.Width = 67.1; - dmns.WidthSpecified = true; - dmns.Thickness = 7.9; + dmns.Width = 67.1; + dmns.WidthSpecified = true; + dmns.Thickness = 7.9; return dmns; case CommonTypes.MediaType.NintendoDiskCard: - dmns.Height = 76.2; + dmns.Height = 76.2; dmns.HeightSpecified = true; - dmns.Width = 71.12; - dmns.WidthSpecified = true; - dmns.Thickness = 0; + dmns.Width = 71.12; + dmns.WidthSpecified = true; + dmns.Thickness = 0; return dmns; case CommonTypes.MediaType.HiMD: case CommonTypes.MediaType.MD: case CommonTypes.MediaType.MDData: case CommonTypes.MediaType.MDData2: - dmns.Height = 68; + dmns.Height = 68; dmns.HeightSpecified = true; - dmns.Width = 71.5; - dmns.WidthSpecified = true; - dmns.Thickness = 4.8; + dmns.Width = 71.5; + dmns.WidthSpecified = true; + dmns.Thickness = 4.8; return dmns; case CommonTypes.MediaType.DAT160: case CommonTypes.MediaType.DAT320: @@ -498,90 +498,90 @@ namespace DiscImageChef.Metadata case CommonTypes.MediaType.DDS3: case CommonTypes.MediaType.DDS4: case CommonTypes.MediaType.DigitalAudioTape: - dmns.Height = 54; + dmns.Height = 54; dmns.HeightSpecified = true; - dmns.Width = 73; - dmns.WidthSpecified = true; - dmns.Thickness = 10.5; + dmns.Width = 73; + dmns.WidthSpecified = true; + dmns.Thickness = 10.5; return dmns; case CommonTypes.MediaType.CompactFloppy: - dmns.Height = 100; + dmns.Height = 100; dmns.HeightSpecified = true; - dmns.Width = 80; - dmns.WidthSpecified = true; - dmns.Thickness = 5; + dmns.Width = 80; + dmns.WidthSpecified = true; + dmns.Thickness = 5; return dmns; case CommonTypes.MediaType.DECtapeII: - dmns.Height = 60; + dmns.Height = 60; dmns.HeightSpecified = true; - dmns.Width = 81; - dmns.WidthSpecified = true; - dmns.Thickness = 13; + dmns.Width = 81; + dmns.WidthSpecified = true; + dmns.Thickness = 13; return dmns; case CommonTypes.MediaType.Ditto: - dmns.Height = 60; + dmns.Height = 60; dmns.HeightSpecified = true; - dmns.Width = 81; - dmns.WidthSpecified = true; - dmns.Thickness = 14; + dmns.Width = 81; + dmns.WidthSpecified = true; + dmns.Thickness = 14; return dmns; case CommonTypes.MediaType.DittoMax: - dmns.Height = 126; + dmns.Height = 126; dmns.HeightSpecified = true; - dmns.Width = 81; - dmns.WidthSpecified = true; - dmns.Thickness = 14; + dmns.Width = 81; + dmns.WidthSpecified = true; + dmns.Thickness = 14; return dmns; case CommonTypes.MediaType.RDX: case CommonTypes.MediaType.RDX320: - dmns.Height = 119; + dmns.Height = 119; dmns.HeightSpecified = true; - dmns.Width = 87; - dmns.WidthSpecified = true; - dmns.Thickness = 23; + dmns.Width = 87; + dmns.WidthSpecified = true; + dmns.Thickness = 23; return dmns; case CommonTypes.MediaType.LS120: case CommonTypes.MediaType.LS240: - dmns.Height = 94; + dmns.Height = 94; dmns.HeightSpecified = true; - dmns.Width = 90; - dmns.WidthSpecified = true; - dmns.Thickness = 3.5; + dmns.Width = 90; + dmns.WidthSpecified = true; + dmns.Thickness = 3.5; return dmns; case CommonTypes.MediaType.Travan: case CommonTypes.MediaType.Travan3: case CommonTypes.MediaType.Travan4: case CommonTypes.MediaType.Travan5: case CommonTypes.MediaType.Travan7: - dmns.Height = 72; + dmns.Height = 72; dmns.HeightSpecified = true; - dmns.Width = 92; - dmns.WidthSpecified = true; - dmns.Thickness = 15; + dmns.Width = 92; + dmns.WidthSpecified = true; + dmns.Thickness = 15; return dmns; case CommonTypes.MediaType.Travan1Ex: - dmns.Height = 0; + dmns.Height = 0; dmns.HeightSpecified = true; - dmns.Width = 92; - dmns.WidthSpecified = true; - dmns.Thickness = 15; + dmns.Width = 92; + dmns.WidthSpecified = true; + dmns.Thickness = 15; return dmns; case CommonTypes.MediaType.Travan3Ex: - dmns.Height = 0; + dmns.Height = 0; dmns.HeightSpecified = true; - dmns.Width = 92; - dmns.WidthSpecified = true; - dmns.Thickness = 15; + dmns.Width = 92; + dmns.WidthSpecified = true; + dmns.Thickness = 15; return dmns; case CommonTypes.MediaType.ADR2120: case CommonTypes.MediaType.ADR260: case CommonTypes.MediaType.ADR30: case CommonTypes.MediaType.ADR50: - dmns.Height = 129; + dmns.Height = 129; dmns.HeightSpecified = true; - dmns.Width = 93; - dmns.WidthSpecified = true; - dmns.Thickness = 14.5; + dmns.Width = 93; + dmns.WidthSpecified = true; + dmns.Thickness = 14.5; return dmns; case CommonTypes.MediaType.Data8: case CommonTypes.MediaType.AIT1: @@ -611,51 +611,51 @@ namespace DiscImageChef.Metadata case CommonTypes.MediaType.Exatape75m: case CommonTypes.MediaType.Exatape76m: case CommonTypes.MediaType.Exatape80m: - dmns.Height = 62.5; + dmns.Height = 62.5; dmns.HeightSpecified = true; - dmns.Width = 95; - dmns.WidthSpecified = true; - dmns.Thickness = 15; + dmns.Width = 95; + dmns.WidthSpecified = true; + dmns.Thickness = 15; return dmns; case CommonTypes.MediaType.EZ135: case CommonTypes.MediaType.EZ230: - dmns.Height = 97; + dmns.Height = 97; dmns.HeightSpecified = true; - dmns.Width = 98; - dmns.WidthSpecified = true; - dmns.Thickness = 9.5; + dmns.Width = 98; + dmns.WidthSpecified = true; + dmns.Thickness = 9.5; return dmns; case CommonTypes.MediaType.ZIP100: case CommonTypes.MediaType.ZIP250: case CommonTypes.MediaType.ZIP750: - dmns.Height = 98.5; + dmns.Height = 98.5; dmns.HeightSpecified = true; - dmns.Width = 98; - dmns.WidthSpecified = true; - dmns.Thickness = 6.5; + dmns.Width = 98; + dmns.WidthSpecified = true; + dmns.Thickness = 6.5; return dmns; case CommonTypes.MediaType.Jaz: case CommonTypes.MediaType.Jaz2: - dmns.Height = 102; + dmns.Height = 102; dmns.HeightSpecified = true; - dmns.Width = 98; - dmns.WidthSpecified = true; - dmns.Thickness = 12; + dmns.Width = 98; + dmns.WidthSpecified = true; + dmns.Thickness = 12; return dmns; case CommonTypes.MediaType.Orb: case CommonTypes.MediaType.Orb5: - dmns.Height = 104; + dmns.Height = 104; dmns.HeightSpecified = true; - dmns.Width = 98; - dmns.WidthSpecified = true; - dmns.Thickness = 8; + dmns.Width = 98; + dmns.WidthSpecified = true; + dmns.Thickness = 8; return dmns; case CommonTypes.MediaType.SparQ: - dmns.Height = 98; + dmns.Height = 98; dmns.HeightSpecified = true; - dmns.Width = 100; - dmns.WidthSpecified = true; - dmns.Thickness = 9.7; + dmns.Width = 100; + dmns.WidthSpecified = true; + dmns.Thickness = 9.7; return dmns; case CommonTypes.MediaType.SLR1: case CommonTypes.MediaType.SLR2: @@ -676,18 +676,18 @@ namespace DiscImageChef.Metadata case CommonTypes.MediaType.SLRtape7: case CommonTypes.MediaType.SLRtape75: case CommonTypes.MediaType.SLRtape7SL: - dmns.Height = 150; + dmns.Height = 150; dmns.HeightSpecified = true; - dmns.Width = 100; - dmns.WidthSpecified = true; - dmns.Thickness = 18; + dmns.Width = 100; + dmns.WidthSpecified = true; + dmns.Thickness = 18; return dmns; case CommonTypes.MediaType.N64DD: - dmns.Height = 103.124; + dmns.Height = 103.124; dmns.HeightSpecified = true; - dmns.Width = 101.092; - dmns.WidthSpecified = true; - dmns.Thickness = 10.16; + dmns.Width = 101.092; + dmns.WidthSpecified = true; + dmns.Thickness = 10.16; return dmns; case CommonTypes.MediaType.CompactTapeI: case CommonTypes.MediaType.CompactTapeII: @@ -698,11 +698,11 @@ namespace DiscImageChef.Metadata case CommonTypes.MediaType.SDLT1: case CommonTypes.MediaType.SDLT2: case CommonTypes.MediaType.VStapeI: - dmns.Height = 105; + dmns.Height = 105; dmns.HeightSpecified = true; - dmns.Width = 105; - dmns.WidthSpecified = true; - dmns.Thickness = 25; + dmns.Width = 105; + dmns.WidthSpecified = true; + dmns.Thickness = 25; return dmns; case CommonTypes.MediaType.LTO: case CommonTypes.MediaType.LTO2: @@ -716,21 +716,21 @@ namespace DiscImageChef.Metadata case CommonTypes.MediaType.LTO6WORM: case CommonTypes.MediaType.LTO7: case CommonTypes.MediaType.LTO7WORM: - dmns.Height = 101.6; + dmns.Height = 101.6; dmns.HeightSpecified = true; - dmns.Width = 105.41; - dmns.WidthSpecified = true; - dmns.Thickness = 21.59; + dmns.Width = 105.41; + dmns.WidthSpecified = true; + dmns.Thickness = 21.59; return dmns; case CommonTypes.MediaType.IBM3480: case CommonTypes.MediaType.IBM3490: case CommonTypes.MediaType.IBM3490E: case CommonTypes.MediaType.IBM3592: - dmns.Height = 125.73; + dmns.Height = 125.73; dmns.HeightSpecified = true; - dmns.Width = 107.95; - dmns.WidthSpecified = true; - dmns.Thickness = 25.4; + dmns.Width = 107.95; + dmns.WidthSpecified = true; + dmns.Thickness = 25.4; return dmns; case CommonTypes.MediaType.T9840A: case CommonTypes.MediaType.T9840B: @@ -738,44 +738,44 @@ namespace DiscImageChef.Metadata case CommonTypes.MediaType.T9840D: case CommonTypes.MediaType.T9940A: case CommonTypes.MediaType.T9940B: - dmns.Height = 124.46; + dmns.Height = 124.46; dmns.HeightSpecified = true; - dmns.Width = 109.22; - dmns.WidthSpecified = true; - dmns.Thickness = 25.4; + dmns.Width = 109.22; + dmns.WidthSpecified = true; + dmns.Thickness = 25.4; return dmns; case CommonTypes.MediaType.CompactCassette: case CommonTypes.MediaType.Dcas25: case CommonTypes.MediaType.Dcas85: case CommonTypes.MediaType.Dcas103: - dmns.Height = 63.5; + dmns.Height = 63.5; dmns.HeightSpecified = true; - dmns.Width = 128; - dmns.WidthSpecified = true; - dmns.Thickness = 12; + dmns.Width = 128; + dmns.WidthSpecified = true; + dmns.Thickness = 12; return dmns; case CommonTypes.MediaType.IBM3470: - dmns.Height = 58.42; + dmns.Height = 58.42; dmns.HeightSpecified = true; - dmns.Width = 137.16; - dmns.WidthSpecified = true; - dmns.Thickness = 16.51; + dmns.Width = 137.16; + dmns.WidthSpecified = true; + dmns.Thickness = 16.51; return dmns; case CommonTypes.MediaType.Bernoulli2: - dmns.Height = 136; + dmns.Height = 136; dmns.HeightSpecified = true; - dmns.Width = 140; - dmns.WidthSpecified = true; - dmns.Thickness = 9; + dmns.Width = 140; + dmns.WidthSpecified = true; + dmns.Thickness = 9; return dmns; case CommonTypes.MediaType.MLR1: case CommonTypes.MediaType.MLR3: case CommonTypes.MediaType.MLR1SL: - dmns.Height = 101.6; + dmns.Height = 101.6; dmns.HeightSpecified = true; - dmns.Width = 152.4; - dmns.WidthSpecified = true; - dmns.Thickness = 15.24; + dmns.Width = 152.4; + dmns.WidthSpecified = true; + dmns.Thickness = 15.24; return dmns; case CommonTypes.MediaType.QIC11: case CommonTypes.MediaType.QIC120: @@ -783,35 +783,35 @@ namespace DiscImageChef.Metadata case CommonTypes.MediaType.QIC150: case CommonTypes.MediaType.QIC24: case CommonTypes.MediaType.QIC525: - dmns.Height = 101.6; + dmns.Height = 101.6; dmns.HeightSpecified = true; - dmns.Width = 154.2; - dmns.WidthSpecified = true; - dmns.Thickness = 16.6; + dmns.Width = 154.2; + dmns.WidthSpecified = true; + dmns.Thickness = 16.6; return dmns; case CommonTypes.MediaType.Bernoulli: - dmns.Height = 275; + dmns.Height = 275; dmns.HeightSpecified = true; - dmns.Width = 210; - dmns.WidthSpecified = true; - dmns.Thickness = 0; + dmns.Width = 210; + dmns.WidthSpecified = true; + dmns.Thickness = 0; return dmns; case CommonTypes.MediaType.DTF: case CommonTypes.MediaType.DTF2: - dmns.Height = 144.78; + dmns.Height = 144.78; dmns.HeightSpecified = true; - dmns.Width = 254; - dmns.WidthSpecified = true; - dmns.Thickness = 25.4; + dmns.Width = 254; + dmns.WidthSpecified = true; + dmns.Thickness = 25.4; return dmns; case CommonTypes.MediaType.LD: case CommonTypes.MediaType.LDROM: case CommonTypes.MediaType.LDROM2: case CommonTypes.MediaType.MegaLD: case CommonTypes.MediaType.LVROM: - dmns.Diameter = 300; + dmns.Diameter = 300; dmns.DiameterSpecified = true; - dmns.Thickness = 2.5; + dmns.Thickness = 2.5; return dmns; #region CD/DVD/BD @@ -879,34 +879,35 @@ namespace DiscImageChef.Metadata case CommonTypes.MediaType.WOD: case CommonTypes.MediaType.WUOD: case CommonTypes.MediaType.PCFX: - dmns.Diameter = 120; + dmns.Diameter = 120; dmns.DiameterSpecified = true; - dmns.Thickness = 1.2; + dmns.Thickness = 1.2; return dmns; case CommonTypes.MediaType.GOD: - dmns.Diameter = 80; + dmns.Diameter = 80; dmns.DiameterSpecified = true; - dmns.Thickness = 1.2; + dmns.Thickness = 1.2; return dmns; #endregion CD/DVD/BD #region Apple Hard Disks // TODO: Find Apple Widget size case CommonTypes.MediaType.AppleProfile: - dmns.Height = 223.8; + dmns.Height = 223.8; dmns.HeightSpecified = true; - dmns.Width = 438.9; - dmns.WidthSpecified = true; - dmns.Thickness = 111.5; + dmns.Width = 438.9; + dmns.WidthSpecified = true; + dmns.Thickness = 111.5; return dmns; case CommonTypes.MediaType.AppleHD20: - dmns.Height = 246.4; + dmns.Height = 246.4; dmns.HeightSpecified = true; - dmns.Width = 266.7; - dmns.WidthSpecified = true; - dmns.Thickness = 78.7; + dmns.Width = 266.7; + dmns.WidthSpecified = true; + dmns.Thickness = 78.7; return dmns; #endregion Apple Hard Disks + case CommonTypes.MediaType.UMD: dmns.Height = 64; dmns.HeightSpecified = true; diff --git a/DiscImageChef.Metadata/ExtentsConverter.cs b/DiscImageChef.Metadata/ExtentsConverter.cs index 4f0427413..b17abe289 100644 --- a/DiscImageChef.Metadata/ExtentsConverter.cs +++ b/DiscImageChef.Metadata/ExtentsConverter.cs @@ -45,7 +45,7 @@ namespace DiscImageChef.Metadata if(extents == null) return null; Tuple[] tuples = extents.ToArray(); - ExtentType[] array = new ExtentType[tuples.Length]; + 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}; diff --git a/DiscImageChef.Metadata/MediaType.cs b/DiscImageChef.Metadata/MediaType.cs index 5906fdc3f..ba9d31047 100644 --- a/DiscImageChef.Metadata/MediaType.cs +++ b/DiscImageChef.Metadata/MediaType.cs @@ -39,669 +39,669 @@ namespace DiscImageChef.Metadata switch(dskType) { case CommonTypes.MediaType.BDR: - discType = "Blu-ray"; + discType = "Blu-ray"; discSubType = "BD-R"; break; case CommonTypes.MediaType.BDRE: - discType = "Blu-ray"; + discType = "Blu-ray"; discSubType = "BD-RE"; break; case CommonTypes.MediaType.BDREXL: - discType = "Blu-ray"; + discType = "Blu-ray"; discSubType = "BD-RE XL"; break; case CommonTypes.MediaType.BDROM: - discType = "Blu-ray"; + discType = "Blu-ray"; discSubType = "BD-ROM"; break; case CommonTypes.MediaType.BDRXL: - discType = "Blu-ray"; + discType = "Blu-ray"; discSubType = "BD-R XL"; break; case CommonTypes.MediaType.CBHD: - discType = "Blu-ray"; + discType = "Blu-ray"; discSubType = "CBHD"; break; case CommonTypes.MediaType.CD: - discType = "Compact Disc"; + discType = "Compact Disc"; discSubType = "CD"; break; case CommonTypes.MediaType.CDDA: - discType = "Compact Disc"; + discType = "Compact Disc"; discSubType = "CD Digital Audio"; break; case CommonTypes.MediaType.CDEG: - discType = "Compact Disc"; + discType = "Compact Disc"; discSubType = "CD+EG"; break; case CommonTypes.MediaType.CDG: - discType = "Compact Disc"; + discType = "Compact Disc"; discSubType = "CD+G"; break; case CommonTypes.MediaType.CDI: - discType = "Compact Disc"; + discType = "Compact Disc"; discSubType = "CD-i"; break; case CommonTypes.MediaType.CDMIDI: - discType = "Compact Disc"; + discType = "Compact Disc"; discSubType = "CD+MIDI"; break; case CommonTypes.MediaType.CDMO: - discType = "Compact Disc"; + discType = "Compact Disc"; discSubType = "CD-MO"; break; case CommonTypes.MediaType.CDMRW: - discType = "Compact Disc"; + discType = "Compact Disc"; discSubType = "CD-MRW"; break; case CommonTypes.MediaType.CDPLUS: - discType = "Compact Disc"; + discType = "Compact Disc"; discSubType = "CD+"; break; case CommonTypes.MediaType.CDR: - discType = "Compact Disc"; + discType = "Compact Disc"; discSubType = "CD-R"; break; case CommonTypes.MediaType.CDROM: - discType = "Compact Disc"; + discType = "Compact Disc"; discSubType = "CD-ROM"; break; case CommonTypes.MediaType.CDROMXA: - discType = "Compact Disc"; + discType = "Compact Disc"; discSubType = "CD-ROM XA"; break; case CommonTypes.MediaType.CDRW: - discType = "Compact Disc"; + discType = "Compact Disc"; discSubType = "CD-RW"; break; case CommonTypes.MediaType.CDV: - discType = "Compact Disc"; + discType = "Compact Disc"; discSubType = "CD-Video"; break; case CommonTypes.MediaType.DDCD: - discType = "DDCD"; + discType = "DDCD"; discSubType = "DDCD"; break; case CommonTypes.MediaType.DDCDR: - discType = "DDCD"; + discType = "DDCD"; discSubType = "DDCD-R"; break; case CommonTypes.MediaType.DDCDRW: - discType = "DDCD"; + discType = "DDCD"; discSubType = "DDCD-RW"; break; case CommonTypes.MediaType.DTSCD: - discType = "Compact Disc"; + discType = "Compact Disc"; discSubType = "DTS CD"; break; case CommonTypes.MediaType.DVDDownload: - discType = "DVD"; + discType = "DVD"; discSubType = "DVD-Download"; break; case CommonTypes.MediaType.DVDPR: - discType = "DVD"; + discType = "DVD"; discSubType = "DVD+R"; break; case CommonTypes.MediaType.DVDPRDL: - discType = "DVD"; + discType = "DVD"; discSubType = "DVD+R DL"; break; case CommonTypes.MediaType.DVDPRW: - discType = "DVD"; + discType = "DVD"; discSubType = "DVD+RW"; break; case CommonTypes.MediaType.DVDPRWDL: - discType = "DVD"; + discType = "DVD"; discSubType = "DVD+RW DL"; break; case CommonTypes.MediaType.DVDR: - discType = "DVD"; + discType = "DVD"; discSubType = "DVD-R"; break; case CommonTypes.MediaType.DVDRAM: - discType = "DVD"; + discType = "DVD"; discSubType = "DVD-RAM"; break; case CommonTypes.MediaType.DVDRDL: - discType = "DVD"; + discType = "DVD"; discSubType = "DVD-R DL"; break; case CommonTypes.MediaType.DVDROM: - discType = "DVD"; + discType = "DVD"; discSubType = "DVD-ROM"; break; case CommonTypes.MediaType.DVDRW: - discType = "DVD"; + discType = "DVD"; discSubType = "DVD-RW"; break; case CommonTypes.MediaType.DVDRWDL: - discType = "DVD"; + discType = "DVD"; discSubType = "DVD-RW DL"; break; case CommonTypes.MediaType.EVD: - discType = "EVD"; + discType = "EVD"; discSubType = "EVD"; break; case CommonTypes.MediaType.FDDVD: - discType = "FDDVD"; + discType = "FDDVD"; discSubType = "FDDVD"; break; case CommonTypes.MediaType.FVD: - discType = "FVD"; + discType = "FVD"; discSubType = "FVD"; break; case CommonTypes.MediaType.GDR: - discType = "GD"; + discType = "GD"; discSubType = "GD-R"; break; case CommonTypes.MediaType.GDROM: - discType = "GD"; + discType = "GD"; discSubType = "GD-ROM"; break; case CommonTypes.MediaType.GOD: - discType = "DVD"; + discType = "DVD"; discSubType = "GameCube Game Disc"; break; case CommonTypes.MediaType.WOD: - discType = "DVD"; + discType = "DVD"; discSubType = "Wii Optical Disc"; break; case CommonTypes.MediaType.WUOD: - discType = "Blu-ray"; + discType = "Blu-ray"; discSubType = "Wii U Optical Disc"; break; case CommonTypes.MediaType.HDDVDR: - discType = "HD DVD"; + discType = "HD DVD"; discSubType = "HD DVD-R"; break; case CommonTypes.MediaType.HDDVDRAM: - discType = "HD DVD"; + discType = "HD DVD"; discSubType = "HD DVD-RAM"; break; case CommonTypes.MediaType.HDDVDRDL: - discType = "HD DVD"; + discType = "HD DVD"; discSubType = "HD DVD-R DL"; break; case CommonTypes.MediaType.HDDVDROM: - discType = "HD DVD"; + discType = "HD DVD"; discSubType = "HD DVD-ROM"; break; case CommonTypes.MediaType.HDDVDRW: - discType = "HD DVD"; + discType = "HD DVD"; discSubType = "HD DVD-RW"; break; case CommonTypes.MediaType.HDDVDRWDL: - discType = "HD DVD"; + discType = "HD DVD"; discSubType = "HD DVD-RW DL"; break; case CommonTypes.MediaType.HDVMD: - discType = "HD VMD"; + discType = "HD VMD"; discSubType = "HD VMD"; break; case CommonTypes.MediaType.HiMD: - discType = "MiniDisc"; + discType = "MiniDisc"; discSubType = "HiMD"; break; case CommonTypes.MediaType.HVD: - discType = "HVD"; + discType = "HVD"; discSubType = "HVD"; break; case CommonTypes.MediaType.LD: - discType = "LaserDisc"; + discType = "LaserDisc"; discSubType = "LaserDisc"; break; case CommonTypes.MediaType.LDROM: - discType = "LaserDisc"; + discType = "LaserDisc"; discSubType = "LD-ROM"; break; case CommonTypes.MediaType.LVROM: - discType = "LaserDisc"; + discType = "LaserDisc"; discSubType = "LV-ROM"; break; case CommonTypes.MediaType.MegaLD: - discType = "LaserDisc"; + discType = "LaserDisc"; discSubType = "MegaLD"; break; case CommonTypes.MediaType.MD: - discType = "MiniDisc"; + discType = "MiniDisc"; discSubType = "MiniDisc"; break; case CommonTypes.MediaType.MEGACD: - discType = "Compact Disc"; + discType = "Compact Disc"; discSubType = "Sega Mega CD"; break; case CommonTypes.MediaType.PCD: - discType = "Compact Disc"; + discType = "Compact Disc"; discSubType = "Photo CD"; break; case CommonTypes.MediaType.PlayStationMemoryCard: - discType = "PlayStation Memory Card"; + discType = "PlayStation Memory Card"; discSubType = "PlayStation Memory Card"; break; case CommonTypes.MediaType.PlayStationMemoryCard2: - discType = "PlayStation Memory Card"; + discType = "PlayStation Memory Card"; discSubType = "PlayStation 2 Memory Card"; break; case CommonTypes.MediaType.PS1CD: - discType = "Compact Disc"; + discType = "Compact Disc"; discSubType = "PlayStation Game Disc"; break; case CommonTypes.MediaType.PS2CD: - discType = "Compact Disc"; + discType = "Compact Disc"; discSubType = "PlayStation 2 Game Disc"; break; case CommonTypes.MediaType.PS2DVD: - discType = "DVD"; + discType = "DVD"; discSubType = "PlayStation 2 Game Disc"; break; case CommonTypes.MediaType.PS3BD: - discType = "Blu-ray"; + discType = "Blu-ray"; discSubType = "PlayStation 3 Game Disc"; break; case CommonTypes.MediaType.PS3DVD: - discType = "DVD"; + discType = "DVD"; discSubType = "PlayStation 3 Game Disc"; break; case CommonTypes.MediaType.PS4BD: - discType = "Blu-ray"; + discType = "Blu-ray"; discSubType = "PlayStation 4 Game Disc"; break; case CommonTypes.MediaType.SACD: - discType = "SACD"; + discType = "SACD"; discSubType = "Super Audio CD"; break; case CommonTypes.MediaType.SegaCard: - discType = "Sega Card"; + discType = "Sega Card"; discSubType = "Sega Card"; break; case CommonTypes.MediaType.SATURNCD: - discType = "Compact Disc"; + discType = "Compact Disc"; discSubType = "Sega Saturn CD"; break; case CommonTypes.MediaType.SVCD: - discType = "Compact Disc"; + discType = "Compact Disc"; discSubType = "Super Video CD"; break; case CommonTypes.MediaType.SVOD: - discType = "SVOD"; + discType = "SVOD"; discSubType = "SVOD"; break; case CommonTypes.MediaType.UDO: - discType = "UDO"; + discType = "UDO"; discSubType = "UDO"; break; case CommonTypes.MediaType.UMD: - discType = "UMD"; + discType = "UMD"; discSubType = "Universal Media Disc"; break; case CommonTypes.MediaType.VCD: - discType = "Compact Disc"; + discType = "Compact Disc"; discSubType = "Video CD"; break; case CommonTypes.MediaType.XGD: - discType = "DVD"; + discType = "DVD"; discSubType = "Xbox Game Disc (XGD)"; break; case CommonTypes.MediaType.XGD2: - discType = "DVD"; + discType = "DVD"; discSubType = "Xbox 360 Game Disc (XGD2)"; break; case CommonTypes.MediaType.XGD3: - discType = "DVD"; + discType = "DVD"; discSubType = "Xbox 360 Game Disc (XGD3)"; break; case CommonTypes.MediaType.XGD4: - discType = "Blu-ray"; + discType = "Blu-ray"; discSubType = "Xbox One Game Disc (XGD4)"; break; case CommonTypes.MediaType.Apple32SS: - discType = "5.25\" floppy"; + discType = "5.25\" floppy"; discSubType = "Apple DOS 3.2"; break; case CommonTypes.MediaType.Apple32DS: - discType = "5.25\" floppy"; + discType = "5.25\" floppy"; discSubType = "Apple DOS 3.2 (double-sided)"; break; case CommonTypes.MediaType.Apple33SS: - discType = "5.25\" floppy"; + discType = "5.25\" floppy"; discSubType = "Apple DOS 3.3"; break; case CommonTypes.MediaType.Apple33DS: - discType = "5.25\" floppy"; + discType = "5.25\" floppy"; discSubType = "Apple DOS 3.3 (double-sided)"; break; case CommonTypes.MediaType.AppleSonySS: - discType = "3.5\" floppy"; + discType = "3.5\" floppy"; discSubType = "Apple 400K"; break; case CommonTypes.MediaType.AppleSonyDS: - discType = "3.5\" floppy"; + discType = "3.5\" floppy"; discSubType = "Apple 800K"; break; case CommonTypes.MediaType.AppleFileWare: - discType = "5.25\" floppy"; + discType = "5.25\" floppy"; discSubType = "Apple FileWare"; break; case CommonTypes.MediaType.RX50: - discType = "5.25\" floppy"; + discType = "5.25\" floppy"; discSubType = "DEC RX50"; break; case CommonTypes.MediaType.DOS_525_SS_DD_8: - discType = "5.25\" floppy"; + discType = "5.25\" floppy"; discSubType = "IBM double-density, single-sided, 8 sectors"; break; case CommonTypes.MediaType.DOS_525_SS_DD_9: - discType = "5.25\" floppy"; + discType = "5.25\" floppy"; discSubType = "IBM double-density, single-sided, 9 sectors"; break; case CommonTypes.MediaType.DOS_525_DS_DD_8: - discType = "5.25\" floppy"; + discType = "5.25\" floppy"; discSubType = "IBM double-density, double-sided, 8 sectors"; break; case CommonTypes.MediaType.DOS_525_DS_DD_9: - discType = "5.25\" floppy"; + discType = "5.25\" floppy"; discSubType = "IBM double-density, double-sided, 9 sectors"; break; case CommonTypes.MediaType.DOS_525_HD: - discType = "5.25\" floppy"; + discType = "5.25\" floppy"; discSubType = "IBM high-density"; break; case CommonTypes.MediaType.DOS_35_SS_DD_8: - discType = "3.5\" floppy"; + discType = "3.5\" floppy"; discSubType = "IBM double-density, single-sided, 8 sectors"; break; case CommonTypes.MediaType.DOS_35_SS_DD_9: - discType = "3.5\" floppy"; + discType = "3.5\" floppy"; discSubType = "IBM double-density, single-sided, 9 sectors"; break; case CommonTypes.MediaType.DOS_35_DS_DD_8: - discType = "3.5\" floppy"; + discType = "3.5\" floppy"; discSubType = "IBM double-density, double-sided, 8 sectors"; break; case CommonTypes.MediaType.DOS_35_DS_DD_9: - discType = "3.5\" floppy"; + discType = "3.5\" floppy"; discSubType = "IBM double-density, double-sided, 9 sectors"; break; case CommonTypes.MediaType.DOS_35_HD: - discType = "3.5\" floppy"; + discType = "3.5\" floppy"; discSubType = "IBM high-density"; break; case CommonTypes.MediaType.DOS_35_ED: - discType = "3.5\" floppy"; + discType = "3.5\" floppy"; discSubType = "IBM extra-density"; break; case CommonTypes.MediaType.Apricot_35: - discType = "3.5\" floppy"; + discType = "3.5\" floppy"; discSubType = "Apricot double-density, single-sided, 70 tracks"; break; case CommonTypes.MediaType.DMF: - discType = "3.5\" floppy"; + discType = "3.5\" floppy"; discSubType = "Microsoft DMF"; break; case CommonTypes.MediaType.DMF_82: - discType = "3.5\" floppy"; + discType = "3.5\" floppy"; discSubType = "Microsoft DMF (82-track)"; break; case CommonTypes.MediaType.XDF_35: - discType = "3.5\" floppy"; + discType = "3.5\" floppy"; discSubType = "IBM XDF"; break; case CommonTypes.MediaType.XDF_525: - discType = "5.25\" floppy"; + discType = "5.25\" floppy"; discSubType = "IBM XDF"; break; case CommonTypes.MediaType.IBM23FD: - discType = "8\" floppy"; + discType = "8\" floppy"; discSubType = "IBM 23FD"; break; case CommonTypes.MediaType.IBM33FD_128: - discType = "8\" floppy"; + discType = "8\" floppy"; discSubType = "IBM 33FD (128 bytes/sector)"; break; case CommonTypes.MediaType.IBM33FD_256: - discType = "8\" floppy"; + discType = "8\" floppy"; discSubType = "IBM 33FD (256 bytes/sector)"; break; case CommonTypes.MediaType.IBM33FD_512: - discType = "8\" floppy"; + discType = "8\" floppy"; discSubType = "IBM 33FD (512 bytes/sector)"; break; case CommonTypes.MediaType.IBM43FD_128: - discType = "8\" floppy"; + discType = "8\" floppy"; discSubType = "IBM 43FD (128 bytes/sector)"; break; case CommonTypes.MediaType.IBM43FD_256: - discType = "8\" floppy"; + discType = "8\" floppy"; discSubType = "IBM 43FD (256 bytes/sector)"; break; case CommonTypes.MediaType.IBM53FD_256: - discType = "8\" floppy"; + discType = "8\" floppy"; discSubType = "IBM 53FD (256 bytes/sector)"; break; case CommonTypes.MediaType.IBM53FD_512: - discType = "8\" floppy"; + discType = "8\" floppy"; discSubType = "IBM 53FD (512 bytes/sector)"; break; case CommonTypes.MediaType.IBM53FD_1024: - discType = "8\" floppy"; + discType = "8\" floppy"; discSubType = "IBM 53FD (1024 bytes/sector)"; break; case CommonTypes.MediaType.RX01: - discType = "8\" floppy"; + discType = "8\" floppy"; discSubType = "DEC RX-01"; break; case CommonTypes.MediaType.RX02: - discType = "8\" floppy"; + discType = "8\" floppy"; discSubType = "DEC RX-02"; break; case CommonTypes.MediaType.RX03: - discType = "8\" floppy"; + discType = "8\" floppy"; discSubType = "DEC RX-03"; break; case CommonTypes.MediaType.ACORN_525_SS_SD_40: - discType = "5.25\" floppy"; + discType = "5.25\" floppy"; discSubType = "BBC Micro 100K"; break; case CommonTypes.MediaType.ACORN_525_SS_SD_80: - discType = "5.25\" floppy"; + discType = "5.25\" floppy"; discSubType = "BBC Micro 200K"; break; case CommonTypes.MediaType.ACORN_525_SS_DD_40: - discType = "5.25\" floppy"; + discType = "5.25\" floppy"; discSubType = "Acorn S"; break; case CommonTypes.MediaType.ACORN_525_SS_DD_80: - discType = "5.25\" floppy"; + discType = "5.25\" floppy"; discSubType = "Acorn M"; break; case CommonTypes.MediaType.ACORN_525_DS_DD: - discType = "5.25\" floppy"; + discType = "5.25\" floppy"; discSubType = "Acorn L"; break; case CommonTypes.MediaType.ACORN_35_DS_DD: - discType = "3.5\" floppy"; + discType = "3.5\" floppy"; discSubType = "Acorn Archimedes"; break; case CommonTypes.MediaType.ACORN_35_DS_HD: - discType = "3.5\" floppy"; + discType = "3.5\" floppy"; discSubType = "Acorn Archimedes high-density"; break; case CommonTypes.MediaType.ATARI_525_SD: - discType = "5.25\" floppy"; + discType = "5.25\" floppy"; discSubType = "Atari single-density"; break; case CommonTypes.MediaType.ATARI_525_ED: - discType = "5.25\" floppy"; + discType = "5.25\" floppy"; discSubType = "Atari enhanced-density"; break; case CommonTypes.MediaType.ATARI_525_DD: - discType = "5.25\" floppy"; + discType = "5.25\" floppy"; discSubType = "Atari double-density"; break; case CommonTypes.MediaType.ATARI_35_SS_DD: - discType = "3.5\" floppy"; + discType = "3.5\" floppy"; discSubType = "Atari ST double-density, single-sided, 10 sectors"; break; case CommonTypes.MediaType.ATARI_35_DS_DD: - discType = "3.5\" floppy"; + discType = "3.5\" floppy"; discSubType = "Atari ST double-density, double-sided, 10 sectors"; break; case CommonTypes.MediaType.ATARI_35_SS_DD_11: - discType = "3.5\" floppy"; + discType = "3.5\" floppy"; discSubType = "Atari ST double-density, single-sided, 11 sectors"; break; case CommonTypes.MediaType.ATARI_35_DS_DD_11: - discType = "3.5\" floppy"; + discType = "3.5\" floppy"; discSubType = "Atari ST double-density, double-sided, 11 sectors"; break; case CommonTypes.MediaType.CBM_1540: case CommonTypes.MediaType.CBM_1540_Ext: - discType = "5.25\" floppy"; + discType = "5.25\" floppy"; discSubType = "Commodore 1540/1541"; break; case CommonTypes.MediaType.CBM_1571: - discType = "5.25\" floppy"; + discType = "5.25\" floppy"; discSubType = "Commodore 1571"; break; case CommonTypes.MediaType.CBM_35_DD: - discType = "3.5\" floppy"; + discType = "3.5\" floppy"; discSubType = "Commodore 1581"; break; case CommonTypes.MediaType.CBM_AMIGA_35_DD: - discType = "3.5\" floppy"; + discType = "3.5\" floppy"; discSubType = "Amiga double-density"; break; case CommonTypes.MediaType.CBM_AMIGA_35_HD: - discType = "3.5\" floppy"; + discType = "3.5\" floppy"; discSubType = "Amiga high-density"; break; case CommonTypes.MediaType.NEC_8_SD: - discType = "8\" floppy"; + discType = "8\" floppy"; discSubType = "NEC single-sided"; break; case CommonTypes.MediaType.NEC_8_DD: - discType = "8\" floppy"; + discType = "8\" floppy"; discSubType = "NEC double-sided"; break; case CommonTypes.MediaType.NEC_525_SS: - discType = "5.25\" floppy"; + discType = "5.25\" floppy"; discSubType = "NEC single-sided"; break; case CommonTypes.MediaType.NEC_525_HD: - discType = "5.25\" floppy"; + discType = "5.25\" floppy"; discSubType = "NEC high-density"; break; case CommonTypes.MediaType.NEC_35_HD_8: - discType = "3.5\" floppy"; + discType = "3.5\" floppy"; discSubType = "NEC high-density"; break; case CommonTypes.MediaType.NEC_35_HD_15: - discType = "3.5\" floppy"; + discType = "3.5\" floppy"; discSubType = "NEC high-density"; break; case CommonTypes.MediaType.NEC_35_TD: - discType = "3.5\" floppy"; + discType = "3.5\" floppy"; discSubType = "NEC triple-density"; break; case CommonTypes.MediaType.SHARP_525_9: - discType = "5.25\" floppy"; + discType = "5.25\" floppy"; discSubType = "Sharp (9 sectors per track)"; break; case CommonTypes.MediaType.SHARP_35_9: - discType = "3.5\" floppy"; + discType = "3.5\" floppy"; discSubType = "Sharp (9 sectors per track)"; break; case CommonTypes.MediaType.ECMA_54: - discType = "8\" floppy"; + discType = "8\" floppy"; discSubType = "ECMA-54"; break; case CommonTypes.MediaType.ECMA_59: - discType = "8\" floppy"; + discType = "8\" floppy"; discSubType = "ECMA-59"; break; case CommonTypes.MediaType.ECMA_69_8: case CommonTypes.MediaType.ECMA_69_15: case CommonTypes.MediaType.ECMA_69_26: - discType = "8\" floppy"; + discType = "8\" floppy"; discSubType = "ECMA-69"; break; case CommonTypes.MediaType.ECMA_66: - discType = "5.25\" floppy"; + discType = "5.25\" floppy"; discSubType = "ECMA-66"; break; case CommonTypes.MediaType.ECMA_70: - discType = "5.25\" floppy"; + discType = "5.25\" floppy"; discSubType = "ECMA-70"; break; case CommonTypes.MediaType.ECMA_78: case CommonTypes.MediaType.ECMA_78_2: - discType = "5.25\" floppy"; + discType = "5.25\" floppy"; discSubType = "ECMA-78"; break; case CommonTypes.MediaType.ECMA_99_8: case CommonTypes.MediaType.ECMA_99_15: case CommonTypes.MediaType.ECMA_99_26: - discType = "5.25\" floppy"; + discType = "5.25\" floppy"; discSubType = "ECMA-99"; break; case CommonTypes.MediaType.FDFORMAT_525_DD: - discType = "5.25\" floppy"; + discType = "5.25\" floppy"; discSubType = "FDFORMAT double-density"; break; case CommonTypes.MediaType.FDFORMAT_525_HD: - discType = "5.25\" floppy"; + discType = "5.25\" floppy"; discSubType = "FDFORMAT high-density"; break; case CommonTypes.MediaType.FDFORMAT_35_DD: - discType = "3.5\" floppy"; + discType = "3.5\" floppy"; discSubType = "FDFORMAT double-density"; break; case CommonTypes.MediaType.FDFORMAT_35_HD: - discType = "3.5\" floppy"; + discType = "3.5\" floppy"; discSubType = "FDFORMAT high-density"; break; case CommonTypes.MediaType.ECMA_260: case CommonTypes.MediaType.ECMA_260_Double: - discType = "356mm magneto-optical"; + discType = "356mm magneto-optical"; discSubType = "ECMA-260 / ISO 15898"; break; case CommonTypes.MediaType.ECMA_183_512: case CommonTypes.MediaType.ECMA_183: - discType = "5.25\" magneto-optical"; + discType = "5.25\" magneto-optical"; discSubType = "ECMA-183"; break; case CommonTypes.MediaType.ECMA_184_512: case CommonTypes.MediaType.ECMA_184: - discType = "5.25\" magneto-optical"; + discType = "5.25\" magneto-optical"; discSubType = "ECMA-184"; break; case CommonTypes.MediaType.ECMA_154: - discType = "3.5\" magneto-optical"; + discType = "3.5\" magneto-optical"; discSubType = "ECMA-154"; break; case CommonTypes.MediaType.ECMA_201: case CommonTypes.MediaType.ECMA_201_ROM: - discType = "3.5\" magneto-optical"; + discType = "3.5\" magneto-optical"; discSubType = "ECMA-201"; break; case CommonTypes.MediaType.FlashDrive: - discType = "USB flash drive"; + discType = "USB flash drive"; discSubType = "USB flash drive"; break; case CommonTypes.MediaType.SuperCDROM2: - discType = "Compact Disc"; + discType = "Compact Disc"; discSubType = "Super CD-ROM²"; break; case CommonTypes.MediaType.LDROM2: - discType = "LaserDisc"; + discType = "LaserDisc"; discSubType = "LD-ROM²"; break; case CommonTypes.MediaType.JaguarCD: - discType = "Compact Disc"; + discType = "Compact Disc"; discSubType = "Atari Jaguar CD"; break; case CommonTypes.MediaType.ThreeDO: - discType = "Compact Disc"; + discType = "Compact Disc"; discSubType = "3DO"; break; case CommonTypes.MediaType.PCFX: @@ -713,743 +713,743 @@ namespace DiscImageChef.Metadata discSubType = "NEO-GEO CD"; break; case CommonTypes.MediaType.ZIP100: - discType = "Iomega ZIP"; + discType = "Iomega ZIP"; discSubType = "Iomega ZIP100"; break; case CommonTypes.MediaType.ZIP250: - discType = "Iomega ZIP"; + discType = "Iomega ZIP"; discSubType = "Iomega ZIP250"; break; case CommonTypes.MediaType.ZIP750: - discType = "Iomega ZIP"; + discType = "Iomega ZIP"; discSubType = "Iomega ZIP750"; break; case CommonTypes.MediaType.AppleProfile: - discType = "Hard Disk Drive"; + discType = "Hard Disk Drive"; discSubType = "Apple Profile"; break; case CommonTypes.MediaType.AppleWidget: - discType = "Hard Disk Drive"; + discType = "Hard Disk Drive"; discSubType = "Apple Widget"; break; case CommonTypes.MediaType.AppleHD20: - discType = "Hard Disk Drive"; + discType = "Hard Disk Drive"; discSubType = "Apple HD20"; break; case CommonTypes.MediaType.PriamDataTower: - discType = "Hard Disk Drive"; + discType = "Hard Disk Drive"; discSubType = "Priam DataTower"; break; case CommonTypes.MediaType.DDS1: - discType = "Digital Data Storage"; + discType = "Digital Data Storage"; discSubType = "DDS"; break; case CommonTypes.MediaType.DDS2: - discType = "Digital Data Storage"; + discType = "Digital Data Storage"; discSubType = "DDS-2"; break; case CommonTypes.MediaType.DDS3: - discType = "Digital Data Storage"; + discType = "Digital Data Storage"; discSubType = "DDS-3"; break; case CommonTypes.MediaType.DDS4: - discType = "Digital Data Storage"; + discType = "Digital Data Storage"; discSubType = "DDS-4"; break; case CommonTypes.MediaType.PocketZip: - discType = "Iomega PocketZip"; + discType = "Iomega PocketZip"; discSubType = "Iomega PocketZip"; break; case CommonTypes.MediaType.CompactFloppy: - discType = "3\" floppy"; + discType = "3\" floppy"; discSubType = "Compact Floppy"; break; case CommonTypes.MediaType.GENERIC_HDD: - discType = "Hard Disk Drive"; + discType = "Hard Disk Drive"; discSubType = "Unknown"; break; case CommonTypes.MediaType.MDData: - discType = "MiniDisc"; + discType = "MiniDisc"; discSubType = "MD-DATA"; break; case CommonTypes.MediaType.MDData2: - discType = "MiniDisc"; + discType = "MiniDisc"; discSubType = "MD-DATA2"; break; case CommonTypes.MediaType.UDO2: - discType = "UDO"; + discType = "UDO"; discSubType = "UDO2"; break; case CommonTypes.MediaType.UDO2_WORM: - discType = "UDO"; + discType = "UDO"; discSubType = "UDO2 (WORM)"; break; case CommonTypes.MediaType.ADR30: - discType = "Advanced Digital Recording"; + discType = "Advanced Digital Recording"; discSubType = "ADR 30"; break; case CommonTypes.MediaType.ADR50: - discType = "Advanced Digital Recording"; + discType = "Advanced Digital Recording"; discSubType = "ADR 50"; break; case CommonTypes.MediaType.ADR260: - discType = "Advanced Digital Recording"; + discType = "Advanced Digital Recording"; discSubType = "ADR 2.60"; break; case CommonTypes.MediaType.ADR2120: - discType = "Advanced Digital Recording"; + discType = "Advanced Digital Recording"; discSubType = "ADR 2.120"; break; case CommonTypes.MediaType.AIT1: - discType = "Advanced Intelligent Tape"; + discType = "Advanced Intelligent Tape"; discSubType = "AIT-1"; break; case CommonTypes.MediaType.AIT1Turbo: - discType = "Advanced Intelligent Tape"; + discType = "Advanced Intelligent Tape"; discSubType = "AIT-1 Turbo"; break; case CommonTypes.MediaType.AIT2: - discType = "Advanced Intelligent Tape"; + discType = "Advanced Intelligent Tape"; discSubType = "AIT-2"; break; case CommonTypes.MediaType.AIT2Turbo: - discType = "Advanced Intelligent Tape"; + discType = "Advanced Intelligent Tape"; discSubType = "AIT-2 Turbo"; break; case CommonTypes.MediaType.AIT3: - discType = "Advanced Intelligent Tape"; + discType = "Advanced Intelligent Tape"; discSubType = "AIT-3"; break; case CommonTypes.MediaType.AIT3Ex: - discType = "Advanced Intelligent Tape"; + discType = "Advanced Intelligent Tape"; discSubType = "AIT-3Ex"; break; case CommonTypes.MediaType.AIT3Turbo: - discType = "Advanced Intelligent Tape"; + discType = "Advanced Intelligent Tape"; discSubType = "AIT-3 Turbo"; break; case CommonTypes.MediaType.AIT4: - discType = "Advanced Intelligent Tape"; + discType = "Advanced Intelligent Tape"; discSubType = "AIT-4"; break; case CommonTypes.MediaType.AIT5: - discType = "Advanced Intelligent Tape"; + discType = "Advanced Intelligent Tape"; discSubType = "AIT-5"; break; case CommonTypes.MediaType.AITETurbo: - discType = "Advanced Intelligent Tape"; + discType = "Advanced Intelligent Tape"; discSubType = "AIT-E Turbo"; break; case CommonTypes.MediaType.SAIT1: - discType = "Super Advanced Intelligent Tape"; + discType = "Super Advanced Intelligent Tape"; discSubType = "SAIT-1"; break; case CommonTypes.MediaType.SAIT2: - discType = "Super Advanced Intelligent Tape"; + discType = "Super Advanced Intelligent Tape"; discSubType = "SAIT-2"; break; case CommonTypes.MediaType.Bernoulli: - discType = "Iomega Bernoulli"; + discType = "Iomega Bernoulli"; discSubType = "Iomega Bernoulli"; break; case CommonTypes.MediaType.Bernoulli2: - discType = "Iomega Bernoulli"; + discType = "Iomega Bernoulli"; discSubType = "Iomega Bernoulli 2"; break; case CommonTypes.MediaType.Ditto: - discType = "Iomega Ditto"; + discType = "Iomega Ditto"; discSubType = "Iomega Ditto"; break; case CommonTypes.MediaType.DittoMax: - discType = "Iomega Ditto"; + discType = "Iomega Ditto"; discSubType = "Iomega Ditto Max"; break; case CommonTypes.MediaType.Jaz: - discType = "Iomega Jaz"; + discType = "Iomega Jaz"; discSubType = "Iomega Jaz 1GB"; break; case CommonTypes.MediaType.Jaz2: - discType = "Iomega Jaz"; + discType = "Iomega Jaz"; discSubType = "Iomega Jaz 2GB"; break; case CommonTypes.MediaType.REV35: - discType = "Iomega REV"; + discType = "Iomega REV"; discSubType = "Iomega REV-35"; break; case CommonTypes.MediaType.REV70: - discType = "Iomega REV"; + discType = "Iomega REV"; discSubType = "Iomega REV-70"; break; case CommonTypes.MediaType.REV120: - discType = "Iomega REV"; + discType = "Iomega REV"; discSubType = "Iomega REV-120"; break; case CommonTypes.MediaType.CompactFlash: - discType = "Compact Flash"; + discType = "Compact Flash"; discSubType = "Compact Flash"; break; case CommonTypes.MediaType.CompactFlashType2: - discType = "Compact Flash"; + discType = "Compact Flash"; discSubType = "Compact Flash Type 2"; break; case CommonTypes.MediaType.CFast: - discType = "Compact Flash"; + discType = "Compact Flash"; discSubType = "CFast"; break; case CommonTypes.MediaType.DigitalAudioTape: - discType = "Digital Audio Tape"; + discType = "Digital Audio Tape"; discSubType = "Digital Audio Tape"; break; case CommonTypes.MediaType.DAT72: - discType = "Digital Data Storage"; + discType = "Digital Data Storage"; discSubType = "DAT-72"; break; case CommonTypes.MediaType.DAT160: - discType = "Digital Data Storage"; + discType = "Digital Data Storage"; discSubType = "DAT-160"; break; case CommonTypes.MediaType.DAT320: - discType = "Digital Data Storage"; + discType = "Digital Data Storage"; discSubType = "DAT-320"; break; case CommonTypes.MediaType.DECtapeII: - discType = "DECtape"; + discType = "DECtape"; discSubType = "DECtape II"; break; case CommonTypes.MediaType.CompactTapeI: - discType = "CompacTape"; + discType = "CompacTape"; discSubType = "CompacTape"; break; case CommonTypes.MediaType.CompactTapeII: - discType = "CompacTape"; + discType = "CompacTape"; discSubType = "CompacTape II"; break; case CommonTypes.MediaType.DLTtapeIII: - discType = "Digital Linear Tape"; + discType = "Digital Linear Tape"; discSubType = "DLTtape III"; break; case CommonTypes.MediaType.DLTtapeIIIxt: - discType = "Digital Linear Tape"; + discType = "Digital Linear Tape"; discSubType = "DLTtape IIIXT"; break; case CommonTypes.MediaType.DLTtapeIV: - discType = "Digital Linear Tape"; + discType = "Digital Linear Tape"; discSubType = "DLTtape IV"; break; case CommonTypes.MediaType.DLTtapeS4: - discType = "Digital Linear Tape"; + discType = "Digital Linear Tape"; discSubType = "DLTtape S4"; break; case CommonTypes.MediaType.SDLT1: - discType = "Super Digital Linear Tape"; + discType = "Super Digital Linear Tape"; discSubType = "SDLTtape I"; break; case CommonTypes.MediaType.SDLT2: - discType = "Super Digital Linear Tape"; + discType = "Super Digital Linear Tape"; discSubType = "SDLTtape II"; break; case CommonTypes.MediaType.VStapeI: - discType = "Digital Linear Tape"; + discType = "Digital Linear Tape"; discSubType = "DLTtape VS1"; break; case CommonTypes.MediaType.Data8: - discType = "Data8"; + discType = "Data8"; discSubType = "Data8"; break; case CommonTypes.MediaType.MiniDV: - discType = "DV tape"; + discType = "DV tape"; discSubType = "MiniDV"; break; case CommonTypes.MediaType.Exatape15m: - discType = "Exatape"; + discType = "Exatape"; discSubType = "Exatape (15m)"; break; case CommonTypes.MediaType.Exatape22m: - discType = "Exatape"; + discType = "Exatape"; discSubType = "Exatape (22m)"; break; case CommonTypes.MediaType.Exatape22mAME: - discType = "Exatape"; + discType = "Exatape"; discSubType = "Exatape (22m AME)"; break; case CommonTypes.MediaType.Exatape28m: - discType = "Exatape"; + discType = "Exatape"; discSubType = "Exatape (28m)"; break; case CommonTypes.MediaType.Exatape40m: - discType = "Exatape"; + discType = "Exatape"; discSubType = "Exatape (40m)"; break; case CommonTypes.MediaType.Exatape45m: - discType = "Exatape"; + discType = "Exatape"; discSubType = "Exatape (45m)"; break; case CommonTypes.MediaType.Exatape54m: - discType = "Exatape"; + discType = "Exatape"; discSubType = "Exatape (54m)"; break; case CommonTypes.MediaType.Exatape75m: - discType = "Exatape"; + discType = "Exatape"; discSubType = "Exatape (75m)"; break; case CommonTypes.MediaType.Exatape76m: - discType = "Exatape"; + discType = "Exatape"; discSubType = "Exatape (76m)"; break; case CommonTypes.MediaType.Exatape80m: - discType = "Exatape"; + discType = "Exatape"; discSubType = "Exatape (80m)"; break; case CommonTypes.MediaType.Exatape106m: - discType = "Exatape"; + discType = "Exatape"; discSubType = "Exatape (106m)"; break; case CommonTypes.MediaType.Exatape112m: - discType = "Exatape"; + discType = "Exatape"; discSubType = "Exatape (112m)"; break; case CommonTypes.MediaType.Exatape125m: - discType = "Exatape"; + discType = "Exatape"; discSubType = "Exatape (125m)"; break; case CommonTypes.MediaType.Exatape150m: - discType = "Exatape"; + discType = "Exatape"; discSubType = "Exatape (150m)"; break; case CommonTypes.MediaType.Exatape160mXL: - discType = "Exatape"; + discType = "Exatape"; discSubType = "Exatape XL (160m)"; break; case CommonTypes.MediaType.Exatape170m: - discType = "Exatape"; + discType = "Exatape"; discSubType = "Exatape (170m)"; break; case CommonTypes.MediaType.Exatape225m: - discType = "Exatape"; + discType = "Exatape"; discSubType = "Exatape (225m)"; break; case CommonTypes.MediaType.EZ135: - discType = "3.5\" SyQuest cartridge"; + discType = "3.5\" SyQuest cartridge"; discSubType = "EZ135"; break; case CommonTypes.MediaType.EZ230: - discType = "3.5\" SyQuest cartridge"; + discType = "3.5\" SyQuest cartridge"; discSubType = "EZ230"; break; case CommonTypes.MediaType.Quest: - discType = "3.5\" SyQuest cartridge"; + discType = "3.5\" SyQuest cartridge"; discSubType = "Quest"; break; case CommonTypes.MediaType.SparQ: - discType = "3.5\" SyQuest cartridge"; + discType = "3.5\" SyQuest cartridge"; discSubType = "SparQ"; break; case CommonTypes.MediaType.SQ100: - discType = "3.9\" SyQuest cartridge"; + discType = "3.9\" SyQuest cartridge"; discSubType = "SQ100"; break; case CommonTypes.MediaType.SQ200: - discType = "3.9\" SyQuest cartridge"; + discType = "3.9\" SyQuest cartridge"; discSubType = "SQ200"; break; case CommonTypes.MediaType.SQ300: - discType = "3.9\" SyQuest cartridge"; + discType = "3.9\" SyQuest cartridge"; discSubType = "SQ300"; break; case CommonTypes.MediaType.SQ310: - discType = "3.5\" SyQuest cartridge"; + discType = "3.5\" SyQuest cartridge"; discSubType = "SQ310"; break; case CommonTypes.MediaType.SQ327: - discType = "3.5\" SyQuest cartridge"; + discType = "3.5\" SyQuest cartridge"; discSubType = "SQ327"; break; case CommonTypes.MediaType.SQ400: - discType = "5.25\" SyQuest cartridge"; + discType = "5.25\" SyQuest cartridge"; discSubType = "SQ400"; break; case CommonTypes.MediaType.SQ800: - discType = "5.25\" SyQuest cartridge"; + discType = "5.25\" SyQuest cartridge"; discSubType = "SQ800"; break; case CommonTypes.MediaType.SQ1500: - discType = "3.5\" SyQuest cartridge"; + discType = "3.5\" SyQuest cartridge"; discSubType = "SQ1500"; break; case CommonTypes.MediaType.SQ2000: - discType = "5.25\" SyQuest cartridge"; + discType = "5.25\" SyQuest cartridge"; discSubType = "SQ2000"; break; case CommonTypes.MediaType.SyJet: - discType = "3.5\" SyQuest cartridge"; + discType = "3.5\" SyQuest cartridge"; discSubType = "SyJet"; break; case CommonTypes.MediaType.LTO: - discType = "Linear Tape-Open"; + discType = "Linear Tape-Open"; discSubType = "LTO"; break; case CommonTypes.MediaType.LTO2: - discType = "Linear Tape-Open"; + discType = "Linear Tape-Open"; discSubType = "LTO-2"; break; case CommonTypes.MediaType.LTO3: - discType = "Linear Tape-Open"; + discType = "Linear Tape-Open"; discSubType = "LTO-3"; break; case CommonTypes.MediaType.LTO3WORM: - discType = "Linear Tape-Open"; + discType = "Linear Tape-Open"; discSubType = "LTO-3 (WORM)"; break; case CommonTypes.MediaType.LTO4: - discType = "Linear Tape-Open"; + discType = "Linear Tape-Open"; discSubType = "LTO-4"; break; case CommonTypes.MediaType.LTO4WORM: - discType = "Linear Tape-Open"; + discType = "Linear Tape-Open"; discSubType = "LTO-4 (WORM)"; break; case CommonTypes.MediaType.LTO5: - discType = "Linear Tape-Open"; + discType = "Linear Tape-Open"; discSubType = "LTO-5"; break; case CommonTypes.MediaType.LTO5WORM: - discType = "Linear Tape-Open"; + discType = "Linear Tape-Open"; discSubType = "LTO-5 (WORM)"; break; case CommonTypes.MediaType.LTO6: - discType = "Linear Tape-Open"; + discType = "Linear Tape-Open"; discSubType = "LTO-6"; break; case CommonTypes.MediaType.LTO6WORM: - discType = "Linear Tape-Open"; + discType = "Linear Tape-Open"; discSubType = "LTO-6 (WORM)"; break; case CommonTypes.MediaType.LTO7: - discType = "Linear Tape-Open"; + discType = "Linear Tape-Open"; discSubType = "LTO-7"; break; case CommonTypes.MediaType.LTO7WORM: - discType = "Linear Tape-Open"; + discType = "Linear Tape-Open"; discSubType = "LTO-7 (WORM)"; break; case CommonTypes.MediaType.MemoryStick: - discType = "Memory Stick"; + discType = "Memory Stick"; discSubType = "Memory Stick"; break; case CommonTypes.MediaType.MemoryStickDuo: - discType = "Memory Stick"; + discType = "Memory Stick"; discSubType = "Memory Stick Duo"; break; case CommonTypes.MediaType.MemoryStickMicro: - discType = "Memory Stick"; + discType = "Memory Stick"; discSubType = "Memory Stick Micro"; break; case CommonTypes.MediaType.MemoryStickPro: - discType = "Memory Stick"; + discType = "Memory Stick"; discSubType = "Memory Stick Pro"; break; case CommonTypes.MediaType.MemoryStickProDuo: - discType = "Memory Stick"; + discType = "Memory Stick"; discSubType = "Memory Stick PRO Duo"; break; case CommonTypes.MediaType.SecureDigital: - discType = "Secure Digital"; + discType = "Secure Digital"; discSubType = "Secure Digital"; break; case CommonTypes.MediaType.miniSD: - discType = "Secure Digital"; + discType = "Secure Digital"; discSubType = "miniSD"; break; case CommonTypes.MediaType.microSD: - discType = "Secure Digital"; + discType = "Secure Digital"; discSubType = "microSD"; break; case CommonTypes.MediaType.MMC: - discType = "MultiMediaCard"; + discType = "MultiMediaCard"; discSubType = "MultiMediaCard"; break; case CommonTypes.MediaType.MMCmicro: - discType = "MultiMediaCard"; + discType = "MultiMediaCard"; discSubType = "MMCmicro"; break; case CommonTypes.MediaType.RSMMC: - discType = "MultiMediaCard"; + discType = "MultiMediaCard"; discSubType = "Reduced-Size MultiMediaCard"; break; case CommonTypes.MediaType.MMCplus: - discType = "MultiMediaCard"; + discType = "MultiMediaCard"; discSubType = "MMCplus"; break; case CommonTypes.MediaType.MMCmobile: - discType = "MultiMediaCard"; + discType = "MultiMediaCard"; discSubType = "MMCmobile"; break; case CommonTypes.MediaType.MLR1: - discType = "Scalable Linear Recording"; + discType = "Scalable Linear Recording"; discSubType = "MLR1"; break; case CommonTypes.MediaType.MLR1SL: - discType = "Scalable Linear Recording"; + discType = "Scalable Linear Recording"; discSubType = "MLR1 SL"; break; case CommonTypes.MediaType.MLR3: - discType = "Scalable Linear Recording"; + discType = "Scalable Linear Recording"; discSubType = "MLR3"; break; case CommonTypes.MediaType.SLR1: - discType = "Scalable Linear Recording"; + discType = "Scalable Linear Recording"; discSubType = "SLR1"; break; case CommonTypes.MediaType.SLR2: - discType = "Scalable Linear Recording"; + discType = "Scalable Linear Recording"; discSubType = "SLR2"; break; case CommonTypes.MediaType.SLR3: - discType = "Scalable Linear Recording"; + discType = "Scalable Linear Recording"; discSubType = "SLR3"; break; case CommonTypes.MediaType.SLR32: - discType = "Scalable Linear Recording"; + discType = "Scalable Linear Recording"; discSubType = "SLR32"; break; case CommonTypes.MediaType.SLR32SL: - discType = "Scalable Linear Recording"; + discType = "Scalable Linear Recording"; discSubType = "SLR32 SL"; break; case CommonTypes.MediaType.SLR4: - discType = "Scalable Linear Recording"; + discType = "Scalable Linear Recording"; discSubType = "SLR4"; break; case CommonTypes.MediaType.SLR5: - discType = "Scalable Linear Recording"; + discType = "Scalable Linear Recording"; discSubType = "SLR5"; break; case CommonTypes.MediaType.SLR5SL: - discType = "Scalable Linear Recording"; + discType = "Scalable Linear Recording"; discSubType = "SLR5 SL"; break; case CommonTypes.MediaType.SLR6: - discType = "Scalable Linear Recording"; + discType = "Scalable Linear Recording"; discSubType = "SLR6"; break; case CommonTypes.MediaType.SLRtape7: - discType = "Scalable Linear Recording"; + discType = "Scalable Linear Recording"; discSubType = "SLRtape7"; break; case CommonTypes.MediaType.SLRtape7SL: - discType = "Scalable Linear Recording"; + discType = "Scalable Linear Recording"; discSubType = "SLRtape7 SL"; break; case CommonTypes.MediaType.SLRtape24: - discType = "Scalable Linear Recording"; + discType = "Scalable Linear Recording"; discSubType = "SLRtape24"; break; case CommonTypes.MediaType.SLRtape24SL: - discType = "Scalable Linear Recording"; + discType = "Scalable Linear Recording"; discSubType = "SLRtape24 SL"; break; case CommonTypes.MediaType.SLRtape40: - discType = "Scalable Linear Recording"; + discType = "Scalable Linear Recording"; discSubType = "SLRtape40"; break; case CommonTypes.MediaType.SLRtape50: - discType = "Scalable Linear Recording"; + discType = "Scalable Linear Recording"; discSubType = "SLRtape50"; break; case CommonTypes.MediaType.SLRtape60: - discType = "Scalable Linear Recording"; + discType = "Scalable Linear Recording"; discSubType = "SLRtape60"; break; case CommonTypes.MediaType.SLRtape75: - discType = "Scalable Linear Recording"; + discType = "Scalable Linear Recording"; discSubType = "SLRtape75"; break; case CommonTypes.MediaType.SLRtape100: - discType = "Scalable Linear Recording"; + discType = "Scalable Linear Recording"; discSubType = "SLRtape100"; break; case CommonTypes.MediaType.SLRtape140: - discType = "Scalable Linear Recording"; + discType = "Scalable Linear Recording"; discSubType = "SLRtape140"; break; case CommonTypes.MediaType.QIC11: - discType = "Quarter-inch cartridge"; + discType = "Quarter-inch cartridge"; discSubType = "QIC-11"; break; case CommonTypes.MediaType.QIC24: - discType = "Quarter-inch cartridge"; + discType = "Quarter-inch cartridge"; discSubType = "QIC-24"; break; case CommonTypes.MediaType.QIC40: - discType = "Quarter-inch mini cartridge"; + discType = "Quarter-inch mini cartridge"; discSubType = "QIC-40"; break; case CommonTypes.MediaType.QIC80: - discType = "Quarter-inch mini cartridge"; + discType = "Quarter-inch mini cartridge"; discSubType = "QIC-80"; break; case CommonTypes.MediaType.QIC120: - discType = "Quarter-inch cartridge"; + discType = "Quarter-inch cartridge"; discSubType = "QIC-120"; break; case CommonTypes.MediaType.QIC150: - discType = "Quarter-inch cartridge"; + discType = "Quarter-inch cartridge"; discSubType = "QIC-150"; break; case CommonTypes.MediaType.QIC320: - discType = "Quarter-inch cartridge"; + discType = "Quarter-inch cartridge"; discSubType = "QIC-320"; break; case CommonTypes.MediaType.QIC525: - discType = "Quarter-inch cartridge"; + discType = "Quarter-inch cartridge"; discSubType = "QIC-525"; break; case CommonTypes.MediaType.QIC1350: - discType = "Quarter-inch cartridge"; + discType = "Quarter-inch cartridge"; discSubType = "QIC-1350"; break; case CommonTypes.MediaType.QIC3010: - discType = "Quarter-inch cartridge"; + discType = "Quarter-inch cartridge"; discSubType = "QIC-3010"; break; case CommonTypes.MediaType.QIC3020: - discType = "Quarter-inch cartridge"; + discType = "Quarter-inch cartridge"; discSubType = "QIC-3020"; break; case CommonTypes.MediaType.QIC3080: - discType = "Quarter-inch cartridge"; + discType = "Quarter-inch cartridge"; discSubType = "QIC-3080"; break; case CommonTypes.MediaType.QIC3095: - discType = "Quarter-inch cartridge"; + discType = "Quarter-inch cartridge"; discSubType = "QIC-3095"; break; case CommonTypes.MediaType.Travan: - discType = "Travan"; + discType = "Travan"; discSubType = "TR-1"; break; case CommonTypes.MediaType.Travan1Ex: - discType = "Travan"; + discType = "Travan"; discSubType = "TR-1 Ex"; break; case CommonTypes.MediaType.Travan3: - discType = "Travan"; + discType = "Travan"; discSubType = "TR-3"; break; case CommonTypes.MediaType.Travan3Ex: - discType = "Travan"; + discType = "Travan"; discSubType = "TR-3 Ex"; break; case CommonTypes.MediaType.Travan4: - discType = "Travan"; + discType = "Travan"; discSubType = "TR-4"; break; case CommonTypes.MediaType.Travan5: - discType = "Travan"; + discType = "Travan"; discSubType = "TR-5"; break; case CommonTypes.MediaType.Travan7: - discType = "Travan"; + discType = "Travan"; discSubType = "TR-7"; break; case CommonTypes.MediaType.VXA1: - discType = "VXA"; + discType = "VXA"; discSubType = "VXA-1"; break; case CommonTypes.MediaType.VXA2: - discType = "VXA"; + discType = "VXA"; discSubType = "VXA-2"; break; case CommonTypes.MediaType.VXA3: - discType = "VXA"; + discType = "VXA"; discSubType = "VXA-3"; break; case CommonTypes.MediaType.ECMA_153: case CommonTypes.MediaType.ECMA_153_512: - discType = "5.25\" magneto-optical"; + discType = "5.25\" magneto-optical"; discSubType = "ECMA-153"; break; case CommonTypes.MediaType.ECMA_189: - discType = "300mm magneto optical"; + discType = "300mm magneto optical"; discSubType = "ECMA-189"; break; case CommonTypes.MediaType.ECMA_190: - discType = "300mm magneto optical"; + discType = "300mm magneto optical"; discSubType = "ECMA-190"; break; case CommonTypes.MediaType.ECMA_195: case CommonTypes.MediaType.ECMA_195_512: - discType = "5.25\" magneto-optical"; + discType = "5.25\" magneto-optical"; discSubType = "ECMA-195"; break; case CommonTypes.MediaType.ECMA_223: case CommonTypes.MediaType.ECMA_223_512: - discType = "3.5\" magneto-optical"; + discType = "3.5\" magneto-optical"; discSubType = "ECMA-223"; break; case CommonTypes.MediaType.ECMA_238: - discType = "5.25\" magneto-optical"; + discType = "5.25\" magneto-optical"; discSubType = "ECMA-238"; break; case CommonTypes.MediaType.ECMA_239: - discType = "3.5\" magneto-optical"; + discType = "3.5\" magneto-optical"; discSubType = "ECMA-239"; break; case CommonTypes.MediaType.ECMA_280: - discType = "5.25\" magneto-optical"; + discType = "5.25\" magneto-optical"; discSubType = "ECMA-280"; break; case CommonTypes.MediaType.ECMA_317: - discType = "300mm magneto optical"; + discType = "300mm magneto optical"; discSubType = "ECMA-317"; break; case CommonTypes.MediaType.ECMA_322: case CommonTypes.MediaType.ECMA_322_2k: - discType = "5.25\" magneto-optical"; + discType = "5.25\" magneto-optical"; discSubType = "ECMA-322"; break; case CommonTypes.MediaType.GigaMo: - discType = "3.5\" magneto-optical"; + discType = "3.5\" magneto-optical"; discSubType = "GIGAMO"; break; case CommonTypes.MediaType.GigaMo2: - discType = "3.5\" magneto-optical"; + discType = "3.5\" magneto-optical"; discSubType = "2.3GB GIGAMO"; break; case CommonTypes.MediaType.UnknownMO: - discType = "Magneto-optical"; + discType = "Magneto-optical"; discSubType = "Unknown"; break; case CommonTypes.MediaType.Floptical: - discType = "Floptical"; + discType = "Floptical"; discSubType = "Floptical"; break; case CommonTypes.MediaType.HiFD: - discType = "HiFD"; + discType = "HiFD"; discSubType = "HiFD"; break; case CommonTypes.MediaType.LS120: - discType = "SuperDisk"; + discType = "SuperDisk"; discSubType = "LS-120"; break; case CommonTypes.MediaType.LS240: - discType = "SuperDisk"; + discType = "SuperDisk"; discSubType = "LS-240"; break; case CommonTypes.MediaType.FD32MB: - discType = "3.5\" floppy"; + discType = "3.5\" floppy"; discSubType = "FD32MB"; break; case CommonTypes.MediaType.UHD144: - discType = "UHD144"; + discType = "UHD144"; discSubType = "UHD144"; break; case CommonTypes.MediaType.VCDHD: - discType = "VCDHD"; + discType = "VCDHD"; discSubType = "VCDHD"; break; case CommonTypes.MediaType.HuCard: - discType = "HuCard"; + discType = "HuCard"; discSubType = "HuCard"; break; case CommonTypes.MediaType.CompactCassette: @@ -1469,358 +1469,358 @@ namespace DiscImageChef.Metadata discSubType = "D/CAS-103"; break; case CommonTypes.MediaType.PCCardTypeI: - discType = "PCMCIA Card"; + discType = "PCMCIA Card"; discSubType = "PC-Card Type I"; break; case CommonTypes.MediaType.PCCardTypeII: - discType = "PCMCIA Card"; + discType = "PCMCIA Card"; discSubType = "PC-Card Type II"; break; case CommonTypes.MediaType.PCCardTypeIII: - discType = "PCMCIA Card"; + discType = "PCMCIA Card"; discSubType = "PC-Card Type III"; break; case CommonTypes.MediaType.PCCardTypeIV: - discType = "PCMCIA Card"; + discType = "PCMCIA Card"; discSubType = "PC-Card Type IV"; break; case CommonTypes.MediaType.ExpressCard34: - discType = "Express Card"; + discType = "Express Card"; discSubType = "Express Card (34mm)"; break; case CommonTypes.MediaType.ExpressCard54: - discType = "Express Card"; + discType = "Express Card"; discSubType = "Express Card (54mm)"; break; case CommonTypes.MediaType.FamicomGamePak: - discType = "Nintendo Famicom Game Pak"; + discType = "Nintendo Famicom Game Pak"; discSubType = "Nintendo Famicom Game Pak"; break; case CommonTypes.MediaType.GameBoyAdvanceGamePak: - discType = "Nintendo Game Boy Advance Game Pak"; + discType = "Nintendo Game Boy Advance Game Pak"; discSubType = "Nintendo Game Boy Advance Game Pak"; break; case CommonTypes.MediaType.GameBoyGamePak: - discType = "Nintendo Game Boy Game Pak"; + discType = "Nintendo Game Boy Game Pak"; discSubType = "Nintendo Game Boy Game Pak"; break; case CommonTypes.MediaType.N64DD: - discType = "Nintendo 64 Disk"; + discType = "Nintendo 64 Disk"; discSubType = "Nintendo 64 Disk"; break; case CommonTypes.MediaType.N64GamePak: - discType = "Nintendo 64 Game Pak"; + discType = "Nintendo 64 Game Pak"; discSubType = "Nintendo 64 Game Pak"; break; case CommonTypes.MediaType.NESGamePak: - discType = "Nintendo Entertainment System Game Pak"; + discType = "Nintendo Entertainment System Game Pak"; discSubType = "Nintendo Entertainment System Game Pak"; break; case CommonTypes.MediaType.Nintendo3DSGameCard: - discType = "Nintendo 3DS Game Card"; + discType = "Nintendo 3DS Game Card"; discSubType = "Nintendo 3DS Game Card"; break; case CommonTypes.MediaType.NintendoDiskCard: - discType = "Nintendo Disk Card"; + discType = "Nintendo Disk Card"; discSubType = "Nintendo Disk Card"; break; case CommonTypes.MediaType.NintendoDSGameCard: - discType = "Nintendo DS Game Card"; + discType = "Nintendo DS Game Card"; discSubType = "Nintendo DS Game Card"; break; case CommonTypes.MediaType.NintendoDSiGameCard: - discType = "Nintendo DSi Game Card"; + discType = "Nintendo DSi Game Card"; discSubType = "Nintendo DSi Game Card"; break; case CommonTypes.MediaType.SNESGamePak: - discType = "Super Nintendo Game Pak"; + discType = "Super Nintendo Game Pak"; discSubType = "Super Nintendo Game Pak"; break; case CommonTypes.MediaType.SNESGamePakUS: - discType = "Super Nintendo Game Pak (US)"; + discType = "Super Nintendo Game Pak (US)"; discSubType = "Super Nintendo Game Pak (US)"; break; case CommonTypes.MediaType.IBM3470: - discType = "IBM 3470"; + discType = "IBM 3470"; discSubType = "IBM 3470"; break; case CommonTypes.MediaType.IBM3480: - discType = "IBM 3480"; + discType = "IBM 3480"; discSubType = "IBM 3480"; break; case CommonTypes.MediaType.IBM3490: - discType = "IBM 3490"; + discType = "IBM 3490"; discSubType = "IBM 3490"; break; case CommonTypes.MediaType.IBM3490E: - discType = "IBM 3490E"; + discType = "IBM 3490E"; discSubType = "IBM 3490E"; break; case CommonTypes.MediaType.IBM3592: - discType = "IBM 3592"; + discType = "IBM 3592"; discSubType = "IBM 3592"; break; case CommonTypes.MediaType.STK4480: - discType = "STK 4480"; + discType = "STK 4480"; discSubType = "STK 4480"; break; case CommonTypes.MediaType.STK4490: - discType = "STK 4490"; + discType = "STK 4490"; discSubType = "STK 4490"; break; case CommonTypes.MediaType.STK9490: - discType = "STK 9490"; + discType = "STK 9490"; discSubType = "STK 9490"; break; case CommonTypes.MediaType.T9840A: - discType = "STK T-9840"; + discType = "STK T-9840"; discSubType = "STK T-9840A"; break; case CommonTypes.MediaType.T9840B: - discType = "STK T-9840"; + discType = "STK T-9840"; discSubType = "STK T-9840B"; break; case CommonTypes.MediaType.T9840C: - discType = "STK T-9840"; + discType = "STK T-9840"; discSubType = "STK T-9840C"; break; case CommonTypes.MediaType.T9840D: - discType = "STK T-9840"; + discType = "STK T-9840"; discSubType = "STK T-9840D"; break; case CommonTypes.MediaType.T9940A: - discType = "STK T-9940"; + discType = "STK T-9940"; discSubType = "STK T-9940A"; break; case CommonTypes.MediaType.T9940B: - discType = "STK T-9840"; + discType = "STK T-9840"; discSubType = "STK T-9840B"; break; case CommonTypes.MediaType.T10000A: - discType = "STK T-10000"; + discType = "STK T-10000"; discSubType = "STK T-10000A"; break; case CommonTypes.MediaType.T10000B: - discType = "STK T-10000"; + discType = "STK T-10000"; discSubType = "STK T-10000B"; break; case CommonTypes.MediaType.T10000C: - discType = "STK T-10000"; + discType = "STK T-10000"; discSubType = "STK T-10000C"; break; case CommonTypes.MediaType.T10000D: - discType = "STK T-10000"; + discType = "STK T-10000"; discSubType = "STK T-10000D"; break; case CommonTypes.MediaType.DemiDiskette: - discType = "DemiDiskette"; + discType = "DemiDiskette"; discSubType = "DemiDiskette"; break; case CommonTypes.MediaType.QuickDisk: - discType = "QuickDisk"; + discType = "QuickDisk"; discSubType = "QuickDisk"; break; case CommonTypes.MediaType.VideoFloppy: - discType = "VideoFloppy"; + discType = "VideoFloppy"; discSubType = "VideoFloppy"; break; case CommonTypes.MediaType.Wafer: - discType = "Wafer"; + discType = "Wafer"; discSubType = "Wafer"; break; case CommonTypes.MediaType.ZXMicrodrive: - discType = "ZX Microdrive"; + discType = "ZX Microdrive"; discSubType = "ZX Microdrive"; break; case CommonTypes.MediaType.BeeCard: - discType = "BeeCard"; + discType = "BeeCard"; discSubType = "BeeCard"; break; case CommonTypes.MediaType.Borsu: - discType = "Borsu"; + discType = "Borsu"; discSubType = "Borsu"; break; case CommonTypes.MediaType.DataStore: - discType = "DataStore"; + discType = "DataStore"; discSubType = "DataStore"; break; case CommonTypes.MediaType.DIR: - discType = "DIR"; + discType = "DIR"; discSubType = "DIR"; break; case CommonTypes.MediaType.DST: - discType = "DST"; + discType = "DST"; discSubType = "DST"; break; case CommonTypes.MediaType.DTF: - discType = "DTF"; + discType = "DTF"; discSubType = "DTF"; break; case CommonTypes.MediaType.DTF2: - discType = "DTF2"; + discType = "DTF2"; discSubType = "DTF2"; break; case CommonTypes.MediaType.Flextra3020: - discType = "Flextra"; + discType = "Flextra"; discSubType = "Flextra 3020"; break; case CommonTypes.MediaType.Flextra3225: - discType = "Flextra"; + discType = "Flextra"; discSubType = "Flextra 3225"; break; case CommonTypes.MediaType.HiTC1: - discType = "HiTC"; + discType = "HiTC"; discSubType = "HiTC1"; break; case CommonTypes.MediaType.HiTC2: - discType = "HiTC"; + discType = "HiTC"; discSubType = "HiTC2"; break; case CommonTypes.MediaType.LT1: - discType = "LT1"; + discType = "LT1"; discSubType = "LT1"; break; case CommonTypes.MediaType.MiniCard: - discType = "MiniCard"; + discType = "MiniCard"; discSubType = "MiniCard"; break; case CommonTypes.MediaType.Orb: - discType = "Orb"; + discType = "Orb"; discSubType = "Orb"; break; case CommonTypes.MediaType.Orb5: - discType = "Orb"; + discType = "Orb"; discSubType = "Orb5"; break; case CommonTypes.MediaType.SmartMedia: - discType = "SmartMedia"; + discType = "SmartMedia"; discSubType = "SmartMedia"; break; case CommonTypes.MediaType.xD: - discType = "xD"; + discType = "xD"; discSubType = "xD"; break; case CommonTypes.MediaType.XQD: - discType = "XQD"; + discType = "XQD"; discSubType = "XQD"; break; case CommonTypes.MediaType.DataPlay: - discType = "DataPlay"; + discType = "DataPlay"; discSubType = "DataPlay"; break; case CommonTypes.MediaType.PD650: - discType = "PD650"; + discType = "PD650"; discSubType = "PD650"; break; case CommonTypes.MediaType.PD650_WORM: - discType = "PD650"; + discType = "PD650"; discSubType = "PD650 (WORM)"; break; case CommonTypes.MediaType.RA60: - discType = "Hard Disk Drive"; + discType = "Hard Disk Drive"; discSubType = "DEC RA-60"; break; case CommonTypes.MediaType.RA80: - discType = "Hard Disk Drive"; + discType = "Hard Disk Drive"; discSubType = "DEC RA-80"; break; case CommonTypes.MediaType.RA81: - discType = "Hard Disk Drive"; + discType = "Hard Disk Drive"; discSubType = "DEC RA-81"; break; case CommonTypes.MediaType.RC25: - discType = "Hard Disk Drive"; + discType = "Hard Disk Drive"; discSubType = "DEC RC-25"; break; case CommonTypes.MediaType.RD31: - discType = "Hard Disk Drive"; + discType = "Hard Disk Drive"; discSubType = "DEC RD-31"; break; case CommonTypes.MediaType.RD32: - discType = "Hard Disk Drive"; + discType = "Hard Disk Drive"; discSubType = "DEC RD-32"; break; case CommonTypes.MediaType.RD51: - discType = "Hard Disk Drive"; + discType = "Hard Disk Drive"; discSubType = "DEC RD-51"; break; case CommonTypes.MediaType.RD52: - discType = "Hard Disk Drive"; + discType = "Hard Disk Drive"; discSubType = "DEC RD-52"; break; case CommonTypes.MediaType.RD53: - discType = "Hard Disk Drive"; + discType = "Hard Disk Drive"; discSubType = "DEC RD-53"; break; case CommonTypes.MediaType.RD54: - discType = "Hard Disk Drive"; + discType = "Hard Disk Drive"; discSubType = "DEC RD-54"; break; case CommonTypes.MediaType.RK06: case CommonTypes.MediaType.RK06_18: - discType = "Hard Disk Drive"; + discType = "Hard Disk Drive"; discSubType = "DEC RK-06"; break; case CommonTypes.MediaType.RK07: case CommonTypes.MediaType.RK07_18: - discType = "Hard Disk Drive"; + discType = "Hard Disk Drive"; discSubType = "DEC RK-07"; break; case CommonTypes.MediaType.RM02: - discType = "Hard Disk Drive"; + discType = "Hard Disk Drive"; discSubType = "DEC RM-02"; break; case CommonTypes.MediaType.RM03: - discType = "Hard Disk Drive"; + discType = "Hard Disk Drive"; discSubType = "DEC RM-03"; break; case CommonTypes.MediaType.RM05: - discType = "Hard Disk Drive"; + discType = "Hard Disk Drive"; discSubType = "DEC RM-05"; break; case CommonTypes.MediaType.RP02: case CommonTypes.MediaType.RP02_18: - discType = "Hard Disk Drive"; + discType = "Hard Disk Drive"; discSubType = "DEC RP-02"; break; case CommonTypes.MediaType.RP03: case CommonTypes.MediaType.RP03_18: - discType = "Hard Disk Drive"; + discType = "Hard Disk Drive"; discSubType = "DEC RP-03"; break; case CommonTypes.MediaType.RP04: case CommonTypes.MediaType.RP04_18: - discType = "Hard Disk Drive"; + discType = "Hard Disk Drive"; discSubType = "DEC RP-04"; break; case CommonTypes.MediaType.RP05: case CommonTypes.MediaType.RP05_18: - discType = "Hard Disk Drive"; + discType = "Hard Disk Drive"; discSubType = "DEC RP-05"; break; case CommonTypes.MediaType.RP06: case CommonTypes.MediaType.RP06_18: - discType = "Hard Disk Drive"; + discType = "Hard Disk Drive"; discSubType = "DEC RP-06"; break; case CommonTypes.MediaType.RDX: - discType = "RDX"; + discType = "RDX"; discSubType = "RDX"; break; case CommonTypes.MediaType.RDX320: - discType = "RDX"; + discType = "RDX"; discSubType = "RDX 320"; break; case CommonTypes.MediaType.Zone_HDD: - discType = "Zoned Hard Disk Drive"; + discType = "Zoned Hard Disk Drive"; discSubType = "Unknown"; break; case CommonTypes.MediaType.Microdrive: - discType = "Hard Disk Drive"; + discType = "Hard Disk Drive"; discSubType = "Microdrive"; break; default: - discType = "Unknown"; + discType = "Unknown"; discSubType = "Unknown"; break; } diff --git a/DiscImageChef.Metadata/Resume.cs b/DiscImageChef.Metadata/Resume.cs index e5cc87927..0325e78c5 100644 --- a/DiscImageChef.Metadata/Resume.cs +++ b/DiscImageChef.Metadata/Resume.cs @@ -43,11 +43,11 @@ namespace DiscImageChef.Metadata { [XmlElement(DataType = "dateTime")] public DateTime CreationDate; [XmlElement(DataType = "dateTime")] public DateTime LastWriteDate; - public bool Removable; - public ulong LastBlock; - public ulong NextBlock; + public bool Removable; + public ulong LastBlock; + public ulong NextBlock; [XmlArrayItem("DumpTry")] public List Tries; - [XmlArrayItem("Block")] public List BadBlocks; + [XmlArrayItem("Block")] public List BadBlocks; } } \ No newline at end of file diff --git a/DiscImageChef.Metadata/Statistics.cs b/DiscImageChef.Metadata/Statistics.cs index a6fd462ac..b9e2438bf 100644 --- a/DiscImageChef.Metadata/Statistics.cs +++ b/DiscImageChef.Metadata/Statistics.cs @@ -54,10 +54,10 @@ namespace DiscImageChef.Metadata [XmlArrayItem("Device", IsNullable = true)] public List Devices { get; set; } [XmlArrayItem("Media")] - public List Medias { get; set; } + public List Medias { get; set; } public BenchmarkStats Benchmark { get; set; } public MediaScanStats MediaScan { get; set; } - public VerifyStats Verify { get; set; } + public VerifyStats Verify { get; set; } } public class CommandsStats @@ -66,8 +66,8 @@ namespace DiscImageChef.Metadata public long Benchmark; public long Checksum; public long Compare; - public long CreateSidecar; public long ConvertImage; + public long CreateSidecar; public long Decode; public long DeviceInfo; public long DeviceReport; @@ -93,7 +93,7 @@ namespace DiscImageChef.Metadata public class VerifyStats { - public VerifiedItems MediaImages; + public VerifiedItems MediaImages; public ScannedSectors Sectors; } @@ -118,39 +118,39 @@ namespace DiscImageChef.Metadata public class MediaScanStats { public ScannedSectors Sectors; - public TimeStats Times; + public TimeStats Times; } public class ChecksumStats { [XmlAttribute] public string algorithm; - [XmlText] public double Value; + [XmlText] public double Value; } public class BenchmarkStats { - public double All; + public double All; [XmlElement("Checksum")] public List Checksum; - public double Entropy; - public long MaxMemory; - public long MinMemory; - public double Sequential; + public double Entropy; + public long MaxMemory; + public long MinMemory; + public double Sequential; } public class MediaStats { - [XmlAttribute] public bool real; + [XmlAttribute] public bool real; [XmlAttribute] public string type; - [XmlText] public long Value; + [XmlText] public long Value; } public class DeviceStats { - [XmlIgnore] public bool ManufacturerSpecified; - public string Manufacturer { get; set; } - public string Model { get; set; } - public string Revision { get; set; } - public string Bus { get; set; } + [XmlIgnore] public bool ManufacturerSpecified; + public string Manufacturer { get; set; } + public string Model { get; set; } + public string Revision { get; set; } + public string Bus { get; set; } } public class NameValueStats diff --git a/DiscImageChef.Partitions/Acorn.cs b/DiscImageChef.Partitions/Acorn.cs index d69db3118..ee11a76d3 100644 --- a/DiscImageChef.Partitions/Acorn.cs +++ b/DiscImageChef.Partitions/Acorn.cs @@ -41,17 +41,17 @@ namespace DiscImageChef.Partitions { public class Acorn : IPartition { - const ulong ADFS_SB_POS = 0xC00; - const uint LINUX_MAGIC = 0xDEAFA1DE; - const uint SWAP_MAGIC = 0xDEAFAB1E; - const uint RISCIX_MAGIC = 0x4A657320; - const uint TYPE_LINUX = 9; - const uint TYPE_RISCIX_MFM = 1; - const uint TYPE_RISCIX_SCSI = 2; - const uint TYPE_MASK = 15; + const ulong ADFS_SB_POS = 0xC00; + const uint LINUX_MAGIC = 0xDEAFA1DE; + const uint SWAP_MAGIC = 0xDEAFAB1E; + const uint RISCIX_MAGIC = 0x4A657320; + const uint TYPE_LINUX = 9; + const uint TYPE_RISCIX_MFM = 1; + const uint TYPE_RISCIX_SCSI = 2; + const uint TYPE_MASK = 15; public string Name => "Acorn FileCore partitions"; - public Guid Id => new Guid("A7C8FEBE-8D00-4933-B9F3-42184C8BA808"); + public Guid Id => new Guid("A7C8FEBE-8D00-4933-B9F3-42184C8BA808"); public bool GetInformation(IMediaImage imagePlugin, out List partitions, ulong sectorOffset) { @@ -63,7 +63,7 @@ namespace DiscImageChef.Partitions if(sectorOffset != 0) return false; if(imagePlugin.Info.SectorSize > ADFS_SB_POS) sbSector = 0; - else sbSector = ADFS_SB_POS / imagePlugin.Info.SectorSize; + else sbSector = ADFS_SB_POS / imagePlugin.Info.SectorSize; byte[] sector = imagePlugin.ReadSector(sbSector); @@ -74,12 +74,12 @@ namespace DiscImageChef.Partitions AcornBootBlock bootBlock = (AcornBootBlock)Marshal.PtrToStructure(bbPtr, typeof(AcornBootBlock)); Marshal.FreeHGlobal(bbPtr); - int checksum = 0; + int checksum = 0; 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; + 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.Info.Sectors) return false; @@ -118,11 +118,11 @@ namespace DiscImageChef.Partitions { Partition part = new Partition { - Start = (ulong)(mapSector + entry.start), - Size = entry.size, - Length = (ulong)(entry.size * sector.Length), + Start = (ulong)(mapSector + entry.start), + Size = entry.size, + Length = (ulong)(entry.size * sector.Length), Sequence = counter, - Scheme = Name + Scheme = Name }; part.Offset = part.Start * (ulong)sector.Length; if(entry.magic != LINUX_MAGIC && entry.magic != SWAP_MAGIC) continue; @@ -146,12 +146,12 @@ namespace DiscImageChef.Partitions { Partition part = new Partition { - Start = (ulong)(mapSector + entry.start), - Size = entry.length, - Length = (ulong)(entry.length * sector.Length), - Name = StringHandlers.CToString(entry.name, Encoding.GetEncoding("iso-8859-1")), + Start = (ulong)(mapSector + entry.start), + Size = entry.length, + Length = (ulong)(entry.length * sector.Length), + Name = StringHandlers.CToString(entry.name, Encoding.GetEncoding("iso-8859-1")), Sequence = counter, - Scheme = Name + Scheme = Name }; part.Offset = part.Start * (ulong)sector.Length; if(entry.length <= 0) continue; @@ -170,45 +170,50 @@ namespace DiscImageChef.Partitions [StructLayout(LayoutKind.Sequential)] struct DiscRecord { - public byte log2secsize; - public byte spt; - public byte heads; - public byte density; - public byte idlen; - public byte log2bpmb; - public byte skew; - public byte bootoption; - public byte lowsector; - public byte nzones; + public byte log2secsize; + public byte spt; + public byte heads; + public byte density; + public byte idlen; + public byte log2bpmb; + public byte skew; + public byte bootoption; + public byte lowsector; + public byte nzones; public ushort zone_spare; - public uint root; - public uint disc_size; + 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; - public byte checksum; + public byte flags; + public ushort startCylinder; + public byte checksum; } [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)] @@ -224,7 +229,8 @@ namespace DiscImageChef.Partitions { 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)] @@ -233,7 +239,8 @@ namespace DiscImageChef.Partitions 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 ab9e8739a..e4a6fea52 100644 --- a/DiscImageChef.Partitions/AppleMap.cs +++ b/DiscImageChef.Partitions/AppleMap.cs @@ -54,14 +54,16 @@ namespace DiscImageChef.Partitions const uint HFS_MAGIC_OLD = 0x54465331; public string Name => "Apple Partition Map"; - public Guid Id => new Guid("36405F8D-4F1A-07F5-209C-223D735D6D22"); + public Guid Id => new Guid("36405F8D-4F1A-07F5-209C-223D735D6D22"); public bool GetInformation(IMediaImage imagePlugin, out List partitions, ulong sectorOffset) { uint sectorSize; if(imagePlugin.Info.SectorSize == 2352 || imagePlugin.Info.SectorSize == 2448) sectorSize = 2048; - else sectorSize = imagePlugin.Info.SectorSize; + else + sectorSize = + imagePlugin.Info.SectorSize; partitions = new List(); @@ -75,7 +77,7 @@ namespace DiscImageChef.Partitions { byte[] tmp = new byte[512]; Array.Copy(ddmSector, 0, tmp, 0, 256); - ddmSector = tmp; + ddmSector = tmp; maxDrivers = 29; } else if(sectorSize < 256) return false; @@ -83,11 +85,11 @@ namespace DiscImageChef.Partitions AppleDriverDescriptorMap ddm = BigEndianMarshal.ByteArrayToStructureBigEndian(ddmSector); - DicConsole.DebugWriteLine("AppleMap Plugin", "ddm.sbSig = 0x{0:X4}", ddm.sbSig); + DicConsole.DebugWriteLine("AppleMap Plugin", "ddm.sbSig = 0x{0:X4}", ddm.sbSig); DicConsole.DebugWriteLine("AppleMap Plugin", "ddm.sbBlockSize = {0}", ddm.sbBlockSize); - DicConsole.DebugWriteLine("AppleMap Plugin", "ddm.sbBlocks = {0}", ddm.sbBlocks); - DicConsole.DebugWriteLine("AppleMap Plugin", "ddm.sbDevType = {0}", ddm.sbDevType); - DicConsole.DebugWriteLine("AppleMap Plugin", "ddm.sbDevId = {0}", ddm.sbDevId); + DicConsole.DebugWriteLine("AppleMap Plugin", "ddm.sbBlocks = {0}", ddm.sbBlocks); + DicConsole.DebugWriteLine("AppleMap Plugin", "ddm.sbDevType = {0}", ddm.sbDevType); + DicConsole.DebugWriteLine("AppleMap Plugin", "ddm.sbDevId = {0}", ddm.sbDevId); DicConsole.DebugWriteLine("AppleMap Plugin", "ddm.sbData = 0x{0:X8}", ddm.sbData); DicConsole.DebugWriteLine("AppleMap Plugin", "ddm.sbDrvrCount = {0}", ddm.sbDrvrCount); @@ -113,12 +115,12 @@ namespace DiscImageChef.Partitions Partition part = new Partition { - Size = (ulong)(ddm.sbMap[i].ddSize * 512), - Length = (ulong)(ddm.sbMap[i].ddSize * 512 / sectorSize), + Size = (ulong)(ddm.sbMap[i].ddSize * 512), + Length = (ulong)(ddm.sbMap[i].ddSize * 512 / sectorSize), Sequence = sequence, - Offset = ddm.sbMap[i].ddBlock * sectorSize, - Start = ddm.sbMap[i].ddBlock + sectorOffset, - Type = "Apple_Driver" + Offset = ddm.sbMap[i].ddBlock * sectorSize, + Start = ddm.sbMap[i].ddBlock + sectorOffset, + Type = "Apple_Driver" }; if(ddm.sbMap[i].ddSize * 512 % sectorSize > 0) part.Length++; @@ -158,13 +160,13 @@ namespace DiscImageChef.Partitions Partition part = new Partition { - Size = oldEntry.pdStart * ddm.sbBlockSize, - Length = oldEntry.pdStart * ddm.sbBlockSize / sectorSize, + Size = oldEntry.pdStart * ddm.sbBlockSize, + Length = oldEntry.pdStart * ddm.sbBlockSize / sectorSize, Sequence = sequence, - Offset = oldEntry.pdSize * ddm.sbBlockSize, - Start = oldEntry.pdSize * ddm.sbBlockSize / sectorSize, - Scheme = Name, - Type = oldEntry.pdFSID == HFS_MAGIC_OLD ? "Apple_HFS" : $"0x{oldEntry.pdFSID:X8}" + Offset = oldEntry.pdSize * ddm.sbBlockSize, + Start = oldEntry.pdSize * ddm.sbBlockSize / sectorSize, + Scheme = Name, + Type = oldEntry.pdFSID == HFS_MAGIC_OLD ? "Apple_HFS" : $"0x{oldEntry.pdFSID:X8}" }; partitions.Add(part); @@ -176,10 +178,10 @@ namespace DiscImageChef.Partitions } AppleMapPartitionEntry entry; - uint entrySize; - uint entryCount; - uint sectorsToRead; - uint skipDdm; + uint entrySize; + uint entryCount; + uint sectorsToRead; + uint skipDdm; // If sector is bigger than 512 if(sectorSize > 512) @@ -191,9 +193,9 @@ namespace DiscImageChef.Partitions if(entry.signature == APM_MAGIC) { DicConsole.DebugWriteLine("AppleMap Plugin", "Found misaligned entry."); - entrySize = 512; - entryCount = entry.entries; - skipDdm = 512; + entrySize = 512; + entryCount = entry.entries; + skipDdm = 512; sectorsToRead = (entryCount + 1) * 512 / sectorSize + 1; } else @@ -202,9 +204,9 @@ namespace DiscImageChef.Partitions if(entry.signature == APM_MAGIC) { DicConsole.DebugWriteLine("AppleMap Plugin", "Found aligned entry."); - entrySize = sectorSize; - entryCount = entry.entries; - skipDdm = sectorSize; + entrySize = sectorSize; + entryCount = entry.entries; + skipDdm = sectorSize; sectorsToRead = entryCount + 2; } else return partitions.Count > 0; @@ -216,18 +218,18 @@ namespace DiscImageChef.Partitions if(entry.signature == APM_MAGIC) { DicConsole.DebugWriteLine("AppleMap Plugin", "Found aligned entry."); - entrySize = sectorSize; - entryCount = entry.entries; - skipDdm = sectorSize; + entrySize = sectorSize; + entryCount = entry.entries; + skipDdm = sectorSize; sectorsToRead = entryCount + 2; } else return partitions.Count > 0; } byte[] entries = imagePlugin.ReadSectors(sectorOffset, sectorsToRead); - DicConsole.DebugWriteLine("AppleMap Plugin", "entry_size = {0}", entrySize); - DicConsole.DebugWriteLine("AppleMap Plugin", "entry_count = {0}", entryCount); - DicConsole.DebugWriteLine("AppleMap Plugin", "skip_ddm = {0}", skipDdm); + DicConsole.DebugWriteLine("AppleMap Plugin", "entry_size = {0}", entrySize); + DicConsole.DebugWriteLine("AppleMap Plugin", "entry_count = {0}", entryCount); + DicConsole.DebugWriteLine("AppleMap Plugin", "skip_ddm = {0}", skipDdm); DicConsole.DebugWriteLine("AppleMap Plugin", "sectors_to_read = {0}", sectorsToRead); byte[] copy = new byte[entries.Length - skipDdm]; @@ -243,9 +245,9 @@ namespace DiscImageChef.Partitions DicConsole.DebugWriteLine("AppleMap Plugin", "dpme[{0}].signature = 0x{1:X4}", i, entry.signature); DicConsole.DebugWriteLine("AppleMap Plugin", "dpme[{0}].reserved1 = 0x{1:X4}", i, entry.reserved1); - 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}].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, @@ -253,7 +255,8 @@ namespace DiscImageChef.Partitions 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}].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); @@ -279,13 +282,13 @@ namespace DiscImageChef.Partitions Partition partition = new Partition { Sequence = sequence, - Type = StringHandlers.CToString(entry.type), - Name = StringHandlers.CToString(entry.name), - Offset = entry.start * entrySize, - Size = entry.sectors * entrySize, - Start = entry.start * entrySize / sectorSize + sectorOffset, - Length = entry.sectors * entrySize / sectorSize, - Scheme = Name + Type = StringHandlers.CToString(entry.type), + Name = StringHandlers.CToString(entry.name), + Offset = entry.start * entrySize, + Size = entry.sectors * entrySize, + Start = entry.start * entrySize / sectorSize + sectorOffset, + Length = entry.sectors * entrySize / sectorSize, + Scheme = Name }; sb.AppendLine("Partition flags:"); if(flags.HasFlag(AppleMapFlags.Valid)) sb.AppendLine("Partition is valid."); @@ -351,7 +354,8 @@ namespace DiscImageChef.Partitions /// Number of entries of the driver descriptor public ushort sbDrvrCount; /// Entries of the driver descriptor - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 61)] public AppleDriverEntry[] sbMap; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 61)] + public AppleDriverEntry[] sbMap; } [StructLayout(LayoutKind.Sequential, Pack = 1)] @@ -371,7 +375,8 @@ namespace DiscImageChef.Partitions /// Signature public ushort pdSig; /// Entries of the driver descriptor - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 42)] public AppleMapOldPartitionEntry[] pdMap; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 42)] + public AppleMapOldPartitionEntry[] pdMap; } [StructLayout(LayoutKind.Sequential, Pack = 1)] @@ -428,9 +433,11 @@ namespace DiscImageChef.Partitions /// Number of sectos of the partition public uint sectors; /// Partition name, 32 bytes, null-padded - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] public byte[] name; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] + public byte[] name; /// Partition type. 32 bytes, null-padded - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] public byte[] type; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] + public byte[] type; /// First sector of the data area public uint first_data_block; /// Number of sectors of the data area @@ -452,9 +459,11 @@ namespace DiscImageChef.Partitions /// Boot code checksum public uint checksum; /// Processor type, 16 bytes, null-padded - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] public byte[] processor; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] + public byte[] processor; /// Boot arguments - [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 7510a1c7e..72b5666cf 100644 --- a/DiscImageChef.Partitions/Apricot.cs +++ b/DiscImageChef.Partitions/Apricot.cs @@ -49,15 +49,15 @@ namespace DiscImageChef.Partitions }; readonly string[] diskTypeCodes = {"MF1DD 70-track", "MF1DD", "MF2DD", "Winchester 5M", "Winchester 10M", "Winchester 20M"}; - readonly int[] lineModes = {256, 200}; - readonly int[] lineWidths = {80, 40}; + readonly int[] lineModes = {256, 200}; + readonly int[] lineWidths = {80, 40}; readonly string[] operatingSystemCodes = {"Invalid", "MS-DOS", "UCSD Pascal", "CP/M", "Concurrent CP/M"}; - readonly string[] parityTypes = {"None", "Odd", "Even", "Mark", "Space"}; - readonly string[] printDevices = {"Parallel", "Serial"}; - readonly double[] stopBits = {1, 1.5, 2}; + readonly string[] parityTypes = {"None", "Odd", "Even", "Mark", "Space"}; + readonly string[] printDevices = {"Parallel", "Serial"}; + readonly double[] stopBits = {1, 1.5, 2}; public string Name => "ACT Apricot partitions"; - public Guid Id => new Guid("8CBF5864-7B5A-47A0-8CEB-199C74FA22DE"); + public Guid Id => new Guid("8CBF5864-7B5A-47A0-8CEB-199C74FA22DE"); public bool GetInformation(IMediaImage imagePlugin, out List partitions, ulong sectorOffset) { @@ -76,9 +76,9 @@ namespace DiscImageChef.Partitions Marshal.FreeHGlobal(lblPtr); // Not much to check but... - ulong deviceSectors = imagePlugin.Info.Sectors; + ulong deviceSectors = imagePlugin.Info.Sectors; ulong deviceSizeAccordingToLabel = label.cylinders * label.heads * label.spt; - if(label.operatingSystem > 4 || label.bootType > 5 || label.partitionCount > 8 || + if(label.operatingSystem > 4 || label.bootType > 5 || label.partitionCount > 8 || deviceSizeAccordingToLabel > deviceSectors || label.firstDataBlock > deviceSectors) return false; DicConsole.DebugWriteLine("Apricot partitions", "label.version = \"{0}\"", @@ -88,42 +88,42 @@ namespace DiscImageChef.Partitions ? 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.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.partitionCount = {0}", label.partitionCount); - DicConsole.DebugWriteLine("Apricot partitions", "label.winchester = {0}", label.winchester); - DicConsole.DebugWriteLine("Apricot partitions", "label.sectorSize = {0}", label.sectorSize); - DicConsole.DebugWriteLine("Apricot partitions", "label.spt = {0}", label.spt); - DicConsole.DebugWriteLine("Apricot partitions", "label.cylinders = {0}", label.cylinders); - DicConsole.DebugWriteLine("Apricot partitions", "label.heads = {0}", label.heads); - DicConsole.DebugWriteLine("Apricot partitions", "label.interleave = {0}", label.interleave); - DicConsole.DebugWriteLine("Apricot partitions", "label.skew = {0}", label.skew); - DicConsole.DebugWriteLine("Apricot partitions", "label.bootLocation = {0}", label.bootLocation); - DicConsole.DebugWriteLine("Apricot partitions", "label.bootSize = {0}", label.bootSize); + 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); + DicConsole.DebugWriteLine("Apricot partitions", "label.spt = {0}", label.spt); + DicConsole.DebugWriteLine("Apricot partitions", "label.cylinders = {0}", label.cylinders); + DicConsole.DebugWriteLine("Apricot partitions", "label.heads = {0}", label.heads); + DicConsole.DebugWriteLine("Apricot partitions", "label.interleave = {0}", label.interleave); + DicConsole.DebugWriteLine("Apricot partitions", "label.skew = {0}", label.skew); + 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.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.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.mainBPB.bps = {0}", label.mainBPB.bps); - DicConsole.DebugWriteLine("Apricot partitions", "label.mainBPB.spc = {0}", label.mainBPB.spc); + 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); - DicConsole.DebugWriteLine("Apricot partitions", "label.mainBPB.fats_no = {0}", label.mainBPB.fats_no); + DicConsole.DebugWriteLine("Apricot partitions", "label.mainBPB.fats_no = {0}", label.mainBPB.fats_no); DicConsole.DebugWriteLine("Apricot partitions", "label.mainBPB.root_ent = {0}", label.mainBPB.root_ent); - 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.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 @@ -137,25 +137,25 @@ namespace DiscImageChef.Partitions 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.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.bellVolume = {0}", label.bellVolume); - DicConsole.DebugWriteLine("Apricot partitions", "label.enableCache = {0}", label.enableCache); - DicConsole.DebugWriteLine("Apricot partitions", "label.enableGraphics = {0}", label.enableGraphics); - DicConsole.DebugWriteLine("Apricot partitions", "label.dosLength = {0}", label.dosLength); - DicConsole.DebugWriteLine("Apricot partitions", "label.fontLength = {0}", label.fontLength); - DicConsole.DebugWriteLine("Apricot partitions", "label.keyboardLength = {0}", label.keyboardLength); - DicConsole.DebugWriteLine("Apricot partitions", "label.dosStart = {0}", label.dosStart); - DicConsole.DebugWriteLine("Apricot partitions", "label.fontStart = {0}", label.fontStart); - DicConsole.DebugWriteLine("Apricot partitions", "label.keyboardStart = {0}", label.keyboardStart); - DicConsole.DebugWriteLine("Apricot partitions", "label.keyboardVolume = {0}", label.keyboardVolume); - DicConsole.DebugWriteLine("Apricot partitions", "label.autorepeat = {0}", label.autorepeat); - DicConsole.DebugWriteLine("Apricot partitions", "label.autorepeatLeadIn = {0}", label.autorepeatLeadIn); + 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); + DicConsole.DebugWriteLine("Apricot partitions", "label.dosLength = {0}", label.dosLength); + DicConsole.DebugWriteLine("Apricot partitions", "label.fontLength = {0}", label.fontLength); + DicConsole.DebugWriteLine("Apricot partitions", "label.keyboardLength = {0}", label.keyboardLength); + DicConsole.DebugWriteLine("Apricot partitions", "label.dosStart = {0}", label.dosStart); + DicConsole.DebugWriteLine("Apricot partitions", "label.fontStart = {0}", label.fontStart); + DicConsole.DebugWriteLine("Apricot partitions", "label.keyboardStart = {0}", label.keyboardStart); + DicConsole.DebugWriteLine("Apricot partitions", "label.keyboardVolume = {0}", label.keyboardVolume); + DicConsole.DebugWriteLine("Apricot partitions", "label.autorepeat = {0}", label.autorepeat); + 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.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, @@ -178,31 +178,31 @@ namespace DiscImageChef.Partitions 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); - DicConsole.DebugWriteLine("Apricot partitions", "label.xoffCharacter = {0}", label.xoffCharacter); + 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); + DicConsole.DebugWriteLine("Apricot partitions", "label.xoffCharacter = {0}", label.xoffCharacter); DicConsole.DebugWriteLine("Apricot partitions", "label.rxXonXoffBuffer = {0}", label.rxXonXoffBuffer); - DicConsole.DebugWriteLine("Apricot partitions", "label.dtrDsr = {0}", label.dtrDsr); - DicConsole.DebugWriteLine("Apricot partitions", "label.ctsRts = {0}", label.ctsRts); - DicConsole.DebugWriteLine("Apricot partitions", "label.nullsAfterCr = {0}", label.nullsAfterCr); - DicConsole.DebugWriteLine("Apricot partitions", "label.nullsAfterFF = {0}", label.nullsAfterFF); + DicConsole.DebugWriteLine("Apricot partitions", "label.dtrDsr = {0}", label.dtrDsr); + DicConsole.DebugWriteLine("Apricot partitions", "label.ctsRts = {0}", label.ctsRts); + 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.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.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.parkingEnabled = {0}", label.parkingEnabled); + 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)); @@ -246,13 +246,13 @@ namespace DiscImageChef.Partitions { Partition part = new Partition { - Start = label.partitions[i].startSector, - Size = (ulong)(label.partitions[i].sectors * label.sectorSize), - Length = label.partitions[i].sectors, - Type = "ACT Apricot partition", + Start = label.partitions[i].startSector, + Size = (ulong)(label.partitions[i].sectors * label.sectorSize), + Length = label.partitions[i].sectors, + Type = "ACT Apricot partition", Sequence = i, - Scheme = Name, - Offset = (ulong)(label.partitions[i].startSector * label.sectorSize) + Scheme = Name, + Offset = (ulong)(label.partitions[i].startSector * label.sectorSize) }; if(part.Start < deviceSectors && part.End < deviceSectors) partitions.Add(part); } @@ -265,7 +265,8 @@ namespace DiscImageChef.Partitions struct ApricotLabel { /// Version of format which created disk - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] public byte[] version; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] + public byte[] version; /// Operating system. public byte operatingSystem; /// Software write protection. @@ -309,17 +310,22 @@ namespace DiscImageChef.Partitions /// Maximum number of copies. public ushort maxCopies; /// Serial number. - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] public byte[] serialNumber; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] + public byte[] serialNumber; /// Part number. - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] public byte[] partNumber; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] + public byte[] partNumber; /// Copyright. - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 14)] public byte[] copyright; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 14)] + public byte[] copyright; /// BPB for whole disk. public ApricotParameterBlock mainBPB; /// Name of FONT file. - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] public byte[] fontName; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] + public byte[] fontName; /// Name of KEYBOARD file. - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] public byte[] keyboardName; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] + public byte[] keyboardName; /// Minor BIOS version. public byte biosMinorVersion; /// Major BIOS version. @@ -357,7 +363,8 @@ namespace DiscImageChef.Partitions /// Microscreen mode. public byte microscreenMode; /// Spare area for keyboard values expansion. - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 11)] public byte[] spareKeyboard; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 11)] + public byte[] spareKeyboard; /// Screen line mode. public byte lineMode; /// Screen line width. @@ -365,7 +372,8 @@ namespace DiscImageChef.Partitions /// Screen disabled?. [MarshalAs(UnmanagedType.U1)] public bool imageOff; /// Spare area for screen values expansion. - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 13)] public byte[] spareScreen; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 13)] + public byte[] spareScreen; /// TX baud rate. public byte txBaudRate; /// RX baud rate. @@ -403,7 +411,8 @@ namespace DiscImageChef.Partitions /// BIOS error report in serial port. [MarshalAs(UnmanagedType.U1)] public bool biosErrorReportSerial; /// Spare area for serial port values expansion. - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 13)] public byte[] spareSerial; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 13)] + public byte[] spareSerial; /// Send LF after CR in parallel port. [MarshalAs(UnmanagedType.U1)] public bool lfAfterCrParallel; /// Select line supported?. @@ -415,21 +424,27 @@ namespace DiscImageChef.Partitions /// BIOS error report in parallel port. [MarshalAs(UnmanagedType.U1)] public bool biosErrorReportParallel; /// Spare area for parallel port values expansion. - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 11)] public byte[] spareParallel; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 11)] + public byte[] spareParallel; /// Spare area for Winchester values expansion. - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 14)] public byte[] spareWinchester; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 14)] + public byte[] spareWinchester; /// Parking enabled?. [MarshalAs(UnmanagedType.U1)] public bool parkingEnabled; /// Format protection?. [MarshalAs(UnmanagedType.U1)] public bool formatProtection; /// Spare area for RAM disk values expansion. - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] public byte[] spareRamDisk; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] + public byte[] spareRamDisk; /// List of bad blocks. - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] public ushort[] badBlocks; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] + public ushort[] badBlocks; /// Array of partition BPBs. - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] public ApricotParameterBlock[] partitions; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] + public ApricotParameterBlock[] partitions; /// Spare area. - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 63)] public byte[] spare; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 63)] + public byte[] spare; /// CP/M double side indicator?. public bool cpmDoubleSided; } diff --git a/DiscImageChef.Partitions/Atari.cs b/DiscImageChef.Partitions/Atari.cs index 027839122..59ba0df2a 100644 --- a/DiscImageChef.Partitions/Atari.cs +++ b/DiscImageChef.Partitions/Atari.cs @@ -165,9 +165,9 @@ namespace DiscImageChef.Partitions if(sectorSize == 2448 || sectorSize == 2352) sectorSize = 2048; byte[] partType = new byte[3]; - partType[0] = (byte)((type & 0xFF0000) >> 16); - partType[1] = (byte)((type & 0x00FF00) >> 8); - partType[2] = (byte)(type & 0x0000FF); + partType[0] = (byte)((type & 0xFF0000) >> 16); + partType[1] = (byte)((type & 0x00FF00) >> 8); + partType[2] = (byte)(type & 0x0000FF); Partition part = new Partition { @@ -226,7 +226,7 @@ namespace DiscImageChef.Partitions case TypeExtended: byte[] extendedSector = imagePlugin.ReadSector(table.entries[i].start); AtariTable extendedTable = new AtariTable(); - extendedTable.entries = new AtariEntry[4]; + extendedTable.entries = new AtariEntry[4]; for(int j = 0; j < 4; j++) { @@ -262,9 +262,9 @@ namespace DiscImageChef.Partitions if(sectorSize == 2448 || sectorSize == 2352) sectorSize = 2048; byte[] partType = new byte[3]; - partType[0] = (byte)((extendedType & 0xFF0000) >> 16); - partType[1] = (byte)((extendedType & 0x00FF00) >> 8); - partType[2] = (byte)(extendedType & 0x0000FF); + partType[0] = (byte)((extendedType & 0xFF0000) >> 16); + partType[1] = (byte)((extendedType & 0x00FF00) >> 8); + partType[2] = (byte)(extendedType & 0x0000FF); Partition part = new Partition { @@ -343,9 +343,9 @@ namespace DiscImageChef.Partitions if(sectorSize == 2448 || sectorSize == 2352) sectorSize = 2048; byte[] partType = new byte[3]; - partType[0] = (byte)((type & 0xFF0000) >> 16); - partType[1] = (byte)((type & 0x00FF00) >> 8); - partType[2] = (byte)(type & 0x0000FF); + partType[0] = (byte)((type & 0xFF0000) >> 16); + partType[1] = (byte)((type & 0x00FF00) >> 8); + partType[2] = (byte)(type & 0x0000FF); Partition part = new Partition { diff --git a/DiscImageChef.Partitions/DEC.cs b/DiscImageChef.Partitions/DEC.cs index f414362fb..117c9f3f6 100644 --- a/DiscImageChef.Partitions/DEC.cs +++ b/DiscImageChef.Partitions/DEC.cs @@ -45,7 +45,7 @@ namespace DiscImageChef.Partitions const int PT_VALID = 1; public string Name => "DEC disklabel"; - public Guid Id => new Guid("58CEC3B7-3B93-4D47-86EE-D6DADE9D444F"); + public Guid Id => new Guid("58CEC3B7-3B93-4D47-86EE-D6DADE9D444F"); public bool GetInformation(IMediaImage imagePlugin, out List partitions, ulong sectorOffset) { @@ -67,12 +67,12 @@ namespace DiscImageChef.Partitions foreach(Partition part in table.pt_part.Select(entry => new Partition { - Start = entry.pi_blkoff, - Offset = (ulong)(entry.pi_blkoff * sector.Length), - Size = (ulong)entry.pi_nblocks, - Length = (ulong)(entry.pi_nblocks * sector.Length), + Start = entry.pi_blkoff, + Offset = (ulong)(entry.pi_blkoff * sector.Length), + Size = (ulong)entry.pi_nblocks, + Length = (ulong)(entry.pi_nblocks * sector.Length), Sequence = counter, - Scheme = Name + Scheme = Name }).Where(part => part.Size > 0)) { partitions.Add(part); @@ -85,16 +85,18 @@ namespace DiscImageChef.Partitions [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)] struct DECPartition { - public int pi_nblocks; + public int pi_nblocks; public uint pi_blkoff; } } diff --git a/DiscImageChef.Partitions/DragonFlyBSD.cs b/DiscImageChef.Partitions/DragonFlyBSD.cs index 36fb3d899..01802648f 100644 --- a/DiscImageChef.Partitions/DragonFlyBSD.cs +++ b/DiscImageChef.Partitions/DragonFlyBSD.cs @@ -43,7 +43,7 @@ namespace DiscImageChef.Partitions const uint DISK_MAGIC64 = 0xC4464C59; public string Name => "DragonFly BSD 64-bit disklabel"; - public Guid Id => new Guid("D49E41A6-D952-4760-9D94-03DAE2450C5F"); + public Guid Id => new Guid("D49E41A6-D952-4760-9D94-03DAE2450C5F"); public bool GetInformation(IMediaImage imagePlugin, out List partitions, ulong sectorOffset) { @@ -70,12 +70,13 @@ namespace DiscImageChef.Partitions Partition part = new Partition { Start = entry.p_boffset / imagePlugin.Info.SectorSize + sectorOffset, - Offset = entry.p_boffset + sectorOffset * imagePlugin.Info.SectorSize, - Size = entry.p_bsize, - Length = entry.p_bsize / imagePlugin.Info.SectorSize, - Name = entry.p_stor_uuid.ToString(), + Offset = entry.p_boffset + + sectorOffset * imagePlugin.Info.SectorSize, + Size = entry.p_bsize, + Length = entry.p_bsize / imagePlugin.Info.SectorSize, + Name = entry.p_stor_uuid.ToString(), Sequence = counter, - Scheme = Name, + Scheme = Name, Type = (BSD.fsType)entry.p_fstype == BSD.fsType.Other ? entry.p_type_uuid.ToString() : BSD.fsTypeToString((BSD.fsType)entry.p_fstype) @@ -95,20 +96,24 @@ namespace DiscImageChef.Partitions [StructLayout(LayoutKind.Sequential, Pack = 1)] struct Disklabel64 { - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 512)] public byte[] d_reserved0; - public uint d_magic; - public uint d_crc; - public uint d_align; - public uint d_npartitions; - public Guid d_stor_uuid; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 512)] + public byte[] d_reserved0; + public uint d_magic; + public uint d_crc; + public uint d_align; + public uint d_npartitions; + public Guid d_stor_uuid; public ulong d_total_size; public ulong d_bbase; 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)] @@ -116,15 +121,15 @@ namespace DiscImageChef.Partitions { public ulong p_boffset; public ulong p_bsize; - public byte p_fstype; - public byte p_unused01; - public byte p_unused02; - public byte p_unused03; - public uint p_unused04; - public uint p_unused05; - public uint p_unused06; - public Guid p_type_uuid; - public Guid p_stor_uuid; + public byte p_fstype; + public byte p_unused01; + public byte p_unused02; + public byte p_unused03; + public uint p_unused04; + public uint p_unused05; + public uint p_unused06; + public Guid p_type_uuid; + public Guid p_stor_uuid; } } } \ No newline at end of file diff --git a/DiscImageChef.Partitions/GPT.cs b/DiscImageChef.Partitions/GPT.cs index 8b99f6fc5..5f5cd5750 100644 --- a/DiscImageChef.Partitions/GPT.cs +++ b/DiscImageChef.Partitions/GPT.cs @@ -42,11 +42,11 @@ namespace DiscImageChef.Partitions { public class GuidPartitionTable : IPartition { - const ulong GPT_MAGIC = 0x5452415020494645; - const uint GPT_REVISION1 = 0x00010000; + const ulong GPT_MAGIC = 0x5452415020494645; + const uint GPT_REVISION1 = 0x00010000; public string Name => "GUID Partition Table"; - public Guid Id => new Guid("CBC9D281-C1D0-44E8-9038-4D66FD2678AB"); + public Guid Id => new Guid("CBC9D281-C1D0-44E8-9038-4D66FD2678AB"); public bool GetInformation(IMediaImage imagePlugin, out List partitions, ulong sectorOffset) { @@ -54,18 +54,18 @@ namespace DiscImageChef.Partitions if(sectorOffset + 2 >= imagePlugin.Info.Sectors) return false; - byte[] hdrBytes = imagePlugin.ReadSector(1 + sectorOffset); + byte[] hdrBytes = imagePlugin.ReadSector(1 + sectorOffset); GptHeader hdr; - ulong signature = BitConverter.ToUInt64(hdrBytes, 0); - bool misaligned = false; + ulong signature = BitConverter.ToUInt64(hdrBytes, 0); + bool misaligned = false; DicConsole.DebugWriteLine("GPT Plugin", "hdr.signature = 0x{0:X16}", signature); if(signature != GPT_MAGIC) if(imagePlugin.Info.XmlMediaType == XmlMediaType.OpticalDisc) { - hdrBytes = imagePlugin.ReadSector(sectorOffset); + hdrBytes = imagePlugin.ReadSector(sectorOffset); signature = BitConverter.ToUInt64(hdrBytes, 512); DicConsole.DebugWriteLine("GPT Plugin", "hdr.signature @ 0x200 = 0x{0:X16}", signature); if(signature == GPT_MAGIC) @@ -73,12 +73,13 @@ namespace DiscImageChef.Partitions DicConsole.DebugWriteLine("GPT Plugin", "Found unaligned signature", signature); byte[] real = new byte[512]; Array.Copy(hdrBytes, 512, real, 0, 512); - hdrBytes = real; + hdrBytes = real; misaligned = true; } else return false; } - else return false; + else + return false; try { @@ -88,18 +89,18 @@ namespace DiscImageChef.Partitions } catch { return false; } - DicConsole.DebugWriteLine("GPT Plugin", "hdr.revision = 0x{0:X8}", hdr.revision); - DicConsole.DebugWriteLine("GPT Plugin", "hdr.headerSize = {0}", hdr.headerSize); - DicConsole.DebugWriteLine("GPT Plugin", "hdr.headerCrc = 0x{0:X8}", hdr.headerCrc); - DicConsole.DebugWriteLine("GPT Plugin", "hdr.reserved = 0x{0:X8}", hdr.reserved); - DicConsole.DebugWriteLine("GPT Plugin", "hdr.myLBA = {0}", hdr.myLBA); - DicConsole.DebugWriteLine("GPT Plugin", "hdr.alternateLBA = {0}", hdr.alternateLBA); - DicConsole.DebugWriteLine("GPT Plugin", "hdr.firstUsableLBA = {0}", hdr.firstUsableLBA); - DicConsole.DebugWriteLine("GPT Plugin", "hdr.lastUsableLBA = {0}", hdr.lastUsableLBA); - DicConsole.DebugWriteLine("GPT Plugin", "hdr.diskGuid = {0}", hdr.diskGuid); - DicConsole.DebugWriteLine("GPT Plugin", "hdr.entryLBA = {0}", hdr.entryLBA); - DicConsole.DebugWriteLine("GPT Plugin", "hdr.entries = {0}", hdr.entries); - DicConsole.DebugWriteLine("GPT Plugin", "hdr.entriesSize = {0}", hdr.entriesSize); + DicConsole.DebugWriteLine("GPT Plugin", "hdr.revision = 0x{0:X8}", hdr.revision); + DicConsole.DebugWriteLine("GPT Plugin", "hdr.headerSize = {0}", hdr.headerSize); + DicConsole.DebugWriteLine("GPT Plugin", "hdr.headerCrc = 0x{0:X8}", hdr.headerCrc); + DicConsole.DebugWriteLine("GPT Plugin", "hdr.reserved = 0x{0:X8}", hdr.reserved); + DicConsole.DebugWriteLine("GPT Plugin", "hdr.myLBA = {0}", hdr.myLBA); + DicConsole.DebugWriteLine("GPT Plugin", "hdr.alternateLBA = {0}", hdr.alternateLBA); + DicConsole.DebugWriteLine("GPT Plugin", "hdr.firstUsableLBA = {0}", hdr.firstUsableLBA); + DicConsole.DebugWriteLine("GPT Plugin", "hdr.lastUsableLBA = {0}", hdr.lastUsableLBA); + DicConsole.DebugWriteLine("GPT Plugin", "hdr.diskGuid = {0}", hdr.diskGuid); + DicConsole.DebugWriteLine("GPT Plugin", "hdr.entryLBA = {0}", hdr.entryLBA); + DicConsole.DebugWriteLine("GPT Plugin", "hdr.entries = {0}", hdr.entries); + DicConsole.DebugWriteLine("GPT Plugin", "hdr.entriesSize = {0}", hdr.entriesSize); DicConsole.DebugWriteLine("GPT Plugin", "hdr.entriesCrc = 0x{0:X8}", hdr.entriesCrc); if(hdr.signature != GPT_MAGIC) return false; @@ -110,21 +111,21 @@ namespace DiscImageChef.Partitions if(misaligned) { - divisor = 4; - modulo = (uint)(hdr.entryLBA % divisor); + divisor = 4; + modulo = (uint)(hdr.entryLBA % divisor); sectorSize = 512; } else { - divisor = 1; - modulo = 0; + divisor = 1; + modulo = 0; sectorSize = imagePlugin.Info.SectorSize; } uint totalEntriesSectors = hdr.entries * hdr.entriesSize / imagePlugin.Info.SectorSize; if(hdr.entries * hdr.entriesSize % imagePlugin.Info.SectorSize > 0) totalEntriesSectors++; - byte[] temp = imagePlugin.ReadSectors(hdr.entryLBA / divisor, totalEntriesSectors + modulo); + byte[] temp = imagePlugin.ReadSectors(hdr.entryLBA / divisor, totalEntriesSectors + modulo); byte[] entriesBytes = new byte[temp.Length - modulo * 512]; Array.Copy(temp, modulo * 512, entriesBytes, 0, entriesBytes.Length); List entries = new List(); @@ -136,46 +137,46 @@ namespace DiscImageChef.Partitions byte[] entryBytes = new byte[hdr.entriesSize]; Array.Copy(entriesBytes, hdr.entriesSize * i, entryBytes, 0, hdr.entriesSize); GCHandle handle = GCHandle.Alloc(entryBytes, GCHandleType.Pinned); - GptEntry entry = (GptEntry)Marshal.PtrToStructure(handle.AddrOfPinnedObject(), typeof(GptEntry)); + GptEntry entry = (GptEntry)Marshal.PtrToStructure(handle.AddrOfPinnedObject(), typeof(GptEntry)); handle.Free(); entries.Add(entry); } -#pragma warning disable RECS0022 // A catch clause that catches System.Exception and has an empty body + #pragma warning disable RECS0022 // A catch clause that catches System.Exception and has an empty body catch { // ignored } -#pragma warning restore RECS0022 // A catch clause that catches System.Exception and has an empty body + #pragma warning restore RECS0022 // A catch clause that catches System.Exception and has an empty body } if(entries.Count == 0) return false; ulong pseq = 0; - foreach(GptEntry entry in - entries.Where(entry => entry.partitionType != Guid.Empty && entry.partitionId != Guid.Empty)) + foreach(GptEntry entry in entries.Where(entry => entry.partitionType != Guid.Empty && + entry.partitionId != Guid.Empty)) { - DicConsole.DebugWriteLine("GPT Plugin", "entry.partitionType = {0}", entry.partitionType); - DicConsole.DebugWriteLine("GPT Plugin", "entry.partitionId = {0}", entry.partitionId); - DicConsole.DebugWriteLine("GPT Plugin", "entry.startLBA = {0}", entry.startLBA); - DicConsole.DebugWriteLine("GPT Plugin", "entry.endLBA = {0}", entry.endLBA); + DicConsole.DebugWriteLine("GPT Plugin", "entry.partitionType = {0}", entry.partitionType); + DicConsole.DebugWriteLine("GPT Plugin", "entry.partitionId = {0}", entry.partitionId); + DicConsole.DebugWriteLine("GPT Plugin", "entry.startLBA = {0}", entry.startLBA); + DicConsole.DebugWriteLine("GPT Plugin", "entry.endLBA = {0}", entry.endLBA); DicConsole.DebugWriteLine("GPT Plugin", "entry.attributes = 0x{0:X16}", entry.attributes); - DicConsole.DebugWriteLine("GPT Plugin", "entry.name = {0}", entry.name); + DicConsole.DebugWriteLine("GPT Plugin", "entry.name = {0}", entry.name); if(entry.startLBA / divisor > imagePlugin.Info.Sectors || - entry.endLBA / divisor > imagePlugin.Info.Sectors) return false; + entry.endLBA / divisor > imagePlugin.Info.Sectors) return false; Partition part = new Partition { Description = $"ID: {entry.partitionId}", - Size = (entry.endLBA - entry.startLBA + 1) * sectorSize, - Name = entry.name, - Length = (entry.endLBA - entry.startLBA + 1) / divisor, - Sequence = pseq++, - Offset = entry.startLBA * sectorSize, - Start = entry.startLBA / divisor, - Type = GetGuidTypeName(entry.partitionType), - Scheme = Name + Size = (entry.endLBA - entry.startLBA + 1) * sectorSize, + Name = entry.name, + Length = (entry.endLBA - entry.startLBA + 1) / divisor, + Sequence = pseq++, + Offset = entry.startLBA * sectorSize, + Start = entry.startLBA / divisor, + Type = GetGuidTypeName(entry.partitionType), + Scheme = Name }; DicConsole.DebugWriteLine("GPT Plugin", "part.PartitionType = {0}", part.Type); partitions.Add(part); @@ -288,7 +289,7 @@ namespace DiscImageChef.Partitions 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 ""; + default: return ""; } } @@ -296,30 +297,31 @@ namespace DiscImageChef.Partitions struct GptHeader { public ulong signature; - public uint revision; - public uint headerSize; - public uint headerCrc; - public uint reserved; + public uint revision; + public uint headerSize; + public uint headerCrc; + public uint reserved; public ulong myLBA; public ulong alternateLBA; public ulong firstUsableLBA; public ulong lastUsableLBA; - public Guid diskGuid; + public Guid diskGuid; public ulong entryLBA; - public uint entries; - public uint entriesSize; - public uint entriesCrc; + public uint entries; + public uint entriesSize; + public uint entriesCrc; } [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)] struct GptEntry { - public Guid partitionType; - public Guid partitionId; + public Guid partitionType; + public Guid partitionId; 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/MBR.cs b/DiscImageChef.Partitions/MBR.cs index 159aa5b7d..26a8b1b1f 100644 --- a/DiscImageChef.Partitions/MBR.cs +++ b/DiscImageChef.Partitions/MBR.cs @@ -47,7 +47,7 @@ namespace DiscImageChef.Partitions const ushort MBR_MAGIC = 0xAA55; const ushort NEC_MAGIC = 0xA55A; - const ushort DM_MAGIC = 0x55AA; + const ushort DM_MAGIC = 0x55AA; static readonly string[] MbrTypes = { @@ -185,7 +185,7 @@ namespace DiscImageChef.Partitions }; public string Name => "Master Boot Record"; - public Guid Id => new Guid("5E8A34E8-4F1A-59E6-4BF7-7EA647063A76"); + public Guid Id => new Guid("5E8A34E8-4F1A-59E6-4BF7-7EA647063A76"); public bool GetInformation(IMediaImage imagePlugin, out List partitions, ulong sectorOffset) { @@ -202,7 +202,7 @@ namespace DiscImageChef.Partitions if(imagePlugin.Info.XmlMediaType == XmlMediaType.OpticalDisc) { sectorSize = 512; - divider = 4; + divider = 4; } byte[] sector = imagePlugin.ReadSector(sectorOffset); @@ -226,7 +226,7 @@ namespace DiscImageChef.Partitions typeof(DiskManagerMasterBootRecord)); handle.Free(); - DicConsole.DebugWriteLine("MBR plugin", "xmlmedia = {0}", imagePlugin.Info.XmlMediaType); + DicConsole.DebugWriteLine("MBR plugin", "xmlmedia = {0}", imagePlugin.Info.XmlMediaType); DicConsole.DebugWriteLine("MBR plugin", "mbr.magic = {0:X4}", mbr.magic); if(mbr.magic != MBR_MAGIC) return false; // Not MBR @@ -241,7 +241,7 @@ namespace DiscImageChef.Partitions if(signature != GPT_MAGIC && imagePlugin.Info.XmlMediaType == XmlMediaType.OpticalDisc) { - hdrBytes = imagePlugin.ReadSector(sectorOffset); + hdrBytes = imagePlugin.ReadSector(sectorOffset); signature = BitConverter.ToUInt64(hdrBytes, 512); DicConsole.DebugWriteLine("MBR Plugin", "gpt.signature @ 0x200 = 0x{0:X16}", signature); if(signature == GPT_MAGIC) return false; @@ -249,24 +249,24 @@ namespace DiscImageChef.Partitions MbrPartitionEntry[] entries; - if(mbrOntrack.dm_magic == DM_MAGIC) entries = mbrOntrack.entries; + if(mbrOntrack.dm_magic == DM_MAGIC) entries = mbrOntrack.entries; else if(mbrNec.nec_magic == NEC_MAGIC) entries = mbrNec.entries; - else entries = mbr.entries; + else entries = mbr.entries; foreach(MbrPartitionEntry entry in entries) { - byte startSector = (byte)(entry.start_sector & 0x3F); + byte startSector = (byte)(entry.start_sector & 0x3F); ushort startCylinder = (ushort)(((entry.start_sector & 0xC0) << 2) | entry.start_cylinder); - byte endSector = (byte)(entry.end_sector & 0x3F); - ushort endCylinder = (ushort)(((entry.end_sector & 0xC0) << 2) | entry.end_cylinder); - ulong lbaStart = entry.lba_start; - ulong lbaSectors = entry.lba_sectors; + byte endSector = (byte)(entry.end_sector & 0x3F); + ushort endCylinder = (ushort)(((entry.end_sector & 0xC0) << 2) | entry.end_cylinder); + ulong lbaStart = entry.lba_start; + ulong lbaSectors = entry.lba_sectors; // Let's start the fun... - bool valid = true; + bool valid = true; bool extended = false; - bool minix = false; + bool minix = false; if(entry.status != 0x00 && entry.status != 0x80) return false; // Maybe a FAT filesystem @@ -275,14 +275,15 @@ namespace DiscImageChef.Partitions entry.type == 0x85 || entry.type == 0x91 || entry.type == 0x9B || entry.type == 0xC5 || entry.type == 0xCF || entry.type == 0xD5) { - valid = false; + 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) { lbaStart = CHS.ToLBA(startCylinder, entry.start_head, startSector, imagePlugin.Info.Heads, @@ -292,62 +293,61 @@ namespace DiscImageChef.Partitions } // For optical media - lbaStart /= divider; + lbaStart /= divider; lbaSectors /= divider; if(minix && lbaStart == sectorOffset) minix = false; if(lbaStart > imagePlugin.Info.Sectors) { - valid = false; + valid = false; extended = false; } // Some buggy implementations do some rounding errors getting a few sectors beyond device size - if(lbaStart + lbaSectors > imagePlugin.Info.Sectors) - lbaSectors = imagePlugin.Info.Sectors - lbaStart; + if(lbaStart + lbaSectors > imagePlugin.Info.Sectors) lbaSectors = imagePlugin.Info.Sectors - lbaStart; - DicConsole.DebugWriteLine("MBR plugin", "entry.status {0}", entry.status); - DicConsole.DebugWriteLine("MBR plugin", "entry.type {0}", entry.type); - DicConsole.DebugWriteLine("MBR plugin", "entry.lba_start {0}", entry.lba_start); - DicConsole.DebugWriteLine("MBR plugin", "entry.lba_sectors {0}", entry.lba_sectors); + DicConsole.DebugWriteLine("MBR plugin", "entry.status {0}", entry.status); + DicConsole.DebugWriteLine("MBR plugin", "entry.type {0}", entry.type); + DicConsole.DebugWriteLine("MBR plugin", "entry.lba_start {0}", entry.lba_start); + DicConsole.DebugWriteLine("MBR plugin", "entry.lba_sectors {0}", entry.lba_sectors); DicConsole.DebugWriteLine("MBR plugin", "entry.start_cylinder {0}", startCylinder); - DicConsole.DebugWriteLine("MBR plugin", "entry.start_head {0}", entry.start_head); - DicConsole.DebugWriteLine("MBR plugin", "entry.start_sector {0}", startSector); - DicConsole.DebugWriteLine("MBR plugin", "entry.end_cylinder {0}", endCylinder); - DicConsole.DebugWriteLine("MBR plugin", "entry.end_head {0}", entry.end_head); - DicConsole.DebugWriteLine("MBR plugin", "entry.end_sector {0}", endSector); + DicConsole.DebugWriteLine("MBR plugin", "entry.start_head {0}", entry.start_head); + DicConsole.DebugWriteLine("MBR plugin", "entry.start_sector {0}", startSector); + DicConsole.DebugWriteLine("MBR plugin", "entry.end_cylinder {0}", endCylinder); + DicConsole.DebugWriteLine("MBR plugin", "entry.end_head {0}", entry.end_head); + DicConsole.DebugWriteLine("MBR plugin", "entry.end_sector {0}", endSector); DicConsole.DebugWriteLine("MBR plugin", "entry.minix = {0}", minix); - DicConsole.DebugWriteLine("MBR plugin", "lba_start {0}", lbaStart); + DicConsole.DebugWriteLine("MBR plugin", "lba_start {0}", lbaStart); DicConsole.DebugWriteLine("MBR plugin", "lba_sectors {0}", lbaSectors); if(valid && minix) // Let's mix the fun if(GetMinix(imagePlugin, lbaStart, divider, sectorOffset, sectorSize, out List mnxParts)) partitions.AddRange(mnxParts); - else minix = false; + else + minix = false; if(valid && !minix) { Partition part = new Partition(); - if((lbaStart > 0 || imagePlugin.Info.XmlMediaType == XmlMediaType.OpticalDisc) && - lbaSectors > 0) + if((lbaStart > 0 || imagePlugin.Info.XmlMediaType == XmlMediaType.OpticalDisc) && lbaSectors > 0) { - part.Start = lbaStart + sectorOffset; + part.Start = lbaStart + sectorOffset; part.Length = lbaSectors; - part.Offset = part.Start * sectorSize; - part.Size = part.Length * sectorSize; + part.Offset = part.Start * sectorSize; + part.Size = part.Length * sectorSize; } else valid = false; if(valid) { - part.Type = $"0x{entry.type:X2}"; - part.Name = DecodeMbrType(entry.type); - part.Sequence = counter; + part.Type = $"0x{entry.type:X2}"; + part.Name = DecodeMbrType(entry.type); + part.Sequence = counter; part.Description = entry.status == 0x80 ? "Partition is bootable." : ""; - part.Scheme = Name; + part.Scheme = Name; counter++; @@ -359,8 +359,8 @@ namespace DiscImageChef.Partitions if(!extended) continue; - bool processingExtended = true; - ulong chainStart = lbaStart; + bool processingExtended = true; + ulong chainStart = lbaStart; while(processingExtended) { @@ -381,47 +381,47 @@ namespace DiscImageChef.Partitions foreach(MbrPartitionEntry ebrEntry in ebr.entries) { bool extValid = true; - startSector = (byte)(ebrEntry.start_sector & 0x3F); + startSector = (byte)(ebrEntry.start_sector & 0x3F); startCylinder = (ushort)(((ebrEntry.start_sector & 0xC0) << 2) | ebrEntry.start_cylinder); - endSector = (byte)(ebrEntry.end_sector & 0x3F); - endCylinder = (ushort)(((ebrEntry.end_sector & 0xC0) << 2) | ebrEntry.end_cylinder); - ulong extStart = ebrEntry.lba_start; + endSector = (byte)(ebrEntry.end_sector & 0x3F); + endCylinder = (ushort)(((ebrEntry.end_sector & 0xC0) << 2) | ebrEntry.end_cylinder); + ulong extStart = ebrEntry.lba_start; ulong extSectors = ebrEntry.lba_sectors; - bool extMinix = false; + bool extMinix = false; - DicConsole.DebugWriteLine("MBR plugin", "ebr_entry.status {0}", ebrEntry.status); - DicConsole.DebugWriteLine("MBR plugin", "ebr_entry.type {0}", ebrEntry.type); - DicConsole.DebugWriteLine("MBR plugin", "ebr_entry.lba_start {0}", ebrEntry.lba_start); - DicConsole.DebugWriteLine("MBR plugin", "ebr_entry.lba_sectors {0}", ebrEntry.lba_sectors); + DicConsole.DebugWriteLine("MBR plugin", "ebr_entry.status {0}", ebrEntry.status); + DicConsole.DebugWriteLine("MBR plugin", "ebr_entry.type {0}", ebrEntry.type); + DicConsole.DebugWriteLine("MBR plugin", "ebr_entry.lba_start {0}", ebrEntry.lba_start); + DicConsole.DebugWriteLine("MBR plugin", "ebr_entry.lba_sectors {0}", ebrEntry.lba_sectors); DicConsole.DebugWriteLine("MBR plugin", "ebr_entry.start_cylinder {0}", startCylinder); - DicConsole.DebugWriteLine("MBR plugin", "ebr_entry.start_head {0}", ebrEntry.start_head); - DicConsole.DebugWriteLine("MBR plugin", "ebr_entry.start_sector {0}", startSector); - DicConsole.DebugWriteLine("MBR plugin", "ebr_entry.end_cylinder {0}", endCylinder); - DicConsole.DebugWriteLine("MBR plugin", "ebr_entry.end_head {0}", ebrEntry.end_head); - DicConsole.DebugWriteLine("MBR plugin", "ebr_entry.end_sector {0}", endSector); + DicConsole.DebugWriteLine("MBR plugin", "ebr_entry.start_head {0}", ebrEntry.start_head); + DicConsole.DebugWriteLine("MBR plugin", "ebr_entry.start_sector {0}", startSector); + DicConsole.DebugWriteLine("MBR plugin", "ebr_entry.end_cylinder {0}", endCylinder); + DicConsole.DebugWriteLine("MBR plugin", "ebr_entry.end_head {0}", ebrEntry.end_head); + DicConsole.DebugWriteLine("MBR plugin", "ebr_entry.end_sector {0}", endSector); // Let's start the fun... extValid &= ebrEntry.status == 0x00 || ebrEntry.status == 0x80; extValid &= ebrEntry.type != 0x00; - extValid &= ebrEntry.lba_start != 0 || ebrEntry.lba_sectors != 0 || - ebrEntry.start_cylinder != 0 || ebrEntry.start_head != 0 || - ebrEntry.start_sector != 0 || ebrEntry.end_cylinder != 0 || - ebrEntry.end_head != 0 || ebrEntry.end_sector != 0; + extValid &= ebrEntry.lba_start != 0 || ebrEntry.lba_sectors != 0 || + ebrEntry.start_cylinder != 0 || ebrEntry.start_head != 0 || + ebrEntry.start_sector != 0 || ebrEntry.end_cylinder != 0 || + ebrEntry.end_head != 0 || ebrEntry.end_sector != 0; if(ebrEntry.lba_start == 0 && ebrEntry.lba_sectors == 0 && extValid) { extStart = CHS.ToLBA(startCylinder, ebrEntry.start_head, startSector, imagePlugin.Info.Heads, imagePlugin.Info.SectorsPerTrack); extSectors = CHS.ToLBA(endCylinder, ebrEntry.end_head, ebrEntry.end_sector, - imagePlugin.Info.Heads, imagePlugin.Info.SectorsPerTrack) - - extStart; + imagePlugin.Info.Heads, imagePlugin.Info.SectorsPerTrack) - extStart; } + extMinix |= ebrEntry.type == 0x81 || ebrEntry.type == 0x80; // For optical media - extStart /= divider; + extStart /= divider; extSectors /= divider; - DicConsole.DebugWriteLine("MBR plugin", "ext_start {0}", extStart); + DicConsole.DebugWriteLine("MBR plugin", "ext_start {0}", extStart); DicConsole.DebugWriteLine("MBR plugin", "ext_sectors {0}", extSectors); if(ebrEntry.type == 0x05 || ebrEntry.type == 0x0F || ebrEntry.type == 0x15 || @@ -429,7 +429,7 @@ namespace DiscImageChef.Partitions ebrEntry.type == 0x9B || ebrEntry.type == 0xC5 || ebrEntry.type == 0xCF || ebrEntry.type == 0xD5) { - extValid = false; + extValid = false; nextStart = chainStart + extStart; } @@ -442,28 +442,30 @@ namespace DiscImageChef.Partitions if(extValid && extMinix) // Let's mix the fun if(GetMinix(imagePlugin, lbaStart, divider, sectorOffset, sectorSize, - out List mnxParts)) partitions.AddRange(mnxParts); - else extMinix = false; + out List mnxParts)) + partitions.AddRange(mnxParts); + else + extMinix = false; if(!extValid || extMinix) continue; Partition part = new Partition(); if(extStart > 0 && extSectors > 0) { - part.Start = extStart + sectorOffset; + part.Start = extStart + sectorOffset; part.Length = extSectors; - part.Offset = part.Start * sectorSize; - part.Size = part.Length * sectorSize; + part.Offset = part.Start * sectorSize; + part.Size = part.Length * sectorSize; } else extValid = false; if(!extValid) continue; - part.Type = $"0x{ebrEntry.type:X2}"; - part.Name = DecodeMbrType(ebrEntry.type); - part.Sequence = counter; + part.Type = $"0x{ebrEntry.type:X2}"; + part.Name = DecodeMbrType(ebrEntry.type); + part.Sequence = counter; part.Description = ebrEntry.status == 0x80 ? "Partition is bootable." : ""; - part.Scheme = Name; + part.Scheme = Name; counter++; partitions.Add(part); @@ -472,7 +474,7 @@ namespace DiscImageChef.Partitions DicConsole.DebugWriteLine("MBR plugin", "next_start {0}", nextStart); processingExtended &= nextStart != 0; processingExtended &= nextStart <= imagePlugin.Info.Sectors; - lbaStart = nextStart; + lbaStart = nextStart; } } @@ -480,7 +482,8 @@ namespace DiscImageChef.Partitions return partitions.Count != 0; } - static bool GetMinix(IMediaImage imagePlugin, ulong start, ulong divider, ulong sectorOffset, uint sectorSize, + static bool GetMinix(IMediaImage imagePlugin, ulong start, ulong divider, ulong sectorOffset, + uint sectorSize, out List partitions) { partitions = new List(); @@ -500,44 +503,43 @@ namespace DiscImageChef.Partitions foreach(MbrPartitionEntry mnxEntry in mnx.entries) { - bool mnxValid = true; - byte startSector = (byte)(mnxEntry.start_sector & 0x3F); + bool mnxValid = true; + byte startSector = (byte)(mnxEntry.start_sector & 0x3F); ushort startCylinder = (ushort)(((mnxEntry.start_sector & 0xC0) << 2) | mnxEntry.start_cylinder); - byte endSector = (byte)(mnxEntry.end_sector & 0x3F); - ushort endCylinder = (ushort)(((mnxEntry.end_sector & 0xC0) << 2) | mnxEntry.end_cylinder); - ulong mnxStart = mnxEntry.lba_start; - ulong mnxSectors = mnxEntry.lba_sectors; + byte endSector = (byte)(mnxEntry.end_sector & 0x3F); + ushort endCylinder = (ushort)(((mnxEntry.end_sector & 0xC0) << 2) | mnxEntry.end_cylinder); + ulong mnxStart = mnxEntry.lba_start; + ulong mnxSectors = mnxEntry.lba_sectors; - DicConsole.DebugWriteLine("MBR plugin", "mnx_entry.status {0}", mnxEntry.status); - DicConsole.DebugWriteLine("MBR plugin", "mnx_entry.type {0}", mnxEntry.type); - DicConsole.DebugWriteLine("MBR plugin", "mnx_entry.lba_start {0}", mnxEntry.lba_start); - DicConsole.DebugWriteLine("MBR plugin", "mnx_entry.lba_sectors {0}", mnxEntry.lba_sectors); + DicConsole.DebugWriteLine("MBR plugin", "mnx_entry.status {0}", mnxEntry.status); + DicConsole.DebugWriteLine("MBR plugin", "mnx_entry.type {0}", mnxEntry.type); + DicConsole.DebugWriteLine("MBR plugin", "mnx_entry.lba_start {0}", mnxEntry.lba_start); + DicConsole.DebugWriteLine("MBR plugin", "mnx_entry.lba_sectors {0}", mnxEntry.lba_sectors); DicConsole.DebugWriteLine("MBR plugin", "mnx_entry.start_cylinder {0}", startCylinder); - DicConsole.DebugWriteLine("MBR plugin", "mnx_entry.start_head {0}", mnxEntry.start_head); - DicConsole.DebugWriteLine("MBR plugin", "mnx_entry.start_sector {0}", startSector); - DicConsole.DebugWriteLine("MBR plugin", "mnx_entry.end_cylinder {0}", endCylinder); - DicConsole.DebugWriteLine("MBR plugin", "mnx_entry.end_head {0}", mnxEntry.end_head); - DicConsole.DebugWriteLine("MBR plugin", "mnx_entry.end_sector {0}", endSector); + DicConsole.DebugWriteLine("MBR plugin", "mnx_entry.start_head {0}", mnxEntry.start_head); + DicConsole.DebugWriteLine("MBR plugin", "mnx_entry.start_sector {0}", startSector); + DicConsole.DebugWriteLine("MBR plugin", "mnx_entry.end_cylinder {0}", endCylinder); + DicConsole.DebugWriteLine("MBR plugin", "mnx_entry.end_head {0}", mnxEntry.end_head); + DicConsole.DebugWriteLine("MBR plugin", "mnx_entry.end_sector {0}", endSector); mnxValid &= mnxEntry.status == 0x00 || mnxEntry.status == 0x80; - mnxValid &= mnxEntry.type == 0x81 || mnxEntry.type == 0x80; - mnxValid &= mnxEntry.lba_start != 0 || mnxEntry.lba_sectors != 0 || mnxEntry.start_cylinder != 0 || - mnxEntry.start_head != 0 || mnxEntry.start_sector != 0 || mnxEntry.end_cylinder != 0 || - mnxEntry.end_head != 0 || mnxEntry.end_sector != 0; + mnxValid &= mnxEntry.type == 0x81 || mnxEntry.type == 0x80; + mnxValid &= mnxEntry.lba_start != 0 || mnxEntry.lba_sectors != 0 || mnxEntry.start_cylinder != 0 || + mnxEntry.start_head != 0 || mnxEntry.start_sector != 0 || mnxEntry.end_cylinder != 0 || + mnxEntry.end_head != 0 || mnxEntry.end_sector != 0; if(mnxEntry.lba_start == 0 && mnxEntry.lba_sectors == 0 && mnxValid) { mnxStart = CHS.ToLBA(startCylinder, mnxEntry.start_head, startSector, imagePlugin.Info.Heads, imagePlugin.Info.SectorsPerTrack); - mnxSectors = CHS.ToLBA(endCylinder, mnxEntry.end_head, mnxEntry.end_sector, - imagePlugin.Info.Heads, imagePlugin.Info.SectorsPerTrack) - - mnxStart; + mnxSectors = CHS.ToLBA(endCylinder, mnxEntry.end_head, mnxEntry.end_sector, imagePlugin.Info.Heads, + imagePlugin.Info.SectorsPerTrack) - mnxStart; } // For optical media - mnxStart /= divider; + mnxStart /= divider; mnxSectors /= divider; - DicConsole.DebugWriteLine("MBR plugin", "mnx_start {0}", mnxStart); + DicConsole.DebugWriteLine("MBR plugin", "mnx_start {0}", mnxStart); DicConsole.DebugWriteLine("MBR plugin", "mnx_sectors {0}", mnxSectors); if(!mnxValid) continue; @@ -545,20 +547,20 @@ namespace DiscImageChef.Partitions Partition part = new Partition(); if(mnxStart > 0 && mnxSectors > 0) { - part.Start = mnxStart + sectorOffset; + part.Start = mnxStart + sectorOffset; part.Length = mnxSectors; - part.Offset = part.Start * sectorSize; - part.Size = part.Length * sectorSize; + part.Offset = part.Start * sectorSize; + part.Size = part.Length * sectorSize; } else mnxValid = false; if(!mnxValid) continue; - anyMnx = true; - part.Type = "MINIX"; - part.Name = "MINIX"; + anyMnx = true; + part.Type = "MINIX"; + part.Name = "MINIX"; part.Description = mnxEntry.status == 0x80 ? "Partition is bootable." : ""; - part.Scheme = "MINIX"; + part.Scheme = "MINIX"; partitions.Add(part); } @@ -575,9 +577,11 @@ namespace DiscImageChef.Partitions struct MasterBootRecord { /// Boot code - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 446)] public byte[] boot_code; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 446)] + public byte[] boot_code; /// Partitions - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)] public MbrPartitionEntry[] entries; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)] + public MbrPartitionEntry[] entries; /// /// /// @@ -589,9 +593,11 @@ namespace DiscImageChef.Partitions struct ExtendedBootRecord { /// Boot code, almost always unused - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 446)] public byte[] boot_code; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 446)] + public byte[] boot_code; /// Partitions or pointers - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)] public MbrPartitionEntry[] entries; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)] + public MbrPartitionEntry[] entries; /// /// /// @@ -602,7 +608,8 @@ namespace DiscImageChef.Partitions struct TimedMasterBootRecord { /// Boot code - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 218)] public byte[] boot_code; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 218)] + public byte[] boot_code; /// Set to 0 public ushort zero; /// Original physical drive @@ -614,9 +621,11 @@ namespace DiscImageChef.Partitions /// Disk timestamp, hours public byte hours; /// Boot code, continuation - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 222)] public byte[] boot_code2; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 222)] + public byte[] boot_code2; /// Partitions - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)] public MbrPartitionEntry[] entries; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)] + public MbrPartitionEntry[] entries; /// /// /// @@ -627,13 +636,15 @@ namespace DiscImageChef.Partitions struct SerializedMasterBootRecord { /// Boot code - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 440)] public byte[] boot_code; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 440)] + public byte[] boot_code; /// Disk serial number public uint serial; /// Set to 0 public ushort zero; /// Partitions - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)] public MbrPartitionEntry[] entries; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)] + public MbrPartitionEntry[] entries; /// /// /// @@ -644,7 +655,8 @@ namespace DiscImageChef.Partitions struct ModernMasterBootRecord { /// Boot code - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 218)] public byte[] boot_code; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 218)] + public byte[] boot_code; /// Set to 0 public ushort zero; /// Original physical drive @@ -656,13 +668,15 @@ namespace DiscImageChef.Partitions /// Disk timestamp, hours public byte hours; /// Boot code, continuation - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 216)] public byte[] boot_code2; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 216)] + public byte[] boot_code2; /// Disk serial number public uint serial; /// Set to 0 public ushort zero2; /// Partitions - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)] public MbrPartitionEntry[] entries; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)] + public MbrPartitionEntry[] entries; /// /// /// @@ -673,13 +687,15 @@ namespace DiscImageChef.Partitions struct NecMasterBootRecord { /// Boot code - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 380)] public byte[] boot_code; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 380)] + public byte[] boot_code; /// /// /// public ushort nec_magic; /// Partitions - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] public MbrPartitionEntry[] entries; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] + public MbrPartitionEntry[] entries; /// /// /// @@ -690,13 +706,15 @@ namespace DiscImageChef.Partitions struct DiskManagerMasterBootRecord { /// Boot code - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 252)] public byte[] boot_code; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 252)] + public byte[] boot_code; /// /// /// public ushort dm_magic; /// Partitions - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] public MbrPartitionEntry[] entries; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] + public MbrPartitionEntry[] entries; /// /// /// diff --git a/DiscImageChef.Partitions/NeXT.cs b/DiscImageChef.Partitions/NeXT.cs index a6d698f8d..75a24da93 100644 --- a/DiscImageChef.Partitions/NeXT.cs +++ b/DiscImageChef.Partitions/NeXT.cs @@ -56,17 +56,19 @@ namespace DiscImageChef.Partitions const ushort DISKTAB_ENTRY_SIZE = 0x2C; public string Name => "NeXT Disklabel"; - public Guid Id => new Guid("246A6D93-4F1A-1F8A-344D-50187A5513A9"); + public Guid Id => new Guid("246A6D93-4F1A-1F8A-344D-50187A5513A9"); public bool GetInformation(IMediaImage imagePlugin, out List partitions, ulong sectorOffset) { - bool magicFound = false; + bool magicFound = false; byte[] labelSector; uint sectorSize; if(imagePlugin.Info.SectorSize == 2352 || imagePlugin.Info.SectorSize == 2448) sectorSize = 2048; - else sectorSize = imagePlugin.Info.SectorSize; + else + sectorSize = + imagePlugin.Info.SectorSize; partitions = new List(); @@ -80,7 +82,7 @@ namespace DiscImageChef.Partitions uint magic = BigEndianBitConverter.ToUInt32(labelSector, 0x00); if(magic != NEXT_MAGIC1 && magic != NEXT_MAGIC2 && magic != NEXT_MAGIC3) continue; - magicFound = true; + magicFound = true; labelPosition = i + sectorOffset; break; } @@ -92,34 +94,34 @@ namespace DiscImageChef.Partitions labelSector = imagePlugin.ReadSectors(labelPosition, sectorsToRead); - NeXTLabel label = BigEndianMarshal.ByteArrayToStructureBigEndian(labelSector); - byte[] disktabB = new byte[498]; + NeXTLabel label = BigEndianMarshal.ByteArrayToStructureBigEndian(labelSector); + byte[] disktabB = new byte[498]; Array.Copy(labelSector, 44, disktabB, 0, 498); - label.dl_dt = BigEndianMarshal.ByteArrayToStructureBigEndian(disktabB); + label.dl_dt = BigEndianMarshal.ByteArrayToStructureBigEndian(disktabB); label.dl_dt.d_partitions = new NeXTEntry[8]; 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_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_flags = {0}", label.dl_flags); + 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_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); + 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); DicConsole.DebugWriteLine("NeXT Plugin", "label.dl_dt.d_ncylinders = {0}", label.dl_dt.d_ncylinders); - DicConsole.DebugWriteLine("NeXT Plugin", "label.dl_dt.d_rpm = {0}", label.dl_dt.d_rpm); - DicConsole.DebugWriteLine("NeXT Plugin", "label.dl_dt.d_front = {0}", label.dl_dt.d_front); - DicConsole.DebugWriteLine("NeXT Plugin", "label.dl_dt.d_back = {0}", label.dl_dt.d_back); - DicConsole.DebugWriteLine("NeXT Plugin", "label.dl_dt.d_ngroups = {0}", label.dl_dt.d_ngroups); - 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_rpm = {0}", label.dl_dt.d_rpm); + DicConsole.DebugWriteLine("NeXT Plugin", "label.dl_dt.d_front = {0}", label.dl_dt.d_front); + DicConsole.DebugWriteLine("NeXT Plugin", "label.dl_dt.d_back = {0}", label.dl_dt.d_back); + DicConsole.DebugWriteLine("NeXT Plugin", "label.dl_dt.d_ngroups = {0}", label.dl_dt.d_ngroups); + 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}", @@ -129,7 +131,7 @@ namespace DiscImageChef.Partitions 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); + DicConsole.DebugWriteLine("NeXT Plugin", "label.dl_dt.d_rwpartition = {0}", label.dl_dt.d_rwpartition); for(int i = 0; i < 8; i++) { @@ -161,7 +163,7 @@ namespace DiscImageChef.Partitions 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 || + 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) continue; StringBuilder sb = new StringBuilder(); @@ -171,10 +173,10 @@ namespace DiscImageChef.Partitions 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), - Type = StringHandlers.CToString(label.dl_dt.d_partitions[i].p_type), + 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 / sectorSize), + 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 / sectorSize), Start = (ulong)((label.dl_dt.d_partitions[i].p_base + label.dl_dt.d_front) * label.dl_dt.d_secsize / sectorSize), Scheme = Name @@ -184,14 +186,14 @@ namespace DiscImageChef.Partitions { DicConsole.DebugWriteLine("NeXT Plugin", "Partition bigger than device, reducing..."); part.Length = imagePlugin.Info.Sectors - part.Start; - part.Size = part.Length * sectorSize; + part.Size = part.Length * sectorSize; 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"); + 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(); @@ -223,7 +225,8 @@ namespace DiscImageChef.Partitions /// Device size in blocks public int dl_size; /// Device name - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 24)] public byte[] dl_label; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 24)] + public byte[] dl_label; /// Device flags public uint dl_flags; /// Device tag @@ -247,7 +250,8 @@ namespace DiscImageChef.Partitions /// Device size in blocks public int dl_size; /// Device name - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 24)] public byte[] dl_label; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 24)] + public byte[] dl_label; /// Device flags public uint dl_flags; /// Device tag @@ -255,7 +259,8 @@ namespace DiscImageChef.Partitions /// Device info and partitions public NeXTDiskTab dl_dt; /// Bad sector table - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 1670)] public int[] dl_bad; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 1670)] + public int[] dl_bad; /// Checksum public ushort dl_checksum; } @@ -267,9 +272,11 @@ namespace DiscImageChef.Partitions struct NeXTDiskTab { /// Drive name - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 24)] public byte[] d_name; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 24)] + public byte[] d_name; /// Drive type - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 24)] public byte[] d_type; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 24)] + public byte[] d_type; /// Sector size public int d_secsize; /// tracks/cylinder @@ -293,17 +300,21 @@ namespace DiscImageChef.Partitions /// sector offset to first alternate public short d_ag_off; /// "blk 0" boot locations - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)] public int[] d_boot0_blkno; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)] + public int[] d_boot0_blkno; /// default bootfile - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 24)] public byte[] d_bootfile; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 24)] + public byte[] d_bootfile; /// host name - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] public byte[] d_hostname; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] + public byte[] d_hostname; /// root partition public byte d_rootpartition; /// r/w partition public byte d_rwpartition; /// partitions - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] public NeXTEntry[] d_partitions; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] + public NeXTEntry[] d_partitions; } /// @@ -331,11 +342,13 @@ namespace DiscImageChef.Partitions /// Should newfs be run on first start? public byte p_newfs; /// Mount point or empty if mount where you want - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] public byte[] p_mountpt; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] + public byte[] p_mountpt; /// Should automount public byte p_automnt; /// Filesystem type, always "4.3BSD"? - [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 2e0239a78..d45f490eb 100644 --- a/DiscImageChef.Partitions/PC98.cs +++ b/DiscImageChef.Partitions/PC98.cs @@ -44,7 +44,7 @@ namespace DiscImageChef.Partitions public class PC98 : IPartition { public string Name => "NEC PC-9800 partition table"; - public Guid Id => new Guid("27333401-C7C2-447D-961C-22AD0641A09A"); + public Guid Id => new Guid("27333401-C7C2-447D-961C-22AD0641A09A"); public bool GetInformation(IMediaImage imagePlugin, out List partitions, ulong sectorOffset) { @@ -53,12 +53,12 @@ namespace DiscImageChef.Partitions if(sectorOffset != 0) return false; byte[] bootSector = imagePlugin.ReadSector(0); - byte[] sector = imagePlugin.ReadSector(1); + byte[] sector = imagePlugin.ReadSector(1); if(bootSector[bootSector.Length - 2] != 0x55 || bootSector[bootSector.Length - 1] != 0xAA) return false; // Prevent false positives with some FAT BPBs if(Encoding.ASCII.GetString(bootSector, 0x36, 3) == "FAT") return false; - + IntPtr tablePtr = Marshal.AllocHGlobal(256); Marshal.Copy(sector, 0, tablePtr, 256); PC98Table table = (PC98Table)Marshal.PtrToStructure(tablePtr, typeof(PC98Table)); @@ -68,25 +68,26 @@ namespace DiscImageChef.Partitions foreach(PC98Partition entry in table.entries) { - DicConsole.DebugWriteLine("PC98 plugin", "entry.dp_mid = {0}", entry.dp_mid); - DicConsole.DebugWriteLine("PC98 plugin", "entry.dp_sid = {0}", entry.dp_sid); - DicConsole.DebugWriteLine("PC98 plugin", "entry.dp_dum1 = {0}", entry.dp_dum1); - DicConsole.DebugWriteLine("PC98 plugin", "entry.dp_dum2 = {0}", entry.dp_dum2); - DicConsole.DebugWriteLine("PC98 plugin", "entry.dp_ipl_sct = {0}", entry.dp_ipl_sct); + DicConsole.DebugWriteLine("PC98 plugin", "entry.dp_mid = {0}", entry.dp_mid); + DicConsole.DebugWriteLine("PC98 plugin", "entry.dp_sid = {0}", entry.dp_sid); + DicConsole.DebugWriteLine("PC98 plugin", "entry.dp_dum1 = {0}", entry.dp_dum1); + DicConsole.DebugWriteLine("PC98 plugin", "entry.dp_dum2 = {0}", entry.dp_dum2); + DicConsole.DebugWriteLine("PC98 plugin", "entry.dp_ipl_sct = {0}", entry.dp_ipl_sct); DicConsole.DebugWriteLine("PC98 plugin", "entry.dp_ipl_head = {0}", entry.dp_ipl_head); - DicConsole.DebugWriteLine("PC98 plugin", "entry.dp_ipl_cyl = {0}", entry.dp_ipl_cyl); - DicConsole.DebugWriteLine("PC98 plugin", "entry.dp_ssect = {0}", entry.dp_ssect); - DicConsole.DebugWriteLine("PC98 plugin", "entry.dp_shd = {0}", entry.dp_shd); - DicConsole.DebugWriteLine("PC98 plugin", "entry.dp_scyl = {0}", entry.dp_scyl); - 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_ipl_cyl = {0}", entry.dp_ipl_cyl); + DicConsole.DebugWriteLine("PC98 plugin", "entry.dp_ssect = {0}", entry.dp_ssect); + DicConsole.DebugWriteLine("PC98 plugin", "entry.dp_shd = {0}", entry.dp_shd); + DicConsole.DebugWriteLine("PC98 plugin", "entry.dp_scyl = {0}", entry.dp_scyl); + 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))); - if(entry.dp_scyl == entry.dp_ecyl || entry.dp_ecyl <= 0 || entry.dp_scyl > imagePlugin.Info.Cylinders || - entry.dp_ecyl > imagePlugin.Info.Cylinders || entry.dp_shd > imagePlugin.Info.Heads || - entry.dp_ehd > imagePlugin.Info.Heads || entry.dp_ssect > imagePlugin.Info.SectorsPerTrack || + if(entry.dp_scyl == entry.dp_ecyl || entry.dp_ecyl <= 0 || + entry.dp_scyl > imagePlugin.Info.Cylinders || + entry.dp_ecyl > imagePlugin.Info.Cylinders || entry.dp_shd > imagePlugin.Info.Heads || + entry.dp_ehd > imagePlugin.Info.Heads || entry.dp_ssect > imagePlugin.Info.SectorsPerTrack || entry.dp_esect > imagePlugin.Info.SectorsPerTrack) continue; Partition part = new Partition @@ -94,26 +95,27 @@ namespace DiscImageChef.Partitions Start = CHS.ToLBA(entry.dp_scyl, entry.dp_shd, (uint)(entry.dp_ssect + 1), imagePlugin.Info.Heads, imagePlugin.Info.SectorsPerTrack), - Type = DecodePC98Sid(entry.dp_sid), - Name = StringHandlers.CToString(entry.dp_name, Encoding.GetEncoding(932)).Trim(), + Type = DecodePC98Sid(entry.dp_sid), + Name = StringHandlers.CToString(entry.dp_name, Encoding.GetEncoding(932)).Trim(), Sequence = counter, - Scheme = Name + Scheme = Name }; part.Offset = part.Start * imagePlugin.Info.SectorSize; part.Length = CHS.ToLBA(entry.dp_ecyl, entry.dp_ehd, (uint)(entry.dp_esect + 1), imagePlugin.Info.Heads, imagePlugin.Info.SectorsPerTrack) - part.Start; part.Size = part.Length * imagePlugin.Info.SectorSize; - DicConsole.DebugWriteLine("PC98 plugin", "part.Start = {0}", part.Start); - DicConsole.DebugWriteLine("PC98 plugin", "part.Type = {0}", part.Type); - DicConsole.DebugWriteLine("PC98 plugin", "part.Name = {0}", part.Name); + DicConsole.DebugWriteLine("PC98 plugin", "part.Start = {0}", part.Start); + DicConsole.DebugWriteLine("PC98 plugin", "part.Type = {0}", part.Type); + DicConsole.DebugWriteLine("PC98 plugin", "part.Name = {0}", part.Name); DicConsole.DebugWriteLine("PC98 plugin", "part.Sequence = {0}", part.Sequence); - DicConsole.DebugWriteLine("PC98 plugin", "part.Offset = {0}", part.Offset); - DicConsole.DebugWriteLine("PC98 plugin", "part.Length = {0}", part.Length); - DicConsole.DebugWriteLine("PC98 plugin", "part.Size = {0}", part.Size); + DicConsole.DebugWriteLine("PC98 plugin", "part.Offset = {0}", part.Offset); + 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.Info.Sectors || part.End > imagePlugin.Info.Sectors) continue; + part.Start >= imagePlugin.Info.Sectors || + part.End > imagePlugin.Info.Sectors) continue; partitions.Add(part); counter++; @@ -138,14 +140,15 @@ namespace DiscImageChef.Partitions case 0x44: return "FreeBSD"; case 0x61: return "FAT32"; case 0x62: return "Linux"; - default: return "Unknown"; + 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)] @@ -159,18 +162,19 @@ namespace DiscImageChef.Partitions /// Some ID, if 0x80 bit is set, it is active /// public byte dp_sid; - public byte dp_dum1; - public byte dp_dum2; - public byte dp_ipl_sct; - public byte dp_ipl_head; + public byte dp_dum1; + public byte dp_dum2; + public byte dp_ipl_sct; + public byte dp_ipl_head; public ushort dp_ipl_cyl; - public byte dp_ssect; - public byte dp_shd; + public byte dp_ssect; + public byte dp_shd; public ushort dp_scyl; - public byte dp_esect; - public byte dp_ehd; + 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/Plan9.cs b/DiscImageChef.Partitions/Plan9.cs index 41d937bc0..2c582c2e4 100644 --- a/DiscImageChef.Partitions/Plan9.cs +++ b/DiscImageChef.Partitions/Plan9.cs @@ -46,7 +46,7 @@ namespace DiscImageChef.Partitions public class Plan9 : IPartition { public string Name => "Plan9 partition table"; - public Guid Id => new Guid("F0BF4FFC-056E-4E7C-8B65-4EAEE250ADD9"); + public Guid Id => new Guid("F0BF4FFC-056E-4E7C-8B65-4EAEE250ADD9"); public bool GetInformation(IMediaImage imagePlugin, out List partitions, ulong sectorOffset) { @@ -65,13 +65,13 @@ namespace DiscImageChef.Partitions Partition part = new Partition { - Length = end - start + 1, - Offset = (start + sectorOffset) * imagePlugin.Info.SectorSize, - Scheme = Name, + Length = end - start + 1, + Offset = (start + sectorOffset) * imagePlugin.Info.SectorSize, + Scheme = Name, Sequence = (ulong)partitions.Count, - Size = (end - start + 1) * imagePlugin.Info.SectorSize, - Start = start + sectorOffset, - Type = tokens[1] + Size = (end - start + 1) * imagePlugin.Info.SectorSize, + Start = start + sectorOffset, + Type = tokens[1] }; partitions.Add(part); diff --git a/DiscImageChef.Partitions/RDB.cs b/DiscImageChef.Partitions/RDB.cs index 31e131a3e..6ccaec52a 100644 --- a/DiscImageChef.Partitions/RDB.cs +++ b/DiscImageChef.Partitions/RDB.cs @@ -282,8 +282,8 @@ namespace DiscImageChef.Partitions { partitions = new List(); BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian; - ulong rdbBlock = 0; - bool foundRdb = false; + ulong rdbBlock = 0; + bool foundRdb = false; while(rdbBlock < 16) { @@ -446,13 +446,13 @@ namespace DiscImageChef.Partitions // Reading BadBlock list List badBlockChain = new List(); - ulong nextBlock = rdb.BadblockPtr; + ulong nextBlock = rdb.BadblockPtr; while(nextBlock != 0xFFFFFFFF) { DicConsole.DebugWriteLine("Amiga RDB plugin", "Going to block {0} in search of a BadBlock block", nextBlock); - sector = imagePlugin.ReadSector(nextBlock); + sector = imagePlugin.ReadSector(nextBlock); uint magic = BigEndianBitConverter.ToUInt32(sector, 0); if(magic != BAD_BLOCK_LIST_MAGIC) break; @@ -468,7 +468,7 @@ namespace DiscImageChef.Partitions NextPtr = BigEndianBitConverter.ToUInt32(sector, 0x10), Reserved = BigEndianBitConverter.ToUInt32(sector, 0x14) }; - ulong entries = (chainEntry.Size - 6) / 2; + ulong entries = (chainEntry.Size - 6) / 2; chainEntry.BlockPairs = new BadBlockEntry[entries]; DicConsole.DebugWriteLine("Amiga RDB plugin", "chainEntry.magic = 0x{0:X8}", chainEntry.Magic); @@ -481,8 +481,7 @@ namespace DiscImageChef.Partitions for(ulong i = 0; i < entries; i++) { - chainEntry.BlockPairs[i].BadBlock = - BigEndianBitConverter.ToUInt32(sector, (int)(0x18 + i * 8 + 0)); + chainEntry.BlockPairs[i].BadBlock = BigEndianBitConverter.ToUInt32(sector, (int)(0x18 + i * 8 + 0)); chainEntry.BlockPairs[i].GoodBlock = BigEndianBitConverter.ToUInt32(sector, (int)(0x18 + i * 8 + 4)); @@ -496,13 +495,13 @@ namespace DiscImageChef.Partitions // Reading BadBlock list List partitionEntries = new List(); - nextBlock = rdb.PartitionPtr; + nextBlock = rdb.PartitionPtr; while(nextBlock != 0xFFFFFFFF) { DicConsole.DebugWriteLine("Amiga RDB plugin", "Going to block {0} in search of a PartitionEntry block", nextBlock + sectorOffset); - sector = imagePlugin.ReadSector(nextBlock + sectorOffset); + sector = imagePlugin.ReadSector(nextBlock + sectorOffset); uint magic = BigEndianBitConverter.ToUInt32(sector, 0); if(magic != PARTITION_BLOCK_MAGIC) break; @@ -536,7 +535,7 @@ namespace DiscImageChef.Partitions Reserved15 = BigEndianBitConverter.ToUInt32(sector, 0x74), Reserved16 = BigEndianBitConverter.ToUInt32(sector, 0x78), Reserved17 = BigEndianBitConverter.ToUInt32(sector, 0x7C), - DosEnvVec = new DosEnvironmentVector + DosEnvVec = new DosEnvironmentVector { Size = BigEndianBitConverter.ToUInt32(sector, 0x80), BlockSize = BigEndianBitConverter.ToUInt32(sector, 0x84), @@ -640,13 +639,13 @@ namespace DiscImageChef.Partitions // Reading BadBlock list List fshdEntries = new List(); List segmentEntries = new List(); - nextBlock = rdb.FsheaderPtr; + nextBlock = rdb.FsheaderPtr; while(nextBlock != 0xFFFFFFFF) { DicConsole.DebugWriteLine("Amiga RDB plugin", "Going to block {0} in search of a FileSystemHeader block", nextBlock); - sector = imagePlugin.ReadSector(nextBlock); + sector = imagePlugin.ReadSector(nextBlock); uint magic = BigEndianBitConverter.ToUInt32(sector, 0); if(magic != FILESYSTEM_HEADER_MAGIC) break; @@ -666,7 +665,7 @@ namespace DiscImageChef.Partitions DosType = BigEndianBitConverter.ToUInt32(sector, 0x20), Version = BigEndianBitConverter.ToUInt32(sector, 0x24), PatchFlags = BigEndianBitConverter.ToUInt32(sector, 0x28), - Dnode = new DeviceNode + Dnode = new DeviceNode { Type = BigEndianBitConverter.ToUInt32(sector, 0x2C), Task = BigEndianBitConverter.ToUInt32(sector, 0x30), @@ -706,7 +705,7 @@ namespace DiscImageChef.Partitions fshd.Dnode.SeglistPtr); DicConsole.DebugWriteLine("Amiga RDB plugin", "FSHD.dnode.global_vec = 0x{0:X8}", fshd.Dnode.GlobalVec); - nextBlock = fshd.Dnode.SeglistPtr; + nextBlock = fshd.Dnode.SeglistPtr; bool thereAreLoadSegments = false; Sha1Context sha1Ctx = new Sha1Context(); while(nextBlock != 0xFFFFFFFF) @@ -714,7 +713,7 @@ namespace DiscImageChef.Partitions DicConsole.DebugWriteLine("Amiga RDB plugin", "Going to block {0} in search of a LoadSegment block", nextBlock); - sector = imagePlugin.ReadSector(nextBlock); + sector = imagePlugin.ReadSector(nextBlock); uint magicSeg = BigEndianBitConverter.ToUInt32(sector, 0); if(magicSeg != LOAD_SEG_MAGIC) break; @@ -722,7 +721,7 @@ namespace DiscImageChef.Partitions DicConsole.DebugWriteLine("Amiga RDB plugin", "Found LoadSegment block"); thereAreLoadSegments = true; - LoadSegment loadSeg = new LoadSegment + LoadSegment loadSeg = new LoadSegment { Magic = BigEndianBitConverter.ToUInt32(sector, 0x00), Size = BigEndianBitConverter.ToUInt32(sector, 0x04), @@ -730,7 +729,7 @@ namespace DiscImageChef.Partitions TargetId = BigEndianBitConverter.ToUInt32(sector, 0x0C), NextPtr = BigEndianBitConverter.ToUInt32(sector, 0x10) }; - loadSeg.LoadData = new byte[(loadSeg.Size - 5) * 4]; + loadSeg.LoadData = new byte[(loadSeg.Size - 5) * 4]; Array.Copy(sector, 0x14, loadSeg.LoadData, 0, (loadSeg.Size - 5) * 4); DicConsole.DebugWriteLine("Amiga RDB plugin", "loadSeg.magic = 0x{0:X8}", loadSeg.Magic); @@ -762,7 +761,7 @@ namespace DiscImageChef.Partitions Description = AmigaDosTypeToDescriptionString(rdbEntry.DosEnvVec.DosType), Name = rdbEntry.DriveName, Sequence = sequence, - Length = + Length = (rdbEntry.DosEnvVec.HighCylinder + 1 - rdbEntry.DosEnvVec.LowCylinder) * rdbEntry.DosEnvVec.Surfaces * rdbEntry.DosEnvVec.Bpt, Start = @@ -771,9 +770,8 @@ namespace DiscImageChef.Partitions Type = AmigaDosTypeToString(rdbEntry.DosEnvVec.DosType), Scheme = Name, Offset = - (rdbEntry.DosEnvVec.LowCylinder * - rdbEntry.DosEnvVec.Surfaces * rdbEntry.DosEnvVec.Bpt + - sectorOffset) * rdb.BlockSize, + (rdbEntry.DosEnvVec.LowCylinder * rdbEntry.DosEnvVec.Surfaces * rdbEntry.DosEnvVec.Bpt + + sectorOffset) * rdb.BlockSize, Size = (rdbEntry.DosEnvVec.HighCylinder + 1 - rdbEntry.DosEnvVec.LowCylinder) * rdbEntry.DosEnvVec.Surfaces * rdbEntry.DosEnvVec.Bpt * rdb.BlockSize @@ -805,7 +803,7 @@ namespace DiscImageChef.Partitions case TYPEID_PFS: case TYPEID_PFS2: case TYPEID_PFS_MUSER: - case TYPEID_AFS: return "ProfessionalFileSystem"; + case TYPEID_AFS: return "ProfessionalFileSystem"; case TYPEID_SFS: return "SmartFileSystem v1"; case TYPEID_SFS2: return "SmartFileSystem v2"; case TYPEID_JXFS: return "JXFS"; diff --git a/DiscImageChef.Partitions/RioKarma.cs b/DiscImageChef.Partitions/RioKarma.cs index 8b7423aab..23582abca 100644 --- a/DiscImageChef.Partitions/RioKarma.cs +++ b/DiscImageChef.Partitions/RioKarma.cs @@ -42,10 +42,10 @@ namespace DiscImageChef.Partitions public class RioKarma : IPartition { const ushort KARMA_MAGIC = 0xAB56; - const byte ENTRY_MAGIC = 0x4D; + const byte ENTRY_MAGIC = 0x4D; public string Name => "Rio Karma partitioning"; - public Guid Id => new Guid("246A6D93-4F1A-1F8A-344D-50187A5513A9"); + public Guid Id => new Guid("246A6D93-4F1A-1F8A-344D-50187A5513A9"); public bool GetInformation(IMediaImage imagePlugin, out List partitions, ulong sectorOffset) { @@ -82,9 +82,12 @@ namespace DiscImageChef.Partitions [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; } @@ -93,7 +96,8 @@ namespace DiscImageChef.Partitions { 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/UNIX.cs b/DiscImageChef.Partitions/UNIX.cs index 437d99d64..16e96aad6 100644 --- a/DiscImageChef.Partitions/UNIX.cs +++ b/DiscImageChef.Partitions/UNIX.cs @@ -48,90 +48,90 @@ namespace DiscImageChef.Partitions new Partition { Description = null, - Name = "/", - Type = "data", - Length = 9600, - Start = 0, - Size = 4915200, - Offset = 0, - Sequence = 0 + 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 + 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 + 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 + 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 + 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 + 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 + 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 + Name = "maintenance area", + Type = "maintenance", + Length = 1000, + Start = 399176, + Size = 512000, + Offset = 204378112, + Sequence = 8 } }; @@ -140,68 +140,68 @@ namespace DiscImageChef.Partitions new Partition { Description = null, - Name = "/", - Type = "data", - Length = 9600, - Start = 0, - Size = 4915200, - Offset = 0, - Sequence = 0 + 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 + 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 + 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 + 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 + 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 + Name = "maintenance area", + Type = "maintenance", + Length = 1000, + Start = 236212, + Size = 512000, + Offset = 120940544, + Sequence = 8 } }; @@ -210,101 +210,101 @@ namespace DiscImageChef.Partitions new Partition { Description = null, - Name = "/", - Type = "data", - Length = 9600, - Start = 0, - Size = 4915200, - Offset = 0, - Sequence = 0 + 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 + 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 + 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 + 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 + 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 + 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 + 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 + 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 + Name = "maintenance area", + Type = "maintenance", + Length = 1000, + Start = 890072, + Size = 512000, + Offset = 455716864, + Sequence = 8 } }; @@ -313,79 +313,79 @@ namespace DiscImageChef.Partitions new Partition { Description = null, - Name = "/", - Type = "data", - Length = 9000, - Start = 0, - Size = 4608000, - Offset = 0, - Sequence = 0 + 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 + 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 + 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 + 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 + 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 + 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 + Name = "maintenance area", + Type = "maintenance", + Length = 102, + Start = 890072, + Size = 50800, + Offset = 26009600, + Sequence = 8 } }; @@ -394,57 +394,57 @@ namespace DiscImageChef.Partitions new Partition { Description = null, - Name = "/", - Type = "data", - Length = 9700, - Start = 0, - Size = 4966400, - Offset = 0, - Sequence = 0 + 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 + 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 + 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 + 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 + Name = "maintenance area", + Type = "maintenance", + Length = 32, + Start = 41528, + Size = 16384, + Offset = 21262336, + Sequence = 8 } }; @@ -453,68 +453,68 @@ namespace DiscImageChef.Partitions new Partition { Description = null, - Name = "/", - Type = "data", - Length = 9700, - Start = 0, - Size = 4966400, - Offset = 0, - Sequence = 0 + 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 + 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 + 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 + 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 + 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 + Name = "maintenance area", + Type = "maintenance", + Length = 32, + Start = 83172, + Size = 16384, + Offset = 42584064, + Sequence = 8 } }; @@ -523,57 +523,57 @@ namespace DiscImageChef.Partitions new Partition { Description = null, - Name = "/", - Type = "data", - Length = 7460, - Start = 0, - Size = 4608000, - Offset = 0, - Sequence = 0 + 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 + 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 + 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 + 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 + Name = "maintenance area", + Type = "maintenance", + Length = 32, + Start = 21568, + Size = 16384, + Offset = 11042816, + Sequence = 8 } }; @@ -582,68 +582,68 @@ namespace DiscImageChef.Partitions new Partition { Description = null, - Name = "/", - Type = "data", - Length = 9700, - Start = 0, - Size = 4966400, - Offset = 0, - Sequence = 0 + 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 + 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 + 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 + 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 + 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 + Name = "maintenance area", + Type = "maintenance", + Length = 32, + Start = 60448, + Size = 16384, + Offset = 30949376, + Sequence = 8 } }; @@ -652,68 +652,68 @@ namespace DiscImageChef.Partitions new Partition { Description = null, - Name = "/", - Type = "data", - Length = 9700, - Start = 0, - Size = 4966400, - Offset = 0, - Sequence = 0 + 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 + 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 + 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 + 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 + 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 + Name = "maintenance area", + Type = "maintenance", + Length = 32, + Start = 138640, + Size = 16384, + Offset = 70983680, + Sequence = 8 } }; @@ -722,68 +722,68 @@ namespace DiscImageChef.Partitions new Partition { Description = null, - Name = "/", - Type = "data", - Length = 9700, - Start = 0, - Size = 4966400, - Offset = 0, - Sequence = 0 + 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 + 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 + 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 + 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 + 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 + Name = "maintenance area", + Type = "maintenance", + Length = 32, + Start = 311168, + Size = 16384, + Offset = 159318016, + Sequence = 8 } }; @@ -792,57 +792,57 @@ namespace DiscImageChef.Partitions new Partition { Description = null, - Name = "/", - Type = "data", - Length = 7920, - Start = 0, - Size = 4055040, - Offset = 0, - Sequence = 0 + 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 + 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 + 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 + 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 + Name = "bad sector file", + Type = "bad", + Length = 44, + Start = 27082, + Size = 22528, + Offset = 13865984, + Sequence = 8 } }; @@ -851,57 +851,57 @@ namespace DiscImageChef.Partitions new Partition { Description = null, - Name = "/", - Type = "data", - Length = 7920, - Start = 0, - Size = 4055040, - Offset = 0, - Sequence = 0 + 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 + 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 + 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 + 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 + Name = "bad sector file", + Type = "bad", + Length = 44, + Start = 53746, + Size = 22528, + Offset = 27517952, + Sequence = 8 } }; @@ -910,101 +910,101 @@ namespace DiscImageChef.Partitions new Partition { Description = null, - Name = "/", - Type = "data", - Length = 9120, - Start = 0, - Size = 4669440, - Offset = 0, - Sequence = 0 + 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 + 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 + 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 + 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 + 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 + 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 + 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 + 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 + Name = "bad sector file", + Type = "bad", + Length = 64, + Start = 131616, + Size = 32768, + Offset = 67387392, + Sequence = 8 } }; @@ -1013,101 +1013,101 @@ namespace DiscImageChef.Partitions new Partition { Description = null, - Name = "/", - Type = "data", - Length = 10336, - Start = 0, - Size = 5292032, - Offset = 0, - Sequence = 0 + 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 + 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 + 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 + 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 + 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 + 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 + 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 + 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 + Name = "bad sector file", + Type = "bad", + Length = 64, + Start = 421312, + Size = 32768, + Offset = 215711744, + Sequence = 8 } }; @@ -1116,46 +1116,46 @@ namespace DiscImageChef.Partitions new Partition { Description = null, - Name = "/", - Type = "data", - Length = 8400, - Start = 0, - Size = 4300800, - Offset = 0, - Sequence = 0 + 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 + 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 + 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 + Name = "/usr", + Type = "data", + Length = 28400, + Start = 11600, + Size = 14540800, + Offset = 5939200, + Sequence = 2 } }; @@ -1164,46 +1164,46 @@ namespace DiscImageChef.Partitions new Partition { Description = null, - Name = "/", - Type = "data", - Length = 8400, - Start = 0, - Size = 4300800, - Offset = 0, - Sequence = 0 + 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 + 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 + 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 + Name = "/usr", + Type = "data", + Length = 68400, + Start = 11600, + Size = 35020800, + Offset = 5939200, + Sequence = 2 } }; @@ -1212,68 +1212,68 @@ namespace DiscImageChef.Partitions new Partition { Description = null, - Name = "/", - Type = "data", - Length = 9614, - Start = 0, - Size = 4922368, - Offset = 0, - Sequence = 0 + 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 + 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 + 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 + 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 + 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 + Name = "bad sector file", + Type = "bad", + Length = 44, + Start = 171754, + Size = 22528, + Offset = 87938048, + Sequence = 8 } }; @@ -1282,95 +1282,95 @@ namespace DiscImageChef.Partitions new Partition { Description = null, - Name = "/", - Type = "data", - Length = 9614, - Start = 0, - Size = 4922368, - Offset = 0, - Sequence = 0 + 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 + 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 + 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 + 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 + 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 + 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 + 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 + Name = "bad sector file", + Type = "bad", + Length = 44, + Start = 340626, + Size = 22528, + Offset = 174400512, + Sequence = 8 } }; public string Name => "UNIX hardwired"; - public Guid Id => new Guid("9ED7E30B-53BF-4619-87A0-5D2002155617"); + public Guid Id => new Guid("9ED7E30B-53BF-4619-87A0-5D2002155617"); public bool GetInformation(IMediaImage imagePlugin, out List partitions, ulong sectorOffset) { diff --git a/DiscImageChef.Partitions/VTOC.cs b/DiscImageChef.Partitions/VTOC.cs index ea6db6ad6..78c4d10eb 100644 --- a/DiscImageChef.Partitions/VTOC.cs +++ b/DiscImageChef.Partitions/VTOC.cs @@ -42,106 +42,106 @@ namespace DiscImageChef.Partitions { public class VTOC : IPartition { - const uint PD_MAGIC = 0xCA5E600D; + const uint PD_MAGIC = 0xCA5E600D; const uint VTOC_SANE = 0x600DDEEE; - const uint PD_CIGAM = 0x0D605ECA; + 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 int V_NUMPAR = 16; + const uint XPDVERS = 3; /* 1st version of extended pdinfo */ public string Name => "UNIX VTOC"; - public Guid Id => new Guid("6D35A66F-8D77-426F-A562-D88F6A1F1702"); + public Guid Id => new Guid("6D35A66F-8D77-426F-A562-D88F6A1F1702"); public bool GetInformation(IMediaImage imagePlugin, out List partitions, ulong sectorOffset) { partitions = new List(); - uint magic = 0; - ulong pdloc = 0; - byte[] pdsector = null; - bool magicFound = false; - bool absolute = false; + uint magic = 0; + ulong pdloc = 0; + byte[] pdsector = null; + bool magicFound = false; + bool absolute = false; foreach(ulong i in new ulong[] {0, 1, 8, 29}.TakeWhile(i => i + sectorOffset < imagePlugin.Info.Sectors)) { pdsector = imagePlugin.ReadSector(i + sectorOffset); - magic = BitConverter.ToUInt32(pdsector, 4); + 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); if(magic != PD_MAGIC && magic != PD_CIGAM) continue; magicFound = true; - pdloc = i; + pdloc = i; break; } if(!magicFound) return false; - PDInfo pd; + PDInfo pd; PDInfoOld pdold; - GCHandle handle; + GCHandle handle; if(magic == PD_MAGIC) { handle = GCHandle.Alloc(pdsector, GCHandleType.Pinned); - pd = (PDInfo)Marshal.PtrToStructure(handle.AddrOfPinnedObject(), typeof(PDInfo)); - pdold = (PDInfoOld)Marshal.PtrToStructure(handle.AddrOfPinnedObject(), typeof(PDInfoOld)); + pd = (PDInfo)Marshal.PtrToStructure(handle.AddrOfPinnedObject(), typeof(PDInfo)); + pdold = (PDInfoOld)Marshal.PtrToStructure(handle.AddrOfPinnedObject(), typeof(PDInfoOld)); handle.Free(); } else { - pd = BigEndianMarshal.ByteArrayToStructureBigEndian(pdsector); + pd = BigEndianMarshal.ByteArrayToStructureBigEndian(pdsector); pdold = BigEndianMarshal.ByteArrayToStructureBigEndian(pdsector); } 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.version = {0}", pd.version); + 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); - DicConsole.DebugWriteLine("VTOC plugin", "pdinfo.tracks = {0}", pd.tracks); - DicConsole.DebugWriteLine("VTOC plugin", "pdinfo.sectors = {0}", pd.sectors); - DicConsole.DebugWriteLine("VTOC plugin", "pdinfo.bytes = {0}", pd.bytes); - DicConsole.DebugWriteLine("VTOC plugin", "pdinfo.logicalst = {0}", pd.logicalst); - DicConsole.DebugWriteLine("VTOC plugin", "pdinfo.errlogst = {0}", pd.errlogst); - DicConsole.DebugWriteLine("VTOC plugin", "pdinfo.errlogsz = {0}", pd.errlogsz); - DicConsole.DebugWriteLine("VTOC plugin", "pdinfo.mfgst = {0}", pd.mfgst); - DicConsole.DebugWriteLine("VTOC plugin", "pdinfo.mfgsz = {0}", pd.mfgsz); - DicConsole.DebugWriteLine("VTOC plugin", "pdinfo.defectst = {0}", pd.defectst); - DicConsole.DebugWriteLine("VTOC plugin", "pdinfo.defectsz = {0}", pd.defectsz); - DicConsole.DebugWriteLine("VTOC plugin", "pdinfo.relno = {0}", pd.relno); - DicConsole.DebugWriteLine("VTOC plugin", "pdinfo.relst = {0}", pd.relst); - DicConsole.DebugWriteLine("VTOC plugin", "pdinfo.relsz = {0}", pd.relsz); - DicConsole.DebugWriteLine("VTOC plugin", "pdinfo.relnext = {0}", pd.relnext); - DicConsole.DebugWriteLine("VTOC plugin", "pdinfo.allcstrt = {0}", pdold.allcstrt); - DicConsole.DebugWriteLine("VTOC plugin", "pdinfo.allcend = {0}", pdold.allcend); - DicConsole.DebugWriteLine("VTOC plugin", "pdinfo.vtoc_ptr = {0}", pd.vtoc_ptr); - DicConsole.DebugWriteLine("VTOC plugin", "pdinfo.vtoc_len = {0}", pd.vtoc_len); - DicConsole.DebugWriteLine("VTOC plugin", "pdinfo.vtoc_pad = {0}", pd.vtoc_pad); - DicConsole.DebugWriteLine("VTOC plugin", "pdinfo.alt_ptr = {0}", pd.alt_ptr); - DicConsole.DebugWriteLine("VTOC plugin", "pdinfo.alt_len = {0}", pd.alt_len); - DicConsole.DebugWriteLine("VTOC plugin", "pdinfo.pcyls = {0}", pd.pcyls); - DicConsole.DebugWriteLine("VTOC plugin", "pdinfo.ptracks = {0}", pd.ptracks); - DicConsole.DebugWriteLine("VTOC plugin", "pdinfo.psectors = {0}", pd.psectors); - DicConsole.DebugWriteLine("VTOC plugin", "pdinfo.pbytes = {0}", pd.pbytes); - DicConsole.DebugWriteLine("VTOC plugin", "pdinfo.secovhd = {0}", pd.secovhd); + DicConsole.DebugWriteLine("VTOC plugin", "pdinfo.cyls = {0}", pd.cyls); + DicConsole.DebugWriteLine("VTOC plugin", "pdinfo.tracks = {0}", pd.tracks); + DicConsole.DebugWriteLine("VTOC plugin", "pdinfo.sectors = {0}", pd.sectors); + DicConsole.DebugWriteLine("VTOC plugin", "pdinfo.bytes = {0}", pd.bytes); + DicConsole.DebugWriteLine("VTOC plugin", "pdinfo.logicalst = {0}", pd.logicalst); + DicConsole.DebugWriteLine("VTOC plugin", "pdinfo.errlogst = {0}", pd.errlogst); + DicConsole.DebugWriteLine("VTOC plugin", "pdinfo.errlogsz = {0}", pd.errlogsz); + DicConsole.DebugWriteLine("VTOC plugin", "pdinfo.mfgst = {0}", pd.mfgst); + DicConsole.DebugWriteLine("VTOC plugin", "pdinfo.mfgsz = {0}", pd.mfgsz); + DicConsole.DebugWriteLine("VTOC plugin", "pdinfo.defectst = {0}", pd.defectst); + DicConsole.DebugWriteLine("VTOC plugin", "pdinfo.defectsz = {0}", pd.defectsz); + DicConsole.DebugWriteLine("VTOC plugin", "pdinfo.relno = {0}", pd.relno); + DicConsole.DebugWriteLine("VTOC plugin", "pdinfo.relst = {0}", pd.relst); + DicConsole.DebugWriteLine("VTOC plugin", "pdinfo.relsz = {0}", pd.relsz); + DicConsole.DebugWriteLine("VTOC plugin", "pdinfo.relnext = {0}", pd.relnext); + DicConsole.DebugWriteLine("VTOC plugin", "pdinfo.allcstrt = {0}", pdold.allcstrt); + DicConsole.DebugWriteLine("VTOC plugin", "pdinfo.allcend = {0}", pdold.allcend); + DicConsole.DebugWriteLine("VTOC plugin", "pdinfo.vtoc_ptr = {0}", pd.vtoc_ptr); + DicConsole.DebugWriteLine("VTOC plugin", "pdinfo.vtoc_len = {0}", pd.vtoc_len); + DicConsole.DebugWriteLine("VTOC plugin", "pdinfo.vtoc_pad = {0}", pd.vtoc_pad); + DicConsole.DebugWriteLine("VTOC plugin", "pdinfo.alt_ptr = {0}", pd.alt_ptr); + DicConsole.DebugWriteLine("VTOC plugin", "pdinfo.alt_len = {0}", pd.alt_len); + DicConsole.DebugWriteLine("VTOC plugin", "pdinfo.pcyls = {0}", pd.pcyls); + DicConsole.DebugWriteLine("VTOC plugin", "pdinfo.ptracks = {0}", pd.ptracks); + DicConsole.DebugWriteLine("VTOC plugin", "pdinfo.psectors = {0}", pd.psectors); + DicConsole.DebugWriteLine("VTOC plugin", "pdinfo.pbytes = {0}", pd.pbytes); + DicConsole.DebugWriteLine("VTOC plugin", "pdinfo.secovhd = {0}", pd.secovhd); DicConsole.DebugWriteLine("VTOC plugin", "pdinfo.interleave = {0}", pd.interleave); - DicConsole.DebugWriteLine("VTOC plugin", "pdinfo.skew = {0}", pd.skew); - DicConsole.DebugWriteLine("VTOC plugin", "pdinfo.pad[0] = {0}", pd.pad[0]); - DicConsole.DebugWriteLine("VTOC plugin", "pdinfo.pad[1] = {0}", pd.pad[1]); - DicConsole.DebugWriteLine("VTOC plugin", "pdinfo.pad[2] = {0}", pd.pad[2]); - DicConsole.DebugWriteLine("VTOC plugin", "pdinfo.pad[3] = {0}", pd.pad[3]); - DicConsole.DebugWriteLine("VTOC plugin", "pdinfo.pad[4] = {0}", pd.pad[4]); - DicConsole.DebugWriteLine("VTOC plugin", "pdinfo.pad[5] = {0}", pd.pad[5]); - DicConsole.DebugWriteLine("VTOC plugin", "pdinfo.pad[6] = {0}", pd.pad[6]); - DicConsole.DebugWriteLine("VTOC plugin", "pdinfo.pad[7] = {0}", pd.pad[7]); + DicConsole.DebugWriteLine("VTOC plugin", "pdinfo.skew = {0}", pd.skew); + DicConsole.DebugWriteLine("VTOC plugin", "pdinfo.pad[0] = {0}", pd.pad[0]); + DicConsole.DebugWriteLine("VTOC plugin", "pdinfo.pad[1] = {0}", pd.pad[1]); + DicConsole.DebugWriteLine("VTOC plugin", "pdinfo.pad[2] = {0}", pd.pad[2]); + DicConsole.DebugWriteLine("VTOC plugin", "pdinfo.pad[3] = {0}", pd.pad[3]); + DicConsole.DebugWriteLine("VTOC plugin", "pdinfo.pad[4] = {0}", pd.pad[4]); + DicConsole.DebugWriteLine("VTOC plugin", "pdinfo.pad[5] = {0}", pd.pad[5]); + DicConsole.DebugWriteLine("VTOC plugin", "pdinfo.pad[6] = {0}", pd.pad[6]); + DicConsole.DebugWriteLine("VTOC plugin", "pdinfo.pad[7] = {0}", pd.pad[7]); magicFound = false; - bool useOld = false; - byte[] vtocsector = imagePlugin.ReadSector(pdloc + sectorOffset + 1); - vtoc vtoc = new vtoc(); - vtocold vtocOld = new vtocold(); + bool useOld = false; + byte[] vtocsector = imagePlugin.ReadSector(pdloc + sectorOffset + 1); + vtoc vtoc = new vtoc(); + vtocold vtocOld = new vtocold(); magic = BitConverter.ToUInt32(vtocsector, 0); if(magic == VTOC_SANE || magic == VTOC_ENAS) @@ -151,7 +151,7 @@ namespace DiscImageChef.Partitions if(magic == VTOC_SANE) { handle = GCHandle.Alloc(vtocsector, GCHandleType.Pinned); - vtoc = (vtoc)Marshal.PtrToStructure(handle.AddrOfPinnedObject(), typeof(vtoc)); + vtoc = (vtoc)Marshal.PtrToStructure(handle.AddrOfPinnedObject(), typeof(vtoc)); handle.Free(); } else @@ -159,11 +159,11 @@ namespace DiscImageChef.Partitions vtoc = BigEndianMarshal.ByteArrayToStructureBigEndian(vtocsector); for(int i = 0; i < vtoc.v_part.Length; i++) { - vtoc.v_part[i].p_tag = (pTag)Swapping.Swap((ushort)vtoc.v_part[i].p_tag); - vtoc.v_part[i].p_flag = (pFlag)Swapping.Swap((ushort)vtoc.v_part[i].p_flag); + vtoc.v_part[i].p_tag = (pTag)Swapping.Swap((ushort)vtoc.v_part[i].p_tag); + vtoc.v_part[i].p_flag = (pFlag)Swapping.Swap((ushort)vtoc.v_part[i].p_flag); vtoc.v_part[i].p_start = Swapping.Swap(vtoc.v_part[i].p_start); - vtoc.v_part[i].p_size = Swapping.Swap(vtoc.v_part[i].p_size); - vtoc.timestamp[i] = Swapping.Swap(vtoc.timestamp[i]); + vtoc.v_part[i].p_size = Swapping.Swap(vtoc.v_part[i].p_size); + vtoc.timestamp[i] = Swapping.Swap(vtoc.timestamp[i]); } } } @@ -175,11 +175,11 @@ namespace DiscImageChef.Partitions if(magic == VTOC_SANE || magic == VTOC_ENAS) { magicFound = true; - useOld = true; + useOld = true; DicConsole.DebugWriteLine("VTOC plugin", "Old VTOC found at {0}", pdloc + sectorOffset + 1); if(magic == VTOC_SANE) { - handle = GCHandle.Alloc(vtocsector, GCHandleType.Pinned); + handle = GCHandle.Alloc(vtocsector, GCHandleType.Pinned); vtocOld = (vtocold)Marshal.PtrToStructure(handle.AddrOfPinnedObject(), typeof(vtocold)); handle.Free(); } @@ -188,11 +188,11 @@ namespace DiscImageChef.Partitions vtocOld = BigEndianMarshal.ByteArrayToStructureBigEndian(vtocsector); for(int i = 0; i < vtocOld.v_part.Length; i++) { - vtocOld.v_part[i].p_tag = (pTag)Swapping.Swap((ushort)vtocOld.v_part[i].p_tag); - vtocOld.v_part[i].p_flag = (pFlag)Swapping.Swap((ushort)vtocOld.v_part[i].p_flag); + vtocOld.v_part[i].p_tag = (pTag)Swapping.Swap((ushort)vtocOld.v_part[i].p_tag); + vtocOld.v_part[i].p_flag = (pFlag)Swapping.Swap((ushort)vtocOld.v_part[i].p_flag); vtocOld.v_part[i].p_start = Swapping.Swap(vtocOld.v_part[i].p_start); - vtocOld.v_part[i].p_size = Swapping.Swap(vtocOld.v_part[i].p_size); - vtocOld.timestamp[i] = Swapping.Swap(vtocOld.timestamp[i]); + vtocOld.v_part[i].p_size = Swapping.Swap(vtocOld.v_part[i].p_size); + vtocOld.timestamp[i] = Swapping.Swap(vtocOld.timestamp[i]); } } } @@ -201,9 +201,9 @@ namespace DiscImageChef.Partitions if(!magicFound) { DicConsole.DebugWriteLine("VTOC plugin", "Searching for VTOC on relative byte {0}", pd.vtoc_ptr); - ulong relSecPtr = pd.vtoc_ptr / imagePlugin.Info.SectorSize; - uint relSecOff = pd.vtoc_ptr % imagePlugin.Info.SectorSize; - uint secCount = (relSecOff + pd.vtoc_len) / imagePlugin.Info.SectorSize; + ulong relSecPtr = pd.vtoc_ptr / imagePlugin.Info.SectorSize; + uint relSecOff = pd.vtoc_ptr % imagePlugin.Info.SectorSize; + uint secCount = (relSecOff + pd.vtoc_len) / imagePlugin.Info.SectorSize; if((relSecOff + pd.vtoc_len) % imagePlugin.Info.SectorSize > 0) secCount++; DicConsole.DebugWriteLine("VTOC plugin", "Going to read {0} sectors from sector {1}, getting VTOC from byte {2}", @@ -226,7 +226,7 @@ namespace DiscImageChef.Partitions if(magic == VTOC_SANE) { handle = GCHandle.Alloc(vtocsector, GCHandleType.Pinned); - vtoc = (vtoc)Marshal.PtrToStructure(handle.AddrOfPinnedObject(), typeof(vtoc)); + vtoc = (vtoc)Marshal.PtrToStructure(handle.AddrOfPinnedObject(), typeof(vtoc)); handle.Free(); } else @@ -234,11 +234,11 @@ namespace DiscImageChef.Partitions vtoc = BigEndianMarshal.ByteArrayToStructureBigEndian(vtocsector); for(int i = 0; i < vtoc.v_part.Length; i++) { - vtoc.v_part[i].p_tag = (pTag)Swapping.Swap((ushort)vtoc.v_part[i].p_tag); - vtoc.v_part[i].p_flag = (pFlag)Swapping.Swap((ushort)vtoc.v_part[i].p_flag); + vtoc.v_part[i].p_tag = (pTag)Swapping.Swap((ushort)vtoc.v_part[i].p_tag); + vtoc.v_part[i].p_flag = (pFlag)Swapping.Swap((ushort)vtoc.v_part[i].p_flag); vtoc.v_part[i].p_start = Swapping.Swap(vtoc.v_part[i].p_start); - vtoc.v_part[i].p_size = Swapping.Swap(vtoc.v_part[i].p_size); - vtoc.timestamp[i] = Swapping.Swap(vtoc.timestamp[i]); + vtoc.v_part[i].p_size = Swapping.Swap(vtoc.v_part[i].p_size); + vtoc.timestamp[i] = Swapping.Swap(vtoc.timestamp[i]); } } } @@ -258,7 +258,7 @@ namespace DiscImageChef.Partitions 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); + 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, @@ -280,7 +280,7 @@ namespace DiscImageChef.Partitions 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_pad = {0}", vtoc.v_pad); + 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++) { @@ -296,20 +296,20 @@ namespace DiscImageChef.Partitions } } - uint bps; + uint bps; partition[] parts; - int[] timestamps; + int[] timestamps; if(useOld) { - bps = vtocOld.v_sectorsz; - parts = vtocOld.v_part; + bps = vtocOld.v_sectorsz; + parts = vtocOld.v_part; timestamps = vtocOld.timestamp; } else { - bps = pd.bytes; - parts = vtoc.v_part; + bps = pd.bytes; + parts = vtoc.v_part; timestamps = vtoc.timestamp; } @@ -327,29 +327,30 @@ namespace DiscImageChef.Partitions { Partition part = new Partition { - Start = (ulong)(parts[i].p_start * bps) / imagePlugin.Info.SectorSize, - Length = (ulong)(parts[i].p_size * bps) / imagePlugin.Info.SectorSize, - Offset = (ulong)(parts[i].p_start * bps), - Size = (ulong)(parts[i].p_size * bps), + Start = (ulong)(parts[i].p_start * bps) / imagePlugin.Info.SectorSize, + Length = (ulong)(parts[i].p_size * bps) / imagePlugin.Info.SectorSize, + Offset = (ulong)(parts[i].p_start * bps), + Size = (ulong)(parts[i].p_size * bps), Sequence = (ulong)i, - Type = $"UNIX: {decodeUNIXTAG(parts[i].p_tag, !useOld)}", - Scheme = Name + Type = $"UNIX: {decodeUNIXTAG(parts[i].p_tag, !useOld)}", + Scheme = Name }; string info = ""; // Apparently old ones are absolute :? if(!useOld && !absolute) { - part.Start += sectorOffset; + part.Start += sectorOffset; part.Offset += sectorOffset * imagePlugin.Info.SectorSize; } 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_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 += $" created on {DateHandlers.UnixToDateTime(timestamps[i])}"; + if(timestamps[i] != 0) + info += $" created on {DateHandlers.UnixToDateTime(timestamps[i])}"; part.Description = "UNIX slice" + info + "."; @@ -363,23 +364,23 @@ namespace DiscImageChef.Partitions { 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_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 $"Unknown TAG: 0x{type:X4}"; + 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 $"Unknown TAG: 0x{type:X4}"; } } @@ -387,102 +388,114 @@ namespace DiscImageChef.Partitions struct PDInfo { public uint driveid; /*identifies the device type*/ - public uint sanity; /*verifies device sanity*/ + 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*/ + [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 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 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*/ + 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 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 ushort skew; /*skew factor*/ + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] + public uint[] pad; /*space for more stuff*/ } [StructLayout(LayoutKind.Sequential, Pack = 1)] struct PDInfoOld { public uint driveid; /*identifies the device type*/ - public uint sanity; /*verifies device sanity*/ + 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*/ + [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*/ + 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*/ } [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*/ + [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 */ + 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 { - public uint v_sanity; /*to verify vtoc sanity*/ + 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*/ + [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 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*/ } enum pTag : ushort @@ -537,12 +550,12 @@ namespace DiscImageChef.Partitions 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 */ } } } \ No newline at end of file diff --git a/DiscImageChef.Partitions/XENIX.cs b/DiscImageChef.Partitions/XENIX.cs index b63578abb..a564ebcd3 100644 --- a/DiscImageChef.Partitions/XENIX.cs +++ b/DiscImageChef.Partitions/XENIX.cs @@ -33,7 +33,6 @@ using System; using System.Collections.Generic; using System.Runtime.InteropServices; -using DiscImageChef.CommonTypes; using DiscImageChef.Console; using DiscImageChef.DiscImages; @@ -42,16 +41,17 @@ namespace DiscImageChef.Partitions // TODO: Find better documentation, this is working for XENIX 2 but not for SCO OpenServer... public class XENIX : IPartition { - const ushort PAMAGIC = 0x1234; - const int MAXPARTS = 16; - const uint XENIX_BSIZE = 1024; + const ushort PAMAGIC = 0x1234; + const int MAXPARTS = 16; + const uint XENIX_BSIZE = 1024; // Can't find this in any documentation but everything is aligned to this offset (in sectors) const uint XENIX_OFFSET = 977; public string Name => "XENIX"; - public Guid Id => new Guid("53BE01DE-E68B-469F-A17F-EC2E4BD61CD9"); + public Guid Id => new Guid("53BE01DE-E68B-469F-A17F-EC2E4BD61CD9"); - public bool GetInformation(IMediaImage imagePlugin, out List partitions, ulong sectorOffset) + public bool GetInformation(IMediaImage imagePlugin, out List partitions, + ulong sectorOffset) { partitions = new List(); @@ -70,7 +70,7 @@ namespace DiscImageChef.Partitions 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_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) continue; @@ -83,10 +83,10 @@ namespace DiscImageChef.Partitions Offset = (ulong)((xnxtbl.p[i].p_off + XENIX_OFFSET) * XENIX_BSIZE) + imagePlugin.Info.SectorSize * sectorOffset, - Size = (ulong)(xnxtbl.p[i].p_size * XENIX_BSIZE), + Size = (ulong)(xnxtbl.p[i].p_size * XENIX_BSIZE), Sequence = (ulong)i, - Type = "XENIX", - Scheme = Name + Type = "XENIX", + Scheme = Name }; if(part.End < imagePlugin.Info.Sectors) partitions.Add(part); @@ -99,13 +99,14 @@ namespace DiscImageChef.Partitions struct Partable { public ushort p_magic; /* magic number validity indicator */ - [MarshalAs(UnmanagedType.ByValArray, SizeConst = MAXPARTS)] public Partition[] p; /*partition headers*/ + [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_off; /*start 1K block no of partition*/ public int p_size; /*# of 1K blocks in partition*/ } } diff --git a/DiscImageChef.Partitions/Xbox.cs b/DiscImageChef.Partitions/Xbox.cs index 5bf842a23..4eb4a4001 100644 --- a/DiscImageChef.Partitions/Xbox.cs +++ b/DiscImageChef.Partitions/Xbox.cs @@ -40,28 +40,28 @@ namespace DiscImageChef.Partitions { public class Xbox : IPartition { - const uint XboxCigam = 0x46415458; - const uint XboxMagic = 0x58544146; - const long MemoryUnitDataOff = 0x7FF000; + const uint XboxCigam = 0x46415458; + const uint XboxMagic = 0x58544146; + const long MemoryUnitDataOff = 0x7FF000; const long Xbox360SecuritySectorOff = 0x2000; - const long Xbox360SystemCacheOff = 0x80000; - const long Xbox360GameCacheOff = 0x8008000; - const long Xbox368SysExtOff = 0x10C080000; - const long Xbox360SysExt2Off = 0x118EB0000; - const long Xbox360CompatOff = 0x120EB0000; - const long Xbox360DataOff = 0x130EB0000; + const long Xbox360SystemCacheOff = 0x80000; + const long Xbox360GameCacheOff = 0x8008000; + const long Xbox368SysExtOff = 0x10C080000; + const long Xbox360SysExt2Off = 0x118EB0000; + const long Xbox360CompatOff = 0x120EB0000; + const long Xbox360DataOff = 0x130EB0000; const long Xbox360SecuritySectorLen = 0x80000; - const long Xbox360SystemCacheLen = 0x80000000; - const long Xbox360GameCacheLen = 0xA0E30000; - const long Xbox368SysExtLen = 0xCE30000; - const long Xbox360SysExt2Len = 0x8000000; - const long Xbox360CompatLen = 0x10000000; + const long Xbox360SystemCacheLen = 0x80000000; + const long Xbox360GameCacheLen = 0xA0E30000; + const long Xbox368SysExtLen = 0xCE30000; + const long Xbox360SysExt2Len = 0x8000000; + const long Xbox360CompatLen = 0x10000000; const uint XBOX360_DEVKIT_MAGIC = 0x00020000; public string Name => "Xbox partitioning"; - public Guid Id => new Guid("E3F6FB91-D358-4F22-A550-81E92D50EB78"); + public Guid Id => new Guid("E3F6FB91-D358-4F22-A550-81E92D50EB78"); public bool GetInformation(IMediaImage imagePlugin, out List partitions, ulong sectorOffset) { @@ -76,29 +76,30 @@ namespace DiscImageChef.Partitions Xbox360DevKitPartitionTable table = BigEndianMarshal.ByteArrayToStructureBigEndian(sector); - if(table.magic == XBOX360_DEVKIT_MAGIC && table.contentOff + table.contentLen <= imagePlugin.Info.Sectors && + if(table.magic == XBOX360_DEVKIT_MAGIC && + table.contentOff + table.contentLen <= imagePlugin.Info.Sectors && table.dashboardOff + table.dashboardLen <= imagePlugin.Info.Sectors) { Partition contentPart = new Partition { Description = "Content volume", - Size = (ulong)table.contentLen * imagePlugin.Info.SectorSize, - Length = table.contentLen, - Sequence = 1, - Offset = (ulong)table.contentOff * imagePlugin.Info.SectorSize, - Start = table.contentOff, - Scheme = Name + Size = (ulong)table.contentLen * imagePlugin.Info.SectorSize, + Length = table.contentLen, + Sequence = 1, + Offset = (ulong)table.contentOff * imagePlugin.Info.SectorSize, + Start = table.contentOff, + Scheme = Name }; Partition dashboardPart = new Partition { Description = "Dashboard volume", - Size = (ulong)table.dashboardLen * imagePlugin.Info.SectorSize, - Length = table.dashboardLen, - Sequence = 2, - Offset = (ulong)table.dashboardOff * imagePlugin.Info.SectorSize, - Start = table.dashboardOff, - Scheme = Name + Size = (ulong)table.dashboardLen * imagePlugin.Info.SectorSize, + Length = table.dashboardLen, + Sequence = 2, + Offset = (ulong)table.dashboardOff * imagePlugin.Info.SectorSize, + Start = table.dashboardOff, + Scheme = Name }; partitions.Add(contentPart); @@ -112,30 +113,30 @@ namespace DiscImageChef.Partitions if(imagePlugin.Info.Sectors > (ulong)(MemoryUnitDataOff / imagePlugin.Info.SectorSize)) { sector = imagePlugin.ReadSector((ulong)(MemoryUnitDataOff / imagePlugin.Info.SectorSize)); - temp = BitConverter.ToUInt32(sector, 0); + temp = BitConverter.ToUInt32(sector, 0); if(temp == XboxCigam) { Partition sysCachePart = new Partition { Description = "System cache", - Size = MemoryUnitDataOff, - Length = (ulong)(MemoryUnitDataOff / imagePlugin.Info.SectorSize), - Sequence = 1, - Offset = 0, - Start = 0, - Scheme = Name + Size = MemoryUnitDataOff, + Length = (ulong)(MemoryUnitDataOff / imagePlugin.Info.SectorSize), + Sequence = 1, + Offset = 0, + Start = 0, + Scheme = Name }; Partition dataPart = new Partition { Description = "Data volume", - Size = imagePlugin.Info.Sectors * imagePlugin.Info.SectorSize - MemoryUnitDataOff, - Length = imagePlugin.Info.Sectors - sysCachePart.Length, - Sequence = 2, - Offset = MemoryUnitDataOff, - Start = sysCachePart.Length, - Scheme = Name + Size = imagePlugin.Info.Sectors * imagePlugin.Info.SectorSize - MemoryUnitDataOff, + Length = imagePlugin.Info.Sectors - sysCachePart.Length, + Sequence = 2, + Offset = MemoryUnitDataOff, + Start = sysCachePart.Length, + Scheme = Name }; partitions.Add(sysCachePart); @@ -149,86 +150,86 @@ namespace DiscImageChef.Partitions { sector = imagePlugin.ReadSector((ulong)(Xbox360DataOff / imagePlugin.Info.SectorSize)); - temp = BitConverter.ToUInt32(sector, 0); + temp = BitConverter.ToUInt32(sector, 0); if(temp != XboxCigam) return false; Partition securityPart = new Partition { Description = "Security sectors", - Size = Xbox360SecuritySectorLen, - Length = (ulong)(Xbox360SecuritySectorLen / imagePlugin.Info.SectorSize), - Sequence = 1, - Offset = Xbox360SecuritySectorOff, - Start = (ulong)(Xbox360SecuritySectorOff / imagePlugin.Info.SectorSize), - Scheme = Name + Size = Xbox360SecuritySectorLen, + Length = (ulong)(Xbox360SecuritySectorLen / imagePlugin.Info.SectorSize), + Sequence = 1, + Offset = Xbox360SecuritySectorOff, + Start = (ulong)(Xbox360SecuritySectorOff / imagePlugin.Info.SectorSize), + Scheme = Name }; Partition sysCachePart = new Partition { Description = "System cache", - Size = Xbox360SystemCacheLen, - Length = (ulong)(Xbox360SystemCacheLen / imagePlugin.Info.SectorSize), - Sequence = 2, - Offset = Xbox360SystemCacheOff, - Start = (ulong)(Xbox360SystemCacheOff / imagePlugin.Info.SectorSize), - Scheme = Name + Size = Xbox360SystemCacheLen, + Length = (ulong)(Xbox360SystemCacheLen / imagePlugin.Info.SectorSize), + Sequence = 2, + Offset = Xbox360SystemCacheOff, + Start = (ulong)(Xbox360SystemCacheOff / imagePlugin.Info.SectorSize), + Scheme = Name }; Partition gameCachePart = new Partition { Description = "Game cache", - Size = Xbox360GameCacheLen, - Length = (ulong)(Xbox360GameCacheLen / imagePlugin.Info.SectorSize), - Sequence = 3, - Offset = Xbox360GameCacheOff, - Start = (ulong)(Xbox360GameCacheOff / imagePlugin.Info.SectorSize), - Scheme = Name + Size = Xbox360GameCacheLen, + Length = (ulong)(Xbox360GameCacheLen / imagePlugin.Info.SectorSize), + Sequence = 3, + Offset = Xbox360GameCacheOff, + Start = (ulong)(Xbox360GameCacheOff / imagePlugin.Info.SectorSize), + Scheme = Name }; Partition sysExtPart = new Partition { Description = "System volume", - Size = Xbox368SysExtLen, - Length = (ulong)(Xbox368SysExtLen / imagePlugin.Info.SectorSize), - Sequence = 4, - Offset = Xbox368SysExtOff, - Start = (ulong)(Xbox368SysExtOff / imagePlugin.Info.SectorSize), - Scheme = Name + Size = Xbox368SysExtLen, + Length = (ulong)(Xbox368SysExtLen / imagePlugin.Info.SectorSize), + Sequence = 4, + Offset = Xbox368SysExtOff, + Start = (ulong)(Xbox368SysExtOff / imagePlugin.Info.SectorSize), + Scheme = Name }; Partition sysExt2Part = new Partition { Description = "System volume 2", - Size = Xbox360SysExt2Len, - Length = (ulong)(Xbox360SysExt2Len / imagePlugin.Info.SectorSize), - Sequence = 5, - Offset = Xbox360SysExt2Off, - Start = (ulong)(Xbox360SysExt2Off / imagePlugin.Info.SectorSize), - Scheme = Name + Size = Xbox360SysExt2Len, + Length = (ulong)(Xbox360SysExt2Len / imagePlugin.Info.SectorSize), + Sequence = 5, + Offset = Xbox360SysExt2Off, + Start = (ulong)(Xbox360SysExt2Off / imagePlugin.Info.SectorSize), + Scheme = Name }; Partition xbox1Part = new Partition { Description = "Xbox backwards compatibility", - Size = Xbox360CompatLen, - Length = (ulong)(Xbox360CompatLen / imagePlugin.Info.SectorSize), - Sequence = 6, - Offset = Xbox360CompatOff, - Start = (ulong)(Xbox360CompatOff / imagePlugin.Info.SectorSize), - Scheme = Name + Size = Xbox360CompatLen, + Length = (ulong)(Xbox360CompatLen / imagePlugin.Info.SectorSize), + Sequence = 6, + Offset = Xbox360CompatOff, + Start = (ulong)(Xbox360CompatOff / imagePlugin.Info.SectorSize), + Scheme = Name }; Partition dataPart = new Partition { Description = "Data volume", - Sequence = 7, - Offset = Xbox360DataOff, - Start = (ulong)(Xbox360DataOff / imagePlugin.Info.SectorSize), - Scheme = Name + Sequence = 7, + Offset = Xbox360DataOff, + Start = (ulong)(Xbox360DataOff / imagePlugin.Info.SectorSize), + Scheme = Name }; dataPart.Length = imagePlugin.Info.Sectors - dataPart.Start; - dataPart.Size = dataPart.Length * imagePlugin.Info.SectorSize; + dataPart.Size = dataPart.Length * imagePlugin.Info.SectorSize; partitions.Add(securityPart); partitions.Add(sysCachePart); diff --git a/DiscImageChef.Server/App_Start/Ata.cs b/DiscImageChef.Server/App_Start/Ata.cs index 588c01f37..caa3d4f1a 100644 --- a/DiscImageChef.Server/App_Start/Ata.cs +++ b/DiscImageChef.Server/App_Start/Ata.cs @@ -50,8 +50,9 @@ namespace DiscImageChef.Server.App_Start /// List to put values on /// List to put key=value pairs on /// List of tested media - public static void Report(ataType ataReport, bool cfa, bool atapi, ref bool removable, - ref List ataOneValue, ref Dictionary ataTwoValue, + public static void Report(ataType ataReport, bool cfa, bool atapi, + ref bool removable, + ref List ataOneValue, ref Dictionary ataTwoValue, ref testedMediaType[] testedMedia) { uint logicalsectorsize = 0; @@ -70,7 +71,7 @@ namespace DiscImageChef.Server.App_Start ata5 = false, ata6 = false, ata7 = false, - acs = false, + acs = false, acs2 = false, acs3 = false, acs4 = false; @@ -105,82 +106,93 @@ namespace DiscImageChef.Server.App_Start ata5 |= ataReport.MajorVersion.HasFlag(MajorVersionBit.AtaAtapi5); ata6 |= ataReport.MajorVersion.HasFlag(MajorVersionBit.AtaAtapi6); ata7 |= ataReport.MajorVersion.HasFlag(MajorVersionBit.AtaAtapi7); - acs |= ataReport.MajorVersion.HasFlag(MajorVersionBit.Ata8ACS); + acs |= ataReport.MajorVersion.HasFlag(MajorVersionBit.Ata8ACS); acs2 |= ataReport.MajorVersion.HasFlag(MajorVersionBit.ACS2); acs3 |= ataReport.MajorVersion.HasFlag(MajorVersionBit.ACS3); acs4 |= ataReport.MajorVersion.HasFlag(MajorVersionBit.ACS4); } } - int maxatalevel = 0; - int minatalevel = 255; - string tmpString = ""; + int maxatalevel = 0; + int minatalevel = 255; + string tmpString = ""; if(ata1) { - tmpString += "ATA-1 "; - maxatalevel = 1; + tmpString += "ATA-1 "; + maxatalevel = 1; if(minatalevel > 1) minatalevel = 1; } + if(ata2) { - tmpString += "ATA-2 "; - maxatalevel = 2; + tmpString += "ATA-2 "; + maxatalevel = 2; if(minatalevel > 2) minatalevel = 2; } + if(ata3) { - tmpString += "ATA-3 "; - maxatalevel = 3; + tmpString += "ATA-3 "; + maxatalevel = 3; if(minatalevel > 3) minatalevel = 3; } + if(ata4) { - tmpString += "ATA/ATAPI-4 "; - maxatalevel = 4; + tmpString += "ATA/ATAPI-4 "; + maxatalevel = 4; if(minatalevel > 4) minatalevel = 4; } + if(ata5) { - tmpString += "ATA/ATAPI-5 "; - maxatalevel = 5; + tmpString += "ATA/ATAPI-5 "; + maxatalevel = 5; if(minatalevel > 5) minatalevel = 5; } + if(ata6) { - tmpString += "ATA/ATAPI-6 "; - maxatalevel = 6; + tmpString += "ATA/ATAPI-6 "; + maxatalevel = 6; if(minatalevel > 6) minatalevel = 6; } + if(ata7) { - tmpString += "ATA/ATAPI-7 "; - maxatalevel = 7; + tmpString += "ATA/ATAPI-7 "; + maxatalevel = 7; if(minatalevel > 7) minatalevel = 7; } + if(acs) { - tmpString += "ATA8-ACS "; - maxatalevel = 8; + tmpString += "ATA8-ACS "; + maxatalevel = 8; if(minatalevel > 8) minatalevel = 8; } + if(acs2) { - tmpString += "ATA8-ACS2 "; - maxatalevel = 9; + tmpString += "ATA8-ACS2 "; + maxatalevel = 9; if(minatalevel > 9) minatalevel = 9; } + if(acs3) { - tmpString += "ATA8-ACS3 "; - maxatalevel = 10; + tmpString += "ATA8-ACS3 "; + maxatalevel = 10; if(minatalevel > 10) minatalevel = 10; } + if(acs4) { - tmpString += "ATA8-ACS4 "; - maxatalevel = 11; + tmpString += "ATA8-ACS4 "; + maxatalevel = 11; if(minatalevel > 11) minatalevel = 11; } + if(tmpString != "") ataTwoValue.Add("Supported ATA versions", tmpString); if(maxatalevel >= 3 && ataReport.MinorVersionSpecified) @@ -437,7 +449,7 @@ namespace DiscImageChef.Server.App_Start break; default: ataOneValue - .Add($"ATAPI Unknown device type field value 0x{((ushort)ataReport.GeneralConfiguration & 0x1F00) >> 8:X2}"); + .Add($"ATAPI Unknown device type field value 0x{((ushort)ataReport.GeneralConfiguration & 0x1F00) >> 8:X2}"); break; } @@ -455,7 +467,7 @@ namespace DiscImageChef.Server.App_Start break; default: ataOneValue - .Add($"Unknown ATAPI DRQ behaviour code {((ushort)ataReport.GeneralConfiguration & 0x60) >> 5}"); + .Add($"Unknown ATAPI DRQ behaviour code {((ushort)ataReport.GeneralConfiguration & 0x60) >> 5}"); break; } @@ -470,7 +482,7 @@ namespace DiscImageChef.Server.App_Start break; default: ataOneValue - .Add($"Unknown ATAPI packet size code {(ushort)ataReport.GeneralConfiguration & 0x03}"); + .Add($"Unknown ATAPI packet size code {(ushort)ataReport.GeneralConfiguration & 0x03}"); break; } } @@ -519,51 +531,52 @@ namespace DiscImageChef.Server.App_Start } if(ataReport.SpecificConfigurationSpecified && (ushort)ataReport.SpecificConfiguration != 0x0000 && - (ushort)ataReport.SpecificConfiguration != 0xFFFF) + (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."); + .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."); + .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."); + .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."); + .Add("Device does not require SET FEATURES to spin up and IDENTIFY DEVICE response is complete."); break; default: ataOneValue - .Add($"Unknown device specific configuration 0x{(ushort)ataReport.SpecificConfiguration:X4}"); + .Add($"Unknown device specific configuration 0x{(ushort)ataReport.SpecificConfiguration:X4}"); 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) + ataReport.BufferSize != 0xFFFF && + ataReport.BufferType != 0x0000 && ataReport.BufferType != 0xFFFF) switch(ataReport.BufferType) { case 1: ataOneValue - .Add($"{ataReport.BufferSize * logicalsectorsize / 1024} KiB of single ported single sector buffer"); + .Add($"{ataReport.BufferSize * logicalsectorsize / 1024} KiB of single ported single sector buffer"); break; case 2: ataOneValue - .Add($"{ataReport.BufferSize * logicalsectorsize / 1024} KiB of dual ported multi sector buffer"); + .Add($"{ataReport.BufferSize * logicalsectorsize / 1024} KiB of dual ported multi sector buffer"); break; case 3: ataOneValue - .Add($"{ataReport.BufferSize * logicalsectorsize / 1024} KiB of dual ported multi sector buffer with read caching"); + .Add($"{ataReport.BufferSize * logicalsectorsize / 1024} KiB of dual ported multi sector buffer with read caching"); break; default: ataOneValue - .Add($"{ataReport.BufferSize * logicalsectorsize / 1024} KiB of unknown type {ataReport.BufferType} buffer"); + .Add($"{ataReport.BufferSize * logicalsectorsize / 1024} KiB of unknown type {ataReport.BufferType} buffer"); break; } @@ -603,7 +616,7 @@ namespace DiscImageChef.Server.App_Start if(ataReport.Capabilities3.HasFlag(CapabilitiesBit3.MultipleValid)) { ataOneValue - .Add($"A maximum of {ataReport.MultipleSectorNumber} sectors can be transferred per interrupt on READ/WRITE MULTIPLE"); + .Add($"A maximum of {ataReport.MultipleSectorNumber} sectors can be transferred per interrupt on READ/WRITE MULTIPLE"); ataOneValue.Add($"Device supports setting a maximum of {ataReport.MultipleMaxSectors} sectors"); } @@ -644,48 +657,56 @@ namespace DiscImageChef.Server.App_Start if(ataReport.DMAActive.HasFlag(TransferMode.Mode0) && ataReport.DMAActiveSpecified) tmpString += "(active) "; } + if(ataReport.DMASupported.HasFlag(TransferMode.Mode1)) { tmpString += "DMA1 "; if(ataReport.DMAActive.HasFlag(TransferMode.Mode1) && ataReport.DMAActiveSpecified) tmpString += "(active) "; } + if(ataReport.DMASupported.HasFlag(TransferMode.Mode2)) { tmpString += "DMA2 "; if(ataReport.DMAActive.HasFlag(TransferMode.Mode2) && ataReport.DMAActiveSpecified) tmpString += "(active) "; } + if(ataReport.DMASupported.HasFlag(TransferMode.Mode3)) { tmpString += "DMA3 "; if(ataReport.DMAActive.HasFlag(TransferMode.Mode3) && ataReport.DMAActiveSpecified) tmpString += "(active) "; } + if(ataReport.DMASupported.HasFlag(TransferMode.Mode4)) { tmpString += "DMA4 "; if(ataReport.DMAActive.HasFlag(TransferMode.Mode4) && ataReport.DMAActiveSpecified) tmpString += "(active) "; } + if(ataReport.DMASupported.HasFlag(TransferMode.Mode5)) { tmpString += "DMA5 "; if(ataReport.DMAActive.HasFlag(TransferMode.Mode5) && ataReport.DMAActiveSpecified) tmpString += "(active) "; } + if(ataReport.DMASupported.HasFlag(TransferMode.Mode6)) { tmpString += "DMA6 "; if(ataReport.DMAActive.HasFlag(TransferMode.Mode6) && ataReport.DMAActiveSpecified) tmpString += "(active) "; } + if(ataReport.DMASupported.HasFlag(TransferMode.Mode7)) { tmpString += "DMA7 "; if(ataReport.DMAActive.HasFlag(TransferMode.Mode7) && ataReport.DMAActiveSpecified) tmpString += "(active) "; } + ataTwoValue.Add("Single-word DMA", tmpString); } @@ -698,48 +719,56 @@ namespace DiscImageChef.Server.App_Start if(ataReport.MDMAActive.HasFlag(TransferMode.Mode0) && ataReport.MDMAActiveSpecified) tmpString += "(active) "; } + if(ataReport.MDMASupported.HasFlag(TransferMode.Mode1)) { tmpString += "MDMA1 "; if(ataReport.MDMAActive.HasFlag(TransferMode.Mode1) && ataReport.MDMAActiveSpecified) tmpString += "(active) "; } + if(ataReport.MDMASupported.HasFlag(TransferMode.Mode2)) { tmpString += "MDMA2 "; if(ataReport.MDMAActive.HasFlag(TransferMode.Mode2) && ataReport.MDMAActiveSpecified) tmpString += "(active) "; } + if(ataReport.MDMASupported.HasFlag(TransferMode.Mode3)) { tmpString += "MDMA3 "; if(ataReport.MDMAActive.HasFlag(TransferMode.Mode3) && ataReport.MDMAActiveSpecified) tmpString += "(active) "; } + if(ataReport.MDMASupported.HasFlag(TransferMode.Mode4)) { tmpString += "MDMA4 "; if(ataReport.MDMAActive.HasFlag(TransferMode.Mode4) && ataReport.MDMAActiveSpecified) tmpString += "(active) "; } + if(ataReport.MDMASupported.HasFlag(TransferMode.Mode5)) { tmpString += "MDMA5 "; if(ataReport.MDMAActive.HasFlag(TransferMode.Mode5) && ataReport.MDMAActiveSpecified) tmpString += "(active) "; } + if(ataReport.MDMASupported.HasFlag(TransferMode.Mode6)) { tmpString += "MDMA6 "; if(ataReport.MDMAActive.HasFlag(TransferMode.Mode6) && ataReport.MDMAActiveSpecified) tmpString += "(active) "; } + if(ataReport.MDMASupported.HasFlag(TransferMode.Mode7)) { tmpString += "MDMA7 "; if(ataReport.MDMAActive.HasFlag(TransferMode.Mode7) && ataReport.MDMAActiveSpecified) tmpString += "(active) "; } + ataTwoValue.Add("Multi-word DMA", tmpString); } @@ -752,48 +781,56 @@ namespace DiscImageChef.Server.App_Start if(ataReport.UDMAActive.HasFlag(TransferMode.Mode0) && ataReport.UDMAActiveSpecified) tmpString += "(active) "; } + if(ataReport.UDMASupported.HasFlag(TransferMode.Mode1)) { tmpString += "UDMA1 "; if(ataReport.UDMAActive.HasFlag(TransferMode.Mode1) && ataReport.UDMAActiveSpecified) tmpString += "(active) "; } + if(ataReport.UDMASupported.HasFlag(TransferMode.Mode2)) { tmpString += "UDMA2 "; if(ataReport.UDMAActive.HasFlag(TransferMode.Mode2) && ataReport.UDMAActiveSpecified) tmpString += "(active) "; } + if(ataReport.UDMASupported.HasFlag(TransferMode.Mode3)) { tmpString += "UDMA3 "; if(ataReport.UDMAActive.HasFlag(TransferMode.Mode3) && ataReport.UDMAActiveSpecified) tmpString += "(active) "; } + if(ataReport.UDMASupported.HasFlag(TransferMode.Mode4)) { tmpString += "UDMA4 "; if(ataReport.UDMAActive.HasFlag(TransferMode.Mode4) && ataReport.UDMAActiveSpecified) tmpString += "(active) "; } + if(ataReport.UDMASupported.HasFlag(TransferMode.Mode5)) { tmpString += "UDMA5 "; if(ataReport.UDMAActive.HasFlag(TransferMode.Mode5) && ataReport.UDMAActiveSpecified) tmpString += "(active) "; } + if(ataReport.UDMASupported.HasFlag(TransferMode.Mode6)) { tmpString += "UDMA6 "; if(ataReport.UDMAActive.HasFlag(TransferMode.Mode6) && ataReport.UDMAActiveSpecified) tmpString += "(active) "; } + if(ataReport.UDMASupported.HasFlag(TransferMode.Mode7)) { tmpString += "UDMA7 "; if(ataReport.UDMAActive.HasFlag(TransferMode.Mode7) && ataReport.UDMAActiveSpecified) tmpString += "(active) "; } + ataTwoValue.Add("Ultra DMA", tmpString); } @@ -815,7 +852,7 @@ namespace DiscImageChef.Server.App_Start ataOneValue.Add($"{ataReport.PacketBusRelease} ns. typical to release bus from receipt of PACKET"); if(ataReport.ServiceBusyClear != 0) ataOneValue - .Add($"{ataReport.ServiceBusyClear} ns. typical to clear BSY bit from receipt of SERVICE"); + .Add($"{ataReport.ServiceBusyClear} ns. typical to clear BSY bit from receipt of SERVICE"); } if(ataReport.TransportMajorVersionSpecified && ((ataReport.TransportMajorVersion & 0xF000) >> 12 == 0x1 || @@ -851,7 +888,7 @@ namespace DiscImageChef.Server.App_Start if(ataReport.SATACapabilities2Specified && !ataReport.SATACapabilities2.HasFlag(SATACapabilitiesBit2.Clear)) { - if(ataReport.SATACapabilitiesSpecified && + if(ataReport.SATACapabilitiesSpecified && !ataReport.SATACapabilities.HasFlag(SATACapabilitiesBit.Clear) && ataReport.SATACapabilities.HasFlag(SATACapabilitiesBit.NCQ)) { @@ -913,7 +950,7 @@ namespace DiscImageChef.Server.App_Start ataOneValue.Add($"CompactFlash device uses a maximum of {ataReport.CFAPowerMode & 0x0FFF} mA"); } - if(ataReport.CommandSetSpecified || ataReport.CommandSet2Specified || ataReport.CommandSet3Specified || + if(ataReport.CommandSetSpecified || ataReport.CommandSet2Specified || ataReport.CommandSet3Specified || ataReport.CommandSet4Specified || ataReport.CommandSet5Specified) ataOneValue.Add("Command set and features:"); if(ataReport.CommandSetSpecified) @@ -921,59 +958,79 @@ namespace DiscImageChef.Server.App_Start 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"); + 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"); + 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"); + 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) 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"); + 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) 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"); + 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) 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) 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"); + 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"); } @@ -983,76 +1040,93 @@ namespace DiscImageChef.Server.App_Start { 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"); + 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"); + 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) 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($"Automatic Acoustic Management is supported and enabled with value {ataReport.CurrentAAM} (vendor recommends {ataReport.RecommendedAAM}"); - else ataOneValue.Add("Automatic Acoustic Management is supported"); + .Add($"Automatic Acoustic Management is supported and enabled with value {ataReport.CurrentAAM} (vendor recommends {ataReport.RecommendedAAM}"); + else + ataOneValue.Add("Automatic Acoustic Management is supported"); if(ataReport.CommandSet2.HasFlag(CommandSetBit2.SetMax)) 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) 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)) ataOneValue.Add("SET FEATURES is required before spin-up"); if(ataReport.CommandSet2.HasFlag(CommandSetBit2.PowerUpInStandby)) 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) 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 - ) + if(ataReport.EnabledCommandSet2.HasFlag(CommandSetBit2.APM) && + ataReport.EnabledCommandSet2Specified) ataOneValue - .Add($"Advanced Power Management is supported and enabled with value {ataReport.CurrentAPM}"); - else ataOneValue.Add("Advanced Power Management is supported"); + .Add($"Advanced Power Management is supported and enabled with value {ataReport.CurrentAPM}"); + else + ataOneValue.Add("Advanced Power Management is supported"); if(ataReport.CommandSet2.HasFlag(CommandSetBit2.CompactFlash)) 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) 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) ataOneValue.Add("DOWNLOAD MICROCODE is supported and enabled"); - else ataOneValue.Add("DOWNLOAD MICROCODE is supported"); + else + ataOneValue.Add("DOWNLOAD MICROCODE is supported"); } if(ataReport.CommandSet.HasFlag(CommandSetBit.SMART) && ataReport.CommandSetSpecified) 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"); @@ -1064,17 +1138,20 @@ namespace DiscImageChef.Server.App_Start 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) 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) 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)) ataOneValue.Add("URG bit is supported in WRITE STREAM DMA EXT and WRITE STREAM EXT"); if(ataReport.CommandSet3.HasFlag(CommandSetBit3.ReadURG)) @@ -1084,21 +1161,26 @@ namespace DiscImageChef.Server.App_Start 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) 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) 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) ataOneValue.Add(ataReport.EnabledCommandSet3.HasFlag(CommandSetBit3.MCPT) ? "Media Card Pass Through command set is supported and enabled" @@ -1113,44 +1195,53 @@ namespace DiscImageChef.Server.App_Start !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) 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) 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) 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) 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) 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) 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) 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 @@ -1161,10 +1252,13 @@ namespace DiscImageChef.Server.App_Start if(ataReport.EnabledCommandSet4.HasFlag(CommandSetBit4.WRV) && ataReport.EnabledCommandSet4Specified ) ataOneValue.Add($"Current Write/Read/Verify mode: {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"); + ataReport.EnabledCommandSet4Specified) + ataOneValue.Add("DT1825 is supported and enabled"); + else + ataOneValue.Add("DT1825 is supported"); } if(ataReport.Capabilities3Specified) @@ -1202,6 +1296,7 @@ namespace DiscImageChef.Server.App_Start if(ataReport.CommandSet5.HasFlag(CommandSetBit5.ReadZeroTrim)) ataOneValue.Add("Read after TRIM returns empty data"); } + if(ataReport.CommandSet5.HasFlag(CommandSetBit5.LongPhysSectorAligError)) ataOneValue.Add("Device supports Long Physical Sector Alignment Error Reporting Control"); if(ataReport.CommandSet5.HasFlag(CommandSetBit5.Encrypted)) @@ -1225,7 +1320,7 @@ namespace DiscImageChef.Server.App_Start } if(!ata1 && maxatalevel >= 8 && ataReport.TrustedComputingSpecified) - if(ataReport.TrustedComputing.HasFlag(TrustedComputingBit.Set) && + if(ataReport.TrustedComputing.HasFlag(TrustedComputingBit.Set) && !ataReport.TrustedComputing.HasFlag(TrustedComputingBit.Clear) && ataReport.TrustedComputing.HasFlag(TrustedComputingBit.TrustedComputing)) ataOneValue.Add("Trusted Computing feature set is supported"); @@ -1250,46 +1345,54 @@ namespace DiscImageChef.Server.App_Start 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) 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) 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) 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) 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.EnabledSATAFeatures.HasFlag(SATAFeaturesBit.AsyncNotification) && ataReport.EnabledSATAFeaturesSpecified) ataOneValue.Add("Asynchronous notification is supported"); - else 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 ataOneValue.Add("Software Settings Preservation is supported"); + else + ataOneValue.Add("Software Settings Preservation is supported"); if(ataReport.SATAFeatures.HasFlag(SATAFeaturesBit.NCQAutoSense)) ataOneValue.Add("NCQ Autosense is supported"); if(ataReport.EnabledSATAFeatures.HasFlag(SATAFeaturesBit.EnabledSlumber)) ataOneValue.Add("Automatic Partial to Slumber transitions are enabled"); } } + if((ataReport.RemovableStatusSet & 0x03) > 0) ataOneValue.Add("Removable Media Status Notification feature set is supported"); @@ -1331,12 +1434,13 @@ namespace DiscImageChef.Server.App_Start ataOneValue.Add($"{ataReport.SecurityEraseTime * 2} minutes to complete secure erase"); if(ataReport.SecurityStatus.HasFlag(SecurityStatusBit.Enhanced)) ataOneValue - .Add($"{ataReport.EnhancedSecurityEraseTime * 2} minutes to complete enhanced secure erase"); + .Add($"{ataReport.EnhancedSecurityEraseTime * 2} minutes to complete enhanced secure erase"); ataOneValue.Add($"Master password revision code: {ataReport.MasterPasswordRevisionCode}"); } - if(ataReport.CommandSet3Specified && ataReport.CommandSet3.HasFlag(CommandSetBit3.MustBeSet) && + if(ataReport.CommandSet3Specified && + ataReport.CommandSet3.HasFlag(CommandSetBit3.MustBeSet) && !ataReport.CommandSet3.HasFlag(CommandSetBit3.MustBeClear) && ataReport.CommandSet3.HasFlag(CommandSetBit3.Streaming)) { @@ -1376,6 +1480,7 @@ namespace DiscImageChef.Server.App_Start ataOneValue.Add($"Version {(ataReport.NVCacheCaps & 0x0F00) >> 8}"); } + ataOneValue.Add($"Non-Volatile Cache is {ataReport.NVCacheSize * logicalsectorsize} bytes"); } @@ -1384,7 +1489,7 @@ namespace DiscImageChef.Server.App_Start removable = false; ataOneValue.Add(""); - if(ataReport.ReadCapabilities.NominalRotationRateSpecified && + if(ataReport.ReadCapabilities.NominalRotationRateSpecified && ataReport.ReadCapabilities.NominalRotationRate != 0x0000 && ataReport.ReadCapabilities.NominalRotationRate != 0xFFFF) ataOneValue.Add(ataReport.ReadCapabilities.NominalRotationRate == 0x0001 @@ -1398,24 +1503,29 @@ namespace DiscImageChef.Server.App_Start ataTwoValue.Add("Logical sector size", $"{ataReport.ReadCapabilities.BlockSize} bytes"); logicalsectorsize = ataReport.ReadCapabilities.BlockSize; } + if(ataReport.ReadCapabilities.PhysicalBlockSizeSpecified) ataTwoValue.Add("Physical sector size", $"{ataReport.ReadCapabilities.PhysicalBlockSize} bytes"); if(ataReport.ReadCapabilities.LongBlockSizeSpecified) ataTwoValue.Add("READ LONG sector size", $"{ataReport.ReadCapabilities.LongBlockSize} bytes"); - if(ataReport.ReadCapabilities.BlockSizeSpecified && - ataReport.ReadCapabilities.PhysicalBlockSizeSpecified && - ataReport.ReadCapabilities.BlockSize != ataReport.ReadCapabilities.PhysicalBlockSize && - (ataReport.ReadCapabilities.LogicalAlignment & 0x8000) == 0x0000 && + if(ataReport.ReadCapabilities + .BlockSizeSpecified && + ataReport.ReadCapabilities + .PhysicalBlockSizeSpecified && + ataReport.ReadCapabilities.BlockSize != + ataReport.ReadCapabilities.PhysicalBlockSize && + (ataReport.ReadCapabilities.LogicalAlignment & 0x8000) == + 0x0000 && (ataReport.ReadCapabilities.LogicalAlignment & 0x4000) == 0x4000) ataOneValue - .Add($"Logical sector starts at offset {ataReport.ReadCapabilities.LogicalAlignment & 0x3FFF} from physical sector"); + .Add($"Logical sector starts at offset {ataReport.ReadCapabilities.LogicalAlignment & 0x3FFF} from physical sector"); if(ataReport.ReadCapabilities.CHS != null && ataReport.ReadCapabilities.CurrentCHS != null) { int currentSectors = ataReport.ReadCapabilities.CurrentCHS.Cylinders * - ataReport.ReadCapabilities.CurrentCHS.Heads * + ataReport.ReadCapabilities.CurrentCHS.Heads * ataReport.ReadCapabilities.CurrentCHS.Sectors; ataTwoValue.Add("Cylinders", $"{ataReport.ReadCapabilities.CHS.Cylinders} max., {ataReport.ReadCapabilities.CurrentCHS.Cylinders} current"); @@ -1431,11 +1541,12 @@ namespace DiscImageChef.Server.App_Start else if(ataReport.ReadCapabilities.CHS != null) { int currentSectors = ataReport.ReadCapabilities.CHS.Cylinders * - ataReport.ReadCapabilities.CHS.Heads * + ataReport.ReadCapabilities.CHS.Heads * ataReport.ReadCapabilities.CHS.Sectors; - ataTwoValue.Add("Cylinders", $"{ataReport.ReadCapabilities.CHS.Cylinders}"); - ataTwoValue.Add("Heads", $"{ataReport.ReadCapabilities.CHS.Heads}"); - ataTwoValue.Add("Sectors per track", $"{ataReport.ReadCapabilities.CHS.Sectors}"); + ataTwoValue.Add("Cylinders", + $"{ataReport.ReadCapabilities.CHS.Cylinders}"); + ataTwoValue.Add("Heads", $"{ataReport.ReadCapabilities.CHS.Heads}"); + ataTwoValue.Add("Sectors per track", $"{ataReport.ReadCapabilities.CHS.Sectors}"); ataTwoValue.Add("Sectors addressable in CHS mode", $"{currentSectors}"); ataTwoValue.Add("Device size in CHS mode", $"{(ulong)currentSectors * logicalsectorsize} bytes, {(ulong)currentSectors * logicalsectorsize / 1000 / 1000} Mb, {(double)((ulong)currentSectors * logicalsectorsize) / 1024 / 1024:F2} MiB"); diff --git a/DiscImageChef.Server/App_Start/ScsiEvpd.cs b/DiscImageChef.Server/App_Start/ScsiEvpd.cs index f9468828c..8654a7b79 100644 --- a/DiscImageChef.Server/App_Start/ScsiEvpd.cs +++ b/DiscImageChef.Server/App_Start/ScsiEvpd.cs @@ -51,23 +51,27 @@ namespace DiscImageChef.Server.App_Start { string decoded; if(evpd.page >= 0x01 && evpd.page <= 0x7F) decoded = EVPD.DecodeASCIIPage(evpd.value); - else if(evpd.page == 0x81) decoded = EVPD.PrettifyPage_81(evpd.value); - else if(evpd.page == 0x82) decoded = EVPD.DecodePage82(evpd.value); - else if(evpd.page == 0x83) decoded = EVPD.PrettifyPage_83(evpd.value); - else if(evpd.page == 0x84) decoded = EVPD.PrettifyPage_84(evpd.value); - else if(evpd.page == 0x85) decoded = EVPD.PrettifyPage_85(evpd.value); - else if(evpd.page == 0x86) decoded = EVPD.PrettifyPage_86(evpd.value); - else if(evpd.page == 0x89) decoded = EVPD.PrettifyPage_89(evpd.value); - else if(evpd.page == 0xB0) decoded = EVPD.PrettifyPage_B0(evpd.value); + else if(evpd.page == 0x81) decoded = EVPD.PrettifyPage_81(evpd.value); + else if(evpd.page == 0x82) decoded = EVPD.DecodePage82(evpd.value); + else if(evpd.page == 0x83) decoded = EVPD.PrettifyPage_83(evpd.value); + else if(evpd.page == 0x84) decoded = EVPD.PrettifyPage_84(evpd.value); + else if(evpd.page == 0x85) decoded = EVPD.PrettifyPage_85(evpd.value); + else if(evpd.page == 0x86) decoded = EVPD.PrettifyPage_86(evpd.value); + else if(evpd.page == 0x89) decoded = EVPD.PrettifyPage_89(evpd.value); + else if(evpd.page == 0xB0) decoded = EVPD.PrettifyPage_B0(evpd.value); else if(evpd.page == 0xB2) - decoded = $"TapeAlert Supported Flags Bitmap: 0x{EVPD.DecodePageB2(evpd.value):X16}
"; + decoded = + $"TapeAlert Supported Flags Bitmap: 0x{EVPD.DecodePageB2(evpd.value):X16}
"; else if(evpd.page == 0xB4) decoded = EVPD.DecodePageB4(evpd.value); else if(evpd.page == 0xC0 && vendor.Trim() == "quantum") decoded = EVPD.PrettifyPage_C0_Quantum(evpd.value); else if(evpd.page == 0xC0 && vendor.Trim() == "seagate") - decoded = EVPD.PrettifyPage_C0_Seagate(evpd.value); - else if(evpd.page == 0xC0 && vendor.Trim() == "ibm") decoded = EVPD.PrettifyPage_C0_IBM(evpd.value); - else if(evpd.page == 0xC1 && vendor.Trim() == "ibm") decoded = EVPD.PrettifyPage_C1_IBM(evpd.value); + decoded = + EVPD.PrettifyPage_C0_Seagate(evpd.value); + else if(evpd.page == 0xC0 && vendor.Trim() == "ibm") + decoded = EVPD.PrettifyPage_C0_IBM(evpd.value); + else if(evpd.page == 0xC1 && vendor.Trim() == "ibm") + decoded = EVPD.PrettifyPage_C1_IBM(evpd.value); else if((evpd.page == 0xC0 || evpd.page == 0xC1) && vendor.Trim() == "certance") decoded = EVPD.PrettifyPage_C0_C1_Certance(evpd.value); else if((evpd.page == 0xC2 || evpd.page == 0xC3 || evpd.page == 0xC4 || evpd.page == 0xC5 || @@ -77,7 +81,7 @@ namespace DiscImageChef.Server.App_Start evpd.page == 0xC4 || evpd.page == 0xC5) && vendor.Trim() == "hp") decoded = EVPD.PrettifyPage_C0_to_C5_HP(evpd.value); else if(evpd.page == 0xDF && vendor.Trim() == "certance") - decoded = EVPD.PrettifyPage_DF_Certance(evpd.value); + decoded = EVPD.PrettifyPage_DF_Certance(evpd.value); else decoded = "Undecoded"; if(!string.IsNullOrEmpty(decoded)) decoded = decoded.Replace("\n", "
"); diff --git a/DiscImageChef.Server/App_Start/ScsiInquiry.cs b/DiscImageChef.Server/App_Start/ScsiInquiry.cs index 3fe0b4daa..3ab4d2a71 100644 --- a/DiscImageChef.Server/App_Start/ScsiInquiry.cs +++ b/DiscImageChef.Server/App_Start/ScsiInquiry.cs @@ -168,7 +168,7 @@ namespace DiscImageChef.Server.App_Start break; default: scsiOneValue - .Add($"Device claims to comply with unknown SCSI ANSI standard value 0x{inquiry.ANSIVersion:X2})"); + .Add($"Device claims to comply with unknown SCSI ANSI standard value 0x{inquiry.ANSIVersion:X2})"); break; } @@ -182,7 +182,7 @@ namespace DiscImageChef.Server.App_Start break; default: scsiOneValue - .Add($"Device claims to comply with unknown SCSI ECMA standard value 0x{inquiry.ECMAVersion:X2})"); + .Add($"Device claims to comply with unknown SCSI ECMA standard value 0x{inquiry.ECMAVersion:X2})"); break; } @@ -196,7 +196,7 @@ namespace DiscImageChef.Server.App_Start break; default: scsiOneValue - .Add($"Device claims to comply with unknown SCSI ISO/IEC standard value 0x{inquiry.ISOVersion:X2})"); + .Add($"Device claims to comply with unknown SCSI ISO/IEC standard value 0x{inquiry.ISOVersion:X2})"); break; } @@ -401,11 +401,11 @@ namespace DiscImageChef.Server.App_Start break; case 0x01DD: scsiOneValue - .Add("Device complies with SES T10/1212 revision 08b w/ Amendment ANSI INCITS.305/AM1-2000"); + .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"); + .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)"); @@ -742,7 +742,7 @@ namespace DiscImageChef.Server.App_Start break; case 0x04E7: scsiOneValue - .Add("Device complies with MMC-6 ANSI INCITS 468-2010 + MMC-6/AM1 ANSI INCITS 468-2010/AM 1"); + .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)"); @@ -1031,7 +1031,7 @@ namespace DiscImageChef.Server.App_Start break; case 0x0ABC: scsiOneValue - .Add("Device complies with SPI ANSI INCITS 253-1995 with SPI Amnd ANSI INCITS 253/AM1-1998"); + .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)"); @@ -1173,7 +1173,7 @@ namespace DiscImageChef.Server.App_Start break; case 0x0C4F: scsiOneValue - .Add("Device complies with SAS-2.1 ANSI INCITS 478-2011 w/ Amnd 1 ANSI INCITS 478/AM1-2014"); + .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"); @@ -1201,7 +1201,7 @@ namespace DiscImageChef.Server.App_Start break; case 0x0D3C: scsiOneValue - .Add("Device complies with FC-PH ANSI INCITS 230-1994 with Amnd 1 ANSI INCITS 230/AM1-1996"); + .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)"); @@ -1274,7 +1274,7 @@ namespace DiscImageChef.Server.App_Start break; case 0x0E03: scsiOneValue - .Add("Device complies with FC-FS-2 ANSI INCITS 242-2007 with AM1 ANSI INCITS 242/AM1-2007"); + .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)"); @@ -1332,7 +1332,7 @@ namespace DiscImageChef.Server.App_Start break; case 0x0EA6: scsiOneValue - .Add("Device complies with FC 10GFC ANSI INCITS 364-2003 with AM1 ANSI INCITS 364/AM1-2007"); + .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)"); @@ -1513,22 +1513,22 @@ namespace DiscImageChef.Server.App_Start break; case 0x1621: scsiOneValue - .Add("Device complies with ATA/ATAPI-8 ATA8-APT Parallel Transport (no version claimed)"); + .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)"); + .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)"); + .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"); + .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"); @@ -1538,7 +1538,7 @@ namespace DiscImageChef.Server.App_Start break; case 0x1730: scsiOneValue - .Add("Device complies with USB Mass Storage Class Bulk-Only Transport, Revision 1.0"); + .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)"); diff --git a/DiscImageChef.Server/App_Start/ScsiMmcFeatures.cs b/DiscImageChef.Server/App_Start/ScsiMmcFeatures.cs index ce9d28666..0aa35c78c 100644 --- a/DiscImageChef.Server/App_Start/ScsiMmcFeatures.cs +++ b/DiscImageChef.Server/App_Start/ScsiMmcFeatures.cs @@ -56,6 +56,7 @@ namespace DiscImageChef.Server.App_Start if(ftr.BindingNonceBlocksSpecified) mmcOneValue.Add($"{ftr.BindingNonceBlocks} media blocks are required for the binding nonce"); } + if(ftr.BlocksPerReadableUnit > 1) mmcOneValue.Add($"{ftr.BlocksPerReadableUnit} logical blocks per media writable unit"); if(ftr.BufferUnderrunFreeInDVD) mmcOneValue.Add("Drive supports zero loss linking writing DVDs"); @@ -176,9 +177,10 @@ namespace DiscImageChef.Server.App_Start 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:"); + 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) + 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"); @@ -211,6 +213,7 @@ namespace DiscImageChef.Server.App_Start if(ftr.CanWritePackedSubchannelInTAO) mmcOneValue.Add("Drive accepts Packed R-W subchannel data in Track at Once Mode"); } + if(ftr.CanWriteRWSubchannelInSAO) mmcOneValue.Add("Drive can write user provided data in the R-W subchannels in Session at Once Mode"); if(ftr.CanWriteRaw && ftr.CanWriteRawMultiSession) @@ -225,6 +228,7 @@ namespace DiscImageChef.Server.App_Start mmcOneValue.Add($"Drive has {ftr.ChangerSlots + 1} slots"); } + if(ftr.SupportsCSS && ftr.CSSVersionSpecified) mmcOneValue.Add($"Drive supports DVD CSS/CPPM version {ftr.CSSVersion}"); else if(ftr.SupportsCSS) mmcOneValue.Add("Drive supports DVD CSS/CPRM"); diff --git a/DiscImageChef.Server/App_Start/ScsiMmcMode.cs b/DiscImageChef.Server/App_Start/ScsiMmcMode.cs index e3608b181..1b21d2c89 100644 --- a/DiscImageChef.Server/App_Start/ScsiMmcMode.cs +++ b/DiscImageChef.Server/App_Start/ScsiMmcMode.cs @@ -95,6 +95,7 @@ namespace DiscImageChef.Server.App_Start mmcOneValue.Add(mode.LockStatus ? "Drive is locked, media cannot be ejected, but if empty, can be inserted" : "Drive is not locked, media can be ejected and inserted"); + if(mode.CanEject) mmcOneValue.Add("Drive can eject media"); if(mode.SeparateChannelMute) mmcOneValue.Add("Each channel can be muted independently"); @@ -134,10 +135,10 @@ namespace DiscImageChef.Server.App_Start { if(mode.RotationControlSelected == 0) mmcOneValue - .Add($"Drive's current writing speed is {mode.CurrentWriteSpeedSelected} Kbyte/sec. in CLV mode"); + .Add($"Drive's current writing speed is {mode.CurrentWriteSpeedSelected} Kbyte/sec. in CLV mode"); else if(mode.RotationControlSelected == 1) mmcOneValue - .Add($"Drive's current writing speed is {mode.CurrentWriteSpeedSelected} Kbyte/sec. in pure CAV mode"); + .Add($"Drive's current writing speed is {mode.CurrentWriteSpeedSelected} Kbyte/sec. in pure CAV mode"); } else { @@ -154,7 +155,7 @@ namespace DiscImageChef.Server.App_Start mmcOneValue.Add($"Drive supports writing at {descriptor.WriteSpeed} Kbyte/sec. in CLV mode"); else if(descriptor.RotationControl == 1) mmcOneValue - .Add($"Drive supports writing at is {descriptor.WriteSpeed} Kbyte/sec. in pure CAV mode"); + .Add($"Drive supports writing at is {descriptor.WriteSpeed} Kbyte/sec. in pure CAV mode"); if(mode.TestWrite) mmcOneValue.Add("Drive supports test writing"); diff --git a/DiscImageChef.Server/App_Start/ScsiModeSense.cs b/DiscImageChef.Server/App_Start/ScsiModeSense.cs index 734cbac28..030fe9b82 100644 --- a/DiscImageChef.Server/App_Start/ScsiModeSense.cs +++ b/DiscImageChef.Server/App_Start/ScsiModeSense.cs @@ -47,8 +47,9 @@ namespace DiscImageChef.Server.App_Start /// SCSI peripheral device type /// List to put values on /// List to put key=value pairs on - public static void Report(modeType modeSense, string vendor, PeripheralDeviceTypes deviceType, - ref List scsiOneValue, ref Dictionary modePages) + public static void Report(modeType modeSense, string vendor, + PeripheralDeviceTypes deviceType, + ref List scsiOneValue, ref Dictionary modePages) { if(modeSense.MediumTypeSpecified) scsiOneValue.Add($"Medium type is {modeSense.MediumType:X2}h"); if(modeSense.WriteProtected) scsiOneValue.Add("Device is write protected."); @@ -56,8 +57,9 @@ namespace DiscImageChef.Server.App_Start foreach(blockDescriptorType descriptor in modeSense.BlockDescriptors) if(descriptor.BlocksSpecified && descriptor.BlockLengthSpecified) scsiOneValue - .Add($"Density code {descriptor.Density:X2}h has {descriptor.Blocks} blocks of {descriptor.BlockLength} bytes each"); - else scsiOneValue.Add($"Density code {descriptor.Density:X2}h"); + .Add($"Density code {descriptor.Density:X2}h has {descriptor.Blocks} blocks of {descriptor.BlockLength} bytes each"); + else + scsiOneValue.Add($"Density code {descriptor.Density:X2}h"); if(modeSense.DPOandFUA) scsiOneValue.Add("Drive supports DPO and FUA bits"); if(modeSense.BlankCheckEnabled) scsiOneValue.Add("Blank checking during write is enabled"); @@ -89,8 +91,8 @@ namespace DiscImageChef.Server.App_Start modePages.Add($"MODE page {page.page:X2}h", Modes.PrettifyModePage_00_SFF(page.value)); else modePages - .Add(page.subpage != 0 ? $"MODE page {page.page:X2}h subpage {page.subpage:X2}h" : $"MODE page {page.page:X2}h", - "Unknown vendor mode page"); + .Add(page.subpage != 0 ? $"MODE page {page.page:X2}h subpage {page.subpage:X2}h" : $"MODE page {page.page:X2}h", + "Unknown vendor mode page"); break; } case 0x01: @@ -367,8 +369,10 @@ namespace DiscImageChef.Server.App_Start Dictionary newModePages = new Dictionary(); foreach(KeyValuePair kvp in modePages) - if(string.IsNullOrWhiteSpace(kvp.Value)) newModePages.Add(kvp.Key, "Undecoded"); - else newModePages.Add(kvp.Key, kvp.Value.Replace("\n", "
")); + if(string.IsNullOrWhiteSpace(kvp.Value)) + newModePages.Add(kvp.Key, "Undecoded"); + else + newModePages.Add(kvp.Key, kvp.Value.Replace("\n", "
")); modePages = newModePages; } diff --git a/DiscImageChef.Server/App_Start/TestedMedia.cs b/DiscImageChef.Server/App_Start/TestedMedia.cs index 39e6db39f..8a8daae93 100644 --- a/DiscImageChef.Server/App_Start/TestedMedia.cs +++ b/DiscImageChef.Server/App_Start/TestedMedia.cs @@ -80,13 +80,13 @@ namespace DiscImageChef.Server.App_Start if(testedMedia.Blocks * testedMedia.BlockSize / 1024 / 1024 > 1000000) mediaOneValue - .Add($"Medium size: {testedMedia.Blocks * testedMedia.BlockSize} bytes, {testedMedia.Blocks * testedMedia.BlockSize / 1000 / 1000 / 1000 / 1000} Tb, {(double)(testedMedia.Blocks * testedMedia.BlockSize) / 1024 / 1024 / 1024 / 1024:F2} TiB"); + .Add($"Medium size: {testedMedia.Blocks * testedMedia.BlockSize} bytes, {testedMedia.Blocks * testedMedia.BlockSize / 1000 / 1000 / 1000 / 1000} Tb, {(double)(testedMedia.Blocks * testedMedia.BlockSize) / 1024 / 1024 / 1024 / 1024:F2} TiB"); else if(testedMedia.Blocks * testedMedia.BlockSize / 1024 / 1024 > 1000) mediaOneValue - .Add($"Medium size: {testedMedia.Blocks * testedMedia.BlockSize} bytes, {testedMedia.Blocks * testedMedia.BlockSize / 1000 / 1000 / 1000} Gb, {(double)(testedMedia.Blocks * testedMedia.BlockSize) / 1024 / 1024 / 1024:F2} GiB"); + .Add($"Medium size: {testedMedia.Blocks * testedMedia.BlockSize} bytes, {testedMedia.Blocks * testedMedia.BlockSize / 1000 / 1000 / 1000} Gb, {(double)(testedMedia.Blocks * testedMedia.BlockSize) / 1024 / 1024 / 1024:F2} GiB"); else mediaOneValue - .Add($"Medium size: {testedMedia.Blocks * testedMedia.BlockSize} bytes, {testedMedia.Blocks * testedMedia.BlockSize / 1000 / 1000} Mb, {(double)(testedMedia.Blocks * testedMedia.BlockSize) / 1024 / 1024:F2} MiB"); + .Add($"Medium size: {testedMedia.Blocks * testedMedia.BlockSize} bytes, {testedMedia.Blocks * testedMedia.BlockSize / 1000 / 1000} Mb, {(double)(testedMedia.Blocks * testedMedia.BlockSize) / 1024 / 1024:F2} MiB"); } if(testedMedia.CHS != null && testedMedia.CurrentCHS != null) @@ -94,14 +94,14 @@ namespace DiscImageChef.Server.App_Start int currentSectors = testedMedia.CurrentCHS.Cylinders * testedMedia.CurrentCHS.Heads * testedMedia.CurrentCHS.Sectors; mediaOneValue - .Add($"Cylinders: {testedMedia.CHS.Cylinders} max., {testedMedia.CurrentCHS.Cylinders} current"); + .Add($"Cylinders: {testedMedia.CHS.Cylinders} max., {testedMedia.CurrentCHS.Cylinders} current"); mediaOneValue.Add($"Heads: {testedMedia.CHS.Heads} max., {testedMedia.CurrentCHS.Heads} current"); mediaOneValue - .Add($"Sectors per track: {testedMedia.CHS.Sectors} max., {testedMedia.CurrentCHS.Sectors} current"); + .Add($"Sectors per track: {testedMedia.CHS.Sectors} max., {testedMedia.CurrentCHS.Sectors} current"); mediaOneValue - .Add($"Sectors addressable in CHS mode: {testedMedia.CHS.Cylinders * testedMedia.CHS.Heads * testedMedia.CHS.Sectors} max., {currentSectors} current"); + .Add($"Sectors addressable in CHS mode: {testedMedia.CHS.Cylinders * testedMedia.CHS.Heads * testedMedia.CHS.Sectors} max., {currentSectors} current"); mediaOneValue - .Add($"Medium size in CHS mode: {(ulong)currentSectors * testedMedia.BlockSize} bytes, {(ulong)currentSectors * testedMedia.BlockSize / 1000 / 1000} Mb, {(double)((ulong)currentSectors * testedMedia.BlockSize) / 1024 / 1024:F2} MiB"); + .Add($"Medium size in CHS mode: {(ulong)currentSectors * testedMedia.BlockSize} bytes, {(ulong)currentSectors * testedMedia.BlockSize / 1000 / 1000} Mb, {(double)((ulong)currentSectors * testedMedia.BlockSize) / 1024 / 1024:F2} MiB"); } else if(testedMedia.CHS != null) { @@ -111,7 +111,7 @@ namespace DiscImageChef.Server.App_Start mediaOneValue.Add($"Sectors per track: {testedMedia.CHS.Sectors}"); mediaOneValue.Add($"Sectors addressable in CHS mode: {currentSectors}"); mediaOneValue - .Add($"Medium size in CHS mode: {(ulong)currentSectors * testedMedia.BlockSize} bytes, {(ulong)currentSectors * testedMedia.BlockSize / 1000 / 1000} Mb, {(double)((ulong)currentSectors * testedMedia.BlockSize) / 1024 / 1024:F2} MiB"); + .Add($"Medium size in CHS mode: {(ulong)currentSectors * testedMedia.BlockSize} bytes, {(ulong)currentSectors * testedMedia.BlockSize / 1000 / 1000} Mb, {(double)((ulong)currentSectors * testedMedia.BlockSize) / 1024 / 1024:F2} MiB"); } if(testedMedia.LBASectorsSpecified) @@ -120,13 +120,13 @@ namespace DiscImageChef.Server.App_Start if((ulong)testedMedia.LBASectors * testedMedia.BlockSize / 1024 / 1024 > 1000000) mediaOneValue - .Add($"Medium size in 28-bit LBA mode: {(ulong)testedMedia.LBASectors * testedMedia.BlockSize} bytes, {(ulong)testedMedia.LBASectors * testedMedia.BlockSize / 1000 / 1000 / 1000 / 1000} Tb, {(double)((ulong)testedMedia.LBASectors * testedMedia.BlockSize) / 1024 / 1024 / 1024 / 1024:F2} TiB"); + .Add($"Medium size in 28-bit LBA mode: {(ulong)testedMedia.LBASectors * testedMedia.BlockSize} bytes, {(ulong)testedMedia.LBASectors * testedMedia.BlockSize / 1000 / 1000 / 1000 / 1000} Tb, {(double)((ulong)testedMedia.LBASectors * testedMedia.BlockSize) / 1024 / 1024 / 1024 / 1024:F2} TiB"); else if((ulong)testedMedia.LBASectors * testedMedia.BlockSize / 1024 / 1024 > 1000) mediaOneValue - .Add($"Medium size in 28-bit LBA mode: {(ulong)testedMedia.LBASectors * testedMedia.BlockSize} bytes, {(ulong)testedMedia.LBASectors * testedMedia.BlockSize / 1000 / 1000 / 1000} Gb, {(double)((ulong)testedMedia.LBASectors * testedMedia.BlockSize) / 1024 / 1024 / 1024:F2} GiB"); + .Add($"Medium size in 28-bit LBA mode: {(ulong)testedMedia.LBASectors * testedMedia.BlockSize} bytes, {(ulong)testedMedia.LBASectors * testedMedia.BlockSize / 1000 / 1000 / 1000} Gb, {(double)((ulong)testedMedia.LBASectors * testedMedia.BlockSize) / 1024 / 1024 / 1024:F2} GiB"); else mediaOneValue - .Add($"Medium size in 28-bit LBA mode: {(ulong)testedMedia.LBASectors * testedMedia.BlockSize} bytes, {(ulong)testedMedia.LBASectors * testedMedia.BlockSize / 1000 / 1000} Mb, {(double)((ulong)testedMedia.LBASectors * testedMedia.BlockSize) / 1024 / 1024:F2} MiB"); + .Add($"Medium size in 28-bit LBA mode: {(ulong)testedMedia.LBASectors * testedMedia.BlockSize} bytes, {(ulong)testedMedia.LBASectors * testedMedia.BlockSize / 1000 / 1000} Mb, {(double)((ulong)testedMedia.LBASectors * testedMedia.BlockSize) / 1024 / 1024:F2} MiB"); } if(testedMedia.LBA48SectorsSpecified) @@ -135,27 +135,28 @@ namespace DiscImageChef.Server.App_Start if(testedMedia.LBA48Sectors * testedMedia.BlockSize / 1024 / 1024 > 1000000) mediaOneValue - .Add($"Medium size in 48-bit LBA mode: {testedMedia.LBA48Sectors * testedMedia.BlockSize} bytes, {testedMedia.LBA48Sectors * testedMedia.BlockSize / 1000 / 1000 / 1000 / 1000} Tb, {(double)(testedMedia.LBA48Sectors * testedMedia.BlockSize) / 1024 / 1024 / 1024 / 1024:F2} TiB"); + .Add($"Medium size in 48-bit LBA mode: {testedMedia.LBA48Sectors * testedMedia.BlockSize} bytes, {testedMedia.LBA48Sectors * testedMedia.BlockSize / 1000 / 1000 / 1000 / 1000} Tb, {(double)(testedMedia.LBA48Sectors * testedMedia.BlockSize) / 1024 / 1024 / 1024 / 1024:F2} TiB"); else if(testedMedia.LBA48Sectors * testedMedia.BlockSize / 1024 / 1024 > 1000) mediaOneValue - .Add($"Medium size in 48-bit LBA mode: {testedMedia.LBA48Sectors * testedMedia.BlockSize} bytes, {testedMedia.LBA48Sectors * testedMedia.BlockSize / 1000 / 1000 / 1000} Gb, {(double)(testedMedia.LBA48Sectors * testedMedia.BlockSize) / 1024 / 1024 / 1024:F2} GiB"); + .Add($"Medium size in 48-bit LBA mode: {testedMedia.LBA48Sectors * testedMedia.BlockSize} bytes, {testedMedia.LBA48Sectors * testedMedia.BlockSize / 1000 / 1000 / 1000} Gb, {(double)(testedMedia.LBA48Sectors * testedMedia.BlockSize) / 1024 / 1024 / 1024:F2} GiB"); else mediaOneValue - .Add($"Medium size in 48-bit LBA mode: {testedMedia.LBA48Sectors * testedMedia.BlockSize} bytes, {testedMedia.LBA48Sectors * testedMedia.BlockSize / 1000 / 1000} Mb, {(double)(testedMedia.LBA48Sectors * testedMedia.BlockSize) / 1024 / 1024:F2} MiB"); + .Add($"Medium size in 48-bit LBA mode: {testedMedia.LBA48Sectors * testedMedia.BlockSize} bytes, {testedMedia.LBA48Sectors * testedMedia.BlockSize / 1000 / 1000} Mb, {(double)(testedMedia.LBA48Sectors * testedMedia.BlockSize) / 1024 / 1024:F2} MiB"); } if(testedMedia.NominalRotationRateSpecified && testedMedia.NominalRotationRate != 0x0000 && - testedMedia.NominalRotationRate != 0xFFFF) + testedMedia.NominalRotationRate != 0xFFFF) mediaOneValue.Add(testedMedia.NominalRotationRate == 0x0001 ? "Medium does not rotate." : $"Medium rotates at {testedMedia.NominalRotationRate} rpm"); - if(testedMedia.BlockSizeSpecified && testedMedia.PhysicalBlockSizeSpecified && - testedMedia.BlockSize != testedMedia.PhysicalBlockSize && - (testedMedia.LogicalAlignment & 0x8000) == 0x0000 && + if(testedMedia.BlockSizeSpecified && + testedMedia.PhysicalBlockSizeSpecified && + testedMedia.BlockSize != testedMedia.PhysicalBlockSize && + (testedMedia.LogicalAlignment & 0x8000) == 0x0000 && (testedMedia.LogicalAlignment & 0x4000) == 0x4000) mediaOneValue - .Add($"Logical sector starts at offset {testedMedia.LogicalAlignment & 0x3FFF} from physical sector"); + .Add($"Logical sector starts at offset {testedMedia.LogicalAlignment & 0x3FFF} from physical sector"); if(testedMedia.SupportsRead && ata) mediaOneValue.Add("Device can use the READ SECTOR(S) command in CHS mode with this medium"); @@ -174,7 +175,7 @@ namespace DiscImageChef.Server.App_Start 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"); + .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) @@ -217,10 +218,10 @@ namespace DiscImageChef.Server.App_Start 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"); + .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"); + .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"); @@ -250,7 +251,7 @@ namespace DiscImageChef.Server.App_Start 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"); + .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) @@ -279,14 +280,14 @@ namespace DiscImageChef.Server.App_Start 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"); + .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"); + .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) diff --git a/DiscImageChef.Server/Changelog.aspx b/DiscImageChef.Server/Changelog.aspx index 7f789b3e7..042b9355a 100644 --- a/DiscImageChef.Server/Changelog.aspx +++ b/DiscImageChef.Server/Changelog.aspx @@ -37,10 +37,13 @@ - + DiscImageChef's TODO - + - +

- Return to main page.
+ 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 254cbcba2..2e86db3d4 100644 --- a/DiscImageChef.Server/Controllers/UploadReportController.cs +++ b/DiscImageChef.Server/Controllers/UploadReportController.cs @@ -58,7 +58,7 @@ namespace DiscImageChef.Server.Controllers try { DeviceReport newReport = new DeviceReport(); - HttpRequest request = HttpContext.Current.Request; + HttpRequest request = HttpContext.Current.Request; XmlSerializer xs = new XmlSerializer(newReport.GetType()); newReport = (DeviceReport)xs.Deserialize(request.InputStream); @@ -69,7 +69,7 @@ namespace DiscImageChef.Server.Controllers return response; } - Random rng = new Random(); + Random rng = new Random(); string filename = $"NewReport_{DateTime.UtcNow:yyyyMMddHHmmssfff}_{rng.Next()}.xml"; while(File.Exists(Path.Combine(HostingEnvironment.MapPath("~") ?? throw new InvalidOperationException(), "Upload", filename))) @@ -88,9 +88,9 @@ namespace DiscImageChef.Server.Controllers // ReSharper disable once RedundantCatchClause catch { -#if DEBUG + #if DEBUG throw; -#else + #else response.Content = new StringContent("error", System.Text.Encoding.UTF8, "text/plain"); return response; #endif diff --git a/DiscImageChef.Server/Controllers/UploadStatsController.cs b/DiscImageChef.Server/Controllers/UploadStatsController.cs index abaf17d1b..39ac51fdb 100644 --- a/DiscImageChef.Server/Controllers/UploadStatsController.cs +++ b/DiscImageChef.Server/Controllers/UploadStatsController.cs @@ -60,8 +60,8 @@ namespace DiscImageChef.Server.Controllers try { - Stats newStats = new Stats(); - HttpRequest request = HttpContext.Current.Request; + Stats newStats = new Stats(); + HttpRequest request = HttpContext.Current.Request; XmlSerializer xs = new XmlSerializer(newStats.GetType()); newStats = (Stats)xs.Deserialize(request.InputStream); @@ -83,52 +83,55 @@ namespace DiscImageChef.Server.Controllers } Stats oldStats = new Stats(); - xs = new XmlSerializer(oldStats.GetType()); + xs = new XmlSerializer(oldStats.GetType()); oldStats = (Stats)xs.Deserialize(fs); 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; - oldStats.Commands.Benchmark += newStats.Commands.Benchmark; - oldStats.Commands.Checksum += newStats.Commands.Checksum; - oldStats.Commands.Compare += newStats.Commands.Compare; + oldStats.Commands.Analyze += newStats.Commands.Analyze; + oldStats.Commands.Benchmark += newStats.Commands.Benchmark; + oldStats.Commands.Checksum += newStats.Commands.Checksum; + oldStats.Commands.Compare += newStats.Commands.Compare; oldStats.Commands.CreateSidecar += newStats.Commands.CreateSidecar; - oldStats.Commands.Decode += newStats.Commands.Decode; - oldStats.Commands.DeviceInfo += newStats.Commands.DeviceInfo; - oldStats.Commands.DeviceReport += newStats.Commands.DeviceReport; - oldStats.Commands.DumpMedia += newStats.Commands.DumpMedia; - oldStats.Commands.Entropy += newStats.Commands.Entropy; - oldStats.Commands.Formats += newStats.Commands.Formats; - oldStats.Commands.MediaInfo += newStats.Commands.MediaInfo; - oldStats.Commands.MediaScan += newStats.Commands.MediaScan; - oldStats.Commands.PrintHex += newStats.Commands.PrintHex; - oldStats.Commands.Verify += newStats.Commands.Verify; - oldStats.Commands.Ls += newStats.Commands.Ls; - oldStats.Commands.ExtractFiles += newStats.Commands.ExtractFiles; - oldStats.Commands.ListDevices += newStats.Commands.ListDevices; + oldStats.Commands.Decode += newStats.Commands.Decode; + oldStats.Commands.DeviceInfo += newStats.Commands.DeviceInfo; + oldStats.Commands.DeviceReport += newStats.Commands.DeviceReport; + oldStats.Commands.DumpMedia += newStats.Commands.DumpMedia; + oldStats.Commands.Entropy += newStats.Commands.Entropy; + oldStats.Commands.Formats += newStats.Commands.Formats; + oldStats.Commands.MediaInfo += newStats.Commands.MediaInfo; + oldStats.Commands.MediaScan += newStats.Commands.MediaScan; + oldStats.Commands.PrintHex += newStats.Commands.PrintHex; + oldStats.Commands.Verify += newStats.Commands.Verify; + oldStats.Commands.Ls += newStats.Commands.Ls; + oldStats.Commands.ExtractFiles += newStats.Commands.ExtractFiles; + oldStats.Commands.ListDevices += newStats.Commands.ListDevices; oldStats.Commands.ListEncodings += newStats.Commands.ListEncodings; - oldStats.Commands.ConvertImage += newStats.Commands.ConvertImage; - oldStats.Commands.ImageInfo += newStats.Commands.ImageInfo; + oldStats.Commands.ConvertImage += newStats.Commands.ConvertImage; + oldStats.Commands.ImageInfo += newStats.Commands.ImageInfo; } 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) { OsStats removeNvs = null; - OsStats addNvs = null; + OsStats addNvs = null; - foreach(OsStats oldNvs in - oldStats.OperatingSystems.Where(oldNvs => oldNvs.name == newNvs.name && - oldNvs.version == newNvs.version)) + foreach(OsStats oldNvs in oldStats.OperatingSystems.Where(oldNvs => + oldNvs.name == newNvs.name && + oldNvs.version == + newNvs.version)) { addNvs = new OsStats { - name = oldNvs.name, - Value = oldNvs.Value + newNvs.Value, + name = oldNvs.name, + Value = oldNvs.Value + newNvs.Value, version = oldNvs.version }; removeNvs = oldNvs; @@ -149,14 +152,14 @@ namespace DiscImageChef.Server.Controllers else { OsStats removeNvs = null; - OsStats addNvs = null; + OsStats addNvs = null; foreach(OsStats oldNvs in oldStats.OperatingSystems.Where(oldNvs => oldNvs.name == "Linux")) { addNvs = new OsStats { - name = oldNvs.name, - Value = oldNvs.Value + 1, + name = oldNvs.name, + Value = oldNvs.Value + 1, version = oldNvs.version }; removeNvs = oldNvs; @@ -173,17 +176,22 @@ namespace DiscImageChef.Server.Controllers } 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) { NameValueStats removeNvs = null; - NameValueStats addNvs = null; + NameValueStats addNvs = null; foreach(NameValueStats oldNvs in oldStats.Versions.Where(oldNvs => 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; } @@ -203,11 +211,11 @@ namespace DiscImageChef.Server.Controllers else { NameValueStats removeNvs = null; - NameValueStats addNvs = null; + NameValueStats addNvs = null; foreach(NameValueStats oldNvs in oldStats.Versions.Where(oldNvs => 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; } @@ -222,17 +230,22 @@ namespace DiscImageChef.Server.Controllers } 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) { NameValueStats removeNvs = null; - NameValueStats addNvs = null; + NameValueStats addNvs = null; foreach(NameValueStats oldNvs in oldStats.Filesystems.Where(oldNvs => 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; } @@ -246,17 +259,22 @@ namespace DiscImageChef.Server.Controllers } 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) { NameValueStats removeNvs = null; - NameValueStats addNvs = null; + NameValueStats addNvs = null; foreach(NameValueStats oldNvs in oldStats.Partitions.Where(oldNvs => 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; } @@ -270,17 +288,22 @@ namespace DiscImageChef.Server.Controllers } 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) { NameValueStats removeNvs = null; - NameValueStats addNvs = null; + NameValueStats addNvs = null; foreach(NameValueStats oldNvs in oldStats.MediaImages.Where(oldNvs => 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,17 +317,22 @@ namespace DiscImageChef.Server.Controllers } 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) { NameValueStats removeNvs = null; - NameValueStats addNvs = null; + NameValueStats addNvs = null; foreach(NameValueStats oldNvs in oldStats.Filters.Where(oldNvs => 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; } @@ -318,35 +346,38 @@ namespace DiscImageChef.Server.Controllers } 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 from newDev in newStats.Devices let found = oldStats.Devices.Any(oldDev => oldDev.Manufacturer == - newDev.Manufacturer && - oldDev.Model == newDev.Model && + newDev.Manufacturer && + oldDev.Model == newDev.Model && oldDev.Revision == newDev.Revision && - oldDev.Bus == newDev.Bus) + oldDev.Bus == newDev.Bus) where !found - select newDev) oldStats.Devices.Add(newDev); + select newDev) + 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) { MediaStats removeMstat = null; - MediaStats addMstat = null; + MediaStats addMstat = null; - foreach(MediaStats oldMstat in - oldStats.Medias.Where(oldMstat => oldMstat.real == newMstat.real && - oldMstat.type == newMstat.type)) + foreach(MediaStats oldMstat in oldStats.Medias.Where(oldMstat => + oldMstat.real == newMstat.real && + oldMstat.type == newMstat.type)) { addMstat = new MediaStats { - real = oldMstat.real, - type = oldMstat.type, + real = oldMstat.real, + type = oldMstat.type, Value = oldMstat.Value + newMstat.Value }; removeMstat = oldMstat; @@ -362,40 +393,42 @@ namespace DiscImageChef.Server.Controllers } 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; else { - oldStats.MediaScan.Sectors.Correct = newStats.MediaScan.Sectors.Correct; - oldStats.MediaScan.Sectors.Error = newStats.MediaScan.Sectors.Error; - oldStats.MediaScan.Sectors.Total = newStats.MediaScan.Sectors.Total; + oldStats.MediaScan.Sectors.Correct = newStats.MediaScan.Sectors.Correct; + oldStats.MediaScan.Sectors.Error = newStats.MediaScan.Sectors.Error; + oldStats.MediaScan.Sectors.Total = newStats.MediaScan.Sectors.Total; oldStats.MediaScan.Sectors.Unverifiable = newStats.MediaScan.Sectors.Unverifiable; } if(oldStats.MediaScan.Times == null) oldStats.MediaScan.Times = newStats.MediaScan.Times; else { - oldStats.MediaScan.Times.LessThan10ms = newStats.MediaScan.Times.LessThan10ms; + oldStats.MediaScan.Times.LessThan10ms = newStats.MediaScan.Times.LessThan10ms; oldStats.MediaScan.Times.LessThan150ms = newStats.MediaScan.Times.LessThan150ms; - oldStats.MediaScan.Times.LessThan3ms = newStats.MediaScan.Times.LessThan3ms; + oldStats.MediaScan.Times.LessThan3ms = newStats.MediaScan.Times.LessThan3ms; oldStats.MediaScan.Times.LessThan500ms = newStats.MediaScan.Times.LessThan500ms; - oldStats.MediaScan.Times.LessThan50ms = newStats.MediaScan.Times.LessThan50ms; + oldStats.MediaScan.Times.LessThan50ms = newStats.MediaScan.Times.LessThan50ms; oldStats.MediaScan.Times.MoreThan500ms = newStats.MediaScan.Times.MoreThan500ms; } } 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; else { - oldStats.Verify.Sectors.Correct = newStats.Verify.Sectors.Correct; - oldStats.Verify.Sectors.Error = newStats.Verify.Sectors.Error; - oldStats.Verify.Sectors.Total = newStats.Verify.Sectors.Total; + oldStats.Verify.Sectors.Correct = newStats.Verify.Sectors.Correct; + oldStats.Verify.Sectors.Error = newStats.Verify.Sectors.Error; + oldStats.Verify.Sectors.Total = newStats.Verify.Sectors.Total; oldStats.Verify.Sectors.Unverifiable = newStats.Verify.Sectors.Unverifiable; } @@ -404,7 +437,7 @@ namespace DiscImageChef.Server.Controllers else { oldStats.Verify.MediaImages.Correct = newStats.Verify.MediaImages.Correct; - oldStats.Verify.MediaImages.Failed = newStats.Verify.MediaImages.Failed; + oldStats.Verify.MediaImages.Failed = newStats.Verify.MediaImages.Failed; } } @@ -413,7 +446,7 @@ namespace DiscImageChef.Server.Controllers .ThenBy(device => device.Model).ThenBy(device => device.Revision) .ThenBy(device => device.Bus).ToList(); - Random rng = new Random(); + Random rng = new Random(); string filename = $"BackupStats_{DateTime.UtcNow:yyyyMMddHHmmssfff}_{rng.Next()}.xml"; while(File.Exists(Path.Combine(HostingEnvironment.MapPath("~"), "Statistics", filename))) filename = $"BackupStats_{DateTime.UtcNow:yyyyMMddHHmmssfff}_{rng.Next()}.xml"; @@ -435,10 +468,10 @@ namespace DiscImageChef.Server.Controllers } catch(Exception ex) { -#if DEBUG + #if DEBUG System.Console.WriteLine("{0} {1}", ex.Message, ex.InnerException); throw; -#else + #else response.Content = new StringContent("error", System.Text.Encoding.UTF8, "text/plain"); return response; #endif diff --git a/DiscImageChef.Server/DONATING.aspx b/DiscImageChef.Server/DONATING.aspx index 11287e5fc..21aca7470 100644 --- a/DiscImageChef.Server/DONATING.aspx +++ b/DiscImageChef.Server/DONATING.aspx @@ -37,10 +37,13 @@ - + DiscImageChef's TODO - + - +

- Return to main page.
+ 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 d26ceccee..c5cad6167 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/Statistics.aspx b/DiscImageChef.Server/Statistics.aspx index 0aae11876..c8862600f 100644 --- a/DiscImageChef.Server/Statistics.aspx +++ b/DiscImageChef.Server/Statistics.aspx @@ -36,10 +36,13 @@ - + DiscImageChef Statistics - + - +

Welcome to - DiscImageChef - Server version + + DiscImageChef + + Server version +

-
-
-
+
+
+
- +
DiscImageChef has run on - - times. + + + times.
-
+
-
+
- +
DiscImageChef version - - has been used times. + + 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
- convert-image 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
- image-info 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 + analyze command has been run + times
+ benchmark command has been run + times
+ checksum command has been run + times
+ compare command has been run + times
+ convert-image 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
+ image-info 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:

- +
- +
Filter Times
- + - +
-
+

Media image formats found:

- +
- +
Media image format Times
- + - +
-
+

Partition schemes found:

- +
- +
Partition scheme Times
- + - +
-
+

Filesystems found:

- +
- +
Filesystem name Times
- + - +
-
+

Media types found in images:

- +
- +
Physical type Logical type Times
- + - + - +
-
+

Media types found in devices:

- +
- +
Physical type Logical type Times
- + - + - +
-
+

Found devices:

- +
@@ -263,23 +360,29 @@ - + @@ -287,11 +390,23 @@
Manufacturer ModelBus Report
- + - + - + - + - +
-
+
\ No newline at end of file diff --git a/DiscImageChef.Server/Statistics.aspx.cs b/DiscImageChef.Server/Statistics.aspx.cs index 0d272b199..c79664431 100644 --- a/DiscImageChef.Server/Statistics.aspx.cs +++ b/DiscImageChef.Server/Statistics.aspx.cs @@ -80,7 +80,7 @@ namespace DiscImageChef.Server statistics = new Stats(); XmlSerializer xs = new XmlSerializer(statistics.GetType()); - FileStream fs = + FileStream fs = WaitForFile(Path.Combine(HostingEnvironment.MapPath("~") ?? throw new InvalidOperationException(), "Statistics", "Statistics.xml"), FileMode.Open, FileAccess.Read, FileShare.Read); statistics = (Stats)xs.Deserialize(fs); @@ -217,20 +217,20 @@ namespace DiscImageChef.Server !string.IsNullOrWhiteSpace(device.Revision)) { xmlFile = device.Manufacturer + "_" + device.Model + "_" + device.Revision + ".xml"; - url = + url = $"ViewReport.aspx?manufacturer={HttpUtility.UrlPathEncode(device.Manufacturer)}&model={HttpUtility.UrlPathEncode(device.Model)}&revision={HttpUtility.UrlPathEncode(device.Revision)}"; } else if(!string.IsNullOrWhiteSpace(device.Manufacturer) && !string.IsNullOrWhiteSpace(device.Model)) { xmlFile = device.Manufacturer + "_" + device.Model + ".xml"; - url = + url = $"ViewReport.aspx?manufacturer={HttpUtility.UrlPathEncode(device.Manufacturer)}&model={HttpUtility.UrlPathEncode(device.Model)}"; } else if(!string.IsNullOrWhiteSpace(device.Model) && !string.IsNullOrWhiteSpace(device.Revision)) { xmlFile = device.Model + "_" + device.Revision + ".xml"; - url = + url = $"ViewReport.aspx?model={HttpUtility.UrlPathEncode(device.Model)}&revision={HttpUtility.UrlPathEncode(device.Revision)}"; } else diff --git a/DiscImageChef.Server/TODO.aspx b/DiscImageChef.Server/TODO.aspx index c3b202919..2da70ce74 100644 --- a/DiscImageChef.Server/TODO.aspx +++ b/DiscImageChef.Server/TODO.aspx @@ -37,10 +37,13 @@ - + DiscImageChef's TODO - + - +

- Return to main page.
+ 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 bcdfcb00f..0aedbfbee 100644 --- a/DiscImageChef.Server/ViewReport.aspx +++ b/DiscImageChef.Server/ViewReport.aspx @@ -36,10 +36,13 @@ - + DiscImageChef Device Report - + - -DiscImageChef Report for -
-
- USB characteristics:
- Manufacturer:
- Product:
- Vendor ID:
- Product ID: + +DiscImageChef Report for + + + +
+
+ USB characteristics:
+ Manufacturer: +
+ Product: +
+ Vendor ID: + +
+ Product ID: + +
-
-
- FireWire characteristics:
- Manufacturer:
- Product:
- Vendor ID:
- Product ID: +
+
+ FireWire characteristics:
+ Manufacturer: +
+ Product: +
+ Vendor ID: +
+ Product ID: +
-
-
- PCMCIA characteristics:
- Manufacturer:
- Product:
- Manufacturer code:
- Card code:
- Compliance: - +
+
+ PCMCIA characteristics:
+ Manufacturer: +
+ Product: +
+ Manufacturer code: +
+ Card code: +
+ Compliance: + + - - :
+ + : +
-
-
- ATA characteristics:
-
- +
+
+ + ATA + characteristics: +
+
+ - - :
+ + : +
-
- +
+ - <%# Container.DataItem?.ToString() ?? string.Empty %>
+ <%# Container.DataItem?.ToString() ?? string.Empty %>
-
-
- SCSI characteristics:
- Vendor:
- Product:
- Revision:
- +
+
+ SCSI characteristics:
+ Vendor: +
+ Product: +
+ Revision: +
+ - <%# Container.DataItem?.ToString() ?? string.Empty %>
+ <%# Container.DataItem?.ToString() ?? string.Empty %>
-
-
SCSI mode sense pages: +
+
SCSI mode sense pages: - +
Mode Contents
- + - +
-
-
SCSI extended vital product data pages: +
+
SCSI extended vital product data pages: - +
EVPD Contents
- + - +
-
-
SCSI CD-ROM capabilities:
- +
+
SCSI CD-ROM capabilities:
+ - <%# Container.DataItem?.ToString() ?? string.Empty %>
+ <%# Container.DataItem?.ToString() ?? string.Empty %>
-
-
SCSI MMC features:
- +
+
SCSI MMC features:
+ - <%# Container.DataItem?.ToString() ?? string.Empty %>
+ <%# Container.DataItem?.ToString() ?? string.Empty %>
-
-
SCSI Streaming device capabilities:
- Block size granularity:
- Maximum block length: bytes
- Minimum block length: bytes
- +
+
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 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:
+
+ + 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:
- +
+
Tested media:
+ - <%# Container.DataItem?.ToString() ?? string.Empty %>
+ <%# Container.DataItem?.ToString() ?? string.Empty %>
-
-
- MultiMediaCard device:
- +
+
+ MultiMediaCard device:
+ - <%# Container.DataItem?.ToString() ?? string.Empty %>
+ <%# Container.DataItem?.ToString() ?? string.Empty %>
-
-
- SecureDigital device:
- +
+
+ SecureDigital device:
+ - <%# Container.DataItem?.ToString() ?? string.Empty %>
+ <%# Container.DataItem?.ToString() ?? string.Empty %>
diff --git a/DiscImageChef.Server/ViewReport.aspx.cs b/DiscImageChef.Server/ViewReport.aspx.cs index 8f391df95..c0855c28e 100644 --- a/DiscImageChef.Server/ViewReport.aspx.cs +++ b/DiscImageChef.Server/ViewReport.aspx.cs @@ -56,24 +56,25 @@ namespace DiscImageChef.Server try { string manufacturer = Request.QueryString["manufacturer"]; - string model = Request.QueryString["model"]; - string revision = Request.QueryString["revision"]; + string model = Request.QueryString["model"]; + string revision = Request.QueryString["revision"]; // 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('?', '_'); + .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('?', '_'); + .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('?', '_'); + .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) && @@ -81,8 +82,8 @@ namespace DiscImageChef.Server 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"; + xmlFile = model + "_" + revision + ".xml"; + else if(!string.IsNullOrWhiteSpace(model)) xmlFile = model + ".xml"; if(xmlFile == null || !File.Exists(Path.Combine(HostingEnvironment.MapPath("~") ?? throw new InvalidOperationException(), @@ -93,11 +94,11 @@ namespace DiscImageChef.Server } lblManufacturer.Text = Request.QueryString["manufacturer"]; - lblModel.Text = Request.QueryString["model"]; - lblRevision.Text = Request.QueryString["revision"]; + lblModel.Text = Request.QueryString["model"]; + lblRevision.Text = Request.QueryString["revision"]; - DeviceReport report = new DeviceReport(); - XmlSerializer xs = new XmlSerializer(report.GetType()); + DeviceReport report = new DeviceReport(); + XmlSerializer xs = new XmlSerializer(report.GetType()); StreamReader sr = new StreamReader(Path.Combine(HostingEnvironment.MapPath("~") ?? throw new InvalidOperationException(), @@ -111,8 +112,8 @@ namespace DiscImageChef.Server out string usbProductDescription); lblUsbManufacturer.Text = HttpUtility.HtmlEncode(report.USB.Manufacturer); - lblUsbProduct.Text = HttpUtility.HtmlEncode(report.USB.Product); - lblUsbVendor.Text = $"0x{report.USB.VendorID:x4}"; + lblUsbProduct.Text = HttpUtility.HtmlEncode(report.USB.Product); + lblUsbVendor.Text = $"0x{report.USB.VendorID:x4}"; if(usbVendorDescription != null) lblUsbVendorDescription.Text = $"({HttpUtility.HtmlEncode(usbVendorDescription)})"; lblUsbProductId.Text = $"0x{report.USB.ProductID:x4}"; @@ -124,19 +125,19 @@ namespace DiscImageChef.Server if(report.FireWire != null) { lblFirewireManufacturer.Text = HttpUtility.HtmlEncode(report.FireWire.Manufacturer); - lblFirewireProduct.Text = HttpUtility.HtmlEncode(report.FireWire.Product); - lblFirewireVendor.Text = $"0x{report.FireWire.VendorID:x8}"; - lblFirewireProductId.Text = $"0x{report.FireWire.ProductID:x8}"; + lblFirewireProduct.Text = HttpUtility.HtmlEncode(report.FireWire.Product); + lblFirewireVendor.Text = $"0x{report.FireWire.VendorID:x8}"; + lblFirewireProductId.Text = $"0x{report.FireWire.ProductID:x8}"; } else divFirewire.Visible = false; if(report.PCMCIA != null) { - lblPcmciaManufacturer.Text = HttpUtility.HtmlEncode(report.PCMCIA.Manufacturer); - lblPcmciaProduct.Text = HttpUtility.HtmlEncode(report.PCMCIA.ProductName); + lblPcmciaManufacturer.Text = HttpUtility.HtmlEncode(report.PCMCIA.Manufacturer); + lblPcmciaProduct.Text = HttpUtility.HtmlEncode(report.PCMCIA.ProductName); lblPcmciaManufacturerCode.Text = $"0x{report.PCMCIA.ManufacturerCode:x4}"; - lblPcmciaCardCode.Text = $"0x{report.PCMCIA.CardCode:x4}"; - lblPcmciaCompliance.Text = HttpUtility.HtmlEncode(report.PCMCIA.Compliance); + lblPcmciaCardCode.Text = $"0x{report.PCMCIA.CardCode:x4}"; + lblPcmciaCompliance.Text = HttpUtility.HtmlEncode(report.PCMCIA.Compliance); Tuple[] tuples = CIS.GetTuples(report.PCMCIA.CIS); if(tuples != null) { @@ -219,32 +220,32 @@ namespace DiscImageChef.Server } else divPcmcia.Visible = false; - bool removable = true; + bool removable = true; testedMediaType[] testedMedia = null; - bool ata = false; - bool atapi = false; - bool sscMedia = false; + bool ata = false; + bool atapi = false; + bool sscMedia = false; if(report.ATA != null || report.ATAPI != null) { ata = true; - List ataOneValue = new List(); + List ataOneValue = new List(); Dictionary ataTwoValue = new Dictionary(); - ataType ataReport; + ataType ataReport; if(report.ATAPI != null) { lblAtapi.Text = "PI"; - ataReport = report.ATAPI; - atapi = true; + ataReport = report.ATAPI; + atapi = true; } 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); @@ -257,16 +258,16 @@ namespace DiscImageChef.Server if(report.SCSI != null) { - List scsiOneValue = new List(); - Dictionary modePages = new Dictionary(); - Dictionary evpdPages = new Dictionary(); + List scsiOneValue = new List(); + Dictionary modePages = new Dictionary(); + Dictionary evpdPages = new Dictionary(); lblScsiVendor.Text = VendorString.Prettify(report.SCSI.Inquiry.VendorIdentification) != report.SCSI.Inquiry.VendorIdentification ? $"{report.SCSI.Inquiry.VendorIdentification} ({VendorString.Prettify(report.SCSI.Inquiry.VendorIdentification)})" : report.SCSI.Inquiry.VendorIdentification; - lblScsiProduct.Text = report.SCSI.Inquiry.ProductIdentification; + lblScsiProduct.Text = report.SCSI.Inquiry.ProductIdentification; lblScsiRevision.Text = report.SCSI.Inquiry.ProductRevisionLevel; scsiOneValue.AddRange(ScsiInquiry.Report(report.SCSI.Inquiry)); @@ -296,9 +297,9 @@ namespace DiscImageChef.Server } else divScsiEvpd.Visible = false; - divScsiMmcMode.Visible = false; + divScsiMmcMode.Visible = false; divScsiMmcFeatures.Visible = false; - divScsiSsc.Visible = false; + divScsiSsc.Visible = false; if(report.SCSI.MultiMediaDevice != null) { @@ -310,7 +311,7 @@ namespace DiscImageChef.Server ScsiMmcMode.Report(report.SCSI.MultiMediaDevice.ModeSense2A, ref mmcModeOneValue); if(mmcModeOneValue.Count > 0) { - divScsiMmcMode.Visible = true; + divScsiMmcMode.Visible = true; repScsiMmcMode.DataSource = mmcModeOneValue; repScsiMmcMode.DataBind(); } @@ -322,7 +323,7 @@ namespace DiscImageChef.Server ScsiMmcFeatures.Report(report.SCSI.MultiMediaDevice.Features, ref mmcFeaturesOneValue); if(mmcFeaturesOneValue.Count > 0) { - divScsiMmcFeatures.Visible = true; + divScsiMmcFeatures.Visible = true; repScsiMmcFeatures.DataSource = mmcFeaturesOneValue; repScsiMmcFeatures.DataBind(); } @@ -364,7 +365,7 @@ namespace DiscImageChef.Server SscTestedMedia.Report(report.SCSI.SequentialDevice.TestedMedia, ref mediaOneValue); if(mediaOneValue.Count > 0) { - sscMedia = true; + sscMedia = true; repTestedMedia.DataSource = mediaOneValue; repTestedMedia.DataBind(); } @@ -381,19 +382,20 @@ namespace DiscImageChef.Server report.SCSI.ReadCapabilities.BlockSizeSpecified) { scsiOneValue - .Add($"Device has {report.SCSI.ReadCapabilities.Blocks} blocks of {report.SCSI.ReadCapabilities.BlockSize} bytes each"); + .Add($"Device has {report.SCSI.ReadCapabilities.Blocks} blocks of {report.SCSI.ReadCapabilities.BlockSize} bytes each"); if(report.SCSI.ReadCapabilities.Blocks * report.SCSI.ReadCapabilities.BlockSize / 1024 / 1024 > 1000000) scsiOneValue - .Add($"Device size: {report.SCSI.ReadCapabilities.Blocks * report.SCSI.ReadCapabilities.BlockSize} bytes, {report.SCSI.ReadCapabilities.Blocks * report.SCSI.ReadCapabilities.BlockSize / 1000 / 1000 / 1000 / 1000} Tb, {(double)(report.SCSI.ReadCapabilities.Blocks * report.SCSI.ReadCapabilities.BlockSize) / 1024 / 1024 / 1024 / 1024:F2} TiB"); + .Add($"Device size: {report.SCSI.ReadCapabilities.Blocks * report.SCSI.ReadCapabilities.BlockSize} bytes, {report.SCSI.ReadCapabilities.Blocks * report.SCSI.ReadCapabilities.BlockSize / 1000 / 1000 / 1000 / 1000} Tb, {(double)(report.SCSI.ReadCapabilities.Blocks * report.SCSI.ReadCapabilities.BlockSize) / 1024 / 1024 / 1024 / 1024:F2} TiB"); else if(report.SCSI.ReadCapabilities.Blocks * report.SCSI.ReadCapabilities.BlockSize / - 1024 / 1024 > 1000) + 1024 / + 1024 > 1000) scsiOneValue - .Add($"Device size: {report.SCSI.ReadCapabilities.Blocks * report.SCSI.ReadCapabilities.BlockSize} bytes, {report.SCSI.ReadCapabilities.Blocks * report.SCSI.ReadCapabilities.BlockSize / 1000 / 1000 / 1000} Gb, {(double)(report.SCSI.ReadCapabilities.Blocks * report.SCSI.ReadCapabilities.BlockSize) / 1024 / 1024 / 1024:F2} GiB"); + .Add($"Device size: {report.SCSI.ReadCapabilities.Blocks * report.SCSI.ReadCapabilities.BlockSize} bytes, {report.SCSI.ReadCapabilities.Blocks * report.SCSI.ReadCapabilities.BlockSize / 1000 / 1000 / 1000} Gb, {(double)(report.SCSI.ReadCapabilities.Blocks * report.SCSI.ReadCapabilities.BlockSize) / 1024 / 1024 / 1024:F2} GiB"); else scsiOneValue - .Add($"Device size: {report.SCSI.ReadCapabilities.Blocks * report.SCSI.ReadCapabilities.BlockSize} bytes, {report.SCSI.ReadCapabilities.Blocks * report.SCSI.ReadCapabilities.BlockSize / 1000 / 1000} Mb, {(double)(report.SCSI.ReadCapabilities.Blocks * report.SCSI.ReadCapabilities.BlockSize) / 1024 / 1024:F2} MiB"); + .Add($"Device size: {report.SCSI.ReadCapabilities.Blocks * report.SCSI.ReadCapabilities.BlockSize} bytes, {report.SCSI.ReadCapabilities.Blocks * report.SCSI.ReadCapabilities.BlockSize / 1000 / 1000} Mb, {(double)(report.SCSI.ReadCapabilities.Blocks * report.SCSI.ReadCapabilities.BlockSize) / 1024 / 1024:F2} MiB"); } if(report.SCSI.ReadCapabilities.MediumTypeSpecified) @@ -508,7 +510,7 @@ namespace DiscImageChef.Server TestedMedia.Report(testedMedia, ata, ref mediaOneValue); if(mediaOneValue.Count > 0) { - divTestedMedia.Visible = true; + divTestedMedia.Visible = true; repTestedMedia.DataSource = mediaOneValue; repTestedMedia.DataBind(); } @@ -519,16 +521,16 @@ namespace DiscImageChef.Server catch(Exception) { content.InnerHtml = "Could not load device report"; -#if DEBUG + #if DEBUG throw; -#endif + #endif } } - static void GetUsbDescriptions(ushort vendor, ushort product, out string vendorDescription, + static void GetUsbDescriptions(ushort vendor, ushort product, out string vendorDescription, out string productDescription) { - vendorDescription = null; + vendorDescription = null; productDescription = null; if(!File.Exists(Path.Combine(HostingEnvironment.MapPath("~") ?? throw new InvalidOperationException(), @@ -560,6 +562,7 @@ namespace DiscImageChef.Server productDescription = line.Substring(7); return; } + // Skip products if(line[0] == '\t') continue; @@ -569,7 +572,7 @@ namespace DiscImageChef.Server if(number != vendor) continue; vendorDescription = line.Substring(6); - inManufacturer = true; + inManufacturer = true; } } } diff --git a/DiscImageChef.Tests.Devices/ATA/Ata48.cs b/DiscImageChef.Tests.Devices/ATA/Ata48.cs index 348c7bea2..2549626f5 100644 --- a/DiscImageChef.Tests.Devices/ATA/Ata48.cs +++ b/DiscImageChef.Tests.Devices/ATA/Ata48.cs @@ -104,8 +104,8 @@ namespace DiscImageChef.Tests.Devices.ATA DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("Sending GET NATIVE MAX ADDRESS EXT to the device:"); DicConsole.WriteLine("Command took {0} ms.", duration); - DicConsole.WriteLine("Sense is {0}.", sense); - DicConsole.WriteLine("Max LBA is {0}.", lba); + DicConsole.WriteLine("Sense is {0}.", sense); + DicConsole.WriteLine("Max LBA is {0}.", lba); DicConsole.WriteLine(); DicConsole.WriteLine("Choose what to do:"); DicConsole.WriteLine("1.- Decode error registers."); @@ -148,10 +148,10 @@ namespace DiscImageChef.Tests.Devices.ATA static void ReadDmaExt(string devPath, Device dev) { - ulong lba = 0; + ulong lba = 0; ushort count = 1; string strDev; - int item; + int item; parameters: while(true) @@ -159,7 +159,7 @@ namespace DiscImageChef.Tests.Devices.ATA System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("Parameters for READ DMA EXT command:"); - DicConsole.WriteLine("LBA: {0}", lba); + DicConsole.WriteLine("LBA: {0}", lba); DicConsole.WriteLine("Count: {0}", count); DicConsole.WriteLine(); DicConsole.WriteLine("Choose what to do:"); @@ -194,10 +194,11 @@ namespace DiscImageChef.Tests.Devices.ATA if(lba > 0xFFFFFFFFFFFF) { DicConsole - .WriteLine("Logical block address cannot be bigger than {0}. Setting it to {0}...", - 0xFFFFFFFFFFFF); + .WriteLine("Logical block address cannot be bigger than {0}. Setting it to {0}...", + 0xFFFFFFFFFFFF); lba = 0xFFFFFFFFFFFF; } + DicConsole.Write("How many sectors?: "); strDev = System.Console.ReadLine(); if(!ushort.TryParse(strDev, out count)) @@ -220,9 +221,9 @@ namespace DiscImageChef.Tests.Devices.ATA menu: DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("Sending READ DMA EXT to the device:"); - DicConsole.WriteLine("Command took {0} ms.", duration); - DicConsole.WriteLine("Sense is {0}.", sense); - DicConsole.WriteLine("Buffer is {0} bytes.", buffer?.Length.ToString() ?? "null"); + DicConsole.WriteLine("Command took {0} ms.", duration); + DicConsole.WriteLine("Sense is {0}.", sense); + DicConsole.WriteLine("Buffer is {0} bytes.", buffer?.Length.ToString() ?? "null"); DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer)); DicConsole.WriteLine(); DicConsole.WriteLine("Choose what to do:"); @@ -279,11 +280,11 @@ namespace DiscImageChef.Tests.Devices.ATA static void ReadLogExt(string devPath, Device dev) { - byte address = 0; - ushort page = 0; - ushort count = 1; + byte address = 0; + ushort page = 0; + ushort count = 1; string strDev; - int item; + int item; parameters: while(true) @@ -293,7 +294,7 @@ namespace DiscImageChef.Tests.Devices.ATA DicConsole.WriteLine("Parameters for READ LOG EXT command:"); DicConsole.WriteLine("Log address: {0}", address); DicConsole.WriteLine("Page number: {0}", page); - DicConsole.WriteLine("Count: {0}", count); + DicConsole.WriteLine("Count: {0}", count); DicConsole.WriteLine(); DicConsole.WriteLine("Choose what to do:"); DicConsole.WriteLine("1.- Change parameters."); @@ -356,9 +357,9 @@ namespace DiscImageChef.Tests.Devices.ATA menu: DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("Sending READ LOG EXT to the device:"); - DicConsole.WriteLine("Command took {0} ms.", duration); - DicConsole.WriteLine("Sense is {0}.", sense); - DicConsole.WriteLine("Buffer is {0} bytes.", buffer?.Length.ToString() ?? "null"); + DicConsole.WriteLine("Command took {0} ms.", duration); + DicConsole.WriteLine("Sense is {0}.", sense); + DicConsole.WriteLine("Buffer is {0} bytes.", buffer?.Length.ToString() ?? "null"); DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer)); DicConsole.WriteLine(); DicConsole.WriteLine("Choose what to do:"); @@ -415,11 +416,11 @@ namespace DiscImageChef.Tests.Devices.ATA static void ReadLogDmaExt(string devPath, Device dev) { - byte address = 0; - ushort page = 0; - ushort count = 1; + byte address = 0; + ushort page = 0; + ushort count = 1; string strDev; - int item; + int item; parameters: while(true) @@ -429,7 +430,7 @@ namespace DiscImageChef.Tests.Devices.ATA DicConsole.WriteLine("Parameters for READ LOG DMA EXT command:"); DicConsole.WriteLine("Log address: {0}", address); DicConsole.WriteLine("Page number: {0}", page); - DicConsole.WriteLine("Count: {0}", count); + DicConsole.WriteLine("Count: {0}", count); DicConsole.WriteLine(); DicConsole.WriteLine("Choose what to do:"); DicConsole.WriteLine("1.- Change parameters."); @@ -492,9 +493,9 @@ namespace DiscImageChef.Tests.Devices.ATA menu: DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("Sending READ LOG DMA EXT to the device:"); - DicConsole.WriteLine("Command took {0} ms.", duration); - DicConsole.WriteLine("Sense is {0}.", sense); - DicConsole.WriteLine("Buffer is {0} bytes.", buffer?.Length.ToString() ?? "null"); + DicConsole.WriteLine("Command took {0} ms.", duration); + DicConsole.WriteLine("Sense is {0}.", sense); + DicConsole.WriteLine("Buffer is {0} bytes.", buffer?.Length.ToString() ?? "null"); DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer)); DicConsole.WriteLine(); DicConsole.WriteLine("Choose what to do:"); @@ -551,10 +552,10 @@ namespace DiscImageChef.Tests.Devices.ATA static void ReadMultipleExt(string devPath, Device dev) { - ulong lba = 0; + ulong lba = 0; ushort count = 1; string strDev; - int item; + int item; parameters: while(true) @@ -562,7 +563,7 @@ namespace DiscImageChef.Tests.Devices.ATA System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("Parameters for READ MULTIPLE EXT command:"); - DicConsole.WriteLine("LBA: {0}", lba); + DicConsole.WriteLine("LBA: {0}", lba); DicConsole.WriteLine("Count: {0}", count); DicConsole.WriteLine(); DicConsole.WriteLine("Choose what to do:"); @@ -597,10 +598,11 @@ namespace DiscImageChef.Tests.Devices.ATA if(lba > 0xFFFFFFFFFFFF) { DicConsole - .WriteLine("Logical block address cannot be bigger than {0}. Setting it to {0}...", - 0xFFFFFFFFFFFF); + .WriteLine("Logical block address cannot be bigger than {0}. Setting it to {0}...", + 0xFFFFFFFFFFFF); lba = 0xFFFFFFFFFFFF; } + DicConsole.Write("How many sectors?: "); strDev = System.Console.ReadLine(); if(!ushort.TryParse(strDev, out count)) @@ -623,9 +625,9 @@ namespace DiscImageChef.Tests.Devices.ATA menu: DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("Sending READ MULTIPLE EXT to the device:"); - DicConsole.WriteLine("Command took {0} ms.", duration); - DicConsole.WriteLine("Sense is {0}.", sense); - DicConsole.WriteLine("Buffer is {0} bytes.", buffer?.Length.ToString() ?? "null"); + DicConsole.WriteLine("Command took {0} ms.", duration); + DicConsole.WriteLine("Sense is {0}.", sense); + DicConsole.WriteLine("Buffer is {0} bytes.", buffer?.Length.ToString() ?? "null"); DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer)); DicConsole.WriteLine(); DicConsole.WriteLine("Choose what to do:"); @@ -691,8 +693,8 @@ namespace DiscImageChef.Tests.Devices.ATA DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("Sending READ NATIVE MAX ADDRESS EXT to the device:"); DicConsole.WriteLine("Command took {0} ms.", duration); - DicConsole.WriteLine("Sense is {0}.", sense); - DicConsole.WriteLine("Max LBA is {0}.", lba); + DicConsole.WriteLine("Sense is {0}.", sense); + DicConsole.WriteLine("Max LBA is {0}.", lba); DicConsole.WriteLine(); DicConsole.WriteLine("Choose what to do:"); DicConsole.WriteLine("1.- Decode error registers."); @@ -735,10 +737,10 @@ namespace DiscImageChef.Tests.Devices.ATA static void ReadSectorsExt(string devPath, Device dev) { - ulong lba = 0; + ulong lba = 0; ushort count = 1; string strDev; - int item; + int item; parameters: while(true) @@ -746,7 +748,7 @@ namespace DiscImageChef.Tests.Devices.ATA System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("Parameters for READ SECTORS EXT command:"); - DicConsole.WriteLine("LBA: {0}", lba); + DicConsole.WriteLine("LBA: {0}", lba); DicConsole.WriteLine("Count: {0}", count); DicConsole.WriteLine(); DicConsole.WriteLine("Choose what to do:"); @@ -781,10 +783,11 @@ namespace DiscImageChef.Tests.Devices.ATA if(lba > 0xFFFFFFFFFFFF) { DicConsole - .WriteLine("Logical block address cannot be bigger than {0}. Setting it to {0}...", - 0xFFFFFFFFFFFF); + .WriteLine("Logical block address cannot be bigger than {0}. Setting it to {0}...", + 0xFFFFFFFFFFFF); lba = 0xFFFFFFFFFFFF; } + DicConsole.Write("How many sectors?: "); strDev = System.Console.ReadLine(); if(!ushort.TryParse(strDev, out count)) @@ -807,9 +810,9 @@ namespace DiscImageChef.Tests.Devices.ATA menu: DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("Sending READ SECTORS EXT to the device:"); - DicConsole.WriteLine("Command took {0} ms.", duration); - DicConsole.WriteLine("Sense is {0}.", sense); - DicConsole.WriteLine("Buffer is {0} bytes.", buffer?.Length.ToString() ?? "null"); + DicConsole.WriteLine("Command took {0} ms.", duration); + DicConsole.WriteLine("Sense is {0}.", sense); + DicConsole.WriteLine("Buffer is {0} bytes.", buffer?.Length.ToString() ?? "null"); DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer)); DicConsole.WriteLine(); DicConsole.WriteLine("Choose what to do:"); diff --git a/DiscImageChef.Tests.Devices/ATA/Atapi.cs b/DiscImageChef.Tests.Devices/ATA/Atapi.cs index 1bbb8418f..c70ee4ecd 100644 --- a/DiscImageChef.Tests.Devices/ATA/Atapi.cs +++ b/DiscImageChef.Tests.Devices/ATA/Atapi.cs @@ -79,9 +79,9 @@ namespace DiscImageChef.Tests.Devices.ATA menu: DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("Sending IDENTIFY PACKET DEVICE to the device:"); - DicConsole.WriteLine("Command took {0} ms.", duration); - DicConsole.WriteLine("Sense is {0}.", sense); - DicConsole.WriteLine("Buffer is {0} bytes.", buffer?.Length.ToString() ?? "null"); + DicConsole.WriteLine("Command took {0} ms.", duration); + DicConsole.WriteLine("Sense is {0}.", sense); + DicConsole.WriteLine("Buffer is {0} bytes.", buffer?.Length.ToString() ?? "null"); DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer)); DicConsole.WriteLine(); DicConsole.WriteLine("Choose what to do:"); diff --git a/DiscImageChef.Tests.Devices/ATA/Cfa.cs b/DiscImageChef.Tests.Devices/ATA/Cfa.cs index eb2ec7593..ac5181a94 100644 --- a/DiscImageChef.Tests.Devices/ATA/Cfa.cs +++ b/DiscImageChef.Tests.Devices/ATA/Cfa.cs @@ -88,8 +88,8 @@ namespace DiscImageChef.Tests.Devices.ATA DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("Sending REQUEST EXTENDED ERROR CODE to the device:"); DicConsole.WriteLine("Command took {0} ms.", duration); - DicConsole.WriteLine("Sense is {0}.", sense); - DicConsole.WriteLine("Error code is {0}.", errorCode); + DicConsole.WriteLine("Sense is {0}.", sense); + DicConsole.WriteLine("Error code is {0}.", errorCode); DicConsole.WriteLine(); DicConsole.WriteLine("Choose what to do:"); DicConsole.WriteLine("1.- Decode error registers."); @@ -133,10 +133,10 @@ namespace DiscImageChef.Tests.Devices.ATA static void TranslateSectorChs(string devPath, Device dev) { ushort cylinder = 0; - byte head = 0; - byte sector = 1; + byte head = 0; + byte sector = 1; string strDev; - int item; + int item; parameters: while(true) @@ -145,8 +145,8 @@ namespace DiscImageChef.Tests.Devices.ATA DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("Parameters for TRANSLATE SECTOR command:"); DicConsole.WriteLine("Cylinder: {0}", cylinder); - DicConsole.WriteLine("Head: {0}", head); - DicConsole.WriteLine("Sector: {0}", sector); + DicConsole.WriteLine("Head: {0}", head); + DicConsole.WriteLine("Sector: {0}", sector); DicConsole.WriteLine(); DicConsole.WriteLine("Choose what to do:"); DicConsole.WriteLine("1.- Change parameters."); @@ -192,6 +192,7 @@ namespace DiscImageChef.Tests.Devices.ATA DicConsole.WriteLine("Head cannot be bigger than 15. Setting it to 15..."); head = 15; } + DicConsole.Write("What sector?: "); strDev = System.Console.ReadLine(); if(!byte.TryParse(strDev, out sector)) @@ -214,9 +215,9 @@ namespace DiscImageChef.Tests.Devices.ATA menu: DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("Sending TRANSLATE SECTOR to the device:"); - DicConsole.WriteLine("Command took {0} ms.", duration); - DicConsole.WriteLine("Sense is {0}.", sense); - DicConsole.WriteLine("Buffer is {0} bytes.", buffer?.Length.ToString() ?? "null"); + DicConsole.WriteLine("Command took {0} ms.", duration); + DicConsole.WriteLine("Sense is {0}.", sense); + DicConsole.WriteLine("Buffer is {0} bytes.", buffer?.Length.ToString() ?? "null"); DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer)); DicConsole.WriteLine(); DicConsole.WriteLine("Choose what to do:"); @@ -273,9 +274,9 @@ namespace DiscImageChef.Tests.Devices.ATA static void TranslateSectorLba(string devPath, Device dev) { - uint lba = 0; + uint lba = 0; string strDev; - int item; + int item; parameters: while(true) @@ -317,10 +318,11 @@ namespace DiscImageChef.Tests.Devices.ATA if(lba > 0xFFFFFFF) { DicConsole - .WriteLine("Logical block address cannot be bigger than {0}. Setting it to {0}...", - 0xFFFFFFF); + .WriteLine("Logical block address cannot be bigger than {0}. Setting it to {0}...", + 0xFFFFFFF); lba = 0xFFFFFFF; } + break; case 2: goto start; } @@ -334,9 +336,9 @@ namespace DiscImageChef.Tests.Devices.ATA menu: DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("Sending TRANSLATE SECTOR to the device:"); - DicConsole.WriteLine("Command took {0} ms.", duration); - DicConsole.WriteLine("Sense is {0}.", sense); - DicConsole.WriteLine("Buffer is {0} bytes.", buffer?.Length.ToString() ?? "null"); + DicConsole.WriteLine("Command took {0} ms.", duration); + DicConsole.WriteLine("Sense is {0}.", sense); + DicConsole.WriteLine("Buffer is {0} bytes.", buffer?.Length.ToString() ?? "null"); DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer)); DicConsole.WriteLine(); DicConsole.WriteLine("Choose what to do:"); diff --git a/DiscImageChef.Tests.Devices/ATA/MCPT.cs b/DiscImageChef.Tests.Devices/ATA/MCPT.cs index d1036d7ec..129f2ef53 100644 --- a/DiscImageChef.Tests.Devices/ATA/MCPT.cs +++ b/DiscImageChef.Tests.Devices/ATA/MCPT.cs @@ -71,9 +71,9 @@ namespace DiscImageChef.Tests.Devices.ATA static void CheckMediaCardType(string devPath, Device dev) { - byte feature = 0; + byte feature = 0; string strDev; - int item; + int item; parameters: while(true) @@ -125,7 +125,7 @@ namespace DiscImageChef.Tests.Devices.ATA DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("Sending CHECK MEDIA CARD TYPE to the device:"); DicConsole.WriteLine("Command took {0} ms.", duration); - DicConsole.WriteLine("Sense is {0}.", sense); + DicConsole.WriteLine("Sense is {0}.", sense); DicConsole.WriteLine("CHECK MEDIA CARD TYPE status registers:"); DicConsole.Write("{0}", MainClass.DecodeAtaRegisters(errorRegisters)); DicConsole.WriteLine(); diff --git a/DiscImageChef.Tests.Devices/ATA/Smart.cs b/DiscImageChef.Tests.Devices/ATA/Smart.cs index 7123b0512..ed04e47ce 100644 --- a/DiscImageChef.Tests.Devices/ATA/Smart.cs +++ b/DiscImageChef.Tests.Devices/ATA/Smart.cs @@ -109,7 +109,7 @@ namespace DiscImageChef.Tests.Devices.ATA DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("Sending DISABLE ATTRIBUTE AUTOSAVE to the device:"); DicConsole.WriteLine("Command took {0} ms.", duration); - DicConsole.WriteLine("Sense is {0}.", sense); + DicConsole.WriteLine("Sense is {0}.", sense); DicConsole.WriteLine("DISABLE ATTRIBUTE AUTOSAVE status registers:"); DicConsole.Write("{0}", MainClass.DecodeAtaRegisters(errorRegisters)); DicConsole.WriteLine(); @@ -151,7 +151,7 @@ namespace DiscImageChef.Tests.Devices.ATA DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("Sending DISABLE OPERATIONS to the device:"); DicConsole.WriteLine("Command took {0} ms.", duration); - DicConsole.WriteLine("Sense is {0}.", sense); + DicConsole.WriteLine("Sense is {0}.", sense); DicConsole.WriteLine("DISABLE OPERATIONS status registers:"); DicConsole.Write("{0}", MainClass.DecodeAtaRegisters(errorRegisters)); DicConsole.WriteLine(); @@ -195,7 +195,7 @@ namespace DiscImageChef.Tests.Devices.ATA DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("Sending ENABLE ATTRIBUTE AUTOSAVE to the device:"); DicConsole.WriteLine("Command took {0} ms.", duration); - DicConsole.WriteLine("Sense is {0}.", sense); + DicConsole.WriteLine("Sense is {0}.", sense); DicConsole.WriteLine("ENABLE ATTRIBUTE AUTOSAVE status registers:"); DicConsole.Write("{0}", MainClass.DecodeAtaRegisters(errorRegisters)); DicConsole.WriteLine(); @@ -237,7 +237,7 @@ namespace DiscImageChef.Tests.Devices.ATA DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("Sending ENABLE OPERATIONS to the device:"); DicConsole.WriteLine("Command took {0} ms.", duration); - DicConsole.WriteLine("Sense is {0}.", sense); + DicConsole.WriteLine("Sense is {0}.", sense); DicConsole.WriteLine("ENABLE OPERATIONS status registers:"); DicConsole.Write("{0}", MainClass.DecodeAtaRegisters(errorRegisters)); DicConsole.WriteLine(); @@ -271,9 +271,9 @@ namespace DiscImageChef.Tests.Devices.ATA static void ExecuteOfflineImmediate(string devPath, Device dev) { - byte subcommand = 0; + byte subcommand = 0; string strDev; - int item; + int item; parameters: while(true) @@ -325,7 +325,7 @@ namespace DiscImageChef.Tests.Devices.ATA DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("Sending EXECUTE OFF-LINE IMMEDIATE to the device:"); DicConsole.WriteLine("Command took {0} ms.", duration); - DicConsole.WriteLine("Sense is {0}.", sense); + DicConsole.WriteLine("Sense is {0}.", sense); DicConsole.WriteLine("EXECUTE OFF-LINE IMMEDIATE status registers:"); DicConsole.Write("{0}", MainClass.DecodeAtaRegisters(errorRegisters)); DicConsole.WriteLine(); @@ -369,9 +369,9 @@ namespace DiscImageChef.Tests.Devices.ATA menu: DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("Sending READ DATA to the device:"); - DicConsole.WriteLine("Command took {0} ms.", duration); - DicConsole.WriteLine("Sense is {0}.", sense); - DicConsole.WriteLine("Buffer is {0} bytes.", buffer?.Length.ToString() ?? "null"); + DicConsole.WriteLine("Command took {0} ms.", duration); + DicConsole.WriteLine("Sense is {0}.", sense); + DicConsole.WriteLine("Buffer is {0} bytes.", buffer?.Length.ToString() ?? "null"); DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer)); DicConsole.WriteLine(); DicConsole.WriteLine("Choose what to do:"); @@ -426,9 +426,9 @@ namespace DiscImageChef.Tests.Devices.ATA static void ReadLog(string devPath, Device dev) { - byte address = 0; + byte address = 0; string strDev; - int item; + int item; parameters: while(true) @@ -479,9 +479,9 @@ namespace DiscImageChef.Tests.Devices.ATA menu: DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("Sending READ LOG to the device:"); - DicConsole.WriteLine("Command took {0} ms.", duration); - DicConsole.WriteLine("Sense is {0}.", sense); - DicConsole.WriteLine("Buffer is {0} bytes.", buffer?.Length.ToString() ?? "null"); + DicConsole.WriteLine("Command took {0} ms.", duration); + DicConsole.WriteLine("Sense is {0}.", sense); + DicConsole.WriteLine("Buffer is {0} bytes.", buffer?.Length.ToString() ?? "null"); DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer)); DicConsole.WriteLine(); DicConsole.WriteLine("Choose what to do:"); @@ -547,7 +547,7 @@ namespace DiscImageChef.Tests.Devices.ATA DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("Sending RETURN STATUS to the device:"); DicConsole.WriteLine("Command took {0} ms.", duration); - DicConsole.WriteLine("Sense is {0}.", sense); + DicConsole.WriteLine("Sense is {0}.", sense); DicConsole.WriteLine("RETURN STATUS status registers:"); DicConsole.Write("{0}", MainClass.DecodeAtaRegisters(errorRegisters)); DicConsole.WriteLine(); diff --git a/DiscImageChef.Tests.Devices/DecodeATARegisters.cs b/DiscImageChef.Tests.Devices/DecodeATARegisters.cs index f3b8d9477..4d786a369 100644 --- a/DiscImageChef.Tests.Devices/DecodeATARegisters.cs +++ b/DiscImageChef.Tests.Devices/DecodeATARegisters.cs @@ -42,10 +42,10 @@ namespace DiscImageChef.Tests.Devices 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 & 0x8) == 0x8) ret += "DRQ "; + if((status & 0x4) == 0x4) ret += "CORR "; + if((status & 0x2) == 0x2) ret += "IDX "; + if((status & 0x1) == 0x1) ret += "ERR "; return ret; } @@ -58,10 +58,10 @@ namespace DiscImageChef.Tests.Devices 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 & 0x8) == 0x8) ret += "MCR "; + if((status & 0x4) == 0x4) ret += "ABRT "; + if((status & 0x2) == 0x2) ret += "TK0NF "; + if((status & 0x1) == 0x1) ret += "AMNF "; return ret; } @@ -105,8 +105,9 @@ namespace DiscImageChef.Tests.Devices 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) * 0x100000000000 + - registers.LbaHigh * (ulong)0x100000000L + (ulong)(registers.LbaMid << 16) + + (ulong)(registers.DeviceHead & 0xF) * 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(); diff --git a/DiscImageChef.Tests.Devices/Device.cs b/DiscImageChef.Tests.Devices/Device.cs index 7ff7056f0..c8a35c407 100644 --- a/DiscImageChef.Tests.Devices/Device.cs +++ b/DiscImageChef.Tests.Devices/Device.cs @@ -42,35 +42,35 @@ namespace DiscImageChef.Tests.Devices while(true) { - DicConsole.WriteLine("dev.PlatformID = {0}", dev.PlatformId); - DicConsole.WriteLine("dev.FileHandle = {0}", dev.FileHandle); - DicConsole.WriteLine("dev.Timeout = {0}", dev.Timeout); - DicConsole.WriteLine("dev.Error = {0}", dev.Error); - DicConsole.WriteLine("dev.LastError = {0}", dev.LastError); - DicConsole.WriteLine("dev.Type = {0}", dev.Type); - DicConsole.WriteLine("dev.Manufacturer = \"{0}\"", dev.Manufacturer); - DicConsole.WriteLine("dev.Model = \"{0}\"", dev.Model); - DicConsole.WriteLine("dev.Revision = \"{0}\"", dev.Revision); - DicConsole.WriteLine("dev.Serial = \"{0}\"", dev.Serial); - DicConsole.WriteLine("dev.SCSIType = {0}", dev.ScsiType); - DicConsole.WriteLine("dev.IsRemovable = {0}", dev.IsRemovable); - DicConsole.WriteLine("dev.IsUSB = {0}", dev.IsUsb); - DicConsole.WriteLine("dev.USBVendorID = 0x{0:X4}", dev.UsbVendorId); + DicConsole.WriteLine("dev.PlatformID = {0}", dev.PlatformId); + DicConsole.WriteLine("dev.FileHandle = {0}", dev.FileHandle); + DicConsole.WriteLine("dev.Timeout = {0}", dev.Timeout); + DicConsole.WriteLine("dev.Error = {0}", dev.Error); + DicConsole.WriteLine("dev.LastError = {0}", dev.LastError); + DicConsole.WriteLine("dev.Type = {0}", dev.Type); + DicConsole.WriteLine("dev.Manufacturer = \"{0}\"", dev.Manufacturer); + DicConsole.WriteLine("dev.Model = \"{0}\"", dev.Model); + DicConsole.WriteLine("dev.Revision = \"{0}\"", dev.Revision); + DicConsole.WriteLine("dev.Serial = \"{0}\"", dev.Serial); + DicConsole.WriteLine("dev.SCSIType = {0}", dev.ScsiType); + DicConsole.WriteLine("dev.IsRemovable = {0}", dev.IsRemovable); + 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?.Length.ToString() ?? "null"); DicConsole.WriteLine("dev.USBManufacturerString = \"{0}\"", dev.UsbManufacturerString); - DicConsole.WriteLine("dev.USBProductString = \"{0}\"", dev.UsbProductString); - DicConsole.WriteLine("dev.USBSerialString = \"{0}\"", dev.UsbSerialString); - DicConsole.WriteLine("dev.IsFireWire = {0}", dev.IsFireWire); - DicConsole.WriteLine("dev.FireWireGUID = {0:X16}", dev.FireWireGuid); - DicConsole.WriteLine("dev.FireWireModel = 0x{0:X8}", dev.FireWireModel); - DicConsole.WriteLine("dev.FireWireModelName = \"{0}\"", dev.FireWireModelName); - DicConsole.WriteLine("dev.FireWireVendor = 0x{0:X8}", dev.FireWireVendor); - DicConsole.WriteLine("dev.FireWireVendorName = \"{0}\"", dev.FireWireVendorName); - DicConsole.WriteLine("dev.IsCompactFlash = {0}", dev.IsCompactFlash); - DicConsole.WriteLine("dev.IsPCMCIA = {0}", dev.IsPcmcia); - DicConsole.WriteLine("dev.CIS.Length = {0}", dev.Cis?.Length.ToString() ?? "null"); + DicConsole.WriteLine("dev.USBProductString = \"{0}\"", dev.UsbProductString); + DicConsole.WriteLine("dev.USBSerialString = \"{0}\"", dev.UsbSerialString); + DicConsole.WriteLine("dev.IsFireWire = {0}", dev.IsFireWire); + DicConsole.WriteLine("dev.FireWireGUID = {0:X16}", dev.FireWireGuid); + DicConsole.WriteLine("dev.FireWireModel = 0x{0:X8}", dev.FireWireModel); + DicConsole.WriteLine("dev.FireWireModelName = \"{0}\"", dev.FireWireModelName); + DicConsole.WriteLine("dev.FireWireVendor = 0x{0:X8}", dev.FireWireVendor); + DicConsole.WriteLine("dev.FireWireVendorName = \"{0}\"", dev.FireWireVendorName); + DicConsole.WriteLine("dev.IsCompactFlash = {0}", dev.IsCompactFlash); + DicConsole.WriteLine("dev.IsPCMCIA = {0}", dev.IsPcmcia); + DicConsole.WriteLine("dev.CIS.Length = {0}", dev.Cis?.Length.ToString() ?? "null"); DicConsole.WriteLine("Press any key to continue...", devPath); System.Console.ReadKey(); diff --git a/DiscImageChef.Tests.Devices/Main.cs b/DiscImageChef.Tests.Devices/Main.cs index 237f70714..716811514 100644 --- a/DiscImageChef.Tests.Devices/Main.cs +++ b/DiscImageChef.Tests.Devices/Main.cs @@ -36,10 +36,10 @@ namespace DiscImageChef.Tests.Devices { public static void Main() { - DicConsole.WriteLineEvent += System.Console.WriteLine; - DicConsole.WriteEvent += System.Console.Write; - DicConsole.ErrorWriteLineEvent += System.Console.Error.WriteLine; - DicConsole.DebugWriteLineEvent += System.Console.Error.WriteLine; + DicConsole.WriteLineEvent += System.Console.WriteLine; + DicConsole.WriteEvent += System.Console.Write; + DicConsole.ErrorWriteLineEvent += System.Console.Error.WriteLine; + DicConsole.DebugWriteLineEvent += System.Console.Error.WriteLine; DicConsole.VerboseWriteLineEvent += System.Console.WriteLine; DeviceInfo[] devices = DiscImageChef.Devices.Device.ListDevices(); diff --git a/DiscImageChef.Tests.Devices/SCSI/Adaptec.cs b/DiscImageChef.Tests.Devices/SCSI/Adaptec.cs index 63f6bf94c..fbb3ae525 100644 --- a/DiscImageChef.Tests.Devices/SCSI/Adaptec.cs +++ b/DiscImageChef.Tests.Devices/SCSI/Adaptec.cs @@ -83,9 +83,9 @@ namespace DiscImageChef.Tests.Devices.SCSI static void ReadResetUsageCounter(string devPath, Device dev) { - bool drive1 = false; + bool drive1 = false; string strDev; - int item; + int item; parameters: while(true) @@ -136,11 +136,11 @@ namespace DiscImageChef.Tests.Devices.SCSI 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?.Length.ToString() ?? "null"); - DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer)); - DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer?.Length.ToString() ?? "null"); + DicConsole.WriteLine("Command took {0} ms.", duration); + DicConsole.WriteLine("Sense is {0}.", sense); + DicConsole.WriteLine("Buffer is {0} bytes.", buffer?.Length.ToString() ?? "null"); + DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer)); + DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer?.Length.ToString() ?? "null"); DicConsole.WriteLine("Sense buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(senseBuffer)); DicConsole.WriteLine(); DicConsole.WriteLine("Choose what to do:"); @@ -216,11 +216,11 @@ namespace DiscImageChef.Tests.Devices.SCSI 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?.Length.ToString() ?? "null"); - DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer)); - DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer?.Length.ToString() ?? "null"); + DicConsole.WriteLine("Command took {0} ms.", duration); + DicConsole.WriteLine("Sense is {0}.", sense); + DicConsole.WriteLine("Buffer is {0} bytes.", buffer?.Length.ToString() ?? "null"); + DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer)); + DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer?.Length.ToString() ?? "null"); DicConsole.WriteLine("Sense buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(senseBuffer)); DicConsole.WriteLine(); DicConsole.WriteLine("Choose what to do:"); @@ -286,10 +286,10 @@ namespace DiscImageChef.Tests.Devices.SCSI static void SetErrorThreshold(string devPath, Device dev) { - bool drive1 = false; - byte threshold = 0; + bool drive1 = false; + byte threshold = 0; string strDev; - int item; + int item; parameters: while(true) @@ -297,7 +297,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("Parameters for SET ERROR THRESHOLD command:"); - DicConsole.WriteLine("Drive 1?: {0}", drive1); + DicConsole.WriteLine("Drive 1?: {0}", drive1); DicConsole.WriteLine("Error threshold: {0}", threshold); DicConsole.WriteLine(); DicConsole.WriteLine("Choose what to do:"); @@ -352,9 +352,9 @@ namespace DiscImageChef.Tests.Devices.SCSI 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?.Length.ToString() ?? "null"); + DicConsole.WriteLine("Command took {0} ms.", duration); + DicConsole.WriteLine("Sense is {0}.", sense); + DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer?.Length.ToString() ?? "null"); DicConsole.WriteLine("Sense buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(senseBuffer)); DicConsole.WriteLine("SET ERROR THRESHOLD decoded sense:"); DicConsole.Write("{0}", Sense.PrettifySense(senseBuffer)); @@ -402,10 +402,10 @@ namespace DiscImageChef.Tests.Devices.SCSI static void Translate(string devPath, Device dev) { - bool drive1 = false; - uint lba = 0; + bool drive1 = false; + uint lba = 0; string strDev; - int item; + int item; parameters: while(true) @@ -414,7 +414,7 @@ namespace DiscImageChef.Tests.Devices.SCSI DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("Parameters for TRANSLATE command:"); DicConsole.WriteLine("Drive 1?: {0}", drive1); - DicConsole.WriteLine("LBA: {0}", lba); + DicConsole.WriteLine("LBA: {0}", lba); DicConsole.WriteLine(); DicConsole.WriteLine("Choose what to do:"); DicConsole.WriteLine("1.- Change parameters."); @@ -467,11 +467,11 @@ namespace DiscImageChef.Tests.Devices.SCSI 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?.Length.ToString() ?? "null"); - DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer)); - DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer?.Length.ToString() ?? "null"); + DicConsole.WriteLine("Command took {0} ms.", duration); + DicConsole.WriteLine("Sense is {0}.", sense); + DicConsole.WriteLine("Buffer is {0} bytes.", buffer?.Length.ToString() ?? "null"); + DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer)); + DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer?.Length.ToString() ?? "null"); DicConsole.WriteLine("Sense buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(senseBuffer)); DicConsole.WriteLine(); DicConsole.WriteLine("Choose what to do:"); diff --git a/DiscImageChef.Tests.Devices/SCSI/ArchiveCorp.cs b/DiscImageChef.Tests.Devices/SCSI/ArchiveCorp.cs index c14f48db5..27f5cc33c 100644 --- a/DiscImageChef.Tests.Devices/SCSI/ArchiveCorp.cs +++ b/DiscImageChef.Tests.Devices/SCSI/ArchiveCorp.cs @@ -75,9 +75,9 @@ namespace DiscImageChef.Tests.Devices.SCSI static void RequestBlockAddress(string devPath, Device dev) { - uint lba = 0; + uint lba = 0; string strDev; - int item; + int item; parameters: while(true) @@ -128,11 +128,11 @@ namespace DiscImageChef.Tests.Devices.SCSI 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?.Length.ToString() ?? "null"); - DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer)); - DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer?.Length.ToString() ?? "null"); + DicConsole.WriteLine("Command took {0} ms.", duration); + DicConsole.WriteLine("Sense is {0}.", sense); + DicConsole.WriteLine("Buffer is {0} bytes.", buffer?.Length.ToString() ?? "null"); + DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer)); + DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer?.Length.ToString() ?? "null"); DicConsole.WriteLine("Sense buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(senseBuffer)); DicConsole.WriteLine(); DicConsole.WriteLine("Choose what to do:"); @@ -200,10 +200,10 @@ namespace DiscImageChef.Tests.Devices.SCSI static void SeekBlock(string devPath, Device dev) { - bool immediate = false; - uint lba = 0; + bool immediate = false; + uint lba = 0; string strDev; - int item; + int item; parameters: while(true) @@ -212,7 +212,7 @@ namespace DiscImageChef.Tests.Devices.SCSI DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("Parameters for SEEK BLOCK command:"); DicConsole.WriteLine("Immediate?: {0}", immediate); - DicConsole.WriteLine("LBA: {0}", lba); + DicConsole.WriteLine("LBA: {0}", lba); DicConsole.WriteLine(); DicConsole.WriteLine("Choose what to do:"); DicConsole.WriteLine("1.- Change parameters."); @@ -265,9 +265,9 @@ namespace DiscImageChef.Tests.Devices.SCSI 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?.Length.ToString() ?? "null"); + DicConsole.WriteLine("Command took {0} ms.", duration); + DicConsole.WriteLine("Sense is {0}.", sense); + DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer?.Length.ToString() ?? "null"); DicConsole.WriteLine("Sense buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(senseBuffer)); DicConsole.WriteLine("SEEK BLOCK decoded sense:"); DicConsole.Write("{0}", Sense.PrettifySense(senseBuffer)); diff --git a/DiscImageChef.Tests.Devices/SCSI/Certance.cs b/DiscImageChef.Tests.Devices/SCSI/Certance.cs index 282968801..01bc8db31 100644 --- a/DiscImageChef.Tests.Devices/SCSI/Certance.cs +++ b/DiscImageChef.Tests.Devices/SCSI/Certance.cs @@ -82,9 +82,9 @@ namespace DiscImageChef.Tests.Devices.SCSI 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?.Length.ToString() ?? "null"); + DicConsole.WriteLine("Command took {0} ms.", duration); + DicConsole.WriteLine("Sense is {0}.", sense); + DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer?.Length.ToString() ?? "null"); DicConsole.WriteLine("Sense buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(senseBuffer)); DicConsole.WriteLine("PARK decoded sense:"); DicConsole.Write("{0}", Sense.PrettifySense(senseBuffer)); @@ -137,9 +137,9 @@ namespace DiscImageChef.Tests.Devices.SCSI 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?.Length.ToString() ?? "null"); + DicConsole.WriteLine("Command took {0} ms.", duration); + DicConsole.WriteLine("Sense is {0}.", sense); + DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer?.Length.ToString() ?? "null"); DicConsole.WriteLine("Sense buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(senseBuffer)); DicConsole.WriteLine("UNPARK decoded sense:"); DicConsole.Write("{0}", Sense.PrettifySense(senseBuffer)); diff --git a/DiscImageChef.Tests.Devices/SCSI/Fujitsu.cs b/DiscImageChef.Tests.Devices/SCSI/Fujitsu.cs index 40aaafdbf..a2dc91696 100644 --- a/DiscImageChef.Tests.Devices/SCSI/Fujitsu.cs +++ b/DiscImageChef.Tests.Devices/SCSI/Fujitsu.cs @@ -72,12 +72,12 @@ namespace DiscImageChef.Tests.Devices.SCSI static void Display(string devPath, Device dev) { - bool flash = false; - FujitsuDisplayModes mode = FujitsuDisplayModes.Ready; - string firstHalf = "DIC TEST"; - string secondHalf = "TEST DIC"; - string strDev; - int item; + bool flash = false; + FujitsuDisplayModes mode = FujitsuDisplayModes.Ready; + string firstHalf = "DIC TEST"; + string secondHalf = "TEST DIC"; + string strDev; + int item; parameters: while(true) @@ -147,9 +147,9 @@ namespace DiscImageChef.Tests.Devices.SCSI 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?.Length.ToString() ?? "null"); + DicConsole.WriteLine("Command took {0} ms.", duration); + DicConsole.WriteLine("Sense is {0}.", sense); + DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer?.Length.ToString() ?? "null"); DicConsole.WriteLine("Sense buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(senseBuffer)); DicConsole.WriteLine("DISPLAY decoded sense:"); DicConsole.Write("{0}", Sense.PrettifySense(senseBuffer)); diff --git a/DiscImageChef.Tests.Devices/SCSI/HL-DT-ST.cs b/DiscImageChef.Tests.Devices/SCSI/HL-DT-ST.cs index cf5403729..5a2a9e728 100644 --- a/DiscImageChef.Tests.Devices/SCSI/HL-DT-ST.cs +++ b/DiscImageChef.Tests.Devices/SCSI/HL-DT-ST.cs @@ -71,10 +71,10 @@ namespace DiscImageChef.Tests.Devices.SCSI static void ReadDvdRaw(string devPath, Device dev) { - uint count = 1; - uint lba = 0; + uint count = 1; + uint lba = 0; string strDev; - int item; + int item; parameters: while(true) @@ -82,7 +82,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("Parameters for READ DVD (RAW) command:"); - DicConsole.WriteLine("LBA: {0}", lba); + DicConsole.WriteLine("LBA: {0}", lba); DicConsole.WriteLine("Count: {0}", count); DicConsole.WriteLine(); DicConsole.WriteLine("Choose what to do:"); @@ -136,11 +136,11 @@ namespace DiscImageChef.Tests.Devices.SCSI 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?.Length.ToString() ?? "null"); - DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer)); - DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer?.Length.ToString() ?? "null"); + DicConsole.WriteLine("Command took {0} ms.", duration); + DicConsole.WriteLine("Sense is {0}.", sense); + DicConsole.WriteLine("Buffer is {0} bytes.", buffer?.Length.ToString() ?? "null"); + DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer)); + DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer?.Length.ToString() ?? "null"); DicConsole.WriteLine("Sense buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(senseBuffer)); DicConsole.WriteLine(); DicConsole.WriteLine("Choose what to do:"); diff --git a/DiscImageChef.Tests.Devices/SCSI/HP.cs b/DiscImageChef.Tests.Devices/SCSI/HP.cs index 6232ded81..74d024a72 100644 --- a/DiscImageChef.Tests.Devices/SCSI/HP.cs +++ b/DiscImageChef.Tests.Devices/SCSI/HP.cs @@ -71,14 +71,14 @@ namespace DiscImageChef.Tests.Devices.SCSI static void ReadLong(string devPath, Device dev) { - bool relative = false; - uint address = 0; - ushort length = 1; - ushort bps = 512; - bool physical = false; - bool sectorCount = true; + bool relative = false; + uint address = 0; + ushort length = 1; + ushort bps = 512; + bool physical = false; + bool sectorCount = true; string strDev; - int item; + int item; parameters: while(true) @@ -87,8 +87,8 @@ namespace DiscImageChef.Tests.Devices.SCSI DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("Parameters for READ LONG command:"); 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"); + 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); DicConsole.WriteLine(); DicConsole.WriteLine("Choose what to do:"); @@ -185,11 +185,11 @@ namespace DiscImageChef.Tests.Devices.SCSI 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?.Length.ToString() ?? "null"); - DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer)); - DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer?.Length.ToString() ?? "null"); + DicConsole.WriteLine("Command took {0} ms.", duration); + DicConsole.WriteLine("Sense is {0}.", sense); + DicConsole.WriteLine("Buffer is {0} bytes.", buffer?.Length.ToString() ?? "null"); + DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer)); + DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer?.Length.ToString() ?? "null"); DicConsole.WriteLine("Sense buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(senseBuffer)); DicConsole.WriteLine(); DicConsole.WriteLine("Choose what to do:"); diff --git a/DiscImageChef.Tests.Devices/SCSI/Kreon.cs b/DiscImageChef.Tests.Devices/SCSI/Kreon.cs index b2e540dc8..b577f6483 100644 --- a/DiscImageChef.Tests.Devices/SCSI/Kreon.cs +++ b/DiscImageChef.Tests.Devices/SCSI/Kreon.cs @@ -84,9 +84,9 @@ namespace DiscImageChef.Tests.Devices.SCSI static void ExtractSecuritySectors(string devPath, Device dev) { - byte requestNumber = 0; + byte requestNumber = 0; string strDev; - int item; + int item; parameters: while(true) @@ -137,11 +137,11 @@ namespace DiscImageChef.Tests.Devices.SCSI 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?.Length.ToString() ?? "null"); - DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer)); - DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer?.Length.ToString() ?? "null"); + DicConsole.WriteLine("Command took {0} ms.", duration); + DicConsole.WriteLine("Sense is {0}.", sense); + DicConsole.WriteLine("Buffer is {0} bytes.", buffer?.Length.ToString() ?? "null"); + DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer)); + DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer?.Length.ToString() ?? "null"); DicConsole.WriteLine("Sense buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(senseBuffer)); DicConsole.WriteLine(); DicConsole.WriteLine("Choose what to do:"); @@ -217,11 +217,11 @@ namespace DiscImageChef.Tests.Devices.SCSI 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?.Length.ToString() ?? "null"); + DicConsole.WriteLine("Command took {0} ms.", duration); + DicConsole.WriteLine("Sense is {0}.", sense); + DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer?.Length.ToString() ?? "null"); DicConsole.WriteLine("Sense buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(senseBuffer)); - DicConsole.WriteLine("Features: {0}.", features); + DicConsole.WriteLine("Features: {0}.", features); DicConsole.WriteLine("GET FEATURE LIST decoded sense:"); DicConsole.Write("{0}", Sense.PrettifySense(senseBuffer)); DicConsole.WriteLine(); @@ -267,8 +267,8 @@ namespace DiscImageChef.Tests.Devices.SCSI static void SetLockState(string devPath, Device dev) { KreonLockStates state = KreonLockStates.Locked; - string strDev; - int item; + string strDev; + int item; parameters: while(true) @@ -322,7 +322,7 @@ namespace DiscImageChef.Tests.Devices.SCSI DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("Sending SET LOCK STATE to the device:"); DicConsole.WriteLine("Command took {0} ms.", duration); - DicConsole.WriteLine("Sense is {0}.", sense); + DicConsole.WriteLine("Sense is {0}.", sense); DicConsole.WriteLine("SET LOCK STATE decoded sense:"); DicConsole.Write("{0}", Sense.PrettifySense(senseBuffer)); DicConsole.WriteLine(); @@ -365,9 +365,9 @@ namespace DiscImageChef.Tests.Devices.SCSI 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?.Length.ToString() ?? "null"); + DicConsole.WriteLine("Command took {0} ms.", duration); + DicConsole.WriteLine("Sense is {0}.", sense); + DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer?.Length.ToString() ?? "null"); DicConsole.WriteLine("Sense buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(senseBuffer)); DicConsole.WriteLine("UNLOCK decoded sense:"); DicConsole.Write("{0}", Sense.PrettifySense(senseBuffer)); diff --git a/DiscImageChef.Tests.Devices/SCSI/MMC.cs b/DiscImageChef.Tests.Devices/SCSI/MMC.cs index 99dd34a94..ff97b504a 100644 --- a/DiscImageChef.Tests.Devices/SCSI/MMC.cs +++ b/DiscImageChef.Tests.Devices/SCSI/MMC.cs @@ -102,10 +102,10 @@ namespace DiscImageChef.Tests.Devices.SCSI static void GetConfiguration(string devPath, Device dev) { - MmcGetConfigurationRt rt = MmcGetConfigurationRt.All; - ushort startingFeatureNumber = 0; - string strDev; - int item; + MmcGetConfigurationRt rt = MmcGetConfigurationRt.All; + ushort startingFeatureNumber = 0; + string strDev; + int item; parameters: while(true) @@ -113,7 +113,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("Parameters for GET CONFIGURATION command:"); - DicConsole.WriteLine("RT: {0}", rt); + DicConsole.WriteLine("RT: {0}", rt); DicConsole.WriteLine("Feature number: {0}", startingFeatureNumber); DicConsole.WriteLine(); DicConsole.WriteLine("Choose what to do:"); @@ -171,11 +171,11 @@ namespace DiscImageChef.Tests.Devices.SCSI 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?.Length.ToString() ?? "null"); - DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer)); - DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer?.Length.ToString() ?? "null"); + DicConsole.WriteLine("Command took {0} ms.", duration); + DicConsole.WriteLine("Sense is {0}.", sense); + DicConsole.WriteLine("Buffer is {0} bytes.", buffer?.Length.ToString() ?? "null"); + DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer)); + DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer?.Length.ToString() ?? "null"); DicConsole.WriteLine("Sense buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(senseBuffer)); DicConsole.WriteLine(); DicConsole.WriteLine("Choose what to do:"); @@ -219,7 +219,7 @@ namespace DiscImageChef.Tests.Devices.SCSI if(buffer != null) { Features.SeparatedFeatures ftr = Features.Separate(buffer); - DicConsole.WriteLine("GET CONFIGURATION length is {0} bytes", ftr.DataLength); + DicConsole.WriteLine("GET CONFIGURATION length is {0} bytes", ftr.DataLength); DicConsole.WriteLine("GET CONFIGURATION current profile is {0:X4}h", ftr.CurrentProfile); if(ftr.Descriptors != null) foreach(Features.FeatureDescriptor desc in ftr.Descriptors) @@ -505,10 +505,10 @@ namespace DiscImageChef.Tests.Devices.SCSI static void PreventAllowMediumRemoval(string devPath, Device dev) { - bool prevent = false; - bool persistent = false; + bool prevent = false; + bool persistent = false; string strDev; - int item; + int item; parameters: while(true) @@ -516,7 +516,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("Parameters for PREVENT ALLOW MEDIUM REMOVAL command:"); - DicConsole.WriteLine("Prevent removal?: {0}", prevent); + DicConsole.WriteLine("Prevent removal?: {0}", prevent); DicConsole.WriteLine("Persistent value?: {0}", persistent); DicConsole.WriteLine(); DicConsole.WriteLine("Choose what to do:"); @@ -570,9 +570,9 @@ namespace DiscImageChef.Tests.Devices.SCSI 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?.Length.ToString() ?? "null"); + DicConsole.WriteLine("Command took {0} ms.", duration); + DicConsole.WriteLine("Sense is {0}.", sense); + DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer?.Length.ToString() ?? "null"); DicConsole.WriteLine("Sense buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(senseBuffer)); DicConsole.WriteLine("PREVENT ALLOW MEDIUM REMOVAL decoded sense:"); DicConsole.Write("{0}", Sense.PrettifySense(senseBuffer)); @@ -620,20 +620,20 @@ namespace DiscImageChef.Tests.Devices.SCSI static void ReadCd(string devPath, Device dev) { - uint address = 0; - uint length = 1; + uint address = 0; + uint length = 1; MmcSectorTypes sectorType = MmcSectorTypes.AllTypes; - bool dap = false; - bool relative = false; - bool sync = false; - MmcHeaderCodes header = MmcHeaderCodes.None; - bool user = true; - bool edc = false; - MmcErrorField c2 = MmcErrorField.None; - MmcSubchannel subchan = MmcSubchannel.None; - uint blockSize = 2352; - string strDev; - int item; + bool dap = false; + bool relative = false; + bool sync = false; + MmcHeaderCodes header = MmcHeaderCodes.None; + bool user = true; + bool edc = false; + MmcErrorField c2 = MmcErrorField.None; + MmcSubchannel subchan = MmcSubchannel.None; + uint blockSize = 2352; + string strDev; + int item; parameters: while(true) @@ -642,17 +642,18 @@ namespace DiscImageChef.Tests.Devices.SCSI DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("Parameters for READ CD command:"); DicConsole.WriteLine("Address relative to current position?: {0}", relative); - DicConsole.WriteLine("{1}: {0}", address, relative ? "Address" : "LBA"); - DicConsole.WriteLine("Will transfer {0} sectors", length); - DicConsole.WriteLine("Sector type: {0}", sectorType); - DicConsole.WriteLine("Process audio?: {0}", dap); - DicConsole.WriteLine("Retrieve sync bytes?: {0}", sync); - DicConsole.WriteLine("Header mode: {0}", header); - DicConsole.WriteLine("Retrieve user data?: {0}", user); + DicConsole.WriteLine("{1}: {0}", address, + relative ? "Address" : "LBA"); + DicConsole.WriteLine("Will transfer {0} sectors", length); + DicConsole.WriteLine("Sector type: {0}", sectorType); + DicConsole.WriteLine("Process audio?: {0}", dap); + DicConsole.WriteLine("Retrieve sync bytes?: {0}", sync); + DicConsole.WriteLine("Header mode: {0}", header); + DicConsole.WriteLine("Retrieve user data?: {0}", user); DicConsole.WriteLine("Retrieve EDC/ECC data?: {0}", edc); - DicConsole.WriteLine("C2 mode: {0}", c2); - DicConsole.WriteLine("Subchannel mode: {0}", subchan); - DicConsole.WriteLine("{0} bytes per sector", blockSize); + DicConsole.WriteLine("C2 mode: {0}", c2); + DicConsole.WriteLine("Subchannel mode: {0}", subchan); + DicConsole.WriteLine("{0} bytes per sector", blockSize); DicConsole.WriteLine(); DicConsole.WriteLine("Choose what to do:"); DicConsole.WriteLine("1.- Change parameters."); @@ -820,11 +821,11 @@ namespace DiscImageChef.Tests.Devices.SCSI 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?.Length.ToString() ?? "null"); - DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer)); - DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer?.Length.ToString() ?? "null"); + DicConsole.WriteLine("Command took {0} ms.", duration); + DicConsole.WriteLine("Sense is {0}.", sense); + DicConsole.WriteLine("Buffer is {0} bytes.", buffer?.Length.ToString() ?? "null"); + DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer)); + DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer?.Length.ToString() ?? "null"); DicConsole.WriteLine("Sense buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(senseBuffer)); DicConsole.WriteLine(); DicConsole.WriteLine("Choose what to do:"); @@ -892,23 +893,23 @@ namespace DiscImageChef.Tests.Devices.SCSI static void ReadCdMsf(string devPath, Device dev) { - byte startFrame = 0; - byte startSecond = 2; - byte startMinute = 0; - byte endFrame = 0; - byte endSecond = 0; - byte endMinute = 0; - MmcSectorTypes sectorType = MmcSectorTypes.AllTypes; - bool dap = false; - bool sync = false; - MmcHeaderCodes header = MmcHeaderCodes.None; - bool user = true; - bool edc = false; - MmcErrorField c2 = MmcErrorField.None; - MmcSubchannel subchan = MmcSubchannel.None; - uint blockSize = 2352; - string strDev; - int item; + byte startFrame = 0; + byte startSecond = 2; + byte startMinute = 0; + byte endFrame = 0; + byte endSecond = 0; + byte endMinute = 0; + MmcSectorTypes sectorType = MmcSectorTypes.AllTypes; + bool dap = false; + bool sync = false; + MmcHeaderCodes header = MmcHeaderCodes.None; + bool user = true; + bool edc = false; + MmcErrorField c2 = MmcErrorField.None; + MmcSubchannel subchan = MmcSubchannel.None; + uint blockSize = 2352; + string strDev; + int item; parameters: while(true) @@ -917,16 +918,16 @@ namespace DiscImageChef.Tests.Devices.SCSI DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("Parameters for READ CD MSF command:"); DicConsole.WriteLine("Start: {0:D2}:{1:D2}:{2:D2}", startMinute, startSecond, startFrame); - DicConsole.WriteLine("End: {0:D2}:{1:D2}:{2:D2}", endMinute, endSecond, endFrame); - DicConsole.WriteLine("Sector type: {0}", sectorType); - DicConsole.WriteLine("Process audio?: {0}", dap); - DicConsole.WriteLine("Retrieve sync bytes?: {0}", sync); - DicConsole.WriteLine("Header mode: {0}", header); - DicConsole.WriteLine("Retrieve user data?: {0}", user); + DicConsole.WriteLine("End: {0:D2}:{1:D2}:{2:D2}", endMinute, endSecond, endFrame); + DicConsole.WriteLine("Sector type: {0}", sectorType); + DicConsole.WriteLine("Process audio?: {0}", dap); + DicConsole.WriteLine("Retrieve sync bytes?: {0}", sync); + DicConsole.WriteLine("Header mode: {0}", header); + DicConsole.WriteLine("Retrieve user data?: {0}", user); DicConsole.WriteLine("Retrieve EDC/ECC data?: {0}", edc); - DicConsole.WriteLine("C2 mode: {0}", c2); - DicConsole.WriteLine("Subchannel mode: {0}", subchan); - DicConsole.WriteLine("{0} bytes per sector", blockSize); + DicConsole.WriteLine("C2 mode: {0}", c2); + DicConsole.WriteLine("Subchannel mode: {0}", subchan); + DicConsole.WriteLine("{0} bytes per sector", blockSize); DicConsole.WriteLine(); DicConsole.WriteLine("Choose what to do:"); DicConsole.WriteLine("1.- Change parameters."); @@ -1117,7 +1118,7 @@ namespace DiscImageChef.Tests.Devices.SCSI start: uint startMsf = (uint)((startMinute << 16) + (startSecond << 8) + startFrame); - uint endMsf = (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, @@ -1126,11 +1127,11 @@ namespace DiscImageChef.Tests.Devices.SCSI 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?.Length.ToString() ?? "null"); - DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer)); - DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer?.Length.ToString() ?? "null"); + DicConsole.WriteLine("Command took {0} ms.", duration); + DicConsole.WriteLine("Sense is {0}.", sense); + DicConsole.WriteLine("Buffer is {0} bytes.", buffer?.Length.ToString() ?? "null"); + DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer)); + DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer?.Length.ToString() ?? "null"); DicConsole.WriteLine("Sense buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(senseBuffer)); DicConsole.WriteLine(); DicConsole.WriteLine("Choose what to do:"); @@ -1199,8 +1200,8 @@ namespace DiscImageChef.Tests.Devices.SCSI static void ReadDiscInformation(string devPath, Device dev) { MmcDiscInformationDataTypes info = MmcDiscInformationDataTypes.DiscInformation; - string strDev; - int item; + string strDev; + int item; parameters: while(true) @@ -1256,11 +1257,11 @@ namespace DiscImageChef.Tests.Devices.SCSI 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?.Length.ToString() ?? "null"); - DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer)); - DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer?.Length.ToString() ?? "null"); + DicConsole.WriteLine("Command took {0} ms.", duration); + DicConsole.WriteLine("Sense is {0}.", sense); + DicConsole.WriteLine("Buffer is {0} bytes.", buffer?.Length.ToString() ?? "null"); + DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer)); + DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer?.Length.ToString() ?? "null"); DicConsole.WriteLine("Sense buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(senseBuffer)); DicConsole.WriteLine(); DicConsole.WriteLine("Choose what to do:"); @@ -1340,12 +1341,12 @@ namespace DiscImageChef.Tests.Devices.SCSI static void ReadDiscStructure(string devPath, Device dev) { MmcDiscStructureMediaType mediaType = MmcDiscStructureMediaType.Dvd; - MmcDiscStructureFormat format = MmcDiscStructureFormat.CapabilityList; - uint address = 0; - byte layer = 0; - byte agid = 0; - string strDev; - int item; + MmcDiscStructureFormat format = MmcDiscStructureFormat.CapabilityList; + uint address = 0; + byte layer = 0; + byte agid = 0; + string strDev; + int item; parameters: while(true) @@ -1354,10 +1355,10 @@ namespace DiscImageChef.Tests.Devices.SCSI DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("Parameters for READ DISC STRUCTURE command:"); DicConsole.WriteLine("Media type: {0}", mediaType); - DicConsole.WriteLine("Format: {0}", format); - DicConsole.WriteLine("Address: {0}", address); - DicConsole.WriteLine("Layer: {0}", layer); - DicConsole.WriteLine("AGID: {0}", agid); + DicConsole.WriteLine("Format: {0}", format); + DicConsole.WriteLine("Address: {0}", address); + DicConsole.WriteLine("Layer: {0}", layer); + DicConsole.WriteLine("AGID: {0}", agid); DicConsole.WriteLine(); DicConsole.WriteLine("Choose what to do:"); DicConsole.WriteLine("1.- Change parameters."); @@ -1497,11 +1498,11 @@ namespace DiscImageChef.Tests.Devices.SCSI 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?.Length.ToString() ?? "null"); - DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer)); - DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer?.Length.ToString() ?? "null"); + DicConsole.WriteLine("Command took {0} ms.", duration); + DicConsole.WriteLine("Sense is {0}.", sense); + DicConsole.WriteLine("Buffer is {0} bytes.", buffer?.Length.ToString() ?? "null"); + DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer)); + DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer?.Length.ToString() ?? "null"); DicConsole.WriteLine("Sense buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(senseBuffer)); DicConsole.WriteLine(); DicConsole.WriteLine("Choose what to do:"); @@ -1580,11 +1581,11 @@ namespace DiscImageChef.Tests.Devices.SCSI static void ReadTocPmaAtip(string devPath, Device dev) { - bool msf = false; - byte format = 0; - byte session = 0; + bool msf = false; + byte format = 0; + byte session = 0; string strDev; - int item; + int item; parameters: while(true) @@ -1593,8 +1594,8 @@ namespace DiscImageChef.Tests.Devices.SCSI DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("Parameters for READ TOC/PMA/ATIP command:"); DicConsole.WriteLine("Return MSF values?: {0}", msf); - DicConsole.WriteLine("Format byte: {0}", format); - DicConsole.WriteLine("Session: {0}", session); + DicConsole.WriteLine("Format byte: {0}", format); + DicConsole.WriteLine("Session: {0}", session); DicConsole.WriteLine(); DicConsole.WriteLine("Choose what to do:"); DicConsole.WriteLine("1.- Change parameters."); @@ -1657,11 +1658,11 @@ namespace DiscImageChef.Tests.Devices.SCSI 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?.Length.ToString() ?? "null"); - DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer)); - DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer?.Length.ToString() ?? "null"); + DicConsole.WriteLine("Command took {0} ms.", duration); + DicConsole.WriteLine("Sense is {0}.", sense); + DicConsole.WriteLine("Buffer is {0} bytes.", buffer?.Length.ToString() ?? "null"); + DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer)); + DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer?.Length.ToString() ?? "null"); DicConsole.WriteLine("Sense buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(senseBuffer)); DicConsole.WriteLine(); DicConsole.WriteLine("Choose what to do:"); @@ -1768,14 +1769,14 @@ namespace DiscImageChef.Tests.Devices.SCSI static void StartStopUnit(string devPath, Device dev) { - bool immediate = false; - bool changeFormatLayer = false; - bool loadEject = false; - bool start = false; - byte formatLayer = 0; - byte powerConditions = 0; + bool immediate = false; + bool changeFormatLayer = false; + bool loadEject = false; + bool start = false; + byte formatLayer = 0; + byte powerConditions = 0; string strDev; - int item; + int item; parameters: while(true) @@ -1783,12 +1784,12 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("Parameters for START STOP UNIT command:"); - DicConsole.WriteLine("Immediate?: {0}", immediate); + DicConsole.WriteLine("Immediate?: {0}", immediate); DicConsole.WriteLine("Change format layer?: {0}", changeFormatLayer); - DicConsole.WriteLine("Eject?: {0}", loadEject); - DicConsole.WriteLine("Start?: {0}", start); - DicConsole.WriteLine("Format layer: {0}", formatLayer); - DicConsole.WriteLine("Power conditions: {0}", powerConditions); + DicConsole.WriteLine("Eject?: {0}", loadEject); + DicConsole.WriteLine("Start?: {0}", start); + DicConsole.WriteLine("Format layer: {0}", formatLayer); + DicConsole.WriteLine("Power conditions: {0}", powerConditions); DicConsole.WriteLine(); DicConsole.WriteLine("Choose what to do:"); DicConsole.WriteLine("1.- Change parameters."); @@ -1881,9 +1882,9 @@ namespace DiscImageChef.Tests.Devices.SCSI 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?.Length.ToString() ?? "null"); + DicConsole.WriteLine("Command took {0} ms.", duration); + DicConsole.WriteLine("Sense is {0}.", sense); + DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer?.Length.ToString() ?? "null"); DicConsole.WriteLine("Sense buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(senseBuffer)); DicConsole.WriteLine("START STOP UNIT decoded sense:"); DicConsole.Write("{0}", Sense.PrettifySense(senseBuffer)); diff --git a/DiscImageChef.Tests.Devices/SCSI/NEC.cs b/DiscImageChef.Tests.Devices/SCSI/NEC.cs index 6641a925b..db9f35e04 100644 --- a/DiscImageChef.Tests.Devices/SCSI/NEC.cs +++ b/DiscImageChef.Tests.Devices/SCSI/NEC.cs @@ -71,10 +71,10 @@ namespace DiscImageChef.Tests.Devices.SCSI static void ReadCdDa(string devPath, Device dev) { - uint address = 0; - uint length = 1; + uint address = 0; + uint length = 1; string strDev; - int item; + int item; parameters: while(true) @@ -82,7 +82,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("Parameters for READ CD-DA command:"); - DicConsole.WriteLine("LBA: {0}", address); + DicConsole.WriteLine("LBA: {0}", address); DicConsole.WriteLine("Will transfer {0} sectors", length); DicConsole.WriteLine(); DicConsole.WriteLine("Choose what to do:"); @@ -136,11 +136,11 @@ namespace DiscImageChef.Tests.Devices.SCSI 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?.Length.ToString() ?? "null"); - DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer)); - DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer?.Length.ToString() ?? "null"); + DicConsole.WriteLine("Command took {0} ms.", duration); + DicConsole.WriteLine("Sense is {0}.", sense); + DicConsole.WriteLine("Buffer is {0} bytes.", buffer?.Length.ToString() ?? "null"); + DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer)); + DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer?.Length.ToString() ?? "null"); DicConsole.WriteLine("Sense buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(senseBuffer)); DicConsole.WriteLine(); DicConsole.WriteLine("Choose what to do:"); diff --git a/DiscImageChef.Tests.Devices/SCSI/Pioneer.cs b/DiscImageChef.Tests.Devices/SCSI/Pioneer.cs index 545d6cbd4..21a7ed4cc 100644 --- a/DiscImageChef.Tests.Devices/SCSI/Pioneer.cs +++ b/DiscImageChef.Tests.Devices/SCSI/Pioneer.cs @@ -80,12 +80,12 @@ namespace DiscImageChef.Tests.Devices.SCSI static void ReadCdDa(string devPath, Device dev) { - uint address = 0; - uint length = 1; - PioneerSubchannel subchan = PioneerSubchannel.None; - uint blockSize = 2352; - string strDev; - int item; + uint address = 0; + uint length = 1; + PioneerSubchannel subchan = PioneerSubchannel.None; + uint blockSize = 2352; + string strDev; + int item; parameters: while(true) @@ -93,10 +93,10 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("Parameters for READ CD-DA command:"); - DicConsole.WriteLine("LBA: {0}", address); + DicConsole.WriteLine("LBA: {0}", address); DicConsole.WriteLine("Will transfer {0} sectors", length); - DicConsole.WriteLine("Subchannel mode: {0}", subchan); - DicConsole.WriteLine("{0} bytes per sectors", blockSize); + DicConsole.WriteLine("Subchannel mode: {0}", subchan); + DicConsole.WriteLine("{0} bytes per sectors", blockSize); DicConsole.WriteLine(); DicConsole.WriteLine("Choose what to do:"); DicConsole.WriteLine("1.- Change parameters."); @@ -179,11 +179,11 @@ namespace DiscImageChef.Tests.Devices.SCSI 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?.Length.ToString() ?? "null"); - DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer)); - DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer?.Length.ToString() ?? "null"); + DicConsole.WriteLine("Command took {0} ms.", duration); + DicConsole.WriteLine("Sense is {0}.", sense); + DicConsole.WriteLine("Buffer is {0} bytes.", buffer?.Length.ToString() ?? "null"); + DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer)); + DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer?.Length.ToString() ?? "null"); DicConsole.WriteLine("Sense buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(senseBuffer)); DicConsole.WriteLine(); DicConsole.WriteLine("Choose what to do:"); @@ -251,16 +251,16 @@ namespace DiscImageChef.Tests.Devices.SCSI static void ReadCdDaMsf(string devPath, Device dev) { - byte startFrame = 0; - byte startSecond = 2; - byte startMinute = 0; - byte endFrame = 0; - byte endSecond = 0; - byte endMinute = 0; - PioneerSubchannel subchan = PioneerSubchannel.None; - uint blockSize = 2352; - string strDev; - int item; + byte startFrame = 0; + byte startSecond = 2; + byte startMinute = 0; + byte endFrame = 0; + byte endSecond = 0; + byte endMinute = 0; + PioneerSubchannel subchan = PioneerSubchannel.None; + uint blockSize = 2352; + string strDev; + int item; parameters: while(true) @@ -269,9 +269,9 @@ namespace DiscImageChef.Tests.Devices.SCSI DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("Parameters for READ CD-DA MSF command:"); DicConsole.WriteLine("Start: {0:D2}:{1:D2}:{2:D2}", startMinute, startSecond, startFrame); - DicConsole.WriteLine("End: {0:D2}:{1:D2}:{2:D2}", endMinute, endSecond, endFrame); - DicConsole.WriteLine("Subchannel mode: {0}", subchan); - DicConsole.WriteLine("{0} bytes per sectors", blockSize); + DicConsole.WriteLine("End: {0:D2}:{1:D2}:{2:D2}", endMinute, endSecond, endFrame); + DicConsole.WriteLine("Subchannel mode: {0}", subchan); + DicConsole.WriteLine("{0} bytes per sectors", blockSize); DicConsole.WriteLine(); DicConsole.WriteLine("Choose what to do:"); DicConsole.WriteLine("1.- Change parameters."); @@ -388,7 +388,7 @@ namespace DiscImageChef.Tests.Devices.SCSI start: uint startMsf = (uint)((startMinute << 16) + (startSecond << 8) + startFrame); - uint endMsf = (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); @@ -396,11 +396,11 @@ namespace DiscImageChef.Tests.Devices.SCSI 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?.Length.ToString() ?? "null"); - DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer)); - DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer?.Length.ToString() ?? "null"); + DicConsole.WriteLine("Command took {0} ms.", duration); + DicConsole.WriteLine("Sense is {0}.", sense); + DicConsole.WriteLine("Buffer is {0} bytes.", buffer?.Length.ToString() ?? "null"); + DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer)); + DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer?.Length.ToString() ?? "null"); DicConsole.WriteLine("Sense buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(senseBuffer)); DicConsole.WriteLine(); DicConsole.WriteLine("Choose what to do:"); @@ -468,12 +468,12 @@ namespace DiscImageChef.Tests.Devices.SCSI static void ReadCdXa(string devPath, Device dev) { - uint address = 0; - uint length = 1; - bool errorFlags = false; - bool wholeSector = false; + uint address = 0; + uint length = 1; + bool errorFlags = false; + bool wholeSector = false; string strDev; - int item; + int item; parameters: while(true) @@ -481,10 +481,10 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("Parameters for READ CD-XA command:"); - DicConsole.WriteLine("LBA: {0}", address); + DicConsole.WriteLine("LBA: {0}", address); DicConsole.WriteLine("Will transfer {0} sectors", length); DicConsole.WriteLine("Include error flags?: {0}", errorFlags); - DicConsole.WriteLine("Whole sector?: {0}", wholeSector); + DicConsole.WriteLine("Whole sector?: {0}", wholeSector); DicConsole.WriteLine(); DicConsole.WriteLine("Choose what to do:"); DicConsole.WriteLine("1.- Change parameters."); @@ -557,11 +557,11 @@ namespace DiscImageChef.Tests.Devices.SCSI 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?.Length.ToString() ?? "null"); - DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer)); - DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer?.Length.ToString() ?? "null"); + DicConsole.WriteLine("Command took {0} ms.", duration); + DicConsole.WriteLine("Sense is {0}.", sense); + DicConsole.WriteLine("Buffer is {0} bytes.", buffer?.Length.ToString() ?? "null"); + DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer)); + DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer?.Length.ToString() ?? "null"); DicConsole.WriteLine("Sense buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(senseBuffer)); DicConsole.WriteLine(); DicConsole.WriteLine("Choose what to do:"); diff --git a/DiscImageChef.Tests.Devices/SCSI/Plasmon.cs b/DiscImageChef.Tests.Devices/SCSI/Plasmon.cs index f7c427c22..3bc3833dd 100644 --- a/DiscImageChef.Tests.Devices/SCSI/Plasmon.cs +++ b/DiscImageChef.Tests.Devices/SCSI/Plasmon.cs @@ -75,14 +75,14 @@ namespace DiscImageChef.Tests.Devices.SCSI static void ReadLong(string devPath, Device dev) { - bool relative = false; - uint address = 0; - ushort length = 1; - ushort bps = 512; - bool physical = false; - bool sectorCount = true; + bool relative = false; + uint address = 0; + ushort length = 1; + ushort bps = 512; + bool physical = false; + bool sectorCount = true; string strDev; - int item; + int item; parameters: while(true) @@ -91,8 +91,8 @@ namespace DiscImageChef.Tests.Devices.SCSI DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("Parameters for READ LONG command:"); 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"); + 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); DicConsole.WriteLine(); DicConsole.WriteLine("Choose what to do:"); @@ -189,11 +189,11 @@ namespace DiscImageChef.Tests.Devices.SCSI 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?.Length.ToString() ?? "null"); - DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer)); - DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer?.Length.ToString() ?? "null"); + DicConsole.WriteLine("Command took {0} ms.", duration); + DicConsole.WriteLine("Sense is {0}.", sense); + DicConsole.WriteLine("Buffer is {0} bytes.", buffer?.Length.ToString() ?? "null"); + DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer)); + DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer?.Length.ToString() ?? "null"); DicConsole.WriteLine("Sense buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(senseBuffer)); DicConsole.WriteLine(); DicConsole.WriteLine("Choose what to do:"); @@ -261,10 +261,10 @@ namespace DiscImageChef.Tests.Devices.SCSI static void ReadSectorLocation(string devPath, Device dev) { - uint address = 0; - bool physical = false; + uint address = 0; + bool physical = false; string strDev; - int item; + int item; parameters: while(true) @@ -325,11 +325,11 @@ namespace DiscImageChef.Tests.Devices.SCSI 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?.Length.ToString() ?? "null"); - DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer)); - DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer?.Length.ToString() ?? "null"); + DicConsole.WriteLine("Command took {0} ms.", duration); + DicConsole.WriteLine("Sense is {0}.", sense); + DicConsole.WriteLine("Buffer is {0} bytes.", buffer?.Length.ToString() ?? "null"); + DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer)); + DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer?.Length.ToString() ?? "null"); DicConsole.WriteLine("Sense buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(senseBuffer)); DicConsole.WriteLine(); DicConsole.WriteLine("Choose what to do:"); diff --git a/DiscImageChef.Tests.Devices/SCSI/Plextor.cs b/DiscImageChef.Tests.Devices/SCSI/Plextor.cs index a015428d0..ba20de5fb 100644 --- a/DiscImageChef.Tests.Devices/SCSI/Plextor.cs +++ b/DiscImageChef.Tests.Devices/SCSI/Plextor.cs @@ -124,9 +124,9 @@ namespace DiscImageChef.Tests.Devices.SCSI static void GetBookBitsetting(string devPath, Device dev) { - bool dl = false; + bool dl = false; string strDev; - int item; + int item; parameters: while(true) @@ -177,11 +177,11 @@ namespace DiscImageChef.Tests.Devices.SCSI 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?.Length.ToString() ?? "null"); - DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer)); - DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer?.Length.ToString() ?? "null"); + DicConsole.WriteLine("Command took {0} ms.", duration); + DicConsole.WriteLine("Sense is {0}.", sense); + DicConsole.WriteLine("Buffer is {0} bytes.", buffer?.Length.ToString() ?? "null"); + DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer)); + DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer?.Length.ToString() ?? "null"); DicConsole.WriteLine("Sense buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(senseBuffer)); DicConsole.WriteLine(); DicConsole.WriteLine("Choose what to do:"); @@ -257,11 +257,11 @@ namespace DiscImageChef.Tests.Devices.SCSI 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?.Length.ToString() ?? "null"); - DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer)); - DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer?.Length.ToString() ?? "null"); + DicConsole.WriteLine("Command took {0} ms.", duration); + DicConsole.WriteLine("Sense is {0}.", sense); + DicConsole.WriteLine("Buffer is {0} bytes.", buffer?.Length.ToString() ?? "null"); + DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer)); + DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer?.Length.ToString() ?? "null"); DicConsole.WriteLine("Sense buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(senseBuffer)); DicConsole.WriteLine(); DicConsole.WriteLine("Choose what to do:"); @@ -335,11 +335,11 @@ namespace DiscImageChef.Tests.Devices.SCSI 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?.Length.ToString() ?? "null"); - DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer)); - DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer?.Length.ToString() ?? "null"); + DicConsole.WriteLine("Command took {0} ms.", duration); + DicConsole.WriteLine("Sense is {0}.", sense); + DicConsole.WriteLine("Buffer is {0} bytes.", buffer?.Length.ToString() ?? "null"); + DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer)); + DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer?.Length.ToString() ?? "null"); DicConsole.WriteLine("Sense buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(senseBuffer)); DicConsole.WriteLine(); DicConsole.WriteLine("Choose what to do:"); @@ -413,11 +413,11 @@ namespace DiscImageChef.Tests.Devices.SCSI 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?.Length.ToString() ?? "null"); - DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer)); - DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer?.Length.ToString() ?? "null"); + DicConsole.WriteLine("Command took {0} ms.", duration); + DicConsole.WriteLine("Sense is {0}.", sense); + DicConsole.WriteLine("Buffer is {0} bytes.", buffer?.Length.ToString() ?? "null"); + DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer)); + DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer?.Length.ToString() ?? "null"); DicConsole.WriteLine("Sense buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(senseBuffer)); DicConsole.WriteLine(); DicConsole.WriteLine("Choose what to do:"); @@ -491,11 +491,11 @@ namespace DiscImageChef.Tests.Devices.SCSI 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?.Length.ToString() ?? "null"); - DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer)); - DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer?.Length.ToString() ?? "null"); + DicConsole.WriteLine("Command took {0} ms.", duration); + DicConsole.WriteLine("Sense is {0}.", sense); + DicConsole.WriteLine("Buffer is {0} bytes.", buffer?.Length.ToString() ?? "null"); + DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer)); + DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer?.Length.ToString() ?? "null"); DicConsole.WriteLine("Sense buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(senseBuffer)); DicConsole.WriteLine(); DicConsole.WriteLine("Choose what to do:"); @@ -569,11 +569,11 @@ namespace DiscImageChef.Tests.Devices.SCSI 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?.Length.ToString() ?? "null"); - DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer)); - DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer?.Length.ToString() ?? "null"); + DicConsole.WriteLine("Command took {0} ms.", duration); + DicConsole.WriteLine("Sense is {0}.", sense); + DicConsole.WriteLine("Buffer is {0} bytes.", buffer?.Length.ToString() ?? "null"); + DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer)); + DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer?.Length.ToString() ?? "null"); DicConsole.WriteLine("Sense buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(senseBuffer)); DicConsole.WriteLine(); DicConsole.WriteLine("Choose what to do:"); @@ -648,11 +648,11 @@ namespace DiscImageChef.Tests.Devices.SCSI 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?.Length.ToString() ?? "null"); - DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer)); - DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer?.Length.ToString() ?? "null"); + DicConsole.WriteLine("Command took {0} ms.", duration); + DicConsole.WriteLine("Sense is {0}.", sense); + DicConsole.WriteLine("Buffer is {0} bytes.", buffer?.Length.ToString() ?? "null"); + DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer)); + DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer?.Length.ToString() ?? "null"); DicConsole.WriteLine("Sense buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(senseBuffer)); DicConsole.WriteLine(); DicConsole.WriteLine("Choose what to do:"); @@ -718,9 +718,9 @@ namespace DiscImageChef.Tests.Devices.SCSI static void GetVariRec(string devPath, Device dev) { - bool dvd = false; + bool dvd = false; string strDev; - int item; + int item; parameters: while(true) @@ -771,11 +771,11 @@ namespace DiscImageChef.Tests.Devices.SCSI 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?.Length.ToString() ?? "null"); - DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer)); - DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer?.Length.ToString() ?? "null"); + DicConsole.WriteLine("Command took {0} ms.", duration); + DicConsole.WriteLine("Sense is {0}.", sense); + DicConsole.WriteLine("Buffer is {0} bytes.", buffer?.Length.ToString() ?? "null"); + DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer)); + DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer?.Length.ToString() ?? "null"); DicConsole.WriteLine("Sense buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(senseBuffer)); DicConsole.WriteLine(); DicConsole.WriteLine("Choose what to do:"); @@ -851,11 +851,11 @@ namespace DiscImageChef.Tests.Devices.SCSI 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?.Length.ToString() ?? "null"); + 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?.Length.ToString() ?? "null"); DicConsole.WriteLine("Sense buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(senseBuffer)); DicConsole.WriteLine("POWEREC GET SPEEDS decoded sense:"); DicConsole.Write("{0}", Sense.PrettifySense(senseBuffer)); @@ -901,12 +901,12 @@ namespace DiscImageChef.Tests.Devices.SCSI static void ReadCdDa(string devPath, Device dev) { - uint address = 0; - uint length = 1; - PlextorSubchannel subchan = PlextorSubchannel.None; - uint blockSize = 2352; - string strDev; - int item; + uint address = 0; + uint length = 1; + PlextorSubchannel subchan = PlextorSubchannel.None; + uint blockSize = 2352; + string strDev; + int item; parameters: while(true) @@ -914,10 +914,10 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("Parameters for READ CD-DA command:"); - DicConsole.WriteLine("LBA: {0}", address); + DicConsole.WriteLine("LBA: {0}", address); DicConsole.WriteLine("Will transfer {0} sectors", length); - DicConsole.WriteLine("Subchannel mode: {0}", subchan); - DicConsole.WriteLine("{0} bytes per sectors", blockSize); + DicConsole.WriteLine("Subchannel mode: {0}", subchan); + DicConsole.WriteLine("{0} bytes per sectors", blockSize); DicConsole.WriteLine(); DicConsole.WriteLine("Choose what to do:"); DicConsole.WriteLine("1.- Change parameters."); @@ -1002,11 +1002,11 @@ namespace DiscImageChef.Tests.Devices.SCSI 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?.Length.ToString() ?? "null"); - DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer)); - DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer?.Length.ToString() ?? "null"); + DicConsole.WriteLine("Command took {0} ms.", duration); + DicConsole.WriteLine("Sense is {0}.", sense); + DicConsole.WriteLine("Buffer is {0} bytes.", buffer?.Length.ToString() ?? "null"); + DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer)); + DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer?.Length.ToString() ?? "null"); DicConsole.WriteLine("Sense buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(senseBuffer)); DicConsole.WriteLine(); DicConsole.WriteLine("Choose what to do:"); @@ -1074,10 +1074,10 @@ namespace DiscImageChef.Tests.Devices.SCSI static void ReadDvdRaw(string devPath, Device dev) { - uint count = 1; - uint lba = 0; + uint count = 1; + uint lba = 0; string strDev; - int item; + int item; parameters: while(true) @@ -1085,7 +1085,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("Parameters for READ DVD (RAW) command:"); - DicConsole.WriteLine("LBA: {0}", lba); + DicConsole.WriteLine("LBA: {0}", lba); DicConsole.WriteLine("Count: {0}", count); DicConsole.WriteLine(); DicConsole.WriteLine("Choose what to do:"); @@ -1139,11 +1139,11 @@ namespace DiscImageChef.Tests.Devices.SCSI 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?.Length.ToString() ?? "null"); - DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer)); - DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer?.Length.ToString() ?? "null"); + DicConsole.WriteLine("Command took {0} ms.", duration); + DicConsole.WriteLine("Sense is {0}.", sense); + DicConsole.WriteLine("Buffer is {0} bytes.", buffer?.Length.ToString() ?? "null"); + DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer)); + DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer?.Length.ToString() ?? "null"); DicConsole.WriteLine("Sense buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(senseBuffer)); DicConsole.WriteLine(); DicConsole.WriteLine("Choose what to do:"); @@ -1219,11 +1219,11 @@ namespace DiscImageChef.Tests.Devices.SCSI 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?.Length.ToString() ?? "null"); - DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer)); - DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer?.Length.ToString() ?? "null"); + DicConsole.WriteLine("Command took {0} ms.", duration); + DicConsole.WriteLine("Sense is {0}.", sense); + DicConsole.WriteLine("Buffer is {0} bytes.", buffer?.Length.ToString() ?? "null"); + DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer)); + DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer?.Length.ToString() ?? "null"); DicConsole.WriteLine("Sense buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(senseBuffer)); DicConsole.WriteLine(); DicConsole.WriteLine("Choose what to do:"); @@ -1289,10 +1289,10 @@ namespace DiscImageChef.Tests.Devices.SCSI static void ReadEepromBlock(string devPath, Device dev) { - byte block = 0; + byte block = 0; ushort blockSize = 256; string strDev; - int item; + int item; parameters: while(true) @@ -1301,7 +1301,7 @@ namespace DiscImageChef.Tests.Devices.SCSI DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("Parameters for READ EEPROM command:"); DicConsole.WriteLine("EEPROM block to read: {0}", block); - DicConsole.WriteLine("EEPROM block size: {0}", blockSize); + DicConsole.WriteLine("EEPROM block size: {0}", blockSize); DicConsole.WriteLine(); DicConsole.WriteLine("Choose what to do:"); DicConsole.WriteLine("1.- Change parameters."); @@ -1354,11 +1354,11 @@ namespace DiscImageChef.Tests.Devices.SCSI 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?.Length.ToString() ?? "null"); - DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer)); - DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer?.Length.ToString() ?? "null"); + DicConsole.WriteLine("Command took {0} ms.", duration); + DicConsole.WriteLine("Sense is {0}.", sense); + DicConsole.WriteLine("Buffer is {0} bytes.", buffer?.Length.ToString() ?? "null"); + DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer)); + DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer?.Length.ToString() ?? "null"); DicConsole.WriteLine("Sense buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(senseBuffer)); DicConsole.WriteLine(); DicConsole.WriteLine("Choose what to do:"); @@ -1434,11 +1434,11 @@ namespace DiscImageChef.Tests.Devices.SCSI 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?.Length.ToString() ?? "null"); - DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer)); - DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer?.Length.ToString() ?? "null"); + DicConsole.WriteLine("Command took {0} ms.", duration); + DicConsole.WriteLine("Sense is {0}.", sense); + DicConsole.WriteLine("Buffer is {0} bytes.", buffer?.Length.ToString() ?? "null"); + DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer)); + DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer?.Length.ToString() ?? "null"); DicConsole.WriteLine("Sense buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(senseBuffer)); DicConsole.WriteLine(); DicConsole.WriteLine("Choose what to do:"); diff --git a/DiscImageChef.Tests.Devices/SCSI/SBC.cs b/DiscImageChef.Tests.Devices/SCSI/SBC.cs index c47e60d12..21dfe8d51 100644 --- a/DiscImageChef.Tests.Devices/SCSI/SBC.cs +++ b/DiscImageChef.Tests.Devices/SCSI/SBC.cs @@ -99,11 +99,11 @@ namespace DiscImageChef.Tests.Devices.SCSI static void Read6(string devPath, Device dev) { - uint lba = 0; - uint blockSize = 512; - byte count = 1; + uint lba = 0; + uint blockSize = 512; + byte count = 1; string strDev; - int item; + int item; parameters: while(true) @@ -111,8 +111,8 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("Parameters for READ (6) command:"); - DicConsole.WriteLine("LBA: {0}", lba); - DicConsole.WriteLine("{0} blocks to read", count == 0 ? 256 : count); + DicConsole.WriteLine("LBA: {0}", lba); + DicConsole.WriteLine("{0} blocks to read", count == 0 ? 256 : count); DicConsole.WriteLine("{0} bytes expected per block", blockSize); DicConsole.WriteLine(); DicConsole.WriteLine("Choose what to do:"); @@ -149,6 +149,7 @@ namespace DiscImageChef.Tests.Devices.SCSI DicConsole.WriteLine("Max LBA is {0}, setting to {0}", 0x1FFFFF); lba = 0x1FFFFF; } + DicConsole.Write("Blocks to read (0 for 256 blocks)?: "); strDev = System.Console.ReadLine(); if(!byte.TryParse(strDev, out count)) @@ -181,11 +182,11 @@ namespace DiscImageChef.Tests.Devices.SCSI 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?.Length.ToString() ?? "null"); - DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer)); - DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer?.Length.ToString() ?? "null"); + DicConsole.WriteLine("Command took {0} ms.", duration); + DicConsole.WriteLine("Sense is {0}.", sense); + DicConsole.WriteLine("Buffer is {0} bytes.", buffer?.Length.ToString() ?? "null"); + DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer)); + DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer?.Length.ToString() ?? "null"); DicConsole.WriteLine("Sense buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(senseBuffer)); DicConsole.WriteLine(); DicConsole.WriteLine("Choose what to do:"); @@ -253,17 +254,17 @@ namespace DiscImageChef.Tests.Devices.SCSI static void Read10(string devPath, Device dev) { - uint lba = 0; - uint blockSize = 512; - byte count = 1; - byte rdprotect = 0; - bool dpo = false; - bool fua = false; - bool fuaNv = false; - byte groupNumber = 0; - bool relative = false; + uint lba = 0; + uint blockSize = 512; + byte count = 1; + byte rdprotect = 0; + bool dpo = false; + bool fua = false; + bool fuaNv = false; + byte groupNumber = 0; + bool relative = false; string strDev; - int item; + int item; parameters: while(true) @@ -272,14 +273,16 @@ namespace DiscImageChef.Tests.Devices.SCSI DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("Parameters for READ (10) command:"); DicConsole.WriteLine("Address relative to current position?: {0}", relative); - DicConsole.WriteLine("{1}: {0}", lba, relative ? "Address" : "LBA"); - DicConsole.WriteLine("{0} blocks to read", count == 0 ? 256 : count); - DicConsole.WriteLine("{0} bytes expected per block", blockSize); - DicConsole.WriteLine("How to check protection information: {0}", rdprotect); - DicConsole.WriteLine("Give lowest cache priority?: {0}", dpo); - DicConsole.WriteLine("Force bypassing cache and reading from medium?: {0}", fua); + DicConsole.WriteLine("{1}: {0}", lba, + relative ? "Address" : "LBA"); + DicConsole.WriteLine("{0} blocks to read", + count == 0 ? 256 : count); + DicConsole.WriteLine("{0} bytes expected per block", blockSize); + DicConsole.WriteLine("How to check protection information: {0}", rdprotect); + DicConsole.WriteLine("Give lowest cache priority?: {0}", dpo); + DicConsole.WriteLine("Force bypassing cache and reading from medium?: {0}", fua); DicConsole.WriteLine("Force bypassing cache and reading from non-volatile cache?: {0}", fuaNv); - DicConsole.WriteLine("Group number: {0}", groupNumber); + DicConsole.WriteLine("Group number: {0}", groupNumber); DicConsole.WriteLine(); DicConsole.WriteLine("Choose what to do:"); DicConsole.WriteLine("1.- Change parameters."); @@ -402,11 +405,11 @@ namespace DiscImageChef.Tests.Devices.SCSI 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?.Length.ToString() ?? "null"); - DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer)); - DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer?.Length.ToString() ?? "null"); + DicConsole.WriteLine("Command took {0} ms.", duration); + DicConsole.WriteLine("Sense is {0}.", sense); + DicConsole.WriteLine("Buffer is {0} bytes.", buffer?.Length.ToString() ?? "null"); + DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer)); + DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer?.Length.ToString() ?? "null"); DicConsole.WriteLine("Sense buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(senseBuffer)); DicConsole.WriteLine(); DicConsole.WriteLine("Choose what to do:"); @@ -474,18 +477,18 @@ namespace DiscImageChef.Tests.Devices.SCSI static void Read12(string devPath, Device dev) { - uint lba = 0; - uint blockSize = 512; - byte count = 1; - byte rdprotect = 0; - bool dpo = false; - bool fua = false; - bool fuaNv = false; - byte groupNumber = 0; - bool relative = false; - bool streaming = false; + uint lba = 0; + uint blockSize = 512; + byte count = 1; + byte rdprotect = 0; + bool dpo = false; + bool fua = false; + bool fuaNv = false; + byte groupNumber = 0; + bool relative = false; + bool streaming = false; string strDev; - int item; + int item; parameters: while(true) @@ -494,15 +497,17 @@ namespace DiscImageChef.Tests.Devices.SCSI DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("Parameters for READ (12) command:"); DicConsole.WriteLine("Address relative to current position?: {0}", relative); - DicConsole.WriteLine("{1}: {0}", lba, relative ? "Address" : "LBA"); - DicConsole.WriteLine("{0} blocks to read", count == 0 ? 256 : count); - DicConsole.WriteLine("{0} bytes expected per block", blockSize); - DicConsole.WriteLine("How to check protection information: {0}", rdprotect); - DicConsole.WriteLine("Give lowest cache priority?: {0}", dpo); - DicConsole.WriteLine("Force bypassing cache and reading from medium?: {0}", fua); + DicConsole.WriteLine("{1}: {0}", lba, + relative ? "Address" : "LBA"); + DicConsole.WriteLine("{0} blocks to read", + count == 0 ? 256 : count); + DicConsole.WriteLine("{0} bytes expected per block", blockSize); + DicConsole.WriteLine("How to check protection information: {0}", rdprotect); + DicConsole.WriteLine("Give lowest cache priority?: {0}", dpo); + DicConsole.WriteLine("Force bypassing cache and reading from medium?: {0}", fua); DicConsole.WriteLine("Force bypassing cache and reading from non-volatile cache?: {0}", fuaNv); - DicConsole.WriteLine("Group number: {0}", groupNumber); - DicConsole.WriteLine("Use streaming?: {0}", streaming); + DicConsole.WriteLine("Group number: {0}", groupNumber); + DicConsole.WriteLine("Use streaming?: {0}", streaming); DicConsole.WriteLine(); DicConsole.WriteLine("Choose what to do:"); DicConsole.WriteLine("1.- Change parameters."); @@ -635,11 +640,11 @@ namespace DiscImageChef.Tests.Devices.SCSI 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?.Length.ToString() ?? "null"); - DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer)); - DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer?.Length.ToString() ?? "null"); + DicConsole.WriteLine("Command took {0} ms.", duration); + DicConsole.WriteLine("Sense is {0}.", sense); + DicConsole.WriteLine("Buffer is {0} bytes.", buffer?.Length.ToString() ?? "null"); + DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer)); + DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer?.Length.ToString() ?? "null"); DicConsole.WriteLine("Sense buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(senseBuffer)); DicConsole.WriteLine(); DicConsole.WriteLine("Choose what to do:"); @@ -707,17 +712,17 @@ namespace DiscImageChef.Tests.Devices.SCSI static void Read16(string devPath, Device dev) { - ulong lba = 0; - uint blockSize = 512; - byte count = 1; - byte rdprotect = 0; - bool dpo = false; - bool fua = false; - bool fuaNv = false; - byte groupNumber = 0; - bool streaming = false; + ulong lba = 0; + uint blockSize = 512; + byte count = 1; + byte rdprotect = 0; + bool dpo = false; + bool fua = false; + bool fuaNv = false; + byte groupNumber = 0; + bool streaming = false; string strDev; - int item; + int item; parameters: while(true) @@ -726,14 +731,15 @@ namespace DiscImageChef.Tests.Devices.SCSI DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("Parameters for READ (16) command:"); DicConsole.WriteLine("LBA: {0}", lba); - DicConsole.WriteLine("{0} blocks to read", count == 0 ? 256 : count); - DicConsole.WriteLine("{0} bytes expected per block", blockSize); - DicConsole.WriteLine("How to check protection information: {0}", rdprotect); - DicConsole.WriteLine("Give lowest cache priority?: {0}", dpo); - DicConsole.WriteLine("Force bypassing cache and reading from medium?: {0}", fua); + DicConsole.WriteLine("{0} blocks to read", + count == 0 ? 256 : count); + DicConsole.WriteLine("{0} bytes expected per block", blockSize); + DicConsole.WriteLine("How to check protection information: {0}", rdprotect); + DicConsole.WriteLine("Give lowest cache priority?: {0}", dpo); + DicConsole.WriteLine("Force bypassing cache and reading from medium?: {0}", fua); DicConsole.WriteLine("Force bypassing cache and reading from non-volatile cache?: {0}", fuaNv); - DicConsole.WriteLine("Group number: {0}", groupNumber); - DicConsole.WriteLine("Use streaming?: {0}", streaming); + DicConsole.WriteLine("Group number: {0}", groupNumber); + DicConsole.WriteLine("Use streaming?: {0}", streaming); DicConsole.WriteLine(); DicConsole.WriteLine("Choose what to do:"); DicConsole.WriteLine("1.- Change parameters."); @@ -856,11 +862,11 @@ namespace DiscImageChef.Tests.Devices.SCSI 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?.Length.ToString() ?? "null"); - DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer)); - DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer?.Length.ToString() ?? "null"); + DicConsole.WriteLine("Command took {0} ms.", duration); + DicConsole.WriteLine("Sense is {0}.", sense); + DicConsole.WriteLine("Buffer is {0} bytes.", buffer?.Length.ToString() ?? "null"); + DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer)); + DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer?.Length.ToString() ?? "null"); DicConsole.WriteLine("Sense buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(senseBuffer)); DicConsole.WriteLine(); DicConsole.WriteLine("Choose what to do:"); @@ -928,12 +934,12 @@ namespace DiscImageChef.Tests.Devices.SCSI static void ReadLong10(string devPath, Device dev) { - uint lba = 0; + uint lba = 0; ushort blockSize = 512; - bool correct = false; - bool relative = false; + bool correct = false; + bool relative = false; string strDev; - int item; + int item; parameters: while(true) @@ -942,9 +948,9 @@ namespace DiscImageChef.Tests.Devices.SCSI DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("Parameters for READ LONG (10) command:"); DicConsole.WriteLine("Address relative to current position?: {0}", relative); - DicConsole.WriteLine("{1}: {0}", lba, relative ? "Address" : "LBA"); - DicConsole.WriteLine("{0} bytes expected per block", blockSize); - DicConsole.WriteLine("Try to error correct block?: {0}", correct); + DicConsole.WriteLine("{1}: {0}", lba, relative ? "Address" : "LBA"); + DicConsole.WriteLine("{0} bytes expected per block", blockSize); + DicConsole.WriteLine("Try to error correct block?: {0}", correct); DicConsole.WriteLine(); DicConsole.WriteLine("Choose what to do:"); DicConsole.WriteLine("1.- Change parameters."); @@ -1017,11 +1023,11 @@ namespace DiscImageChef.Tests.Devices.SCSI 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?.Length.ToString() ?? "null"); - DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer)); - DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer?.Length.ToString() ?? "null"); + DicConsole.WriteLine("Command took {0} ms.", duration); + DicConsole.WriteLine("Sense is {0}.", sense); + DicConsole.WriteLine("Buffer is {0} bytes.", buffer?.Length.ToString() ?? "null"); + DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer)); + DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer?.Length.ToString() ?? "null"); DicConsole.WriteLine("Sense buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(senseBuffer)); DicConsole.WriteLine(); DicConsole.WriteLine("Choose what to do:"); @@ -1089,11 +1095,11 @@ namespace DiscImageChef.Tests.Devices.SCSI static void ReadLong16(string devPath, Device dev) { - ulong lba = 0; - uint blockSize = 512; - bool correct = false; + ulong lba = 0; + uint blockSize = 512; + bool correct = false; string strDev; - int item; + int item; parameters: while(true) @@ -1101,8 +1107,8 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("Parameters for READ LONG (16) command:"); - DicConsole.WriteLine("LBA: {0}", lba); - DicConsole.WriteLine("{0} bytes expected per block", blockSize); + DicConsole.WriteLine("LBA: {0}", lba); + DicConsole.WriteLine("{0} bytes expected per block", blockSize); DicConsole.WriteLine("Try to error correct block?: {0}", correct); DicConsole.WriteLine(); DicConsole.WriteLine("Choose what to do:"); @@ -1166,11 +1172,11 @@ namespace DiscImageChef.Tests.Devices.SCSI 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?.Length.ToString() ?? "null"); - DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer)); - DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer?.Length.ToString() ?? "null"); + DicConsole.WriteLine("Command took {0} ms.", duration); + DicConsole.WriteLine("Sense is {0}.", sense); + DicConsole.WriteLine("Buffer is {0} bytes.", buffer?.Length.ToString() ?? "null"); + DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer)); + DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer?.Length.ToString() ?? "null"); DicConsole.WriteLine("Sense buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(senseBuffer)); DicConsole.WriteLine(); DicConsole.WriteLine("Choose what to do:"); @@ -1238,9 +1244,9 @@ namespace DiscImageChef.Tests.Devices.SCSI static void Seek6(string devPath, Device dev) { - uint lba = 0; + uint lba = 0; string strDev; - int item; + int item; parameters: while(true) @@ -1284,6 +1290,7 @@ namespace DiscImageChef.Tests.Devices.SCSI DicConsole.WriteLine("Max LBA is {0}, setting to {0}", 0x1FFFFF); lba = 0x1FFFFF; } + break; case 2: goto start; } @@ -1296,9 +1303,9 @@ namespace DiscImageChef.Tests.Devices.SCSI 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?.Length.ToString() ?? "null"); + DicConsole.WriteLine("Command took {0} ms.", duration); + DicConsole.WriteLine("Sense is {0}.", sense); + DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer?.Length.ToString() ?? "null"); DicConsole.WriteLine("Sense buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(senseBuffer)); DicConsole.WriteLine("SEEK (6) decoded sense:"); DicConsole.Write("{0}", Sense.PrettifySense(senseBuffer)); @@ -1346,9 +1353,9 @@ namespace DiscImageChef.Tests.Devices.SCSI static void Seek10(string devPath, Device dev) { - uint lba = 0; + uint lba = 0; string strDev; - int item; + int item; parameters: while(true) @@ -1398,9 +1405,9 @@ namespace DiscImageChef.Tests.Devices.SCSI 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?.Length.ToString() ?? "null"); + DicConsole.WriteLine("Command took {0} ms.", duration); + DicConsole.WriteLine("Sense is {0}.", sense); + DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer?.Length.ToString() ?? "null"); DicConsole.WriteLine("Sense buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(senseBuffer)); DicConsole.WriteLine("SEEK (6) decoded sense:"); DicConsole.Write("{0}", Sense.PrettifySense(senseBuffer)); diff --git a/DiscImageChef.Tests.Devices/SCSI/SMC.cs b/DiscImageChef.Tests.Devices/SCSI/SMC.cs index 3c90a9405..8f55a49c9 100644 --- a/DiscImageChef.Tests.Devices/SCSI/SMC.cs +++ b/DiscImageChef.Tests.Devices/SCSI/SMC.cs @@ -72,15 +72,15 @@ namespace DiscImageChef.Tests.Devices.SCSI static void ReadAttribute(string devPath, Device dev) { - ushort element = 0; - byte elementType = 0; - byte volume = 0; - byte partition = 0; - ushort firstAttribute = 0; - bool cache = false; - ScsiAttributeAction action = ScsiAttributeAction.Values; - string strDev; - int item; + ushort element = 0; + byte elementType = 0; + byte volume = 0; + byte partition = 0; + ushort firstAttribute = 0; + bool cache = false; + ScsiAttributeAction action = ScsiAttributeAction.Values; + string strDev; + int item; parameters: while(true) @@ -88,13 +88,13 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("Parameters for READ ATTRIBUTE command:"); - DicConsole.WriteLine("Action: {0}", action); - DicConsole.WriteLine("Element: {0}", element); - DicConsole.WriteLine("Element type: {0}", elementType); - DicConsole.WriteLine("Volume: {0}", volume); - DicConsole.WriteLine("Partition: {0}", partition); + DicConsole.WriteLine("Action: {0}", action); + DicConsole.WriteLine("Element: {0}", element); + DicConsole.WriteLine("Element type: {0}", elementType); + DicConsole.WriteLine("Volume: {0}", volume); + DicConsole.WriteLine("Partition: {0}", partition); DicConsole.WriteLine("First attribute: {0}", firstAttribute); - DicConsole.WriteLine("Use cache?: {0}", cache); + DicConsole.WriteLine("Use cache?: {0}", cache); DicConsole.WriteLine(); DicConsole.WriteLine("Choose what to do:"); DicConsole.WriteLine("1.- Change parameters."); @@ -202,11 +202,11 @@ namespace DiscImageChef.Tests.Devices.SCSI 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?.Length.ToString() ?? "null"); - DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer)); - DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer?.Length.ToString() ?? "null"); + DicConsole.WriteLine("Command took {0} ms.", duration); + DicConsole.WriteLine("Sense is {0}.", sense); + DicConsole.WriteLine("Buffer is {0} bytes.", buffer?.Length.ToString() ?? "null"); + DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer)); + DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer?.Length.ToString() ?? "null"); DicConsole.WriteLine("Sense buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(senseBuffer)); DicConsole.WriteLine(); DicConsole.WriteLine("Choose what to do:"); diff --git a/DiscImageChef.Tests.Devices/SCSI/SPC.cs b/DiscImageChef.Tests.Devices/SCSI/SPC.cs index 3755ef48d..02ccc83cb 100644 --- a/DiscImageChef.Tests.Devices/SCSI/SPC.cs +++ b/DiscImageChef.Tests.Devices/SCSI/SPC.cs @@ -115,11 +115,11 @@ namespace DiscImageChef.Tests.Devices.SCSI 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?.Length.ToString() ?? "null"); - DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer)); - DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer?.Length.ToString() ?? "null"); + DicConsole.WriteLine("Command took {0} ms.", duration); + DicConsole.WriteLine("Sense is {0}.", sense); + DicConsole.WriteLine("Buffer is {0} bytes.", buffer?.Length.ToString() ?? "null"); + DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer)); + DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer?.Length.ToString() ?? "null"); DicConsole.WriteLine("Sense buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(senseBuffer)); DicConsole.WriteLine(); DicConsole.WriteLine("Choose what to do:"); @@ -196,9 +196,9 @@ namespace DiscImageChef.Tests.Devices.SCSI static void InquiryEvpd(string devPath, Device dev) { - byte page = 1; + byte page = 1; string strDev; - int item; + int item; parameters: while(true) @@ -249,11 +249,11 @@ namespace DiscImageChef.Tests.Devices.SCSI 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?.Length.ToString() ?? "null"); - DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer)); - DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer?.Length.ToString() ?? "null"); + DicConsole.WriteLine("Command took {0} ms.", duration); + DicConsole.WriteLine("Sense is {0}.", sense); + DicConsole.WriteLine("Buffer is {0} bytes.", buffer?.Length.ToString() ?? "null"); + DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer)); + DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer?.Length.ToString() ?? "null"); DicConsole.WriteLine("Sense buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(senseBuffer)); DicConsole.WriteLine(); DicConsole.WriteLine("Choose what to do:"); @@ -321,12 +321,12 @@ namespace DiscImageChef.Tests.Devices.SCSI static void ModeSense6(string devPath, Device dev) { - bool dbd = false; + bool dbd = false; ScsiModeSensePageControl pageControl = ScsiModeSensePageControl.Current; - byte page = 0x3F; - byte subpage = 0xFF; - string strDev; - int item; + byte page = 0x3F; + byte subpage = 0xFF; + string strDev; + int item; parameters: while(true) @@ -334,10 +334,10 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("Parameters for MODE SENSE (6) command:"); - DicConsole.WriteLine("DBD?: {0}", dbd); + DicConsole.WriteLine("DBD?: {0}", dbd); DicConsole.WriteLine("Page control: {0}", pageControl); - DicConsole.WriteLine("Page: {0}", page); - DicConsole.WriteLine("Subpage: {0}", subpage); + DicConsole.WriteLine("Page: {0}", page); + DicConsole.WriteLine("Subpage: {0}", subpage); DicConsole.WriteLine(); DicConsole.WriteLine("Choose what to do:"); DicConsole.WriteLine("1.- Change parameters."); @@ -414,11 +414,11 @@ namespace DiscImageChef.Tests.Devices.SCSI 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?.Length.ToString() ?? "null"); - DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer)); - DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer?.Length.ToString() ?? "null"); + DicConsole.WriteLine("Command took {0} ms.", duration); + DicConsole.WriteLine("Sense is {0}.", sense); + DicConsole.WriteLine("Buffer is {0} bytes.", buffer?.Length.ToString() ?? "null"); + DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer)); + DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer?.Length.ToString() ?? "null"); DicConsole.WriteLine("Sense buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(senseBuffer)); DicConsole.WriteLine(); DicConsole.WriteLine("Choose what to do:"); @@ -497,13 +497,13 @@ namespace DiscImageChef.Tests.Devices.SCSI static void ModeSense10(string devPath, Device dev) { - bool llba = false; - bool dbd = false; + bool llba = false; + bool dbd = false; ScsiModeSensePageControl pageControl = ScsiModeSensePageControl.Current; - byte page = 0x3F; - byte subpage = 0xFF; - string strDev; - int item; + byte page = 0x3F; + byte subpage = 0xFF; + string strDev; + int item; parameters: while(true) @@ -511,11 +511,11 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("Parameters for MODE SENSE (10) command:"); - DicConsole.WriteLine("LLBA?: {0}", llba); - DicConsole.WriteLine("DBD?: {0}", dbd); + DicConsole.WriteLine("LLBA?: {0}", llba); + DicConsole.WriteLine("DBD?: {0}", dbd); DicConsole.WriteLine("Page control: {0}", pageControl); - DicConsole.WriteLine("Page: {0}", page); - DicConsole.WriteLine("Subpage: {0}", subpage); + DicConsole.WriteLine("Page: {0}", page); + DicConsole.WriteLine("Subpage: {0}", subpage); DicConsole.WriteLine(); DicConsole.WriteLine("Choose what to do:"); DicConsole.WriteLine("1.- Change parameters."); @@ -602,11 +602,11 @@ namespace DiscImageChef.Tests.Devices.SCSI 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?.Length.ToString() ?? "null"); - DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer)); - DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer?.Length.ToString() ?? "null"); + DicConsole.WriteLine("Command took {0} ms.", duration); + DicConsole.WriteLine("Sense is {0}.", sense); + DicConsole.WriteLine("Buffer is {0} bytes.", buffer?.Length.ToString() ?? "null"); + DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer)); + DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer?.Length.ToString() ?? "null"); DicConsole.WriteLine("Sense buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(senseBuffer)); DicConsole.WriteLine(); DicConsole.WriteLine("Choose what to do:"); @@ -686,8 +686,8 @@ namespace DiscImageChef.Tests.Devices.SCSI static void PreventAllowMediumRemoval(string devPath, Device dev) { ScsiPreventAllowMode mode = ScsiPreventAllowMode.Allow; - string strDev; - int item; + string strDev; + int item; parameters: while(true) @@ -743,7 +743,7 @@ namespace DiscImageChef.Tests.Devices.SCSI 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 is {0}.", sense); DicConsole.WriteLine("PREVENT ALLOW MEDIUM REMOVAL decoded sense:"); DicConsole.Write("{0}", Sense.PrettifySense(senseBuffer)); DicConsole.WriteLine(); @@ -779,11 +779,11 @@ namespace DiscImageChef.Tests.Devices.SCSI static void ReadCapacity10(string devPath, Device dev) { - bool relative = false; - bool partial = false; - uint address = 0; + bool relative = false; + bool partial = false; + uint address = 0; string strDev; - int item; + int item; parameters: while(true) @@ -793,7 +793,7 @@ namespace DiscImageChef.Tests.Devices.SCSI DicConsole.WriteLine("Parameters for READ CAPACITY (10) command:"); DicConsole.WriteLine("Relative address?: {0}", relative); DicConsole.WriteLine("Partial capacity?: {0}", partial); - DicConsole.WriteLine("Address: {0}", address); + DicConsole.WriteLine("Address: {0}", address); DicConsole.WriteLine(); DicConsole.WriteLine("Choose what to do:"); DicConsole.WriteLine("1.- Change parameters."); @@ -856,11 +856,11 @@ namespace DiscImageChef.Tests.Devices.SCSI 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?.Length.ToString() ?? "null"); - DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer)); - DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer?.Length.ToString() ?? "null"); + DicConsole.WriteLine("Command took {0} ms.", duration); + DicConsole.WriteLine("Sense is {0}.", sense); + DicConsole.WriteLine("Buffer is {0} bytes.", buffer?.Length.ToString() ?? "null"); + DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer)); + DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer?.Length.ToString() ?? "null"); DicConsole.WriteLine("Sense buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(senseBuffer)); DicConsole.WriteLine(); DicConsole.WriteLine("Choose what to do:"); @@ -928,10 +928,10 @@ namespace DiscImageChef.Tests.Devices.SCSI static void ReadCapacity16(string devPath, Device dev) { - bool partial = false; - ulong address = 0; + bool partial = false; + ulong address = 0; string strDev; - int item; + int item; parameters: while(true) @@ -940,7 +940,7 @@ namespace DiscImageChef.Tests.Devices.SCSI DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("Parameters for READ CAPACITY (16) command:"); DicConsole.WriteLine("Partial capacity?: {0}", partial); - DicConsole.WriteLine("Address: {0}", address); + DicConsole.WriteLine("Address: {0}", address); DicConsole.WriteLine(); DicConsole.WriteLine("Choose what to do:"); DicConsole.WriteLine("1.- Change parameters."); @@ -993,11 +993,11 @@ namespace DiscImageChef.Tests.Devices.SCSI 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?.Length.ToString() ?? "null"); - DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer)); - DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer?.Length.ToString() ?? "null"); + DicConsole.WriteLine("Command took {0} ms.", duration); + DicConsole.WriteLine("Sense is {0}.", sense); + DicConsole.WriteLine("Buffer is {0} bytes.", buffer?.Length.ToString() ?? "null"); + DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer)); + DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer?.Length.ToString() ?? "null"); DicConsole.WriteLine("Sense buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(senseBuffer)); DicConsole.WriteLine(); DicConsole.WriteLine("Choose what to do:"); @@ -1073,11 +1073,11 @@ namespace DiscImageChef.Tests.Devices.SCSI 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?.Length.ToString() ?? "null"); - DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer)); - DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer?.Length.ToString() ?? "null"); + DicConsole.WriteLine("Command took {0} ms.", duration); + DicConsole.WriteLine("Sense is {0}.", sense); + DicConsole.WriteLine("Buffer is {0} bytes.", buffer?.Length.ToString() ?? "null"); + DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer)); + DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer?.Length.ToString() ?? "null"); DicConsole.WriteLine("Sense buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(senseBuffer)); DicConsole.WriteLine(); DicConsole.WriteLine("Choose what to do:"); @@ -1143,9 +1143,9 @@ namespace DiscImageChef.Tests.Devices.SCSI static void RequestSense(string devPath, Device dev) { - bool descriptor = false; + bool descriptor = false; string strDev; - int item; + int item; parameters: while(true) @@ -1195,9 +1195,9 @@ namespace DiscImageChef.Tests.Devices.SCSI 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?.Length.ToString() ?? "null"); + DicConsole.WriteLine("Command took {0} ms.", duration); + DicConsole.WriteLine("Sense is {0}.", sense); + DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer?.Length.ToString() ?? "null"); DicConsole.WriteLine("Sense buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(senseBuffer)); DicConsole.WriteLine("REQUEST SENSE decoded sense:"); DicConsole.Write("{0}", Sense.PrettifySense(senseBuffer)); @@ -1252,9 +1252,9 @@ namespace DiscImageChef.Tests.Devices.SCSI 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?.Length.ToString() ?? "null"); + DicConsole.WriteLine("Command took {0} ms.", duration); + DicConsole.WriteLine("Sense is {0}.", sense); + DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer?.Length.ToString() ?? "null"); DicConsole.WriteLine("Sense buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(senseBuffer)); DicConsole.WriteLine("TEST UNIT READY decoded sense:"); DicConsole.Write("{0}", Sense.PrettifySense(senseBuffer)); diff --git a/DiscImageChef.Tests.Devices/SCSI/SSC.cs b/DiscImageChef.Tests.Devices/SCSI/SSC.cs index 480f6bca4..f36faf3eb 100644 --- a/DiscImageChef.Tests.Devices/SCSI/SSC.cs +++ b/DiscImageChef.Tests.Devices/SCSI/SSC.cs @@ -125,13 +125,13 @@ namespace DiscImageChef.Tests.Devices.SCSI static void LoadUnload(string devPath, Device dev) { - bool load = true; - bool immediate = false; - bool retense = false; - bool eot = false; - bool hold = false; + bool load = true; + bool immediate = false; + bool retense = false; + bool eot = false; + bool hold = false; string strDev; - int item; + int item; parameters: while(true) @@ -139,11 +139,11 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("Parameters for LOAD UNLOAD command:"); - DicConsole.WriteLine("Load?: {0}", load); - DicConsole.WriteLine("Immediate?: {0}", immediate); - DicConsole.WriteLine("Retense?: {0}", retense); + DicConsole.WriteLine("Load?: {0}", load); + DicConsole.WriteLine("Immediate?: {0}", immediate); + DicConsole.WriteLine("Retense?: {0}", retense); DicConsole.WriteLine("End of tape?: {0}", eot); - DicConsole.WriteLine("Hold?: {0}", hold); + DicConsole.WriteLine("Hold?: {0}", hold); DicConsole.WriteLine(); DicConsole.WriteLine("Choose what to do:"); DicConsole.WriteLine("1.- Change parameters."); @@ -226,9 +226,9 @@ namespace DiscImageChef.Tests.Devices.SCSI 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?.Length.ToString() ?? "null"); + DicConsole.WriteLine("Command took {0} ms.", duration); + DicConsole.WriteLine("Sense is {0}.", sense); + DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer?.Length.ToString() ?? "null"); DicConsole.WriteLine("Sense buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(senseBuffer)); DicConsole.WriteLine("LOAD UNLOAD decoded sense:"); DicConsole.Write("{0}", Sense.PrettifySense(senseBuffer)); @@ -276,13 +276,13 @@ namespace DiscImageChef.Tests.Devices.SCSI static void Locate10(string devPath, Device dev) { - bool blockType = true; - bool immediate = false; - bool changePartition = false; - byte partition = 0; - uint objectId = 0; + bool blockType = true; + bool immediate = false; + bool changePartition = false; + byte partition = 0; + uint objectId = 0; string strDev; - int item; + int item; parameters: while(true) @@ -290,11 +290,11 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("Parameters for LOCATE (10) command:"); - DicConsole.WriteLine("Locate block?: {0}", blockType); - DicConsole.WriteLine("Immediate?: {0}", immediate); + DicConsole.WriteLine("Locate block?: {0}", blockType); + DicConsole.WriteLine("Immediate?: {0}", immediate); DicConsole.WriteLine("Change partition?: {0}", changePartition); - DicConsole.WriteLine("Partition: {0}", partition); - DicConsole.WriteLine("{1}: {0}", objectId, blockType ? "Block" : "Object"); + DicConsole.WriteLine("Partition: {0}", partition); + DicConsole.WriteLine("{1}: {0}", objectId, blockType ? "Block" : "Object"); DicConsole.WriteLine(); DicConsole.WriteLine("Choose what to do:"); DicConsole.WriteLine("1.- Change parameters."); @@ -377,9 +377,9 @@ namespace DiscImageChef.Tests.Devices.SCSI 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?.Length.ToString() ?? "null"); + DicConsole.WriteLine("Command took {0} ms.", duration); + DicConsole.WriteLine("Sense is {0}.", sense); + DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer?.Length.ToString() ?? "null"); DicConsole.WriteLine("Sense buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(senseBuffer)); DicConsole.WriteLine("LOCATE (10) decoded sense:"); DicConsole.Write("{0}", Sense.PrettifySense(senseBuffer)); @@ -427,14 +427,14 @@ namespace DiscImageChef.Tests.Devices.SCSI static void Locate16(string devPath, Device dev) { - SscLogicalIdTypes destType = SscLogicalIdTypes.FileId; - bool immediate = false; - bool changePartition = false; - bool bam = false; - byte partition = 0; - ulong objectId = 1; - string strDev; - int item; + SscLogicalIdTypes destType = SscLogicalIdTypes.FileId; + bool immediate = false; + bool changePartition = false; + bool bam = false; + byte partition = 0; + ulong objectId = 1; + string strDev; + int item; parameters: while(true) @@ -442,12 +442,12 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("Parameters for LOCATE (16) command:"); - DicConsole.WriteLine("Object type: {0}", destType); - DicConsole.WriteLine("Immediate?: {0}", immediate); + DicConsole.WriteLine("Object type: {0}", destType); + DicConsole.WriteLine("Immediate?: {0}", immediate); DicConsole.WriteLine("Explicit identifier?: {0}", bam); - DicConsole.WriteLine("Change partition?: {0}", changePartition); - DicConsole.WriteLine("Partition: {0}", partition); - DicConsole.WriteLine("Object identifier: {0}", objectId); + DicConsole.WriteLine("Change partition?: {0}", changePartition); + DicConsole.WriteLine("Partition: {0}", partition); + DicConsole.WriteLine("Object identifier: {0}", objectId); DicConsole.WriteLine(); DicConsole.WriteLine("Choose what to do:"); DicConsole.WriteLine("1.- Change parameters."); @@ -544,9 +544,9 @@ namespace DiscImageChef.Tests.Devices.SCSI 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?.Length.ToString() ?? "null"); + DicConsole.WriteLine("Command took {0} ms.", duration); + DicConsole.WriteLine("Sense is {0}.", sense); + DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer?.Length.ToString() ?? "null"); DicConsole.WriteLine("Sense buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(senseBuffer)); DicConsole.WriteLine("LOCATE (16) decoded sense:"); DicConsole.Write("{0}", Sense.PrettifySense(senseBuffer)); @@ -594,12 +594,12 @@ namespace DiscImageChef.Tests.Devices.SCSI static void Read6(string devPath, Device dev) { - bool sili = false; - bool fixedLen = true; - uint blockSize = 512; - uint length = 1; + bool sili = false; + bool fixedLen = true; + uint blockSize = 512; + uint length = 1; string strDev; - int item; + int item; parameters: while(true) @@ -608,7 +608,7 @@ namespace DiscImageChef.Tests.Devices.SCSI DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("Parameters for READ (6) command:"); DicConsole.WriteLine("Fixed block size?: {0}", fixedLen); - DicConsole.WriteLine("Will read {0} {1}", length, fixedLen ? "blocks" : "bytes"); + DicConsole.WriteLine("Will read {0} {1}", length, fixedLen ? "blocks" : "bytes"); if(fixedLen) DicConsole.WriteLine("{0} bytes expected per block", blockSize); DicConsole.WriteLine("Suppress length indicator?: {0}", sili); DicConsole.WriteLine(); @@ -657,6 +657,7 @@ namespace DiscImageChef.Tests.Devices.SCSI fixedLen ? "blocks" : "bytes"); length = 0xFFFFFF; } + if(fixedLen) { DicConsole.Write("How many bytes to expect per block?: "); @@ -692,11 +693,11 @@ namespace DiscImageChef.Tests.Devices.SCSI 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?.Length.ToString() ?? "null"); - DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer)); - DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer?.Length.ToString() ?? "null"); + DicConsole.WriteLine("Command took {0} ms.", duration); + DicConsole.WriteLine("Sense is {0}.", sense); + DicConsole.WriteLine("Buffer is {0} bytes.", buffer?.Length.ToString() ?? "null"); + DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer)); + DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer?.Length.ToString() ?? "null"); DicConsole.WriteLine("Sense buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(senseBuffer)); DicConsole.WriteLine(); DicConsole.WriteLine("Choose what to do:"); @@ -764,14 +765,14 @@ namespace DiscImageChef.Tests.Devices.SCSI static void Read16(string devPath, Device dev) { - bool sili = false; - bool fixedLen = true; - uint objectSize = 512; - uint length = 1; - byte partition = 0; - ulong objectId = 0; + bool sili = false; + bool fixedLen = true; + uint objectSize = 512; + uint length = 1; + byte partition = 0; + ulong objectId = 0; string strDev; - int item; + int item; parameters: while(true) @@ -780,9 +781,9 @@ namespace DiscImageChef.Tests.Devices.SCSI DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("Parameters for READ (16) command:"); DicConsole.WriteLine("Fixed block size?: {0}", fixedLen); - DicConsole.WriteLine("Will read {0} {1}", length, fixedLen ? "objects" : "bytes"); + DicConsole.WriteLine("Will read {0} {1}", length, fixedLen ? "objects" : "bytes"); if(fixedLen) DicConsole.WriteLine("{0} bytes expected per object", objectSize); - DicConsole.WriteLine("Suppress length indicator?: {0}", sili); + DicConsole.WriteLine("Suppress length indicator?: {0}", sili); DicConsole.WriteLine("Read object {0} from partition {1}", objectId, partition); DicConsole.WriteLine(); DicConsole.WriteLine("Choose what to do:"); @@ -830,6 +831,7 @@ namespace DiscImageChef.Tests.Devices.SCSI fixedLen ? "blocks" : "bytes"); length = 0xFFFFFF; } + if(fixedLen) { DicConsole.Write("How many bytes to expect per object?: "); @@ -885,11 +887,11 @@ namespace DiscImageChef.Tests.Devices.SCSI 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?.Length.ToString() ?? "null"); - DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer)); - DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer?.Length.ToString() ?? "null"); + DicConsole.WriteLine("Command took {0} ms.", duration); + DicConsole.WriteLine("Sense is {0}.", sense); + DicConsole.WriteLine("Buffer is {0} bytes.", buffer?.Length.ToString() ?? "null"); + DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer)); + DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer?.Length.ToString() ?? "null"); DicConsole.WriteLine("Sense buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(senseBuffer)); DicConsole.WriteLine(); DicConsole.WriteLine("Choose what to do:"); @@ -965,11 +967,11 @@ namespace DiscImageChef.Tests.Devices.SCSI 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?.Length.ToString() ?? "null"); - DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer)); - DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer?.Length.ToString() ?? "null"); + DicConsole.WriteLine("Command took {0} ms.", duration); + DicConsole.WriteLine("Sense is {0}.", sense); + DicConsole.WriteLine("Buffer is {0} bytes.", buffer?.Length.ToString() ?? "null"); + DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer)); + DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer?.Length.ToString() ?? "null"); DicConsole.WriteLine("Sense buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(senseBuffer)); DicConsole.WriteLine(); DicConsole.WriteLine("Choose what to do:"); @@ -1047,8 +1049,8 @@ namespace DiscImageChef.Tests.Devices.SCSI static void ReadPosition(string devPath, Device dev) { SscPositionForms responseForm = SscPositionForms.Short; - string strDev; - int item; + string strDev; + int item; parameters: while(true) @@ -1106,9 +1108,9 @@ namespace DiscImageChef.Tests.Devices.SCSI 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?.Length.ToString() ?? "null"); + DicConsole.WriteLine("Command took {0} ms.", duration); + DicConsole.WriteLine("Sense is {0}.", sense); + DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer?.Length.ToString() ?? "null"); DicConsole.WriteLine("Sense buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(senseBuffer)); DicConsole.WriteLine("READ POSITION decoded sense:"); DicConsole.Write("{0}", Sense.PrettifySense(senseBuffer)); @@ -1156,13 +1158,13 @@ namespace DiscImageChef.Tests.Devices.SCSI static void ReadReverse6(string devPath, Device dev) { - bool byteOrder = false; - bool sili = false; - bool fixedLen = true; - uint blockSize = 512; - uint length = 1; + bool byteOrder = false; + bool sili = false; + bool fixedLen = true; + uint blockSize = 512; + uint length = 1; string strDev; - int item; + int item; parameters: while(true) @@ -1171,9 +1173,9 @@ namespace DiscImageChef.Tests.Devices.SCSI DicConsole.WriteLine("Device: {0}", devPath); 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"); + DicConsole.WriteLine("Will read {0} {1}", length, fixedLen ? "blocks" : "bytes"); if(fixedLen) DicConsole.WriteLine("{0} bytes expected per block", blockSize); - DicConsole.WriteLine("Suppress length indicator?: {0}", sili); + DicConsole.WriteLine("Suppress length indicator?: {0}", sili); DicConsole.WriteLine("Drive should unreverse bytes?: {0}", byteOrder); DicConsole.WriteLine(); DicConsole.WriteLine("Choose what to do:"); @@ -1221,6 +1223,7 @@ namespace DiscImageChef.Tests.Devices.SCSI fixedLen ? "blocks" : "bytes"); length = 0xFFFFFF; } + if(fixedLen) { DicConsole.Write("How many bytes to expect per block?: "); @@ -1266,11 +1269,11 @@ namespace DiscImageChef.Tests.Devices.SCSI 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?.Length.ToString() ?? "null"); - DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer)); - DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer?.Length.ToString() ?? "null"); + DicConsole.WriteLine("Command took {0} ms.", duration); + DicConsole.WriteLine("Sense is {0}.", sense); + DicConsole.WriteLine("Buffer is {0} bytes.", buffer?.Length.ToString() ?? "null"); + DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer)); + DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer?.Length.ToString() ?? "null"); DicConsole.WriteLine("Sense buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(senseBuffer)); DicConsole.WriteLine(); DicConsole.WriteLine("Choose what to do:"); @@ -1338,15 +1341,15 @@ namespace DiscImageChef.Tests.Devices.SCSI static void ReadReverse16(string devPath, Device dev) { - bool byteOrder = false; - bool sili = false; - bool fixedLen = true; - uint objectSize = 512; - uint length = 1; - byte partition = 0; - ulong objectId = 0; + bool byteOrder = false; + bool sili = false; + bool fixedLen = true; + uint objectSize = 512; + uint length = 1; + byte partition = 0; + ulong objectId = 0; string strDev; - int item; + int item; parameters: while(true) @@ -1355,9 +1358,9 @@ namespace DiscImageChef.Tests.Devices.SCSI DicConsole.WriteLine("Device: {0}", devPath); 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"); + DicConsole.WriteLine("Will read {0} {1}", length, fixedLen ? "objects" : "bytes"); if(fixedLen) DicConsole.WriteLine("{0} bytes expected per object", objectSize); - DicConsole.WriteLine("Suppress length indicator?: {0}", sili); + 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); DicConsole.WriteLine(); @@ -1406,6 +1409,7 @@ namespace DiscImageChef.Tests.Devices.SCSI fixedLen ? "blocks" : "bytes"); length = 0xFFFFFF; } + if(fixedLen) { DicConsole.Write("How many bytes to expect per object?: "); @@ -1471,11 +1475,11 @@ namespace DiscImageChef.Tests.Devices.SCSI 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?.Length.ToString() ?? "null"); - DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer)); - DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer?.Length.ToString() ?? "null"); + DicConsole.WriteLine("Command took {0} ms.", duration); + DicConsole.WriteLine("Sense is {0}.", sense); + DicConsole.WriteLine("Buffer is {0} bytes.", buffer?.Length.ToString() ?? "null"); + DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer)); + DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer?.Length.ToString() ?? "null"); DicConsole.WriteLine("Sense buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(senseBuffer)); DicConsole.WriteLine(); DicConsole.WriteLine("Choose what to do:"); @@ -1543,12 +1547,12 @@ namespace DiscImageChef.Tests.Devices.SCSI static void RecoverBufferedData(string devPath, Device dev) { - bool sili = false; - bool fixedLen = true; - uint blockSize = 512; - uint length = 1; + bool sili = false; + bool fixedLen = true; + uint blockSize = 512; + uint length = 1; string strDev; - int item; + int item; parameters: while(true) @@ -1557,7 +1561,7 @@ namespace DiscImageChef.Tests.Devices.SCSI DicConsole.WriteLine("Device: {0}", devPath); 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"); + DicConsole.WriteLine("Will read {0} {1}", length, fixedLen ? "blocks" : "bytes"); if(fixedLen) DicConsole.WriteLine("{0} bytes expected per block", blockSize); DicConsole.WriteLine("Suppress length indicator?: {0}", sili); DicConsole.WriteLine(); @@ -1606,6 +1610,7 @@ namespace DiscImageChef.Tests.Devices.SCSI fixedLen ? "blocks" : "bytes"); length = 0xFFFFFF; } + if(fixedLen) { DicConsole.Write("How many bytes to expect per block?: "); @@ -1641,11 +1646,11 @@ namespace DiscImageChef.Tests.Devices.SCSI 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?.Length.ToString() ?? "null"); - DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer)); - DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer?.Length.ToString() ?? "null"); + DicConsole.WriteLine("Command took {0} ms.", duration); + DicConsole.WriteLine("Sense is {0}.", sense); + DicConsole.WriteLine("Buffer is {0} bytes.", buffer?.Length.ToString() ?? "null"); + DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer)); + DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer?.Length.ToString() ?? "null"); DicConsole.WriteLine("Sense buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(senseBuffer)); DicConsole.WriteLine(); DicConsole.WriteLine("Choose what to do:"); @@ -1713,10 +1718,10 @@ namespace DiscImageChef.Tests.Devices.SCSI static void ReportDensitySupport(string devPath, Device dev) { - bool medium = false; - bool current = false; + bool medium = false; + bool current = false; string strDev; - int item; + int item; parameters: while(true) @@ -1724,7 +1729,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("Parameters for REPORT DENSITY SUPPORT command:"); - DicConsole.WriteLine("Report about medium types?: {0}", medium); + DicConsole.WriteLine("Report about medium types?: {0}", medium); DicConsole.WriteLine("Report about current medium?: {0}", current); DicConsole.WriteLine(); DicConsole.WriteLine("Choose what to do:"); @@ -1778,11 +1783,11 @@ namespace DiscImageChef.Tests.Devices.SCSI 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?.Length.ToString() ?? "null"); - DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer)); - DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer?.Length.ToString() ?? "null"); + DicConsole.WriteLine("Command took {0} ms.", duration); + DicConsole.WriteLine("Sense is {0}.", sense); + DicConsole.WriteLine("Buffer is {0} bytes.", buffer?.Length.ToString() ?? "null"); + DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer)); + DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer?.Length.ToString() ?? "null"); DicConsole.WriteLine("Sense buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(senseBuffer)); DicConsole.WriteLine(); DicConsole.WriteLine("Choose what to do:"); @@ -1864,9 +1869,9 @@ namespace DiscImageChef.Tests.Devices.SCSI static void Rewind(string devPath, Device dev) { - bool immediate = false; + bool immediate = false; string strDev; - int item; + int item; parameters: while(true) @@ -1916,9 +1921,9 @@ namespace DiscImageChef.Tests.Devices.SCSI 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?.Length.ToString() ?? "null"); + DicConsole.WriteLine("Command took {0} ms.", duration); + DicConsole.WriteLine("Sense is {0}.", sense); + DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer?.Length.ToString() ?? "null"); DicConsole.WriteLine("Sense buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(senseBuffer)); DicConsole.WriteLine("REWIND decoded sense:"); DicConsole.Write("{0}", Sense.PrettifySense(senseBuffer)); @@ -1966,10 +1971,10 @@ namespace DiscImageChef.Tests.Devices.SCSI static void Space(string devPath, Device dev) { - SscSpaceCodes what = SscSpaceCodes.LogicalBlock; - int count = -1; - string strDev; - int item; + SscSpaceCodes what = SscSpaceCodes.LogicalBlock; + int count = -1; + string strDev; + int item; parameters: while(true) @@ -1978,7 +1983,7 @@ namespace DiscImageChef.Tests.Devices.SCSI DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("Parameters for SPACE command:"); DicConsole.WriteLine("What to space: {0}", what); - DicConsole.WriteLine("How many: {0}", count); + DicConsole.WriteLine("How many: {0}", count); DicConsole.WriteLine(); DicConsole.WriteLine("Choose what to do:"); DicConsole.WriteLine("1.- Change parameters."); @@ -2034,9 +2039,9 @@ namespace DiscImageChef.Tests.Devices.SCSI 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?.Length.ToString() ?? "null"); + DicConsole.WriteLine("Command took {0} ms.", duration); + DicConsole.WriteLine("Sense is {0}.", sense); + DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer?.Length.ToString() ?? "null"); DicConsole.WriteLine("Sense buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(senseBuffer)); DicConsole.WriteLine("SPACE decoded sense:"); DicConsole.Write("{0}", Sense.PrettifySense(senseBuffer)); @@ -2084,9 +2089,9 @@ namespace DiscImageChef.Tests.Devices.SCSI static void TrackSelect(string devPath, Device dev) { - byte track = 1; + byte track = 1; string strDev; - int item; + int item; parameters: while(true) @@ -2136,9 +2141,9 @@ namespace DiscImageChef.Tests.Devices.SCSI 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?.Length.ToString() ?? "null"); + DicConsole.WriteLine("Command took {0} ms.", duration); + DicConsole.WriteLine("Sense is {0}.", sense); + DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer?.Length.ToString() ?? "null"); DicConsole.WriteLine("Sense buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(senseBuffer)); DicConsole.WriteLine("TRACK SELECT decoded sense:"); DicConsole.Write("{0}", Sense.PrettifySense(senseBuffer)); diff --git a/DiscImageChef.Tests.Devices/SCSI/SyQuest.cs b/DiscImageChef.Tests.Devices/SCSI/SyQuest.cs index ee5e554a9..08d3c3a3e 100644 --- a/DiscImageChef.Tests.Devices/SCSI/SyQuest.cs +++ b/DiscImageChef.Tests.Devices/SCSI/SyQuest.cs @@ -87,23 +87,23 @@ namespace DiscImageChef.Tests.Devices.SCSI static void Read6(string devPath, Device dev, bool readlong) { - uint lba = 0; - uint blockSize = 512; - byte count = 1; - bool noDma = false; + uint lba = 0; + uint blockSize = 512; + byte count = 1; + bool noDma = false; string strDev; - int item; + int item; parameters: while(true) { System.Console.Clear(); - DicConsole.WriteLine("Device: {0}", devPath); + DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("Parameters for READ {0}(6) command:", readlong ? "LONG " : ""); - DicConsole.WriteLine("LBA: {0}", lba); - DicConsole.WriteLine("{0} blocks to read", count == 0 ? 256 : count); - DicConsole.WriteLine("{0} bytes expected per block", blockSize); - DicConsole.WriteLine("Inhibit DMA?: {0}", noDma); + DicConsole.WriteLine("LBA: {0}", lba); + DicConsole.WriteLine("{0} blocks to read", count == 0 ? 256 : count); + DicConsole.WriteLine("{0} bytes expected per block", blockSize); + DicConsole.WriteLine("Inhibit DMA?: {0}", noDma); DicConsole.WriteLine(); DicConsole.WriteLine("Choose what to do:"); DicConsole.WriteLine("1.- Change parameters."); @@ -139,6 +139,7 @@ namespace DiscImageChef.Tests.Devices.SCSI DicConsole.WriteLine("Max LBA is {0}, setting to {0}", 0x1FFFFF); lba = 0x1FFFFF; } + DicConsole.Write("Blocks to read (0 for 256 blocks)?: "); strDev = System.Console.ReadLine(); if(!byte.TryParse(strDev, out count)) @@ -179,13 +180,13 @@ namespace DiscImageChef.Tests.Devices.SCSI readlong, dev.Timeout, out double duration); menu: - DicConsole.WriteLine("Device: {0}", devPath); + 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?.Length.ToString() ?? "null"); - DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer)); - DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer?.Length.ToString() ?? "null"); + DicConsole.WriteLine("Command took {0} ms.", duration); + DicConsole.WriteLine("Sense is {0}.", sense); + DicConsole.WriteLine("Buffer is {0} bytes.", buffer?.Length.ToString() ?? "null"); + DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer)); + DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer?.Length.ToString() ?? "null"); DicConsole.WriteLine("Sense buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(senseBuffer)); DicConsole.WriteLine(); DicConsole.WriteLine("Choose what to do:"); @@ -213,7 +214,7 @@ namespace DiscImageChef.Tests.Devices.SCSI return; case 1: System.Console.Clear(); - DicConsole.WriteLine("Device: {0}", devPath); + DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("READ {0}(6) response:", readlong ? "LONG " : ""); if(buffer != null) PrintHex.PrintHexArray(buffer, 64); DicConsole.WriteLine("Press any key to continue..."); @@ -223,7 +224,7 @@ namespace DiscImageChef.Tests.Devices.SCSI goto menu; case 2: System.Console.Clear(); - DicConsole.WriteLine("Device: {0}", devPath); + DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("READ {0}(6) sense:", readlong ? "LONG " : ""); if(senseBuffer != null) PrintHex.PrintHexArray(senseBuffer, 64); DicConsole.WriteLine("Press any key to continue..."); @@ -233,7 +234,7 @@ namespace DiscImageChef.Tests.Devices.SCSI goto menu; case 3: System.Console.Clear(); - DicConsole.WriteLine("Device: {0}", devPath); + DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("READ {0}(6) decoded sense:", readlong ? "LONG " : ""); DicConsole.Write("{0}", Sense.PrettifySense(senseBuffer)); DicConsole.WriteLine("Press any key to continue..."); @@ -253,23 +254,23 @@ namespace DiscImageChef.Tests.Devices.SCSI static void Read10(string devPath, Device dev, bool readlong) { - uint lba = 0; - uint blockSize = 512; - byte count = 1; - bool noDma = false; + uint lba = 0; + uint blockSize = 512; + byte count = 1; + bool noDma = false; string strDev; - int item; + int item; parameters: while(true) { System.Console.Clear(); - DicConsole.WriteLine("Device: {0}", devPath); + DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("Parameters for READ {0}(10) command:", readlong ? "LONG " : ""); - DicConsole.WriteLine("LBA: {0}", lba); - DicConsole.WriteLine("{0} blocks to read", count == 0 ? 256 : count); - DicConsole.WriteLine("{0} bytes expected per block", blockSize); - DicConsole.WriteLine("Inhibit DMA?: {0}", noDma); + DicConsole.WriteLine("LBA: {0}", lba); + DicConsole.WriteLine("{0} blocks to read", count == 0 ? 256 : count); + DicConsole.WriteLine("{0} bytes expected per block", blockSize); + DicConsole.WriteLine("Inhibit DMA?: {0}", noDma); DicConsole.WriteLine(); DicConsole.WriteLine("Choose what to do:"); DicConsole.WriteLine("1.- Change parameters."); @@ -340,14 +341,14 @@ namespace DiscImageChef.Tests.Devices.SCSI readlong, dev.Timeout, out double duration); menu: - DicConsole.WriteLine("Device: {0}", devPath); + 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?.Length.ToString() ?? "null"); - DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer)); - DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer?.Length.ToString() ?? "null"); - DicConsole.WriteLine("Sense buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(senseBuffer)); + DicConsole.WriteLine("Command took {0} ms.", duration); + DicConsole.WriteLine("Sense is {0}.", sense); + DicConsole.WriteLine("Buffer is {0} bytes.", buffer?.Length.ToString() ?? "null"); + DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer)); + DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer?.Length.ToString() ?? "null"); + DicConsole.WriteLine("Sense buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(senseBuffer)); DicConsole.WriteLine(); DicConsole.WriteLine("Choose what to do:"); DicConsole.WriteLine("1.- Print buffer."); @@ -374,7 +375,7 @@ namespace DiscImageChef.Tests.Devices.SCSI return; case 1: System.Console.Clear(); - DicConsole.WriteLine("Device: {0}", devPath); + DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("READ {0}(10) response:", readlong ? "LONG " : ""); if(buffer != null) PrintHex.PrintHexArray(buffer, 64); DicConsole.WriteLine("Press any key to continue..."); @@ -384,7 +385,7 @@ namespace DiscImageChef.Tests.Devices.SCSI goto menu; case 2: System.Console.Clear(); - DicConsole.WriteLine("Device: {0}", devPath); + DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("READ {0}(10) sense:", readlong ? "LONG " : ""); if(senseBuffer != null) PrintHex.PrintHexArray(senseBuffer, 64); DicConsole.WriteLine("Press any key to continue..."); @@ -394,7 +395,7 @@ namespace DiscImageChef.Tests.Devices.SCSI goto menu; case 3: System.Console.Clear(); - DicConsole.WriteLine("Device: {0}", devPath); + DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("READ {0}(10) decoded sense:", readlong ? "LONG " : ""); DicConsole.Write("{0}", Sense.PrettifySense(senseBuffer)); DicConsole.WriteLine("Press any key to continue..."); @@ -423,11 +424,11 @@ namespace DiscImageChef.Tests.Devices.SCSI 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?.Length.ToString() ?? "null"); - DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer)); - DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer?.Length.ToString() ?? "null"); + DicConsole.WriteLine("Command took {0} ms.", duration); + DicConsole.WriteLine("Sense is {0}.", sense); + DicConsole.WriteLine("Buffer is {0} bytes.", buffer?.Length.ToString() ?? "null"); + DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer)); + DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer?.Length.ToString() ?? "null"); DicConsole.WriteLine("Sense buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(senseBuffer)); DicConsole.WriteLine(); DicConsole.WriteLine("Choose what to do:"); diff --git a/DiscImageChef.Tests.Devices/SecureDigital/MultiMediaCard.cs b/DiscImageChef.Tests.Devices/SecureDigital/MultiMediaCard.cs index 2345e6558..419c79a7d 100644 --- a/DiscImageChef.Tests.Devices/SecureDigital/MultiMediaCard.cs +++ b/DiscImageChef.Tests.Devices/SecureDigital/MultiMediaCard.cs @@ -98,21 +98,21 @@ namespace DiscImageChef.Tests.Devices.SecureDigital static void Read(string devPath, Device dev, bool multiple) { - uint address = 0; - uint blockSize = 512; - uint count = 1; - bool byteAddr = false; + uint address = 0; + uint blockSize = 512; + uint count = 1; + bool byteAddr = false; string strDev; - int item; + int item; parameters: while(true) { System.Console.Clear(); - DicConsole.WriteLine("Device: {0}", devPath); + DicConsole.WriteLine("Device: {0}", devPath); 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); + 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); DicConsole.WriteLine(); DicConsole.WriteLine("Choose what to do:"); @@ -187,13 +187,13 @@ namespace DiscImageChef.Tests.Devices.SecureDigital byteAddr, dev.Timeout, out double duration); menu: - DicConsole.WriteLine("Device: {0}", devPath); + DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("Sending READ_{0}_BLOCK to the device:", multiple ? "MULTIPLE" : "SINGLE"); - DicConsole.WriteLine("Command took {0} ms.", duration); - DicConsole.WriteLine("Sense is {0}.", sense); - DicConsole.WriteLine("Buffer is {0} bytes.", buffer?.Length.ToString() ?? "null"); - DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer)); - DicConsole.WriteLine("Response has {0} elements.", response?.Length.ToString() ?? "null"); + DicConsole.WriteLine("Command took {0} ms.", duration); + DicConsole.WriteLine("Sense is {0}.", sense); + DicConsole.WriteLine("Buffer is {0} bytes.", buffer?.Length.ToString() ?? "null"); + DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer)); + DicConsole.WriteLine("Response has {0} elements.", response?.Length.ToString() ?? "null"); DicConsole.WriteLine(); DicConsole.WriteLine("Choose what to do:"); DicConsole.WriteLine("1.- Print buffer."); @@ -219,7 +219,7 @@ namespace DiscImageChef.Tests.Devices.SecureDigital return; case 1: System.Console.Clear(); - DicConsole.WriteLine("Device: {0}", devPath); + DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("READ_{0}_BLOCK buffer:", multiple ? "MULTIPLE" : "SINGLE"); if(buffer != null) PrintHex.PrintHexArray(buffer, 64); DicConsole.WriteLine("Press any key to continue..."); @@ -229,7 +229,7 @@ namespace DiscImageChef.Tests.Devices.SecureDigital goto menu; case 2: System.Console.Clear(); - DicConsole.WriteLine("Device: {0}", devPath); + DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("READ_{0}_BLOCK response:", multiple ? "MULTIPLE" : "SINGLE"); if(response != null) { @@ -262,11 +262,11 @@ namespace DiscImageChef.Tests.Devices.SecureDigital menu: DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("Sending SEND_OP_COND to the device:"); - DicConsole.WriteLine("Command took {0} ms.", duration); - DicConsole.WriteLine("Sense is {0}.", sense); - DicConsole.WriteLine("Buffer is {0} bytes.", buffer?.Length.ToString() ?? "null"); + DicConsole.WriteLine("Command took {0} ms.", duration); + DicConsole.WriteLine("Sense is {0}.", sense); + DicConsole.WriteLine("Buffer is {0} bytes.", buffer?.Length.ToString() ?? "null"); DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer)); - DicConsole.WriteLine("Response has {0} elements.", response?.Length.ToString() ?? "null"); + DicConsole.WriteLine("Response has {0} elements.", response?.Length.ToString() ?? "null"); DicConsole.WriteLine(); DicConsole.WriteLine("Choose what to do:"); DicConsole.WriteLine("1.- Print buffer."); @@ -344,11 +344,11 @@ namespace DiscImageChef.Tests.Devices.SecureDigital menu: DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("Sending SEND_STATUS to the device:"); - DicConsole.WriteLine("Command took {0} ms.", duration); - DicConsole.WriteLine("Sense is {0}.", sense); - DicConsole.WriteLine("Buffer is {0} bytes.", buffer?.Length.ToString() ?? "null"); + DicConsole.WriteLine("Command took {0} ms.", duration); + DicConsole.WriteLine("Sense is {0}.", sense); + DicConsole.WriteLine("Buffer is {0} bytes.", buffer?.Length.ToString() ?? "null"); DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer)); - DicConsole.WriteLine("Response has {0} elements.", response?.Length.ToString() ?? "null"); + DicConsole.WriteLine("Response has {0} elements.", response?.Length.ToString() ?? "null"); DicConsole.WriteLine(); DicConsole.WriteLine("Choose what to do:"); DicConsole.WriteLine("1.- Print buffer."); @@ -415,11 +415,11 @@ namespace DiscImageChef.Tests.Devices.SecureDigital menu: DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("Sending SEND_CID to the device:"); - DicConsole.WriteLine("Command took {0} ms.", duration); - DicConsole.WriteLine("Sense is {0}.", sense); - DicConsole.WriteLine("Buffer is {0} bytes.", buffer?.Length.ToString() ?? "null"); + DicConsole.WriteLine("Command took {0} ms.", duration); + DicConsole.WriteLine("Sense is {0}.", sense); + DicConsole.WriteLine("Buffer is {0} bytes.", buffer?.Length.ToString() ?? "null"); DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer)); - DicConsole.WriteLine("Response has {0} elements.", response?.Length.ToString() ?? "null"); + DicConsole.WriteLine("Response has {0} elements.", response?.Length.ToString() ?? "null"); DicConsole.WriteLine(); DicConsole.WriteLine("Choose what to do:"); DicConsole.WriteLine("1.- Print buffer."); @@ -497,11 +497,11 @@ namespace DiscImageChef.Tests.Devices.SecureDigital menu: DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("Sending SEND_CSD to the device:"); - DicConsole.WriteLine("Command took {0} ms.", duration); - DicConsole.WriteLine("Sense is {0}.", sense); - DicConsole.WriteLine("Buffer is {0} bytes.", buffer?.Length.ToString() ?? "null"); + DicConsole.WriteLine("Command took {0} ms.", duration); + DicConsole.WriteLine("Sense is {0}.", sense); + DicConsole.WriteLine("Buffer is {0} bytes.", buffer?.Length.ToString() ?? "null"); DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer)); - DicConsole.WriteLine("Response has {0} elements.", response?.Length.ToString() ?? "null"); + DicConsole.WriteLine("Response has {0} elements.", response?.Length.ToString() ?? "null"); DicConsole.WriteLine(); DicConsole.WriteLine("Choose what to do:"); DicConsole.WriteLine("1.- Print buffer."); @@ -579,11 +579,11 @@ namespace DiscImageChef.Tests.Devices.SecureDigital menu: DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("Sending SEND_EXT_CSD to the device:"); - DicConsole.WriteLine("Command took {0} ms.", duration); - DicConsole.WriteLine("Sense is {0}.", sense); - DicConsole.WriteLine("Buffer is {0} bytes.", buffer?.Length.ToString() ?? "null"); + DicConsole.WriteLine("Command took {0} ms.", duration); + DicConsole.WriteLine("Sense is {0}.", sense); + DicConsole.WriteLine("Buffer is {0} bytes.", buffer?.Length.ToString() ?? "null"); DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer)); - DicConsole.WriteLine("Response has {0} elements.", response?.Length.ToString() ?? "null"); + DicConsole.WriteLine("Response has {0} elements.", response?.Length.ToString() ?? "null"); DicConsole.WriteLine(); DicConsole.WriteLine("Choose what to do:"); DicConsole.WriteLine("1.- Print buffer."); @@ -654,9 +654,9 @@ namespace DiscImageChef.Tests.Devices.SecureDigital static void SetBlockLength(string devPath, Device dev) { - uint blockSize = 512; + uint blockSize = 512; string strDev; - int item; + int item; parameters: while(true) @@ -706,8 +706,8 @@ namespace DiscImageChef.Tests.Devices.SecureDigital menu: DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("Sending SET_BLOCKLEN to the device:"); - DicConsole.WriteLine("Command took {0} ms.", duration); - DicConsole.WriteLine("Sense is {0}.", sense); + DicConsole.WriteLine("Command took {0} ms.", duration); + DicConsole.WriteLine("Sense is {0}.", sense); DicConsole.WriteLine("Response has {0} elements.", response?.Length.ToString() ?? "null"); DicConsole.WriteLine("SET_BLOCKLEN response:"); if(response != null) diff --git a/DiscImageChef.Tests.Devices/SecureDigital/SecureDigital.cs b/DiscImageChef.Tests.Devices/SecureDigital/SecureDigital.cs index 837355ffb..f43608e56 100644 --- a/DiscImageChef.Tests.Devices/SecureDigital/SecureDigital.cs +++ b/DiscImageChef.Tests.Devices/SecureDigital/SecureDigital.cs @@ -98,21 +98,21 @@ namespace DiscImageChef.Tests.Devices.SecureDigital static void Read(string devPath, Device dev, bool multiple) { - uint address = 0; - uint blockSize = 512; - uint count = 1; - bool byteAddr = false; + uint address = 0; + uint blockSize = 512; + uint count = 1; + bool byteAddr = false; string strDev; - int item; + int item; parameters: while(true) { System.Console.Clear(); - DicConsole.WriteLine("Device: {0}", devPath); + DicConsole.WriteLine("Device: {0}", devPath); 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); + 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); DicConsole.WriteLine(); DicConsole.WriteLine("Choose what to do:"); @@ -187,13 +187,13 @@ namespace DiscImageChef.Tests.Devices.SecureDigital byteAddr, dev.Timeout, out double duration); menu: - DicConsole.WriteLine("Device: {0}", devPath); + DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("Sending READ_{0}_BLOCK to the device:", multiple ? "MULTIPLE" : "SINGLE"); - DicConsole.WriteLine("Command took {0} ms.", duration); - DicConsole.WriteLine("Sense is {0}.", sense); - DicConsole.WriteLine("Buffer is {0} bytes.", buffer?.Length.ToString() ?? "null"); - DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer)); - DicConsole.WriteLine("Response has {0} elements.", response?.Length.ToString() ?? "null"); + DicConsole.WriteLine("Command took {0} ms.", duration); + DicConsole.WriteLine("Sense is {0}.", sense); + DicConsole.WriteLine("Buffer is {0} bytes.", buffer?.Length.ToString() ?? "null"); + DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer)); + DicConsole.WriteLine("Response has {0} elements.", response?.Length.ToString() ?? "null"); DicConsole.WriteLine(); DicConsole.WriteLine("Choose what to do:"); DicConsole.WriteLine("1.- Print buffer."); @@ -219,7 +219,7 @@ namespace DiscImageChef.Tests.Devices.SecureDigital return; case 1: System.Console.Clear(); - DicConsole.WriteLine("Device: {0}", devPath); + DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("READ_{0}_BLOCK buffer:", multiple ? "MULTIPLE" : "SINGLE"); if(buffer != null) PrintHex.PrintHexArray(buffer, 64); DicConsole.WriteLine("Press any key to continue..."); @@ -229,7 +229,7 @@ namespace DiscImageChef.Tests.Devices.SecureDigital goto menu; case 2: System.Console.Clear(); - DicConsole.WriteLine("Device: {0}", devPath); + DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("READ_{0}_BLOCK response:", multiple ? "MULTIPLE" : "SINGLE"); if(response != null) { @@ -262,11 +262,11 @@ namespace DiscImageChef.Tests.Devices.SecureDigital menu: DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("Sending SD_SEND_OP_COND to the device:"); - DicConsole.WriteLine("Command took {0} ms.", duration); - DicConsole.WriteLine("Sense is {0}.", sense); - DicConsole.WriteLine("Buffer is {0} bytes.", buffer?.Length.ToString() ?? "null"); + DicConsole.WriteLine("Command took {0} ms.", duration); + DicConsole.WriteLine("Sense is {0}.", sense); + DicConsole.WriteLine("Buffer is {0} bytes.", buffer?.Length.ToString() ?? "null"); DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer)); - DicConsole.WriteLine("Response has {0} elements.", response?.Length.ToString() ?? "null"); + DicConsole.WriteLine("Response has {0} elements.", response?.Length.ToString() ?? "null"); DicConsole.WriteLine(); DicConsole.WriteLine("Choose what to do:"); DicConsole.WriteLine("1.- Print buffer."); @@ -344,11 +344,11 @@ namespace DiscImageChef.Tests.Devices.SecureDigital menu: DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("Sending SD_STATUS to the device:"); - DicConsole.WriteLine("Command took {0} ms.", duration); - DicConsole.WriteLine("Sense is {0}.", sense); - DicConsole.WriteLine("Buffer is {0} bytes.", buffer?.Length.ToString() ?? "null"); + DicConsole.WriteLine("Command took {0} ms.", duration); + DicConsole.WriteLine("Sense is {0}.", sense); + DicConsole.WriteLine("Buffer is {0} bytes.", buffer?.Length.ToString() ?? "null"); DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer)); - DicConsole.WriteLine("Response has {0} elements.", response?.Length.ToString() ?? "null"); + DicConsole.WriteLine("Response has {0} elements.", response?.Length.ToString() ?? "null"); DicConsole.WriteLine(); DicConsole.WriteLine("Choose what to do:"); DicConsole.WriteLine("1.- Print buffer."); @@ -415,11 +415,11 @@ namespace DiscImageChef.Tests.Devices.SecureDigital menu: DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("Sending SEND_CID to the device:"); - DicConsole.WriteLine("Command took {0} ms.", duration); - DicConsole.WriteLine("Sense is {0}.", sense); - DicConsole.WriteLine("Buffer is {0} bytes.", buffer?.Length.ToString() ?? "null"); + DicConsole.WriteLine("Command took {0} ms.", duration); + DicConsole.WriteLine("Sense is {0}.", sense); + DicConsole.WriteLine("Buffer is {0} bytes.", buffer?.Length.ToString() ?? "null"); DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer)); - DicConsole.WriteLine("Response has {0} elements.", response?.Length.ToString() ?? "null"); + DicConsole.WriteLine("Response has {0} elements.", response?.Length.ToString() ?? "null"); DicConsole.WriteLine(); DicConsole.WriteLine("Choose what to do:"); DicConsole.WriteLine("1.- Print buffer."); @@ -497,11 +497,11 @@ namespace DiscImageChef.Tests.Devices.SecureDigital menu: DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("Sending SEND_CSD to the device:"); - DicConsole.WriteLine("Command took {0} ms.", duration); - DicConsole.WriteLine("Sense is {0}.", sense); - DicConsole.WriteLine("Buffer is {0} bytes.", buffer?.Length.ToString() ?? "null"); + DicConsole.WriteLine("Command took {0} ms.", duration); + DicConsole.WriteLine("Sense is {0}.", sense); + DicConsole.WriteLine("Buffer is {0} bytes.", buffer?.Length.ToString() ?? "null"); DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer)); - DicConsole.WriteLine("Response has {0} elements.", response?.Length.ToString() ?? "null"); + DicConsole.WriteLine("Response has {0} elements.", response?.Length.ToString() ?? "null"); DicConsole.WriteLine(); DicConsole.WriteLine("Choose what to do:"); DicConsole.WriteLine("1.- Print buffer."); @@ -579,11 +579,11 @@ namespace DiscImageChef.Tests.Devices.SecureDigital menu: DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("Sending SEND_SCR to the device:"); - DicConsole.WriteLine("Command took {0} ms.", duration); - DicConsole.WriteLine("Sense is {0}.", sense); - DicConsole.WriteLine("Buffer is {0} bytes.", buffer?.Length.ToString() ?? "null"); + DicConsole.WriteLine("Command took {0} ms.", duration); + DicConsole.WriteLine("Sense is {0}.", sense); + DicConsole.WriteLine("Buffer is {0} bytes.", buffer?.Length.ToString() ?? "null"); DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer)); - DicConsole.WriteLine("Response has {0} elements.", response?.Length.ToString() ?? "null"); + DicConsole.WriteLine("Response has {0} elements.", response?.Length.ToString() ?? "null"); DicConsole.WriteLine(); DicConsole.WriteLine("Choose what to do:"); DicConsole.WriteLine("1.- Print buffer."); @@ -654,9 +654,9 @@ namespace DiscImageChef.Tests.Devices.SecureDigital static void SetBlockLength(string devPath, Device dev) { - uint blockSize = 512; + uint blockSize = 512; string strDev; - int item; + int item; parameters: while(true) @@ -706,8 +706,8 @@ namespace DiscImageChef.Tests.Devices.SecureDigital menu: DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("Sending SET_BLOCKLEN to the device:"); - DicConsole.WriteLine("Command took {0} ms.", duration); - DicConsole.WriteLine("Sense is {0}.", sense); + DicConsole.WriteLine("Command took {0} ms.", duration); + DicConsole.WriteLine("Sense is {0}.", sense); DicConsole.WriteLine("Response has {0} elements.", response?.Length.ToString() ?? "null"); DicConsole.WriteLine("SET_BLOCKLEN response:"); if(response != null) diff --git a/DiscImageChef.Tests/Checksums/Adler32.cs b/DiscImageChef.Tests/Checksums/Adler32.cs index ea726ead3..c094425ad 100644 --- a/DiscImageChef.Tests/Checksums/Adler32.cs +++ b/DiscImageChef.Tests/Checksums/Adler32.cs @@ -48,9 +48,9 @@ namespace DiscImageChef.Tests.Checksums [Test] public void Adler32EmptyData() { - byte[] data = new byte[1048576]; - FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "empty"), FileMode.Open, - FileAccess.Read); + byte[] data = new byte[1048576]; + FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "empty"), FileMode.Open, + FileAccess.Read); fs.Read(data, 0, 1048576); fs.Close(); fs.Dispose(); @@ -61,9 +61,9 @@ namespace DiscImageChef.Tests.Checksums [Test] public void Adler32EmptyInstance() { - byte[] data = new byte[1048576]; - FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "empty"), FileMode.Open, - FileAccess.Read); + byte[] data = new byte[1048576]; + FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "empty"), FileMode.Open, + FileAccess.Read); fs.Read(data, 0, 1048576); fs.Close(); fs.Dispose(); @@ -83,9 +83,9 @@ namespace DiscImageChef.Tests.Checksums [Test] public void Adler32RandomData() { - byte[] data = new byte[1048576]; - FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "random"), FileMode.Open, - FileAccess.Read); + byte[] data = new byte[1048576]; + FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "random"), FileMode.Open, + FileAccess.Read); fs.Read(data, 0, 1048576); fs.Close(); fs.Dispose(); @@ -96,9 +96,9 @@ namespace DiscImageChef.Tests.Checksums [Test] public void Adler32RandomInstance() { - byte[] data = new byte[1048576]; - FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "random"), FileMode.Open, - FileAccess.Read); + byte[] data = new byte[1048576]; + FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "random"), FileMode.Open, + FileAccess.Read); fs.Read(data, 0, 1048576); fs.Close(); fs.Dispose(); diff --git a/DiscImageChef.Tests/Checksums/CRC16.cs b/DiscImageChef.Tests/Checksums/CRC16.cs index e3f648144..70db5eab5 100644 --- a/DiscImageChef.Tests/Checksums/CRC16.cs +++ b/DiscImageChef.Tests/Checksums/CRC16.cs @@ -48,9 +48,9 @@ namespace DiscImageChef.Tests.Checksums [Test] public void Crc16EmptyData() { - byte[] data = new byte[1048576]; - FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "empty"), FileMode.Open, - FileAccess.Read); + byte[] data = new byte[1048576]; + FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "empty"), FileMode.Open, + FileAccess.Read); fs.Read(data, 0, 1048576); fs.Close(); fs.Dispose(); @@ -61,9 +61,9 @@ namespace DiscImageChef.Tests.Checksums [Test] public void Crc16EmptyInstance() { - byte[] data = new byte[1048576]; - FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "empty"), FileMode.Open, - FileAccess.Read); + byte[] data = new byte[1048576]; + FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "empty"), FileMode.Open, + FileAccess.Read); fs.Read(data, 0, 1048576); fs.Close(); fs.Dispose(); @@ -83,9 +83,9 @@ namespace DiscImageChef.Tests.Checksums [Test] public void Crc16RandomData() { - byte[] data = new byte[1048576]; - FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "random"), FileMode.Open, - FileAccess.Read); + byte[] data = new byte[1048576]; + FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "random"), FileMode.Open, + FileAccess.Read); fs.Read(data, 0, 1048576); fs.Close(); fs.Dispose(); @@ -96,9 +96,9 @@ namespace DiscImageChef.Tests.Checksums [Test] public void Crc16RandomInstance() { - byte[] data = new byte[1048576]; - FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "random"), FileMode.Open, - FileAccess.Read); + byte[] data = new byte[1048576]; + FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "random"), FileMode.Open, + FileAccess.Read); fs.Read(data, 0, 1048576); fs.Close(); fs.Dispose(); diff --git a/DiscImageChef.Tests/Checksums/CRC32.cs b/DiscImageChef.Tests/Checksums/CRC32.cs index a941f2ada..c44b8334b 100644 --- a/DiscImageChef.Tests/Checksums/CRC32.cs +++ b/DiscImageChef.Tests/Checksums/CRC32.cs @@ -48,9 +48,9 @@ namespace DiscImageChef.Tests.Checksums [Test] public void Crc32EmptyData() { - byte[] data = new byte[1048576]; - FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "empty"), FileMode.Open, - FileAccess.Read); + byte[] data = new byte[1048576]; + FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "empty"), FileMode.Open, + FileAccess.Read); fs.Read(data, 0, 1048576); fs.Close(); fs.Dispose(); @@ -61,9 +61,9 @@ namespace DiscImageChef.Tests.Checksums [Test] public void Crc32EmptyInstance() { - byte[] data = new byte[1048576]; - FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "empty"), FileMode.Open, - FileAccess.Read); + byte[] data = new byte[1048576]; + FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "empty"), FileMode.Open, + FileAccess.Read); fs.Read(data, 0, 1048576); fs.Close(); fs.Dispose(); @@ -83,9 +83,9 @@ namespace DiscImageChef.Tests.Checksums [Test] public void Crc32RandomData() { - byte[] data = new byte[1048576]; - FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "random"), FileMode.Open, - FileAccess.Read); + byte[] data = new byte[1048576]; + FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "random"), FileMode.Open, + FileAccess.Read); fs.Read(data, 0, 1048576); fs.Close(); fs.Dispose(); @@ -96,9 +96,9 @@ namespace DiscImageChef.Tests.Checksums [Test] public void Crc32RandomInstance() { - byte[] data = new byte[1048576]; - FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "random"), FileMode.Open, - FileAccess.Read); + byte[] data = new byte[1048576]; + FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "random"), FileMode.Open, + FileAccess.Read); fs.Read(data, 0, 1048576); fs.Close(); fs.Dispose(); diff --git a/DiscImageChef.Tests/Checksums/CRC64.cs b/DiscImageChef.Tests/Checksums/CRC64.cs index 2a7e2cc30..b725990a3 100644 --- a/DiscImageChef.Tests/Checksums/CRC64.cs +++ b/DiscImageChef.Tests/Checksums/CRC64.cs @@ -48,9 +48,9 @@ namespace DiscImageChef.Tests.Checksums [Test] public void Crc64EmptyData() { - byte[] data = new byte[1048576]; - FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "empty"), FileMode.Open, - FileAccess.Read); + byte[] data = new byte[1048576]; + FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "empty"), FileMode.Open, + FileAccess.Read); fs.Read(data, 0, 1048576); fs.Close(); fs.Dispose(); @@ -61,9 +61,9 @@ namespace DiscImageChef.Tests.Checksums [Test] public void Crc64EmptyInstance() { - byte[] data = new byte[1048576]; - FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "empty"), FileMode.Open, - FileAccess.Read); + byte[] data = new byte[1048576]; + FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "empty"), FileMode.Open, + FileAccess.Read); fs.Read(data, 0, 1048576); fs.Close(); fs.Dispose(); @@ -83,9 +83,9 @@ namespace DiscImageChef.Tests.Checksums [Test] public void Crc64RandomData() { - byte[] data = new byte[1048576]; - FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "random"), FileMode.Open, - FileAccess.Read); + byte[] data = new byte[1048576]; + FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "random"), FileMode.Open, + FileAccess.Read); fs.Read(data, 0, 1048576); fs.Close(); fs.Dispose(); @@ -96,9 +96,9 @@ namespace DiscImageChef.Tests.Checksums [Test] public void Crc64RandomInstance() { - byte[] data = new byte[1048576]; - FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "random"), FileMode.Open, - FileAccess.Read); + byte[] data = new byte[1048576]; + FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "random"), FileMode.Open, + FileAccess.Read); fs.Read(data, 0, 1048576); fs.Close(); fs.Dispose(); diff --git a/DiscImageChef.Tests/Checksums/MD5.cs b/DiscImageChef.Tests/Checksums/MD5.cs index 68ff095bb..c37bea87b 100644 --- a/DiscImageChef.Tests/Checksums/MD5.cs +++ b/DiscImageChef.Tests/Checksums/MD5.cs @@ -50,9 +50,9 @@ namespace DiscImageChef.Tests.Checksums [Test] public void Md5EmptyData() { - byte[] data = new byte[1048576]; - FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "empty"), FileMode.Open, - FileAccess.Read); + byte[] data = new byte[1048576]; + FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "empty"), FileMode.Open, + FileAccess.Read); fs.Read(data, 0, 1048576); fs.Close(); fs.Dispose(); @@ -63,9 +63,9 @@ namespace DiscImageChef.Tests.Checksums [Test] public void Md5EmptyInstance() { - byte[] data = new byte[1048576]; - FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "empty"), FileMode.Open, - FileAccess.Read); + byte[] data = new byte[1048576]; + FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "empty"), FileMode.Open, + FileAccess.Read); fs.Read(data, 0, 1048576); fs.Close(); fs.Dispose(); @@ -85,9 +85,9 @@ namespace DiscImageChef.Tests.Checksums [Test] public void Md5RandomData() { - byte[] data = new byte[1048576]; - FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "random"), FileMode.Open, - FileAccess.Read); + byte[] data = new byte[1048576]; + FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "random"), FileMode.Open, + FileAccess.Read); fs.Read(data, 0, 1048576); fs.Close(); fs.Dispose(); @@ -98,9 +98,9 @@ namespace DiscImageChef.Tests.Checksums [Test] public void Md5RandomInstance() { - byte[] data = new byte[1048576]; - FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "random"), FileMode.Open, - FileAccess.Read); + byte[] data = new byte[1048576]; + FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "random"), FileMode.Open, + FileAccess.Read); fs.Read(data, 0, 1048576); fs.Close(); fs.Dispose(); diff --git a/DiscImageChef.Tests/Checksums/RIPEMD160.cs b/DiscImageChef.Tests/Checksums/RIPEMD160.cs index 8358ca202..6a27c462f 100644 --- a/DiscImageChef.Tests/Checksums/RIPEMD160.cs +++ b/DiscImageChef.Tests/Checksums/RIPEMD160.cs @@ -56,9 +56,9 @@ namespace DiscImageChef.Tests.Checksums [Test] public void Ripemd160EmptyData() { - byte[] data = new byte[1048576]; - FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "empty"), FileMode.Open, - FileAccess.Read); + byte[] data = new byte[1048576]; + FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "empty"), FileMode.Open, + FileAccess.Read); fs.Read(data, 0, 1048576); fs.Close(); fs.Dispose(); @@ -69,9 +69,9 @@ namespace DiscImageChef.Tests.Checksums [Test] public void Ripemd160EmptyInstance() { - byte[] data = new byte[1048576]; - FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "empty"), FileMode.Open, - FileAccess.Read); + byte[] data = new byte[1048576]; + FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "empty"), FileMode.Open, + FileAccess.Read); fs.Read(data, 0, 1048576); fs.Close(); fs.Dispose(); @@ -91,9 +91,9 @@ namespace DiscImageChef.Tests.Checksums [Test] public void Ripemd160RandomData() { - byte[] data = new byte[1048576]; - FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "random"), FileMode.Open, - FileAccess.Read); + byte[] data = new byte[1048576]; + FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "random"), FileMode.Open, + FileAccess.Read); fs.Read(data, 0, 1048576); fs.Close(); fs.Dispose(); @@ -104,9 +104,9 @@ namespace DiscImageChef.Tests.Checksums [Test] public void Ripemd160RandomInstance() { - byte[] data = new byte[1048576]; - FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "random"), FileMode.Open, - FileAccess.Read); + byte[] data = new byte[1048576]; + FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "random"), FileMode.Open, + FileAccess.Read); fs.Read(data, 0, 1048576); fs.Close(); fs.Dispose(); diff --git a/DiscImageChef.Tests/Checksums/SHA1.cs b/DiscImageChef.Tests/Checksums/SHA1.cs index 50378d80e..4e1a9519e 100644 --- a/DiscImageChef.Tests/Checksums/SHA1.cs +++ b/DiscImageChef.Tests/Checksums/SHA1.cs @@ -56,9 +56,9 @@ namespace DiscImageChef.Tests.Checksums [Test] public void Sha1EmptyData() { - byte[] data = new byte[1048576]; - FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "empty"), FileMode.Open, - FileAccess.Read); + byte[] data = new byte[1048576]; + FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "empty"), FileMode.Open, + FileAccess.Read); fs.Read(data, 0, 1048576); fs.Close(); fs.Dispose(); @@ -69,9 +69,9 @@ namespace DiscImageChef.Tests.Checksums [Test] public void Sha1EmptyInstance() { - byte[] data = new byte[1048576]; - FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "empty"), FileMode.Open, - FileAccess.Read); + byte[] data = new byte[1048576]; + FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "empty"), FileMode.Open, + FileAccess.Read); fs.Read(data, 0, 1048576); fs.Close(); fs.Dispose(); @@ -91,9 +91,9 @@ namespace DiscImageChef.Tests.Checksums [Test] public void Sha1RandomData() { - byte[] data = new byte[1048576]; - FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "random"), FileMode.Open, - FileAccess.Read); + byte[] data = new byte[1048576]; + FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "random"), FileMode.Open, + FileAccess.Read); fs.Read(data, 0, 1048576); fs.Close(); fs.Dispose(); @@ -104,9 +104,9 @@ namespace DiscImageChef.Tests.Checksums [Test] public void Sha1RandomInstance() { - byte[] data = new byte[1048576]; - FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "random"), FileMode.Open, - FileAccess.Read); + byte[] data = new byte[1048576]; + FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "random"), FileMode.Open, + FileAccess.Read); fs.Read(data, 0, 1048576); fs.Close(); fs.Dispose(); diff --git a/DiscImageChef.Tests/Checksums/SHA256.cs b/DiscImageChef.Tests/Checksums/SHA256.cs index 9c0a7234f..be5deb733 100644 --- a/DiscImageChef.Tests/Checksums/SHA256.cs +++ b/DiscImageChef.Tests/Checksums/SHA256.cs @@ -56,9 +56,9 @@ namespace DiscImageChef.Tests.Checksums [Test] public void Sha256EmptyData() { - byte[] data = new byte[1048576]; - FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "empty"), FileMode.Open, - FileAccess.Read); + byte[] data = new byte[1048576]; + FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "empty"), FileMode.Open, + FileAccess.Read); fs.Read(data, 0, 1048576); fs.Close(); fs.Dispose(); @@ -69,9 +69,9 @@ namespace DiscImageChef.Tests.Checksums [Test] public void Sha256EmptyInstance() { - byte[] data = new byte[1048576]; - FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "empty"), FileMode.Open, - FileAccess.Read); + byte[] data = new byte[1048576]; + FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "empty"), FileMode.Open, + FileAccess.Read); fs.Read(data, 0, 1048576); fs.Close(); fs.Dispose(); @@ -91,9 +91,9 @@ namespace DiscImageChef.Tests.Checksums [Test] public void Sha256RandomData() { - byte[] data = new byte[1048576]; - FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "random"), FileMode.Open, - FileAccess.Read); + byte[] data = new byte[1048576]; + FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "random"), FileMode.Open, + FileAccess.Read); fs.Read(data, 0, 1048576); fs.Close(); fs.Dispose(); @@ -104,9 +104,9 @@ namespace DiscImageChef.Tests.Checksums [Test] public void Sha256RandomInstance() { - byte[] data = new byte[1048576]; - FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "random"), FileMode.Open, - FileAccess.Read); + byte[] data = new byte[1048576]; + FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "random"), FileMode.Open, + FileAccess.Read); fs.Read(data, 0, 1048576); fs.Close(); fs.Dispose(); diff --git a/DiscImageChef.Tests/Checksums/SHA384.cs b/DiscImageChef.Tests/Checksums/SHA384.cs index 51b59774c..b1b0535ee 100644 --- a/DiscImageChef.Tests/Checksums/SHA384.cs +++ b/DiscImageChef.Tests/Checksums/SHA384.cs @@ -58,9 +58,9 @@ namespace DiscImageChef.Tests.Checksums [Test] public void Sha384EmptyData() { - byte[] data = new byte[1048576]; - FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "empty"), FileMode.Open, - FileAccess.Read); + byte[] data = new byte[1048576]; + FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "empty"), FileMode.Open, + FileAccess.Read); fs.Read(data, 0, 1048576); fs.Close(); fs.Dispose(); @@ -71,9 +71,9 @@ namespace DiscImageChef.Tests.Checksums [Test] public void Sha384EmptyInstance() { - byte[] data = new byte[1048576]; - FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "empty"), FileMode.Open, - FileAccess.Read); + byte[] data = new byte[1048576]; + FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "empty"), FileMode.Open, + FileAccess.Read); fs.Read(data, 0, 1048576); fs.Close(); fs.Dispose(); @@ -93,9 +93,9 @@ namespace DiscImageChef.Tests.Checksums [Test] public void Sha384RandomData() { - byte[] data = new byte[1048576]; - FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "random"), FileMode.Open, - FileAccess.Read); + byte[] data = new byte[1048576]; + FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "random"), FileMode.Open, + FileAccess.Read); fs.Read(data, 0, 1048576); fs.Close(); fs.Dispose(); @@ -106,9 +106,9 @@ namespace DiscImageChef.Tests.Checksums [Test] public void Sha384RandomInstance() { - byte[] data = new byte[1048576]; - FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "random"), FileMode.Open, - FileAccess.Read); + byte[] data = new byte[1048576]; + FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "random"), FileMode.Open, + FileAccess.Read); fs.Read(data, 0, 1048576); fs.Close(); fs.Dispose(); diff --git a/DiscImageChef.Tests/Checksums/SHA512.cs b/DiscImageChef.Tests/Checksums/SHA512.cs index 6f0e4eb3e..91b138fa1 100644 --- a/DiscImageChef.Tests/Checksums/SHA512.cs +++ b/DiscImageChef.Tests/Checksums/SHA512.cs @@ -60,9 +60,9 @@ namespace DiscImageChef.Tests.Checksums [Test] public void Sha512EmptyData() { - byte[] data = new byte[1048576]; - FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "empty"), FileMode.Open, - FileAccess.Read); + byte[] data = new byte[1048576]; + FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "empty"), FileMode.Open, + FileAccess.Read); fs.Read(data, 0, 1048576); fs.Close(); fs.Dispose(); @@ -73,9 +73,9 @@ namespace DiscImageChef.Tests.Checksums [Test] public void Sha512EmptyInstance() { - byte[] data = new byte[1048576]; - FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "empty"), FileMode.Open, - FileAccess.Read); + byte[] data = new byte[1048576]; + FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "empty"), FileMode.Open, + FileAccess.Read); fs.Read(data, 0, 1048576); fs.Close(); fs.Dispose(); @@ -95,9 +95,9 @@ namespace DiscImageChef.Tests.Checksums [Test] public void Sha512RandomData() { - byte[] data = new byte[1048576]; - FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "random"), FileMode.Open, - FileAccess.Read); + byte[] data = new byte[1048576]; + FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "random"), FileMode.Open, + FileAccess.Read); fs.Read(data, 0, 1048576); fs.Close(); fs.Dispose(); @@ -108,9 +108,9 @@ namespace DiscImageChef.Tests.Checksums [Test] public void Sha512RandomInstance() { - byte[] data = new byte[1048576]; - FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "random"), FileMode.Open, - FileAccess.Read); + byte[] data = new byte[1048576]; + FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "random"), FileMode.Open, + FileAccess.Read); fs.Read(data, 0, 1048576); fs.Close(); fs.Dispose(); diff --git a/DiscImageChef.Tests/Checksums/SpamSum.cs b/DiscImageChef.Tests/Checksums/SpamSum.cs index db7c164af..828e7646c 100644 --- a/DiscImageChef.Tests/Checksums/SpamSum.cs +++ b/DiscImageChef.Tests/Checksums/SpamSum.cs @@ -41,9 +41,9 @@ namespace DiscImageChef.Tests.Checksums [Test] public void SpamSumEmptyData() { - byte[] data = new byte[1048576]; - FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "empty"), FileMode.Open, - FileAccess.Read); + byte[] data = new byte[1048576]; + FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "empty"), FileMode.Open, + FileAccess.Read); fs.Read(data, 0, 1048576); fs.Close(); fs.Dispose(); @@ -54,9 +54,9 @@ namespace DiscImageChef.Tests.Checksums [Test] public void SpamSumEmptyInstance() { - byte[] data = new byte[1048576]; - FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "empty"), FileMode.Open, - FileAccess.Read); + byte[] data = new byte[1048576]; + FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "empty"), FileMode.Open, + FileAccess.Read); fs.Read(data, 0, 1048576); fs.Close(); fs.Dispose(); @@ -69,9 +69,9 @@ namespace DiscImageChef.Tests.Checksums [Test] public void SpamSumRandomData() { - byte[] data = new byte[1048576]; - FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "random"), FileMode.Open, - FileAccess.Read); + byte[] data = new byte[1048576]; + FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "random"), FileMode.Open, + FileAccess.Read); fs.Read(data, 0, 1048576); fs.Close(); fs.Dispose(); @@ -82,9 +82,9 @@ namespace DiscImageChef.Tests.Checksums [Test] public void SpamSumRandomInstance() { - byte[] data = new byte[1048576]; - FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "random"), FileMode.Open, - FileAccess.Read); + byte[] data = new byte[1048576]; + FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "random"), FileMode.Open, + FileAccess.Read); fs.Read(data, 0, 1048576); fs.Close(); fs.Dispose(); diff --git a/DiscImageChef.Tests/Devices/IomegaJaz.cs b/DiscImageChef.Tests/Devices/IomegaJaz.cs index e964a4bf4..5d3afab69 100644 --- a/DiscImageChef.Tests/Devices/IomegaJaz.cs +++ b/DiscImageChef.Tests/Devices/IomegaJaz.cs @@ -50,13 +50,13 @@ namespace DiscImageChef.Tests.Devices { for(int i = 0; i < testfiles.Length; i++) { - string location = Path.Combine(Consts.TestFilesRoot, "devices", "jaz", testfiles[i]); - IFilter filter = new LZip(); + string location = Path.Combine(Consts.TestFilesRoot, "devices", "jaz", testfiles[i]); + IFilter filter = new LZip(); filter.Open(location); IMediaImage image = new ZZZRawImage(); - Assert.AreEqual(true, image.Open(filter), testfiles[i]); - Assert.AreEqual(mediatypes[i], image.Info.MediaType, testfiles[i]); - Assert.AreEqual(sectors[i], image.Info.Sectors, testfiles[i]); + Assert.AreEqual(true, image.Open(filter), testfiles[i]); + Assert.AreEqual(mediatypes[i], image.Info.MediaType, testfiles[i]); + Assert.AreEqual(sectors[i], image.Info.Sectors, testfiles[i]); Assert.AreEqual(sectorsize[i], image.Info.SectorSize, testfiles[i]); } } diff --git a/DiscImageChef.Tests/Devices/LS120.cs b/DiscImageChef.Tests/Devices/LS120.cs index d1db3700a..9754a12f2 100644 --- a/DiscImageChef.Tests/Devices/LS120.cs +++ b/DiscImageChef.Tests/Devices/LS120.cs @@ -50,13 +50,13 @@ namespace DiscImageChef.Tests.Devices { for(int i = 0; i < testfiles.Length; i++) { - string location = Path.Combine(Consts.TestFilesRoot, "devices", "ls120", testfiles[i]); - IFilter filter = new LZip(); + string location = Path.Combine(Consts.TestFilesRoot, "devices", "ls120", testfiles[i]); + IFilter filter = new LZip(); filter.Open(location); IMediaImage image = new ZZZRawImage(); - Assert.AreEqual(true, image.Open(filter), testfiles[i]); - Assert.AreEqual(mediatypes[i], image.Info.MediaType, testfiles[i]); - Assert.AreEqual(sectors[i], image.Info.Sectors, testfiles[i]); + Assert.AreEqual(true, image.Open(filter), testfiles[i]); + Assert.AreEqual(mediatypes[i], image.Info.MediaType, testfiles[i]); + Assert.AreEqual(sectors[i], image.Info.Sectors, testfiles[i]); Assert.AreEqual(sectorsize[i], image.Info.SectorSize, testfiles[i]); } } diff --git a/DiscImageChef.Tests/Devices/PocketZip.cs b/DiscImageChef.Tests/Devices/PocketZip.cs index 3faf51fee..c025c13ed 100644 --- a/DiscImageChef.Tests/Devices/PocketZip.cs +++ b/DiscImageChef.Tests/Devices/PocketZip.cs @@ -50,13 +50,13 @@ namespace DiscImageChef.Tests.Devices { for(int i = 0; i < testfiles.Length; i++) { - string location = Path.Combine(Consts.TestFilesRoot, "devices", "pocketzip", testfiles[i]); - IFilter filter = new LZip(); + string location = Path.Combine(Consts.TestFilesRoot, "devices", "pocketzip", testfiles[i]); + IFilter filter = new LZip(); filter.Open(location); IMediaImage image = new ZZZRawImage(); - Assert.AreEqual(true, image.Open(filter), testfiles[i]); - Assert.AreEqual(mediatypes[i], image.Info.MediaType, testfiles[i]); - Assert.AreEqual(sectors[i], image.Info.Sectors, testfiles[i]); + Assert.AreEqual(true, image.Open(filter), testfiles[i]); + Assert.AreEqual(mediatypes[i], image.Info.MediaType, testfiles[i]); + Assert.AreEqual(sectors[i], image.Info.Sectors, testfiles[i]); Assert.AreEqual(sectorsize[i], image.Info.SectorSize, testfiles[i]); } } diff --git a/DiscImageChef.Tests/Filesystems/ADFS.cs b/DiscImageChef.Tests/Filesystems/ADFS.cs index 4707bf0bc..9d66d948f 100644 --- a/DiscImageChef.Tests/Filesystems/ADFS.cs +++ b/DiscImageChef.Tests/Filesystems/ADFS.cs @@ -71,29 +71,29 @@ namespace DiscImageChef.Tests.Filesystems { for(int i = 0; i < testfiles.Length; i++) { - string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "adfs", testfiles[i]); - IFilter filter = new LZip(); + string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "adfs", testfiles[i]); + IFilter filter = new LZip(); filter.Open(location); IMediaImage image = new ZZZRawImage(); - Assert.AreEqual(true, image.Open(filter), testfiles[i]); - Assert.AreEqual(mediatypes[i], image.Info.MediaType, testfiles[i]); - Assert.AreEqual(sectors[i], image.Info.Sectors, testfiles[i]); + Assert.AreEqual(true, image.Open(filter), testfiles[i]); + Assert.AreEqual(mediatypes[i], image.Info.MediaType, testfiles[i]); + Assert.AreEqual(sectors[i], image.Info.Sectors, testfiles[i]); Assert.AreEqual(sectorsize[i], image.Info.SectorSize, testfiles[i]); IFilesystem fs = new AcornADFS(); Partition wholePart = new Partition { - Name = "Whole device", + Name = "Whole device", Length = image.Info.Sectors, - Size = image.Info.Sectors * image.Info.SectorSize + Size = image.Info.Sectors * image.Info.SectorSize }; Assert.AreEqual(true, fs.Identify(image, wholePart), testfiles[i]); fs.GetInformation(image, wholePart, out _, null); - Assert.AreEqual(bootable[i], fs.XmlFsType.Bootable, testfiles[i]); - Assert.AreEqual(clusters[i], fs.XmlFsType.Clusters, testfiles[i]); - Assert.AreEqual(clustersize[i], fs.XmlFsType.ClusterSize, testfiles[i]); - Assert.AreEqual("Acorn Advanced Disc Filing System", fs.XmlFsType.Type, testfiles[i]); - Assert.AreEqual(volumename[i], fs.XmlFsType.VolumeName, testfiles[i]); - Assert.AreEqual(volumeserial[i], fs.XmlFsType.VolumeSerial, testfiles[i]); + Assert.AreEqual(bootable[i], fs.XmlFsType.Bootable, testfiles[i]); + Assert.AreEqual(clusters[i], fs.XmlFsType.Clusters, testfiles[i]); + Assert.AreEqual(clustersize[i], fs.XmlFsType.ClusterSize, testfiles[i]); + Assert.AreEqual("Acorn Advanced Disc Filing System", fs.XmlFsType.Type, testfiles[i]); + Assert.AreEqual(volumename[i], fs.XmlFsType.VolumeName, testfiles[i]); + Assert.AreEqual(volumeserial[i], fs.XmlFsType.VolumeSerial, testfiles[i]); } } } diff --git a/DiscImageChef.Tests/Filesystems/AFFS.cs b/DiscImageChef.Tests/Filesystems/AFFS.cs index e863b6e5e..15253562c 100644 --- a/DiscImageChef.Tests/Filesystems/AFFS.cs +++ b/DiscImageChef.Tests/Filesystems/AFFS.cs @@ -60,27 +60,27 @@ namespace DiscImageChef.Tests.Filesystems { for(int i = 0; i < testfiles.Length; i++) { - string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "affs", testfiles[i]); - IFilter filter = new LZip(); + string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "affs", testfiles[i]); + IFilter filter = new LZip(); filter.Open(location); IMediaImage image = new ZZZRawImage(); - Assert.AreEqual(true, image.Open(filter), testfiles[i]); - Assert.AreEqual(mediatypes[i], image.Info.MediaType, testfiles[i]); - Assert.AreEqual(sectors[i], image.Info.Sectors, testfiles[i]); + Assert.AreEqual(true, image.Open(filter), testfiles[i]); + Assert.AreEqual(mediatypes[i], image.Info.MediaType, testfiles[i]); + Assert.AreEqual(sectors[i], image.Info.Sectors, testfiles[i]); Assert.AreEqual(sectorsize[i], image.Info.SectorSize, testfiles[i]); IFilesystem fs = new AmigaDOSPlugin(); Partition wholePart = new Partition { - Name = "Whole device", + Name = "Whole device", Length = image.Info.Sectors, - Size = image.Info.Sectors * image.Info.SectorSize + Size = image.Info.Sectors * image.Info.SectorSize }; Assert.AreEqual(true, fs.Identify(image, wholePart), testfiles[i]); fs.GetInformation(image, wholePart, out _, null); - Assert.AreEqual(clusters[i], fs.XmlFsType.Clusters, testfiles[i]); - Assert.AreEqual(clustersize[i], fs.XmlFsType.ClusterSize, testfiles[i]); - Assert.AreEqual("Amiga FFS", fs.XmlFsType.Type, testfiles[i]); - Assert.AreEqual(volumename[i], fs.XmlFsType.VolumeName, testfiles[i]); + Assert.AreEqual(clusters[i], fs.XmlFsType.Clusters, testfiles[i]); + Assert.AreEqual(clustersize[i], fs.XmlFsType.ClusterSize, testfiles[i]); + Assert.AreEqual("Amiga FFS", fs.XmlFsType.Type, testfiles[i]); + Assert.AreEqual(volumename[i], fs.XmlFsType.VolumeName, testfiles[i]); Assert.AreEqual(volumeserial[i], fs.XmlFsType.VolumeSerial, testfiles[i]); } } @@ -108,16 +108,16 @@ namespace DiscImageChef.Tests.Filesystems { for(int i = 0; i < testfiles.Length; i++) { - string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "affs_mbr", testfiles[i]); - IFilter filter = new LZip(); + string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "affs_mbr", testfiles[i]); + IFilter filter = new LZip(); filter.Open(location); IMediaImage image = new Vdi(); - Assert.AreEqual(true, image.Open(filter), testfiles[i]); - Assert.AreEqual(sectors[i], image.Info.Sectors, testfiles[i]); + Assert.AreEqual(true, image.Open(filter), testfiles[i]); + Assert.AreEqual(sectors[i], image.Info.Sectors, testfiles[i]); Assert.AreEqual(sectorsize[i], image.Info.SectorSize, testfiles[i]); List partitions = Core.Partitions.GetAll(image); - IFilesystem fs = new AmigaDOSPlugin(); - int part = -1; + IFilesystem fs = new AmigaDOSPlugin(); + int part = -1; for(int j = 0; j < partitions.Count; j++) if(partitions[j].Type == "0x2D" || partitions[j].Type == "0x2E") { @@ -128,10 +128,10 @@ namespace DiscImageChef.Tests.Filesystems Assert.AreNotEqual(-1, part, $"Partition not found on {testfiles[i]}"); Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]); fs.GetInformation(image, partitions[part], out _, null); - Assert.AreEqual(clusters[i], fs.XmlFsType.Clusters, testfiles[i]); - Assert.AreEqual(clustersize[i], fs.XmlFsType.ClusterSize, testfiles[i]); - Assert.AreEqual("Amiga FFS", fs.XmlFsType.Type, testfiles[i]); - Assert.AreEqual(volumename[i], fs.XmlFsType.VolumeName, testfiles[i]); + Assert.AreEqual(clusters[i], fs.XmlFsType.Clusters, testfiles[i]); + Assert.AreEqual(clustersize[i], fs.XmlFsType.ClusterSize, testfiles[i]); + Assert.AreEqual("Amiga FFS", fs.XmlFsType.Type, testfiles[i]); + Assert.AreEqual(volumename[i], fs.XmlFsType.VolumeName, testfiles[i]); Assert.AreEqual(volumeserial[i], fs.XmlFsType.VolumeSerial, testfiles[i]); } } @@ -159,16 +159,16 @@ namespace DiscImageChef.Tests.Filesystems { for(int i = 0; i < testfiles.Length; i++) { - string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "affs_mbr_rdb", testfiles[i]); - IFilter filter = new LZip(); + string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "affs_mbr_rdb", testfiles[i]); + IFilter filter = new LZip(); filter.Open(location); IMediaImage image = new Vdi(); - Assert.AreEqual(true, image.Open(filter), testfiles[i]); - Assert.AreEqual(sectors[i], image.Info.Sectors, testfiles[i]); + Assert.AreEqual(true, image.Open(filter), testfiles[i]); + Assert.AreEqual(sectors[i], image.Info.Sectors, testfiles[i]); Assert.AreEqual(sectorsize[i], image.Info.SectorSize, testfiles[i]); List partitions = Core.Partitions.GetAll(image); - IFilesystem fs = new AmigaDOSPlugin(); - int part = -1; + IFilesystem fs = new AmigaDOSPlugin(); + int part = -1; for(int j = 0; j < partitions.Count; j++) if(partitions[j].Type == "\"DOS\\1\"" || partitions[j].Type == "\"DOS\\3\"") { @@ -179,10 +179,10 @@ namespace DiscImageChef.Tests.Filesystems Assert.AreNotEqual(-1, part, $"Partition not found on {testfiles[i]}"); Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]); fs.GetInformation(image, partitions[part], out _, null); - Assert.AreEqual(clusters[i], fs.XmlFsType.Clusters, testfiles[i]); - Assert.AreEqual(clustersize[i], fs.XmlFsType.ClusterSize, testfiles[i]); - Assert.AreEqual("Amiga FFS", fs.XmlFsType.Type, testfiles[i]); - Assert.AreEqual(volumename[i], fs.XmlFsType.VolumeName, testfiles[i]); + Assert.AreEqual(clusters[i], fs.XmlFsType.Clusters, testfiles[i]); + Assert.AreEqual(clustersize[i], fs.XmlFsType.ClusterSize, testfiles[i]); + Assert.AreEqual("Amiga FFS", fs.XmlFsType.Type, testfiles[i]); + Assert.AreEqual(volumename[i], fs.XmlFsType.VolumeName, testfiles[i]); Assert.AreEqual(volumeserial[i], fs.XmlFsType.VolumeSerial, testfiles[i]); } } @@ -219,16 +219,16 @@ namespace DiscImageChef.Tests.Filesystems { for(int i = 0; i < testfiles.Length; i++) { - string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "affs_rdb", testfiles[i]); - IFilter filter = new LZip(); + string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "affs_rdb", testfiles[i]); + IFilter filter = new LZip(); filter.Open(location); IMediaImage image = new Vdi(); - Assert.AreEqual(true, image.Open(filter), testfiles[i]); - Assert.AreEqual(sectors[i], image.Info.Sectors, testfiles[i]); + Assert.AreEqual(true, image.Open(filter), testfiles[i]); + Assert.AreEqual(sectors[i], image.Info.Sectors, testfiles[i]); Assert.AreEqual(sectorsize[i], image.Info.SectorSize, testfiles[i]); List partitions = Core.Partitions.GetAll(image); - IFilesystem fs = new AmigaDOSPlugin(); - int part = -1; + IFilesystem fs = new AmigaDOSPlugin(); + 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\"") @@ -240,10 +240,10 @@ namespace DiscImageChef.Tests.Filesystems Assert.AreNotEqual(-1, part, $"Partition not found on {testfiles[i]}"); Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]); fs.GetInformation(image, partitions[part], out _, null); - Assert.AreEqual(clusters[i], fs.XmlFsType.Clusters, testfiles[i]); - Assert.AreEqual(clustersize[i], fs.XmlFsType.ClusterSize, testfiles[i]); - Assert.AreEqual("Amiga FFS", fs.XmlFsType.Type, testfiles[i]); - Assert.AreEqual(volumename[i], fs.XmlFsType.VolumeName, testfiles[i]); + Assert.AreEqual(clusters[i], fs.XmlFsType.Clusters, testfiles[i]); + Assert.AreEqual(clustersize[i], fs.XmlFsType.ClusterSize, testfiles[i]); + Assert.AreEqual("Amiga FFS", fs.XmlFsType.Type, testfiles[i]); + Assert.AreEqual(volumename[i], fs.XmlFsType.VolumeName, testfiles[i]); Assert.AreEqual(volumeserial[i], fs.XmlFsType.VolumeSerial, testfiles[i]); } } diff --git a/DiscImageChef.Tests/Filesystems/AFFS2.cs b/DiscImageChef.Tests/Filesystems/AFFS2.cs index e06fbf832..d94c3f422 100644 --- a/DiscImageChef.Tests/Filesystems/AFFS2.cs +++ b/DiscImageChef.Tests/Filesystems/AFFS2.cs @@ -58,16 +58,16 @@ namespace DiscImageChef.Tests.Filesystems { for(int i = 0; i < testfiles.Length; i++) { - string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "affs2_rdb", testfiles[i]); - IFilter filter = new LZip(); + string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "affs2_rdb", testfiles[i]); + IFilter filter = new LZip(); filter.Open(location); IMediaImage image = new Vdi(); - Assert.AreEqual(true, image.Open(filter), testfiles[i]); - Assert.AreEqual(sectors[i], image.Info.Sectors, testfiles[i]); + Assert.AreEqual(true, image.Open(filter), testfiles[i]); + Assert.AreEqual(sectors[i], image.Info.Sectors, testfiles[i]); Assert.AreEqual(sectorsize[i], image.Info.SectorSize, testfiles[i]); List partitions = Core.Partitions.GetAll(image); - IFilesystem fs = new AmigaDOSPlugin(); - int part = -1; + IFilesystem fs = new AmigaDOSPlugin(); + int part = -1; for(int j = 0; j < partitions.Count; j++) if(partitions[j].Type == "\"DOS\\7\"") { @@ -78,10 +78,10 @@ namespace DiscImageChef.Tests.Filesystems Assert.AreNotEqual(-1, part, $"Partition not found on {testfiles[i]}"); Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]); fs.GetInformation(image, partitions[part], out _, null); - Assert.AreEqual(clusters[i], fs.XmlFsType.Clusters, testfiles[i]); - Assert.AreEqual(clustersize[i], fs.XmlFsType.ClusterSize, testfiles[i]); - Assert.AreEqual("Amiga FFS2", fs.XmlFsType.Type, testfiles[i]); - Assert.AreEqual(volumename[i], fs.XmlFsType.VolumeName, testfiles[i]); + Assert.AreEqual(clusters[i], fs.XmlFsType.Clusters, testfiles[i]); + Assert.AreEqual(clustersize[i], fs.XmlFsType.ClusterSize, testfiles[i]); + Assert.AreEqual("Amiga FFS2", fs.XmlFsType.Type, testfiles[i]); + Assert.AreEqual(volumename[i], fs.XmlFsType.VolumeName, testfiles[i]); Assert.AreEqual(volumeserial[i], fs.XmlFsType.VolumeSerial, testfiles[i]); } } diff --git a/DiscImageChef.Tests/Filesystems/AFS.cs b/DiscImageChef.Tests/Filesystems/AFS.cs index 83d57200c..dd7a1cb95 100644 --- a/DiscImageChef.Tests/Filesystems/AFS.cs +++ b/DiscImageChef.Tests/Filesystems/AFS.cs @@ -72,27 +72,27 @@ namespace DiscImageChef.Tests.Filesystems { for(int i = 0; i < testfiles.Length; i++) { - string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "afs", testfiles[i]); - IFilter filter = new LZip(); + string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "afs", testfiles[i]); + IFilter filter = new LZip(); filter.Open(location); IMediaImage image = new ZZZRawImage(); - Assert.AreEqual(true, image.Open(filter), testfiles[i]); - Assert.AreEqual(mediatypes[i], image.Info.MediaType, testfiles[i]); - Assert.AreEqual(sectors[i], image.Info.Sectors, testfiles[i]); + Assert.AreEqual(true, image.Open(filter), testfiles[i]); + Assert.AreEqual(mediatypes[i], image.Info.MediaType, testfiles[i]); + Assert.AreEqual(sectors[i], image.Info.Sectors, testfiles[i]); Assert.AreEqual(sectorsize[i], image.Info.SectorSize, testfiles[i]); IFilesystem fs = new SysVfs(); Partition wholePart = new Partition { - Name = "Whole device", + Name = "Whole device", Length = image.Info.Sectors, - Size = image.Info.Sectors * image.Info.SectorSize + Size = image.Info.Sectors * image.Info.SectorSize }; Assert.AreEqual(true, fs.Identify(image, wholePart), testfiles[i]); fs.GetInformation(image, wholePart, out _, null); - Assert.AreEqual(clusters[i], fs.XmlFsType.Clusters, testfiles[i]); - Assert.AreEqual(clustersize[i], fs.XmlFsType.ClusterSize, testfiles[i]); - Assert.AreEqual(type[i], fs.XmlFsType.Type, testfiles[i]); - Assert.AreEqual(volumename[i], fs.XmlFsType.VolumeName, testfiles[i]); + Assert.AreEqual(clusters[i], fs.XmlFsType.Clusters, testfiles[i]); + Assert.AreEqual(clustersize[i], fs.XmlFsType.ClusterSize, testfiles[i]); + Assert.AreEqual(type[i], fs.XmlFsType.Type, testfiles[i]); + Assert.AreEqual(volumename[i], fs.XmlFsType.VolumeName, testfiles[i]); Assert.AreEqual(volumeserial[i], fs.XmlFsType.VolumeSerial, testfiles[i]); } } @@ -122,16 +122,16 @@ namespace DiscImageChef.Tests.Filesystems { for(int i = 0; i < testfiles.Length; i++) { - string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "afs_mbr", testfiles[i]); - IFilter filter = new LZip(); + string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "afs_mbr", testfiles[i]); + IFilter filter = new LZip(); filter.Open(location); IMediaImage image = new Vdi(); - Assert.AreEqual(true, image.Open(filter), testfiles[i]); - Assert.AreEqual(sectors[i], image.Info.Sectors, testfiles[i]); + Assert.AreEqual(true, image.Open(filter), testfiles[i]); + Assert.AreEqual(sectors[i], image.Info.Sectors, testfiles[i]); Assert.AreEqual(sectorsize[i], image.Info.SectorSize, testfiles[i]); List partitions = Core.Partitions.GetAll(image); - IFilesystem fs = new SysVfs(); - int part = -1; + IFilesystem fs = new SysVfs(); + int part = -1; for(int j = 0; j < partitions.Count; j++) if(partitions[j].Type == "XENIX") { @@ -142,10 +142,10 @@ namespace DiscImageChef.Tests.Filesystems Assert.AreNotEqual(-1, part, $"Partition not found on {testfiles[i]}"); Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]); fs.GetInformation(image, partitions[part], out _, null); - Assert.AreEqual(clusters[i], fs.XmlFsType.Clusters, testfiles[i]); - Assert.AreEqual(clustersize[i], fs.XmlFsType.ClusterSize, testfiles[i]); - Assert.AreEqual(type[i], fs.XmlFsType.Type, testfiles[i]); - Assert.AreEqual(volumename[i], fs.XmlFsType.VolumeName, testfiles[i]); + Assert.AreEqual(clusters[i], fs.XmlFsType.Clusters, testfiles[i]); + Assert.AreEqual(clustersize[i], fs.XmlFsType.ClusterSize, testfiles[i]); + Assert.AreEqual(type[i], fs.XmlFsType.Type, testfiles[i]); + Assert.AreEqual(volumename[i], fs.XmlFsType.VolumeName, testfiles[i]); Assert.AreEqual(volumeserial[i], fs.XmlFsType.VolumeSerial, testfiles[i]); } } diff --git a/DiscImageChef.Tests/Filesystems/AOFS.cs b/DiscImageChef.Tests/Filesystems/AOFS.cs index d88aacc15..3c2417913 100644 --- a/DiscImageChef.Tests/Filesystems/AOFS.cs +++ b/DiscImageChef.Tests/Filesystems/AOFS.cs @@ -60,27 +60,27 @@ namespace DiscImageChef.Tests.Filesystems { for(int i = 0; i < testfiles.Length; i++) { - string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "aofs", testfiles[i]); - IFilter filter = new LZip(); + string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "aofs", testfiles[i]); + IFilter filter = new LZip(); filter.Open(location); IMediaImage image = new ZZZRawImage(); - Assert.AreEqual(true, image.Open(filter), testfiles[i]); - Assert.AreEqual(mediatypes[i], image.Info.MediaType, testfiles[i]); - Assert.AreEqual(sectors[i], image.Info.Sectors, testfiles[i]); + Assert.AreEqual(true, image.Open(filter), testfiles[i]); + Assert.AreEqual(mediatypes[i], image.Info.MediaType, testfiles[i]); + Assert.AreEqual(sectors[i], image.Info.Sectors, testfiles[i]); Assert.AreEqual(sectorsize[i], image.Info.SectorSize, testfiles[i]); IFilesystem fs = new AmigaDOSPlugin(); Partition wholePart = new Partition { - Name = "Whole device", + Name = "Whole device", Length = image.Info.Sectors, - Size = image.Info.Sectors * image.Info.SectorSize + Size = image.Info.Sectors * image.Info.SectorSize }; Assert.AreEqual(true, fs.Identify(image, wholePart), testfiles[i]); fs.GetInformation(image, wholePart, out _, null); - Assert.AreEqual(clusters[i], fs.XmlFsType.Clusters, testfiles[i]); - Assert.AreEqual(clustersize[i], fs.XmlFsType.ClusterSize, testfiles[i]); - Assert.AreEqual("Amiga OFS", fs.XmlFsType.Type, testfiles[i]); - Assert.AreEqual(volumename[i], fs.XmlFsType.VolumeName, testfiles[i]); + Assert.AreEqual(clusters[i], fs.XmlFsType.Clusters, testfiles[i]); + Assert.AreEqual(clustersize[i], fs.XmlFsType.ClusterSize, testfiles[i]); + Assert.AreEqual("Amiga OFS", fs.XmlFsType.Type, testfiles[i]); + Assert.AreEqual(volumename[i], fs.XmlFsType.VolumeName, testfiles[i]); Assert.AreEqual(volumeserial[i], fs.XmlFsType.VolumeSerial, testfiles[i]); } } @@ -108,16 +108,16 @@ namespace DiscImageChef.Tests.Filesystems { for(int i = 0; i < testfiles.Length; i++) { - string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "aofs_mbr", testfiles[i]); - IFilter filter = new LZip(); + string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "aofs_mbr", testfiles[i]); + IFilter filter = new LZip(); filter.Open(location); IMediaImage image = new Vdi(); - Assert.AreEqual(true, image.Open(filter), testfiles[i]); - Assert.AreEqual(sectors[i], image.Info.Sectors, testfiles[i]); + Assert.AreEqual(true, image.Open(filter), testfiles[i]); + Assert.AreEqual(sectors[i], image.Info.Sectors, testfiles[i]); Assert.AreEqual(sectorsize[i], image.Info.SectorSize, testfiles[i]); List partitions = Core.Partitions.GetAll(image); - IFilesystem fs = new AmigaDOSPlugin(); - int part = -1; + IFilesystem fs = new AmigaDOSPlugin(); + int part = -1; for(int j = 0; j < partitions.Count; j++) if(partitions[j].Type == "0x2C") { @@ -128,10 +128,10 @@ namespace DiscImageChef.Tests.Filesystems Assert.AreNotEqual(-1, part, $"Partition not found on {testfiles[i]}"); Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]); fs.GetInformation(image, partitions[part], out _, null); - Assert.AreEqual(clusters[i], fs.XmlFsType.Clusters, testfiles[i]); - Assert.AreEqual(clustersize[i], fs.XmlFsType.ClusterSize, testfiles[i]); - Assert.AreEqual("Amiga OFS", fs.XmlFsType.Type, testfiles[i]); - Assert.AreEqual(volumename[i], fs.XmlFsType.VolumeName, testfiles[i]); + Assert.AreEqual(clusters[i], fs.XmlFsType.Clusters, testfiles[i]); + Assert.AreEqual(clustersize[i], fs.XmlFsType.ClusterSize, testfiles[i]); + Assert.AreEqual("Amiga OFS", fs.XmlFsType.Type, testfiles[i]); + Assert.AreEqual(volumename[i], fs.XmlFsType.VolumeName, testfiles[i]); Assert.AreEqual(volumeserial[i], fs.XmlFsType.VolumeSerial, testfiles[i]); } } @@ -159,16 +159,16 @@ namespace DiscImageChef.Tests.Filesystems { for(int i = 0; i < testfiles.Length; i++) { - string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "aofs_mbr_rdb", testfiles[i]); - IFilter filter = new LZip(); + string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "aofs_mbr_rdb", testfiles[i]); + IFilter filter = new LZip(); filter.Open(location); IMediaImage image = new Vdi(); - Assert.AreEqual(true, image.Open(filter), testfiles[i]); - Assert.AreEqual(sectors[i], image.Info.Sectors, testfiles[i]); + Assert.AreEqual(true, image.Open(filter), testfiles[i]); + Assert.AreEqual(sectors[i], image.Info.Sectors, testfiles[i]); Assert.AreEqual(sectorsize[i], image.Info.SectorSize, testfiles[i]); List partitions = Core.Partitions.GetAll(image); - IFilesystem fs = new AmigaDOSPlugin(); - int part = -1; + IFilesystem fs = new AmigaDOSPlugin(); + int part = -1; for(int j = 0; j < partitions.Count; j++) if(partitions[j].Type == "\"DOS\\0\"") { @@ -179,10 +179,10 @@ namespace DiscImageChef.Tests.Filesystems Assert.AreNotEqual(-1, part, $"Partition not found on {testfiles[i]}"); Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]); fs.GetInformation(image, partitions[part], out _, null); - Assert.AreEqual(clusters[i], fs.XmlFsType.Clusters, testfiles[i]); - Assert.AreEqual(clustersize[i], fs.XmlFsType.ClusterSize, testfiles[i]); - Assert.AreEqual("Amiga OFS", fs.XmlFsType.Type, testfiles[i]); - Assert.AreEqual(volumename[i], fs.XmlFsType.VolumeName, testfiles[i]); + Assert.AreEqual(clusters[i], fs.XmlFsType.Clusters, testfiles[i]); + Assert.AreEqual(clustersize[i], fs.XmlFsType.ClusterSize, testfiles[i]); + Assert.AreEqual("Amiga OFS", fs.XmlFsType.Type, testfiles[i]); + Assert.AreEqual(volumename[i], fs.XmlFsType.VolumeName, testfiles[i]); Assert.AreEqual(volumeserial[i], fs.XmlFsType.VolumeSerial, testfiles[i]); } } @@ -211,16 +211,16 @@ namespace DiscImageChef.Tests.Filesystems { for(int i = 0; i < testfiles.Length; i++) { - string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "aofs_rdb", testfiles[i]); - IFilter filter = new LZip(); + string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "aofs_rdb", testfiles[i]); + IFilter filter = new LZip(); filter.Open(location); IMediaImage image = new Vdi(); - Assert.AreEqual(true, image.Open(filter), testfiles[i]); - Assert.AreEqual(sectors[i], image.Info.Sectors, testfiles[i]); + Assert.AreEqual(true, image.Open(filter), testfiles[i]); + Assert.AreEqual(sectors[i], image.Info.Sectors, testfiles[i]); Assert.AreEqual(sectorsize[i], image.Info.SectorSize, testfiles[i]); List partitions = Core.Partitions.GetAll(image); - IFilesystem fs = new AmigaDOSPlugin(); - int part = -1; + IFilesystem fs = new AmigaDOSPlugin(); + 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\"") @@ -232,10 +232,10 @@ namespace DiscImageChef.Tests.Filesystems Assert.AreNotEqual(-1, part, $"Partition not found on {testfiles[i]}"); Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]); fs.GetInformation(image, partitions[part], out _, null); - Assert.AreEqual(clusters[i], fs.XmlFsType.Clusters, testfiles[i]); - Assert.AreEqual(clustersize[i], fs.XmlFsType.ClusterSize, testfiles[i]); - Assert.AreEqual("Amiga OFS", fs.XmlFsType.Type, testfiles[i]); - Assert.AreEqual(volumename[i], fs.XmlFsType.VolumeName, testfiles[i]); + Assert.AreEqual(clusters[i], fs.XmlFsType.Clusters, testfiles[i]); + Assert.AreEqual(clustersize[i], fs.XmlFsType.ClusterSize, testfiles[i]); + Assert.AreEqual("Amiga OFS", fs.XmlFsType.Type, testfiles[i]); + Assert.AreEqual(volumename[i], fs.XmlFsType.VolumeName, testfiles[i]); Assert.AreEqual(volumeserial[i], fs.XmlFsType.VolumeSerial, testfiles[i]); } } diff --git a/DiscImageChef.Tests/Filesystems/Atheos.cs b/DiscImageChef.Tests/Filesystems/Atheos.cs index 4676b28fa..1231979d1 100644 --- a/DiscImageChef.Tests/Filesystems/Atheos.cs +++ b/DiscImageChef.Tests/Filesystems/Atheos.cs @@ -58,16 +58,16 @@ namespace DiscImageChef.Tests.Filesystems { for(int i = 0; i < testfiles.Length; i++) { - string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "atheos_mbr", testfiles[i]); - IFilter filter = new LZip(); + string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "atheos_mbr", testfiles[i]); + IFilter filter = new LZip(); filter.Open(location); IMediaImage image = new Vdi(); - Assert.AreEqual(true, image.Open(filter), testfiles[i]); - Assert.AreEqual(sectors[i], image.Info.Sectors, testfiles[i]); + Assert.AreEqual(true, image.Open(filter), testfiles[i]); + Assert.AreEqual(sectors[i], image.Info.Sectors, testfiles[i]); Assert.AreEqual(sectorsize[i], image.Info.SectorSize, testfiles[i]); List partitions = Core.Partitions.GetAll(image); - IFilesystem fs = new AtheOS(); - int part = -1; + IFilesystem fs = new AtheOS(); + int part = -1; for(int j = 0; j < partitions.Count; j++) if(partitions[j].Type == "0x2A") { @@ -78,11 +78,11 @@ namespace DiscImageChef.Tests.Filesystems Assert.AreNotEqual(-1, part, $"Partition not found on {testfiles[i]}"); Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]); fs.GetInformation(image, partitions[part], out _, null); - Assert.AreEqual(clusters[i], fs.XmlFsType.Clusters, testfiles[i]); - Assert.AreEqual(clustersize[i], fs.XmlFsType.ClusterSize, testfiles[i]); - Assert.AreEqual("AtheOS filesystem", fs.XmlFsType.Type, testfiles[i]); - Assert.AreEqual(volumename[i], fs.XmlFsType.VolumeName, testfiles[i]); - Assert.AreEqual(volumeserial[i], fs.XmlFsType.VolumeSerial, testfiles[i]); + Assert.AreEqual(clusters[i], fs.XmlFsType.Clusters, testfiles[i]); + Assert.AreEqual(clustersize[i], fs.XmlFsType.ClusterSize, testfiles[i]); + Assert.AreEqual("AtheOS filesystem", fs.XmlFsType.Type, testfiles[i]); + Assert.AreEqual(volumename[i], fs.XmlFsType.VolumeName, testfiles[i]); + Assert.AreEqual(volumeserial[i], fs.XmlFsType.VolumeSerial, testfiles[i]); } } } diff --git a/DiscImageChef.Tests/Filesystems/BeFS.cs b/DiscImageChef.Tests/Filesystems/BeFS.cs index 73945dba5..115c38b46 100644 --- a/DiscImageChef.Tests/Filesystems/BeFS.cs +++ b/DiscImageChef.Tests/Filesystems/BeFS.cs @@ -62,29 +62,29 @@ namespace DiscImageChef.Tests.Filesystems { for(int i = 0; i < testfiles.Length; i++) { - string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "befs", testfiles[i]); - IFilter filter = new LZip(); + string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "befs", testfiles[i]); + IFilter filter = new LZip(); filter.Open(location); IMediaImage image = new ZZZRawImage(); - Assert.AreEqual(true, image.Open(filter), testfiles[i]); - Assert.AreEqual(mediatypes[i], image.Info.MediaType, testfiles[i]); - Assert.AreEqual(sectors[i], image.Info.Sectors, testfiles[i]); + Assert.AreEqual(true, image.Open(filter), testfiles[i]); + Assert.AreEqual(mediatypes[i], image.Info.MediaType, testfiles[i]); + Assert.AreEqual(sectors[i], image.Info.Sectors, testfiles[i]); Assert.AreEqual(sectorsize[i], image.Info.SectorSize, testfiles[i]); IFilesystem fs = new BeFS(); Partition wholePart = new Partition { - Name = "Whole device", + Name = "Whole device", Length = image.Info.Sectors, - Size = image.Info.Sectors * image.Info.SectorSize + Size = image.Info.Sectors * image.Info.SectorSize }; Assert.AreEqual(true, fs.Identify(image, wholePart), testfiles[i]); fs.GetInformation(image, wholePart, out _, null); - Assert.AreEqual(clusters[i], fs.XmlFsType.Clusters, testfiles[i]); - Assert.AreEqual(clustersize[i], fs.XmlFsType.ClusterSize, testfiles[i]); - Assert.AreEqual("BeFS", fs.XmlFsType.Type, testfiles[i]); - Assert.AreEqual(volumename[i], fs.XmlFsType.VolumeName, testfiles[i]); - Assert.AreEqual(volumeserial[i], fs.XmlFsType.VolumeSerial, testfiles[i]); - Assert.AreEqual(oemid[i], fs.XmlFsType.SystemIdentifier, testfiles[i]); + Assert.AreEqual(clusters[i], fs.XmlFsType.Clusters, testfiles[i]); + Assert.AreEqual(clustersize[i], fs.XmlFsType.ClusterSize, testfiles[i]); + Assert.AreEqual("BeFS", fs.XmlFsType.Type, testfiles[i]); + Assert.AreEqual(volumename[i], fs.XmlFsType.VolumeName, testfiles[i]); + Assert.AreEqual(volumeserial[i], fs.XmlFsType.VolumeSerial, testfiles[i]); + Assert.AreEqual(oemid[i], fs.XmlFsType.SystemIdentifier, testfiles[i]); } } } @@ -113,16 +113,16 @@ namespace DiscImageChef.Tests.Filesystems { for(int i = 0; i < testfiles.Length; i++) { - string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "befs_apm", testfiles[i]); - IFilter filter = new LZip(); + string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "befs_apm", testfiles[i]); + IFilter filter = new LZip(); filter.Open(location); IMediaImage image = new Vdi(); - Assert.AreEqual(true, image.Open(filter), testfiles[i]); - Assert.AreEqual(sectors[i], image.Info.Sectors, testfiles[i]); + Assert.AreEqual(true, image.Open(filter), testfiles[i]); + Assert.AreEqual(sectors[i], image.Info.Sectors, testfiles[i]); Assert.AreEqual(sectorsize[i], image.Info.SectorSize, testfiles[i]); List partitions = Core.Partitions.GetAll(image); - IFilesystem fs = new BeFS(); - int part = -1; + IFilesystem fs = new BeFS(); + int part = -1; for(int j = 0; j < partitions.Count; j++) if(partitions[j].Type == "Be_BFS") { @@ -133,12 +133,12 @@ namespace DiscImageChef.Tests.Filesystems Assert.AreNotEqual(-1, part, $"Partition not found on {testfiles[i]}"); Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]); fs.GetInformation(image, partitions[part], out _, null); - Assert.AreEqual(clusters[i], fs.XmlFsType.Clusters, testfiles[i]); - Assert.AreEqual(clustersize[i], fs.XmlFsType.ClusterSize, testfiles[i]); - Assert.AreEqual("BeFS", fs.XmlFsType.Type, testfiles[i]); - Assert.AreEqual(volumename[i], fs.XmlFsType.VolumeName, testfiles[i]); - Assert.AreEqual(volumeserial[i], fs.XmlFsType.VolumeSerial, testfiles[i]); - Assert.AreEqual(oemid[i], fs.XmlFsType.SystemIdentifier, testfiles[i]); + Assert.AreEqual(clusters[i], fs.XmlFsType.Clusters, testfiles[i]); + Assert.AreEqual(clustersize[i], fs.XmlFsType.ClusterSize, testfiles[i]); + Assert.AreEqual("BeFS", fs.XmlFsType.Type, testfiles[i]); + Assert.AreEqual(volumename[i], fs.XmlFsType.VolumeName, testfiles[i]); + Assert.AreEqual(volumeserial[i], fs.XmlFsType.VolumeSerial, testfiles[i]); + Assert.AreEqual(oemid[i], fs.XmlFsType.SystemIdentifier, testfiles[i]); } } } @@ -165,16 +165,16 @@ namespace DiscImageChef.Tests.Filesystems { for(int i = 0; i < testfiles.Length; i++) { - string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "befs_gpt", testfiles[i]); - IFilter filter = new LZip(); + string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "befs_gpt", testfiles[i]); + IFilter filter = new LZip(); filter.Open(location); IMediaImage image = new Vdi(); - Assert.AreEqual(true, image.Open(filter), testfiles[i]); - Assert.AreEqual(sectors[i], image.Info.Sectors, testfiles[i]); + Assert.AreEqual(true, image.Open(filter), testfiles[i]); + Assert.AreEqual(sectors[i], image.Info.Sectors, testfiles[i]); Assert.AreEqual(sectorsize[i], image.Info.SectorSize, testfiles[i]); List partitions = Core.Partitions.GetAll(image); - IFilesystem fs = new BeFS(); - int part = -1; + IFilesystem fs = new BeFS(); + int part = -1; for(int j = 0; j < partitions.Count; j++) if(partitions[j].Type == "Haiku BFS") { @@ -185,10 +185,10 @@ namespace DiscImageChef.Tests.Filesystems Assert.AreNotEqual(-1, part, $"Partition not found on {testfiles[i]}"); Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]); fs.GetInformation(image, partitions[part], out _, null); - Assert.AreEqual(clusters[i], fs.XmlFsType.Clusters, testfiles[i]); - Assert.AreEqual(clustersize[i], fs.XmlFsType.ClusterSize, testfiles[i]); - Assert.AreEqual("BeFS", fs.XmlFsType.Type, testfiles[i]); - Assert.AreEqual(volumename[i], fs.XmlFsType.VolumeName, testfiles[i]); + Assert.AreEqual(clusters[i], fs.XmlFsType.Clusters, testfiles[i]); + Assert.AreEqual(clustersize[i], fs.XmlFsType.ClusterSize, testfiles[i]); + Assert.AreEqual("BeFS", fs.XmlFsType.Type, testfiles[i]); + Assert.AreEqual(volumename[i], fs.XmlFsType.VolumeName, testfiles[i]); Assert.AreEqual(volumeserial[i], fs.XmlFsType.VolumeSerial, testfiles[i]); } } @@ -217,16 +217,16 @@ namespace DiscImageChef.Tests.Filesystems { for(int i = 0; i < testfiles.Length; i++) { - string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "befs_mbr", testfiles[i]); - IFilter filter = new LZip(); + string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "befs_mbr", testfiles[i]); + IFilter filter = new LZip(); filter.Open(location); IMediaImage image = new Vdi(); - Assert.AreEqual(true, image.Open(filter), testfiles[i]); - Assert.AreEqual(sectors[i], image.Info.Sectors, testfiles[i]); + Assert.AreEqual(true, image.Open(filter), testfiles[i]); + Assert.AreEqual(sectors[i], image.Info.Sectors, testfiles[i]); Assert.AreEqual(sectorsize[i], image.Info.SectorSize, testfiles[i]); List partitions = Core.Partitions.GetAll(image); - IFilesystem fs = new BeFS(); - int part = -1; + IFilesystem fs = new BeFS(); + int part = -1; for(int j = 0; j < partitions.Count; j++) if(partitions[j].Type == "0xEB") { @@ -237,10 +237,10 @@ namespace DiscImageChef.Tests.Filesystems Assert.AreNotEqual(-1, part, $"Partition not found on {testfiles[i]}"); Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]); fs.GetInformation(image, partitions[part], out _, null); - Assert.AreEqual(clusters[i], fs.XmlFsType.Clusters, testfiles[i]); - Assert.AreEqual(clustersize[i], fs.XmlFsType.ClusterSize, testfiles[i]); - Assert.AreEqual("BeFS", fs.XmlFsType.Type, testfiles[i]); - Assert.AreEqual(volumename[i], fs.XmlFsType.VolumeName, testfiles[i]); + Assert.AreEqual(clusters[i], fs.XmlFsType.Clusters, testfiles[i]); + Assert.AreEqual(clustersize[i], fs.XmlFsType.ClusterSize, testfiles[i]); + Assert.AreEqual("BeFS", fs.XmlFsType.Type, testfiles[i]); + Assert.AreEqual(volumename[i], fs.XmlFsType.VolumeName, testfiles[i]); Assert.AreEqual(volumeserial[i], fs.XmlFsType.VolumeSerial, testfiles[i]); } } diff --git a/DiscImageChef.Tests/Filesystems/COHERENT.cs b/DiscImageChef.Tests/Filesystems/COHERENT.cs index dddeaddd9..f4d722a4f 100644 --- a/DiscImageChef.Tests/Filesystems/COHERENT.cs +++ b/DiscImageChef.Tests/Filesystems/COHERENT.cs @@ -67,27 +67,27 @@ namespace DiscImageChef.Tests.Filesystems { for(int i = 0; i < testfiles.Length; i++) { - string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "coherent", testfiles[i]); - IFilter filter = new LZip(); + string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "coherent", testfiles[i]); + IFilter filter = new LZip(); filter.Open(location); IMediaImage image = new ZZZRawImage(); - Assert.AreEqual(true, image.Open(filter), testfiles[i]); - Assert.AreEqual(mediatypes[i], image.Info.MediaType, testfiles[i]); - Assert.AreEqual(sectors[i], image.Info.Sectors, testfiles[i]); + Assert.AreEqual(true, image.Open(filter), testfiles[i]); + Assert.AreEqual(mediatypes[i], image.Info.MediaType, testfiles[i]); + Assert.AreEqual(sectors[i], image.Info.Sectors, testfiles[i]); Assert.AreEqual(sectorsize[i], image.Info.SectorSize, testfiles[i]); IFilesystem fs = new SysVfs(); Partition wholePart = new Partition { - Name = "Whole device", + Name = "Whole device", Length = image.Info.Sectors, - Size = image.Info.Sectors * image.Info.SectorSize + Size = image.Info.Sectors * image.Info.SectorSize }; Assert.AreEqual(true, fs.Identify(image, wholePart), testfiles[i]); fs.GetInformation(image, wholePart, out _, null); - Assert.AreEqual(clusters[i], fs.XmlFsType.Clusters, testfiles[i]); - Assert.AreEqual(clustersize[i], fs.XmlFsType.ClusterSize, testfiles[i]); - Assert.AreEqual(type[i], fs.XmlFsType.Type, testfiles[i]); - Assert.AreEqual(volumename[i], fs.XmlFsType.VolumeName, testfiles[i]); + Assert.AreEqual(clusters[i], fs.XmlFsType.Clusters, testfiles[i]); + Assert.AreEqual(clustersize[i], fs.XmlFsType.ClusterSize, testfiles[i]); + Assert.AreEqual(type[i], fs.XmlFsType.Type, testfiles[i]); + Assert.AreEqual(volumename[i], fs.XmlFsType.VolumeName, testfiles[i]); Assert.AreEqual(volumeserial[i], fs.XmlFsType.VolumeSerial, testfiles[i]); } } @@ -117,16 +117,16 @@ namespace DiscImageChef.Tests.Filesystems { for(int i = 0; i < testfiles.Length; i++) { - string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "coherent_mbr", testfiles[i]); - IFilter filter = new LZip(); + string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "coherent_mbr", testfiles[i]); + IFilter filter = new LZip(); filter.Open(location); IMediaImage image = new Vdi(); - Assert.AreEqual(true, image.Open(filter), testfiles[i]); - Assert.AreEqual(sectors[i], image.Info.Sectors, testfiles[i]); + Assert.AreEqual(true, image.Open(filter), testfiles[i]); + Assert.AreEqual(sectors[i], image.Info.Sectors, testfiles[i]); Assert.AreEqual(sectorsize[i], image.Info.SectorSize, testfiles[i]); List partitions = Core.Partitions.GetAll(image); - IFilesystem fs = new SysVfs(); - int part = -1; + IFilesystem fs = new SysVfs(); + int part = -1; for(int j = 0; j < partitions.Count; j++) if(partitions[j].Type == "0x09") { @@ -137,10 +137,10 @@ namespace DiscImageChef.Tests.Filesystems Assert.AreNotEqual(-1, part, $"Partition not found on {testfiles[i]}"); Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]); fs.GetInformation(image, partitions[part], out _, null); - Assert.AreEqual(clusters[i], fs.XmlFsType.Clusters, testfiles[i]); - Assert.AreEqual(clustersize[i], fs.XmlFsType.ClusterSize, testfiles[i]); - Assert.AreEqual(type[i], fs.XmlFsType.Type, testfiles[i]); - Assert.AreEqual(volumename[i], fs.XmlFsType.VolumeName, testfiles[i]); + Assert.AreEqual(clusters[i], fs.XmlFsType.Clusters, testfiles[i]); + Assert.AreEqual(clustersize[i], fs.XmlFsType.ClusterSize, testfiles[i]); + Assert.AreEqual(type[i], fs.XmlFsType.Type, testfiles[i]); + Assert.AreEqual(volumename[i], fs.XmlFsType.VolumeName, testfiles[i]); Assert.AreEqual(volumeserial[i], fs.XmlFsType.VolumeSerial, testfiles[i]); } } diff --git a/DiscImageChef.Tests/Filesystems/DTFS.cs b/DiscImageChef.Tests/Filesystems/DTFS.cs index 45a5ccc8a..be225c29b 100644 --- a/DiscImageChef.Tests/Filesystems/DTFS.cs +++ b/DiscImageChef.Tests/Filesystems/DTFS.cs @@ -68,27 +68,27 @@ namespace DiscImageChef.Tests.Filesystems { for(int i = 0; i < testfiles.Length; i++) { - string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "dtfs", testfiles[i]); - IFilter filter = new LZip(); + string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "dtfs", testfiles[i]); + IFilter filter = new LZip(); filter.Open(location); IMediaImage image = new ZZZRawImage(); - Assert.AreEqual(true, image.Open(filter), testfiles[i]); - Assert.AreEqual(mediatypes[i], image.Info.MediaType, testfiles[i]); - Assert.AreEqual(sectors[i], image.Info.Sectors, testfiles[i]); + Assert.AreEqual(true, image.Open(filter), testfiles[i]); + Assert.AreEqual(mediatypes[i], image.Info.MediaType, testfiles[i]); + Assert.AreEqual(sectors[i], image.Info.Sectors, testfiles[i]); Assert.AreEqual(sectorsize[i], image.Info.SectorSize, testfiles[i]); IFilesystem fs = new SysVfs(); Partition wholePart = new Partition { - Name = "Whole device", + Name = "Whole device", Length = image.Info.Sectors, - Size = image.Info.Sectors * image.Info.SectorSize + Size = image.Info.Sectors * image.Info.SectorSize }; Assert.AreEqual(true, fs.Identify(image, wholePart), testfiles[i]); fs.GetInformation(image, wholePart, out _, null); - Assert.AreEqual(clusters[i], fs.XmlFsType.Clusters, testfiles[i]); - Assert.AreEqual(clustersize[i], fs.XmlFsType.ClusterSize, testfiles[i]); - Assert.AreEqual(type[i], fs.XmlFsType.Type, testfiles[i]); - Assert.AreEqual(volumename[i], fs.XmlFsType.VolumeName, testfiles[i]); + Assert.AreEqual(clusters[i], fs.XmlFsType.Clusters, testfiles[i]); + Assert.AreEqual(clustersize[i], fs.XmlFsType.ClusterSize, testfiles[i]); + Assert.AreEqual(type[i], fs.XmlFsType.Type, testfiles[i]); + Assert.AreEqual(volumename[i], fs.XmlFsType.VolumeName, testfiles[i]); Assert.AreEqual(volumeserial[i], fs.XmlFsType.VolumeSerial, testfiles[i]); } } @@ -118,16 +118,16 @@ namespace DiscImageChef.Tests.Filesystems { for(int i = 0; i < testfiles.Length; i++) { - string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "dtfs_mbr", testfiles[i]); - IFilter filter = new LZip(); + string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "dtfs_mbr", testfiles[i]); + IFilter filter = new LZip(); filter.Open(location); IMediaImage image = new Vdi(); - Assert.AreEqual(true, image.Open(filter), testfiles[i]); - Assert.AreEqual(sectors[i], image.Info.Sectors, testfiles[i]); + Assert.AreEqual(true, image.Open(filter), testfiles[i]); + Assert.AreEqual(sectors[i], image.Info.Sectors, testfiles[i]); Assert.AreEqual(sectorsize[i], image.Info.SectorSize, testfiles[i]); List partitions = Core.Partitions.GetAll(image); - IFilesystem fs = new SysVfs(); - int part = -1; + IFilesystem fs = new SysVfs(); + int part = -1; for(int j = 0; j < partitions.Count; j++) if(partitions[j].Type == "XENIX") { @@ -138,10 +138,10 @@ namespace DiscImageChef.Tests.Filesystems Assert.AreNotEqual(-1, part, $"Partition not found on {testfiles[i]}"); Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]); fs.GetInformation(image, partitions[part], out _, null); - Assert.AreEqual(clusters[i], fs.XmlFsType.Clusters, testfiles[i]); - Assert.AreEqual(clustersize[i], fs.XmlFsType.ClusterSize, testfiles[i]); - Assert.AreEqual(type[i], fs.XmlFsType.Type, testfiles[i]); - Assert.AreEqual(volumename[i], fs.XmlFsType.VolumeName, testfiles[i]); + Assert.AreEqual(clusters[i], fs.XmlFsType.Clusters, testfiles[i]); + Assert.AreEqual(clustersize[i], fs.XmlFsType.ClusterSize, testfiles[i]); + Assert.AreEqual(type[i], fs.XmlFsType.Type, testfiles[i]); + Assert.AreEqual(volumename[i], fs.XmlFsType.VolumeName, testfiles[i]); Assert.AreEqual(volumeserial[i], fs.XmlFsType.VolumeSerial, testfiles[i]); } } diff --git a/DiscImageChef.Tests/Filesystems/EAFS.cs b/DiscImageChef.Tests/Filesystems/EAFS.cs index 830e3a933..316660e93 100644 --- a/DiscImageChef.Tests/Filesystems/EAFS.cs +++ b/DiscImageChef.Tests/Filesystems/EAFS.cs @@ -72,27 +72,27 @@ namespace DiscImageChef.Tests.Filesystems { for(int i = 0; i < testfiles.Length; i++) { - string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "eafs", testfiles[i]); - IFilter filter = new LZip(); + string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "eafs", testfiles[i]); + IFilter filter = new LZip(); filter.Open(location); IMediaImage image = new ZZZRawImage(); - Assert.AreEqual(true, image.Open(filter), testfiles[i]); - Assert.AreEqual(mediatypes[i], image.Info.MediaType, testfiles[i]); - Assert.AreEqual(sectors[i], image.Info.Sectors, testfiles[i]); + Assert.AreEqual(true, image.Open(filter), testfiles[i]); + Assert.AreEqual(mediatypes[i], image.Info.MediaType, testfiles[i]); + Assert.AreEqual(sectors[i], image.Info.Sectors, testfiles[i]); Assert.AreEqual(sectorsize[i], image.Info.SectorSize, testfiles[i]); IFilesystem fs = new SysVfs(); Partition wholePart = new Partition { - Name = "Whole device", + Name = "Whole device", Length = image.Info.Sectors, - Size = image.Info.Sectors * image.Info.SectorSize + Size = image.Info.Sectors * image.Info.SectorSize }; Assert.AreEqual(true, fs.Identify(image, wholePart), testfiles[i]); fs.GetInformation(image, wholePart, out _, null); - Assert.AreEqual(clusters[i], fs.XmlFsType.Clusters, testfiles[i]); - Assert.AreEqual(clustersize[i], fs.XmlFsType.ClusterSize, testfiles[i]); - Assert.AreEqual(type[i], fs.XmlFsType.Type, testfiles[i]); - Assert.AreEqual(volumename[i], fs.XmlFsType.VolumeName, testfiles[i]); + Assert.AreEqual(clusters[i], fs.XmlFsType.Clusters, testfiles[i]); + Assert.AreEqual(clustersize[i], fs.XmlFsType.ClusterSize, testfiles[i]); + Assert.AreEqual(type[i], fs.XmlFsType.Type, testfiles[i]); + Assert.AreEqual(volumename[i], fs.XmlFsType.VolumeName, testfiles[i]); Assert.AreEqual(volumeserial[i], fs.XmlFsType.VolumeSerial, testfiles[i]); } } @@ -122,16 +122,16 @@ namespace DiscImageChef.Tests.Filesystems { for(int i = 0; i < testfiles.Length; i++) { - string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "eafs_mbr", testfiles[i]); - IFilter filter = new LZip(); + string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "eafs_mbr", testfiles[i]); + IFilter filter = new LZip(); filter.Open(location); IMediaImage image = new Vdi(); - Assert.AreEqual(true, image.Open(filter), testfiles[i]); - Assert.AreEqual(sectors[i], image.Info.Sectors, testfiles[i]); + Assert.AreEqual(true, image.Open(filter), testfiles[i]); + Assert.AreEqual(sectors[i], image.Info.Sectors, testfiles[i]); Assert.AreEqual(sectorsize[i], image.Info.SectorSize, testfiles[i]); List partitions = Core.Partitions.GetAll(image); - IFilesystem fs = new SysVfs(); - int part = -1; + IFilesystem fs = new SysVfs(); + int part = -1; for(int j = 0; j < partitions.Count; j++) if(partitions[j].Type == "XENIX") { @@ -142,10 +142,10 @@ namespace DiscImageChef.Tests.Filesystems Assert.AreNotEqual(-1, part, $"Partition not found on {testfiles[i]}"); Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]); fs.GetInformation(image, partitions[part], out _, null); - Assert.AreEqual(clusters[i], fs.XmlFsType.Clusters, testfiles[i]); - Assert.AreEqual(clustersize[i], fs.XmlFsType.ClusterSize, testfiles[i]); - Assert.AreEqual(type[i], fs.XmlFsType.Type, testfiles[i]); - Assert.AreEqual(volumename[i], fs.XmlFsType.VolumeName, testfiles[i]); + Assert.AreEqual(clusters[i], fs.XmlFsType.Clusters, testfiles[i]); + Assert.AreEqual(clustersize[i], fs.XmlFsType.ClusterSize, testfiles[i]); + Assert.AreEqual(type[i], fs.XmlFsType.Type, testfiles[i]); + Assert.AreEqual(volumename[i], fs.XmlFsType.VolumeName, testfiles[i]); Assert.AreEqual(volumeserial[i], fs.XmlFsType.VolumeSerial, testfiles[i]); } } diff --git a/DiscImageChef.Tests/Filesystems/F2FS.cs b/DiscImageChef.Tests/Filesystems/F2FS.cs index 9d7ff0fed..699336bc0 100644 --- a/DiscImageChef.Tests/Filesystems/F2FS.cs +++ b/DiscImageChef.Tests/Filesystems/F2FS.cs @@ -59,17 +59,17 @@ namespace DiscImageChef.Tests.Filesystems { for(int i = 0; i < testfiles.Length; i++) { - string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "f2fs", testfiles[i]); - IFilter filter = new LZip(); + string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "f2fs", testfiles[i]); + IFilter filter = new LZip(); filter.Open(location); IMediaImage image = new Vdi(); - Assert.AreEqual(true, image.Open(filter), testfiles[i]); - Assert.AreEqual(sectors[i], image.Info.Sectors, testfiles[i]); + Assert.AreEqual(true, image.Open(filter), testfiles[i]); + Assert.AreEqual(sectors[i], image.Info.Sectors, testfiles[i]); Assert.AreEqual(sectorsize[i], image.Info.SectorSize, testfiles[i]); IPartition parts = new MBR(); Assert.AreEqual(true, parts.GetInformation(image, out List partitions, 0), testfiles[i]); - IFilesystem fs = new F2FS(); - int part = -1; + IFilesystem fs = new F2FS(); + int part = -1; for(int j = 0; j < partitions.Count; j++) if(partitions[j].Type == "0x83") { @@ -80,11 +80,11 @@ namespace DiscImageChef.Tests.Filesystems Assert.AreNotEqual(-1, part, $"Partition not found on {testfiles[i]}"); Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]); fs.GetInformation(image, partitions[part], out _, null); - Assert.AreEqual(clusters[i], fs.XmlFsType.Clusters, testfiles[i]); - Assert.AreEqual(clustersize[i], fs.XmlFsType.ClusterSize, testfiles[i]); - Assert.AreEqual("F2FS filesystem", fs.XmlFsType.Type, testfiles[i]); - Assert.AreEqual(volumename[i], fs.XmlFsType.VolumeName, testfiles[i]); - Assert.AreEqual(volumeserial[i], fs.XmlFsType.VolumeSerial, testfiles[i]); + Assert.AreEqual(clusters[i], fs.XmlFsType.Clusters, testfiles[i]); + Assert.AreEqual(clustersize[i], fs.XmlFsType.ClusterSize, testfiles[i]); + Assert.AreEqual("F2FS filesystem", fs.XmlFsType.Type, testfiles[i]); + Assert.AreEqual(volumename[i], fs.XmlFsType.VolumeName, testfiles[i]); + Assert.AreEqual(volumeserial[i], fs.XmlFsType.VolumeSerial, testfiles[i]); } } } diff --git a/DiscImageChef.Tests/Filesystems/FAT12.cs b/DiscImageChef.Tests/Filesystems/FAT12.cs index b7641c91c..f48467dae 100644 --- a/DiscImageChef.Tests/Filesystems/FAT12.cs +++ b/DiscImageChef.Tests/Filesystems/FAT12.cs @@ -1719,8 +1719,8 @@ namespace DiscImageChef.Tests.Filesystems Assert.AreEqual(mediatypes[i], image.Info.MediaType, testfiles[i]); Assert.AreEqual(sectors[i], image.Info.Sectors, testfiles[i]); Assert.AreEqual(sectorsize[i], image.Info.SectorSize, testfiles[i]); - IFilesystem fs = new FAT(); - Partition wholePart = new Partition + IFilesystem fs = new FAT(); + Partition wholePart = new Partition { Name = "Whole device", Length = image.Info.Sectors, @@ -1772,7 +1772,7 @@ namespace DiscImageChef.Tests.Filesystems List partitions = Core.Partitions.GetAll(image); IFilesystem fs = new FAT(); int part = -1; - for(int j = 0; j < partitions.Count; j++) + for(int j = 0; j < partitions.Count; j++) if(partitions[j].Type == "DOS_FAT_12") { part = j; @@ -1826,7 +1826,7 @@ namespace DiscImageChef.Tests.Filesystems List partitions = Core.Partitions.GetAll(image); IFilesystem fs = new FAT(); int part = -1; - for(int j = 0; j < partitions.Count; j++) + for(int j = 0; j < partitions.Count; j++) if(partitions[j].Type == "Microsoft Basic data") { part = j; diff --git a/DiscImageChef.Tests/Filesystems/FAT32.cs b/DiscImageChef.Tests/Filesystems/FAT32.cs index 68afebcff..55af60b04 100644 --- a/DiscImageChef.Tests/Filesystems/FAT32.cs +++ b/DiscImageChef.Tests/Filesystems/FAT32.cs @@ -70,7 +70,7 @@ namespace DiscImageChef.Tests.Filesystems List partitions = Core.Partitions.GetAll(image); IFilesystem fs = new FAT(); int part = -1; - for(int j = 0; j < partitions.Count; j++) + for(int j = 0; j < partitions.Count; j++) if(partitions[j].Type == "DOS_FAT_32") { part = j; @@ -124,7 +124,7 @@ namespace DiscImageChef.Tests.Filesystems List partitions = Core.Partitions.GetAll(image); IFilesystem fs = new FAT(); int part = -1; - for(int j = 0; j < partitions.Count; j++) + for(int j = 0; j < partitions.Count; j++) if(partitions[j].Type == "Microsoft Basic data") { part = j; diff --git a/DiscImageChef.Tests/Filesystems/HAMMER.cs b/DiscImageChef.Tests/Filesystems/HAMMER.cs index 1e36e7a4e..f2f8c6bd2 100644 --- a/DiscImageChef.Tests/Filesystems/HAMMER.cs +++ b/DiscImageChef.Tests/Filesystems/HAMMER.cs @@ -59,16 +59,16 @@ namespace DiscImageChef.Tests.Filesystems { for(int i = 0; i < testfiles.Length; i++) { - string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "hammer_mbr", testfiles[i]); - IFilter filter = new LZip(); + string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "hammer_mbr", testfiles[i]); + IFilter filter = new LZip(); filter.Open(location); IMediaImage image = new Vdi(); - Assert.AreEqual(true, image.Open(filter), testfiles[i]); - Assert.AreEqual(sectors[i], image.Info.Sectors, testfiles[i]); + Assert.AreEqual(true, image.Open(filter), testfiles[i]); + Assert.AreEqual(sectors[i], image.Info.Sectors, testfiles[i]); Assert.AreEqual(sectorsize[i], image.Info.SectorSize, testfiles[i]); List partitions = Core.Partitions.GetAll(image); - IFilesystem fs = new HAMMER(); - int part = -1; + IFilesystem fs = new HAMMER(); + int part = -1; for(int j = 0; j < partitions.Count; j++) if(partitions[j].Type == "Hammer") { @@ -79,10 +79,10 @@ namespace DiscImageChef.Tests.Filesystems Assert.AreNotEqual(-1, part, $"Partition not found on {testfiles[i]}"); Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]); fs.GetInformation(image, partitions[part], out _, null); - Assert.AreEqual(clusters[i], fs.XmlFsType.Clusters, testfiles[i]); - Assert.AreEqual(clustersize[i], fs.XmlFsType.ClusterSize, testfiles[i]); - Assert.AreEqual("HAMMER", fs.XmlFsType.Type, testfiles[i]); - Assert.AreEqual(volumename[i], fs.XmlFsType.VolumeName, testfiles[i]); + Assert.AreEqual(clusters[i], fs.XmlFsType.Clusters, testfiles[i]); + Assert.AreEqual(clustersize[i], fs.XmlFsType.ClusterSize, testfiles[i]); + Assert.AreEqual("HAMMER", fs.XmlFsType.Type, testfiles[i]); + Assert.AreEqual(volumename[i], fs.XmlFsType.VolumeName, testfiles[i]); Assert.AreEqual(volumeserial[i], fs.XmlFsType.VolumeSerial, testfiles[i]); } } diff --git a/DiscImageChef.Tests/Filesystems/HFS.cs b/DiscImageChef.Tests/Filesystems/HFS.cs index 8ab73c43d..d49698588 100644 --- a/DiscImageChef.Tests/Filesystems/HFS.cs +++ b/DiscImageChef.Tests/Filesystems/HFS.cs @@ -81,8 +81,8 @@ namespace DiscImageChef.Tests.Filesystems Assert.AreEqual(mediatypes[i], image.Info.MediaType, testfiles[i]); Assert.AreEqual(sectors[i], image.Info.Sectors, testfiles[i]); Assert.AreEqual(sectorsize[i], image.Info.SectorSize, testfiles[i]); - IFilesystem fs = new AppleHFS(); - Partition wholePart = new Partition + IFilesystem fs = new AppleHFS(); + Partition wholePart = new Partition { Name = "Whole device", Length = image.Info.Sectors, @@ -172,7 +172,7 @@ namespace DiscImageChef.Tests.Filesystems List partitions = Core.Partitions.GetAll(image); IFilesystem fs = new AppleHFS(); int part = -1; - for(int j = 0; j < partitions.Count; j++) + for(int j = 0; j < partitions.Count; j++) if(partitions[j].Type == "Apple_HFS") { part = j; @@ -229,7 +229,7 @@ namespace DiscImageChef.Tests.Filesystems List partitions = Core.Partitions.GetAll(image); IFilesystem fs = new AppleHFS(); int part = -1; - for(int j = 0; j < partitions.Count; j++) + for(int j = 0; j < partitions.Count; j++) if(partitions[j].Type == "Apple_HFS") { part = j; @@ -283,7 +283,7 @@ namespace DiscImageChef.Tests.Filesystems List partitions = Core.Partitions.GetAll(image); IFilesystem fs = new AppleHFS(); int part = -1; - for(int j = 0; j < partitions.Count; j++) + for(int j = 0; j < partitions.Count; j++) if(partitions[j].Type == "0xAF") { part = j; @@ -334,7 +334,7 @@ namespace DiscImageChef.Tests.Filesystems List partitions = Core.Partitions.GetAll(image); IFilesystem fs = new AppleHFS(); int part = -1; - for(int j = 0; j < partitions.Count; j++) + for(int j = 0; j < partitions.Count; j++) if(partitions[j].Type == "\"RES\\86\"") { part = j; diff --git a/DiscImageChef.Tests/Filesystems/HFSPlus.cs b/DiscImageChef.Tests/Filesystems/HFSPlus.cs index f4a599b63..a54302e24 100644 --- a/DiscImageChef.Tests/Filesystems/HFSPlus.cs +++ b/DiscImageChef.Tests/Filesystems/HFSPlus.cs @@ -94,16 +94,16 @@ namespace DiscImageChef.Tests.Filesystems { for(int i = 0; i < testfiles.Length; i++) { - string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "hfsplus_apm", testfiles[i]); - IFilter filter = new LZip(); + string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "hfsplus_apm", testfiles[i]); + IFilter filter = new LZip(); filter.Open(location); IMediaImage image = new Vdi(); - Assert.AreEqual(true, image.Open(filter), testfiles[i]); - Assert.AreEqual(sectors[i], image.Info.Sectors, testfiles[i]); + Assert.AreEqual(true, image.Open(filter), testfiles[i]); + Assert.AreEqual(sectors[i], image.Info.Sectors, testfiles[i]); Assert.AreEqual(sectorsize[i], image.Info.SectorSize, testfiles[i]); List partitions = Core.Partitions.GetAll(image); - IFilesystem fs = new AppleHFSPlus(); - int part = -1; + IFilesystem fs = new AppleHFSPlus(); + int part = -1; for(int j = 0; j < partitions.Count; j++) if(partitions[j].Type == "Apple_HFS") { @@ -114,12 +114,12 @@ namespace DiscImageChef.Tests.Filesystems Assert.AreNotEqual(-1, part, $"Partition not found on {testfiles[i]}"); Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]); fs.GetInformation(image, partitions[part], out _, null); - Assert.AreEqual(clusters[i], fs.XmlFsType.Clusters, testfiles[i]); - Assert.AreEqual(clustersize[i], fs.XmlFsType.ClusterSize, testfiles[i]); - Assert.AreEqual("HFS+", fs.XmlFsType.Type, testfiles[i]); - Assert.AreEqual(volumename[i], fs.XmlFsType.VolumeName, testfiles[i]); - Assert.AreEqual(volumeserial[i], fs.XmlFsType.VolumeSerial, testfiles[i]); - Assert.AreEqual(oemid[i], fs.XmlFsType.SystemIdentifier, testfiles[i]); + Assert.AreEqual(clusters[i], fs.XmlFsType.Clusters, testfiles[i]); + Assert.AreEqual(clustersize[i], fs.XmlFsType.ClusterSize, testfiles[i]); + Assert.AreEqual("HFS+", fs.XmlFsType.Type, testfiles[i]); + Assert.AreEqual(volumename[i], fs.XmlFsType.VolumeName, testfiles[i]); + Assert.AreEqual(volumeserial[i], fs.XmlFsType.VolumeSerial, testfiles[i]); + Assert.AreEqual(oemid[i], fs.XmlFsType.SystemIdentifier, testfiles[i]); } } } @@ -148,16 +148,16 @@ namespace DiscImageChef.Tests.Filesystems { for(int i = 0; i < testfiles.Length; i++) { - string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "hfsplus_gpt", testfiles[i]); - IFilter filter = new LZip(); + string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "hfsplus_gpt", testfiles[i]); + IFilter filter = new LZip(); filter.Open(location); IMediaImage image = new Vdi(); - Assert.AreEqual(true, image.Open(filter), testfiles[i]); - Assert.AreEqual(sectors[i], image.Info.Sectors, testfiles[i]); + Assert.AreEqual(true, image.Open(filter), testfiles[i]); + Assert.AreEqual(sectors[i], image.Info.Sectors, testfiles[i]); Assert.AreEqual(sectorsize[i], image.Info.SectorSize, testfiles[i]); List partitions = Core.Partitions.GetAll(image); - IFilesystem fs = new AppleHFSPlus(); - int part = -1; + IFilesystem fs = new AppleHFSPlus(); + int part = -1; for(int j = 0; j < partitions.Count; j++) if(partitions[j].Type == "Apple HFS") { @@ -168,12 +168,12 @@ namespace DiscImageChef.Tests.Filesystems Assert.AreNotEqual(-1, part, $"Partition not found on {testfiles[i]}"); Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]); fs.GetInformation(image, partitions[part], out _, null); - Assert.AreEqual(clusters[i], fs.XmlFsType.Clusters, testfiles[i]); - Assert.AreEqual(clustersize[i], fs.XmlFsType.ClusterSize, testfiles[i]); - Assert.AreEqual("HFS+", fs.XmlFsType.Type, testfiles[i]); - Assert.AreEqual(volumename[i], fs.XmlFsType.VolumeName, testfiles[i]); - Assert.AreEqual(volumeserial[i], fs.XmlFsType.VolumeSerial, testfiles[i]); - Assert.AreEqual(oemid[i], fs.XmlFsType.SystemIdentifier, testfiles[i]); + Assert.AreEqual(clusters[i], fs.XmlFsType.Clusters, testfiles[i]); + Assert.AreEqual(clustersize[i], fs.XmlFsType.ClusterSize, testfiles[i]); + Assert.AreEqual("HFS+", fs.XmlFsType.Type, testfiles[i]); + Assert.AreEqual(volumename[i], fs.XmlFsType.VolumeName, testfiles[i]); + Assert.AreEqual(volumeserial[i], fs.XmlFsType.VolumeSerial, testfiles[i]); + Assert.AreEqual(oemid[i], fs.XmlFsType.SystemIdentifier, testfiles[i]); } } } @@ -215,16 +215,16 @@ namespace DiscImageChef.Tests.Filesystems { for(int i = 0; i < testfiles.Length; i++) { - string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "hfsplus_mbr", testfiles[i]); - IFilter filter = new LZip(); + string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "hfsplus_mbr", testfiles[i]); + IFilter filter = new LZip(); filter.Open(location); IMediaImage image = new Vdi(); - Assert.AreEqual(true, image.Open(filter), testfiles[i]); - Assert.AreEqual(sectors[i], image.Info.Sectors, testfiles[i]); + Assert.AreEqual(true, image.Open(filter), testfiles[i]); + Assert.AreEqual(sectors[i], image.Info.Sectors, testfiles[i]); Assert.AreEqual(sectorsize[i], image.Info.SectorSize, testfiles[i]); List partitions = Core.Partitions.GetAll(image); - IFilesystem fs = new AppleHFSPlus(); - int part = -1; + IFilesystem fs = new AppleHFSPlus(); + int part = -1; for(int j = 0; j < partitions.Count; j++) if(partitions[j].Type == "0xAF") { @@ -235,12 +235,12 @@ namespace DiscImageChef.Tests.Filesystems Assert.AreNotEqual(-1, part, $"Partition not found on {testfiles[i]}"); Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]); fs.GetInformation(image, partitions[part], out _, null); - Assert.AreEqual(clusters[i], fs.XmlFsType.Clusters, testfiles[i]); - Assert.AreEqual(clustersize[i], fs.XmlFsType.ClusterSize, testfiles[i]); - Assert.AreEqual("HFS+", fs.XmlFsType.Type, testfiles[i]); - Assert.AreEqual(volumename[i], fs.XmlFsType.VolumeName, testfiles[i]); - Assert.AreEqual(volumeserial[i], fs.XmlFsType.VolumeSerial, testfiles[i]); - Assert.AreEqual(oemid[i], fs.XmlFsType.SystemIdentifier, testfiles[i]); + Assert.AreEqual(clusters[i], fs.XmlFsType.Clusters, testfiles[i]); + Assert.AreEqual(clustersize[i], fs.XmlFsType.ClusterSize, testfiles[i]); + Assert.AreEqual("HFS+", fs.XmlFsType.Type, testfiles[i]); + Assert.AreEqual(volumename[i], fs.XmlFsType.VolumeName, testfiles[i]); + Assert.AreEqual(volumeserial[i], fs.XmlFsType.VolumeSerial, testfiles[i]); + Assert.AreEqual(oemid[i], fs.XmlFsType.SystemIdentifier, testfiles[i]); } } } diff --git a/DiscImageChef.Tests/Filesystems/HFSX.cs b/DiscImageChef.Tests/Filesystems/HFSX.cs index 70a64017c..fab973a90 100644 --- a/DiscImageChef.Tests/Filesystems/HFSX.cs +++ b/DiscImageChef.Tests/Filesystems/HFSX.cs @@ -68,16 +68,16 @@ namespace DiscImageChef.Tests.Filesystems { for(int i = 0; i < testfiles.Length; i++) { - string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "hfsx_apm", testfiles[i]); - IFilter filter = new LZip(); + string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "hfsx_apm", testfiles[i]); + IFilter filter = new LZip(); filter.Open(location); IMediaImage image = new Vdi(); - Assert.AreEqual(true, image.Open(filter), testfiles[i]); - Assert.AreEqual(sectors[i], image.Info.Sectors, testfiles[i]); + Assert.AreEqual(true, image.Open(filter), testfiles[i]); + Assert.AreEqual(sectors[i], image.Info.Sectors, testfiles[i]); Assert.AreEqual(sectorsize[i], image.Info.SectorSize, testfiles[i]); List partitions = Core.Partitions.GetAll(image); - IFilesystem fs = new AppleHFSPlus(); - int part = -1; + IFilesystem fs = new AppleHFSPlus(); + int part = -1; for(int j = 0; j < partitions.Count; j++) if(partitions[j].Type == "Apple_HFSX") { @@ -88,12 +88,12 @@ namespace DiscImageChef.Tests.Filesystems Assert.AreNotEqual(-1, part, $"Partition not found on {testfiles[i]}"); Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]); fs.GetInformation(image, partitions[part], out _, null); - Assert.AreEqual(clusters[i], fs.XmlFsType.Clusters, testfiles[i]); - Assert.AreEqual(clustersize[i], fs.XmlFsType.ClusterSize, testfiles[i]); - Assert.AreEqual("HFSX", fs.XmlFsType.Type, testfiles[i]); - Assert.AreEqual(volumename[i], fs.XmlFsType.VolumeName, testfiles[i]); - Assert.AreEqual(volumeserial[i], fs.XmlFsType.VolumeSerial, testfiles[i]); - Assert.AreEqual(oemid[i], fs.XmlFsType.SystemIdentifier, testfiles[i]); + Assert.AreEqual(clusters[i], fs.XmlFsType.Clusters, testfiles[i]); + Assert.AreEqual(clustersize[i], fs.XmlFsType.ClusterSize, testfiles[i]); + Assert.AreEqual("HFSX", fs.XmlFsType.Type, testfiles[i]); + Assert.AreEqual(volumename[i], fs.XmlFsType.VolumeName, testfiles[i]); + Assert.AreEqual(volumeserial[i], fs.XmlFsType.VolumeSerial, testfiles[i]); + Assert.AreEqual(oemid[i], fs.XmlFsType.SystemIdentifier, testfiles[i]); } } } @@ -122,16 +122,16 @@ namespace DiscImageChef.Tests.Filesystems { for(int i = 0; i < testfiles.Length; i++) { - string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "hfsx_gpt", testfiles[i]); - IFilter filter = new LZip(); + string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "hfsx_gpt", testfiles[i]); + IFilter filter = new LZip(); filter.Open(location); IMediaImage image = new Vdi(); - Assert.AreEqual(true, image.Open(filter), testfiles[i]); - Assert.AreEqual(sectors[i], image.Info.Sectors, testfiles[i]); + Assert.AreEqual(true, image.Open(filter), testfiles[i]); + Assert.AreEqual(sectors[i], image.Info.Sectors, testfiles[i]); Assert.AreEqual(sectorsize[i], image.Info.SectorSize, testfiles[i]); List partitions = Core.Partitions.GetAll(image); - IFilesystem fs = new AppleHFSPlus(); - int part = -1; + IFilesystem fs = new AppleHFSPlus(); + int part = -1; for(int j = 0; j < partitions.Count; j++) if(partitions[j].Type == "Apple HFS") { @@ -142,12 +142,12 @@ namespace DiscImageChef.Tests.Filesystems Assert.AreNotEqual(-1, part, $"Partition not found on {testfiles[i]}"); Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]); fs.GetInformation(image, partitions[part], out _, null); - Assert.AreEqual(clusters[i], fs.XmlFsType.Clusters, testfiles[i]); - Assert.AreEqual(clustersize[i], fs.XmlFsType.ClusterSize, testfiles[i]); - Assert.AreEqual("HFSX", fs.XmlFsType.Type, testfiles[i]); - Assert.AreEqual(volumename[i], fs.XmlFsType.VolumeName, testfiles[i]); - Assert.AreEqual(volumeserial[i], fs.XmlFsType.VolumeSerial, testfiles[i]); - Assert.AreEqual(oemid[i], fs.XmlFsType.SystemIdentifier, testfiles[i]); + Assert.AreEqual(clusters[i], fs.XmlFsType.Clusters, testfiles[i]); + Assert.AreEqual(clustersize[i], fs.XmlFsType.ClusterSize, testfiles[i]); + Assert.AreEqual("HFSX", fs.XmlFsType.Type, testfiles[i]); + Assert.AreEqual(volumename[i], fs.XmlFsType.VolumeName, testfiles[i]); + Assert.AreEqual(volumeserial[i], fs.XmlFsType.VolumeSerial, testfiles[i]); + Assert.AreEqual(oemid[i], fs.XmlFsType.SystemIdentifier, testfiles[i]); } } } @@ -181,16 +181,16 @@ namespace DiscImageChef.Tests.Filesystems { for(int i = 0; i < testfiles.Length; i++) { - string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "hfsx_mbr", testfiles[i]); - IFilter filter = new LZip(); + string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "hfsx_mbr", testfiles[i]); + IFilter filter = new LZip(); filter.Open(location); IMediaImage image = new Vdi(); - Assert.AreEqual(true, image.Open(filter), testfiles[i]); - Assert.AreEqual(sectors[i], image.Info.Sectors, testfiles[i]); + Assert.AreEqual(true, image.Open(filter), testfiles[i]); + Assert.AreEqual(sectors[i], image.Info.Sectors, testfiles[i]); Assert.AreEqual(sectorsize[i], image.Info.SectorSize, testfiles[i]); List partitions = Core.Partitions.GetAll(image); - IFilesystem fs = new AppleHFSPlus(); - int part = -1; + IFilesystem fs = new AppleHFSPlus(); + int part = -1; for(int j = 0; j < partitions.Count; j++) if(partitions[j].Type == "0xAF") { @@ -201,12 +201,12 @@ namespace DiscImageChef.Tests.Filesystems Assert.AreNotEqual(-1, part, $"Partition not found on {testfiles[i]}"); Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]); fs.GetInformation(image, partitions[part], out _, null); - Assert.AreEqual(clusters[i], fs.XmlFsType.Clusters, testfiles[i]); - Assert.AreEqual(clustersize[i], fs.XmlFsType.ClusterSize, testfiles[i]); - Assert.AreEqual("HFSX", fs.XmlFsType.Type, testfiles[i]); - Assert.AreEqual(volumename[i], fs.XmlFsType.VolumeName, testfiles[i]); - Assert.AreEqual(volumeserial[i], fs.XmlFsType.VolumeSerial, testfiles[i]); - Assert.AreEqual(oemid[i], fs.XmlFsType.SystemIdentifier, testfiles[i]); + Assert.AreEqual(clusters[i], fs.XmlFsType.Clusters, testfiles[i]); + Assert.AreEqual(clustersize[i], fs.XmlFsType.ClusterSize, testfiles[i]); + Assert.AreEqual("HFSX", fs.XmlFsType.Type, testfiles[i]); + Assert.AreEqual(volumename[i], fs.XmlFsType.VolumeName, testfiles[i]); + Assert.AreEqual(volumeserial[i], fs.XmlFsType.VolumeSerial, testfiles[i]); + Assert.AreEqual(oemid[i], fs.XmlFsType.SystemIdentifier, testfiles[i]); } } } diff --git a/DiscImageChef.Tests/Filesystems/HPOFS.cs b/DiscImageChef.Tests/Filesystems/HPOFS.cs index 19998412d..baad70939 100644 --- a/DiscImageChef.Tests/Filesystems/HPOFS.cs +++ b/DiscImageChef.Tests/Filesystems/HPOFS.cs @@ -70,8 +70,8 @@ namespace DiscImageChef.Tests.Filesystems Assert.AreEqual(mediatypes[i], image.Info.MediaType, testfiles[i]); Assert.AreEqual(sectors[i], image.Info.Sectors, testfiles[i]); Assert.AreEqual(sectorsize[i], image.Info.SectorSize, testfiles[i]); - IFilesystem fs = new HPOFS(); - Partition wholePart = new Partition + IFilesystem fs = new HPOFS(); + Partition wholePart = new Partition { Name = "Whole device", Length = image.Info.Sectors, diff --git a/DiscImageChef.Tests/Filesystems/HTFS.cs b/DiscImageChef.Tests/Filesystems/HTFS.cs index 39bd2a9bf..975af48ab 100644 --- a/DiscImageChef.Tests/Filesystems/HTFS.cs +++ b/DiscImageChef.Tests/Filesystems/HTFS.cs @@ -68,27 +68,27 @@ namespace DiscImageChef.Tests.Filesystems { for(int i = 0; i < testfiles.Length; i++) { - string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "htfs", testfiles[i]); - IFilter filter = new LZip(); + string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "htfs", testfiles[i]); + IFilter filter = new LZip(); filter.Open(location); IMediaImage image = new ZZZRawImage(); - Assert.AreEqual(true, image.Open(filter), testfiles[i]); - Assert.AreEqual(mediatypes[i], image.Info.MediaType, testfiles[i]); - Assert.AreEqual(sectors[i], image.Info.Sectors, testfiles[i]); + Assert.AreEqual(true, image.Open(filter), testfiles[i]); + Assert.AreEqual(mediatypes[i], image.Info.MediaType, testfiles[i]); + Assert.AreEqual(sectors[i], image.Info.Sectors, testfiles[i]); Assert.AreEqual(sectorsize[i], image.Info.SectorSize, testfiles[i]); IFilesystem fs = new SysVfs(); Partition wholePart = new Partition { - Name = "Whole device", + Name = "Whole device", Length = image.Info.Sectors, - Size = image.Info.Sectors * image.Info.SectorSize + Size = image.Info.Sectors * image.Info.SectorSize }; Assert.AreEqual(true, fs.Identify(image, wholePart), testfiles[i]); fs.GetInformation(image, wholePart, out _, null); - Assert.AreEqual(clusters[i], fs.XmlFsType.Clusters, testfiles[i]); - Assert.AreEqual(clustersize[i], fs.XmlFsType.ClusterSize, testfiles[i]); - Assert.AreEqual(type[i], fs.XmlFsType.Type, testfiles[i]); - Assert.AreEqual(volumename[i], fs.XmlFsType.VolumeName, testfiles[i]); + Assert.AreEqual(clusters[i], fs.XmlFsType.Clusters, testfiles[i]); + Assert.AreEqual(clustersize[i], fs.XmlFsType.ClusterSize, testfiles[i]); + Assert.AreEqual(type[i], fs.XmlFsType.Type, testfiles[i]); + Assert.AreEqual(volumename[i], fs.XmlFsType.VolumeName, testfiles[i]); Assert.AreEqual(volumeserial[i], fs.XmlFsType.VolumeSerial, testfiles[i]); } } @@ -118,16 +118,16 @@ namespace DiscImageChef.Tests.Filesystems { for(int i = 0; i < testfiles.Length; i++) { - string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "htfs_mbr", testfiles[i]); - IFilter filter = new LZip(); + string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "htfs_mbr", testfiles[i]); + IFilter filter = new LZip(); filter.Open(location); IMediaImage image = new Vdi(); - Assert.AreEqual(true, image.Open(filter), testfiles[i]); - Assert.AreEqual(sectors[i], image.Info.Sectors, testfiles[i]); + Assert.AreEqual(true, image.Open(filter), testfiles[i]); + Assert.AreEqual(sectors[i], image.Info.Sectors, testfiles[i]); Assert.AreEqual(sectorsize[i], image.Info.SectorSize, testfiles[i]); List partitions = Core.Partitions.GetAll(image); - IFilesystem fs = new SysVfs(); - int part = -1; + IFilesystem fs = new SysVfs(); + int part = -1; for(int j = 0; j < partitions.Count; j++) if(partitions[j].Type == "XENIX") { @@ -138,10 +138,10 @@ namespace DiscImageChef.Tests.Filesystems Assert.AreNotEqual(-1, part, $"Partition not found on {testfiles[i]}"); Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]); fs.GetInformation(image, partitions[part], out _, null); - Assert.AreEqual(clusters[i], fs.XmlFsType.Clusters, testfiles[i]); - Assert.AreEqual(clustersize[i], fs.XmlFsType.ClusterSize, testfiles[i]); - Assert.AreEqual(type[i], fs.XmlFsType.Type, testfiles[i]); - Assert.AreEqual(volumename[i], fs.XmlFsType.VolumeName, testfiles[i]); + Assert.AreEqual(clusters[i], fs.XmlFsType.Clusters, testfiles[i]); + Assert.AreEqual(clustersize[i], fs.XmlFsType.ClusterSize, testfiles[i]); + Assert.AreEqual(type[i], fs.XmlFsType.Type, testfiles[i]); + Assert.AreEqual(volumename[i], fs.XmlFsType.VolumeName, testfiles[i]); Assert.AreEqual(volumeserial[i], fs.XmlFsType.VolumeSerial, testfiles[i]); } } diff --git a/DiscImageChef.Tests/Filesystems/ISO9660.cs b/DiscImageChef.Tests/Filesystems/ISO9660.cs index 69dab307c..6e49f63b9 100644 --- a/DiscImageChef.Tests/Filesystems/ISO9660.cs +++ b/DiscImageChef.Tests/Filesystems/ISO9660.cs @@ -119,30 +119,30 @@ namespace DiscImageChef.Tests.Filesystems { for(int i = 0; i < testfiles.Length; i++) { - string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "iso9660", testfiles[i]); - IFilter filter = new LZip(); + string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "iso9660", testfiles[i]); + IFilter filter = new LZip(); filter.Open(location); IMediaImage image = new ZZZRawImage(); - Assert.AreEqual(true, image.Open(filter), testfiles[i]); - Assert.AreEqual(mediatypes[i], image.Info.MediaType, testfiles[i]); - Assert.AreEqual(sectors[i], image.Info.Sectors, testfiles[i]); + Assert.AreEqual(true, image.Open(filter), testfiles[i]); + Assert.AreEqual(mediatypes[i], image.Info.MediaType, testfiles[i]); + Assert.AreEqual(sectors[i], image.Info.Sectors, testfiles[i]); Assert.AreEqual(sectorsize[i], image.Info.SectorSize, testfiles[i]); IFilesystem fs = new ISO9660(); Partition wholePart = new Partition { - Name = "Whole device", + Name = "Whole device", Length = image.Info.Sectors, - Size = image.Info.Sectors * image.Info.SectorSize + Size = image.Info.Sectors * image.Info.SectorSize }; Assert.AreEqual(true, fs.Identify(image, wholePart), testfiles[i]); fs.GetInformation(image, wholePart, out _, null); - Assert.AreEqual(clusters[i], fs.XmlFsType.Clusters, testfiles[i]); - Assert.AreEqual(clustersize[i], fs.XmlFsType.ClusterSize, testfiles[i]); - Assert.AreEqual("ISO9660", fs.XmlFsType.Type, testfiles[i]); - Assert.AreEqual(volumename[i], fs.XmlFsType.VolumeName, testfiles[i]); - Assert.AreEqual(volumeserial[i], fs.XmlFsType.VolumeSerial, testfiles[i]); - Assert.AreEqual(sysid[i], fs.XmlFsType.SystemIdentifier, testfiles[i]); - Assert.AreEqual(appid[i], fs.XmlFsType.ApplicationIdentifier, testfiles[i]); + Assert.AreEqual(clusters[i], fs.XmlFsType.Clusters, testfiles[i]); + Assert.AreEqual(clustersize[i], fs.XmlFsType.ClusterSize, testfiles[i]); + Assert.AreEqual("ISO9660", fs.XmlFsType.Type, testfiles[i]); + Assert.AreEqual(volumename[i], fs.XmlFsType.VolumeName, testfiles[i]); + Assert.AreEqual(volumeserial[i], fs.XmlFsType.VolumeSerial, testfiles[i]); + Assert.AreEqual(sysid[i], fs.XmlFsType.SystemIdentifier, testfiles[i]); + Assert.AreEqual(appid[i], fs.XmlFsType.ApplicationIdentifier, testfiles[i]); } } } diff --git a/DiscImageChef.Tests/Filesystems/JFS2.cs b/DiscImageChef.Tests/Filesystems/JFS2.cs index 5049d5081..21610720b 100644 --- a/DiscImageChef.Tests/Filesystems/JFS2.cs +++ b/DiscImageChef.Tests/Filesystems/JFS2.cs @@ -72,7 +72,7 @@ namespace DiscImageChef.Tests.Filesystems List partitions = Core.Partitions.GetAll(image); IFilesystem fs = new JFS(); int part = -1; - for(int j = 0; j < partitions.Count; j++) + for(int j = 0; j < partitions.Count; j++) if(partitions[j].Type == "0x83" || partitions[j].Type == "0x07") { part = j; diff --git a/DiscImageChef.Tests/Filesystems/LFS.cs b/DiscImageChef.Tests/Filesystems/LFS.cs index 14df9ad62..24f339e01 100644 --- a/DiscImageChef.Tests/Filesystems/LFS.cs +++ b/DiscImageChef.Tests/Filesystems/LFS.cs @@ -52,6 +52,7 @@ namespace DiscImageChef.Tests.Filesystems public void Test() { throw new NotImplementedException("LFS filesystem is not yet implemented"); + /* for(int i = 0; i < testfiles.Length; i++) { diff --git a/DiscImageChef.Tests/Filesystems/LisaFS.cs b/DiscImageChef.Tests/Filesystems/LisaFS.cs index 405dcf7ab..aac62ad2f 100644 --- a/DiscImageChef.Tests/Filesystems/LisaFS.cs +++ b/DiscImageChef.Tests/Filesystems/LisaFS.cs @@ -84,29 +84,29 @@ namespace DiscImageChef.Tests.Filesystems { for(int i = 0; i < testfiles.Length; i++) { - string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "lisafs", testfiles[i]); - IFilter filter = new LZip(); + string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "lisafs", testfiles[i]); + IFilter filter = new LZip(); filter.Open(location); IMediaImage image = new DiskCopy42(); - Assert.AreEqual(true, image.Open(filter), testfiles[i]); - Assert.AreEqual(mediatypes[i], image.Info.MediaType, testfiles[i]); - Assert.AreEqual(sectors[i], image.Info.Sectors, testfiles[i]); + Assert.AreEqual(true, image.Open(filter), testfiles[i]); + Assert.AreEqual(mediatypes[i], image.Info.MediaType, testfiles[i]); + Assert.AreEqual(sectors[i], image.Info.Sectors, testfiles[i]); Assert.AreEqual(sectorsize[i], image.Info.SectorSize, testfiles[i]); IFilesystem fs = new LisaFS(); Partition wholePart = new Partition { - Name = "Whole device", + Name = "Whole device", Length = image.Info.Sectors, - Size = image.Info.Sectors * image.Info.SectorSize + Size = image.Info.Sectors * image.Info.SectorSize }; Assert.AreEqual(true, fs.Identify(image, wholePart), testfiles[i]); fs.GetInformation(image, wholePart, out _, null); - Assert.AreEqual(clusters[i], fs.XmlFsType.Clusters, testfiles[i]); - Assert.AreEqual(clustersize[i], fs.XmlFsType.ClusterSize, testfiles[i]); - Assert.AreEqual("LisaFS", fs.XmlFsType.Type, testfiles[i]); - Assert.AreEqual(volumename[i], fs.XmlFsType.VolumeName, testfiles[i]); - Assert.AreEqual(volumeserial[i], fs.XmlFsType.VolumeSerial, testfiles[i]); - Assert.AreEqual(oemid[i], fs.XmlFsType.SystemIdentifier, testfiles[i]); + Assert.AreEqual(clusters[i], fs.XmlFsType.Clusters, testfiles[i]); + Assert.AreEqual(clustersize[i], fs.XmlFsType.ClusterSize, testfiles[i]); + Assert.AreEqual("LisaFS", fs.XmlFsType.Type, testfiles[i]); + Assert.AreEqual(volumename[i], fs.XmlFsType.VolumeName, testfiles[i]); + Assert.AreEqual(volumeserial[i], fs.XmlFsType.VolumeSerial, testfiles[i]); + Assert.AreEqual(oemid[i], fs.XmlFsType.SystemIdentifier, testfiles[i]); } } } diff --git a/DiscImageChef.Tests/Filesystems/Locus.cs b/DiscImageChef.Tests/Filesystems/Locus.cs index 7547a3463..040389e13 100644 --- a/DiscImageChef.Tests/Filesystems/Locus.cs +++ b/DiscImageChef.Tests/Filesystems/Locus.cs @@ -61,29 +61,29 @@ namespace DiscImageChef.Tests.Filesystems { for(int i = 0; i < testfiles.Length; i++) { - string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "locus", testfiles[i]); - IFilter filter = new LZip(); + string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "locus", testfiles[i]); + IFilter filter = new LZip(); filter.Open(location); IMediaImage image = new ZZZRawImage(); - Assert.AreEqual(true, image.Open(filter), testfiles[i]); - Assert.AreEqual(mediatypes[i], image.Info.MediaType, testfiles[i]); - Assert.AreEqual(sectors[i], image.Info.Sectors, testfiles[i]); + Assert.AreEqual(true, image.Open(filter), testfiles[i]); + Assert.AreEqual(mediatypes[i], image.Info.MediaType, testfiles[i]); + Assert.AreEqual(sectors[i], image.Info.Sectors, testfiles[i]); Assert.AreEqual(sectorsize[i], image.Info.SectorSize, testfiles[i]); IFilesystem fs = new DiscImageChef.Filesystems.Locus(); Partition wholePart = new Partition { - Name = "Whole device", + Name = "Whole device", Length = image.Info.Sectors, - Size = image.Info.Sectors * image.Info.SectorSize + Size = image.Info.Sectors * image.Info.SectorSize }; Assert.AreEqual(true, fs.Identify(image, wholePart), testfiles[i]); fs.GetInformation(image, wholePart, out _, null); - Assert.AreEqual(clusters[i], fs.XmlFsType.Clusters, testfiles[i]); - Assert.AreEqual(clustersize[i], fs.XmlFsType.ClusterSize, testfiles[i]); - Assert.AreEqual("Locus filesystem", fs.XmlFsType.Type, testfiles[i]); - Assert.AreEqual(volumename[i], fs.XmlFsType.VolumeName, testfiles[i]); - Assert.AreEqual(volumeserial[i], fs.XmlFsType.VolumeSerial, testfiles[i]); - Assert.AreEqual(oemid[i], fs.XmlFsType.SystemIdentifier, testfiles[i]); + Assert.AreEqual(clusters[i], fs.XmlFsType.Clusters, testfiles[i]); + Assert.AreEqual(clustersize[i], fs.XmlFsType.ClusterSize, testfiles[i]); + Assert.AreEqual("Locus filesystem", fs.XmlFsType.Type, testfiles[i]); + Assert.AreEqual(volumename[i], fs.XmlFsType.VolumeName, testfiles[i]); + Assert.AreEqual(volumeserial[i], fs.XmlFsType.VolumeSerial, testfiles[i]); + Assert.AreEqual(oemid[i], fs.XmlFsType.SystemIdentifier, testfiles[i]); } } } diff --git a/DiscImageChef.Tests/Filesystems/MFS.cs b/DiscImageChef.Tests/Filesystems/MFS.cs index 9e3cdd6a2..51ed0797a 100644 --- a/DiscImageChef.Tests/Filesystems/MFS.cs +++ b/DiscImageChef.Tests/Filesystems/MFS.cs @@ -68,27 +68,27 @@ namespace DiscImageChef.Tests.Filesystems { for(int i = 0; i < testfiles.Length; i++) { - string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "mfs", testfiles[i]); - IFilter filter = new LZip(); + string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "mfs", testfiles[i]); + IFilter filter = new LZip(); filter.Open(location); IMediaImage image = new ZZZRawImage(); - Assert.AreEqual(true, image.Open(filter), testfiles[i]); - Assert.AreEqual(mediatypes[i], image.Info.MediaType, testfiles[i]); - Assert.AreEqual(sectors[i], image.Info.Sectors, testfiles[i]); + Assert.AreEqual(true, image.Open(filter), testfiles[i]); + Assert.AreEqual(mediatypes[i], image.Info.MediaType, testfiles[i]); + Assert.AreEqual(sectors[i], image.Info.Sectors, testfiles[i]); Assert.AreEqual(sectorsize[i], image.Info.SectorSize, testfiles[i]); IFilesystem fs = new AppleMFS(); Partition wholePart = new Partition { - Name = "Whole device", + Name = "Whole device", Length = image.Info.Sectors, - Size = image.Info.Sectors * image.Info.SectorSize + Size = image.Info.Sectors * image.Info.SectorSize }; Assert.AreEqual(true, fs.Identify(image, wholePart), testfiles[i]); fs.GetInformation(image, wholePart, out _, null); - Assert.AreEqual(clusters[i], fs.XmlFsType.Clusters, testfiles[i]); - Assert.AreEqual(clustersize[i], fs.XmlFsType.ClusterSize, testfiles[i]); - Assert.AreEqual("MFS", fs.XmlFsType.Type, testfiles[i]); - Assert.AreEqual(volumename[i], fs.XmlFsType.VolumeName, testfiles[i]); + Assert.AreEqual(clusters[i], fs.XmlFsType.Clusters, testfiles[i]); + Assert.AreEqual(clustersize[i], fs.XmlFsType.ClusterSize, testfiles[i]); + Assert.AreEqual("MFS", fs.XmlFsType.Type, testfiles[i]); + Assert.AreEqual(volumename[i], fs.XmlFsType.VolumeName, testfiles[i]); Assert.AreEqual(volumeserial[i], fs.XmlFsType.VolumeSerial, testfiles[i]); } } diff --git a/DiscImageChef.Tests/Filesystems/MINIX.cs b/DiscImageChef.Tests/Filesystems/MINIX.cs index 6ef6bbb80..8077b4585 100644 --- a/DiscImageChef.Tests/Filesystems/MINIX.cs +++ b/DiscImageChef.Tests/Filesystems/MINIX.cs @@ -63,26 +63,26 @@ namespace DiscImageChef.Tests.Filesystems { for(int i = 0; i < testfiles.Length; i++) { - string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "minixv1", testfiles[i]); - IFilter filter = new LZip(); + string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "minixv1", testfiles[i]); + IFilter filter = new LZip(); filter.Open(location); IMediaImage image = new ZZZRawImage(); - Assert.AreEqual(true, image.Open(filter), testfiles[i]); - Assert.AreEqual(mediatypes[i], image.Info.MediaType, testfiles[i]); - Assert.AreEqual(sectors[i], image.Info.Sectors, testfiles[i]); + Assert.AreEqual(true, image.Open(filter), testfiles[i]); + Assert.AreEqual(mediatypes[i], image.Info.MediaType, testfiles[i]); + Assert.AreEqual(sectors[i], image.Info.Sectors, testfiles[i]); Assert.AreEqual(sectorsize[i], image.Info.SectorSize, testfiles[i]); IFilesystem fs = new MinixFS(); Partition wholePart = new Partition { - Name = "Whole device", + Name = "Whole device", Length = image.Info.Sectors, - Size = image.Info.Sectors * image.Info.SectorSize + Size = image.Info.Sectors * image.Info.SectorSize }; Assert.AreEqual(true, fs.Identify(image, wholePart), testfiles[i]); fs.GetInformation(image, wholePart, out _, null); - Assert.AreEqual(clusters[i], fs.XmlFsType.Clusters, testfiles[i]); + Assert.AreEqual(clusters[i], fs.XmlFsType.Clusters, testfiles[i]); Assert.AreEqual(clustersize[i], fs.XmlFsType.ClusterSize, testfiles[i]); - Assert.AreEqual(types[i], fs.XmlFsType.Type, testfiles[i]); + Assert.AreEqual(types[i], fs.XmlFsType.Type, testfiles[i]); } } } @@ -107,16 +107,16 @@ namespace DiscImageChef.Tests.Filesystems { for(int i = 0; i < testfiles.Length; i++) { - string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "minixv1_mbr", testfiles[i]); - IFilter filter = new LZip(); + string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "minixv1_mbr", testfiles[i]); + IFilter filter = new LZip(); filter.Open(location); IMediaImage image = new Vdi(); - Assert.AreEqual(true, image.Open(filter), testfiles[i]); - Assert.AreEqual(sectors[i], image.Info.Sectors, testfiles[i]); + Assert.AreEqual(true, image.Open(filter), testfiles[i]); + Assert.AreEqual(sectors[i], image.Info.Sectors, testfiles[i]); Assert.AreEqual(sectorsize[i], image.Info.SectorSize, testfiles[i]); List partitions = Core.Partitions.GetAll(image); - IFilesystem fs = new MinixFS(); - int part = -1; + IFilesystem fs = new MinixFS(); + int part = -1; for(int j = 0; j < partitions.Count; j++) if(partitions[j].Type == "0x80" || partitions[j].Type == "0x81" || partitions[j].Type == "MINIX") { @@ -127,9 +127,9 @@ namespace DiscImageChef.Tests.Filesystems Assert.AreNotEqual(-1, part, $"Partition not found on {testfiles[i]}"); Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]); fs.GetInformation(image, partitions[part], out _, null); - Assert.AreEqual(clusters[i], fs.XmlFsType.Clusters, testfiles[i]); + Assert.AreEqual(clusters[i], fs.XmlFsType.Clusters, testfiles[i]); Assert.AreEqual(clustersize[i], fs.XmlFsType.ClusterSize, testfiles[i]); - Assert.AreEqual(types[i], fs.XmlFsType.Type, testfiles[i]); + Assert.AreEqual(types[i], fs.XmlFsType.Type, testfiles[i]); } } } @@ -161,26 +161,26 @@ namespace DiscImageChef.Tests.Filesystems { for(int i = 0; i < testfiles.Length; i++) { - string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "minixv2", testfiles[i]); - IFilter filter = new LZip(); + string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "minixv2", testfiles[i]); + IFilter filter = new LZip(); filter.Open(location); IMediaImage image = new ZZZRawImage(); - Assert.AreEqual(true, image.Open(filter), testfiles[i]); - Assert.AreEqual(mediatypes[i], image.Info.MediaType, testfiles[i]); - Assert.AreEqual(sectors[i], image.Info.Sectors, testfiles[i]); + Assert.AreEqual(true, image.Open(filter), testfiles[i]); + Assert.AreEqual(mediatypes[i], image.Info.MediaType, testfiles[i]); + Assert.AreEqual(sectors[i], image.Info.Sectors, testfiles[i]); Assert.AreEqual(sectorsize[i], image.Info.SectorSize, testfiles[i]); IFilesystem fs = new MinixFS(); Partition wholePart = new Partition { - Name = "Whole device", + Name = "Whole device", Length = image.Info.Sectors, - Size = image.Info.Sectors * image.Info.SectorSize + Size = image.Info.Sectors * image.Info.SectorSize }; Assert.AreEqual(true, fs.Identify(image, wholePart), testfiles[i]); fs.GetInformation(image, wholePart, out _, null); - Assert.AreEqual(clusters[i], fs.XmlFsType.Clusters, testfiles[i]); + Assert.AreEqual(clusters[i], fs.XmlFsType.Clusters, testfiles[i]); Assert.AreEqual(clustersize[i], fs.XmlFsType.ClusterSize, testfiles[i]); - Assert.AreEqual(types[i], fs.XmlFsType.Type, testfiles[i]); + Assert.AreEqual(types[i], fs.XmlFsType.Type, testfiles[i]); } } } @@ -205,16 +205,16 @@ namespace DiscImageChef.Tests.Filesystems { for(int i = 0; i < testfiles.Length; i++) { - string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "minixv2_mbr", testfiles[i]); - IFilter filter = new LZip(); + string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "minixv2_mbr", testfiles[i]); + IFilter filter = new LZip(); filter.Open(location); IMediaImage image = new Vdi(); - Assert.AreEqual(true, image.Open(filter), testfiles[i]); - Assert.AreEqual(sectors[i], image.Info.Sectors, testfiles[i]); + Assert.AreEqual(true, image.Open(filter), testfiles[i]); + Assert.AreEqual(sectors[i], image.Info.Sectors, testfiles[i]); Assert.AreEqual(sectorsize[i], image.Info.SectorSize, testfiles[i]); List partitions = Core.Partitions.GetAll(image); - IFilesystem fs = new MinixFS(); - int part = -1; + IFilesystem fs = new MinixFS(); + int part = -1; for(int j = 0; j < partitions.Count; j++) if(partitions[j].Type == "0x81" || partitions[j].Type == "MINIX") { @@ -225,9 +225,9 @@ namespace DiscImageChef.Tests.Filesystems Assert.AreNotEqual(-1, part, $"Partition not found on {testfiles[i]}"); Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]); fs.GetInformation(image, partitions[part], out _, null); - Assert.AreEqual(clusters[i], fs.XmlFsType.Clusters, testfiles[i]); + Assert.AreEqual(clusters[i], fs.XmlFsType.Clusters, testfiles[i]); Assert.AreEqual(clustersize[i], fs.XmlFsType.ClusterSize, testfiles[i]); - Assert.AreEqual(types[i], fs.XmlFsType.Type, testfiles[i]); + Assert.AreEqual(types[i], fs.XmlFsType.Type, testfiles[i]); } } } @@ -259,26 +259,26 @@ namespace DiscImageChef.Tests.Filesystems { for(int i = 0; i < testfiles.Length; i++) { - string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "minixv3", testfiles[i]); - IFilter filter = new LZip(); + string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "minixv3", testfiles[i]); + IFilter filter = new LZip(); filter.Open(location); IMediaImage image = new ZZZRawImage(); - Assert.AreEqual(true, image.Open(filter), testfiles[i]); - Assert.AreEqual(mediatypes[i], image.Info.MediaType, testfiles[i]); - Assert.AreEqual(sectors[i], image.Info.Sectors, testfiles[i]); + Assert.AreEqual(true, image.Open(filter), testfiles[i]); + Assert.AreEqual(mediatypes[i], image.Info.MediaType, testfiles[i]); + Assert.AreEqual(sectors[i], image.Info.Sectors, testfiles[i]); Assert.AreEqual(sectorsize[i], image.Info.SectorSize, testfiles[i]); IFilesystem fs = new MinixFS(); Partition wholePart = new Partition { - Name = "Whole device", + Name = "Whole device", Length = image.Info.Sectors, - Size = image.Info.Sectors * image.Info.SectorSize + Size = image.Info.Sectors * image.Info.SectorSize }; Assert.AreEqual(true, fs.Identify(image, wholePart), testfiles[i]); fs.GetInformation(image, wholePart, out _, null); - Assert.AreEqual(clusters[i], fs.XmlFsType.Clusters, testfiles[i]); + Assert.AreEqual(clusters[i], fs.XmlFsType.Clusters, testfiles[i]); Assert.AreEqual(clustersize[i], fs.XmlFsType.ClusterSize, testfiles[i]); - Assert.AreEqual(types[i], fs.XmlFsType.Type, testfiles[i]); + Assert.AreEqual(types[i], fs.XmlFsType.Type, testfiles[i]); } } } @@ -303,16 +303,16 @@ namespace DiscImageChef.Tests.Filesystems { for(int i = 0; i < testfiles.Length; i++) { - string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "minixv3_mbr", testfiles[i]); - IFilter filter = new LZip(); + string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "minixv3_mbr", testfiles[i]); + IFilter filter = new LZip(); filter.Open(location); IMediaImage image = new Vdi(); - Assert.AreEqual(true, image.Open(filter), testfiles[i]); - Assert.AreEqual(sectors[i], image.Info.Sectors, testfiles[i]); + Assert.AreEqual(true, image.Open(filter), testfiles[i]); + Assert.AreEqual(sectors[i], image.Info.Sectors, testfiles[i]); Assert.AreEqual(sectorsize[i], image.Info.SectorSize, testfiles[i]); List partitions = Core.Partitions.GetAll(image); - IFilesystem fs = new MinixFS(); - int part = -1; + IFilesystem fs = new MinixFS(); + int part = -1; for(int j = 0; j < partitions.Count; j++) if(partitions[j].Type == "0x81" || partitions[j].Type == "MINIX") { @@ -323,9 +323,9 @@ namespace DiscImageChef.Tests.Filesystems Assert.AreNotEqual(-1, part, $"Partition not found on {testfiles[i]}"); Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]); fs.GetInformation(image, partitions[part], out _, null); - Assert.AreEqual(clusters[i], fs.XmlFsType.Clusters, testfiles[i]); + Assert.AreEqual(clusters[i], fs.XmlFsType.Clusters, testfiles[i]); Assert.AreEqual(clustersize[i], fs.XmlFsType.ClusterSize, testfiles[i]); - Assert.AreEqual(types[i], fs.XmlFsType.Type, testfiles[i]); + Assert.AreEqual(types[i], fs.XmlFsType.Type, testfiles[i]); } } } diff --git a/DiscImageChef.Tests/Filesystems/NILFS2.cs b/DiscImageChef.Tests/Filesystems/NILFS2.cs index 1d9839754..cf2507718 100644 --- a/DiscImageChef.Tests/Filesystems/NILFS2.cs +++ b/DiscImageChef.Tests/Filesystems/NILFS2.cs @@ -58,16 +58,16 @@ namespace DiscImageChef.Tests.Filesystems { for(int i = 0; i < testfiles.Length; i++) { - string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "nilfs2", testfiles[i]); - IFilter filter = new LZip(); + string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "nilfs2", testfiles[i]); + IFilter filter = new LZip(); filter.Open(location); IMediaImage image = new Vdi(); - Assert.AreEqual(true, image.Open(filter), testfiles[i]); - Assert.AreEqual(sectors[i], image.Info.Sectors, testfiles[i]); + Assert.AreEqual(true, image.Open(filter), testfiles[i]); + Assert.AreEqual(sectors[i], image.Info.Sectors, testfiles[i]); Assert.AreEqual(sectorsize[i], image.Info.SectorSize, testfiles[i]); List partitions = Core.Partitions.GetAll(image); - IFilesystem fs = new NILFS2(); - int part = -1; + IFilesystem fs = new NILFS2(); + int part = -1; for(int j = 0; j < partitions.Count; j++) if(partitions[j].Type == "0x83") { @@ -78,11 +78,11 @@ namespace DiscImageChef.Tests.Filesystems Assert.AreNotEqual(-1, part, $"Partition not found on {testfiles[i]}"); Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]); fs.GetInformation(image, partitions[part], out _, null); - Assert.AreEqual(clusters[i], fs.XmlFsType.Clusters, testfiles[i]); - Assert.AreEqual(clustersize[i], fs.XmlFsType.ClusterSize, testfiles[i]); - Assert.AreEqual("NILFS2 filesystem", fs.XmlFsType.Type, testfiles[i]); - Assert.AreEqual(volumename[i], fs.XmlFsType.VolumeName, testfiles[i]); - Assert.AreEqual(volumeserial[i], fs.XmlFsType.VolumeSerial, testfiles[i]); + Assert.AreEqual(clusters[i], fs.XmlFsType.Clusters, testfiles[i]); + Assert.AreEqual(clustersize[i], fs.XmlFsType.ClusterSize, testfiles[i]); + Assert.AreEqual("NILFS2 filesystem", fs.XmlFsType.Type, testfiles[i]); + Assert.AreEqual(volumename[i], fs.XmlFsType.VolumeName, testfiles[i]); + Assert.AreEqual(volumeserial[i], fs.XmlFsType.VolumeSerial, testfiles[i]); } } } diff --git a/DiscImageChef.Tests/Filesystems/NTFS.cs b/DiscImageChef.Tests/Filesystems/NTFS.cs index 51f5bb22a..80c85c718 100644 --- a/DiscImageChef.Tests/Filesystems/NTFS.cs +++ b/DiscImageChef.Tests/Filesystems/NTFS.cs @@ -60,16 +60,16 @@ namespace DiscImageChef.Tests.Filesystems { for(int i = 0; i < testfiles.Length; i++) { - string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "ntfs_gpt", testfiles[i]); - IFilter filter = new LZip(); + string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "ntfs_gpt", testfiles[i]); + IFilter filter = new LZip(); filter.Open(location); IMediaImage image = new Vdi(); - Assert.AreEqual(true, image.Open(filter), testfiles[i]); - Assert.AreEqual(sectors[i], image.Info.Sectors, testfiles[i]); + Assert.AreEqual(true, image.Open(filter), testfiles[i]); + Assert.AreEqual(sectors[i], image.Info.Sectors, testfiles[i]); Assert.AreEqual(sectorsize[i], image.Info.SectorSize, testfiles[i]); List partitions = Core.Partitions.GetAll(image); - IFilesystem fs = new NTFS(); - int part = -1; + IFilesystem fs = new NTFS(); + int part = -1; for(int j = 0; j < partitions.Count; j++) if(partitions[j].Type == "Microsoft Basic data") { @@ -80,12 +80,12 @@ namespace DiscImageChef.Tests.Filesystems Assert.AreNotEqual(-1, part, $"Partition not found on {testfiles[i]}"); Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]); fs.GetInformation(image, partitions[part], out _, null); - Assert.AreEqual(clusters[i], fs.XmlFsType.Clusters, testfiles[i]); - Assert.AreEqual(clustersize[i], fs.XmlFsType.ClusterSize, testfiles[i]); - Assert.AreEqual("NTFS", fs.XmlFsType.Type, testfiles[i]); - Assert.AreEqual(volumename[i], fs.XmlFsType.VolumeName, testfiles[i]); - Assert.AreEqual(volumeserial[i], fs.XmlFsType.VolumeSerial, testfiles[i]); - Assert.AreEqual(oemid[i], fs.XmlFsType.SystemIdentifier, testfiles[i]); + Assert.AreEqual(clusters[i], fs.XmlFsType.Clusters, testfiles[i]); + Assert.AreEqual(clustersize[i], fs.XmlFsType.ClusterSize, testfiles[i]); + Assert.AreEqual("NTFS", fs.XmlFsType.Type, testfiles[i]); + Assert.AreEqual(volumename[i], fs.XmlFsType.VolumeName, testfiles[i]); + Assert.AreEqual(volumeserial[i], fs.XmlFsType.VolumeSerial, testfiles[i]); + Assert.AreEqual(oemid[i], fs.XmlFsType.SystemIdentifier, testfiles[i]); } } } @@ -122,16 +122,16 @@ namespace DiscImageChef.Tests.Filesystems { for(int i = 0; i < testfiles.Length; i++) { - string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "ntfs_mbr", testfiles[i]); - IFilter filter = new LZip(); + string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "ntfs_mbr", testfiles[i]); + IFilter filter = new LZip(); filter.Open(location); IMediaImage image = new Vdi(); - Assert.AreEqual(true, image.Open(filter), testfiles[i]); - Assert.AreEqual(sectors[i], image.Info.Sectors, testfiles[i]); + Assert.AreEqual(true, image.Open(filter), testfiles[i]); + Assert.AreEqual(sectors[i], image.Info.Sectors, testfiles[i]); Assert.AreEqual(sectorsize[i], image.Info.SectorSize, testfiles[i]); List partitions = Core.Partitions.GetAll(image); - IFilesystem fs = new NTFS(); - int part = -1; + IFilesystem fs = new NTFS(); + int part = -1; for(int j = 0; j < partitions.Count; j++) if(partitions[j].Type == "0x07" || // Value incorrectly set by Haiku @@ -144,12 +144,12 @@ namespace DiscImageChef.Tests.Filesystems Assert.AreNotEqual(-1, part, $"Partition not found on {testfiles[i]}"); Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]); fs.GetInformation(image, partitions[part], out _, null); - Assert.AreEqual(clusters[i], fs.XmlFsType.Clusters, testfiles[i]); - Assert.AreEqual(clustersize[i], fs.XmlFsType.ClusterSize, testfiles[i]); - Assert.AreEqual("NTFS", fs.XmlFsType.Type, testfiles[i]); - Assert.AreEqual(volumename[i], fs.XmlFsType.VolumeName, testfiles[i]); - Assert.AreEqual(volumeserial[i], fs.XmlFsType.VolumeSerial, testfiles[i]); - Assert.AreEqual(oemid[i], fs.XmlFsType.SystemIdentifier, testfiles[i]); + Assert.AreEqual(clusters[i], fs.XmlFsType.Clusters, testfiles[i]); + Assert.AreEqual(clustersize[i], fs.XmlFsType.ClusterSize, testfiles[i]); + Assert.AreEqual("NTFS", fs.XmlFsType.Type, testfiles[i]); + Assert.AreEqual(volumename[i], fs.XmlFsType.VolumeName, testfiles[i]); + Assert.AreEqual(volumeserial[i], fs.XmlFsType.VolumeSerial, testfiles[i]); + Assert.AreEqual(oemid[i], fs.XmlFsType.SystemIdentifier, testfiles[i]); } } } diff --git a/DiscImageChef.Tests/Filesystems/NWFS386.cs b/DiscImageChef.Tests/Filesystems/NWFS386.cs index 8642c7e98..312ce2810 100644 --- a/DiscImageChef.Tests/Filesystems/NWFS386.cs +++ b/DiscImageChef.Tests/Filesystems/NWFS386.cs @@ -52,6 +52,7 @@ namespace DiscImageChef.Tests.Filesystems public void Test() { throw new NotImplementedException("NWFS386 filesystem is not yet implemented"); + /* for(int i = 0; i < testfiles.Length; i++) { diff --git a/DiscImageChef.Tests/Filesystems/OCFS2.cs b/DiscImageChef.Tests/Filesystems/OCFS2.cs index e17b4826d..c4a33815a 100644 --- a/DiscImageChef.Tests/Filesystems/OCFS2.cs +++ b/DiscImageChef.Tests/Filesystems/OCFS2.cs @@ -52,6 +52,7 @@ namespace DiscImageChef.Tests.Filesystems public void Test() { throw new NotImplementedException("OCFS2 filesystem is not yet implemented"); + /* for(int i = 0; i < testfiles.Length; i++) { diff --git a/DiscImageChef.Tests/Filesystems/PFS3.cs b/DiscImageChef.Tests/Filesystems/PFS3.cs index bca5b5b8c..354b7042a 100644 --- a/DiscImageChef.Tests/Filesystems/PFS3.cs +++ b/DiscImageChef.Tests/Filesystems/PFS3.cs @@ -60,16 +60,16 @@ namespace DiscImageChef.Tests.Filesystems { for(int i = 0; i < testfiles.Length; i++) { - string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "pfs3", testfiles[i]); - IFilter filter = new LZip(); + string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "pfs3", testfiles[i]); + IFilter filter = new LZip(); filter.Open(location); IMediaImage image = new Vdi(); - Assert.AreEqual(true, image.Open(filter), testfiles[i]); - Assert.AreEqual(sectors[i], image.Info.Sectors, testfiles[i]); + Assert.AreEqual(true, image.Open(filter), testfiles[i]); + Assert.AreEqual(sectors[i], image.Info.Sectors, testfiles[i]); Assert.AreEqual(sectorsize[i], image.Info.SectorSize, testfiles[i]); List partitions = Core.Partitions.GetAll(image); - IFilesystem fs = new PFS(); - int part = -1; + IFilesystem fs = new PFS(); + int part = -1; for(int j = 0; j < partitions.Count; j++) if(partitions[j].Type == "\"PFS\\1\"") { @@ -80,12 +80,12 @@ namespace DiscImageChef.Tests.Filesystems Assert.AreNotEqual(-1, part, $"Partition not found on {testfiles[i]}"); Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]); fs.GetInformation(image, partitions[part], out _, null); - Assert.AreEqual(clusters[i], fs.XmlFsType.Clusters, testfiles[i]); - Assert.AreEqual(clustersize[i], fs.XmlFsType.ClusterSize, testfiles[i]); - Assert.AreEqual("PFS v3", fs.XmlFsType.Type, testfiles[i]); - Assert.AreEqual(volumename[i], fs.XmlFsType.VolumeName, testfiles[i]); - Assert.AreEqual(volumeserial[i], fs.XmlFsType.VolumeSerial, testfiles[i]); - Assert.AreEqual(oemid[i], fs.XmlFsType.SystemIdentifier, testfiles[i]); + Assert.AreEqual(clusters[i], fs.XmlFsType.Clusters, testfiles[i]); + Assert.AreEqual(clustersize[i], fs.XmlFsType.ClusterSize, testfiles[i]); + Assert.AreEqual("PFS v3", fs.XmlFsType.Type, testfiles[i]); + Assert.AreEqual(volumename[i], fs.XmlFsType.VolumeName, testfiles[i]); + Assert.AreEqual(volumeserial[i], fs.XmlFsType.VolumeSerial, testfiles[i]); + Assert.AreEqual(oemid[i], fs.XmlFsType.SystemIdentifier, testfiles[i]); } } } diff --git a/DiscImageChef.Tests/Filesystems/ProDOS.cs b/DiscImageChef.Tests/Filesystems/ProDOS.cs index 9dae6a441..fddc8a7a4 100644 --- a/DiscImageChef.Tests/Filesystems/ProDOS.cs +++ b/DiscImageChef.Tests/Filesystems/ProDOS.cs @@ -66,16 +66,16 @@ namespace DiscImageChef.Tests.Filesystems { for(int i = 0; i < testfiles.Length; i++) { - string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "prodos_apm", testfiles[i]); - IFilter filter = new LZip(); + string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "prodos_apm", testfiles[i]); + IFilter filter = new LZip(); filter.Open(location); IMediaImage image = new Vdi(); - Assert.AreEqual(true, image.Open(filter), testfiles[i]); - Assert.AreEqual(sectors[i], image.Info.Sectors, testfiles[i]); + Assert.AreEqual(true, image.Open(filter), testfiles[i]); + Assert.AreEqual(sectors[i], image.Info.Sectors, testfiles[i]); Assert.AreEqual(sectorsize[i], image.Info.SectorSize, testfiles[i]); List partitions = Core.Partitions.GetAll(image); - IFilesystem fs = new ProDOSPlugin(); - int part = -1; + IFilesystem fs = new ProDOSPlugin(); + int part = -1; for(int j = 0; j < partitions.Count; j++) if(partitions[j].Type == "Apple_ProDOS") { @@ -86,10 +86,10 @@ namespace DiscImageChef.Tests.Filesystems Assert.AreNotEqual(-1, part, $"Partition not found on {testfiles[i]}"); Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]); fs.GetInformation(image, partitions[part], out _, null); - Assert.AreEqual(clusters[i], fs.XmlFsType.Clusters, testfiles[i]); - Assert.AreEqual(clustersize[i], fs.XmlFsType.ClusterSize, testfiles[i]); - Assert.AreEqual("ProDOS", fs.XmlFsType.Type, testfiles[i]); - Assert.AreEqual(volumename[i], fs.XmlFsType.VolumeName, testfiles[i]); + Assert.AreEqual(clusters[i], fs.XmlFsType.Clusters, testfiles[i]); + Assert.AreEqual(clustersize[i], fs.XmlFsType.ClusterSize, testfiles[i]); + Assert.AreEqual("ProDOS", fs.XmlFsType.Type, testfiles[i]); + Assert.AreEqual(volumename[i], fs.XmlFsType.VolumeName, testfiles[i]); Assert.AreEqual(volumeserial[i], fs.XmlFsType.VolumeSerial, testfiles[i]); } } diff --git a/DiscImageChef.Tests/Filesystems/QNX4.cs b/DiscImageChef.Tests/Filesystems/QNX4.cs index 40423365b..15b6806ab 100644 --- a/DiscImageChef.Tests/Filesystems/QNX4.cs +++ b/DiscImageChef.Tests/Filesystems/QNX4.cs @@ -58,26 +58,26 @@ namespace DiscImageChef.Tests.Filesystems { for(int i = 0; i < testfiles.Length; i++) { - string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "qnx4", testfiles[i]); - IFilter filter = new LZip(); + string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "qnx4", testfiles[i]); + IFilter filter = new LZip(); filter.Open(location); IMediaImage image = new ZZZRawImage(); - Assert.AreEqual(true, image.Open(filter), testfiles[i]); - Assert.AreEqual(mediatypes[i], image.Info.MediaType, testfiles[i]); - Assert.AreEqual(sectors[i], image.Info.Sectors, testfiles[i]); + Assert.AreEqual(true, image.Open(filter), testfiles[i]); + Assert.AreEqual(mediatypes[i], image.Info.MediaType, testfiles[i]); + Assert.AreEqual(sectors[i], image.Info.Sectors, testfiles[i]); Assert.AreEqual(sectorsize[i], image.Info.SectorSize, testfiles[i]); IFilesystem fs = new QNX4(); Partition wholePart = new Partition { - Name = "Whole device", + Name = "Whole device", Length = image.Info.Sectors, - Size = image.Info.Sectors * image.Info.SectorSize + Size = image.Info.Sectors * image.Info.SectorSize }; Assert.AreEqual(true, fs.Identify(image, wholePart), testfiles[i]); fs.GetInformation(image, wholePart, out _, null); - Assert.AreEqual(clusters[i], fs.XmlFsType.Clusters, testfiles[i]); - Assert.AreEqual(clustersize[i], fs.XmlFsType.ClusterSize, testfiles[i]); - Assert.AreEqual("QNX4 filesystem", fs.XmlFsType.Type, testfiles[i]); + Assert.AreEqual(clusters[i], fs.XmlFsType.Clusters, testfiles[i]); + Assert.AreEqual(clustersize[i], fs.XmlFsType.ClusterSize, testfiles[i]); + Assert.AreEqual("QNX4 filesystem", fs.XmlFsType.Type, testfiles[i]); } } } @@ -100,16 +100,16 @@ namespace DiscImageChef.Tests.Filesystems { for(int i = 0; i < testfiles.Length; i++) { - string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "qnx4_mbr", testfiles[i]); - IFilter filter = new LZip(); + string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "qnx4_mbr", testfiles[i]); + IFilter filter = new LZip(); filter.Open(location); IMediaImage image = new Vdi(); - Assert.AreEqual(true, image.Open(filter), testfiles[i]); - Assert.AreEqual(sectors[i], image.Info.Sectors, testfiles[i]); + Assert.AreEqual(true, image.Open(filter), testfiles[i]); + Assert.AreEqual(sectors[i], image.Info.Sectors, testfiles[i]); Assert.AreEqual(sectorsize[i], image.Info.SectorSize, testfiles[i]); List partitions = Core.Partitions.GetAll(image); - IFilesystem fs = new QNX4(); - int part = -1; + IFilesystem fs = new QNX4(); + int part = -1; for(int j = 0; j < partitions.Count; j++) if(partitions[j].Type == "0x4D") { @@ -120,9 +120,9 @@ namespace DiscImageChef.Tests.Filesystems Assert.AreNotEqual(-1, part, $"Partition not found on {testfiles[i]}"); Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]); fs.GetInformation(image, partitions[part], out _, null); - Assert.AreEqual(clusters[i], fs.XmlFsType.Clusters, testfiles[i]); - Assert.AreEqual(clustersize[i], fs.XmlFsType.ClusterSize, testfiles[i]); - Assert.AreEqual("QNX4 filesystem", fs.XmlFsType.Type, testfiles[i]); + Assert.AreEqual(clusters[i], fs.XmlFsType.Clusters, testfiles[i]); + Assert.AreEqual(clustersize[i], fs.XmlFsType.ClusterSize, testfiles[i]); + Assert.AreEqual("QNX4 filesystem", fs.XmlFsType.Type, testfiles[i]); } } } diff --git a/DiscImageChef.Tests/Filesystems/ReFS.cs b/DiscImageChef.Tests/Filesystems/ReFS.cs index dcf3a7f74..b09eeabb7 100644 --- a/DiscImageChef.Tests/Filesystems/ReFS.cs +++ b/DiscImageChef.Tests/Filesystems/ReFS.cs @@ -69,7 +69,7 @@ namespace DiscImageChef.Tests.Filesystems Assert.AreEqual(sectorsize[i], image.Info.SectorSize, testfiles[i]); List partitions = Core.Partitions.GetAll(image); int part = -1; - for(int j = 0; j < partitions.Count; j++) + for(int j = 0; j < partitions.Count; j++) if(partitions[j].Type == "0x07") { part = j; diff --git a/DiscImageChef.Tests/Filesystems/Reiser3.cs b/DiscImageChef.Tests/Filesystems/Reiser3.cs index 596fc023c..a077463ac 100644 --- a/DiscImageChef.Tests/Filesystems/Reiser3.cs +++ b/DiscImageChef.Tests/Filesystems/Reiser3.cs @@ -56,16 +56,16 @@ namespace DiscImageChef.Tests.Filesystems { for(int i = 0; i < testfiles.Length; i++) { - string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "reiser3", testfiles[i]); - IFilter filter = new LZip(); + string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "reiser3", testfiles[i]); + IFilter filter = new LZip(); filter.Open(location); IMediaImage image = new Vdi(); - Assert.AreEqual(true, image.Open(filter), testfiles[i]); - Assert.AreEqual(sectors[i], image.Info.Sectors, testfiles[i]); + Assert.AreEqual(true, image.Open(filter), testfiles[i]); + Assert.AreEqual(sectors[i], image.Info.Sectors, testfiles[i]); Assert.AreEqual(sectorsize[i], image.Info.SectorSize, testfiles[i]); List partitions = Core.Partitions.GetAll(image); - IFilesystem fs = new Reiser(); - int part = -1; + IFilesystem fs = new Reiser(); + int part = -1; for(int j = 0; j < partitions.Count; j++) if(partitions[j].Type == "0x83") { @@ -76,9 +76,9 @@ namespace DiscImageChef.Tests.Filesystems Assert.AreNotEqual(-1, part, $"Partition not found on {testfiles[i]}"); Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]); fs.GetInformation(image, partitions[part], out _, null); - Assert.AreEqual(clusters[i], fs.XmlFsType.Clusters, testfiles[i]); - Assert.AreEqual(clustersize[i], fs.XmlFsType.ClusterSize, testfiles[i]); - Assert.AreEqual(reiserversion[i], fs.XmlFsType.Type, testfiles[i]); + Assert.AreEqual(clusters[i], fs.XmlFsType.Clusters, testfiles[i]); + Assert.AreEqual(clustersize[i], fs.XmlFsType.ClusterSize, testfiles[i]); + Assert.AreEqual(reiserversion[i], fs.XmlFsType.Type, testfiles[i]); } } } diff --git a/DiscImageChef.Tests/Filesystems/Reiser4.cs b/DiscImageChef.Tests/Filesystems/Reiser4.cs index 646fd7642..d6780fb24 100644 --- a/DiscImageChef.Tests/Filesystems/Reiser4.cs +++ b/DiscImageChef.Tests/Filesystems/Reiser4.cs @@ -58,16 +58,16 @@ namespace DiscImageChef.Tests.Filesystems { for(int i = 0; i < testfiles.Length; i++) { - string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "reiser4", testfiles[i]); - IFilter filter = new LZip(); + string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "reiser4", testfiles[i]); + IFilter filter = new LZip(); filter.Open(location); IMediaImage image = new Vdi(); - Assert.AreEqual(true, image.Open(filter), testfiles[i]); - Assert.AreEqual(sectors[i], image.Info.Sectors, testfiles[i]); + Assert.AreEqual(true, image.Open(filter), testfiles[i]); + Assert.AreEqual(sectors[i], image.Info.Sectors, testfiles[i]); Assert.AreEqual(sectorsize[i], image.Info.SectorSize, testfiles[i]); List partitions = Core.Partitions.GetAll(image); - IFilesystem fs = new DiscImageChef.Filesystems.Reiser4(); - int part = -1; + IFilesystem fs = new DiscImageChef.Filesystems.Reiser4(); + int part = -1; for(int j = 0; j < partitions.Count; j++) if(partitions[j].Type == "0x83") { @@ -78,11 +78,11 @@ namespace DiscImageChef.Tests.Filesystems Assert.AreNotEqual(-1, part, $"Partition not found on {testfiles[i]}"); Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]); fs.GetInformation(image, partitions[part], out _, null); - Assert.AreEqual(clusters[i], fs.XmlFsType.Clusters, testfiles[i]); - Assert.AreEqual(clustersize[i], fs.XmlFsType.ClusterSize, testfiles[i]); - Assert.AreEqual("Reiser 4 filesystem", fs.XmlFsType.Type, testfiles[i]); - Assert.AreEqual(volumename[i], fs.XmlFsType.VolumeName, testfiles[i]); - Assert.AreEqual(volumeserial[i], fs.XmlFsType.VolumeSerial, testfiles[i]); + Assert.AreEqual(clusters[i], fs.XmlFsType.Clusters, testfiles[i]); + Assert.AreEqual(clustersize[i], fs.XmlFsType.ClusterSize, testfiles[i]); + Assert.AreEqual("Reiser 4 filesystem", fs.XmlFsType.Type, testfiles[i]); + Assert.AreEqual(volumename[i], fs.XmlFsType.VolumeName, testfiles[i]); + Assert.AreEqual(volumeserial[i], fs.XmlFsType.VolumeSerial, testfiles[i]); } } } diff --git a/DiscImageChef.Tests/Filesystems/SFS.cs b/DiscImageChef.Tests/Filesystems/SFS.cs index a5f4e8b45..10e07634a 100644 --- a/DiscImageChef.Tests/Filesystems/SFS.cs +++ b/DiscImageChef.Tests/Filesystems/SFS.cs @@ -58,16 +58,16 @@ namespace DiscImageChef.Tests.Filesystems { for(int i = 0; i < testfiles.Length; i++) { - string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "sfs_mbr", testfiles[i]); - IFilter filter = new LZip(); + string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "sfs_mbr", testfiles[i]); + IFilter filter = new LZip(); filter.Open(location); IMediaImage image = new Vdi(); - Assert.AreEqual(true, image.Open(filter), testfiles[i]); - Assert.AreEqual(sectors[i], image.Info.Sectors, testfiles[i]); + Assert.AreEqual(true, image.Open(filter), testfiles[i]); + Assert.AreEqual(sectors[i], image.Info.Sectors, testfiles[i]); Assert.AreEqual(sectorsize[i], image.Info.SectorSize, testfiles[i]); List partitions = Core.Partitions.GetAll(image); - IFilesystem fs = new SFS(); - int part = -1; + IFilesystem fs = new SFS(); + int part = -1; for(int j = 0; j < partitions.Count; j++) if(partitions[j].Type == "0x2F") { @@ -78,11 +78,11 @@ namespace DiscImageChef.Tests.Filesystems Assert.AreNotEqual(-1, part, $"Partition not found on {testfiles[i]}"); Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]); fs.GetInformation(image, partitions[part], out _, null); - Assert.AreEqual(clusters[i], fs.XmlFsType.Clusters, testfiles[i]); - Assert.AreEqual(clustersize[i], fs.XmlFsType.ClusterSize, testfiles[i]); - Assert.AreEqual("SmartFileSystem", fs.XmlFsType.Type, testfiles[i]); - Assert.AreEqual(volumename[i], fs.XmlFsType.VolumeName, testfiles[i]); - Assert.AreEqual(volumeserial[i], fs.XmlFsType.VolumeSerial, testfiles[i]); + Assert.AreEqual(clusters[i], fs.XmlFsType.Clusters, testfiles[i]); + Assert.AreEqual(clustersize[i], fs.XmlFsType.ClusterSize, testfiles[i]); + Assert.AreEqual("SmartFileSystem", fs.XmlFsType.Type, testfiles[i]); + Assert.AreEqual(volumename[i], fs.XmlFsType.VolumeName, testfiles[i]); + Assert.AreEqual(volumeserial[i], fs.XmlFsType.VolumeSerial, testfiles[i]); } } } @@ -109,16 +109,16 @@ namespace DiscImageChef.Tests.Filesystems { for(int i = 0; i < testfiles.Length; i++) { - string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "sfs_mbr_rdb", testfiles[i]); - IFilter filter = new LZip(); + string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "sfs_mbr_rdb", testfiles[i]); + IFilter filter = new LZip(); filter.Open(location); IMediaImage image = new Vdi(); - Assert.AreEqual(true, image.Open(filter), testfiles[i]); - Assert.AreEqual(sectors[i], image.Info.Sectors, testfiles[i]); + Assert.AreEqual(true, image.Open(filter), testfiles[i]); + Assert.AreEqual(sectors[i], image.Info.Sectors, testfiles[i]); Assert.AreEqual(sectorsize[i], image.Info.SectorSize, testfiles[i]); List partitions = Core.Partitions.GetAll(image); - IFilesystem fs = new SFS(); - int part = -1; + IFilesystem fs = new SFS(); + int part = -1; for(int j = 0; j < partitions.Count; j++) if(partitions[j].Type == "\"SFS\\0\"") { @@ -129,11 +129,11 @@ namespace DiscImageChef.Tests.Filesystems Assert.AreNotEqual(-1, part, $"Partition not found on {testfiles[i]}"); Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]); fs.GetInformation(image, partitions[part], out _, null); - Assert.AreEqual(clusters[i], fs.XmlFsType.Clusters, testfiles[i]); - Assert.AreEqual(clustersize[i], fs.XmlFsType.ClusterSize, testfiles[i]); - Assert.AreEqual("SmartFileSystem", fs.XmlFsType.Type, testfiles[i]); - Assert.AreEqual(volumename[i], fs.XmlFsType.VolumeName, testfiles[i]); - Assert.AreEqual(volumeserial[i], fs.XmlFsType.VolumeSerial, testfiles[i]); + Assert.AreEqual(clusters[i], fs.XmlFsType.Clusters, testfiles[i]); + Assert.AreEqual(clustersize[i], fs.XmlFsType.ClusterSize, testfiles[i]); + Assert.AreEqual("SmartFileSystem", fs.XmlFsType.Type, testfiles[i]); + Assert.AreEqual(volumename[i], fs.XmlFsType.VolumeName, testfiles[i]); + Assert.AreEqual(volumeserial[i], fs.XmlFsType.VolumeSerial, testfiles[i]); } } } @@ -160,16 +160,16 @@ namespace DiscImageChef.Tests.Filesystems { for(int i = 0; i < testfiles.Length; i++) { - string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "sfs_rdb", testfiles[i]); - IFilter filter = new LZip(); + string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "sfs_rdb", testfiles[i]); + IFilter filter = new LZip(); filter.Open(location); IMediaImage image = new Vdi(); - Assert.AreEqual(true, image.Open(filter), testfiles[i]); - Assert.AreEqual(sectors[i], image.Info.Sectors, testfiles[i]); + Assert.AreEqual(true, image.Open(filter), testfiles[i]); + Assert.AreEqual(sectors[i], image.Info.Sectors, testfiles[i]); Assert.AreEqual(sectorsize[i], image.Info.SectorSize, testfiles[i]); List partitions = Core.Partitions.GetAll(image); - IFilesystem fs = new SFS(); - int part = -1; + IFilesystem fs = new SFS(); + int part = -1; for(int j = 0; j < partitions.Count; j++) if(partitions[j].Type == "\"SFS\\0\"" || partitions[j].Type == "\"SFS\\2\"") { @@ -180,11 +180,11 @@ namespace DiscImageChef.Tests.Filesystems Assert.AreNotEqual(-1, part, $"Partition not found on {testfiles[i]}"); Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]); fs.GetInformation(image, partitions[part], out _, null); - Assert.AreEqual(clusters[i], fs.XmlFsType.Clusters, testfiles[i]); - Assert.AreEqual(clustersize[i], fs.XmlFsType.ClusterSize, testfiles[i]); - Assert.AreEqual("SmartFileSystem", fs.XmlFsType.Type, testfiles[i]); - Assert.AreEqual(volumename[i], fs.XmlFsType.VolumeName, testfiles[i]); - Assert.AreEqual(volumeserial[i], fs.XmlFsType.VolumeSerial, testfiles[i]); + Assert.AreEqual(clusters[i], fs.XmlFsType.Clusters, testfiles[i]); + Assert.AreEqual(clustersize[i], fs.XmlFsType.ClusterSize, testfiles[i]); + Assert.AreEqual("SmartFileSystem", fs.XmlFsType.Type, testfiles[i]); + Assert.AreEqual(volumename[i], fs.XmlFsType.VolumeName, testfiles[i]); + Assert.AreEqual(volumeserial[i], fs.XmlFsType.VolumeSerial, testfiles[i]); } } } diff --git a/DiscImageChef.Tests/Filesystems/SysV.cs b/DiscImageChef.Tests/Filesystems/SysV.cs index da98be2e8..a87cd2ac1 100644 --- a/DiscImageChef.Tests/Filesystems/SysV.cs +++ b/DiscImageChef.Tests/Filesystems/SysV.cs @@ -73,27 +73,27 @@ namespace DiscImageChef.Tests.Filesystems { for(int i = 0; i < testfiles.Length; i++) { - string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "s5fs", testfiles[i]); - IFilter filter = new LZip(); + string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "s5fs", testfiles[i]); + IFilter filter = new LZip(); filter.Open(location); IMediaImage image = new ZZZRawImage(); - Assert.AreEqual(true, image.Open(filter), testfiles[i]); - Assert.AreEqual(mediatypes[i], image.Info.MediaType, testfiles[i]); - Assert.AreEqual(sectors[i], image.Info.Sectors, testfiles[i]); + Assert.AreEqual(true, image.Open(filter), testfiles[i]); + Assert.AreEqual(mediatypes[i], image.Info.MediaType, testfiles[i]); + Assert.AreEqual(sectors[i], image.Info.Sectors, testfiles[i]); Assert.AreEqual(sectorsize[i], image.Info.SectorSize, testfiles[i]); IFilesystem fs = new SysVfs(); Partition wholePart = new Partition { - Name = "Whole device", + Name = "Whole device", Length = image.Info.Sectors, - Size = image.Info.Sectors * image.Info.SectorSize + Size = image.Info.Sectors * image.Info.SectorSize }; Assert.AreEqual(true, fs.Identify(image, wholePart), testfiles[i]); fs.GetInformation(image, wholePart, out _, null); - Assert.AreEqual(clusters[i], fs.XmlFsType.Clusters, testfiles[i]); - Assert.AreEqual(clustersize[i], fs.XmlFsType.ClusterSize, testfiles[i]); - Assert.AreEqual(type[i], fs.XmlFsType.Type, testfiles[i]); - Assert.AreEqual(volumename[i], fs.XmlFsType.VolumeName, testfiles[i]); + Assert.AreEqual(clusters[i], fs.XmlFsType.Clusters, testfiles[i]); + Assert.AreEqual(clustersize[i], fs.XmlFsType.ClusterSize, testfiles[i]); + Assert.AreEqual(type[i], fs.XmlFsType.Type, testfiles[i]); + Assert.AreEqual(volumename[i], fs.XmlFsType.VolumeName, testfiles[i]); Assert.AreEqual(volumeserial[i], fs.XmlFsType.VolumeSerial, testfiles[i]); } } @@ -124,16 +124,16 @@ namespace DiscImageChef.Tests.Filesystems { for(int i = 0; i < testfiles.Length; i++) { - string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "s5fs_mbr", testfiles[i]); - IFilter filter = new LZip(); + string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "s5fs_mbr", testfiles[i]); + IFilter filter = new LZip(); filter.Open(location); IMediaImage image = new Vdi(); - Assert.AreEqual(true, image.Open(filter), testfiles[i]); - Assert.AreEqual(sectors[i], image.Info.Sectors, testfiles[i]); + Assert.AreEqual(true, image.Open(filter), testfiles[i]); + Assert.AreEqual(sectors[i], image.Info.Sectors, testfiles[i]); Assert.AreEqual(sectorsize[i], image.Info.SectorSize, testfiles[i]); List partitions = Core.Partitions.GetAll(image); - IFilesystem fs = new SysVfs(); - int part = -1; + IFilesystem fs = new SysVfs(); + int part = -1; for(int j = 0; j < partitions.Count; j++) if(partitions[j].Type == "UNIX: /usr" || partitions[j].Type == "XENIX") { @@ -144,10 +144,10 @@ namespace DiscImageChef.Tests.Filesystems Assert.AreNotEqual(-1, part, $"Partition not found on {testfiles[i]}"); Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]); fs.GetInformation(image, partitions[part], out _, null); - Assert.AreEqual(clusters[i], fs.XmlFsType.Clusters, testfiles[i]); - Assert.AreEqual(clustersize[i], fs.XmlFsType.ClusterSize, testfiles[i]); - Assert.AreEqual(type[i], fs.XmlFsType.Type, testfiles[i]); - Assert.AreEqual(volumename[i], fs.XmlFsType.VolumeName, testfiles[i]); + Assert.AreEqual(clusters[i], fs.XmlFsType.Clusters, testfiles[i]); + Assert.AreEqual(clustersize[i], fs.XmlFsType.ClusterSize, testfiles[i]); + Assert.AreEqual(type[i], fs.XmlFsType.Type, testfiles[i]); + Assert.AreEqual(volumename[i], fs.XmlFsType.VolumeName, testfiles[i]); Assert.AreEqual(volumeserial[i], fs.XmlFsType.VolumeSerial, testfiles[i]); } } @@ -177,16 +177,16 @@ namespace DiscImageChef.Tests.Filesystems { for(int i = 0; i < testfiles.Length; i++) { - string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "s5fs_rdb", testfiles[i]); - IFilter filter = new LZip(); + string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "s5fs_rdb", testfiles[i]); + IFilter filter = new LZip(); filter.Open(location); IMediaImage image = new Vdi(); - Assert.AreEqual(true, image.Open(filter), testfiles[i]); - Assert.AreEqual(sectors[i], image.Info.Sectors, testfiles[i]); + Assert.AreEqual(true, image.Open(filter), testfiles[i]); + Assert.AreEqual(sectors[i], image.Info.Sectors, testfiles[i]); Assert.AreEqual(sectorsize[i], image.Info.SectorSize, testfiles[i]); List partitions = Core.Partitions.GetAll(image); - IFilesystem fs = new SysVfs(); - int part = -1; + IFilesystem fs = new SysVfs(); + int part = -1; for(int j = 0; j < partitions.Count; j++) if(partitions[j].Type == "\"UNI\\1\"") { @@ -197,10 +197,10 @@ namespace DiscImageChef.Tests.Filesystems Assert.AreNotEqual(-1, part, $"Partition not found on {testfiles[i]}"); Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]); fs.GetInformation(image, partitions[part], out _, null); - Assert.AreEqual(clusters[i], fs.XmlFsType.Clusters, testfiles[i]); - Assert.AreEqual(clustersize[i], fs.XmlFsType.ClusterSize, testfiles[i]); - Assert.AreEqual(type[i], fs.XmlFsType.Type, testfiles[i]); - Assert.AreEqual(volumename[i], fs.XmlFsType.VolumeName, testfiles[i]); + Assert.AreEqual(clusters[i], fs.XmlFsType.Clusters, testfiles[i]); + Assert.AreEqual(clustersize[i], fs.XmlFsType.ClusterSize, testfiles[i]); + Assert.AreEqual(type[i], fs.XmlFsType.Type, testfiles[i]); + Assert.AreEqual(volumename[i], fs.XmlFsType.VolumeName, testfiles[i]); Assert.AreEqual(volumeserial[i], fs.XmlFsType.VolumeSerial, testfiles[i]); } } diff --git a/DiscImageChef.Tests/Filesystems/UDF.cs b/DiscImageChef.Tests/Filesystems/UDF.cs index 6bafe3fe0..a1b70535e 100644 --- a/DiscImageChef.Tests/Filesystems/UDF.cs +++ b/DiscImageChef.Tests/Filesystems/UDF.cs @@ -105,8 +105,8 @@ namespace DiscImageChef.Tests.Filesystems Assert.AreEqual(true, image.Open(filter), testfiles[i]); Assert.AreEqual(sectors[i], image.Info.Sectors, testfiles[i]); Assert.AreEqual(sectorsize[i], image.Info.SectorSize, testfiles[i]); - IFilesystem fs = new UDF(); - Partition wholePart = new Partition + IFilesystem fs = new UDF(); + Partition wholePart = new Partition { Name = "Whole device", Length = image.Info.Sectors, @@ -161,8 +161,8 @@ namespace DiscImageChef.Tests.Filesystems Assert.AreEqual(true, image.Open(filter), testfiles[i]); Assert.AreEqual(sectors[i], image.Info.Sectors, testfiles[i]); Assert.AreEqual(sectorsize[i], image.Info.SectorSize, testfiles[i]); - IFilesystem fs = new UDF(); - Partition wholePart = new Partition + IFilesystem fs = new UDF(); + Partition wholePart = new Partition { Name = "Whole device", Length = image.Info.Sectors, diff --git a/DiscImageChef.Tests/Filesystems/UFS.cs b/DiscImageChef.Tests/Filesystems/UFS.cs index 33820a664..6661995be 100644 --- a/DiscImageChef.Tests/Filesystems/UFS.cs +++ b/DiscImageChef.Tests/Filesystems/UFS.cs @@ -71,27 +71,27 @@ namespace DiscImageChef.Tests.Filesystems { for(int i = 0; i < testfiles.Length; i++) { - string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "ufs", testfiles[i]); - IFilter filter = new LZip(); + string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "ufs", testfiles[i]); + IFilter filter = new LZip(); filter.Open(location); IMediaImage image = new ZZZRawImage(); - Assert.AreEqual(true, image.Open(filter), testfiles[i]); - Assert.AreEqual(mediatypes[i], image.Info.MediaType, testfiles[i]); - Assert.AreEqual(sectors[i], image.Info.Sectors, testfiles[i]); + Assert.AreEqual(true, image.Open(filter), testfiles[i]); + Assert.AreEqual(mediatypes[i], image.Info.MediaType, testfiles[i]); + Assert.AreEqual(sectors[i], image.Info.Sectors, testfiles[i]); Assert.AreEqual(sectorsize[i], image.Info.SectorSize, testfiles[i]); IFilesystem fs = new FFSPlugin(); Partition wholePart = new Partition { - Name = "Whole device", + Name = "Whole device", Length = image.Info.Sectors, - Size = image.Info.Sectors * image.Info.SectorSize + Size = image.Info.Sectors * image.Info.SectorSize }; Assert.AreEqual(true, fs.Identify(image, wholePart), testfiles[i]); fs.GetInformation(image, wholePart, out _, null); - Assert.AreEqual(clusters[i], fs.XmlFsType.Clusters, testfiles[i]); - Assert.AreEqual(clustersize[i], fs.XmlFsType.ClusterSize, testfiles[i]); - Assert.AreEqual(type[i], fs.XmlFsType.Type, testfiles[i]); - Assert.AreEqual(volumename[i], fs.XmlFsType.VolumeName, testfiles[i]); + Assert.AreEqual(clusters[i], fs.XmlFsType.Clusters, testfiles[i]); + Assert.AreEqual(clustersize[i], fs.XmlFsType.ClusterSize, testfiles[i]); + Assert.AreEqual(type[i], fs.XmlFsType.Type, testfiles[i]); + Assert.AreEqual(volumename[i], fs.XmlFsType.VolumeName, testfiles[i]); Assert.AreEqual(volumeserial[i], fs.XmlFsType.VolumeSerial, testfiles[i]); } } @@ -129,16 +129,16 @@ namespace DiscImageChef.Tests.Filesystems { for(int i = 0; i < testfiles.Length; i++) { - string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "ufs_apm", testfiles[i]); - IFilter filter = new LZip(); + string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "ufs_apm", testfiles[i]); + IFilter filter = new LZip(); filter.Open(location); IMediaImage image = new Vdi(); - Assert.AreEqual(true, image.Open(filter), testfiles[i]); - Assert.AreEqual(sectors[i], image.Info.Sectors, testfiles[i]); + Assert.AreEqual(true, image.Open(filter), testfiles[i]); + Assert.AreEqual(sectors[i], image.Info.Sectors, testfiles[i]); Assert.AreEqual(sectorsize[i], image.Info.SectorSize, testfiles[i]); List partitions = Core.Partitions.GetAll(image); - IFilesystem fs = new FFSPlugin(); - int part = -1; + IFilesystem fs = new FFSPlugin(); + int part = -1; for(int j = 0; j < partitions.Count; j++) if(partitions[j].Type == "Apple_UFS") { @@ -149,10 +149,10 @@ namespace DiscImageChef.Tests.Filesystems Assert.AreNotEqual(-1, part, $"Partition not found on {testfiles[i]}"); Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]); fs.GetInformation(image, partitions[part], out _, null); - Assert.AreEqual(clusters[i], fs.XmlFsType.Clusters, testfiles[i]); - Assert.AreEqual(clustersize[i], fs.XmlFsType.ClusterSize, testfiles[i]); - Assert.AreEqual(type[i], fs.XmlFsType.Type, testfiles[i]); - Assert.AreEqual(volumename[i], fs.XmlFsType.VolumeName, testfiles[i]); + Assert.AreEqual(clusters[i], fs.XmlFsType.Clusters, testfiles[i]); + Assert.AreEqual(clustersize[i], fs.XmlFsType.ClusterSize, testfiles[i]); + Assert.AreEqual(type[i], fs.XmlFsType.Type, testfiles[i]); + Assert.AreEqual(volumename[i], fs.XmlFsType.VolumeName, testfiles[i]); Assert.AreEqual(volumeserial[i], fs.XmlFsType.VolumeSerial, testfiles[i]); } } @@ -223,19 +223,21 @@ namespace DiscImageChef.Tests.Filesystems { for(int i = 0; i < testfiles.Length; i++) { - string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "ufs_mbr", testfiles[i]); - IFilter filter = new LZip(); + string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "ufs_mbr", testfiles[i]); + IFilter filter = new LZip(); filter.Open(location); IMediaImage image = new Vdi(); - Assert.AreEqual(true, image.Open(filter), testfiles[i]); - Assert.AreEqual(sectors[i], image.Info.Sectors, testfiles[i]); + Assert.AreEqual(true, image.Open(filter), testfiles[i]); + Assert.AreEqual(sectors[i], image.Info.Sectors, testfiles[i]); Assert.AreEqual(sectorsize[i], image.Info.SectorSize, testfiles[i]); List partitions = Core.Partitions.GetAll(image); - IFilesystem fs = new FFSPlugin(); - int part = -1; + IFilesystem fs = new FFSPlugin(); + 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" || + 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; @@ -245,10 +247,10 @@ namespace DiscImageChef.Tests.Filesystems Assert.AreNotEqual(-1, part, $"Partition not found on {testfiles[i]}"); Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]); fs.GetInformation(image, partitions[part], out _, null); - Assert.AreEqual(clusters[i], fs.XmlFsType.Clusters, testfiles[i]); - Assert.AreEqual(clustersize[i], fs.XmlFsType.ClusterSize, testfiles[i]); - Assert.AreEqual(type[i], fs.XmlFsType.Type, testfiles[i]); - Assert.AreEqual(volumename[i], fs.XmlFsType.VolumeName, testfiles[i]); + Assert.AreEqual(clusters[i], fs.XmlFsType.Clusters, testfiles[i]); + Assert.AreEqual(clustersize[i], fs.XmlFsType.ClusterSize, testfiles[i]); + Assert.AreEqual(type[i], fs.XmlFsType.Type, testfiles[i]); + Assert.AreEqual(volumename[i], fs.XmlFsType.VolumeName, testfiles[i]); Assert.AreEqual(volumeserial[i], fs.XmlFsType.VolumeSerial, testfiles[i]); } } @@ -282,16 +284,16 @@ namespace DiscImageChef.Tests.Filesystems { for(int i = 0; i < testfiles.Length; i++) { - string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "ufs_next", testfiles[i]); - IFilter filter = new LZip(); + string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "ufs_next", testfiles[i]); + IFilter filter = new LZip(); filter.Open(location); IMediaImage image = new Vdi(); - Assert.AreEqual(true, image.Open(filter), testfiles[i]); - Assert.AreEqual(sectors[i], image.Info.Sectors, testfiles[i]); + Assert.AreEqual(true, image.Open(filter), testfiles[i]); + Assert.AreEqual(sectors[i], image.Info.Sectors, testfiles[i]); Assert.AreEqual(sectorsize[i], image.Info.SectorSize, testfiles[i]); List partitions = Core.Partitions.GetAll(image); - IFilesystem fs = new FFSPlugin(); - int part = -1; + IFilesystem fs = new FFSPlugin(); + int part = -1; for(int j = 0; j < partitions.Count; j++) if(partitions[j].Type == "4.3BSD" || partitions[j].Type == "4.4BSD") { @@ -302,10 +304,10 @@ namespace DiscImageChef.Tests.Filesystems Assert.AreNotEqual(-1, part, $"Partition not found on {testfiles[i]}"); Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]); fs.GetInformation(image, partitions[part], out _, null); - Assert.AreEqual(clusters[i], fs.XmlFsType.Clusters, testfiles[i]); - Assert.AreEqual(clustersize[i], fs.XmlFsType.ClusterSize, testfiles[i]); - Assert.AreEqual(type[i], fs.XmlFsType.Type, testfiles[i]); - Assert.AreEqual(volumename[i], fs.XmlFsType.VolumeName, testfiles[i]); + Assert.AreEqual(clusters[i], fs.XmlFsType.Clusters, testfiles[i]); + Assert.AreEqual(clustersize[i], fs.XmlFsType.ClusterSize, testfiles[i]); + Assert.AreEqual(type[i], fs.XmlFsType.Type, testfiles[i]); + Assert.AreEqual(volumename[i], fs.XmlFsType.VolumeName, testfiles[i]); Assert.AreEqual(volumeserial[i], fs.XmlFsType.VolumeSerial, testfiles[i]); } } @@ -341,16 +343,16 @@ namespace DiscImageChef.Tests.Filesystems { for(int i = 0; i < testfiles.Length; i++) { - string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "ufs_next", testfiles[i]); - IFilter filter = new LZip(); + string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "ufs_next", testfiles[i]); + IFilter filter = new LZip(); filter.Open(location); IMediaImage image = new ZZZRawImage(); - Assert.AreEqual(true, image.Open(filter), testfiles[i]); - Assert.AreEqual(sectors[i], image.Info.Sectors, testfiles[i]); + Assert.AreEqual(true, image.Open(filter), testfiles[i]); + Assert.AreEqual(sectors[i], image.Info.Sectors, testfiles[i]); Assert.AreEqual(sectorsize[i], image.Info.SectorSize, testfiles[i]); List partitions = Core.Partitions.GetAll(image); - IFilesystem fs = new FFSPlugin(); - int part = -1; + IFilesystem fs = new FFSPlugin(); + int part = -1; for(int j = 0; j < partitions.Count; j++) if(partitions[j].Type == "4.3BSD" || partitions[j].Type == "4.4BSD") { @@ -361,10 +363,10 @@ namespace DiscImageChef.Tests.Filesystems Assert.AreNotEqual(-1, part, $"Partition not found on {testfiles[i]}"); Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]); fs.GetInformation(image, partitions[part], out _, null); - Assert.AreEqual(clusters[i], fs.XmlFsType.Clusters, testfiles[i]); - Assert.AreEqual(clustersize[i], fs.XmlFsType.ClusterSize, testfiles[i]); - Assert.AreEqual(type[i], fs.XmlFsType.Type, testfiles[i]); - Assert.AreEqual(volumename[i], fs.XmlFsType.VolumeName, testfiles[i]); + Assert.AreEqual(clusters[i], fs.XmlFsType.Clusters, testfiles[i]); + Assert.AreEqual(clustersize[i], fs.XmlFsType.ClusterSize, testfiles[i]); + Assert.AreEqual(type[i], fs.XmlFsType.Type, testfiles[i]); + Assert.AreEqual(volumename[i], fs.XmlFsType.VolumeName, testfiles[i]); Assert.AreEqual(volumeserial[i], fs.XmlFsType.VolumeSerial, testfiles[i]); } } @@ -394,16 +396,16 @@ namespace DiscImageChef.Tests.Filesystems { for(int i = 0; i < testfiles.Length; i++) { - string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "ufs_rdb", testfiles[i]); - IFilter filter = new LZip(); + string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "ufs_rdb", testfiles[i]); + IFilter filter = new LZip(); filter.Open(location); IMediaImage image = new Vdi(); - Assert.AreEqual(true, image.Open(filter), testfiles[i]); - Assert.AreEqual(sectors[i], image.Info.Sectors, testfiles[i]); + Assert.AreEqual(true, image.Open(filter), testfiles[i]); + Assert.AreEqual(sectors[i], image.Info.Sectors, testfiles[i]); Assert.AreEqual(sectorsize[i], image.Info.SectorSize, testfiles[i]); List partitions = Core.Partitions.GetAll(image); - IFilesystem fs = new FFSPlugin(); - int part = -1; + IFilesystem fs = new FFSPlugin(); + int part = -1; for(int j = 0; j < partitions.Count; j++) if(partitions[j].Type == "\"UNI\\2\"") { @@ -414,10 +416,10 @@ namespace DiscImageChef.Tests.Filesystems Assert.AreNotEqual(-1, part, $"Partition not found on {testfiles[i]}"); Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]); fs.GetInformation(image, partitions[part], out _, null); - Assert.AreEqual(clusters[i], fs.XmlFsType.Clusters, testfiles[i]); - Assert.AreEqual(clustersize[i], fs.XmlFsType.ClusterSize, testfiles[i]); - Assert.AreEqual(type[i], fs.XmlFsType.Type, testfiles[i]); - Assert.AreEqual(volumename[i], fs.XmlFsType.VolumeName, testfiles[i]); + Assert.AreEqual(clusters[i], fs.XmlFsType.Clusters, testfiles[i]); + Assert.AreEqual(clustersize[i], fs.XmlFsType.ClusterSize, testfiles[i]); + Assert.AreEqual(type[i], fs.XmlFsType.Type, testfiles[i]); + Assert.AreEqual(volumename[i], fs.XmlFsType.VolumeName, testfiles[i]); Assert.AreEqual(volumeserial[i], fs.XmlFsType.VolumeSerial, testfiles[i]); } } @@ -447,16 +449,16 @@ namespace DiscImageChef.Tests.Filesystems { for(int i = 0; i < testfiles.Length; i++) { - string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "ufs_suni86", testfiles[i]); - IFilter filter = new LZip(); + string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "ufs_suni86", testfiles[i]); + IFilter filter = new LZip(); filter.Open(location); IMediaImage image = new Vdi(); - Assert.AreEqual(true, image.Open(filter), testfiles[i]); - Assert.AreEqual(sectors[i], image.Info.Sectors, testfiles[i]); + Assert.AreEqual(true, image.Open(filter), testfiles[i]); + Assert.AreEqual(sectors[i], image.Info.Sectors, testfiles[i]); Assert.AreEqual(sectorsize[i], image.Info.SectorSize, testfiles[i]); List partitions = Core.Partitions.GetAll(image); - IFilesystem fs = new FFSPlugin(); - int part = -1; + IFilesystem fs = new FFSPlugin(); + int part = -1; for(int j = 0; j < partitions.Count; j++) if(partitions[j].Type == "Replacement sectors") { @@ -467,10 +469,10 @@ namespace DiscImageChef.Tests.Filesystems Assert.AreNotEqual(-1, part, $"Partition not found on {testfiles[i]}"); Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]); fs.GetInformation(image, partitions[part], out _, null); - Assert.AreEqual(clusters[i], fs.XmlFsType.Clusters, testfiles[i]); - Assert.AreEqual(clustersize[i], fs.XmlFsType.ClusterSize, testfiles[i]); - Assert.AreEqual(type[i], fs.XmlFsType.Type, testfiles[i]); - Assert.AreEqual(volumename[i], fs.XmlFsType.VolumeName, testfiles[i]); + Assert.AreEqual(clusters[i], fs.XmlFsType.Clusters, testfiles[i]); + Assert.AreEqual(clustersize[i], fs.XmlFsType.ClusterSize, testfiles[i]); + Assert.AreEqual(type[i], fs.XmlFsType.Type, testfiles[i]); + Assert.AreEqual(volumename[i], fs.XmlFsType.VolumeName, testfiles[i]); Assert.AreEqual(volumeserial[i], fs.XmlFsType.VolumeSerial, testfiles[i]); } } diff --git a/DiscImageChef.Tests/Filesystems/UNIXBFS.cs b/DiscImageChef.Tests/Filesystems/UNIXBFS.cs index 852580b06..9ff37103b 100644 --- a/DiscImageChef.Tests/Filesystems/UNIXBFS.cs +++ b/DiscImageChef.Tests/Filesystems/UNIXBFS.cs @@ -66,27 +66,27 @@ namespace DiscImageChef.Tests.Filesystems { for(int i = 0; i < testfiles.Length; i++) { - string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "unixbfs", testfiles[i]); - IFilter filter = new LZip(); + string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "unixbfs", testfiles[i]); + IFilter filter = new LZip(); filter.Open(location); IMediaImage image = new ZZZRawImage(); - Assert.AreEqual(true, image.Open(filter), testfiles[i]); - Assert.AreEqual(mediatypes[i], image.Info.MediaType, testfiles[i]); - Assert.AreEqual(sectors[i], image.Info.Sectors, testfiles[i]); + Assert.AreEqual(true, image.Open(filter), testfiles[i]); + Assert.AreEqual(mediatypes[i], image.Info.MediaType, testfiles[i]); + Assert.AreEqual(sectors[i], image.Info.Sectors, testfiles[i]); Assert.AreEqual(sectorsize[i], image.Info.SectorSize, testfiles[i]); IFilesystem fs = new BFS(); Partition wholePart = new Partition { - Name = "Whole device", + Name = "Whole device", Length = image.Info.Sectors, - Size = image.Info.Sectors * image.Info.SectorSize + Size = image.Info.Sectors * image.Info.SectorSize }; Assert.AreEqual(true, fs.Identify(image, wholePart), testfiles[i]); fs.GetInformation(image, wholePart, out _, null); - Assert.AreEqual(clusters[i], fs.XmlFsType.Clusters, testfiles[i]); + Assert.AreEqual(clusters[i], fs.XmlFsType.Clusters, testfiles[i]); Assert.AreEqual(clustersize[i], fs.XmlFsType.ClusterSize, testfiles[i]); - Assert.AreEqual("BFS", fs.XmlFsType.Type, testfiles[i]); - Assert.AreEqual(volumename[i], fs.XmlFsType.VolumeName, testfiles[i]); + Assert.AreEqual("BFS", fs.XmlFsType.Type, testfiles[i]); + Assert.AreEqual(volumename[i], fs.XmlFsType.VolumeName, testfiles[i]); } } } @@ -111,16 +111,16 @@ namespace DiscImageChef.Tests.Filesystems { for(int i = 0; i < testfiles.Length; i++) { - string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "unixbfs_mbr", testfiles[i]); - IFilter filter = new LZip(); + string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "unixbfs_mbr", testfiles[i]); + IFilter filter = new LZip(); filter.Open(location); IMediaImage image = new Vdi(); - Assert.AreEqual(true, image.Open(filter), testfiles[i]); - Assert.AreEqual(sectors[i], image.Info.Sectors, testfiles[i]); + Assert.AreEqual(true, image.Open(filter), testfiles[i]); + Assert.AreEqual(sectors[i], image.Info.Sectors, testfiles[i]); Assert.AreEqual(sectorsize[i], image.Info.SectorSize, testfiles[i]); List partitions = Core.Partitions.GetAll(image); - IFilesystem fs = new BFS(); - int part = -1; + IFilesystem fs = new BFS(); + int part = -1; for(int j = 0; j < partitions.Count; j++) if(partitions[j].Type == "0x83") { @@ -131,10 +131,10 @@ namespace DiscImageChef.Tests.Filesystems Assert.AreNotEqual(-1, part, $"Partition not found on {testfiles[i]}"); Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]); fs.GetInformation(image, partitions[part], out _, null); - Assert.AreEqual(clusters[i], fs.XmlFsType.Clusters, testfiles[i]); + Assert.AreEqual(clusters[i], fs.XmlFsType.Clusters, testfiles[i]); Assert.AreEqual(clustersize[i], fs.XmlFsType.ClusterSize, testfiles[i]); - Assert.AreEqual("BFS", fs.XmlFsType.Type, testfiles[i]); - Assert.AreEqual(volumename[i], fs.XmlFsType.VolumeName, testfiles[i]); + Assert.AreEqual("BFS", fs.XmlFsType.Type, testfiles[i]); + Assert.AreEqual(volumename[i], fs.XmlFsType.VolumeName, testfiles[i]); } } } @@ -163,16 +163,16 @@ namespace DiscImageChef.Tests.Filesystems { for(int i = 0; i < testfiles.Length; i++) { - string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "unixbfs_rdb", testfiles[i]); - IFilter filter = new LZip(); + string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "unixbfs_rdb", testfiles[i]); + IFilter filter = new LZip(); filter.Open(location); IMediaImage image = new Vdi(); - Assert.AreEqual(true, image.Open(filter), testfiles[i]); - Assert.AreEqual(sectors[i], image.Info.Sectors, testfiles[i]); + Assert.AreEqual(true, image.Open(filter), testfiles[i]); + Assert.AreEqual(sectors[i], image.Info.Sectors, testfiles[i]); Assert.AreEqual(sectorsize[i], image.Info.SectorSize, testfiles[i]); List partitions = Core.Partitions.GetAll(image); - IFilesystem fs = new BFS(); - int part = -1; + IFilesystem fs = new BFS(); + int part = -1; for(int j = 0; j < partitions.Count; j++) if(partitions[j].Type == "\"UNI\\0\"") { @@ -183,10 +183,10 @@ namespace DiscImageChef.Tests.Filesystems Assert.AreNotEqual(-1, part, $"Partition not found on {testfiles[i]}"); Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]); fs.GetInformation(image, partitions[part], out _, null); - Assert.AreEqual(clusters[i], fs.XmlFsType.Clusters, testfiles[i]); - Assert.AreEqual(clustersize[i], fs.XmlFsType.ClusterSize, testfiles[i]); - Assert.AreEqual(type[i], fs.XmlFsType.Type, testfiles[i]); - Assert.AreEqual(volumename[i], fs.XmlFsType.VolumeName, testfiles[i]); + Assert.AreEqual(clusters[i], fs.XmlFsType.Clusters, testfiles[i]); + Assert.AreEqual(clustersize[i], fs.XmlFsType.ClusterSize, testfiles[i]); + Assert.AreEqual(type[i], fs.XmlFsType.Type, testfiles[i]); + Assert.AreEqual(volumename[i], fs.XmlFsType.VolumeName, testfiles[i]); Assert.AreEqual(volumeserial[i], fs.XmlFsType.VolumeSerial, testfiles[i]); } } diff --git a/DiscImageChef.Tests/Filesystems/XENIX.cs b/DiscImageChef.Tests/Filesystems/XENIX.cs index c9d9e018a..eff068d00 100644 --- a/DiscImageChef.Tests/Filesystems/XENIX.cs +++ b/DiscImageChef.Tests/Filesystems/XENIX.cs @@ -68,27 +68,27 @@ namespace DiscImageChef.Tests.Filesystems { for(int i = 0; i < testfiles.Length; i++) { - string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "xenix", testfiles[i]); - IFilter filter = new LZip(); + string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "xenix", testfiles[i]); + IFilter filter = new LZip(); filter.Open(location); IMediaImage image = new ZZZRawImage(); - Assert.AreEqual(true, image.Open(filter), testfiles[i]); - Assert.AreEqual(mediatypes[i], image.Info.MediaType, testfiles[i]); - Assert.AreEqual(sectors[i], image.Info.Sectors, testfiles[i]); + Assert.AreEqual(true, image.Open(filter), testfiles[i]); + Assert.AreEqual(mediatypes[i], image.Info.MediaType, testfiles[i]); + Assert.AreEqual(sectors[i], image.Info.Sectors, testfiles[i]); Assert.AreEqual(sectorsize[i], image.Info.SectorSize, testfiles[i]); IFilesystem fs = new SysVfs(); Partition wholePart = new Partition { - Name = "Whole device", + Name = "Whole device", Length = image.Info.Sectors, - Size = image.Info.Sectors * image.Info.SectorSize + Size = image.Info.Sectors * image.Info.SectorSize }; Assert.AreEqual(true, fs.Identify(image, wholePart), testfiles[i]); fs.GetInformation(image, wholePart, out _, null); - Assert.AreEqual(clusters[i], fs.XmlFsType.Clusters, testfiles[i]); - Assert.AreEqual(clustersize[i], fs.XmlFsType.ClusterSize, testfiles[i]); - Assert.AreEqual(type[i], fs.XmlFsType.Type, testfiles[i]); - Assert.AreEqual(volumename[i], fs.XmlFsType.VolumeName, testfiles[i]); + Assert.AreEqual(clusters[i], fs.XmlFsType.Clusters, testfiles[i]); + Assert.AreEqual(clustersize[i], fs.XmlFsType.ClusterSize, testfiles[i]); + Assert.AreEqual(type[i], fs.XmlFsType.Type, testfiles[i]); + Assert.AreEqual(volumename[i], fs.XmlFsType.VolumeName, testfiles[i]); Assert.AreEqual(volumeserial[i], fs.XmlFsType.VolumeSerial, testfiles[i]); } } @@ -118,16 +118,16 @@ namespace DiscImageChef.Tests.Filesystems { for(int i = 0; i < testfiles.Length; i++) { - string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "xenix_mbr", testfiles[i]); - IFilter filter = new LZip(); + string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "xenix_mbr", testfiles[i]); + IFilter filter = new LZip(); filter.Open(location); IMediaImage image = new Vdi(); - Assert.AreEqual(true, image.Open(filter), testfiles[i]); - Assert.AreEqual(sectors[i], image.Info.Sectors, testfiles[i]); + Assert.AreEqual(true, image.Open(filter), testfiles[i]); + Assert.AreEqual(sectors[i], image.Info.Sectors, testfiles[i]); Assert.AreEqual(sectorsize[i], image.Info.SectorSize, testfiles[i]); List partitions = Core.Partitions.GetAll(image); - IFilesystem fs = new SysVfs(); - int part = -1; + IFilesystem fs = new SysVfs(); + int part = -1; for(int j = 0; j < partitions.Count; j++) if(partitions[j].Type == "XENIX") { @@ -138,10 +138,10 @@ namespace DiscImageChef.Tests.Filesystems Assert.AreNotEqual(-1, part, $"Partition not found on {testfiles[i]}"); Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]); fs.GetInformation(image, partitions[part], out _, null); - Assert.AreEqual(clusters[i], fs.XmlFsType.Clusters, testfiles[i]); - Assert.AreEqual(clustersize[i], fs.XmlFsType.ClusterSize, testfiles[i]); - Assert.AreEqual(type[i], fs.XmlFsType.Type, testfiles[i]); - Assert.AreEqual(volumename[i], fs.XmlFsType.VolumeName, testfiles[i]); + Assert.AreEqual(clusters[i], fs.XmlFsType.Clusters, testfiles[i]); + Assert.AreEqual(clustersize[i], fs.XmlFsType.ClusterSize, testfiles[i]); + Assert.AreEqual(type[i], fs.XmlFsType.Type, testfiles[i]); + Assert.AreEqual(volumename[i], fs.XmlFsType.VolumeName, testfiles[i]); Assert.AreEqual(volumeserial[i], fs.XmlFsType.VolumeSerial, testfiles[i]); } } diff --git a/DiscImageChef.Tests/Filesystems/XFS.cs b/DiscImageChef.Tests/Filesystems/XFS.cs index 9d75a20cd..e44c96af1 100644 --- a/DiscImageChef.Tests/Filesystems/XFS.cs +++ b/DiscImageChef.Tests/Filesystems/XFS.cs @@ -58,16 +58,16 @@ namespace DiscImageChef.Tests.Filesystems { for(int i = 0; i < testfiles.Length; i++) { - string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "xfs_mbr", testfiles[i]); - IFilter filter = new LZip(); + string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "xfs_mbr", testfiles[i]); + IFilter filter = new LZip(); filter.Open(location); IMediaImage image = new Vdi(); - Assert.AreEqual(true, image.Open(filter), testfiles[i]); - Assert.AreEqual(sectors[i], image.Info.Sectors, testfiles[i]); + Assert.AreEqual(true, image.Open(filter), testfiles[i]); + Assert.AreEqual(sectors[i], image.Info.Sectors, testfiles[i]); Assert.AreEqual(sectorsize[i], image.Info.SectorSize, testfiles[i]); List partitions = Core.Partitions.GetAll(image); - IFilesystem fs = new XFS(); - int part = -1; + IFilesystem fs = new XFS(); + int part = -1; for(int j = 0; j < partitions.Count; j++) if(partitions[j].Type == "0x83") { @@ -78,11 +78,11 @@ namespace DiscImageChef.Tests.Filesystems Assert.AreNotEqual(-1, part, $"Partition not found on {testfiles[i]}"); Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]); fs.GetInformation(image, partitions[part], out _, null); - Assert.AreEqual(clusters[i], fs.XmlFsType.Clusters, testfiles[i]); - Assert.AreEqual(clustersize[i], fs.XmlFsType.ClusterSize, testfiles[i]); - Assert.AreEqual("XFS filesystem", fs.XmlFsType.Type, testfiles[i]); - Assert.AreEqual(volumename[i], fs.XmlFsType.VolumeName, testfiles[i]); - Assert.AreEqual(volumeserial[i], fs.XmlFsType.VolumeSerial, testfiles[i]); + Assert.AreEqual(clusters[i], fs.XmlFsType.Clusters, testfiles[i]); + Assert.AreEqual(clustersize[i], fs.XmlFsType.ClusterSize, testfiles[i]); + Assert.AreEqual("XFS filesystem", fs.XmlFsType.Type, testfiles[i]); + Assert.AreEqual(volumename[i], fs.XmlFsType.VolumeName, testfiles[i]); + Assert.AreEqual(volumeserial[i], fs.XmlFsType.VolumeSerial, testfiles[i]); } } } diff --git a/DiscImageChef.Tests/Filesystems/Xia.cs b/DiscImageChef.Tests/Filesystems/Xia.cs index 261812c83..a4c04380d 100644 --- a/DiscImageChef.Tests/Filesystems/Xia.cs +++ b/DiscImageChef.Tests/Filesystems/Xia.cs @@ -58,16 +58,16 @@ namespace DiscImageChef.Tests.Filesystems { for(int i = 0; i < testfiles.Length; i++) { - string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "xia_mbr", testfiles[i]); - IFilter filter = new LZip(); + string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "xia_mbr", testfiles[i]); + IFilter filter = new LZip(); filter.Open(location); IMediaImage image = new Vdi(); - Assert.AreEqual(true, image.Open(filter), testfiles[i]); - Assert.AreEqual(sectors[i], image.Info.Sectors, testfiles[i]); + Assert.AreEqual(true, image.Open(filter), testfiles[i]); + Assert.AreEqual(sectors[i], image.Info.Sectors, testfiles[i]); Assert.AreEqual(sectorsize[i], image.Info.SectorSize, testfiles[i]); List partitions = Core.Partitions.GetAll(image); - IFilesystem fs = new Xia(); - int part = -1; + IFilesystem fs = new Xia(); + int part = -1; for(int j = 0; j < partitions.Count; j++) if(partitions[j].Type == "0x83") { @@ -78,11 +78,11 @@ namespace DiscImageChef.Tests.Filesystems Assert.AreNotEqual(-1, part, $"Partition not found on {testfiles[i]}"); Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]); fs.GetInformation(image, partitions[part], out _, null); - Assert.AreEqual(clusters[i], fs.XmlFsType.Clusters, testfiles[i]); - Assert.AreEqual(clustersize[i], fs.XmlFsType.ClusterSize, testfiles[i]); - Assert.AreEqual("Xia filesystem", fs.XmlFsType.Type, testfiles[i]); - Assert.AreEqual(volumename[i], fs.XmlFsType.VolumeName, testfiles[i]); - Assert.AreEqual(volumeserial[i], fs.XmlFsType.VolumeSerial, testfiles[i]); + Assert.AreEqual(clusters[i], fs.XmlFsType.Clusters, testfiles[i]); + Assert.AreEqual(clustersize[i], fs.XmlFsType.ClusterSize, testfiles[i]); + Assert.AreEqual("Xia filesystem", fs.XmlFsType.Type, testfiles[i]); + Assert.AreEqual(volumename[i], fs.XmlFsType.VolumeName, testfiles[i]); + Assert.AreEqual(volumeserial[i], fs.XmlFsType.VolumeSerial, testfiles[i]); } } } diff --git a/DiscImageChef.Tests/Filesystems/ZFS.cs b/DiscImageChef.Tests/Filesystems/ZFS.cs index 4a9e227c8..2474895b1 100644 --- a/DiscImageChef.Tests/Filesystems/ZFS.cs +++ b/DiscImageChef.Tests/Filesystems/ZFS.cs @@ -57,27 +57,27 @@ namespace DiscImageChef.Tests.Filesystems { for(int i = 0; i < testfiles.Length; i++) { - string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "zfs", testfiles[i]); - IFilter filter = new LZip(); + string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "zfs", testfiles[i]); + IFilter filter = new LZip(); filter.Open(location); IMediaImage image = new Vdi(); - Assert.AreEqual(true, image.Open(filter), testfiles[i]); - Assert.AreEqual(sectors[i], image.Info.Sectors, testfiles[i]); + Assert.AreEqual(true, image.Open(filter), testfiles[i]); + Assert.AreEqual(sectors[i], image.Info.Sectors, testfiles[i]); Assert.AreEqual(sectorsize[i], image.Info.SectorSize, testfiles[i]); IFilesystem fs = new ZFS(); Partition wholePart = new Partition { - Name = "Whole device", + Name = "Whole device", Length = image.Info.Sectors, - Size = image.Info.Sectors * image.Info.SectorSize + Size = image.Info.Sectors * image.Info.SectorSize }; Assert.AreEqual(true, fs.Identify(image, wholePart), testfiles[i]); fs.GetInformation(image, wholePart, out _, null); - Assert.AreEqual(clusters[i], fs.XmlFsType.Clusters, testfiles[i]); - Assert.AreEqual(clustersize[i], fs.XmlFsType.ClusterSize, testfiles[i]); - Assert.AreEqual("ZFS filesystem", fs.XmlFsType.Type, testfiles[i]); - Assert.AreEqual(volumename[i], fs.XmlFsType.VolumeName, testfiles[i]); - Assert.AreEqual(volumeserial[i], fs.XmlFsType.VolumeSerial, testfiles[i]); + Assert.AreEqual(clusters[i], fs.XmlFsType.Clusters, testfiles[i]); + Assert.AreEqual(clustersize[i], fs.XmlFsType.ClusterSize, testfiles[i]); + Assert.AreEqual("ZFS filesystem", fs.XmlFsType.Type, testfiles[i]); + Assert.AreEqual(volumename[i], fs.XmlFsType.VolumeName, testfiles[i]); + Assert.AreEqual(volumeserial[i], fs.XmlFsType.VolumeSerial, testfiles[i]); } } } diff --git a/DiscImageChef.Tests/Filesystems/btrfs.cs b/DiscImageChef.Tests/Filesystems/btrfs.cs index 636bdd6d1..e3ee3cff0 100644 --- a/DiscImageChef.Tests/Filesystems/btrfs.cs +++ b/DiscImageChef.Tests/Filesystems/btrfs.cs @@ -59,17 +59,17 @@ namespace DiscImageChef.Tests.Filesystems { for(int i = 0; i < testfiles.Length; i++) { - string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "btrfs", testfiles[i]); - IFilter filter = new LZip(); + string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "btrfs", testfiles[i]); + IFilter filter = new LZip(); filter.Open(location); IMediaImage image = new Vdi(); - Assert.AreEqual(true, image.Open(filter), testfiles[i]); - Assert.AreEqual(sectors[i], image.Info.Sectors, testfiles[i]); + Assert.AreEqual(true, image.Open(filter), testfiles[i]); + Assert.AreEqual(sectors[i], image.Info.Sectors, testfiles[i]); Assert.AreEqual(sectorsize[i], image.Info.SectorSize, testfiles[i]); IPartition parts = new MBR(); Assert.AreEqual(true, parts.GetInformation(image, out List partitions, 0), testfiles[i]); - IFilesystem fs = new BTRFS(); - int part = -1; + IFilesystem fs = new BTRFS(); + int part = -1; for(int j = 0; j < partitions.Count; j++) if(partitions[j].Type == "0x83") { @@ -80,11 +80,11 @@ namespace DiscImageChef.Tests.Filesystems Assert.AreNotEqual(-1, part, $"Partition not found on {testfiles[i]}"); Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]); fs.GetInformation(image, partitions[part], out _, null); - Assert.AreEqual(clusters[i], fs.XmlFsType.Clusters, testfiles[i]); - Assert.AreEqual(clustersize[i], fs.XmlFsType.ClusterSize, testfiles[i]); - Assert.AreEqual("B-tree file system", fs.XmlFsType.Type, testfiles[i]); - Assert.AreEqual(volumename[i], fs.XmlFsType.VolumeName, testfiles[i]); - Assert.AreEqual(volumeserial[i], fs.XmlFsType.VolumeSerial, testfiles[i]); + Assert.AreEqual(clusters[i], fs.XmlFsType.Clusters, testfiles[i]); + Assert.AreEqual(clustersize[i], fs.XmlFsType.ClusterSize, testfiles[i]); + Assert.AreEqual("B-tree file system", fs.XmlFsType.Type, testfiles[i]); + Assert.AreEqual(volumename[i], fs.XmlFsType.VolumeName, testfiles[i]); + Assert.AreEqual(volumeserial[i], fs.XmlFsType.VolumeSerial, testfiles[i]); } } } diff --git a/DiscImageChef.Tests/Filesystems/exFAT.cs b/DiscImageChef.Tests/Filesystems/exFAT.cs index badfc50d0..073a22b1a 100644 --- a/DiscImageChef.Tests/Filesystems/exFAT.cs +++ b/DiscImageChef.Tests/Filesystems/exFAT.cs @@ -58,16 +58,16 @@ namespace DiscImageChef.Tests.Filesystems { for(int i = 0; i < testfiles.Length; i++) { - string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "exfat_apm", testfiles[i]); - IFilter filter = new LZip(); + string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "exfat_apm", testfiles[i]); + IFilter filter = new LZip(); filter.Open(location); IMediaImage image = new Vdi(); - Assert.AreEqual(true, image.Open(filter), testfiles[i]); - Assert.AreEqual(sectors[i], image.Info.Sectors, testfiles[i]); + Assert.AreEqual(true, image.Open(filter), testfiles[i]); + Assert.AreEqual(sectors[i], image.Info.Sectors, testfiles[i]); Assert.AreEqual(sectorsize[i], image.Info.SectorSize, testfiles[i]); List partitions = Core.Partitions.GetAll(image); - IFilesystem fs = new exFAT(); - int part = -1; + IFilesystem fs = new exFAT(); + int part = -1; for(int j = 0; j < partitions.Count; j++) if(partitions[j].Type == "Windows_NTFS") { @@ -78,10 +78,10 @@ namespace DiscImageChef.Tests.Filesystems Assert.AreNotEqual(-1, part, $"Partition not found on {testfiles[i]}"); Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]); fs.GetInformation(image, partitions[part], out _, null); - Assert.AreEqual(clusters[i], fs.XmlFsType.Clusters, testfiles[i]); - Assert.AreEqual(clustersize[i], fs.XmlFsType.ClusterSize, testfiles[i]); - Assert.AreEqual("exFAT", fs.XmlFsType.Type, testfiles[i]); - Assert.AreEqual(volumename[i], fs.XmlFsType.VolumeName, testfiles[i]); + Assert.AreEqual(clusters[i], fs.XmlFsType.Clusters, testfiles[i]); + Assert.AreEqual(clustersize[i], fs.XmlFsType.ClusterSize, testfiles[i]); + Assert.AreEqual("exFAT", fs.XmlFsType.Type, testfiles[i]); + Assert.AreEqual(volumename[i], fs.XmlFsType.VolumeName, testfiles[i]); Assert.AreEqual(volumeserial[i], fs.XmlFsType.VolumeSerial, testfiles[i]); } } @@ -109,16 +109,16 @@ namespace DiscImageChef.Tests.Filesystems { for(int i = 0; i < testfiles.Length; i++) { - string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "exfat_gpt", testfiles[i]); - IFilter filter = new LZip(); + string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "exfat_gpt", testfiles[i]); + IFilter filter = new LZip(); filter.Open(location); IMediaImage image = new Vdi(); - Assert.AreEqual(true, image.Open(filter), testfiles[i]); - Assert.AreEqual(sectors[i], image.Info.Sectors, testfiles[i]); + Assert.AreEqual(true, image.Open(filter), testfiles[i]); + Assert.AreEqual(sectors[i], image.Info.Sectors, testfiles[i]); Assert.AreEqual(sectorsize[i], image.Info.SectorSize, testfiles[i]); List partitions = Core.Partitions.GetAll(image); - IFilesystem fs = new exFAT(); - int part = -1; + IFilesystem fs = new exFAT(); + int part = -1; for(int j = 0; j < partitions.Count; j++) if(partitions[j].Type == "Microsoft Basic data") { @@ -129,10 +129,10 @@ namespace DiscImageChef.Tests.Filesystems Assert.AreNotEqual(-1, part, $"Partition not found on {testfiles[i]}"); Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]); fs.GetInformation(image, partitions[part], out _, null); - Assert.AreEqual(clusters[i], fs.XmlFsType.Clusters, testfiles[i]); - Assert.AreEqual(clustersize[i], fs.XmlFsType.ClusterSize, testfiles[i]); - Assert.AreEqual("exFAT", fs.XmlFsType.Type, testfiles[i]); - Assert.AreEqual(volumename[i], fs.XmlFsType.VolumeName, testfiles[i]); + Assert.AreEqual(clusters[i], fs.XmlFsType.Clusters, testfiles[i]); + Assert.AreEqual(clustersize[i], fs.XmlFsType.ClusterSize, testfiles[i]); + Assert.AreEqual("exFAT", fs.XmlFsType.Type, testfiles[i]); + Assert.AreEqual(volumename[i], fs.XmlFsType.VolumeName, testfiles[i]); Assert.AreEqual(volumeserial[i], fs.XmlFsType.VolumeSerial, testfiles[i]); } } @@ -160,16 +160,16 @@ namespace DiscImageChef.Tests.Filesystems { for(int i = 0; i < testfiles.Length; i++) { - string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "exfat_mbr", testfiles[i]); - IFilter filter = new LZip(); + string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "exfat_mbr", testfiles[i]); + IFilter filter = new LZip(); filter.Open(location); IMediaImage image = new Vdi(); - Assert.AreEqual(true, image.Open(filter), testfiles[i]); - Assert.AreEqual(sectors[i], image.Info.Sectors, testfiles[i]); + Assert.AreEqual(true, image.Open(filter), testfiles[i]); + Assert.AreEqual(sectors[i], image.Info.Sectors, testfiles[i]); Assert.AreEqual(sectorsize[i], image.Info.SectorSize, testfiles[i]); List partitions = Core.Partitions.GetAll(image); - IFilesystem fs = new exFAT(); - int part = -1; + IFilesystem fs = new exFAT(); + int part = -1; for(int j = 0; j < partitions.Count; j++) if(partitions[j].Type == "0x07") { @@ -180,10 +180,10 @@ namespace DiscImageChef.Tests.Filesystems Assert.AreNotEqual(-1, part, $"Partition not found on {testfiles[i]}"); Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]); fs.GetInformation(image, partitions[part], out _, null); - Assert.AreEqual(clusters[i], fs.XmlFsType.Clusters, testfiles[i]); - Assert.AreEqual(clustersize[i], fs.XmlFsType.ClusterSize, testfiles[i]); - Assert.AreEqual("exFAT", fs.XmlFsType.Type, testfiles[i]); - Assert.AreEqual(volumename[i], fs.XmlFsType.VolumeName, testfiles[i]); + Assert.AreEqual(clusters[i], fs.XmlFsType.Clusters, testfiles[i]); + Assert.AreEqual(clustersize[i], fs.XmlFsType.ClusterSize, testfiles[i]); + Assert.AreEqual("exFAT", fs.XmlFsType.Type, testfiles[i]); + Assert.AreEqual(volumename[i], fs.XmlFsType.VolumeName, testfiles[i]); Assert.AreEqual(volumeserial[i], fs.XmlFsType.VolumeSerial, testfiles[i]); } } diff --git a/DiscImageChef.Tests/Filesystems/ext2.cs b/DiscImageChef.Tests/Filesystems/ext2.cs index 59c5d7bed..8a5856276 100644 --- a/DiscImageChef.Tests/Filesystems/ext2.cs +++ b/DiscImageChef.Tests/Filesystems/ext2.cs @@ -69,17 +69,17 @@ namespace DiscImageChef.Tests.Filesystems { for(int i = 0; i < testfiles.Length; i++) { - string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "ext2", testfiles[i]); - IFilter filter = new LZip(); + string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "ext2", testfiles[i]); + IFilter filter = new LZip(); filter.Open(location); IMediaImage image = new Vdi(); - Assert.AreEqual(true, image.Open(filter), testfiles[i]); - Assert.AreEqual(sectors[i], image.Info.Sectors, testfiles[i]); + Assert.AreEqual(true, image.Open(filter), testfiles[i]); + Assert.AreEqual(sectors[i], image.Info.Sectors, testfiles[i]); Assert.AreEqual(sectorsize[i], image.Info.SectorSize, testfiles[i]); IPartition parts = new MBR(); Assert.AreEqual(true, parts.GetInformation(image, out List partitions, 0), testfiles[i]); - IFilesystem fs = new ext2FS(); - int part = -1; + IFilesystem fs = new ext2FS(); + int part = -1; for(int j = 0; j < partitions.Count; j++) if(partitions[j].Type == "0x83") { @@ -90,10 +90,10 @@ namespace DiscImageChef.Tests.Filesystems Assert.AreNotEqual(-1, part, $"Partition not found on {testfiles[i]}"); Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]); fs.GetInformation(image, partitions[part], out _, null); - Assert.AreEqual(clusters[i], fs.XmlFsType.Clusters, testfiles[i]); - Assert.AreEqual(clustersize[i], fs.XmlFsType.ClusterSize, testfiles[i]); - Assert.AreEqual(extversion[i], fs.XmlFsType.Type, testfiles[i]); - Assert.AreEqual(volumename[i], fs.XmlFsType.VolumeName, testfiles[i]); + Assert.AreEqual(clusters[i], fs.XmlFsType.Clusters, testfiles[i]); + Assert.AreEqual(clustersize[i], fs.XmlFsType.ClusterSize, testfiles[i]); + Assert.AreEqual(extversion[i], fs.XmlFsType.Type, testfiles[i]); + Assert.AreEqual(volumename[i], fs.XmlFsType.VolumeName, testfiles[i]); Assert.AreEqual(volumeserial[i], fs.XmlFsType.VolumeSerial, testfiles[i]); } } diff --git a/DiscImageChef.Tests/Filters/AppleDoubleDave.cs b/DiscImageChef.Tests/Filters/AppleDoubleDave.cs index f15a97d29..dcbb8305e 100644 --- a/DiscImageChef.Tests/Filters/AppleDoubleDave.cs +++ b/DiscImageChef.Tests/Filters/AppleDoubleDave.cs @@ -46,8 +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] diff --git a/DiscImageChef.Tests/Filters/AppleDoubleNetatalk.cs b/DiscImageChef.Tests/Filters/AppleDoubleNetatalk.cs index cc3abc953..8c6d97698 100644 --- a/DiscImageChef.Tests/Filters/AppleDoubleNetatalk.cs +++ b/DiscImageChef.Tests/Filters/AppleDoubleNetatalk.cs @@ -46,8 +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] diff --git a/DiscImageChef.Tests/Filters/AppleDoubleProDos.cs b/DiscImageChef.Tests/Filters/AppleDoubleProDos.cs index 519d56c2a..e608c94a3 100644 --- a/DiscImageChef.Tests/Filters/AppleDoubleProDos.cs +++ b/DiscImageChef.Tests/Filters/AppleDoubleProDos.cs @@ -52,7 +52,7 @@ namespace DiscImageChef.Tests.Filters [Test] public void CheckCorrectFile() { - string result = Md5Context.File(location, out _); + string result = Md5Context.File(location, out _); Assert.AreEqual(EXPECTED_FILE, result); result = Md5Context.File(sidecar, out _); @@ -91,7 +91,7 @@ namespace DiscImageChef.Tests.Filters str.Close(); str.Dispose(); filter.Close(); - string result = Md5Context.Data(data, out _); + string result = Md5Context.Data(data, out _); Assert.AreEqual(EXPECTED_CONTENTS, result); } @@ -106,7 +106,7 @@ namespace DiscImageChef.Tests.Filters str.Close(); str.Dispose(); filter.Close(); - string result = Md5Context.Data(data, out _); + string result = Md5Context.Data(data, out _); Assert.AreEqual(EXPECTED_RESOURCE, result); } } diff --git a/DiscImageChef.Tests/Images/2MG.cs b/DiscImageChef.Tests/Images/2MG.cs index 5397b5edc..66857c8c0 100644 --- a/DiscImageChef.Tests/Images/2MG.cs +++ b/DiscImageChef.Tests/Images/2MG.cs @@ -92,7 +92,7 @@ namespace DiscImageChef.Tests.Images else { sector = image.ReadSectors(doneSectors, (uint)(image.Info.Sectors - doneSectors)); - doneSectors += image.Info.Sectors - doneSectors; + doneSectors += image.Info.Sectors - doneSectors; } ctx.Update(sector); diff --git a/DiscImageChef.Tests/Images/Anex86.cs b/DiscImageChef.Tests/Images/Anex86.cs index bf434cb66..c48391c03 100644 --- a/DiscImageChef.Tests/Images/Anex86.cs +++ b/DiscImageChef.Tests/Images/Anex86.cs @@ -96,7 +96,7 @@ namespace DiscImageChef.Tests.Images else { sector = image.ReadSectors(doneSectors, (uint)(image.Info.Sectors - doneSectors)); - doneSectors += image.Info.Sectors - doneSectors; + doneSectors += image.Info.Sectors - doneSectors; } ctx.Update(sector); diff --git a/DiscImageChef.Tests/Images/CisCopy.cs b/DiscImageChef.Tests/Images/CisCopy.cs index 11a31d4be..a070198d7 100644 --- a/DiscImageChef.Tests/Images/CisCopy.cs +++ b/DiscImageChef.Tests/Images/CisCopy.cs @@ -110,7 +110,7 @@ namespace DiscImageChef.Tests.Images else { sector = image.ReadSectors(doneSectors, (uint)(image.Info.Sectors - doneSectors)); - doneSectors += image.Info.Sectors - doneSectors; + doneSectors += image.Info.Sectors - doneSectors; } ctx.Update(sector); diff --git a/DiscImageChef.Tests/Images/CopyQM.cs b/DiscImageChef.Tests/Images/CopyQM.cs index 33a2f7a35..df7e5724b 100644 --- a/DiscImageChef.Tests/Images/CopyQM.cs +++ b/DiscImageChef.Tests/Images/CopyQM.cs @@ -94,7 +94,7 @@ namespace DiscImageChef.Tests.Images else { sector = image.ReadSectors(doneSectors, (uint)(image.Info.Sectors - doneSectors)); - doneSectors += image.Info.Sectors - doneSectors; + doneSectors += image.Info.Sectors - doneSectors; } ctx.Update(sector); diff --git a/DiscImageChef.Tests/Images/D88.cs b/DiscImageChef.Tests/Images/D88.cs index 271e7a972..60e0c63bf 100644 --- a/DiscImageChef.Tests/Images/D88.cs +++ b/DiscImageChef.Tests/Images/D88.cs @@ -112,7 +112,7 @@ namespace DiscImageChef.Tests.Images else { sector = image.ReadSectors(doneSectors, (uint)(image.Info.Sectors - doneSectors)); - doneSectors += image.Info.Sectors - doneSectors; + doneSectors += image.Info.Sectors - doneSectors; } ctx.Update(sector); diff --git a/DiscImageChef.Tests/Images/DART.cs b/DiscImageChef.Tests/Images/DART.cs index 4c1c6cbf1..06ce1c1ca 100644 --- a/DiscImageChef.Tests/Images/DART.cs +++ b/DiscImageChef.Tests/Images/DART.cs @@ -93,7 +93,7 @@ namespace DiscImageChef.Tests.Images else { sector = image.ReadSectors(doneSectors, (uint)(image.Info.Sectors - doneSectors)); - doneSectors += image.Info.Sectors - doneSectors; + doneSectors += image.Info.Sectors - doneSectors; } ctx.Update(sector); diff --git a/DiscImageChef.Tests/Images/DiskCopy42.cs b/DiscImageChef.Tests/Images/DiskCopy42.cs index e34a7d465..02a9d6649 100644 --- a/DiscImageChef.Tests/Images/DiskCopy42.cs +++ b/DiscImageChef.Tests/Images/DiskCopy42.cs @@ -113,7 +113,7 @@ namespace DiscImageChef.Tests.Images else { sector = image.ReadSectors(doneSectors, (uint)(image.Info.Sectors - doneSectors)); - doneSectors += image.Info.Sectors - doneSectors; + doneSectors += image.Info.Sectors - doneSectors; } ctx.Update(sector); diff --git a/DiscImageChef.Tests/Partitions/Acorn.cs b/DiscImageChef.Tests/Partitions/Acorn.cs index fb16b7847..a55bb02d6 100644 --- a/DiscImageChef.Tests/Partitions/Acorn.cs +++ b/DiscImageChef.Tests/Partitions/Acorn.cs @@ -49,46 +49,46 @@ namespace DiscImageChef.Tests.Partitions new Partition { Description = null, - Size = 31457280, - Name = null, - Type = "GEM", - Offset = 512, - Length = 61440, - Sequence = 0, - Start = 1 + 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 + 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 + 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 + Size = 43212800, + Name = null, + Type = "MAC", + Offset = 129803264, + Length = 84400, + Sequence = 3, + Start = 253522 } } }; @@ -98,8 +98,8 @@ namespace DiscImageChef.Tests.Partitions { for(int i = 0; i < testfiles.Length; i++) { - string location = Path.Combine(Consts.TestFilesRoot, "partitions", "acorn", testfiles[i]); - IFilter filter = new LZip(); + string location = Path.Combine(Consts.TestFilesRoot, "partitions", "acorn", testfiles[i]); + IFilter filter = new LZip(); filter.Open(location); IMediaImage image = new Vdi(); Assert.AreEqual(true, image.Open(filter), testfiles[i]); @@ -109,13 +109,13 @@ 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].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]); + 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].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]); Assert.AreEqual(wanted[i][j].Sequence, partitions[j].Sequence, testfiles[i]); - Assert.AreEqual(wanted[i][j].Start, partitions[j].Start, testfiles[i]); + Assert.AreEqual(wanted[i][j].Start, partitions[j].Start, testfiles[i]); } } } diff --git a/DiscImageChef.Tests/Partitions/AppleMap.cs b/DiscImageChef.Tests/Partitions/AppleMap.cs index bf54cd5bc..1507b85b1 100644 --- a/DiscImageChef.Tests/Partitions/AppleMap.cs +++ b/DiscImageChef.Tests/Partitions/AppleMap.cs @@ -56,46 +56,46 @@ namespace DiscImageChef.Tests.Partitions new Partition { Description = null, - Size = 1024, - Name = null, - Type = "Apple_Driver", - Offset = 32768, - Length = 2, - Sequence = 0, - Start = 64 + 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 + 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 + 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 + Size = 26083328, + Name = "Volume label", + Type = "Apple_HFS", + Offset = 131072, + Length = 50944, + Sequence = 3, + Start = 256 } }, // HDT 1.8 Encryption Level 1 @@ -104,35 +104,35 @@ namespace DiscImageChef.Tests.Partitions new Partition { Description = null, - Size = 7168, - Name = null, - Type = "Apple_Driver", - Offset = 32768, - Length = 14, - Sequence = 0, - Start = 64 + 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 + 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 + Size = 25657344, + Name = "MacOS", + Type = "Apple_HFS", + Offset = 557056, + Length = 50112, + Sequence = 2, + Start = 1088 } }, // HDT 1.8 Encryption Level 2 @@ -141,35 +141,35 @@ namespace DiscImageChef.Tests.Partitions new Partition { Description = null, - Size = 7168, - Name = null, - Type = "Apple_Driver", - Offset = 32768, - Length = 14, - Sequence = 0, - Start = 64 + 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 + 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 + Size = 25657344, + Name = "MacOS", + Type = "Apple_HFS", + Offset = 557056, + Length = 50112, + Sequence = 2, + Start = 1088 } }, // HDT 1.8 with password @@ -178,35 +178,35 @@ namespace DiscImageChef.Tests.Partitions new Partition { Description = null, - Size = 7168, - Name = null, - Type = "Apple_Driver", - Offset = 32768, - Length = 14, - Sequence = 0, - Start = 64 + 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 + 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 + Size = 25657344, + Name = "MacOS", + Type = "Apple_HFS", + Offset = 557056, + Length = 50112, + Sequence = 2, + Start = 1088 } }, // HDT 1.8 @@ -215,35 +215,35 @@ namespace DiscImageChef.Tests.Partitions new Partition { Description = null, - Size = 7168, - Name = null, - Type = "Apple_Driver", - Offset = 32768, - Length = 14, - Sequence = 0, - Start = 64 + 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 + 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 + Size = 25657344, + Name = "MacOS", + Type = "Apple_HFS", + Offset = 557056, + Length = 50112, + Sequence = 2, + Start = 1088 } }, // Linux @@ -252,79 +252,79 @@ namespace DiscImageChef.Tests.Partitions new Partition { Description = null, - Size = 512, - Name = "Extra", - Type = "Apple_Free", - Offset = 32768, - Length = 1, - Sequence = 0, - Start = 64 + 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 + 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 + 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 + 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 + 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 + 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 + Size = 7535616, + Name = "Extra", + Type = "Apple_Free", + Offset = 126682112, + Length = 14718, + Sequence = 6, + Start = 247426 } }, // Mac OS 1.1 @@ -333,24 +333,24 @@ namespace DiscImageChef.Tests.Partitions new Partition { Description = null, - Size = 5120, - Name = null, - Type = "Apple_Driver", - Offset = 2048, - Length = 10, - Sequence = 0, - Start = 4 + 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 + Size = 21403648, + Name = "Macintosh", + Type = "Apple_HFS", + Offset = 8192, + Length = 41804, + Sequence = 1, + Start = 16 } }, // Mac OS 2.0 @@ -359,24 +359,24 @@ namespace DiscImageChef.Tests.Partitions new Partition { Description = null, - Size = 5120, - Name = null, - Type = "Apple_Driver", - Offset = 2048, - Length = 10, - Sequence = 0, - Start = 4 + 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 + Size = 19950080, + Name = "Macintosh", + Type = "Apple_HFS", + Offset = 8192, + Length = 38965, + Sequence = 1, + Start = 16 } }, // Mac OS 4.2 @@ -385,24 +385,24 @@ namespace DiscImageChef.Tests.Partitions new Partition { Description = null, - Size = 5632, - Name = null, - Type = "Apple_Driver", - Offset = 2048, - Length = 11, - Sequence = 0, - Start = 4 + 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 + Size = 19950080, + Name = "Macintosh", + Type = "Apple_HFS", + Offset = 8192, + Length = 38965, + Sequence = 1, + Start = 16 } }, // Mac OS 4.3 @@ -411,24 +411,24 @@ namespace DiscImageChef.Tests.Partitions new Partition { Description = null, - Size = 5632, - Name = null, - Type = "Apple_Driver", - Offset = 2048, - Length = 11, - Sequence = 0, - Start = 4 + 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 + Size = 19950080, + Name = "Macintosh", + Type = "Apple_HFS", + Offset = 8192, + Length = 38965, + Sequence = 1, + Start = 16 } }, // Mac OS 6.0.2 @@ -437,167 +437,167 @@ namespace DiscImageChef.Tests.Partitions new Partition { Description = null, - Size = 5120, - Name = null, - Type = "Apple_Driver", - Offset = 32768, - Length = 10, - Sequence = 0, - Start = 64 + 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 + 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 + 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 + 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 + 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 + 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 + 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 + 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 + 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 + 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 + 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 + 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 + 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 + 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 + Size = 5714944, + Name = "Extra", + Type = "Apple_Free", + Offset = 22363136, + Length = 11162, + Sequence = 14, + Start = 43678 } }, // Mac OS 6.0.3 @@ -606,134 +606,134 @@ namespace DiscImageChef.Tests.Partitions new Partition { Description = null, - Size = 5120, - Name = null, - Type = "Apple_Driver", - Offset = 32768, - Length = 10, - Sequence = 0, - Start = 64 + 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 + 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 + 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 + 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 + 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 + 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 + 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 + 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 + 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 + 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 + 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 + Size = 1558528, + Name = "Random A/UX fs", + Type = "Apple_UNIX_SVR2", + Offset = 26519552, + Length = 3044, + Sequence = 11, + Start = 51796 } }, // Mac OS 6.0.4 @@ -742,134 +742,134 @@ namespace DiscImageChef.Tests.Partitions new Partition { Description = null, - Size = 5120, - Name = null, - Type = "Apple_Driver", - Offset = 32768, - Length = 10, - Sequence = 0, - Start = 64 + 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 + 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 + 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 + 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 + 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 + 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 + 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 + 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 + 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 + 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 + 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 + Size = 1657856, + Name = "Extra", + Type = "Apple_Free", + Offset = 26420224, + Length = 3238, + Sequence = 11, + Start = 51602 } }, // Mac OS 6.0.5 @@ -878,167 +878,167 @@ namespace DiscImageChef.Tests.Partitions new Partition { Description = null, - Size = 5120, - Name = null, - Type = "Apple_Driver", - Offset = 32768, - Length = 10, - Sequence = 0, - Start = 64 + 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 + 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 + 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 + 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 + 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 + 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 + 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 + 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 + 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 + 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 + 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 + 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 + 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 + 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 + Size = 3421696, + Name = "Extra", + Type = "Apple_Free", + Offset = 24656384, + Length = 6683, + Sequence = 14, + Start = 48157 } }, // Mac OS 6.0.7 @@ -1047,156 +1047,156 @@ namespace DiscImageChef.Tests.Partitions new Partition { Description = null, - Size = 5120, - Name = null, - Type = "Apple_Driver", - Offset = 32768, - Length = 10, - Sequence = 0, - Start = 64 + 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 + 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 + 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 + 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 + 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 + 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 + 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 + 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 + 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 + 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 + 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 + 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 + 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 + Size = 2252800, + Name = "Unreserved 4", + Type = "Apple_UNIX_SVR2", + Offset = 25825280, + Length = 4400, + Sequence = 13, + Start = 50440 } }, // Mac OS 6.0.8 @@ -1205,167 +1205,167 @@ namespace DiscImageChef.Tests.Partitions new Partition { Description = null, - Size = 5120, - Name = null, - Type = "Apple_Driver", - Offset = 32768, - Length = 10, - Sequence = 0, - Start = 64 + 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 + 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 + 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 + 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 + 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 + 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 + 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 + 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 + 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 + 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 + 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 + 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 + 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 + 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 + Size = 2091520, + Name = "A/UX Root", + Type = "Apple_UNIX_SVR2", + Offset = 25986560, + Length = 4085, + Sequence = 14, + Start = 50755 } }, // Mac OS 6.0 @@ -1374,134 +1374,134 @@ namespace DiscImageChef.Tests.Partitions new Partition { Description = null, - Size = 5120, - Name = null, - Type = "Apple_Driver", - Offset = 32768, - Length = 10, - Sequence = 0, - Start = 64 + 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 + 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 + 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 + 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 + 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 + 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 + 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 + 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 + 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 + 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 + 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 + Size = 4096, + Name = "Extra", + Type = "Apple_Free", + Offset = 21407744, + Length = 8, + Sequence = 11, + Start = 41812 } }, // Mac OS 7.0 @@ -1510,112 +1510,112 @@ namespace DiscImageChef.Tests.Partitions new Partition { Description = null, - Size = 5120, - Name = null, - Type = "Apple_Driver", - Offset = 32768, - Length = 10, - Sequence = 0, - Start = 64 + 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 + 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 + 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 + 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 + 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 + 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 + 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 + 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 + 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 + Size = 5262336, + Name = "Extra", + Type = "Apple_Free", + Offset = 22815744, + Length = 10278, + Sequence = 9, + Start = 44562 } }, // Mac OS 7.1.1 @@ -1624,123 +1624,123 @@ namespace DiscImageChef.Tests.Partitions new Partition { Description = null, - Size = 8704, - Name = null, - Type = "Apple_Driver", - Offset = 32768, - Length = 17, - Sequence = 0, - Start = 64 + 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 + 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 + 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 + 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 + 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 + 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 + 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 + 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 + 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 + 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 + Size = 3996672, + Name = "A/UX Root", + Type = "Apple_UNIX_SVR2", + Offset = 24081408, + Length = 7806, + Sequence = 10, + Start = 47034 } }, // Mac OS 7.5 @@ -1749,35 +1749,35 @@ namespace DiscImageChef.Tests.Partitions new Partition { Description = null, - Size = 9216, - Name = null, - Type = "Apple_Driver", - Offset = 32768, - Length = 18, - Sequence = 0, - Start = 64 + 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 + 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 + Size = 28028928, + Name = "MacOS", + Type = "Apple_HFS", + Offset = 49152, + Length = 54744, + Sequence = 2, + Start = 96 } }, // GNU Parted @@ -1786,35 +1786,35 @@ namespace DiscImageChef.Tests.Partitions new Partition { Description = null, - Size = 2064384, - Name = "Extra", - Type = "Apple_Free", - Offset = 32768, - Length = 4032, - Sequence = 0, - Start = 64 + 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 + 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 + Size = 84934656, + Name = "untitled", + Type = "Apple_UNIX_SVR2", + Offset = 49283072, + Length = 165888, + Sequence = 2, + Start = 96256 } }, // Silverlining 2.2.1 @@ -1823,68 +1823,68 @@ namespace DiscImageChef.Tests.Partitions new Partition { Description = null, - Size = 3072, - Name = null, - Type = "Apple_Driver", - Offset = 32768, - Length = 6, - Sequence = 0, - Start = 64 + 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 + 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 + 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 + 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 + 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 + Size = 237568, + Name = "Extra", + Type = "Apple_Free", + Offset = 25968640, + Length = 464, + Sequence = 5, + Start = 50720 } }, // Hard Disk Speed Tools 3.6 @@ -1893,46 +1893,46 @@ namespace DiscImageChef.Tests.Partitions new Partition { Description = null, - Size = 13824, - Name = null, - Type = "Apple_Driver", - Offset = 32768, - Length = 27, - Sequence = 0, - Start = 64 + 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 + 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 + 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 + Size = 963584, + Name = "Extra", + Type = "Apple_Free", + Offset = 25249792, + Length = 1882, + Sequence = 3, + Start = 49316 } }, // VCP Formatter 2.1.1 @@ -1941,58 +1941,58 @@ namespace DiscImageChef.Tests.Partitions new Partition { Description = null, - Size = 12288, - Name = null, - Type = "Apple_Driver", - Offset = 57344, - Length = 24, - Sequence = 0, - Start = 112 + 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 + 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 + 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 + 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 + Size = 1024, + Name = "Extra", + Type = "Apple_Free", + Offset = 28077056, + Length = 2, + Sequence = 4, + Start = 54838 } } }; @@ -2002,8 +2002,8 @@ namespace DiscImageChef.Tests.Partitions { for(int i = 0; i < testfiles.Length; i++) { - string location = Path.Combine(Consts.TestFilesRoot, "partitions", "apm", testfiles[i]); - IFilter filter = new LZip(); + string location = Path.Combine(Consts.TestFilesRoot, "partitions", "apm", testfiles[i]); + IFilter filter = new LZip(); filter.Open(location); IMediaImage image = new Vdi(); Assert.AreEqual(true, image.Open(filter), testfiles[i]); @@ -2013,13 +2013,13 @@ 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].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]); + 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].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]); Assert.AreEqual(wanted[i][j].Sequence, partitions[j].Sequence, testfiles[i]); - Assert.AreEqual(wanted[i][j].Start, partitions[j].Start, testfiles[i]); + Assert.AreEqual(wanted[i][j].Start, partitions[j].Start, testfiles[i]); } } } diff --git a/DiscImageChef.Tests/Partitions/Atari.cs b/DiscImageChef.Tests/Partitions/Atari.cs index c34c37a76..c1745f70e 100644 --- a/DiscImageChef.Tests/Partitions/Atari.cs +++ b/DiscImageChef.Tests/Partitions/Atari.cs @@ -48,112 +48,112 @@ namespace DiscImageChef.Tests.Partitions new Partition { Description = null, - Size = 31457280, - Name = null, - Type = "GEM", - Offset = 512, - Length = 61440, - Sequence = 0, - Start = 1 + 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 + 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 + 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 + 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 + 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 + 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 + 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 + 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 + 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 + Size = 77593600, + Name = null, + Type = "LNX", + Offset = 446694400, + Length = 151550, + Sequence = 9, + Start = 872450 } }, // Linux (ICD) @@ -162,101 +162,101 @@ namespace DiscImageChef.Tests.Partitions new Partition { Description = null, - Size = 15728640, - Name = null, - Type = "GEM", - Offset = 512, - Length = 30720, - Sequence = 0, - Start = 1 + 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 + 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 + 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 + 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 + 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 + 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 + 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 + 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 + Size = 104857600, + Name = null, + Type = "LNX", + Offset = 413139456, + Length = 204800, + Sequence = 8, + Start = 806913 } }, // TOS 1.04 @@ -265,46 +265,46 @@ namespace DiscImageChef.Tests.Partitions new Partition { Description = null, - Size = 7340032, - Name = null, - Type = "GEM", - Offset = 1024, - Length = 14336, - Sequence = 0, - Start = 2 + 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 + 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 + 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 + Size = 7339008, + Name = null, + Type = "GEM", + Offset = 22021120, + Length = 14334, + Sequence = 3, + Start = 43010 } } }; @@ -314,8 +314,8 @@ namespace DiscImageChef.Tests.Partitions { for(int i = 0; i < testfiles.Length; i++) { - string location = Path.Combine(Consts.TestFilesRoot, "partitions", "atari", testfiles[i]); - IFilter filter = new LZip(); + string location = Path.Combine(Consts.TestFilesRoot, "partitions", "atari", testfiles[i]); + IFilter filter = new LZip(); filter.Open(location); IMediaImage image = new Vdi(); Assert.AreEqual(true, image.Open(filter), testfiles[i]); @@ -325,13 +325,13 @@ 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].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]); + 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].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]); Assert.AreEqual(wanted[i][j].Sequence, partitions[j].Sequence, testfiles[i]); - Assert.AreEqual(wanted[i][j].Start, partitions[j].Start, testfiles[i]); + Assert.AreEqual(wanted[i][j].Start, partitions[j].Start, testfiles[i]); } } } diff --git a/DiscImageChef.Tests/Partitions/BSD.cs b/DiscImageChef.Tests/Partitions/BSD.cs index 03a6f4fb1..b3203fc4d 100644 --- a/DiscImageChef.Tests/Partitions/BSD.cs +++ b/DiscImageChef.Tests/Partitions/BSD.cs @@ -49,35 +49,35 @@ namespace DiscImageChef.Tests.Partitions new Partition { Description = null, - Size = 38797312, - Name = null, - Type = "FAT", - Offset = 1048576, - Length = 75776, - Sequence = 0, - Start = 2048 + 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 + 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 + Size = 48234496, + Name = null, + Type = "FAT", + Offset = 61865984, + Length = 94208, + Sequence = 2, + Start = 120832 } }, // NetBSD 1.6 @@ -86,68 +86,68 @@ namespace DiscImageChef.Tests.Partitions new Partition { Description = null, - Size = 10453504, - Name = null, - Type = "FAT", - Offset = 516096, - Length = 20417, - Sequence = 0, - Start = 1008 + 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 + 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 + 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 + 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 + 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 + Size = 103743488, + Name = null, + Type = "4.2BSD Fast File System", + Offset = 2043740160, + Length = 202624, + Sequence = 5, + Start = 3991680 } }, // NetBSD 6.1.5 @@ -156,114 +156,114 @@ namespace DiscImageChef.Tests.Partitions new Partition { Description = null, - Size = 10485760, - Name = null, - Type = "FAT", - Offset = 516096, - Length = 20480, - Sequence = 0, - Start = 1008 + 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 + 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 + 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 + 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 + 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 + 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 + 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 + 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 + 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 + Size = 463978496, + Name = null, + Type = "Digital LSM Public Region", + Offset = 1683505152, + Length = 906208, + Sequence = 9, + Start = 3288096 } }, // NetBSD 7.1 @@ -272,114 +272,114 @@ namespace DiscImageChef.Tests.Partitions new Partition { Description = null, - Size = 10321920, - Name = null, - Type = "FAT", - Offset = 516096, - Length = 20160, - Sequence = 0, - Start = 1008 + 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 + 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 + 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 + 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 + 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 + 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 + 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 + 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 + 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 + Size = 463970304, + Name = null, + Type = "Digital LSM Public Region", + Offset = 1683505152, + Length = 906192, + Sequence = 9, + Start = 3288096 } } }; @@ -389,8 +389,8 @@ namespace DiscImageChef.Tests.Partitions { for(int i = 0; i < testfiles.Length; i++) { - string location = Path.Combine(Consts.TestFilesRoot, "partitions", "bsd", testfiles[i]); - IFilter filter = new LZip(); + string location = Path.Combine(Consts.TestFilesRoot, "partitions", "bsd", testfiles[i]); + IFilter filter = new LZip(); filter.Open(location); IMediaImage image = new Vdi(); Assert.AreEqual(true, image.Open(filter), testfiles[i]); @@ -400,13 +400,13 @@ 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].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]); + 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].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]); Assert.AreEqual(wanted[i][j].Sequence, partitions[j].Sequence, testfiles[i]); - Assert.AreEqual(wanted[i][j].Start, partitions[j].Start, testfiles[i]); + Assert.AreEqual(wanted[i][j].Start, partitions[j].Start, testfiles[i]); } } } diff --git a/DiscImageChef.Tests/Partitions/GPT.cs b/DiscImageChef.Tests/Partitions/GPT.cs index ef885e737..20c7ead1f 100644 --- a/DiscImageChef.Tests/Partitions/GPT.cs +++ b/DiscImageChef.Tests/Partitions/GPT.cs @@ -48,68 +48,68 @@ namespace DiscImageChef.Tests.Partitions new Partition { Description = null, - Size = 10485760, - Name = "EFI System", - Type = "EFI System", - Offset = 1048576, - Length = 20480, - Sequence = 0, - Start = 2048 + 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 + 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 + 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 + 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 + 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 + Size = 28294656, + Name = "HP-UX data", + Type = "HP-UX Data", + Offset = 105906176, + Length = 55263, + Sequence = 5, + Start = 206848 } }, // Parted @@ -118,35 +118,35 @@ namespace DiscImageChef.Tests.Partitions new Partition { Description = null, - Size = 42991616, - Name = "", - Type = "Apple HFS", - Offset = 1048576, - Length = 83968, - Sequence = 0, - Start = 2048 + 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 + 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 + Size = 36700160, + Name = "", + Type = "Microsoft Basic data", + Offset = 96468992, + Length = 71680, + Sequence = 2, + Start = 188416 } } }; @@ -156,8 +156,8 @@ namespace DiscImageChef.Tests.Partitions { for(int i = 0; i < testfiles.Length; i++) { - string location = Path.Combine(Consts.TestFilesRoot, "partitions", "gpt", testfiles[i]); - IFilter filter = new LZip(); + string location = Path.Combine(Consts.TestFilesRoot, "partitions", "gpt", testfiles[i]); + IFilter filter = new LZip(); filter.Open(location); IMediaImage image = new Vdi(); Assert.AreEqual(true, image.Open(filter), testfiles[i]); @@ -167,13 +167,13 @@ 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].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]); + 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].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]); Assert.AreEqual(wanted[i][j].Sequence, partitions[j].Sequence, testfiles[i]); - Assert.AreEqual(wanted[i][j].Start, partitions[j].Start, testfiles[i]); + Assert.AreEqual(wanted[i][j].Start, partitions[j].Start, testfiles[i]); } } } diff --git a/DiscImageChef.Tests/Partitions/MBR.cs b/DiscImageChef.Tests/Partitions/MBR.cs index 44a38dbbd..1174b37ef 100644 --- a/DiscImageChef.Tests/Partitions/MBR.cs +++ b/DiscImageChef.Tests/Partitions/MBR.cs @@ -58,38 +58,38 @@ namespace DiscImageChef.Tests.Partitions new Partition { Description = null, - Name = null, - Type = "0x04", - Length = 100800, - Sequence = 0, - Start = 1008 + Name = null, + Type = "0x04", + Length = 100800, + Sequence = 0, + Start = 1008 }, new Partition { Description = null, - Name = null, - Type = "0x04", - Length = 99792, - Sequence = 1, - Start = 102816 + Name = null, + Type = "0x04", + Length = 99792, + Sequence = 1, + Start = 102816 }, new Partition { Description = null, - Name = null, - Type = "0x04", - Length = 100800, - Sequence = 2, - Start = 202608 + Name = null, + Type = "0x04", + Length = 100800, + Sequence = 2, + Start = 202608 }, new Partition { Description = null, - Name = null, - Type = "0x04", - Length = 303408, - Sequence = 3, - Start = 352800 + Name = null, + Type = "0x04", + Length = 303408, + Sequence = 3, + Start = 352800 } }, // Darwin 1.4.1 @@ -98,20 +98,20 @@ namespace DiscImageChef.Tests.Partitions new Partition { Description = null, - Name = null, - Type = "0x07", - Length = 409248, - Sequence = 0, - Start = 409248 + Name = null, + Type = "0x07", + Length = 409248, + Sequence = 0, + Start = 409248 }, new Partition { Description = null, - Name = null, - Type = "0xA8", - Length = 204624, - Sequence = 1, - Start = 818496 + Name = null, + Type = "0xA8", + Length = 204624, + Sequence = 1, + Start = 818496 } }, // Darwin 6.0.2 @@ -120,38 +120,38 @@ namespace DiscImageChef.Tests.Partitions new Partition { Description = null, - Name = null, - Type = "0xA8", - Length = 204561, - Sequence = 0, - Start = 63 + Name = null, + Type = "0xA8", + Length = 204561, + Sequence = 0, + Start = 63 }, new Partition { Description = null, - Name = null, - Type = "0xAB", - Length = 81648, - Sequence = 1, - Start = 204624 + Name = null, + Type = "0xAB", + Length = 81648, + Sequence = 1, + Start = 204624 }, new Partition { Description = null, - Name = null, - Type = "0x06", - Length = 245952, - Sequence = 2, - Start = 286272 + Name = null, + Type = "0x06", + Length = 245952, + Sequence = 2, + Start = 286272 }, new Partition { Description = null, - Name = null, - Type = "0x06", - Length = 488880, - Sequence = 3, - Start = 532224 + Name = null, + Type = "0x06", + Length = 488880, + Sequence = 3, + Start = 532224 } }, // Darwin 8.0.1 @@ -160,38 +160,38 @@ namespace DiscImageChef.Tests.Partitions new Partition { Description = null, - Name = null, - Type = "0x06", - Length = 150000, - Sequence = 0, - Start = 63 + Name = null, + Type = "0x06", + Length = 150000, + Sequence = 0, + Start = 63 }, new Partition { Description = null, - Name = null, - Type = "0xAF", - Length = 176000, - Sequence = 1, - Start = 150063 + Name = null, + Type = "0xAF", + Length = 176000, + Sequence = 1, + Start = 150063 }, new Partition { Description = null, - Name = null, - Type = "0xA8", - Length = 350000, - Sequence = 2, - Start = 326063 + Name = null, + Type = "0xA8", + Length = 350000, + Sequence = 2, + Start = 326063 }, new Partition { Description = null, - Name = null, - Type = "0x0C", - Length = 347937, - Sequence = 3, - Start = 676063 + Name = null, + Type = "0x0C", + Length = 347937, + Sequence = 3, + Start = 676063 } }, // DR-DOS 3.40 @@ -200,38 +200,38 @@ namespace DiscImageChef.Tests.Partitions new Partition { Description = null, - Name = null, - Type = "0x06", - Length = 100800, - Sequence = 0, - Start = 1008 + Name = null, + Type = "0x06", + Length = 100800, + Sequence = 0, + Start = 1008 }, new Partition { Description = null, - Name = null, - Type = "0x06", - Length = 402129, - Sequence = 1, - Start = 101871 + Name = null, + Type = "0x06", + Length = 402129, + Sequence = 1, + Start = 101871 }, new Partition { Description = null, - Name = null, - Type = "0x06", - Length = 152145, - Sequence = 2, - Start = 504063 + Name = null, + Type = "0x06", + Length = 152145, + Sequence = 2, + Start = 504063 }, new Partition { Description = null, - Name = null, - Type = "0x06", - Length = 365841, - Sequence = 3, - Start = 656271 + Name = null, + Type = "0x06", + Length = 365841, + Sequence = 3, + Start = 656271 } }, // DR-DOS 3.41 @@ -240,38 +240,38 @@ namespace DiscImageChef.Tests.Partitions new Partition { Description = null, - Name = null, - Type = "0x06", - Length = 126945, - Sequence = 0, - Start = 63 + Name = null, + Type = "0x06", + Length = 126945, + Sequence = 0, + Start = 63 }, new Partition { Description = null, - Name = null, - Type = "0x06", - Length = 124929, - Sequence = 1, - Start = 127071 + Name = null, + Type = "0x06", + Length = 124929, + Sequence = 1, + Start = 127071 }, new Partition { Description = null, - Name = null, - Type = "0x06", - Length = 101745, - Sequence = 2, - Start = 252063 + Name = null, + Type = "0x06", + Length = 101745, + Sequence = 2, + Start = 252063 }, new Partition { Description = null, - Name = null, - Type = "0x06", - Length = 668241, - Sequence = 3, - Start = 353871 + Name = null, + Type = "0x06", + Length = 668241, + Sequence = 3, + Start = 353871 } }, // DR-DOS 5.00 @@ -280,47 +280,47 @@ namespace DiscImageChef.Tests.Partitions new Partition { Description = null, - Name = null, - Type = "0x06", - Length = 128016, - Sequence = 0, - Start = 124992 + Name = null, + Type = "0x06", + Length = 128016, + Sequence = 0, + Start = 124992 }, new Partition { Description = null, - Name = null, - Type = "0x06", - Length = 99729, - Sequence = 1, - Start = 253071 + Name = null, + Type = "0x06", + Length = 99729, + Sequence = 1, + Start = 253071 }, new Partition { Description = null, - Name = null, - Type = "0x06", - Length = 100737, - Sequence = 2, - Start = 352863 + Name = null, + Type = "0x06", + Length = 100737, + Sequence = 2, + Start = 352863 }, new Partition { Description = null, - Name = null, - Type = "0x06", - Length = 313425, - Sequence = 3, - Start = 453663 + Name = null, + Type = "0x06", + Length = 313425, + Sequence = 3, + Start = 453663 }, new Partition { Description = null, - Name = null, - Type = "0x06", - Length = 254961, - Sequence = 4, - Start = 767151 + Name = null, + Type = "0x06", + Length = 254961, + Sequence = 4, + Start = 767151 } }, // DR-DOS 6.00 @@ -329,47 +329,47 @@ namespace DiscImageChef.Tests.Partitions new Partition { Description = null, - Name = null, - Type = "0x06", - Length = 101745, - Sequence = 0, - Start = 63 + Name = null, + Type = "0x06", + Length = 101745, + Sequence = 0, + Start = 63 }, new Partition { Description = null, - Name = null, - Type = "0x01", - Length = 18081, - Sequence = 1, - Start = 102879 + Name = null, + Type = "0x01", + Length = 18081, + Sequence = 1, + Start = 102879 }, new Partition { Description = null, - Name = null, - Type = "0x06", - Length = 130977, - Sequence = 2, - Start = 121023 + Name = null, + Type = "0x06", + Length = 130977, + Sequence = 2, + Start = 121023 }, new Partition { Description = null, - Name = null, - Type = "0x06", - Length = 202545, - Sequence = 3, - Start = 252063 + Name = null, + Type = "0x06", + Length = 202545, + Sequence = 3, + Start = 252063 }, new Partition { Description = null, - Name = null, - Type = "0x06", - Length = 567441, - Sequence = 4, - Start = 454671 + Name = null, + Type = "0x06", + Length = 567441, + Sequence = 4, + Start = 454671 } }, // DR-DOS 7.02 @@ -378,47 +378,47 @@ namespace DiscImageChef.Tests.Partitions new Partition { Description = null, - Name = null, - Type = "0x06", - Length = 102753, - Sequence = 0, - Start = 63 + Name = null, + Type = "0x06", + Length = 102753, + Sequence = 0, + Start = 63 }, new Partition { Description = null, - Name = null, - Type = "0x06", - Length = 307377, - Sequence = 1, - Start = 102879 + Name = null, + Type = "0x06", + Length = 307377, + Sequence = 1, + Start = 102879 }, new Partition { Description = null, - Name = null, - Type = "0x06", - Length = 384993, - Sequence = 2, - Start = 410319 + Name = null, + Type = "0x06", + Length = 384993, + Sequence = 2, + Start = 410319 }, new Partition { Description = null, - Name = null, - Type = "0x01", - Length = 17073, - Sequence = 3, - Start = 795375 + Name = null, + Type = "0x01", + Length = 17073, + Sequence = 3, + Start = 795375 }, new Partition { Description = null, - Name = null, - Type = "0x06", - Length = 209601, - Sequence = 4, - Start = 812511 + Name = null, + Type = "0x06", + Length = 209601, + Sequence = 4, + Start = 812511 } }, // DR-DOS 7.03 @@ -427,47 +427,47 @@ namespace DiscImageChef.Tests.Partitions new Partition { Description = null, - Name = null, - Type = "0x06", - Length = 202545, - Sequence = 0, - Start = 63 + Name = null, + Type = "0x06", + Length = 202545, + Sequence = 0, + Start = 63 }, new Partition { Description = null, - Name = null, - Type = "0x06", - Length = 141057, - Sequence = 1, - Start = 202671 + Name = null, + Type = "0x06", + Length = 141057, + Sequence = 1, + Start = 202671 }, new Partition { Description = null, - Name = null, - Type = "0x06", - Length = 152145, - Sequence = 2, - Start = 352863 + Name = null, + Type = "0x06", + Length = 152145, + Sequence = 2, + Start = 352863 }, new Partition { Description = null, - Name = null, - Type = "0x06", - Length = 364833, - Sequence = 3, - Start = 505071 + Name = null, + Type = "0x06", + Length = 364833, + Sequence = 3, + Start = 505071 }, new Partition { Description = null, - Name = null, - Type = "0x06", - Length = 152145, - Sequence = 4, - Start = 869967 + Name = null, + Type = "0x06", + Length = 152145, + Sequence = 4, + Start = 869967 } }, // DR-DOS 8.0 @@ -476,47 +476,47 @@ namespace DiscImageChef.Tests.Partitions new Partition { Description = null, - Name = null, - Type = "0x06", - Length = 205569, - Sequence = 0, - Start = 63 + Name = null, + Type = "0x06", + Length = 205569, + Sequence = 0, + Start = 63 }, new Partition { Description = null, - Name = null, - Type = "0x06", - Length = 138033, - Sequence = 1, - Start = 205695 + Name = null, + Type = "0x06", + Length = 138033, + Sequence = 1, + Start = 205695 }, new Partition { Description = null, - Name = null, - Type = "0x06", - Length = 303345, - Sequence = 2, - Start = 352863 + Name = null, + Type = "0x06", + Length = 303345, + Sequence = 2, + Start = 352863 }, new Partition { Description = null, - Name = null, - Type = "0x06", - Length = 249921, - Sequence = 3, - Start = 656271 + Name = null, + Type = "0x06", + Length = 249921, + Sequence = 3, + Start = 656271 }, new Partition { Description = null, - Name = null, - Type = "0x06", - Length = 115857, - Sequence = 4, - Start = 906255 + Name = null, + Type = "0x06", + Length = 115857, + Sequence = 4, + Start = 906255 } }, // Linux @@ -525,47 +525,47 @@ namespace DiscImageChef.Tests.Partitions new Partition { Description = null, - Name = null, - Type = "0x04", - Length = 20480, - Sequence = 0, - Start = 2048 + Name = null, + Type = "0x04", + Length = 20480, + Sequence = 0, + Start = 2048 }, new Partition { Description = null, - Name = null, - Type = "0x24", - Length = 40960, - Sequence = 1, - Start = 22528 + Name = null, + Type = "0x24", + Length = 40960, + Sequence = 1, + Start = 22528 }, new Partition { Description = null, - Name = null, - Type = "0xA7", - Length = 61440, - Sequence = 2, - Start = 65536 + Name = null, + Type = "0xA7", + Length = 61440, + Sequence = 2, + Start = 65536 }, new Partition { Description = null, - Name = null, - Type = "0x42", - Length = 81920, - Sequence = 3, - Start = 129024 + Name = null, + Type = "0x42", + Length = 81920, + Sequence = 3, + Start = 129024 }, new Partition { Description = null, - Name = null, - Type = "0x83", - Length = 49152, - Sequence = 4, - Start = 212992 + Name = null, + Type = "0x83", + Length = 49152, + Sequence = 4, + Start = 212992 } }, // Mac OS X 10.3 @@ -574,56 +574,56 @@ namespace DiscImageChef.Tests.Partitions new Partition { Description = null, - Name = null, - Type = "0xA8", - Length = 204800, - Sequence = 0, - Start = 8 + Name = null, + Type = "0xA8", + Length = 204800, + Sequence = 0, + Start = 8 }, new Partition { Description = null, - Name = null, - Type = "0xAF", - Length = 102400, - Sequence = 1, - Start = 204816 + Name = null, + Type = "0xAF", + Length = 102400, + Sequence = 1, + Start = 204816 }, new Partition { Description = null, - Name = null, - Type = "0x0B", - Length = 102400, - Sequence = 2, - Start = 307224 + Name = null, + Type = "0x0B", + Length = 102400, + Sequence = 2, + Start = 307224 }, new Partition { Description = null, - Name = null, - Type = "0xAF", - Length = 204800, - Sequence = 3, - Start = 409632 + Name = null, + Type = "0xAF", + Length = 204800, + Sequence = 3, + Start = 409632 }, new Partition { Description = null, - Name = null, - Type = "0xAF", - Length = 204800, - Sequence = 4, - Start = 614440 + Name = null, + Type = "0xAF", + Length = 204800, + Sequence = 4, + Start = 614440 }, new Partition { Description = null, - Name = null, - Type = "0xAF", - Length = 204752, - Sequence = 5, - Start = 819248 + Name = null, + Type = "0xAF", + Length = 204752, + Sequence = 5, + Start = 819248 } }, // Mac OS X 10.4 @@ -632,56 +632,56 @@ namespace DiscImageChef.Tests.Partitions new Partition { Description = null, - Name = null, - Type = "0xAF", - Length = 102400, - Sequence = 0, - Start = 63 + Name = null, + Type = "0xAF", + Length = 102400, + Sequence = 0, + Start = 63 }, new Partition { Description = null, - Name = null, - Type = "0xAF", - Length = 204800, - Sequence = 1, - Start = 102501 + Name = null, + Type = "0xAF", + Length = 204800, + Sequence = 1, + Start = 102501 }, new Partition { Description = null, - Name = null, - Type = "0x0B", - Length = 204800, - Sequence = 2, - Start = 307314 + Name = null, + Type = "0x0B", + Length = 204800, + Sequence = 2, + Start = 307314 }, new Partition { Description = null, - Name = null, - Type = "0xA8", - Length = 204800, - Sequence = 3, - Start = 512127 + Name = null, + Type = "0xA8", + Length = 204800, + Sequence = 3, + Start = 512127 }, new Partition { Description = null, - Name = null, - Type = "0x06", - Length = 102400, - Sequence = 4, - Start = 716940 + Name = null, + Type = "0x06", + Length = 102400, + Sequence = 4, + Start = 716940 }, new Partition { Description = null, - Name = null, - Type = "0xAF", - Length = 204622, - Sequence = 5, - Start = 819378 + Name = null, + Type = "0xAF", + Length = 204622, + Sequence = 5, + Start = 819378 } }, // MS-DOS 3.30A @@ -690,146 +690,146 @@ namespace DiscImageChef.Tests.Partitions new Partition { Description = null, - Name = null, - Type = "0x04", - Length = 65457, - Sequence = 0, - Start = 63 + Name = null, + Type = "0x04", + Length = 65457, + Sequence = 0, + Start = 63 }, new Partition { Description = null, - Name = null, - Type = "0x04", - Length = 65457, - Sequence = 1, - Start = 65583 + Name = null, + Type = "0x04", + Length = 65457, + Sequence = 1, + Start = 65583 }, new Partition { Description = null, - Name = null, - Type = "0x04", - Length = 65457, - Sequence = 2, - Start = 131103 + Name = null, + Type = "0x04", + Length = 65457, + Sequence = 2, + Start = 131103 }, new Partition { Description = null, - Name = null, - Type = "0x04", - Length = 65457, - Sequence = 3, - Start = 196623 + Name = null, + Type = "0x04", + Length = 65457, + Sequence = 3, + Start = 196623 }, new Partition { Description = null, - Name = null, - Type = "0x04", - Length = 65457, - Sequence = 4, - Start = 262143 + Name = null, + Type = "0x04", + Length = 65457, + Sequence = 4, + Start = 262143 }, new Partition { Description = null, - Name = null, - Type = "0x04", - Length = 65457, - Sequence = 5, - Start = 327663 + Name = null, + Type = "0x04", + Length = 65457, + Sequence = 5, + Start = 327663 }, new Partition { Description = null, - Name = null, - Type = "0x04", - Length = 65457, - Sequence = 6, - Start = 393183 + Name = null, + Type = "0x04", + Length = 65457, + Sequence = 6, + Start = 393183 }, new Partition { Description = null, - Name = null, - Type = "0x04", - Length = 65457, - Sequence = 7, - Start = 458703 + Name = null, + Type = "0x04", + Length = 65457, + Sequence = 7, + Start = 458703 }, new Partition { Description = null, - Name = null, - Type = "0x04", - Length = 65457, - Sequence = 8, - Start = 524223 + Name = null, + Type = "0x04", + Length = 65457, + Sequence = 8, + Start = 524223 }, new Partition { Description = null, - Name = null, - Type = "0x04", - Length = 65457, - Sequence = 9, - Start = 589743 + Name = null, + Type = "0x04", + Length = 65457, + Sequence = 9, + Start = 589743 }, new Partition { Description = null, - Name = null, - Type = "0x04", - Length = 65457, - Sequence = 10, - Start = 655263 + Name = null, + Type = "0x04", + Length = 65457, + Sequence = 10, + Start = 655263 }, new Partition { Description = null, - Name = null, - Type = "0x04", - Length = 65457, - Sequence = 11, - Start = 720783 + Name = null, + Type = "0x04", + Length = 65457, + Sequence = 11, + Start = 720783 }, new Partition { Description = null, - Name = null, - Type = "0x04", - Length = 65457, - Sequence = 12, - Start = 786303 + Name = null, + Type = "0x04", + Length = 65457, + Sequence = 12, + Start = 786303 }, new Partition { Description = null, - Name = null, - Type = "0x04", - Length = 65457, - Sequence = 13, - Start = 851823 + Name = null, + Type = "0x04", + Length = 65457, + Sequence = 13, + Start = 851823 }, new Partition { Description = null, - Name = null, - Type = "0x04", - Length = 65457, - Sequence = 14, - Start = 917343 + Name = null, + Type = "0x04", + Length = 65457, + Sequence = 14, + Start = 917343 }, new Partition { Description = null, - Name = null, - Type = "0x04", - Length = 39249, - Sequence = 15, - Start = 982863 + Name = null, + Type = "0x04", + Length = 39249, + Sequence = 15, + Start = 982863 } }, // MS-DOS 5.00 @@ -838,119 +838,119 @@ namespace DiscImageChef.Tests.Partitions new Partition { Description = null, - Name = null, - Type = "0x06", - Length = 102753, - Sequence = 0, - Start = 63 + Name = null, + Type = "0x06", + Length = 102753, + Sequence = 0, + Start = 63 }, new Partition { Description = null, - Name = null, - Type = "0x01", - Length = 31185, - Sequence = 1, - Start = 102879 + Name = null, + Type = "0x01", + Length = 31185, + Sequence = 1, + Start = 102879 }, new Partition { Description = null, - Name = null, - Type = "0x04", - Length = 41265, - Sequence = 2, - Start = 134127 + Name = null, + Type = "0x04", + Length = 41265, + Sequence = 2, + Start = 134127 }, new Partition { Description = null, - Name = null, - Type = "0x04", - Length = 51345, - Sequence = 3, - Start = 175455 + Name = null, + Type = "0x04", + Length = 51345, + Sequence = 3, + Start = 175455 }, new Partition { Description = null, - Name = null, - Type = "0x04", - Length = 61425, - Sequence = 4, - Start = 226863 + Name = null, + Type = "0x04", + Length = 61425, + Sequence = 4, + Start = 226863 }, new Partition { Description = null, - Name = null, - Type = "0x06", - Length = 72513, - Sequence = 5, - Start = 288351 + Name = null, + Type = "0x06", + Length = 72513, + Sequence = 5, + Start = 288351 }, new Partition { Description = null, - Name = null, - Type = "0x06", - Length = 82593, - Sequence = 6, - Start = 360927 + Name = null, + Type = "0x06", + Length = 82593, + Sequence = 6, + Start = 360927 }, new Partition { Description = null, - Name = null, - Type = "0x06", - Length = 92673, - Sequence = 7, - Start = 443583 + Name = null, + Type = "0x06", + Length = 92673, + Sequence = 7, + Start = 443583 }, new Partition { Description = null, - Name = null, - Type = "0x06", - Length = 102753, - Sequence = 8, - Start = 536319 + Name = null, + Type = "0x06", + Length = 102753, + Sequence = 8, + Start = 536319 }, new Partition { Description = null, - Name = null, - Type = "0x06", - Length = 112833, - Sequence = 9, - Start = 639135 + Name = null, + Type = "0x06", + Length = 112833, + Sequence = 9, + Start = 639135 }, new Partition { Description = null, - Name = null, - Type = "0x06", - Length = 122913, - Sequence = 10, - Start = 752031 + Name = null, + Type = "0x06", + Length = 122913, + Sequence = 10, + Start = 752031 }, new Partition { Description = null, - Name = null, - Type = "0x06", - Length = 134001, - Sequence = 11, - Start = 875007 + Name = null, + Type = "0x06", + Length = 134001, + Sequence = 11, + Start = 875007 }, new Partition { Description = null, - Name = null, - Type = "0x01", - Length = 13041, - Sequence = 12, - Start = 1009071 + Name = null, + Type = "0x01", + Length = 13041, + Sequence = 12, + Start = 1009071 } }, // MS-DOS 6.00 @@ -959,83 +959,83 @@ namespace DiscImageChef.Tests.Partitions new Partition { Description = null, - Name = null, - Type = "0x04", - Length = 51345, - Sequence = 0, - Start = 63 + Name = null, + Type = "0x04", + Length = 51345, + Sequence = 0, + Start = 63 }, new Partition { Description = null, - Name = null, - Type = "0x06", - Length = 72513, - Sequence = 1, - Start = 51471 + Name = null, + Type = "0x06", + Length = 72513, + Sequence = 1, + Start = 51471 }, new Partition { Description = null, - Name = null, - Type = "0x06", - Length = 92673, - Sequence = 2, - Start = 124047 + Name = null, + Type = "0x06", + Length = 92673, + Sequence = 2, + Start = 124047 }, new Partition { Description = null, - Name = null, - Type = "0x06", - Length = 112833, - Sequence = 3, - Start = 216783 + Name = null, + Type = "0x06", + Length = 112833, + Sequence = 3, + Start = 216783 }, new Partition { Description = null, - Name = null, - Type = "0x06", - Length = 134001, - Sequence = 4, - Start = 329679 + Name = null, + Type = "0x06", + Length = 134001, + Sequence = 4, + Start = 329679 }, new Partition { Description = null, - Name = null, - Type = "0x06", - Length = 154161, - Sequence = 5, - Start = 463743 + Name = null, + Type = "0x06", + Length = 154161, + Sequence = 5, + Start = 463743 }, new Partition { Description = null, - Name = null, - Type = "0x06", - Length = 178353, - Sequence = 6, - Start = 617967 + Name = null, + Type = "0x06", + Length = 178353, + Sequence = 6, + Start = 617967 }, new Partition { Description = null, - Name = null, - Type = "0x06", - Length = 184401, - Sequence = 7, - Start = 796383 + Name = null, + Type = "0x06", + Length = 184401, + Sequence = 7, + Start = 796383 }, new Partition { Description = null, - Name = null, - Type = "0x04", - Length = 41265, - Sequence = 8, - Start = 980847 + Name = null, + Type = "0x04", + Length = 41265, + Sequence = 8, + Start = 980847 } }, // MS-DOS 6.20 @@ -1044,56 +1044,56 @@ namespace DiscImageChef.Tests.Partitions new Partition { Description = null, - Name = null, - Type = "0x06", - Length = 205569, - Sequence = 0, - Start = 63 + Name = null, + Type = "0x06", + Length = 205569, + Sequence = 0, + Start = 63 }, new Partition { Description = null, - Name = null, - Type = "0x06", - Length = 225729, - Sequence = 1, - Start = 205695 + Name = null, + Type = "0x06", + Length = 225729, + Sequence = 1, + Start = 205695 }, new Partition { Description = null, - Name = null, - Type = "0x06", - Length = 245889, - Sequence = 2, - Start = 431487 + Name = null, + Type = "0x06", + Length = 245889, + Sequence = 2, + Start = 431487 }, new Partition { Description = null, - Name = null, - Type = "0x06", - Length = 267057, - Sequence = 3, - Start = 677439 + Name = null, + Type = "0x06", + Length = 267057, + Sequence = 3, + Start = 677439 }, new Partition { Description = null, - Name = null, - Type = "0x04", - Length = 61425, - Sequence = 4, - Start = 944559 + Name = null, + Type = "0x04", + Length = 61425, + Sequence = 4, + Start = 944559 }, new Partition { Description = null, - Name = null, - Type = "0x01", - Length = 16065, - Sequence = 5, - Start = 1006047 + Name = null, + Type = "0x01", + Length = 16065, + Sequence = 5, + Start = 1006047 } }, // MS-DOS 6.21 @@ -1102,65 +1102,65 @@ namespace DiscImageChef.Tests.Partitions new Partition { Description = null, - Name = null, - Type = "0x06", - Length = 205569, - Sequence = 0, - Start = 63 + Name = null, + Type = "0x06", + Length = 205569, + Sequence = 0, + Start = 63 }, new Partition { Description = null, - Name = null, - Type = "0x06", - Length = 225729, - Sequence = 1, - Start = 205695 + Name = null, + Type = "0x06", + Length = 225729, + Sequence = 1, + Start = 205695 }, new Partition { Description = null, - Name = null, - Type = "0x06", - Length = 245889, - Sequence = 2, - Start = 431487 + Name = null, + Type = "0x06", + Length = 245889, + Sequence = 2, + Start = 431487 }, new Partition { Description = null, - Name = null, - Type = "0x06", - Length = 267057, - Sequence = 3, - Start = 677439 + Name = null, + Type = "0x06", + Length = 267057, + Sequence = 3, + Start = 677439 }, new Partition { Description = null, - Name = null, - Type = "0x04", - Length = 51345, - Sequence = 4, - Start = 944559 + Name = null, + Type = "0x04", + Length = 51345, + Sequence = 4, + Start = 944559 }, new Partition { Description = null, - Name = null, - Type = "0x01", - Length = 6993, - Sequence = 5, - Start = 995967 + Name = null, + Type = "0x01", + Length = 6993, + Sequence = 5, + Start = 995967 }, new Partition { Description = null, - Name = null, - Type = "0x01", - Length = 19089, - Sequence = 6, - Start = 1003023 + Name = null, + Type = "0x01", + Length = 19089, + Sequence = 6, + Start = 1003023 } }, // MS-DOS 6.22 @@ -1169,47 +1169,47 @@ namespace DiscImageChef.Tests.Partitions new Partition { Description = null, - Name = null, - Type = "0x06", - Length = 245889, - Sequence = 0, - Start = 63 + Name = null, + Type = "0x06", + Length = 245889, + Sequence = 0, + Start = 63 }, new Partition { Description = null, - Name = null, - Type = "0x06", - Length = 205569, - Sequence = 1, - Start = 246015 + Name = null, + Type = "0x06", + Length = 205569, + Sequence = 1, + Start = 246015 }, new Partition { Description = null, - Name = null, - Type = "0x06", - Length = 307377, - Sequence = 2, - Start = 451647 + Name = null, + Type = "0x06", + Length = 307377, + Sequence = 2, + Start = 451647 }, new Partition { Description = null, - Name = null, - Type = "0x06", - Length = 225729, - Sequence = 3, - Start = 759087 + Name = null, + Type = "0x06", + Length = 225729, + Sequence = 3, + Start = 759087 }, new Partition { Description = null, - Name = null, - Type = "0x04", - Length = 37233, - Sequence = 4, - Start = 984879 + Name = null, + Type = "0x04", + Length = 37233, + Sequence = 4, + Start = 984879 } }, // Multiuser DOS 7.22 release 04 @@ -1218,47 +1218,47 @@ namespace DiscImageChef.Tests.Partitions new Partition { Description = null, - Name = null, - Type = "0x06", - Length = 152145, - Sequence = 0, - Start = 63 + Name = null, + Type = "0x06", + Length = 152145, + Sequence = 0, + Start = 63 }, new Partition { Description = null, - Name = null, - Type = "0x06", - Length = 99729, - Sequence = 1, - Start = 152271 + Name = null, + Type = "0x06", + Length = 99729, + Sequence = 1, + Start = 152271 }, new Partition { Description = null, - Name = null, - Type = "0x06", - Length = 202545, - Sequence = 2, - Start = 252063 + Name = null, + Type = "0x06", + Length = 202545, + Sequence = 2, + Start = 252063 }, new Partition { Description = null, - Name = null, - Type = "0x01", - Length = 1953, - Sequence = 3, - Start = 454671 + Name = null, + Type = "0x01", + Length = 1953, + Sequence = 3, + Start = 454671 }, new Partition { Description = null, - Name = null, - Type = "0x06", - Length = 565425, - Sequence = 4, - Start = 456687 + Name = null, + Type = "0x06", + Length = 565425, + Sequence = 4, + Start = 456687 } }, // Novell DOS 7.0 @@ -1267,47 +1267,47 @@ namespace DiscImageChef.Tests.Partitions new Partition { Description = null, - Name = null, - Type = "0x06", - Length = 252945, - Sequence = 0, - Start = 63 + Name = null, + Type = "0x06", + Length = 252945, + Sequence = 0, + Start = 63 }, new Partition { Description = null, - Name = null, - Type = "0x01", - Length = 4977, - Sequence = 1, - Start = 253071 + Name = null, + Type = "0x01", + Length = 4977, + Sequence = 1, + Start = 253071 }, new Partition { Description = null, - Name = null, - Type = "0x06", - Length = 202545, - Sequence = 2, - Start = 352863 + Name = null, + Type = "0x06", + Length = 202545, + Sequence = 2, + Start = 352863 }, new Partition { Description = null, - Name = null, - Type = "0x06", - Length = 348705, - Sequence = 3, - Start = 555471 + Name = null, + Type = "0x06", + Length = 348705, + Sequence = 3, + Start = 555471 }, new Partition { Description = null, - Name = null, - Type = "0x06", - Length = 117873, - Sequence = 4, - Start = 904239 + Name = null, + Type = "0x06", + Length = 117873, + Sequence = 4, + Start = 904239 } }, // OpenDOS 7.01 @@ -1316,47 +1316,47 @@ namespace DiscImageChef.Tests.Partitions new Partition { Description = null, - Name = null, - Type = "0x06", - Length = 307377, - Sequence = 0, - Start = 63 + Name = null, + Type = "0x06", + Length = 307377, + Sequence = 0, + Start = 63 }, new Partition { Description = null, - Name = null, - Type = "0x01", - Length = 4977, - Sequence = 1, - Start = 307503 + Name = null, + Type = "0x01", + Length = 4977, + Sequence = 1, + Start = 307503 }, new Partition { Description = null, - Name = null, - Type = "0x04", - Length = 40257, - Sequence = 2, - Start = 312543 + Name = null, + Type = "0x04", + Length = 40257, + Sequence = 2, + Start = 312543 }, new Partition { Description = null, - Name = null, - Type = "0x06", - Length = 202545, - Sequence = 3, - Start = 352863 + Name = null, + Type = "0x06", + Length = 202545, + Sequence = 3, + Start = 352863 }, new Partition { Description = null, - Name = null, - Type = "0x06", - Length = 466641, - Sequence = 4, - Start = 555471 + Name = null, + Type = "0x06", + Length = 466641, + Sequence = 4, + Start = 555471 } }, // Parted @@ -1365,29 +1365,29 @@ namespace DiscImageChef.Tests.Partitions new Partition { Description = null, - Name = null, - Type = "0x83", - Length = 67584, - Sequence = 0, - Start = 4096 + Name = null, + Type = "0x83", + Length = 67584, + Sequence = 0, + Start = 4096 }, new Partition { Description = null, - Name = null, - Type = "0x07", - Length = 59392, - Sequence = 1, - Start = 73728 + Name = null, + Type = "0x07", + Length = 59392, + Sequence = 1, + Start = 73728 }, new Partition { Description = null, - Name = null, - Type = "0x06", - Length = 129024, - Sequence = 2, - Start = 133120 + Name = null, + Type = "0x06", + Length = 129024, + Sequence = 2, + Start = 133120 } }, // PC-DOS 2000 @@ -1396,47 +1396,47 @@ namespace DiscImageChef.Tests.Partitions new Partition { Description = null, - Name = null, - Type = "0x06", - Length = 205569, - Sequence = 0, - Start = 63 + Name = null, + Type = "0x06", + Length = 205569, + Sequence = 0, + Start = 63 }, new Partition { Description = null, - Name = null, - Type = "0x06", - Length = 225729, - Sequence = 1, - Start = 205695 + Name = null, + Type = "0x06", + Length = 225729, + Sequence = 1, + Start = 205695 }, new Partition { Description = null, - Name = null, - Type = "0x06", - Length = 245889, - Sequence = 2, - Start = 431487 + Name = null, + Type = "0x06", + Length = 245889, + Sequence = 2, + Start = 431487 }, new Partition { Description = null, - Name = null, - Type = "0x06", - Length = 287217, - Sequence = 3, - Start = 677439 + Name = null, + Type = "0x06", + Length = 287217, + Sequence = 3, + Start = 677439 }, new Partition { Description = null, - Name = null, - Type = "0x04", - Length = 57393, - Sequence = 4, - Start = 964719 + Name = null, + Type = "0x04", + Length = 57393, + Sequence = 4, + Start = 964719 } }, // PC-DOS 2.00 @@ -1445,11 +1445,11 @@ namespace DiscImageChef.Tests.Partitions new Partition { Description = null, - Name = null, - Type = "0x01", - Length = 1022111, - Sequence = 0, - Start = 1 + Name = null, + Type = "0x01", + Length = 1022111, + Sequence = 0, + Start = 1 } }, // PC-DOS 2.10 @@ -1458,11 +1458,11 @@ namespace DiscImageChef.Tests.Partitions new Partition { Description = null, - Name = null, - Type = "0x01", - Length = 1022111, - Sequence = 0, - Start = 1 + Name = null, + Type = "0x01", + Length = 1022111, + Sequence = 0, + Start = 1 } }, // PC-DOS 3.00 @@ -1481,146 +1481,146 @@ namespace DiscImageChef.Tests.Partitions new Partition { Description = null, - Name = null, - Type = "0x04", - Length = 65457, - Sequence = 0, - Start = 63 + Name = null, + Type = "0x04", + Length = 65457, + Sequence = 0, + Start = 63 }, new Partition { Description = null, - Name = null, - Type = "0x04", - Length = 65457, - Sequence = 1, - Start = 65583 + Name = null, + Type = "0x04", + Length = 65457, + Sequence = 1, + Start = 65583 }, new Partition { Description = null, - Name = null, - Type = "0x04", - Length = 65457, - Sequence = 2, - Start = 131103 + Name = null, + Type = "0x04", + Length = 65457, + Sequence = 2, + Start = 131103 }, new Partition { Description = null, - Name = null, - Type = "0x04", - Length = 65457, - Sequence = 3, - Start = 196623 + Name = null, + Type = "0x04", + Length = 65457, + Sequence = 3, + Start = 196623 }, new Partition { Description = null, - Name = null, - Type = "0x04", - Length = 65457, - Sequence = 4, - Start = 262143 + Name = null, + Type = "0x04", + Length = 65457, + Sequence = 4, + Start = 262143 }, new Partition { Description = null, - Name = null, - Type = "0x04", - Length = 65457, - Sequence = 5, - Start = 327663 + Name = null, + Type = "0x04", + Length = 65457, + Sequence = 5, + Start = 327663 }, new Partition { Description = null, - Name = null, - Type = "0x04", - Length = 65457, - Sequence = 6, - Start = 393183 + Name = null, + Type = "0x04", + Length = 65457, + Sequence = 6, + Start = 393183 }, new Partition { Description = null, - Name = null, - Type = "0x04", - Length = 65457, - Sequence = 7, - Start = 458703 + Name = null, + Type = "0x04", + Length = 65457, + Sequence = 7, + Start = 458703 }, new Partition { Description = null, - Name = null, - Type = "0x04", - Length = 65457, - Sequence = 8, - Start = 524223 + Name = null, + Type = "0x04", + Length = 65457, + Sequence = 8, + Start = 524223 }, new Partition { Description = null, - Name = null, - Type = "0x04", - Length = 65457, - Sequence = 9, - Start = 589743 + Name = null, + Type = "0x04", + Length = 65457, + Sequence = 9, + Start = 589743 }, new Partition { Description = null, - Name = null, - Type = "0x04", - Length = 65457, - Sequence = 10, - Start = 655263 + Name = null, + Type = "0x04", + Length = 65457, + Sequence = 10, + Start = 655263 }, new Partition { Description = null, - Name = null, - Type = "0x04", - Length = 65457, - Sequence = 11, - Start = 720783 + Name = null, + Type = "0x04", + Length = 65457, + Sequence = 11, + Start = 720783 }, new Partition { Description = null, - Name = null, - Type = "0x04", - Length = 65457, - Sequence = 12, - Start = 786303 + Name = null, + Type = "0x04", + Length = 65457, + Sequence = 12, + Start = 786303 }, new Partition { Description = null, - Name = null, - Type = "0x04", - Length = 65457, - Sequence = 13, - Start = 851823 + Name = null, + Type = "0x04", + Length = 65457, + Sequence = 13, + Start = 851823 }, new Partition { Description = null, - Name = null, - Type = "0x04", - Length = 65457, - Sequence = 14, - Start = 917343 + Name = null, + Type = "0x04", + Length = 65457, + Sequence = 14, + Start = 917343 }, new Partition { Description = null, - Name = null, - Type = "0x04", - Length = 39249, - Sequence = 15, - Start = 982863 + Name = null, + Type = "0x04", + Length = 39249, + Sequence = 15, + Start = 982863 } }, // PC-DOS 4.00 @@ -1629,47 +1629,47 @@ namespace DiscImageChef.Tests.Partitions new Partition { Description = null, - Name = null, - Type = "0x06", - Length = 205569, - Sequence = 0, - Start = 63 + Name = null, + Type = "0x06", + Length = 205569, + Sequence = 0, + Start = 63 }, new Partition { Description = null, - Name = null, - Type = "0x01", - Length = 25137, - Sequence = 1, - Start = 205695 + Name = null, + Type = "0x01", + Length = 25137, + Sequence = 1, + Start = 205695 }, new Partition { Description = null, - Name = null, - Type = "0x06", - Length = 245889, - Sequence = 2, - Start = 230895 + Name = null, + Type = "0x06", + Length = 245889, + Sequence = 2, + Start = 230895 }, new Partition { Description = null, - Name = null, - Type = "0x06", - Length = 307377, - Sequence = 3, - Start = 476847 + Name = null, + Type = "0x06", + Length = 307377, + Sequence = 3, + Start = 476847 }, new Partition { Description = null, - Name = null, - Type = "0x06", - Length = 237825, - Sequence = 4, - Start = 784287 + Name = null, + Type = "0x06", + Length = 237825, + Sequence = 4, + Start = 784287 } }, // PC-DOS 5.00 @@ -1678,47 +1678,47 @@ namespace DiscImageChef.Tests.Partitions new Partition { Description = null, - Name = null, - Type = "0x06", - Length = 205569, - Sequence = 0, - Start = 63 + Name = null, + Type = "0x06", + Length = 205569, + Sequence = 0, + Start = 63 }, new Partition { Description = null, - Name = null, - Type = "0x01", - Length = 25137, - Sequence = 1, - Start = 205695 + Name = null, + Type = "0x01", + Length = 25137, + Sequence = 1, + Start = 205695 }, new Partition { Description = null, - Name = null, - Type = "0x06", - Length = 245889, - Sequence = 2, - Start = 230895 + Name = null, + Type = "0x06", + Length = 245889, + Sequence = 2, + Start = 230895 }, new Partition { Description = null, - Name = null, - Type = "0x06", - Length = 287217, - Sequence = 3, - Start = 476847 + Name = null, + Type = "0x06", + Length = 287217, + Sequence = 3, + Start = 476847 }, new Partition { Description = null, - Name = null, - Type = "0x06", - Length = 257985, - Sequence = 4, - Start = 764127 + Name = null, + Type = "0x06", + Length = 257985, + Sequence = 4, + Start = 764127 } }, // PC-DOS 6.10 @@ -1727,47 +1727,47 @@ namespace DiscImageChef.Tests.Partitions new Partition { Description = null, - Name = null, - Type = "0x06", - Length = 205569, - Sequence = 0, - Start = 63 + Name = null, + Type = "0x06", + Length = 205569, + Sequence = 0, + Start = 63 }, new Partition { Description = null, - Name = null, - Type = "0x01", - Length = 25137, - Sequence = 1, - Start = 205695 + Name = null, + Type = "0x01", + Length = 25137, + Sequence = 1, + Start = 205695 }, new Partition { Description = null, - Name = null, - Type = "0x06", - Length = 225729, - Sequence = 2, - Start = 230895 + Name = null, + Type = "0x06", + Length = 225729, + Sequence = 2, + Start = 230895 }, new Partition { Description = null, - Name = null, - Type = "0x06", - Length = 245889, - Sequence = 3, - Start = 456687 + Name = null, + Type = "0x06", + Length = 245889, + Sequence = 3, + Start = 456687 }, new Partition { Description = null, - Name = null, - Type = "0x06", - Length = 319473, - Sequence = 4, - Start = 702639 + Name = null, + Type = "0x06", + Length = 319473, + Sequence = 4, + Start = 702639 } }, // Windows 95 @@ -1776,47 +1776,47 @@ namespace DiscImageChef.Tests.Partitions new Partition { Description = null, - Name = null, - Type = "0x06", - Length = 205569, - Sequence = 0, - Start = 63 + Name = null, + Type = "0x06", + Length = 205569, + Sequence = 0, + Start = 63 }, new Partition { Description = null, - Name = null, - Type = "0x06", - Length = 245889, - Sequence = 1, - Start = 205695 + Name = null, + Type = "0x06", + Length = 245889, + Sequence = 1, + Start = 205695 }, new Partition { Description = null, - Name = null, - Type = "0x06", - Length = 267057, - Sequence = 2, - Start = 451647 + Name = null, + Type = "0x06", + Length = 267057, + Sequence = 2, + Start = 451647 }, new Partition { Description = null, - Name = null, - Type = "0x06", - Length = 287217, - Sequence = 3, - Start = 718767 + Name = null, + Type = "0x06", + Length = 287217, + Sequence = 3, + Start = 718767 }, new Partition { Description = null, - Name = null, - Type = "0x01", - Length = 17073, - Sequence = 4, - Start = 1006047 + Name = null, + Type = "0x01", + Length = 17073, + Sequence = 4, + Start = 1006047 } }, // Windows 95 OSR 2.5 @@ -1825,56 +1825,56 @@ namespace DiscImageChef.Tests.Partitions new Partition { Description = null, - Name = null, - Type = "0x06", - Length = 307377, - Sequence = 0, - Start = 63 + Name = null, + Type = "0x06", + Length = 307377, + Sequence = 0, + Start = 63 }, new Partition { Description = null, - Name = null, - Type = "0x06", - Length = 245889, - Sequence = 1, - Start = 307503 + Name = null, + Type = "0x06", + Length = 245889, + Sequence = 1, + Start = 307503 }, new Partition { Description = null, - Name = null, - Type = "0x06", - Length = 328545, - Sequence = 2, - Start = 553455 + Name = null, + Type = "0x06", + Length = 328545, + Sequence = 2, + Start = 553455 }, new Partition { Description = null, - Name = null, - Type = "0x06", - Length = 102753, - Sequence = 3, - Start = 882063 + Name = null, + Type = "0x06", + Length = 102753, + Sequence = 3, + Start = 882063 }, new Partition { Description = null, - Name = null, - Type = "0x01", - Length = 21105, - Sequence = 4, - Start = 984879 + Name = null, + Type = "0x01", + Length = 21105, + Sequence = 4, + Start = 984879 }, new Partition { Description = null, - Name = null, - Type = "0x01", - Length = 17073, - Sequence = 5, - Start = 1006047 + Name = null, + Type = "0x01", + Length = 17073, + Sequence = 5, + Start = 1006047 } }, // Windows NT 3.10 @@ -1883,56 +1883,56 @@ namespace DiscImageChef.Tests.Partitions new Partition { Description = null, - Name = null, - Type = "0x07", - Length = 204561, - Sequence = 0, - Start = 63 + Name = null, + Type = "0x07", + Length = 204561, + Sequence = 0, + Start = 63 }, new Partition { Description = null, - Name = null, - Type = "0x07", - Length = 307377, - Sequence = 1, - Start = 204687 + Name = null, + Type = "0x07", + Length = 307377, + Sequence = 1, + Start = 204687 }, new Partition { Description = null, - Name = null, - Type = "0x06", - Length = 224721, - Sequence = 2, - Start = 512127 + Name = null, + Type = "0x06", + Length = 224721, + Sequence = 2, + Start = 512127 }, new Partition { Description = null, - Name = null, - Type = "0x06", - Length = 214641, - Sequence = 3, - Start = 736911 + Name = null, + Type = "0x06", + Length = 214641, + Sequence = 3, + Start = 736911 }, new Partition { Description = null, - Name = null, - Type = "0x01", - Length = 10017, - Sequence = 4, - Start = 951615 + Name = null, + Type = "0x01", + Length = 10017, + Sequence = 4, + Start = 951615 }, new Partition { Description = null, - Name = null, - Type = "0x07", - Length = 60480, - Sequence = 5, - Start = 962640 + Name = null, + Type = "0x07", + Length = 60480, + Sequence = 5, + Start = 962640 } } }; @@ -1942,8 +1942,8 @@ namespace DiscImageChef.Tests.Partitions { for(int i = 0; i < testfiles.Length; i++) { - string location = Path.Combine(Consts.TestFilesRoot, "partitions", "mbr", testfiles[i]); - IFilter filter = new LZip(); + string location = Path.Combine(Consts.TestFilesRoot, "partitions", "mbr", testfiles[i]); + IFilter filter = new LZip(); filter.Open(location); IMediaImage image = new Vdi(); Assert.AreEqual(true, image.Open(filter), testfiles[i]); @@ -1955,11 +1955,11 @@ namespace DiscImageChef.Tests.Partitions //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].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]); - Assert.AreEqual(wanted[i][j].Sequence, partitions[j].Sequence, testfiles[i]); - Assert.AreEqual(wanted[i][j].Start, partitions[j].Start, 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]); + Assert.AreEqual(wanted[i][j].Sequence, partitions[j].Sequence, testfiles[i]); + Assert.AreEqual(wanted[i][j].Start, partitions[j].Start, testfiles[i]); } } } diff --git a/DiscImageChef.Tests/Partitions/MINIX.cs b/DiscImageChef.Tests/Partitions/MINIX.cs index b2086feba..0f29220b0 100644 --- a/DiscImageChef.Tests/Partitions/MINIX.cs +++ b/DiscImageChef.Tests/Partitions/MINIX.cs @@ -48,46 +48,46 @@ namespace DiscImageChef.Tests.Partitions new Partition { Description = null, - Size = 268369408, - Name = "MINIX", - Type = "MINIX", - Offset = 2064896, - Length = 524159, - Sequence = 0, - Start = 4033 + 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 + 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 + 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 + Size = 262176768, + Name = "MINIX", + Type = "MINIX", + Offset = 811302912, + Length = 512064, + Sequence = 3, + Start = 1584576 } } }; @@ -97,8 +97,8 @@ namespace DiscImageChef.Tests.Partitions { for(int i = 0; i < testfiles.Length; i++) { - string location = Path.Combine(Consts.TestFilesRoot, "partitions", "minix", testfiles[i]); - IFilter filter = new LZip(); + string location = Path.Combine(Consts.TestFilesRoot, "partitions", "minix", testfiles[i]); + IFilter filter = new LZip(); filter.Open(location); IMediaImage image = new Vdi(); Assert.AreEqual(true, image.Open(filter), testfiles[i]); @@ -110,11 +110,11 @@ namespace DiscImageChef.Tests.Partitions //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].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]); + 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]); Assert.AreEqual(wanted[i][j].Sequence, partitions[j].Sequence, testfiles[i]); - Assert.AreEqual(wanted[i][j].Start, partitions[j].Start, testfiles[i]); + Assert.AreEqual(wanted[i][j].Start, partitions[j].Start, testfiles[i]); } } } diff --git a/DiscImageChef.Tests/Partitions/PC98.cs b/DiscImageChef.Tests/Partitions/PC98.cs index b59dc39a4..da74492a4 100644 --- a/DiscImageChef.Tests/Partitions/PC98.cs +++ b/DiscImageChef.Tests/Partitions/PC98.cs @@ -49,74 +49,74 @@ namespace DiscImageChef.Tests.Partitions new Partition { Description = null, - Name = "MS-DOS 3.30", - Type = "FAT12", - Length = 19536, - Sequence = 0, - Start = 264 + 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 + 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 + 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 + 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 + 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 + 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 + 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 + Name = "MS-DOS 3.30", + Type = "FAT16", + Length = 245256, + Sequence = 7, + Start = 752664 } }, // NEC MS-DOS 3.30 (80Mb HDD) @@ -125,29 +125,29 @@ namespace DiscImageChef.Tests.Partitions new Partition { Description = null, - Name = "MS-DOS 3.30", - Type = "FAT16", - Length = 59136, - Sequence = 0, - Start = 264 + 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 + 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 + Name = "MS-DOS 3.30", + Type = "FAT16", + Length = 94776, + Sequence = 2, + Start = 218064 } }, // Epson MS-DOS 3.30 @@ -156,74 +156,74 @@ namespace DiscImageChef.Tests.Partitions new Partition { Description = null, - Name = "NamenameName", - Type = "FAT12", - Length = 35639, - Sequence = 0, - Start = 264 + Name = "NamenameName", + Type = "FAT12", + Length = 35639, + Sequence = 0, + Start = 264 }, new Partition { Description = null, - Name = "12BitFAT", - Type = "FAT12", - Length = 59399, - Sequence = 1, - Start = 35904 + Name = "12BitFAT", + Type = "FAT12", + Length = 59399, + Sequence = 1, + Start = 35904 }, new Partition { Description = null, - Name = "16BitFAT", - Type = "FAT16", - Length = 79199, - Sequence = 2, - Start = 95304 + Name = "16BitFAT", + Type = "FAT16", + Length = 79199, + Sequence = 2, + Start = 95304 }, new Partition { Description = null, - Name = "PartLblMaxNameXX", - Type = "FAT16", - Length = 118799, - Sequence = 3, - Start = 174504 + Name = "PartLblMaxNameXX", + Type = "FAT16", + Length = 118799, + Sequence = 3, + Start = 174504 }, new Partition { Description = null, - Name = "BigFAT12", - Type = "FAT12", - Length = 158399, - Sequence = 4, - Start = 293304 + Name = "BigFAT12", + Type = "FAT12", + Length = 158399, + Sequence = 4, + Start = 293304 }, new Partition { Description = null, - Name = "Lalalalalalalala", - Type = "FAT16", - Length = 197999, - Sequence = 5, - Start = 451704 + 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 + 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 + Name = "MS-DOS Ver 5.0", + Type = "FAT16", + Length = 118799, + Sequence = 7, + Start = 887304 } }, // NEC MS-DOS 5.00 @@ -232,74 +232,74 @@ namespace DiscImageChef.Tests.Partitions new Partition { Description = null, - Name = "MS-DOS 5.00", - Type = "FAT12", - Length = 28512, - Sequence = 0, - Start = 264 + 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 + 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 + 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 + 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 + 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 + 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 + 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 + Name = "MS-DOS 5.00", + Type = "FAT16", + Length = 139128, + Sequence = 7, + Start = 869352 } }, // NEC MS-DOS 6.20 @@ -308,65 +308,65 @@ namespace DiscImageChef.Tests.Partitions new Partition { Description = null, - Name = "MS-DOS 6.20", - Type = "FAT16", - Length = 61248, - Sequence = 0, - Start = 264 + 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 + 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 + 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 + 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 + 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 + 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 + Name = "MS-DOS 6.20", + Type = "FAT16", + Length = 315216, + Sequence = 6, + Start = 697224 } } }; @@ -376,8 +376,8 @@ namespace DiscImageChef.Tests.Partitions { for(int i = 0; i < testfiles.Length; i++) { - string location = Path.Combine(Consts.TestFilesRoot, "partitions", "pc98", testfiles[i]); - IFilter filter = new LZip(); + string location = Path.Combine(Consts.TestFilesRoot, "partitions", "pc98", testfiles[i]); + IFilter filter = new LZip(); filter.Open(location); IMediaImage image = new T98(); Assert.AreEqual(true, image.Open(filter), testfiles[i]); @@ -387,11 +387,11 @@ namespace DiscImageChef.Tests.Partitions { // Too chatty //Assert.AreEqual(wanted[i][j].PartitionDescription, partitions[j].PartitionDescription, testfiles[i]); - Assert.AreEqual(wanted[i][j].Length, partitions[j].Length, 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].Length, partitions[j].Length, 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].Sequence, partitions[j].Sequence, testfiles[i]); - Assert.AreEqual(wanted[i][j].Start, partitions[j].Start, testfiles[i]); + Assert.AreEqual(wanted[i][j].Start, partitions[j].Start, testfiles[i]); } } } diff --git a/DiscImageChef.Tests/Partitions/RDB.cs b/DiscImageChef.Tests/Partitions/RDB.cs index f730833bc..442686fc6 100644 --- a/DiscImageChef.Tests/Partitions/RDB.cs +++ b/DiscImageChef.Tests/Partitions/RDB.cs @@ -48,68 +48,68 @@ namespace DiscImageChef.Tests.Partitions new Partition { Description = null, - Size = 87392256, - Name = "UDH0", - Type = "\"DOS\\0\"", - Offset = 2080768, - Length = 170688, - Sequence = 0, - Start = 4064 + 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 + 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 + 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 + 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 + 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 + Size = 85311488, + Name = "UDH5", + Type = "\"RES\\86\"", + Offset = 439042048, + Length = 166624, + Sequence = 5, + Start = 857504 } }, // AmigaOS 4.0 @@ -118,68 +118,68 @@ namespace DiscImageChef.Tests.Partitions new Partition { Description = null, - Size = 91455488, - Name = "DH1", - Type = "\"DOS\\1\"", - Offset = 1048576, - Length = 178624, - Sequence = 0, - Start = 2048 + 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 + 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 + 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 + 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 + 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 + Size = 113541120, + Name = "DH6", + Type = "\"SFS\\2\"", + Offset = 410812416, + Length = 221760, + Sequence = 5, + Start = 802368 } }, // Parted @@ -188,35 +188,35 @@ namespace DiscImageChef.Tests.Partitions new Partition { Description = null, - Size = 8225280, - Name = "primary", - Type = "\"\0\0\0\\0\"", - Offset = 8225280, - Length = 16065, - Sequence = 0, - Start = 16065 + 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 + 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 + Size = 90478080, + Name = "partition", + Type = "\"\0\0\0\\0\"", + Offset = 41126400, + Length = 176715, + Sequence = 2, + Start = 80325 } } }; @@ -226,8 +226,8 @@ namespace DiscImageChef.Tests.Partitions { for(int i = 0; i < testfiles.Length; i++) { - string location = Path.Combine(Consts.TestFilesRoot, "partitions", "rdb", testfiles[i]); - IFilter filter = new LZip(); + string location = Path.Combine(Consts.TestFilesRoot, "partitions", "rdb", testfiles[i]); + IFilter filter = new LZip(); filter.Open(location); IMediaImage image = new Vdi(); Assert.AreEqual(true, image.Open(filter), testfiles[i]); @@ -237,13 +237,13 @@ 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].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]); + 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].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]); Assert.AreEqual(wanted[i][j].Sequence, partitions[j].Sequence, testfiles[i]); - Assert.AreEqual(wanted[i][j].Start, partitions[j].Start, testfiles[i]); + Assert.AreEqual(wanted[i][j].Start, partitions[j].Start, testfiles[i]); } } } diff --git a/DiscImageChef.Tests/Partitions/SGI.cs b/DiscImageChef.Tests/Partitions/SGI.cs index b97fc7741..5b9863162 100644 --- a/DiscImageChef.Tests/Partitions/SGI.cs +++ b/DiscImageChef.Tests/Partitions/SGI.cs @@ -48,128 +48,128 @@ namespace DiscImageChef.Tests.Partitions new Partition { Description = null, - Name = null, - Type = "XFS", - Length = 40961, - Sequence = 0, - Start = 16065 + 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 + 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 + 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 + 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 + 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 + 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 + 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 + 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 + 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 + 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 + 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 + 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 + 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 + Name = null, + Type = "Linux", + Length = 64260, + Sequence = 13, + Start = 947835 } }, // GNU Parted @@ -178,38 +178,38 @@ namespace DiscImageChef.Tests.Partitions new Partition { Description = null, - Name = null, - Type = "Raw data (swap)", - Length = 22528, - Sequence = 0, - Start = 6144 + 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 + 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 + 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 + Name = null, + Type = "XFS", + Length = 36864, + Sequence = 3, + Start = 196608 } } }; @@ -219,8 +219,8 @@ namespace DiscImageChef.Tests.Partitions { for(int i = 0; i < testfiles.Length; i++) { - string location = Path.Combine(Consts.TestFilesRoot, "partitions", "sgi", testfiles[i]); - IFilter filter = new LZip(); + string location = Path.Combine(Consts.TestFilesRoot, "partitions", "sgi", testfiles[i]); + IFilter filter = new LZip(); filter.Open(location); IMediaImage image = new Vdi(); Assert.AreEqual(true, image.Open(filter), testfiles[i]); @@ -232,11 +232,11 @@ namespace DiscImageChef.Tests.Partitions //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].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]); - Assert.AreEqual(wanted[i][j].Sequence, partitions[j].Sequence, testfiles[i]); - Assert.AreEqual(wanted[i][j].Start, partitions[j].Start, 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]); + Assert.AreEqual(wanted[i][j].Sequence, partitions[j].Sequence, testfiles[i]); + Assert.AreEqual(wanted[i][j].Start, partitions[j].Start, testfiles[i]); } } } diff --git a/DiscImageChef.Tests/Partitions/Sun.cs b/DiscImageChef.Tests/Partitions/Sun.cs index 5045ff902..68ee7e35f 100644 --- a/DiscImageChef.Tests/Partitions/Sun.cs +++ b/DiscImageChef.Tests/Partitions/Sun.cs @@ -49,65 +49,65 @@ namespace DiscImageChef.Tests.Partitions new Partition { Description = null, - Name = null, - Type = "Linux", - Length = 204800, - Sequence = 0, - Start = 0 + 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 + 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 + 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 + 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 + 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 + 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 + Name = null, + Type = "Linux swap", + Length = 96390, + Sequence = 6, + Start = 915705 } }, // GNU Parted @@ -116,29 +116,29 @@ namespace DiscImageChef.Tests.Partitions new Partition { Description = null, - Name = null, - Type = "Linux", - Length = 49152, - Sequence = 0, - Start = 0 + Name = null, + Type = "Linux", + Length = 49152, + Sequence = 0, + Start = 0 }, new Partition { Description = null, - Name = null, - Type = "Linux", - Length = 80325, - Sequence = 1, - Start = 64260 + Name = null, + Type = "Linux", + Length = 80325, + Sequence = 1, + Start = 64260 }, new Partition { Description = null, - Name = null, - Type = "Linux", - Length = 96390, - Sequence = 2, - Start = 144585 + Name = null, + Type = "Linux", + Length = 96390, + Sequence = 2, + Start = 144585 } } }; @@ -148,8 +148,8 @@ namespace DiscImageChef.Tests.Partitions { for(int i = 0; i < testfiles.Length; i++) { - string location = Path.Combine(Consts.TestFilesRoot, "partitions", "sun", testfiles[i]); - IFilter filter = new LZip(); + string location = Path.Combine(Consts.TestFilesRoot, "partitions", "sun", testfiles[i]); + IFilter filter = new LZip(); filter.Open(location); IMediaImage image = new Vdi(); Assert.AreEqual(true, image.Open(filter), testfiles[i]); @@ -161,11 +161,11 @@ namespace DiscImageChef.Tests.Partitions //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].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]); - Assert.AreEqual(wanted[i][j].Sequence, partitions[j].Sequence, testfiles[i]); - Assert.AreEqual(wanted[i][j].Start, partitions[j].Start, 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]); + Assert.AreEqual(wanted[i][j].Sequence, partitions[j].Sequence, testfiles[i]); + Assert.AreEqual(wanted[i][j].Start, partitions[j].Start, testfiles[i]); } } } diff --git a/DiscImageChef.Tests/Partitions/VTOC.cs b/DiscImageChef.Tests/Partitions/VTOC.cs index 49ebc45d2..cbeabda08 100644 --- a/DiscImageChef.Tests/Partitions/VTOC.cs +++ b/DiscImageChef.Tests/Partitions/VTOC.cs @@ -48,146 +48,146 @@ namespace DiscImageChef.Tests.Partitions new Partition { Description = null, - Name = null, - Type = "UNIX: Boot", - Length = 34, - Sequence = 0, - Start = 1 + 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 + 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 + 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 + 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 + 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 + 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 + 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 + 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 + 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 + 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 + 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 + 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 + 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 + 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 + 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 + Name = null, + Type = "UNIX: /usr", + Length = 84672, + Sequence = 15, + Start = 937818 } } }; @@ -197,8 +197,8 @@ namespace DiscImageChef.Tests.Partitions { for(int i = 0; i < testfiles.Length; i++) { - string location = Path.Combine(Consts.TestFilesRoot, "partitions", "vtoc", testfiles[i]); - IFilter filter = new LZip(); + string location = Path.Combine(Consts.TestFilesRoot, "partitions", "vtoc", testfiles[i]); + IFilter filter = new LZip(); filter.Open(location); IMediaImage image = new Vdi(); Assert.AreEqual(true, image.Open(filter), testfiles[i]); @@ -210,11 +210,11 @@ namespace DiscImageChef.Tests.Partitions //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].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]); - Assert.AreEqual(wanted[i][j].Sequence, partitions[j].Sequence, testfiles[i]); - Assert.AreEqual(wanted[i][j].Start, partitions[j].Start, 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]); + Assert.AreEqual(wanted[i][j].Sequence, partitions[j].Sequence, testfiles[i]); + Assert.AreEqual(wanted[i][j].Start, partitions[j].Start, testfiles[i]); } } } diff --git a/DiscImageChef.Tests/Program.cs b/DiscImageChef.Tests/Program.cs index 2cfd0727e..c9f381813 100644 --- a/DiscImageChef.Tests/Program.cs +++ b/DiscImageChef.Tests/Program.cs @@ -26,8 +26,8 @@ namespace NUnitLite.Tests public static class Program { /// - /// The main program executes the tests. Output may be routed to - /// various locations, depending on the arguments passed. + /// The main program executes the tests. Output may be routed to + /// various locations, depending on the arguments passed. /// /// Run with --help for a full list of arguments supported /// diff --git a/DiscImageChef/Commands/Analyze.cs b/DiscImageChef/Commands/Analyze.cs index 70c871b03..eb186ffdd 100644 --- a/DiscImageChef/Commands/Analyze.cs +++ b/DiscImageChef/Commands/Analyze.cs @@ -46,15 +46,15 @@ namespace DiscImageChef.Commands { internal static void DoAnalyze(AnalyzeOptions options) { - DicConsole.DebugWriteLine("Analyze command", "--debug={0}", options.Debug); - DicConsole.DebugWriteLine("Analyze command", "--verbose={0}", options.Verbose); - DicConsole.DebugWriteLine("Analyze command", "--input={0}", options.InputFile); + DicConsole.DebugWriteLine("Analyze command", "--debug={0}", options.Debug); + DicConsole.DebugWriteLine("Analyze command", "--verbose={0}", options.Verbose); + DicConsole.DebugWriteLine("Analyze command", "--input={0}", options.InputFile); DicConsole.DebugWriteLine("Analyze command", "--filesystems={0}", options.SearchForFilesystems); - DicConsole.DebugWriteLine("Analyze command", "--partitions={0}", options.SearchForPartitions); - DicConsole.DebugWriteLine("Analyze command", "--encoding={0}", options.EncodingName); + DicConsole.DebugWriteLine("Analyze command", "--partitions={0}", options.SearchForPartitions); + DicConsole.DebugWriteLine("Analyze command", "--encoding={0}", options.EncodingName); FiltersList filtersList = new FiltersList(); - IFilter inputFilter = filtersList.GetFilter(options.InputFile); + IFilter inputFilter = filtersList.GetFilter(options.InputFile); if(inputFilter == null) { @@ -124,8 +124,8 @@ namespace DiscImageChef.Commands } List idPlugins; - IFilesystem plugin; - string information; + IFilesystem plugin; + string information; if(options.SearchForPartitions) { List partitions = Core.Partitions.GetAll(imageFormat); @@ -149,7 +149,7 @@ namespace DiscImageChef.Commands for(int i = 0; i < partitions.Count; i++) { DicConsole.WriteLine(); - DicConsole.WriteLine("Partition {0}:", partitions[i].Sequence); + 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, @@ -165,7 +165,7 @@ namespace DiscImageChef.Commands DicConsole.WriteLine("Identifying filesystem on partition"); Core.Filesystems.Identify(imageFormat, out idPlugins, partitions[i]); - if(idPlugins.Count == 0) DicConsole.WriteLine("Filesystem not identified"); + if(idPlugins.Count == 0) DicConsole.WriteLine("Filesystem not identified"); else if(idPlugins.Count > 1) { DicConsole.WriteLine($"Identified by {idPlugins.Count} plugins"); @@ -197,13 +197,13 @@ namespace DiscImageChef.Commands { Partition wholePart = new Partition { - Name = "Whole device", + Name = "Whole device", Length = imageFormat.Info.Sectors, - Size = imageFormat.Info.Sectors * imageFormat.Info.SectorSize + Size = imageFormat.Info.Sectors * imageFormat.Info.SectorSize }; Core.Filesystems.Identify(imageFormat, out idPlugins, wholePart); - if(idPlugins.Count == 0) DicConsole.WriteLine("Filesystem not identified"); + if(idPlugins.Count == 0) DicConsole.WriteLine("Filesystem not identified"); else if(idPlugins.Count > 1) { DicConsole.WriteLine($"Identified by {idPlugins.Count} plugins"); diff --git a/DiscImageChef/Commands/Benchmark.cs b/DiscImageChef/Commands/Benchmark.cs index 921ef0e12..dc9981374 100644 --- a/DiscImageChef/Commands/Benchmark.cs +++ b/DiscImageChef/Commands/Benchmark.cs @@ -41,9 +41,9 @@ namespace DiscImageChef.Commands internal static void DoBenchmark(BenchmarkOptions options) { Dictionary checksumTimes = new Dictionary(); - Core.Benchmark.InitProgressEvent += Progress.InitProgress; + Core.Benchmark.InitProgressEvent += Progress.InitProgress; Core.Benchmark.UpdateProgressEvent += Progress.UpdateProgress; - Core.Benchmark.EndProgressEvent += Progress.EndProgress; + Core.Benchmark.EndProgressEvent += Progress.EndProgress; BenchmarkResults results = Core.Benchmark.Do(options.BufferSize * 1024 * 1024, options.BlockSize); diff --git a/DiscImageChef/Commands/Checksum.cs b/DiscImageChef/Commands/Checksum.cs index 1965ab9f5..98af02af5 100644 --- a/DiscImageChef/Commands/Checksum.cs +++ b/DiscImageChef/Commands/Checksum.cs @@ -47,27 +47,27 @@ namespace DiscImageChef.Commands internal static void DoChecksum(ChecksumOptions options) { - DicConsole.DebugWriteLine("Checksum command", "--debug={0}", options.Debug); - DicConsole.DebugWriteLine("Checksum command", "--verbose={0}", options.Verbose); + DicConsole.DebugWriteLine("Checksum command", "--debug={0}", options.Debug); + DicConsole.DebugWriteLine("Checksum command", "--verbose={0}", options.Verbose); DicConsole.DebugWriteLine("Checksum command", "--separated-tracks={0}", options.SeparatedTracks); - DicConsole.DebugWriteLine("Checksum command", "--whole-disc={0}", options.WholeDisc); - DicConsole.DebugWriteLine("Checksum command", "--input={0}", options.InputFile); - DicConsole.DebugWriteLine("Checksum command", "--adler32={0}", options.DoAdler32); - DicConsole.DebugWriteLine("Checksum command", "--crc16={0}", options.DoCrc16); - DicConsole.DebugWriteLine("Checksum command", "--crc32={0}", options.DoCrc32); - DicConsole.DebugWriteLine("Checksum command", "--crc64={0}", options.DoCrc64); - DicConsole.DebugWriteLine("Checksum command", "--md5={0}", options.DoMd5); - DicConsole.DebugWriteLine("Checksum command", "--ripemd160={0}", options.DoRipemd160); - DicConsole.DebugWriteLine("Checksum command", "--sha1={0}", options.DoSha1); - DicConsole.DebugWriteLine("Checksum command", "--sha256={0}", options.DoSha256); - DicConsole.DebugWriteLine("Checksum command", "--sha384={0}", options.DoSha384); - DicConsole.DebugWriteLine("Checksum command", "--sha512={0}", options.DoSha512); - DicConsole.DebugWriteLine("Checksum command", "--spamsum={0}", options.DoSpamSum); - DicConsole.DebugWriteLine("Checksum command", "--fletcher16={0}", options.DoFletcher16); - DicConsole.DebugWriteLine("Checksum command", "--fletcher32={0}", options.DoFletcher32); + DicConsole.DebugWriteLine("Checksum command", "--whole-disc={0}", options.WholeDisc); + DicConsole.DebugWriteLine("Checksum command", "--input={0}", options.InputFile); + DicConsole.DebugWriteLine("Checksum command", "--adler32={0}", options.DoAdler32); + DicConsole.DebugWriteLine("Checksum command", "--crc16={0}", options.DoCrc16); + DicConsole.DebugWriteLine("Checksum command", "--crc32={0}", options.DoCrc32); + DicConsole.DebugWriteLine("Checksum command", "--crc64={0}", options.DoCrc64); + DicConsole.DebugWriteLine("Checksum command", "--md5={0}", options.DoMd5); + DicConsole.DebugWriteLine("Checksum command", "--ripemd160={0}", options.DoRipemd160); + DicConsole.DebugWriteLine("Checksum command", "--sha1={0}", options.DoSha1); + DicConsole.DebugWriteLine("Checksum command", "--sha256={0}", options.DoSha256); + DicConsole.DebugWriteLine("Checksum command", "--sha384={0}", options.DoSha384); + DicConsole.DebugWriteLine("Checksum command", "--sha512={0}", options.DoSha512); + DicConsole.DebugWriteLine("Checksum command", "--spamsum={0}", options.DoSpamSum); + DicConsole.DebugWriteLine("Checksum command", "--fletcher16={0}", options.DoFletcher16); + DicConsole.DebugWriteLine("Checksum command", "--fletcher32={0}", options.DoFletcher32); FiltersList filtersList = new FiltersList(); - IFilter inputFilter = filtersList.GetFilter(options.InputFile); + IFilter inputFilter = filtersList.GetFilter(options.InputFile); if(inputFilter == null) { @@ -89,17 +89,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; if(options.DoFletcher16) enabledChecksums |= EnableChecksum.Fletcher16; if(options.DoFletcher32) enabledChecksums |= EnableChecksum.Fletcher32; @@ -134,7 +134,7 @@ namespace DiscImageChef.Commands if(options.SeparatedTracks) trackChecksum = new Core.Checksum(enabledChecksums); - ulong sectors = currentTrack.TrackEndSector - currentTrack.TrackStartSector + 1; + ulong sectors = currentTrack.TrackEndSector - currentTrack.TrackStartSector + 1; ulong doneSectors = 0; DicConsole.WriteLine("Track {0} has {1} sectors", currentTrack.TrackSequence, sectors); diff --git a/DiscImageChef/Commands/Compare.cs b/DiscImageChef/Commands/Compare.cs index 4cbd6eb8a..8e7f30008 100644 --- a/DiscImageChef/Commands/Compare.cs +++ b/DiscImageChef/Commands/Compare.cs @@ -51,8 +51,8 @@ namespace DiscImageChef.Commands FiltersList filtersList = new FiltersList(); IFilter inputFilter1 = filtersList.GetFilter(options.InputFile1); - filtersList = new FiltersList(); - IFilter inputFilter2 = filtersList.GetFilter(options.InputFile2); + filtersList = new FiltersList(); + IFilter inputFilter2 = filtersList.GetFilter(options.InputFile2); if(inputFilter1 == null) { @@ -107,8 +107,8 @@ namespace DiscImageChef.Commands { sb.AppendLine("\tDisc image 1\tDisc image 2"); sb.AppendLine("================================"); - sb.AppendFormat("File\t{0}\t{1}", options.InputFile1, options.InputFile2).AppendLine(); - sb.AppendFormat("Disc image format\t{0}\t{1}", input1Format.Name, input2Format.Name).AppendLine(); + sb.AppendFormat("File\t{0}\t{1}", options.InputFile1, options.InputFile2).AppendLine(); + sb.AppendFormat("Disc image format\t{0}\t{1}", input1Format.Name, input2Format.Name).AppendLine(); } else { @@ -223,25 +223,23 @@ namespace DiscImageChef.Commands { sb.AppendFormat("Has partitions?\t{0}\t{1}", image1Info.HasPartitions, image2Info.HasPartitions) .AppendLine(); - sb.AppendFormat("Has sessions?\t{0}\t{1}", image1Info.HasSessions, image2Info.HasSessions) - .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("Has sessions?\t{0}\t{1}", image1Info.HasSessions, image2Info.HasSessions).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.CreationTime, image2Info.CreationTime) .AppendLine(); sb.AppendFormat("Last modification time\t{0}\t{1}", image1Info.LastModificationTime, image2Info.LastModificationTime).AppendLine(); - sb.AppendFormat("Disk type\t{0}\t{1}", image1Info.MediaType, image2Info.MediaType) - .AppendLine(); - sb.AppendFormat("Image version\t{0}\t{1}", image1Info.Version, image2Info.Version).AppendLine(); + sb.AppendFormat("Disk type\t{0}\t{1}", image1Info.MediaType, image2Info.MediaType).AppendLine(); + sb.AppendFormat("Image version\t{0}\t{1}", image1Info.Version, image2Info.Version).AppendLine(); sb.AppendFormat("Image application\t{0}\t{1}", image1Info.Application, image2Info.Application) .AppendLine(); sb.AppendFormat("Image application version\t{0}\t{1}", image1Info.ApplicationVersion, image2Info.ApplicationVersion).AppendLine(); - sb.AppendFormat("Image creator\t{0}\t{1}", image1Info.Creator, image2Info.Creator).AppendLine(); - sb.AppendFormat("Image name\t{0}\t{1}", image1Info.MediaTitle, image2Info.MediaTitle).AppendLine(); - sb.AppendFormat("Image comments\t{0}\t{1}", image1Info.Comments, image2Info.Comments).AppendLine(); + sb.AppendFormat("Image creator\t{0}\t{1}", image1Info.Creator, image2Info.Creator).AppendLine(); + sb.AppendFormat("Image name\t{0}\t{1}", image1Info.MediaTitle, image2Info.MediaTitle).AppendLine(); + sb.AppendFormat("Image comments\t{0}\t{1}", image1Info.Comments, image2Info.Comments).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(); @@ -432,8 +430,7 @@ namespace DiscImageChef.Commands leastSectors = image2Info.Sectors; if(!options.Verbose) sb.AppendLine("Image 1 has more sectors"); } - else - leastSectors = image1Info.Sectors; + else leastSectors = image1Info.Sectors; DicConsole.WriteLine("Comparing sectors..."); diff --git a/DiscImageChef/Commands/Configure.cs b/DiscImageChef/Commands/Configure.cs index 7d13ce672..e2e986425 100644 --- a/DiscImageChef/Commands/Configure.cs +++ b/DiscImageChef/Commands/Configure.cs @@ -51,21 +51,23 @@ namespace DiscImageChef.Commands "authors. In case of doubt, close DiscImageChef now and ask in our IRC support channel."); DicConsole.WriteLine(); DicConsole.WriteLine("For any information sharing your IP address may be stored in our server, in a way that is not\n" + - "possible for any person, manual, or automated process, to link with your identity, unless\n" + + "possible for any person, manual, or automated process, to link with your identity, unless\n" + "specified otherwise."); } + ConsoleKeyInfo pressedKey = new ConsoleKeyInfo(); #region Device reports DicConsole.WriteLine(); - DicConsole.WriteLine("With the 'device-report' command, DiscImageChef creates a report of a device, that includes its\n" + - "manufacturer, model, firmware revision and/or version, attached bus, size, and supported commands.\n" + - "The serial number of the device is not stored in the report. If used with the debug parameter,\n" + + DicConsole.WriteLine( + "With the 'device-report' command, DiscImageChef creates a report of a device, that includes its\n" + + "manufacturer, model, firmware revision and/or version, attached bus, size, and supported commands.\n" + + "The serial number of the device is not stored in the report. If used with the debug parameter,\n" + "extra information about the device will be stored in the report. This information is known to contain\n" + "the device serial number in non-standard places that prevent the automatic removal of it on a handful\n" + "of devices. A human-readable copy of the report in XML format is always created in the same directory\n" + "where DiscImageChef is being run from."); - + while(pressedKey.Key != ConsoleKey.Y && pressedKey.Key != ConsoleKey.N) { DicConsole.Write("Do you want to save device reports in shared folder of your computer? (Y/N): "); @@ -77,9 +79,9 @@ namespace DiscImageChef.Commands pressedKey = new ConsoleKeyInfo(); DicConsole.WriteLine(); - DicConsole.WriteLine("Sharing a report with us will send it to our server, that's in the european union territory, where it\n" + - "will be manually analized by an european union citizen to remove any trace of personal identification\n" + - "from it. Once that is done, it will be shared in our stats website, http://discimagechef.claunia.com\n" + + DicConsole.WriteLine("Sharing a report with us will send it to our server, that's in the european union territory, where it\n" + + "will be manually analized by an european union citizen to remove any trace of personal identification\n" + + "from it. Once that is done, it will be shared in our stats website, http://discimagechef.claunia.com\n" + "These report will be used to improve DiscImageChef support, and in some cases, to provide emulation of the\n" + "devices to other open-source projects. In any case, no information linking the report to you will be stored."); while(pressedKey.Key != ConsoleKey.Y && pressedKey.Key != ConsoleKey.N) @@ -91,14 +93,14 @@ namespace DiscImageChef.Commands Settings.Settings.Current.ShareReports = pressedKey.Key == ConsoleKey.Y; #endregion Device reports - + #region Statistics DicConsole.WriteLine(); - DicConsole.WriteLine("DiscImageChef can store some usage statistics. These statistics are limited to the number of times a\n" + - "command is executed, a filesystem, partition, or device is used, the operating system version, and other.\n" + + DicConsole.WriteLine("DiscImageChef can store some usage statistics. These statistics are limited to the number of times a\n" + + "command is executed, a filesystem, partition, or device is used, the operating system version, and other.\n" + "In no case, any information besides pure statistical usage numbers is stored, and they're just joint to the\n" + "pool with no way of using them to identify you."); - + pressedKey = new ConsoleKeyInfo(); while(pressedKey.Key != ConsoleKey.Y && pressedKey.Key != ConsoleKey.N) { diff --git a/DiscImageChef/Commands/ConvertImage.cs b/DiscImageChef/Commands/ConvertImage.cs index 60621afb6..172ca3ce9 100644 --- a/DiscImageChef/Commands/ConvertImage.cs +++ b/DiscImageChef/Commands/ConvertImage.cs @@ -94,7 +94,7 @@ namespace DiscImageChef.Commands try { StreamReader sr = new StreamReader(options.CicmXml); - sidecar = (CICMMetadataType)xs.Deserialize(sr); + sidecar = (CICMMetadataType)xs.Deserialize(sr); sr.Close(); } catch @@ -114,7 +114,7 @@ namespace DiscImageChef.Commands try { StreamReader sr = new StreamReader(options.ResumeFile); - resume = (Resume)xs.Deserialize(sr); + resume = (Resume)xs.Deserialize(sr); sr.Close(); } catch @@ -271,7 +271,7 @@ namespace DiscImageChef.Commands DriveManufacturer = options.DriveManufacturer ?? inputFormat.Info.DriveManufacturer, DriveModel = options.DriveModel ?? inputFormat.Info.DriveModel, DriveSerialNumber = options.DriveSerialNumber ?? inputFormat.Info.DriveSerialNumber, - LastMediaSequence = + LastMediaSequence = options.LastMediaSequence != 0 ? options.LastMediaSequence : inputFormat.Info.LastMediaSequence, MediaBarcode = options.MediaBarcode ?? inputFormat.Info.MediaBarcode, MediaManufacturer = options.MediaManufacturer ?? inputFormat.Info.MediaManufacturer, @@ -296,7 +296,7 @@ namespace DiscImageChef.Commands List tracks; - try { tracks = inputFormat.Tracks; } + try { tracks = inputFormat.Tracks; } catch(Exception) { tracks = null; } CICMMetadataType cicmMetadata = inputFormat.CicmMetadata; @@ -312,9 +312,8 @@ namespace DiscImageChef.Commands foreach(MediaTagType mediaTag in inputFormat.Info.ReadableMediaTags) { - if(options.Force && !outputFormat.SupportedMediaTags.Contains(mediaTag)) - continue; - + if(options.Force && !outputFormat.SupportedMediaTags.Contains(mediaTag)) continue; + DicConsole.WriteLine("Converting media tag {0}", mediaTag); byte[] tag = inputFormat.ReadDiskTag(mediaTag); if(outputFormat.WriteMediaTag(tag, mediaTag)) continue; @@ -416,8 +415,7 @@ namespace DiscImageChef.Commands continue; } - if(options.Force && !outputFormat.SupportedSectorTags.Contains(tag)) - continue; + if(options.Force && !outputFormat.SupportedSectorTags.Contains(tag)) continue; doneSectors = 0; while(doneSectors < inputFormat.Info.Sectors) @@ -468,7 +466,7 @@ namespace DiscImageChef.Commands { foreach(Track track in tracks) { - doneSectors = 0; + doneSectors = 0; ulong trackSectors = track.TrackEndSector - track.TrackStartSector + 1; while(doneSectors < trackSectors) @@ -482,8 +480,8 @@ namespace DiscImageChef.Commands (uint)(trackSectors - doneSectors); DicConsole.Write("\rConverting sectors {0} to {1} in track {3} ({2:P2} done)", - doneSectors + track.TrackStartSector, - doneSectors + sectorsToDo + track.TrackStartSector, + doneSectors + track.TrackStartSector, + doneSectors + sectorsToDo + track.TrackStartSector, (doneSectors + track.TrackStartSector) / (double)inputFormat.Info.Sectors, track.TrackSequence); @@ -496,8 +494,7 @@ namespace DiscImageChef.Commands } else { - sector = inputFormat.ReadSectorsLong(doneSectors + track.TrackStartSector, - sectorsToDo); + sector = inputFormat.ReadSectorsLong(doneSectors + track.TrackStartSector, sectorsToDo); result = outputFormat.WriteSectorsLong(sector, doneSectors + track.TrackStartSector, sectorsToDo); } @@ -510,8 +507,7 @@ namespace DiscImageChef.Commands } else { - sector = inputFormat.ReadSectors(doneSectors + track.TrackStartSector, - sectorsToDo); + sector = inputFormat.ReadSectors(doneSectors + track.TrackStartSector, sectorsToDo); result = outputFormat.WriteSectors(sector, doneSectors + track.TrackStartSector, sectorsToDo); } @@ -553,13 +549,12 @@ namespace DiscImageChef.Commands // This tags are inline in long sector continue; } - - if(options.Force && !outputFormat.SupportedSectorTags.Contains(tag)) - continue; + + if(options.Force && !outputFormat.SupportedSectorTags.Contains(tag)) continue; foreach(Track track in tracks) { - doneSectors = 0; + doneSectors = 0; ulong trackSectors = track.TrackEndSector - track.TrackStartSector + 1; byte[] sector; bool result; @@ -595,8 +590,8 @@ namespace DiscImageChef.Commands (uint)(trackSectors - doneSectors); DicConsole.Write("\rConverting tag {4} for sectors {0} to {1} in track {3} ({2:P2} done)", - doneSectors + track.TrackStartSector, - doneSectors + sectorsToDo + track.TrackStartSector, + doneSectors + track.TrackStartSector, + doneSectors + sectorsToDo + track.TrackStartSector, (doneSectors + track.TrackStartSector) / (double)inputFormat.Info.Sectors, track.TrackSequence, tag); @@ -650,8 +645,7 @@ namespace DiscImageChef.Commands if(resume != null || dumpHardware != null) { if(resume != null) ret = outputFormat.SetDumpHardware(resume.Tries); - else if(dumpHardware != null) - ret = outputFormat.SetDumpHardware(dumpHardware); + else if(dumpHardware != null) ret = outputFormat.SetDumpHardware(dumpHardware); if(ret) DicConsole.WriteLine("Written dump hardware list to output image."); } @@ -659,8 +653,7 @@ namespace DiscImageChef.Commands if(sidecar != null || cicmMetadata != null) { if(sidecar != null) ret = outputFormat.SetCicmMetadata(sidecar); - else if(cicmMetadata != null) - ret = outputFormat.SetCicmMetadata(cicmMetadata); + else if(cicmMetadata != null) ret = outputFormat.SetCicmMetadata(cicmMetadata); if(ret) DicConsole.WriteLine("Written CICM XML metadata to output image."); } diff --git a/DiscImageChef/Commands/CreateSidecar.cs b/DiscImageChef/Commands/CreateSidecar.cs index ac66ff304..d1bd24594 100644 --- a/DiscImageChef/Commands/CreateSidecar.cs +++ b/DiscImageChef/Commands/CreateSidecar.cs @@ -152,9 +152,9 @@ namespace DiscImageChef.Commands return; } - string[] contents = Directory.GetFiles(options.InputFile, "*", SearchOption.TopDirectoryOnly); - List files = contents.Where(file => new FileInfo(file).Length % options.BlockSize == 0) - .ToList(); + string[] contents = Directory.GetFiles(options.InputFile, "*", SearchOption.TopDirectoryOnly); + List files = contents.Where(file => new FileInfo(file).Length % options.BlockSize == 0) + .ToList(); files.Sort(StringComparer.CurrentCultureIgnoreCase); @@ -174,8 +174,7 @@ namespace DiscImageChef.Commands Core.Statistics.AddCommand("create-sidecar"); } - else - DicConsole.ErrorWriteLine("The specified input file cannot be found."); + else DicConsole.ErrorWriteLine("The specified input file cannot be found."); } } } \ No newline at end of file diff --git a/DiscImageChef/Commands/Decode.cs b/DiscImageChef/Commands/Decode.cs index 0356f0469..ed1f6b3da 100644 --- a/DiscImageChef/Commands/Decode.cs +++ b/DiscImageChef/Commands/Decode.cs @@ -45,16 +45,16 @@ namespace DiscImageChef.Commands { internal static void DoDecode(DecodeOptions options) { - DicConsole.DebugWriteLine("Decode command", "--debug={0}", options.Debug); - DicConsole.DebugWriteLine("Decode command", "--verbose={0}", options.Verbose); - DicConsole.DebugWriteLine("Decode command", "--input={0}", options.InputFile); - DicConsole.DebugWriteLine("Decode command", "--start={0}", options.StartSector); - DicConsole.DebugWriteLine("Decode command", "--length={0}", options.Length); - DicConsole.DebugWriteLine("Decode command", "--disk-tags={0}", options.DiskTags); + DicConsole.DebugWriteLine("Decode command", "--debug={0}", options.Debug); + DicConsole.DebugWriteLine("Decode command", "--verbose={0}", options.Verbose); + DicConsole.DebugWriteLine("Decode command", "--input={0}", options.InputFile); + DicConsole.DebugWriteLine("Decode command", "--start={0}", options.StartSector); + DicConsole.DebugWriteLine("Decode command", "--length={0}", options.Length); + DicConsole.DebugWriteLine("Decode command", "--disk-tags={0}", options.DiskTags); DicConsole.DebugWriteLine("Decode command", "--sector-tags={0}", options.SectorTags); FiltersList filtersList = new FiltersList(); - IFilter inputFilter = filtersList.GetFilter(options.InputFile); + IFilter inputFilter = filtersList.GetFilter(options.InputFile); if(inputFilter == null) { @@ -91,11 +91,12 @@ namespace DiscImageChef.Commands { DicConsole.WriteLine("SCSI INQUIRY command response:"); DicConsole - .WriteLine("================================================================================"); + .WriteLine("================================================================================"); DicConsole.WriteLine(Inquiry.Prettify(inquiry)); DicConsole - .WriteLine("================================================================================"); + .WriteLine("================================================================================"); } + break; } case MediaTagType.ATA_IDENTIFY: @@ -107,11 +108,12 @@ namespace DiscImageChef.Commands { DicConsole.WriteLine("ATA IDENTIFY DEVICE command response:"); DicConsole - .WriteLine("================================================================================"); + .WriteLine("================================================================================"); DicConsole.WriteLine(Identify.Prettify(identify)); DicConsole - .WriteLine("================================================================================"); + .WriteLine("================================================================================"); } + break; } case MediaTagType.ATAPI_IDENTIFY: @@ -119,16 +121,17 @@ namespace DiscImageChef.Commands byte[] identify = inputFormat.ReadDiskTag(MediaTagType.ATAPI_IDENTIFY); if(identify == null) DicConsole - .WriteLine("Error reading ATA IDENTIFY PACKET DEVICE response from disc image"); + .WriteLine("Error reading ATA IDENTIFY PACKET DEVICE response from disc image"); else { DicConsole.WriteLine("ATA IDENTIFY PACKET DEVICE command response:"); DicConsole - .WriteLine("================================================================================"); + .WriteLine("================================================================================"); DicConsole.WriteLine(Identify.Prettify(identify)); DicConsole - .WriteLine("================================================================================"); + .WriteLine("================================================================================"); } + break; } case MediaTagType.CD_ATIP: @@ -139,11 +142,12 @@ namespace DiscImageChef.Commands { DicConsole.WriteLine("CD ATIP:"); DicConsole - .WriteLine("================================================================================"); + .WriteLine("================================================================================"); DicConsole.WriteLine(ATIP.Prettify(atip)); DicConsole - .WriteLine("================================================================================"); + .WriteLine("================================================================================"); } + break; } case MediaTagType.CD_FullTOC: @@ -154,11 +158,12 @@ namespace DiscImageChef.Commands { DicConsole.WriteLine("CD full TOC:"); DicConsole - .WriteLine("================================================================================"); + .WriteLine("================================================================================"); DicConsole.WriteLine(FullTOC.Prettify(fulltoc)); DicConsole - .WriteLine("================================================================================"); + .WriteLine("================================================================================"); } + break; } case MediaTagType.CD_PMA: @@ -169,11 +174,12 @@ namespace DiscImageChef.Commands { DicConsole.WriteLine("CD PMA:"); DicConsole - .WriteLine("================================================================================"); + .WriteLine("================================================================================"); DicConsole.WriteLine(PMA.Prettify(pma)); DicConsole - .WriteLine("================================================================================"); + .WriteLine("================================================================================"); } + break; } case MediaTagType.CD_SessionInfo: @@ -185,11 +191,12 @@ namespace DiscImageChef.Commands { DicConsole.WriteLine("CD session information:"); DicConsole - .WriteLine("================================================================================"); + .WriteLine("================================================================================"); DicConsole.WriteLine(Session.Prettify(sessioninfo)); DicConsole - .WriteLine("================================================================================"); + .WriteLine("================================================================================"); } + break; } case MediaTagType.CD_TEXT: @@ -200,11 +207,12 @@ namespace DiscImageChef.Commands { DicConsole.WriteLine("CD-TEXT:"); DicConsole - .WriteLine("================================================================================"); + .WriteLine("================================================================================"); DicConsole.WriteLine(CDTextOnLeadIn.Prettify(cdtext)); DicConsole - .WriteLine("================================================================================"); + .WriteLine("================================================================================"); } + break; } case MediaTagType.CD_TOC: @@ -215,11 +223,12 @@ namespace DiscImageChef.Commands { DicConsole.WriteLine("CD TOC:"); DicConsole - .WriteLine("================================================================================"); + .WriteLine("================================================================================"); DicConsole.WriteLine(TOC.Prettify(toc)); DicConsole - .WriteLine("================================================================================"); + .WriteLine("================================================================================"); } + break; } default: diff --git a/DiscImageChef/Commands/DeviceInfo.cs b/DiscImageChef/Commands/DeviceInfo.cs index 87ca1f965..31ec565a0 100644 --- a/DiscImageChef/Commands/DeviceInfo.cs +++ b/DiscImageChef/Commands/DeviceInfo.cs @@ -71,11 +71,11 @@ namespace DiscImageChef.Commands DicConsole.WriteLine("USB device"); if(dev.UsbDescriptors != null) DicConsole.WriteLine("USB descriptor is {0} bytes", dev.UsbDescriptors.Length); - DicConsole.WriteLine("USB Vendor ID: {0:X4}", dev.UsbVendorId); - DicConsole.WriteLine("USB Product ID: {0:X4}", dev.UsbProductId); - DicConsole.WriteLine("USB Manufacturer: {0}", dev.UsbManufacturerString); - DicConsole.WriteLine("USB Product: {0}", dev.UsbProductString); - DicConsole.WriteLine("USB Serial number: {0}", dev.UsbSerialString); + DicConsole.WriteLine("USB Vendor ID: {0:X4}", dev.UsbVendorId); + DicConsole.WriteLine("USB Product ID: {0:X4}", dev.UsbProductId); + DicConsole.WriteLine("USB Manufacturer: {0}", dev.UsbManufacturerString); + DicConsole.WriteLine("USB Product: {0}", dev.UsbProductString); + DicConsole.WriteLine("USB Serial number: {0}", dev.UsbSerialString); DicConsole.WriteLine(); } @@ -842,7 +842,7 @@ namespace DiscImageChef.Commands case "DVDR PX-708A": case "DVDR PX-708A2": case "DVDR PX-712A": - plxtDvd = true; + plxtDvd = true; plxtSense = dev.PlextorReadEeprom(out plxtBuf, out senseBuf, dev.Timeout, out _); break; diff --git a/DiscImageChef/Commands/DeviceReport.cs b/DiscImageChef/Commands/DeviceReport.cs index 408383a30..523939c0d 100644 --- a/DiscImageChef/Commands/DeviceReport.cs +++ b/DiscImageChef/Commands/DeviceReport.cs @@ -45,9 +45,9 @@ namespace DiscImageChef.Commands { internal static void DoDeviceReport(DeviceReportOptions options) { - DicConsole.DebugWriteLine("Device-Report command", "--debug={0}", options.Debug); + DicConsole.DebugWriteLine("Device-Report command", "--debug={0}", options.Debug); DicConsole.DebugWriteLine("Device-Report command", "--verbose={0}", options.Verbose); - DicConsole.DebugWriteLine("Device-Report command", "--device={0}", options.DevicePath); + 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])) @@ -63,14 +63,19 @@ namespace DiscImageChef.Commands Core.Statistics.AddDevice(dev); - Metadata.DeviceReport report = new Metadata.DeviceReport(); - bool removable = false; - string xmlFile; + Metadata.DeviceReport report = new Metadata.DeviceReport(); + bool removable = false; + 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"; + 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"; xmlFile = xmlFile.Replace('\\', '_').Replace('/', '_').Replace('?', '_'); diff --git a/DiscImageChef/Commands/DumpMedia.cs b/DiscImageChef/Commands/DumpMedia.cs index 350a6ed8f..647d183b5 100644 --- a/DiscImageChef/Commands/DumpMedia.cs +++ b/DiscImageChef/Commands/DumpMedia.cs @@ -60,9 +60,9 @@ namespace DiscImageChef.Commands Sidecar.EndProgressEvent2 += Progress.EndProgress2; Sidecar.UpdateStatusEvent += Progress.UpdateStatus; - DicConsole.DebugWriteLine("Dump-Media command", "--debug={0}", options.Debug); - DicConsole.DebugWriteLine("Dump-Media command", "--verbose={0}", options.Verbose); - DicConsole.DebugWriteLine("Dump-Media command", "--device={0}", options.DevicePath); + DicConsole.DebugWriteLine("Dump-Media command", "--debug={0}", options.Debug); + DicConsole.DebugWriteLine("Dump-Media command", "--verbose={0}", options.Verbose); + DicConsole.DebugWriteLine("Dump-Media command", "--device={0}", options.DevicePath); // TODO: Disabled temporarily //DicConsole.DebugWriteLine("Dump-Media command", "--raw={0}", options.Raw); DicConsole.DebugWriteLine("Dump-Media command", "--stop-on-error={0}", options.StopOnError); @@ -206,7 +206,8 @@ namespace DiscImageChef.Commands switch(dev.Type) { case DeviceType.ATA: - Ata.Dump(dev, options.DevicePath, outputFormat, options.RetryPasses, options.Force, false, /*options.Raw,*/ + Ata.Dump(dev, options.DevicePath, outputFormat, options.RetryPasses, options.Force, + false, /*options.Raw,*/ options.Persistent, options.StopOnError, ref resume, ref dumpLog, encoding, outputPrefix, options.OutputFile, parsedOptions, sidecar, (uint)options.Skip, options.NoMetadata, options.NoTrim); @@ -214,19 +215,21 @@ namespace DiscImageChef.Commands case DeviceType.MMC: case DeviceType.SecureDigital: SecureDigital.Dump(dev, options.DevicePath, outputFormat, options.RetryPasses, options.Force, - false, /*options.Raw,*/ options.Persistent, options.StopOnError, ref resume, ref dumpLog, - encoding, outputPrefix, options.OutputFile, parsedOptions, sidecar, + false, /*options.Raw,*/ options.Persistent, options.StopOnError, ref resume, + ref dumpLog, encoding, outputPrefix, options.OutputFile, parsedOptions, sidecar, (uint)options.Skip, options.NoMetadata, options.NoTrim); break; case DeviceType.NVMe: - NvMe.Dump(dev, options.DevicePath, outputFormat, options.RetryPasses, options.Force, false, /*options.Raw,*/ + NvMe.Dump(dev, options.DevicePath, outputFormat, options.RetryPasses, options.Force, + false, /*options.Raw,*/ options.Persistent, options.StopOnError, ref resume, ref dumpLog, encoding, outputPrefix, options.OutputFile, parsedOptions, sidecar, (uint)options.Skip, options.NoMetadata, options.NoTrim); break; case DeviceType.ATAPI: case DeviceType.SCSI: - Scsi.Dump(dev, options.DevicePath, outputFormat, options.RetryPasses, options.Force, false, /*options.Raw,*/ + Scsi.Dump(dev, options.DevicePath, outputFormat, options.RetryPasses, options.Force, + false, /*options.Raw,*/ options.Persistent, options.StopOnError, ref resume, ref dumpLog, options.LeadIn, encoding, outputPrefix, options.OutputFile, parsedOptions, sidecar, (uint)options.Skip, options.NoMetadata, options.NoTrim); diff --git a/DiscImageChef/Commands/Entropy.cs b/DiscImageChef/Commands/Entropy.cs index fa2e1bd02..0de3307d5 100644 --- a/DiscImageChef/Commands/Entropy.cs +++ b/DiscImageChef/Commands/Entropy.cs @@ -84,7 +84,7 @@ namespace DiscImageChef.Commands foreach(Track currentTrack in inputTracks) { - entTable = new ulong[256]; + entTable = new ulong[256]; ulong trackSize = 0; List uniqueSectorsPerTrack = new List(); @@ -107,7 +107,7 @@ namespace DiscImageChef.Commands trackSize += (ulong)sector.LongLength; } - entropy += entTable.Select(l => (double)l / (double)trackSize) + entropy += entTable.Select(l => (double)l / (double)trackSize) .Select(frequency => -(frequency * Math.Log(frequency, 2))).Sum(); DicConsole.WriteLine("Entropy for track {0} is {1:F4}.", currentTrack.TrackSequence, entropy); @@ -128,7 +128,7 @@ namespace DiscImageChef.Commands if(!options.WholeDisc) return; - entTable = new ulong[256]; + entTable = new ulong[256]; ulong diskSize = 0; List uniqueSectors = new List(); @@ -151,7 +151,7 @@ namespace DiscImageChef.Commands diskSize += (ulong)sector.LongLength; } - entropy += entTable.Select(l => (double)l / (double)diskSize) + entropy += entTable.Select(l => (double)l / (double)diskSize) .Select(frequency => -(frequency * Math.Log(frequency, 2))).Sum(); DicConsole.WriteLine(); diff --git a/DiscImageChef/Commands/ExtractFiles.cs b/DiscImageChef/Commands/ExtractFiles.cs index b7a561a13..bbd533230 100644 --- a/DiscImageChef/Commands/ExtractFiles.cs +++ b/DiscImageChef/Commands/ExtractFiles.cs @@ -54,15 +54,15 @@ namespace DiscImageChef.Commands DicConsole.DebugWriteLine("Extract-Files command", "--xattrs={0}", options.Xattrs); DicConsole.DebugWriteLine("Extract-Files command", "--output={0}", options.OutputDir); - FiltersList filtersList = new FiltersList(); - IFilter inputFilter = filtersList.GetFilter(options.InputFile); + FiltersList filtersList = new FiltersList(); + IFilter inputFilter = filtersList.GetFilter(options.InputFile); Dictionary parsedOptions = Options.Parse(options.Options); DicConsole.DebugWriteLine("Extract-Files command", "Parsed options:"); - foreach(KeyValuePair parsedOption in parsedOptions) + foreach(KeyValuePair parsedOption in parsedOptions) DicConsole.DebugWriteLine("Extract-Files command", "{0} = {1}", parsedOption.Key, parsedOption.Value); parsedOptions.Add("debug", options.Debug.ToString()); - + if(inputFilter == null) { DicConsole.ErrorWriteLine("Cannot open specified file."); @@ -172,7 +172,7 @@ namespace DiscImageChef.Commands error = fs.Mount(imageFormat, partitions[i], encoding, parsedOptions); if(error == Errno.NoError) { - error = fs.ReadDir("/", out List rootDir); + error = fs.ReadDir("/", out List rootDir); if(error == Errno.NoError) foreach(string entry in rootDir) { @@ -193,8 +193,7 @@ namespace DiscImageChef.Commands foreach(string xattr in xattrs) { byte[] xattrBuf = new byte[0]; - error = - fs.GetXattr(entry, xattr, ref xattrBuf); + error = fs.GetXattr(entry, xattr, ref xattrBuf); if(error != Errno.NoError) continue; Directory @@ -323,7 +322,7 @@ namespace DiscImageChef.Commands error = fs.Mount(imageFormat, partitions[i], encoding, parsedOptions); if(error == Errno.NoError) { - error = fs.ReadDir("/", out List rootDir); + error = fs.ReadDir("/", out List rootDir); if(error == Errno.NoError) foreach(string entry in rootDir) { @@ -344,7 +343,7 @@ namespace DiscImageChef.Commands foreach(string xattr in xattrs) { byte[] xattrBuf = new byte[0]; - error = fs.GetXattr(entry, xattr, ref xattrBuf); + error = fs.GetXattr(entry, xattr, ref xattrBuf); if(error != Errno.NoError) continue; Directory.CreateDirectory(Path.Combine(options.OutputDir, @@ -479,7 +478,7 @@ namespace DiscImageChef.Commands error = fs.Mount(imageFormat, wholePart, encoding, parsedOptions); if(error == Errno.NoError) { - error = fs.ReadDir("/", out List rootDir); + error = fs.ReadDir("/", out List rootDir); if(error == Errno.NoError) foreach(string entry in rootDir) { @@ -500,7 +499,7 @@ namespace DiscImageChef.Commands foreach(string xattr in xattrs) { byte[] xattrBuf = new byte[0]; - error = fs.GetXattr(entry, xattr, ref xattrBuf); + error = fs.GetXattr(entry, xattr, ref xattrBuf); if(error != Errno.NoError) continue; Directory.CreateDirectory(Path.Combine(options.OutputDir, @@ -619,7 +618,7 @@ namespace DiscImageChef.Commands error = fs.Mount(imageFormat, wholePart, encoding, parsedOptions); if(error == Errno.NoError) { - error = fs.ReadDir("/", out List rootDir); + error = fs.ReadDir("/", out List rootDir); if(error == Errno.NoError) foreach(string entry in rootDir) { @@ -639,7 +638,7 @@ namespace DiscImageChef.Commands foreach(string xattr in xattrs) { byte[] xattrBuf = new byte[0]; - error = fs.GetXattr(entry, xattr, ref xattrBuf); + error = fs.GetXattr(entry, xattr, ref xattrBuf); if(error != Errno.NoError) continue; Directory.CreateDirectory(Path.Combine(options.OutputDir, diff --git a/DiscImageChef/Commands/ListDevices.cs b/DiscImageChef/Commands/ListDevices.cs index cb83c80d5..2d4230fe6 100644 --- a/DiscImageChef/Commands/ListDevices.cs +++ b/DiscImageChef/Commands/ListDevices.cs @@ -40,7 +40,7 @@ namespace DiscImageChef.Commands { internal static void DoListDevices(ListDevicesOptions options) { - DicConsole.DebugWriteLine("Media-Info command", "--debug={0}", options.Debug); + DicConsole.DebugWriteLine("Media-Info command", "--debug={0}", options.Debug); DicConsole.DebugWriteLine("Media-Info command", "--verbose={0}", options.Verbose); Devices.DeviceInfo[] devices = Device.ListDevices(); diff --git a/DiscImageChef/Commands/ListEncodings.cs b/DiscImageChef/Commands/ListEncodings.cs index e5022ad9e..091e83d0a 100644 --- a/DiscImageChef/Commands/ListEncodings.cs +++ b/DiscImageChef/Commands/ListEncodings.cs @@ -42,18 +42,17 @@ namespace DiscImageChef.Commands internal static void DoList() { List encodings = Encoding - .GetEncodings() - .Select(info => new CommonEncodingInfo - { - Name = info.Name, - DisplayName = info.GetEncoding().EncodingName - }).ToList(); + .GetEncodings().Select(info => new CommonEncodingInfo + { + Name = info.Name, + DisplayName = info.GetEncoding().EncodingName + }).ToList(); encodings.AddRange(Claunia.Encoding.Encoding.GetEncodings() .Select(info => new CommonEncodingInfo - { - Name = info.Name, - DisplayName = info.DisplayName - })); + { + Name = info.Name, + DisplayName = info.DisplayName + })); DicConsole.WriteLine("{0,-16} {1,-8}", "Name", "Description"); diff --git a/DiscImageChef/Commands/ListOptions.cs b/DiscImageChef/Commands/ListOptions.cs index ed536e703..fb2e7ad38 100644 --- a/DiscImageChef/Commands/ListOptions.cs +++ b/DiscImageChef/Commands/ListOptions.cs @@ -59,9 +59,9 @@ namespace DiscImageChef.Commands option.description); DicConsole.WriteLine(); } - + DicConsole.WriteLine(); - + DicConsole.WriteLine("Read/Write media images options:"); foreach(KeyValuePair kvp in plugins.WritableImages) { diff --git a/DiscImageChef/Commands/Ls.cs b/DiscImageChef/Commands/Ls.cs index 07d568496..4b96111b4 100644 --- a/DiscImageChef/Commands/Ls.cs +++ b/DiscImageChef/Commands/Ls.cs @@ -50,12 +50,12 @@ namespace DiscImageChef.Commands DicConsole.DebugWriteLine("Ls command", "--verbose={0}", options.Verbose); DicConsole.DebugWriteLine("Ls command", "--input={0}", options.InputFile); - FiltersList filtersList = new FiltersList(); - IFilter inputFilter = filtersList.GetFilter(options.InputFile); - + FiltersList filtersList = new FiltersList(); + IFilter inputFilter = filtersList.GetFilter(options.InputFile); + Dictionary parsedOptions = Options.Parse(options.Options); DicConsole.DebugWriteLine("Ls command", "Parsed options:"); - foreach(KeyValuePair parsedOption in parsedOptions) + foreach(KeyValuePair parsedOption in parsedOptions) DicConsole.DebugWriteLine("Ls command", "{0} = {1}", parsedOption.Key, parsedOption.Value); parsedOptions.Add("debug", options.Debug.ToString()); @@ -161,7 +161,7 @@ namespace DiscImageChef.Commands error = fs.Mount(imageFormat, partitions[i], encoding, parsedOptions); if(error == Errno.NoError) { - error = fs.ReadDir("/", out List rootDir); + error = fs.ReadDir("/", out List rootDir); if(error == Errno.NoError) foreach(string entry in rootDir) DicConsole.WriteLine("{0}", entry); @@ -190,7 +190,7 @@ namespace DiscImageChef.Commands error = fs.Mount(imageFormat, partitions[i], encoding, parsedOptions); if(error == Errno.NoError) { - error = fs.ReadDir("/", out List rootDir); + error = fs.ReadDir("/", out List rootDir); if(error == Errno.NoError) foreach(string entry in rootDir) DicConsole.WriteLine("{0}", entry); @@ -229,7 +229,7 @@ namespace DiscImageChef.Commands error = fs.Mount(imageFormat, wholePart, encoding, parsedOptions); if(error == Errno.NoError) { - error = fs.ReadDir("/", out List rootDir); + error = fs.ReadDir("/", out List rootDir); if(error == Errno.NoError) foreach(string entry in rootDir) DicConsole.WriteLine("{0}", entry); @@ -255,7 +255,7 @@ namespace DiscImageChef.Commands error = fs.Mount(imageFormat, wholePart, encoding, parsedOptions); if(error == Errno.NoError) { - error = fs.ReadDir("/", out List rootDir); + error = fs.ReadDir("/", out List rootDir); if(error == Errno.NoError) foreach(string entry in rootDir) if(options.Long) @@ -272,7 +272,7 @@ namespace DiscImageChef.Commands foreach(string xattr in xattrs) { byte[] xattrBuf = new byte[0]; - error = fs.GetXattr(entry, xattr, ref xattrBuf); + error = fs.GetXattr(entry, xattr, ref xattrBuf); if(error == Errno.NoError) DicConsole.WriteLine("\t\t{0}\t{1} bytes", xattr, xattrBuf.Length); diff --git a/DiscImageChef/Commands/MediaInfo.cs b/DiscImageChef/Commands/MediaInfo.cs index b7f1b6436..4cce422e4 100644 --- a/DiscImageChef/Commands/MediaInfo.cs +++ b/DiscImageChef/Commands/MediaInfo.cs @@ -229,11 +229,9 @@ namespace DiscImageChef.Commands scsiDensityCode = (byte)decMode.Value.Header.BlockDescriptors[0].Density; if(decMode.Value.Pages != null) - { containsFloppyPage = decMode.Value.Pages.Aggregate(containsFloppyPage, (current, modePage) => current | (modePage.Page == 0x05)); - } } switch(dev.ScsiType) @@ -1316,7 +1314,8 @@ namespace DiscImageChef.Commands return; } - ulong totalSize = (ulong)((cmdBuf[0] << 24) + (cmdBuf[1] << 16) + (cmdBuf[2] << 8) + cmdBuf[3]); + ulong 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 _); if(sense) @@ -1347,8 +1346,8 @@ namespace DiscImageChef.Commands return; } - ulong gameSize = (ulong)((cmdBuf[0] << 24) + (cmdBuf[1] << 16) + (cmdBuf[2] << 8) + cmdBuf[3]) + - 1; + ulong 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); @@ -1379,11 +1378,12 @@ namespace DiscImageChef.Commands DicConsole.DebugWriteLine("Dump-media command", "Unlocked total size: {0} sectors", totalSize); - ulong middleZone = totalSize - - (PFI.Decode(cmdBuf).Value.Layer0EndPSN - - PFI.Decode(cmdBuf).Value.DataAreaStartPSN + 1) - gameSize + 1; + ulong middleZone = + totalSize - + (PFI.Decode(cmdBuf).Value.Layer0EndPSN - + PFI.Decode(cmdBuf).Value.DataAreaStartPSN + 1) - gameSize + 1; - totalSize = l0Video + l1Video + middleZone * 2 + gameSize; + totalSize = l0Video + l1Video + middleZone * 2 + gameSize; ulong layerBreak = l0Video + middleZone + gameSize / 2; DicConsole.WriteLine("Video layer 0 size: {0} sectors", l0Video); diff --git a/DiscImageChef/Commands/MediaScan.cs b/DiscImageChef/Commands/MediaScan.cs index 97495a4a4..14d90336e 100644 --- a/DiscImageChef/Commands/MediaScan.cs +++ b/DiscImageChef/Commands/MediaScan.cs @@ -41,11 +41,11 @@ namespace DiscImageChef.Commands { internal static void DoMediaScan(MediaScanOptions options) { - DicConsole.DebugWriteLine("Media-Scan command", "--debug={0}", options.Debug); - DicConsole.DebugWriteLine("Media-Scan command", "--verbose={0}", options.Verbose); - DicConsole.DebugWriteLine("Media-Scan command", "--device={0}", options.DevicePath); + DicConsole.DebugWriteLine("Media-Scan command", "--debug={0}", options.Debug); + DicConsole.DebugWriteLine("Media-Scan command", "--verbose={0}", options.Verbose); + DicConsole.DebugWriteLine("Media-Scan command", "--device={0}", options.DevicePath); DicConsole.DebugWriteLine("Media-Scan command", "--mhdd-log={0}", options.MhddLogPath); - DicConsole.DebugWriteLine("Media-Scan command", "--ibg-log={0}", options.IbgLogPath); + 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])) @@ -84,26 +84,27 @@ namespace DiscImageChef.Commands 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("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); DicConsole.WriteLine("Summary:"); - DicConsole.WriteLine("{0} sectors took less than 3 ms.", results.A); - DicConsole.WriteLine("{0} sectors took less than 10 ms but more than 3 ms.", results.B); - DicConsole.WriteLine("{0} sectors took less than 50 ms but more than 10 ms.", results.C); - DicConsole.WriteLine("{0} sectors took less than 150 ms but more than 50 ms.", results.D); + DicConsole.WriteLine("{0} sectors took less than 3 ms.", results.A); + DicConsole.WriteLine("{0} sectors took less than 10 ms but more than 3 ms.", results.B); + DicConsole.WriteLine("{0} sectors took less than 50 ms but more than 10 ms.", results.C); + DicConsole.WriteLine("{0} sectors took less than 150 ms but more than 50 ms.", results.D); DicConsole.WriteLine("{0} sectors took less than 500 ms but more than 150 ms.", results.E); - DicConsole.WriteLine("{0} sectors took more than 500 ms.", results.F); - DicConsole.WriteLine("{0} sectors could not be read.", results.UnreadableSectors.Count); + DicConsole.WriteLine("{0} sectors took more than 500 ms.", results.F); + DicConsole.WriteLine("{0} sectors could not be read.", + results.UnreadableSectors.Count); if(results.UnreadableSectors.Count > 0) 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 + #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 + #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); diff --git a/DiscImageChef/Commands/PrintHex.cs b/DiscImageChef/Commands/PrintHex.cs index 768efeafc..946ca2320 100644 --- a/DiscImageChef/Commands/PrintHex.cs +++ b/DiscImageChef/Commands/PrintHex.cs @@ -41,16 +41,16 @@ namespace DiscImageChef.Commands { internal static void DoPrintHex(PrintHexOptions options) { - DicConsole.DebugWriteLine("PrintHex command", "--debug={0}", options.Debug); - DicConsole.DebugWriteLine("PrintHex command", "--verbose={0}", options.Verbose); - DicConsole.DebugWriteLine("PrintHex command", "--input={0}", options.InputFile); - DicConsole.DebugWriteLine("PrintHex command", "--start={0}", options.StartSector); - DicConsole.DebugWriteLine("PrintHex command", "--length={0}", options.Length); + DicConsole.DebugWriteLine("PrintHex command", "--debug={0}", options.Debug); + DicConsole.DebugWriteLine("PrintHex command", "--verbose={0}", options.Verbose); + DicConsole.DebugWriteLine("PrintHex command", "--input={0}", options.InputFile); + DicConsole.DebugWriteLine("PrintHex command", "--start={0}", options.StartSector); + DicConsole.DebugWriteLine("PrintHex command", "--length={0}", options.Length); DicConsole.DebugWriteLine("PrintHex command", "--long-sectors={0}", options.LongSectors); - DicConsole.DebugWriteLine("PrintHex command", "--WidthBytes={0}", options.WidthBytes); + DicConsole.DebugWriteLine("PrintHex command", "--WidthBytes={0}", options.WidthBytes); FiltersList filtersList = new FiltersList(); - IFilter inputFilter = filtersList.GetFilter(options.InputFile); + IFilter inputFilter = filtersList.GetFilter(options.InputFile); if(inputFilter == null) { @@ -75,7 +75,7 @@ namespace DiscImageChef.Commands if(inputFormat.Info.ReadableSectorTags == null) { DicConsole - .WriteLine("Requested sectors with tags, unsupported by underlying image format, printing only user data."); + .WriteLine("Requested sectors with tags, unsupported by underlying image format, printing only user data."); options.LongSectors = false; } else @@ -83,14 +83,14 @@ namespace DiscImageChef.Commands if(inputFormat.Info.ReadableSectorTags.Count == 0) { DicConsole - .WriteLine("Requested sectors with tags, unsupported by underlying image format, printing only user data."); + .WriteLine("Requested sectors with tags, unsupported by underlying image format, printing only user data."); options.LongSectors = false; } } byte[] sector = options.LongSectors ? inputFormat.ReadSectorLong(options.StartSector + i) - : inputFormat.ReadSector(options.StartSector + i); + : inputFormat.ReadSector(options.StartSector + i); DiscImageChef.PrintHex.PrintHexArray(sector, options.WidthBytes); } diff --git a/DiscImageChef/Commands/Verify.cs b/DiscImageChef/Commands/Verify.cs index f495da3d8..d82465d21 100644 --- a/DiscImageChef/Commands/Verify.cs +++ b/DiscImageChef/Commands/Verify.cs @@ -43,14 +43,14 @@ namespace DiscImageChef.Commands { internal static void DoVerify(VerifyOptions options) { - DicConsole.DebugWriteLine("Verify command", "--debug={0}", options.Debug); - DicConsole.DebugWriteLine("Verify command", "--verbose={0}", options.Verbose); - DicConsole.DebugWriteLine("Verify command", "--input={0}", options.InputFile); - DicConsole.DebugWriteLine("Verify command", "--verify-disc={0}", options.VerifyDisc); + DicConsole.DebugWriteLine("Verify command", "--debug={0}", options.Debug); + DicConsole.DebugWriteLine("Verify command", "--verbose={0}", options.Verbose); + DicConsole.DebugWriteLine("Verify command", "--input={0}", options.InputFile); + DicConsole.DebugWriteLine("Verify command", "--verify-disc={0}", options.VerifyDisc); DicConsole.DebugWriteLine("Verify command", "--verify-sectors={0}", options.VerifySectors); FiltersList filtersList = new FiltersList(); - IFilter inputFilter = filtersList.GetFilter(options.InputFile); + IFilter inputFilter = filtersList.GetFilter(options.InputFile); if(inputFilter == null) { @@ -71,17 +71,17 @@ namespace DiscImageChef.Commands Core.Statistics.AddMedia(inputFormat.Info.MediaType, false); Core.Statistics.AddFilter(inputFilter.Name); - bool? correctDisc = null; - long totalSectors = 0; - long errorSectors = 0; - long correctSectors = 0; - long unknownSectors = 0; + bool? correctDisc = null; + long totalSectors = 0; + long errorSectors = 0; + long correctSectors = 0; + long unknownSectors = 0; if(options.VerifyDisc) { - DateTime startCheck = DateTime.UtcNow; - bool? discCheckStatus = inputFormat.VerifyMediaImage(); - DateTime endCheck = DateTime.UtcNow; + DateTime startCheck = DateTime.UtcNow; + bool? discCheckStatus = inputFormat.VerifyMediaImage(); + DateTime endCheck = DateTime.UtcNow; TimeSpan checkTime = endCheck - startCheck; @@ -112,21 +112,21 @@ namespace DiscImageChef.Commands } catch { formatHasTracks = false; } - DateTime startCheck; - DateTime endCheck; + DateTime startCheck; + DateTime endCheck; List failingLbas = new List(); List unknownLbas = new List(); if(formatHasTracks) { - List inputTracks = inputFormat.Tracks; - ulong currentSectorAll = 0; + List inputTracks = inputFormat.Tracks; + ulong currentSectorAll = 0; startCheck = DateTime.UtcNow; foreach(Track currentTrack in inputTracks) { ulong remainingSectors = currentTrack.TrackEndSector - currentTrack.TrackStartSector; - ulong currentSector = 0; + ulong currentSector = 0; while(remainingSectors > 0) { @@ -138,11 +138,11 @@ namespace DiscImageChef.Commands if(remainingSectors < 512) inputFormat.VerifySectors(currentSector, (uint)remainingSectors, - currentTrack.TrackSequence, out tempfailingLbas, - out tempunknownLbas); + currentTrack.TrackSequence, out tempfailingLbas, + out tempunknownLbas); else inputFormat.VerifySectors(currentSector, 512, currentTrack.TrackSequence, - out tempfailingLbas, out tempunknownLbas); + out tempfailingLbas, out tempunknownLbas); failingLbas.AddRange(tempfailingLbas); @@ -150,13 +150,13 @@ namespace DiscImageChef.Commands if(remainingSectors < 512) { - currentSector += remainingSectors; + currentSector += remainingSectors; currentSectorAll += remainingSectors; - remainingSectors = 0; + remainingSectors = 0; } else { - currentSector += 512; + currentSector += 512; currentSectorAll += 512; remainingSectors -= 512; } @@ -168,7 +168,7 @@ namespace DiscImageChef.Commands else { ulong remainingSectors = inputFormat.Info.Sectors; - ulong currentSector = 0; + ulong currentSector = 0; startCheck = DateTime.UtcNow; while(remainingSectors > 0) @@ -179,10 +179,9 @@ namespace DiscImageChef.Commands List tempunknownLbas; if(remainingSectors < 512) - inputFormat.VerifySectors(currentSector, (uint)remainingSectors, - out tempfailingLbas, out tempunknownLbas); - else - inputFormat.VerifySectors(currentSector, 512, out tempfailingLbas, out tempunknownLbas); + inputFormat.VerifySectors(currentSector, (uint)remainingSectors, out tempfailingLbas, + out tempunknownLbas); + else inputFormat.VerifySectors(currentSector, 512, out tempfailingLbas, out tempunknownLbas); failingLbas.AddRange(tempfailingLbas); @@ -190,12 +189,12 @@ namespace DiscImageChef.Commands if(remainingSectors < 512) { - currentSector += remainingSectors; - remainingSectors = 0; + currentSector += remainingSectors; + remainingSectors = 0; } else { - currentSector += 512; + currentSector += 512; remainingSectors -= 512; } } @@ -205,15 +204,14 @@ namespace DiscImageChef.Commands TimeSpan checkTime = endCheck - startCheck; - DicConsole.Write("\r" + new string(' ', System.Console.WindowWidth-1) + "\r"); + DicConsole.Write("\r" + new string(' ', System.Console.WindowWidth - 1) + "\r"); if(unknownSectors > 0) DicConsole.WriteLine("There is at least one sector that does not contain a checksum"); - if(errorSectors > 0) + if(errorSectors > 0) DicConsole.WriteLine("There is at least one sector with incorrect checksum or errors"); - if(unknownSectors == 0 && errorSectors == 0) - DicConsole.WriteLine("All sector checksums are correct"); - + if(unknownSectors == 0 && errorSectors == 0) DicConsole.WriteLine("All sector checksums are correct"); + DicConsole.VerboseWriteLine("Checking sector checksums took {0} seconds", checkTime.TotalSeconds); if(options.Verbose) @@ -221,12 +219,16 @@ namespace DiscImageChef.Commands DicConsole.VerboseWriteLine("LBAs with error:"); if(failingLbas.Count == (int)inputFormat.Info.Sectors) DicConsole.VerboseWriteLine("\tall sectors."); - else foreach(ulong t in failingLbas) DicConsole.VerboseWriteLine("\t{0}", t); + else + foreach(ulong t in failingLbas) + DicConsole.VerboseWriteLine("\t{0}", t); DicConsole.WriteLine("LBAs without checksum:"); if(unknownLbas.Count == (int)inputFormat.Info.Sectors) DicConsole.VerboseWriteLine("\tall sectors."); - else foreach(ulong t in unknownLbas) DicConsole.VerboseWriteLine("\t{0}", t); + else + foreach(ulong t in unknownLbas) + DicConsole.VerboseWriteLine("\t{0}", t); } DicConsole.WriteLine("Total sectors........... {0}", inputFormat.Info.Sectors); @@ -234,8 +236,8 @@ namespace DiscImageChef.Commands DicConsole.WriteLine("Total unknowns.......... {0}", unknownLbas.Count); DicConsole.WriteLine("Total errors+unknowns... {0}", failingLbas.Count + unknownLbas.Count); - totalSectors = (long)inputFormat.Info.Sectors; - errorSectors = failingLbas.Count; + totalSectors = (long)inputFormat.Info.Sectors; + errorSectors = failingLbas.Count; unknownSectors = unknownLbas.Count; correctSectors = totalSectors - errorSectors - unknownSectors; } diff --git a/DiscImageChef/Main.cs b/DiscImageChef/Main.cs index 8f4aee535..d62d0c8c1 100644 --- a/DiscImageChef/Main.cs +++ b/DiscImageChef/Main.cs @@ -35,6 +35,7 @@ using System.Reflection; using CommandLine; using DiscImageChef.Commands; using DiscImageChef.Console; +using DiscImageChef.Settings; using Statistics = DiscImageChef.Core.Statistics; namespace DiscImageChef @@ -48,8 +49,7 @@ namespace DiscImageChef DicConsole.ErrorWriteLineEvent += System.Console.Error.WriteLine; Settings.Settings.LoadSettings(); - if(Settings.Settings.Current.GdprCompliance < Settings.DicSettings.GdprLevel) - Configure.DoConfigure(true); + if(Settings.Settings.Current.GdprCompliance < DicSettings.GdprLevel) Configure.DoConfigure(true); Statistics.LoadStats(); if(Settings.Settings.Current.Stats != null && Settings.Settings.Current.Stats.ShareStats) Statistics.SubmitStats(); diff --git a/DiscImageChef/Options.cs b/DiscImageChef/Options.cs index 9bcdefe85..e58563f67 100644 --- a/DiscImageChef/Options.cs +++ b/DiscImageChef/Options.cs @@ -268,9 +268,9 @@ namespace DiscImageChef public string DevicePath { get; set; } // TODO: Disabled temporarily -/* [Option('r', "raw", Default = false, - HelpText = "Dump sectors with tags included. For optical media, dump scrambled sectors")] - public bool Raw { get; set; }*/ + /* [Option('r', "raw", Default = false, + 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.")] public bool StopOnError { get; set; } diff --git a/DiscImageChef/Progress.cs b/DiscImageChef/Progress.cs index a92ed063d..520fb1bd4 100644 --- a/DiscImageChef/Progress.cs +++ b/DiscImageChef/Progress.cs @@ -68,7 +68,7 @@ namespace DiscImageChef } internal static void UpdateTwoProgress(string text, long current, long maximum, string text2, long current2, - long maximum2) + long maximum2) { DicConsole.Write("\r" + text + ": " + text2); }