From 7363a5d9c59a00a17606146224d834aaf4422b8a Mon Sep 17 00:00:00 2001 From: Natalia Portillo Date: Wed, 4 Oct 2023 17:34:40 +0100 Subject: [PATCH] Redo Reformat and cleanup. Rider EAP was having a bug interpreting .editorconfig that didn't generate the code style as we wanted. This is now done with Rider-stable. --- .editorconfig | 6 +- Aaru.Checksums | 2 +- Aaru.CommonTypes | 2 +- Aaru.Compression/ADC.cs | 6 +- Aaru.Compression/AppleRle.cs | 7 +- Aaru.Compression/LZIP.cs | 4 +- Aaru.Compression/TeleDiskLzh.cs | 3 +- Aaru.Console | 2 +- Aaru.Core/DataFile.cs | 3 +- Aaru.Core/Devices/Dumping/ATA.cs | 115 ++-- .../Devices/Dumping/CompactDisc/CdiReady.cs | 34 +- Aaru.Core/Devices/Dumping/CompactDisc/Data.cs | 51 +- Aaru.Core/Devices/Dumping/CompactDisc/Dump.cs | 79 ++- .../Devices/Dumping/CompactDisc/Error.cs | 57 +- .../Devices/Dumping/CompactDisc/LeadOuts.cs | 18 +- .../Devices/Dumping/CompactDisc/Pregap.cs | 39 +- .../Devices/Dumping/CompactDisc/Recordable.cs | 3 +- Aaru.Core/Devices/Dumping/CompactDisc/Tags.cs | 6 +- .../Devices/Dumping/CompactDisc/Tracks.cs | 6 +- Aaru.Core/Devices/Dumping/CompactDisc/Trim.cs | 22 +- Aaru.Core/Devices/Dumping/Dump.cs | 6 +- .../Devices/Dumping/LinearMemory/Retrode.cs | 85 ++- Aaru.Core/Devices/Dumping/MMC.cs | 20 +- Aaru.Core/Devices/Dumping/Metadata.cs | 12 +- Aaru.Core/Devices/Dumping/MiniDisc.cs | 119 ++-- .../PlayStationPortable/MemoryStick.cs | 89 ++- .../Dumping/PlayStationPortable/UMD.cs | 75 +-- Aaru.Core/Devices/Dumping/ResumeSupport.cs | 47 +- Aaru.Core/Devices/Dumping/SSC.cs | 160 +++--- Aaru.Core/Devices/Dumping/Sbc/Data.cs | 49 +- Aaru.Core/Devices/Dumping/Sbc/Dump.cs | 166 +++--- Aaru.Core/Devices/Dumping/Sbc/Error.cs | 52 +- Aaru.Core/Devices/Dumping/Sbc/Optical.cs | 28 +- Aaru.Core/Devices/Dumping/Sbc/Trim.cs | 3 +- Aaru.Core/Devices/Dumping/SecureDigital.cs | 105 ++-- Aaru.Core/Devices/Dumping/XGD.cs | 146 +++-- Aaru.Core/Devices/Info/DeviceInfo.cs | 37 +- Aaru.Core/Devices/Reader.cs | 4 +- Aaru.Core/Devices/ReaderATA.cs | 29 +- Aaru.Core/Devices/ReaderSCSI.cs | 91 ++- Aaru.Core/Devices/Report/ATA.cs | 178 +++--- Aaru.Core/Devices/Report/GdRomSwapTrick.cs | 113 ++-- Aaru.Core/Devices/Report/MMC.cs | 50 +- Aaru.Core/Devices/Report/SSC.cs | 6 +- Aaru.Core/Devices/Report/Scsi.cs | 142 +++-- Aaru.Core/Devices/Scanning/ATA.cs | 36 +- Aaru.Core/Devices/Scanning/SCSI.cs | 42 +- Aaru.Core/Devices/Scanning/SecureDigital.cs | 26 +- Aaru.Core/Entropy.cs | 21 +- Aaru.Core/Graphics/BlockMap.cs | 7 +- Aaru.Core/Graphics/Spiral.cs | 6 +- Aaru.Core/ImageInfo.cs | 12 +- Aaru.Core/Logging/ErrorLog.cs | 18 +- Aaru.Core/Logging/IBGLog.cs | 3 +- Aaru.Core/Logging/MHDDLog.cs | 17 +- Aaru.Core/Logging/SubchannelLog.cs | 3 +- Aaru.Core/Media/CompactDisc.cs | 95 +--- Aaru.Core/Media/Detection/MMC.cs | 228 ++++---- Aaru.Core/Media/Info/CompactDisc.cs | 20 +- Aaru.Core/Media/Info/ScsiInfo.cs | 127 ++--- Aaru.Core/Options.cs | 6 +- Aaru.Core/Partitions.cs | 9 +- Aaru.Core/PluginBase.cs | 15 +- Aaru.Core/PrintScsiModePages.cs | 3 +- Aaru.Core/Remote.cs | 46 +- Aaru.Core/Sidecar/AudioMedia.cs | 3 +- Aaru.Core/Sidecar/BlockMedia.cs | 41 +- Aaru.Core/Sidecar/Files.cs | 6 +- Aaru.Core/Sidecar/OpticalDisc.cs | 39 +- Aaru.Core/Spectre.cs | 7 +- Aaru.Core/Statistics.cs | 120 ++-- Aaru.Database/Context.cs | 164 ++++-- Aaru.Decoders | 2 +- Aaru.Decryption | 2 +- Aaru.Devices/Device/AtaCommands/Ata48.cs | 12 +- Aaru.Devices/Device/Constructor.cs | 3 +- Aaru.Devices/Device/List.cs | 3 +- Aaru.Devices/Device/ScsiCommands/Kreon.cs | 5 +- Aaru.Devices/Device/ScsiCommands/MMC.cs | 10 +- Aaru.Devices/Device/ScsiCommands/Optical.cs | 3 +- Aaru.Devices/Device/ScsiCommands/SPC.cs | 25 +- Aaru.Devices/Device/ScsiCommands/SSC.cs | 3 +- Aaru.Devices/Device/ScsiCommands/SyQuest.cs | 6 +- Aaru.Devices/Linux/Command.cs | 21 +- Aaru.Devices/Linux/Device.cs | 3 +- Aaru.Devices/Linux/ListDevices.cs | 9 +- Aaru.Devices/Remote/Command.cs | 3 +- Aaru.Devices/Remote/Remote.cs | 86 ++- Aaru.Devices/Windows/Command.cs | 24 +- Aaru.Devices/Windows/Device.cs | 20 +- Aaru.Devices/Windows/ListDevices.cs | 6 +- Aaru.Dto | 2 +- Aaru.Filesystems/AODOS/Info.cs | 3 +- Aaru.Filesystems/APFS/Info.cs | 3 +- Aaru.Filesystems/Acorn/Info.cs | 29 +- Aaru.Filesystems/AmigaDOS/Info.cs | 15 +- Aaru.Filesystems/AppleCommon/Info.cs | 15 +- Aaru.Filesystems/AppleDOS/AppleDOS.cs | 4 +- Aaru.Filesystems/AppleDOS/Dir.cs | 9 +- Aaru.Filesystems/AppleDOS/File.cs | 44 +- Aaru.Filesystems/AppleDOS/Info.cs | 12 +- Aaru.Filesystems/AppleDOS/Super.cs | 3 +- Aaru.Filesystems/AppleDOS/Xattr.cs | 27 +- Aaru.Filesystems/AppleHFS/Info.cs | 25 +- Aaru.Filesystems/AppleHFSPlus/Info.cs | 12 +- Aaru.Filesystems/AppleMFS/AppleMFS.cs | 4 +- Aaru.Filesystems/AppleMFS/Dir.cs | 6 +- Aaru.Filesystems/AppleMFS/File.cs | 40 +- Aaru.Filesystems/AppleMFS/Xattr.cs | 14 +- Aaru.Filesystems/AtheOS/Info.cs | 41 +- Aaru.Filesystems/BFS/Info.cs | 26 +- Aaru.Filesystems/BTRFS/Info.cs | 18 +- Aaru.Filesystems/CBM/Info.cs | 43 +- Aaru.Filesystems/CPM/Definitions.cs | 9 +- Aaru.Filesystems/CPM/Dir.cs | 15 +- Aaru.Filesystems/CPM/File.cs | 21 +- Aaru.Filesystems/CPM/Info.cs | 41 +- Aaru.Filesystems/CPM/Super.cs | 23 +- Aaru.Filesystems/CPM/Xattr.cs | 10 +- Aaru.Filesystems/EFS/Info.cs | 7 +- Aaru.Filesystems/F2FS/Info.cs | 6 +- Aaru.Filesystems/FAT/BPB.cs | 57 +- Aaru.Filesystems/FAT/Dir.cs | 34 +- Aaru.Filesystems/FAT/FAT.cs | 24 +- Aaru.Filesystems/FAT/File.cs | 26 +- Aaru.Filesystems/FAT/Info.cs | 166 +++--- Aaru.Filesystems/FAT/Super.cs | 79 ++- Aaru.Filesystems/FAT/Xattr.cs | 9 +- Aaru.Filesystems/FATX/Dir.cs | 8 +- Aaru.Filesystems/FATX/FATX.cs | 4 +- Aaru.Filesystems/FATX/File.cs | 14 +- Aaru.Filesystems/FATX/Info.cs | 6 +- Aaru.Filesystems/FATX/Super.cs | 3 +- Aaru.Filesystems/FFS/Info.cs | 18 +- Aaru.Filesystems/HAMMER/Info.cs | 6 +- Aaru.Filesystems/HPFS/Info.cs | 5 +- Aaru.Filesystems/HPOFS/Consts.cs | 5 +- Aaru.Filesystems/HPOFS/Info.cs | 9 +- Aaru.Filesystems/ISO9660/Date.cs | 7 +- Aaru.Filesystems/ISO9660/Dir.cs | 92 +-- Aaru.Filesystems/ISO9660/File.cs | 22 +- Aaru.Filesystems/ISO9660/ISO9660.cs | 29 +- Aaru.Filesystems/ISO9660/Info.cs | 78 +-- Aaru.Filesystems/ISO9660/Mode2.cs | 41 +- Aaru.Filesystems/ISO9660/PathTable.cs | 9 +- Aaru.Filesystems/ISO9660/Structs/CDi.cs | 12 +- .../ISO9660/Structs/HighSierra.cs | 12 +- Aaru.Filesystems/ISO9660/Structs/ISO.cs | 12 +- Aaru.Filesystems/ISO9660/Structs/Joliet.cs | 24 +- Aaru.Filesystems/ISO9660/Super.cs | 36 +- Aaru.Filesystems/ISO9660/Xattr.cs | 14 +- Aaru.Filesystems/JFS/Info.cs | 3 +- Aaru.Filesystems/LisaFS/Dir.cs | 14 +- Aaru.Filesystems/LisaFS/Extent.cs | 6 +- Aaru.Filesystems/LisaFS/File.cs | 47 +- Aaru.Filesystems/LisaFS/Info.cs | 15 +- Aaru.Filesystems/LisaFS/LisaFS.cs | 12 +- Aaru.Filesystems/LisaFS/Structs.cs | 2 + Aaru.Filesystems/LisaFS/Super.cs | 7 +- Aaru.Filesystems/LisaFS/Xattr.cs | 9 +- Aaru.Filesystems/Locus/Info.cs | 6 +- Aaru.Filesystems/MinixFS/Info.cs | 15 +- Aaru.Filesystems/NTFS/Info.cs | 11 +- Aaru.Filesystems/Nintendo/Helpers.cs | 17 +- Aaru.Filesystems/Nintendo/Info.cs | 40 +- Aaru.Filesystems/ODS/Info.cs | 27 +- Aaru.Filesystems/Opera/Dir.cs | 13 +- Aaru.Filesystems/Opera/File.cs | 11 +- Aaru.Filesystems/Opera/Info.cs | 19 +- Aaru.Filesystems/Opera/Opera.cs | 4 +- Aaru.Filesystems/Opera/Super.cs | 3 +- Aaru.Filesystems/PCFX/Info.cs | 3 +- Aaru.Filesystems/PFS/Info.cs | 3 +- Aaru.Filesystems/ProDOS/Info.cs | 40 +- Aaru.Filesystems/QNX4/Info.cs | 9 +- Aaru.Filesystems/QNX6/Info.cs | 3 +- Aaru.Filesystems/RBF/Info.cs | 38 +- Aaru.Filesystems/RT11/Info.cs | 3 +- Aaru.Filesystems/ReFS/Consts.cs | 7 +- Aaru.Filesystems/ReFS/Info.cs | 6 +- Aaru.Filesystems/Reiser/Consts.cs | 15 +- Aaru.Filesystems/Reiser/Info.cs | 9 +- Aaru.Filesystems/SFS/Info.cs | 9 +- Aaru.Filesystems/SolarFS/Info.cs | 17 +- Aaru.Filesystems/SysV/Info.cs | 87 ++- Aaru.Filesystems/UCSDPascal/Dir.cs | 6 +- Aaru.Filesystems/UCSDPascal/File.cs | 26 +- Aaru.Filesystems/UCSDPascal/Info.cs | 15 +- Aaru.Filesystems/UCSDPascal/Super.cs | 18 +- Aaru.Filesystems/UCSDPascal/UCSDPascal.cs | 4 +- Aaru.Filesystems/UDF/Info.cs | 109 +++- Aaru.Filesystems/UNICOS/Info.cs | 3 +- Aaru.Filesystems/UNIXBFS/Info.cs | 3 +- Aaru.Filesystems/VMfs/Info.cs | 6 +- Aaru.Filesystems/VxFS/Info.cs | 6 +- Aaru.Filesystems/XFS/Info.cs | 26 +- Aaru.Filesystems/Xia/Info.cs | 12 +- Aaru.Filesystems/ZFS/Helpers.cs | 6 +- Aaru.Filesystems/dump/Info.cs | 15 +- Aaru.Filesystems/exFAT/Info.cs | 9 +- Aaru.Filesystems/ext2FS/Info.cs | 63 ++- Aaru.Filters/AppleDouble.cs | 6 +- Aaru.Filters/AppleSingle.cs | 6 +- Aaru.Filters/BZip2.cs | 18 +- Aaru.Filters/LZip.cs | 7 +- Aaru.Filters/MacBinary.cs | 30 +- Aaru.Filters/OffsetStream.cs | 16 +- Aaru.Filters/PCExchange.cs | 14 +- Aaru.Filters/XZ.cs | 34 +- Aaru.Generators/PluginRegisterGenerator.cs | 46 +- Aaru.Gui/ConsoleHandler.cs | 12 +- Aaru.Gui/Main.cs | 4 +- Aaru.Gui/ViewModels/Dialogs/AboutViewModel.cs | 3 +- .../ViewModels/Dialogs/ConsoleViewModel.cs | 13 +- .../ViewModels/Dialogs/EncodingsViewModel.cs | 23 +- .../ViewModels/Dialogs/StatisticsViewModel.cs | 92 ++- .../ViewModels/Panels/DeviceInfoViewModel.cs | 13 +- .../ViewModels/Panels/FileSystemViewModel.cs | 6 +- .../ViewModels/Panels/ImageInfoViewModel.cs | 38 +- .../ViewModels/Panels/MediaInfoViewModel.cs | 29 +- .../ViewModels/Panels/PartitionViewModel.cs | 3 +- .../Panels/SubdirectoryViewModel.cs | 34 +- Aaru.Gui/ViewModels/Tabs/AtaInfoViewModel.cs | 20 +- .../ViewModels/Tabs/BlurayInfoViewModel.cs | 7 +- .../Tabs/CompactDiscInfoViewModel.cs | 49 +- Aaru.Gui/ViewModels/Tabs/DvdInfoViewModel.cs | 7 +- .../Tabs/DvdWritableInfoViewModel.cs | 7 +- .../ViewModels/Tabs/PcmciaInfoViewModel.cs | 7 +- Aaru.Gui/ViewModels/Tabs/ScsiInfoViewModel.cs | 103 ++-- Aaru.Gui/ViewModels/Tabs/XboxInfoViewModel.cs | 7 +- .../Windows/ImageChecksumViewModel.cs | 8 +- .../Windows/ImageConvertViewModel.cs | 243 ++++---- .../Windows/ImageSidecarViewModel.cs | 7 +- .../ViewModels/Windows/MainWindowViewModel.cs | 48 +- .../ViewModels/Windows/MediaDumpViewModel.cs | 45 +- .../ViewModels/Windows/MediaScanViewModel.cs | 11 +- .../Windows/SplashWindowViewModel.cs | 31 +- Aaru.Helpers | 2 +- Aaru.Images/A2R/Helpers.cs | 7 +- Aaru.Images/A2R/Properties.cs | 5 +- Aaru.Images/A2R/Write.cs | 13 +- Aaru.Images/AaruFormat/CdEcc.cs | 3 +- Aaru.Images/AaruFormat/Helpers.cs | 5 +- Aaru.Images/AaruFormat/Properties.cs | 14 +- Aaru.Images/AaruFormat/Read.cs | 212 +++---- Aaru.Images/AaruFormat/Verify.cs | 26 +- Aaru.Images/AaruFormat/Write.cs | 314 +++++------ Aaru.Images/Alcohol120/Properties.cs | 46 +- Aaru.Images/Alcohol120/Read.cs | 160 +++--- Aaru.Images/Alcohol120/Write.cs | 91 ++- Aaru.Images/Anex86/Properties.cs | 12 +- Aaru.Images/Anex86/Write.cs | 6 +- Aaru.Images/Apple2MG/Constants.cs | 16 +- Aaru.Images/Apple2MG/Properties.cs | 5 +- Aaru.Images/Apple2MG/Read.cs | 28 +- Aaru.Images/Apple2MG/Write.cs | 12 +- Aaru.Images/AppleDOS/Constants.cs | 10 +- Aaru.Images/AppleDOS/Properties.cs | 10 +- Aaru.Images/AppleDOS/Read.cs | 22 +- Aaru.Images/AppleDOS/Write.cs | 26 +- Aaru.Images/AppleNIB/Constants.cs | 46 +- Aaru.Images/AppleNIB/Read.cs | 16 +- Aaru.Images/Apridisk/Properties.cs | 15 +- Aaru.Images/Apridisk/Read.cs | 15 +- Aaru.Images/Apridisk/Write.cs | 3 +- Aaru.Images/BLU/Properties.cs | 10 +- Aaru.Images/BlindWrite4/Read.cs | 132 ++--- Aaru.Images/BlindWrite5/Read.cs | 157 +++--- Aaru.Images/ByteAddressable/AtariLynx.cs | 10 +- Aaru.Images/ByteAddressable/GameBoy.cs | 10 +- Aaru.Images/ByteAddressable/GameBoyAdvance.cs | 10 +- Aaru.Images/ByteAddressable/MasterSystem.cs | 11 +- Aaru.Images/ByteAddressable/NES.cs | 13 +- Aaru.Images/ByteAddressable/Nintendo64.cs | 16 +- Aaru.Images/ByteAddressable/SegaMegaDrive.cs | 68 ++- Aaru.Images/ByteAddressable/SuperNintendo.cs | 29 +- Aaru.Images/CDRDAO/Identify.cs | 5 +- Aaru.Images/CDRDAO/Properties.cs | 31 +- Aaru.Images/CDRDAO/Read.cs | 84 +-- Aaru.Images/CDRDAO/Write.cs | 53 +- Aaru.Images/CDRWin/Helpers.cs | 3 +- Aaru.Images/CDRWin/Identify.cs | 5 +- Aaru.Images/CDRWin/Properties.cs | 49 +- Aaru.Images/CDRWin/Read.cs | 190 +++---- Aaru.Images/CDRWin/Verify.cs | 4 +- Aaru.Images/CDRWin/Write.cs | 17 +- Aaru.Images/CHD/Helpers.cs | 12 +- Aaru.Images/CPCDSK/Identify.cs | 3 +- Aaru.Images/CPCDSK/Read.cs | 25 +- Aaru.Images/CisCopy/Identify.cs | 4 +- Aaru.Images/CisCopy/Properties.cs | 5 +- Aaru.Images/CloneCD/Identify.cs | 5 +- Aaru.Images/CloneCD/Properties.cs | 30 +- Aaru.Images/CloneCD/Read.cs | 88 ++- Aaru.Images/CloneCD/Write.cs | 3 +- Aaru.Images/CopyQM/Read.cs | 9 +- Aaru.Images/CopyTape/Identify.cs | 3 +- Aaru.Images/CopyTape/Properties.cs | 50 +- Aaru.Images/CopyTape/Read.cs | 6 +- Aaru.Images/CopyTape/Write.cs | 7 +- Aaru.Images/D88/Constants.cs | 7 +- Aaru.Images/D88/Identify.cs | 7 +- Aaru.Images/D88/Read.cs | 21 +- Aaru.Images/DART/Identify.cs | 3 +- Aaru.Images/DART/Read.cs | 9 +- Aaru.Images/DiscFerret/Read.cs | 15 +- Aaru.Images/DiscJuggler/Identify.cs | 4 +- Aaru.Images/DiscJuggler/Read.cs | 37 +- Aaru.Images/DiskCopy42/Identify.cs | 3 +- Aaru.Images/DiskCopy42/Properties.cs | 10 +- Aaru.Images/DiskCopy42/Read.cs | 16 +- Aaru.Images/DiskCopy42/Write.cs | 6 +- Aaru.Images/DiskDupe/Constants.cs | 5 +- Aaru.Images/DriDiskCopy/Identify.cs | 3 +- Aaru.Images/DriDiskCopy/Properties.cs | 15 +- Aaru.Images/DriDiskCopy/Read.cs | 4 +- Aaru.Images/DriDiskCopy/Write.cs | 3 +- Aaru.Images/GDI/Identify.cs | 5 +- Aaru.Images/GDI/Read.cs | 46 +- Aaru.Images/HDCopy/Helpers.cs | 3 +- Aaru.Images/KryoFlux/Identify.cs | 5 +- Aaru.Images/KryoFlux/Read.cs | 14 +- Aaru.Images/MaxiDisk/Identify.cs | 7 +- Aaru.Images/MaxiDisk/Properties.cs | 5 +- Aaru.Images/MaxiDisk/Read.cs | 7 +- Aaru.Images/MaxiDisk/Write.cs | 3 +- Aaru.Images/NDIF/Identify.cs | 3 +- Aaru.Images/NDIF/Read.cs | 9 +- Aaru.Images/NHDr0/Properties.cs | 10 +- Aaru.Images/NHDr0/Write.cs | 3 +- Aaru.Images/Nero/Identify.cs | 3 +- Aaru.Images/Nero/Read.cs | 112 ++-- Aaru.Images/Parallels/Properties.cs | 5 +- Aaru.Images/Parallels/Write.cs | 3 +- Aaru.Images/PartClone/Read.cs | 3 +- Aaru.Images/Partimage/Read.cs | 32 +- Aaru.Images/QCOW/Properties.cs | 5 +- Aaru.Images/QCOW2/Properties.cs | 5 +- Aaru.Images/QCOW2/Write.cs | 5 +- Aaru.Images/QED/Helpers.cs | 3 +- Aaru.Images/QED/Properties.cs | 5 +- Aaru.Images/QED/Read.cs | 3 +- Aaru.Images/RayDIM/Identify.cs | 3 +- Aaru.Images/RayDIM/Properties.cs | 5 +- Aaru.Images/RsIde/Constants.cs | 5 +- Aaru.Images/RsIde/Properties.cs | 10 +- Aaru.Images/RsIde/Read.cs | 7 +- Aaru.Images/RsIde/Write.cs | 6 +- Aaru.Images/SaveDskF/Identify.cs | 5 +- Aaru.Images/SaveDskF/Properties.cs | 15 +- Aaru.Images/SuperCardPro/Helpers.cs | 10 +- Aaru.Images/SuperCardPro/Properties.cs | 5 +- Aaru.Images/SuperCardPro/Read.cs | 45 +- Aaru.Images/T98/Properties.cs | 5 +- Aaru.Images/TeleDisk/Helpers.cs | 23 +- Aaru.Images/TeleDisk/Identify.cs | 6 +- Aaru.Images/TeleDisk/Read.cs | 37 +- Aaru.Images/UDIF/Properties.cs | 5 +- Aaru.Images/UDIF/Read.cs | 6 +- Aaru.Images/UDIF/Write.cs | 20 +- Aaru.Images/UkvFdi/Read.cs | 3 +- Aaru.Images/VDI/Properties.cs | 5 +- Aaru.Images/VDI/Read.cs | 6 +- Aaru.Images/VDI/Write.cs | 3 +- Aaru.Images/VHD/Properties.cs | 5 +- Aaru.Images/VHD/Read.cs | 68 +-- Aaru.Images/VHD/Write.cs | 12 +- Aaru.Images/VHDX/Read.cs | 40 +- Aaru.Images/VMware/Identify.cs | 10 +- Aaru.Images/VMware/Properties.cs | 5 +- Aaru.Images/VMware/Read.cs | 26 +- Aaru.Images/VMware/Write.cs | 3 +- Aaru.Images/Virtual98/Constants.cs | 5 +- Aaru.Images/Virtual98/Properties.cs | 5 +- Aaru.Images/Virtual98/Write.cs | 3 +- Aaru.Images/WCDiskImage/Read.cs | 15 +- Aaru.Images/ZZZRawImage/Constants.cs | 5 +- Aaru.Images/ZZZRawImage/Identify.cs | 3 +- Aaru.Images/ZZZRawImage/Properties.cs | 27 +- Aaru.Images/ZZZRawImage/Read.cs | 39 +- Aaru.Images/ZZZRawImage/Write.cs | 6 +- Aaru.Images/ZZZRawImage/ZZZRawImage.cs | 4 +- Aaru.Partitions/Acorn.cs | 16 +- Aaru.Partitions/AppleMap.cs | 21 +- Aaru.Partitions/Apricot.cs | 72 +-- Aaru.Partitions/Atari.cs | 14 +- Aaru.Partitions/BSD.cs | 13 +- Aaru.Partitions/DEC.cs | 23 +- Aaru.Partitions/DragonFlyBSD.cs | 6 +- Aaru.Partitions/GPT.cs | 3 +- Aaru.Partitions/MBR.cs | 51 +- Aaru.Partitions/NeXT.cs | 12 +- Aaru.Partitions/PC98.cs | 7 +- Aaru.Partitions/Plan9.cs | 6 +- Aaru.Partitions/RDB.cs | 66 +-- Aaru.Partitions/RioKarma.cs | 3 +- Aaru.Partitions/SGI.cs | 18 +- Aaru.Partitions/Sun.cs | 73 +-- Aaru.Partitions/VTOC.cs | 36 +- Aaru.Partitions/Xbox.cs | 3 +- Aaru.Settings/Settings.cs | 77 ++- Aaru.Tests.Devices/DecodeATARegisters.cs | 4 +- Aaru.Tests.Devices/Main.cs | 3 +- Aaru.Tests.Devices/SCSI/SSC.cs | 35 +- Aaru.Tests.Devices/SCSI_MMC/GdRom.cs | 109 ++-- Aaru.Tests.Devices/SCSI_MMC/LeadOutTrap.cs | 64 ++- Aaru.Tests/Checksums/Adler32.cs | 25 +- Aaru.Tests/Checksums/CRC16CCITT.cs | 25 +- Aaru.Tests/Checksums/CRC16IBM.cs | 25 +- Aaru.Tests/Checksums/CRC32.cs | 25 +- Aaru.Tests/Checksums/CRC64.cs | 30 +- Aaru.Tests/Consts.cs | 7 +- Aaru.Tests/Devices/IomegaJaz.cs | 20 +- Aaru.Tests/Devices/LS120.cs | 20 +- Aaru.Tests/Devices/MultiMediaCard/CID.cs | 40 +- Aaru.Tests/Devices/MultiMediaCard/CSD.cs | 160 ++++-- .../Devices/MultiMediaCard/ExtendedCSD.cs | 300 +++++----- Aaru.Tests/Devices/PocketZip.cs | 20 +- Aaru.Tests/Devices/SecureDigital/CID.cs | 10 +- Aaru.Tests/Devices/SecureDigital/CSD.cs | 70 ++- Aaru.Tests/Devices/SecureDigital/SCR.cs | 98 +++- .../Filesystems/ReadOnlyFilesystemTest.cs | 43 +- Aaru.Tests/Helpers/Marshal.cs | 14 +- Aaru.Tests/Images/BlockMediaImageTest.cs | 12 +- Aaru.Tests/Images/OpticalMediaImageTest.cs | 31 +- Aaru.Tests/Issues/FsExtractHashIssueTest.cs | 16 +- Aaru.Tests/Issues/FsExtractIssueTest.cs | 6 +- .../Issues/OpticalImageConvertIssueTest.cs | 24 +- .../WritableOpticalMediaImageTest.cs | 112 ++-- Aaru/Commands/Configure.cs | 5 +- Aaru/Commands/Database/Statistics.cs | 29 +- Aaru/Commands/Device/DeviceReport.cs | 432 +++++--------- Aaru/Commands/Device/Info.cs | 101 ++-- Aaru/Commands/Device/List.cs | 3 +- Aaru/Commands/Filesystem/ExtractFiles.cs | 133 +++-- Aaru/Commands/Filesystem/Info.cs | 32 +- Aaru/Commands/Filesystem/Ls.cs | 45 +- Aaru/Commands/Filesystem/Options.cs | 13 +- Aaru/Commands/Formats.cs | 12 +- Aaru/Commands/Image/Checksum.cs | 207 +++---- Aaru/Commands/Image/Compare.cs | 43 +- Aaru/Commands/Image/Convert.cs | 529 +++++++++--------- Aaru/Commands/Image/CreateSidecar.cs | 85 +-- Aaru/Commands/Image/Decode.cs | 78 ++- Aaru/Commands/Image/Entropy.cs | 69 ++- Aaru/Commands/Image/Options.cs | 18 +- Aaru/Commands/Image/Print.cs | 23 +- Aaru/Commands/Image/Verify.cs | 54 +- Aaru/Commands/ListEncodings.cs | 23 +- Aaru/Commands/Media/Dump.cs | 177 ++++-- Aaru/Commands/Media/Info.cs | 72 ++- Aaru/Commands/Media/Scan.cs | 45 +- Aaru/Main.cs | 51 +- 453 files changed, 7241 insertions(+), 7126 deletions(-) diff --git a/.editorconfig b/.editorconfig index 71a05170a..103a5d927 100644 --- a/.editorconfig +++ b/.editorconfig @@ -83,7 +83,7 @@ resharper_braces_for_ifelse resharper_braces_for_while = required_for_multiline resharper_builtin_type_apply_to_native_integer = false resharper_constructor_or_destructor_body = expression_body -resharper_csharp_align_first_arg_by_paren = false +resharper_csharp_align_first_arg_by_paren = true resharper_csharp_empty_block_style = together_same_line resharper_csharp_place_comments_at_first_column = true resharper_csharp_prefer_qualified_reference = false @@ -108,6 +108,7 @@ resharper_int_align_enum_initializers resharper_int_align_eq = true resharper_keep_existing_embedded_arrangement = false resharper_keep_existing_initializer_arrangement = false +resharper_keep_existing_linebreaks = false resharper_keep_existing_list_patterns_arrangement = false resharper_keep_existing_property_patterns_arrangement = false resharper_keep_existing_switch_expression_arrangement = false @@ -125,6 +126,7 @@ resharper_outdent_statement_labels resharper_parentheses_redundancy_style = remove resharper_place_attribute_on_same_line = false resharper_place_simple_embedded_statement_on_same_line = false +resharper_place_simple_initializer_on_single_line = false resharper_qualified_using_at_nested_scope = true resharper_show_autodetect_configure_formatting_tip = false resharper_simple_block_style = on_single_line @@ -146,6 +148,8 @@ resharper_use_indent_from_vs resharper_wrap_after_dot_in_method_calls = true resharper_wrap_base_clause_style = chop_if_long resharper_wrap_braced_init_list_style = chop_if_long +resharper_wrap_chained_binary_expressions = chop_if_long +resharper_wrap_chained_method_calls = chop_if_long resharper_wrap_ctor_initializer_style = chop_if_long resharper_wrap_lines = true resharper_xmldoc_attribute_indent = align_by_first_attribute diff --git a/Aaru.Checksums b/Aaru.Checksums index d7a0a3e42..16b2a4039 160000 --- a/Aaru.Checksums +++ b/Aaru.Checksums @@ -1 +1 @@ -Subproject commit d7a0a3e42ff8fd7dc1a5c9039f6947699b0d27cf +Subproject commit 16b2a40390f9bc7519fcd8f20957fe337cff2a9f diff --git a/Aaru.CommonTypes b/Aaru.CommonTypes index 39d41b150..7796540b5 160000 --- a/Aaru.CommonTypes +++ b/Aaru.CommonTypes @@ -1 +1 @@ -Subproject commit 39d41b15039c27bd3306a61cb85c1b78b05d7fd6 +Subproject commit 7796540b5e5e81ceb5dfc2b6e775925b33da8e3d diff --git a/Aaru.Compression/ADC.cs b/Aaru.Compression/ADC.cs index edeb33330..5cc328894 100644 --- a/Aaru.Compression/ADC.cs +++ b/Aaru.Compression/ADC.cs @@ -57,11 +57,7 @@ public static class ADC static extern int AARU_adc_decode_buffer(byte[] dstBuffer, int dstSize, byte[] srcBuffer, int srcSize); [MethodImpl(MethodImplOptions.AggressiveInlining)] - static int GetChunkType(byte byt) => (byt & 0x80) == 0x80 - ? PLAIN - : (byt & 0x40) == 0x40 - ? THREE_BYTE - : TWO_BYTE; + static int GetChunkType(byte byt) => (byt & 0x80) == 0x80 ? PLAIN : (byt & 0x40) == 0x40 ? THREE_BYTE : TWO_BYTE; [MethodImpl(MethodImplOptions.AggressiveInlining)] static int GetChunkSize(byte byt) => GetChunkType(byt) switch diff --git a/Aaru.Compression/AppleRle.cs b/Aaru.Compression/AppleRle.cs index 268b0d3e7..a49b61903 100644 --- a/Aaru.Compression/AppleRle.cs +++ b/Aaru.Compression/AppleRle.cs @@ -61,8 +61,7 @@ public static class AppleRle var repeatMode = false; // true if we're repeating, false if we're just copying int inPosition = 0, outPosition = 0; - while(inPosition <= source.Length && - outPosition <= destination.Length) + while(inPosition <= source.Length && outPosition <= destination.Length) { switch(repeatMode) { @@ -102,9 +101,7 @@ public static class AppleRle byte b2 = source[inPosition++]; var s = (short)(b1 << 8 | b2); - if(s == 0 || - s >= DART_CHUNK || - s <= -DART_CHUNK) + if(s == 0 || s >= DART_CHUNK || s <= -DART_CHUNK) continue; if(s < 0) diff --git a/Aaru.Compression/LZIP.cs b/Aaru.Compression/LZIP.cs index 490a05e60..01697494d 100644 --- a/Aaru.Compression/LZIP.cs +++ b/Aaru.Compression/LZIP.cs @@ -59,7 +59,7 @@ public class LZIP /// The size of the compressed data public static int EncodeBuffer(byte[] source, byte[] destination, int dictionarySize, int matchLengthLimit) => Native.IsSupported - ? AARU_lzip_encode_buffer(destination, destination.Length, source, source.Length, - dictionarySize, matchLengthLimit) + ? AARU_lzip_encode_buffer(destination, destination.Length, source, source.Length, dictionarySize, + matchLengthLimit) : 0; } \ No newline at end of file diff --git a/Aaru.Compression/TeleDiskLzh.cs b/Aaru.Compression/TeleDiskLzh.cs index 6d2c699fc..7118e33a6 100644 --- a/Aaru.Compression/TeleDiskLzh.cs +++ b/Aaru.Compression/TeleDiskLzh.cs @@ -202,8 +202,7 @@ public class TeleDiskLzh else { // still chars from last string - while(_tdctl.Bufndx < _tdctl.Bufcnt && - count < len) + while(_tdctl.Bufndx < _tdctl.Bufcnt && count < len) { c = _textBuf[_tdctl.Bufpos + _tdctl.Bufndx & N - 1]; buf[count] = (byte)c; diff --git a/Aaru.Console b/Aaru.Console index cd6a6c04b..7fb3e7a44 160000 --- a/Aaru.Console +++ b/Aaru.Console @@ -1 +1 @@ -Subproject commit cd6a6c04b17c71f7c5909f5b2d3893db8ec81800 +Subproject commit 7fb3e7a44934431fa1bb47eb669d95cc580ecee5 diff --git a/Aaru.Core/DataFile.cs b/Aaru.Core/DataFile.cs index a74d5815c..5d3c10d11 100644 --- a/Aaru.Core/DataFile.cs +++ b/Aaru.Core/DataFile.cs @@ -116,8 +116,7 @@ public sealed class DataFile /// What is the data about? public static void WriteTo(string who, string outputPrefix, string outputSuffix, string whatWriting, byte[] data) { - if(!string.IsNullOrEmpty(outputPrefix) && - !string.IsNullOrEmpty(outputSuffix)) + if(!string.IsNullOrEmpty(outputPrefix) && !string.IsNullOrEmpty(outputSuffix)) WriteTo(who, outputPrefix + outputSuffix, data, whatWriting); } diff --git a/Aaru.Core/Devices/Dumping/ATA.cs b/Aaru.Core/Devices/Dumping/ATA.cs index 48618d638..7f27d4503 100644 --- a/Aaru.Core/Devices/Dumping/ATA.cs +++ b/Aaru.Core/Devices/Dumping/ATA.cs @@ -182,8 +182,7 @@ public partial class Dump _dev.PlatformId, ref _resume, ref currentTry, ref extents, _dev.FirmwareRevision, _private, _force); - if(currentTry == null || - extents == null) + if(currentTry == null || extents == null) { StoppingErrorMessage?.Invoke(Localization.Core.Could_not_process_resume_file_not_continuing); @@ -249,7 +248,8 @@ public partial class Dump _dumpLog.WriteLine(outputFormat.ErrorMessage); StoppingErrorMessage?.Invoke(Localization.Core.Error_creating_output_image_not_continuing + - Environment.NewLine + outputFormat.ErrorMessage); + Environment.NewLine + + outputFormat.ErrorMessage); return; } @@ -316,19 +316,15 @@ public partial class Dump if(blocks - i < blocksToRead) blocksToRead = (byte)(blocks - i); - if(currentSpeed > maxSpeed && - currentSpeed > 0) + if(currentSpeed > maxSpeed && currentSpeed > 0) maxSpeed = currentSpeed; - if(currentSpeed < minSpeed && - currentSpeed > 0) + if(currentSpeed < minSpeed && currentSpeed > 0) minSpeed = currentSpeed; UpdateProgress?. - Invoke( - string.Format(Localization.Core.Reading_sector_0_of_1_2, i, blocks, - ByteSize.FromMegabytes(currentSpeed).Per(_oneSecond).Humanize()), - (long)i, (long)blocks); + Invoke(string.Format(Localization.Core.Reading_sector_0_of_1_2, i, blocks, ByteSize.FromMegabytes(currentSpeed).Per(_oneSecond).Humanize()), + (long)i, (long)blocks); bool error = ataReader.ReadBlocks(out cmdBuf, i, blocksToRead, out duration, out _, out _); @@ -401,19 +397,18 @@ public partial class Dump _dumpStopwatch.Elapsed.Humanize(minUnit: TimeUnit.Second))); _dumpLog.WriteLine(Localization.Core.Average_dump_speed_0, - ByteSize.FromBytes(blockSize * (blocks + 1)).Per(totalDuration.Milliseconds()). + ByteSize.FromBytes(blockSize * (blocks + 1)). + Per(totalDuration.Milliseconds()). Humanize()); _dumpLog.WriteLine(string.Format(Localization.Core.Average_write_speed_0, ByteSize.FromBytes(blockSize * (blocks + 1)). - Per(imageWriteDuration.Seconds()).Humanize())); + Per(imageWriteDuration.Seconds()). + Humanize())); #region Trimming - if(_resume.BadBlocks.Count > 0 && - !_aborted && - _trim && - newTrim) + if(_resume.BadBlocks.Count > 0 && !_aborted && _trim && newTrim) { _trimStopwatch.Restart(); UpdateStatus?.Invoke(Localization.Core.Trimming_skipped_sectors); @@ -463,9 +458,7 @@ public partial class Dump #region Error handling - if(_resume.BadBlocks.Count > 0 && - !_aborted && - _retryPasses > 0) + if(_resume.BadBlocks.Count > 0 && !_aborted && _retryPasses > 0) { var pass = 1; var forward = true; @@ -489,10 +482,8 @@ public partial class Dump { PulseProgress?.Invoke(_persistent ? string. - Format( - Localization.Core. - Retrying_sector_0_pass_1_recovering_partial_data_forward, - badSector, pass) + Format(Localization.Core.Retrying_sector_0_pass_1_recovering_partial_data_forward, + badSector, pass) : string. Format(Localization.Core.Retrying_sector_0_pass_1_forward, badSector, pass)); @@ -501,10 +492,8 @@ public partial class Dump { PulseProgress?.Invoke(_persistent ? string. - Format( - Localization.Core. - Retrying_sector_0_pass_1_recovering_partial_data_reverse, - badSector, pass) + Format(Localization.Core.Retrying_sector_0_pass_1_recovering_partial_data_reverse, + badSector, pass) : string. Format(Localization.Core.Retrying_sector_0_pass_1_reverse, badSector, pass)); @@ -533,9 +522,7 @@ public partial class Dump outputFormat.WriteSector(cmdBuf, badSector); } - if(pass < _retryPasses && - !_aborted && - _resume.BadBlocks.Count > 0) + if(pass < _retryPasses && !_aborted && _resume.BadBlocks.Count > 0) { pass++; forward = !forward; @@ -601,18 +588,17 @@ public partial class Dump break; } - if(currentSpeed > maxSpeed && - currentSpeed > 0) + if(currentSpeed > maxSpeed && currentSpeed > 0) maxSpeed = currentSpeed; - if(currentSpeed < minSpeed && - currentSpeed > 0) + if(currentSpeed < minSpeed && currentSpeed > 0) minSpeed = currentSpeed; PulseProgress?. Invoke(string.Format(Localization.Core.Reading_cylinder_0_head_1_sector_2_3, cy, hd, sc, - ByteSize.FromMegabytes(currentSpeed).Per(_oneSecond). + ByteSize.FromMegabytes(currentSpeed). + Per(_oneSecond). Humanize())); bool error = @@ -627,8 +613,7 @@ public partial class Dump mhddLog.Write(currentBlock, duration); ibgLog.Write(currentBlock, currentSpeed * 1024); - outputFormat.WriteSector(cmdBuf, - (ulong)((cy * heads + hd) * sectors + (sc - 1))); + outputFormat.WriteSector(cmdBuf, (ulong)((cy * heads + hd) * sectors + (sc - 1))); imageWriteDuration += _writeStopwatch.Elapsed.TotalSeconds; extents.Add(currentBlock); @@ -692,11 +677,13 @@ public partial class Dump _dumpStopwatch.Elapsed.Humanize(minUnit: TimeUnit.Second))); _dumpLog.WriteLine(Localization.Core.Average_dump_speed_0, - ByteSize.FromBytes(blockSize * (blocks + 1)).Per(totalDuration.Milliseconds()). + ByteSize.FromBytes(blockSize * (blocks + 1)). + Per(totalDuration.Milliseconds()). Humanize()); _dumpLog.WriteLine(Localization.Core.Average_write_speed_0, - ByteSize.FromBytes(blockSize * (blocks + 1)).Per(imageWriteDuration.Seconds()). + ByteSize.FromBytes(blockSize * (blocks + 1)). + Per(imageWriteDuration.Seconds()). Humanize()); } @@ -714,7 +701,8 @@ public partial class Dump if(!outputFormat.SetImageInfo(metadata)) { - ErrorMessage?.Invoke(Localization.Core.Error_0_setting_metadata + Environment.NewLine + + ErrorMessage?.Invoke(Localization.Core.Error_0_setting_metadata + + Environment.NewLine + outputFormat.ErrorMessage); } @@ -745,12 +733,10 @@ public partial class Dump outputFormat.WriteMediaTag(ataIdentify, MediaTagType.ATA_IDENTIFY); - if(_dev.IsUsb && - _dev.UsbDescriptors != null) + if(_dev.IsUsb && _dev.UsbDescriptors != null) outputFormat.WriteMediaTag(_dev.UsbDescriptors, MediaTagType.USB_Descriptors); - if(_dev.IsPcmcia && - _dev.Cis != null) + if(_dev.IsPcmcia && _dev.Cis != null) outputFormat.WriteMediaTag(_dev.Cis, MediaTagType.PCMCIA_CIS); if(_metadata) @@ -791,8 +777,7 @@ public partial class Dump sidecar = _preSidecar; } - if(_dev.IsUsb && - _dev.UsbDescriptors != null) + if(_dev.IsUsb && _dev.UsbDescriptors != null) { _dumpLog.WriteLine(Localization.Core.Reading_USB_descriptors); UpdateStatus?.Invoke(Localization.Core.Reading_USB_descriptors); @@ -810,8 +795,7 @@ public partial class Dump }; } - if(_dev.IsPcmcia && - _dev.Cis != null) + if(_dev.IsPcmcia && _dev.Cis != null) { _dumpLog.WriteLine(Localization.Core.Reading_PCMCIA_CIS); UpdateStatus?.Invoke(Localization.Core.Reading_PCMCIA_CIS); @@ -900,7 +884,8 @@ public partial class Dump _dumpLog.WriteLine(Localization.Core.Average_checksum_speed_0, ByteSize.FromBytes(blockSize * (blocks + 1)). - Per(totalChkDuration.Milliseconds()).Humanize()); + Per(totalChkDuration.Milliseconds()). + Humanize()); List<(ulong start, string type)> filesystems = new(); @@ -915,10 +900,11 @@ public partial class Dump if(filesystems.Count > 0) { foreach(var filesystem in filesystems.Select(o => new - { - o.start, - o.type - }).Distinct()) + { + o.start, + o.type + }). + Distinct()) { UpdateStatus?.Invoke(string.Format(Localization.Core.Found_filesystem_0_at_sector_1, filesystem.type, filesystem.start)); @@ -944,9 +930,7 @@ public partial class Dump sidecar.BlockMedias[0].Size = blocks * blockSize; - if(cylinders > 0 && - heads > 0 && - sectors > 0) + if(cylinders > 0 && heads > 0 && sectors > 0) { sidecar.BlockMedias[0].Cylinders = cylinders; sidecar.BlockMedias[0].Heads = heads; @@ -969,18 +953,17 @@ public partial class Dump UpdateStatus?.Invoke(""); UpdateStatus?. - Invoke(string.Format( - Localization.Core. - Took_a_total_of_0_1_processing_commands_2_checksumming_3_writing_4_closing, - _dumpStopwatch.Elapsed.Humanize(minUnit: TimeUnit.Second), - totalDuration.Milliseconds().Humanize(minUnit: TimeUnit.Second), - totalChkDuration.Milliseconds().Humanize(minUnit: TimeUnit.Second), - imageWriteDuration.Seconds().Humanize(minUnit: TimeUnit.Second), - _imageCloseStopwatch.Elapsed.Humanize(minUnit: TimeUnit.Second))); + Invoke(string.Format(Localization.Core.Took_a_total_of_0_1_processing_commands_2_checksumming_3_writing_4_closing, + _dumpStopwatch.Elapsed.Humanize(minUnit: TimeUnit.Second), + totalDuration.Milliseconds().Humanize(minUnit: TimeUnit.Second), + totalChkDuration.Milliseconds().Humanize(minUnit: TimeUnit.Second), + imageWriteDuration.Seconds().Humanize(minUnit: TimeUnit.Second), + _imageCloseStopwatch.Elapsed.Humanize(minUnit: TimeUnit.Second))); UpdateStatus?.Invoke(string.Format(Localization.Core.Average_speed_0, ByteSize.FromBytes(blockSize * (blocks + 1)). - Per(totalDuration.Milliseconds()).Humanize())); + Per(totalDuration.Milliseconds()). + Humanize())); if(maxSpeed > 0) { diff --git a/Aaru.Core/Devices/Dumping/CompactDisc/CdiReady.cs b/Aaru.Core/Devices/Dumping/CompactDisc/CdiReady.cs index dff549cec..67fae2399 100644 --- a/Aaru.Core/Devices/Dumping/CompactDisc/CdiReady.cs +++ b/Aaru.Core/Devices/Dumping/CompactDisc/CdiReady.cs @@ -59,7 +59,10 @@ partial class Dump if(sector?.Length != 2352) return false; - byte[] syncMark = { 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00 }; + byte[] syncMark = + { + 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00 + }; var testMark = new byte[12]; Array.Copy(sector, 0, testMark, 0, 12); @@ -79,7 +82,10 @@ partial class Dump if(sector?.Length != 2352) return false; - byte[] syncMark = { 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00 }; + byte[] syncMark = + { + 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00 + }; var testMark = new byte[12]; @@ -202,19 +208,15 @@ partial class Dump } } - if(currentSpeed > maxSpeed && - currentSpeed > 0) + if(currentSpeed > maxSpeed && currentSpeed > 0) maxSpeed = currentSpeed; - if(currentSpeed < minSpeed && - currentSpeed > 0) + if(currentSpeed < minSpeed && currentSpeed > 0) minSpeed = currentSpeed; UpdateProgress?. - Invoke( - string.Format(Localization.Core.Reading_sector_0_of_1_2, i, blocks, - ByteSize.FromMegabytes(currentSpeed).Per(_oneSecond).Humanize()), - (long)i, (long)blocks); + Invoke(string.Format(Localization.Core.Reading_sector_0_of_1_2, i, blocks, ByteSize.FromMegabytes(currentSpeed).Per(_oneSecond).Humanize()), + (long)i, (long)blocks); sense = _dev.ReadCd(out cmdBuf, out senseBuf, firstSectorToRead, blockSize, blocksToRead, MmcSectorTypes.AllTypes, false, false, true, MmcHeaderCodes.AllHeaders, true, true, @@ -230,10 +232,8 @@ partial class Dump for(uint r = 0; r < _maximumReadable; r++) { UpdateProgress?. - Invoke( - string.Format(Localization.Core.Reading_sector_0_of_1_2, i + r, blocks, - ByteSize.FromMegabytes(currentSpeed).Per(_oneSecond).Humanize()), - (long)i + r, (long)blocks); + Invoke(string.Format(Localization.Core.Reading_sector_0_of_1_2, i + r, blocks, ByteSize.FromMegabytes(currentSpeed).Per(_oneSecond).Humanize()), + (long)i + r, (long)blocks); sense = _dev.ReadCd(out cmdBuf, out senseBuf, (uint)(i + r), blockSize, (uint)sectorsForOffset + 1, MmcSectorTypes.AllTypes, false, false, true, MmcHeaderCodes.AllHeaders, true, @@ -241,8 +241,7 @@ partial class Dump totalDuration += cmdDuration; - if(!sense && - !_dev.Error) + if(!sense && !_dev.Error) { mhddLog.Write(i + r, cmdDuration); ibgLog.Write(i + r, currentSpeed * 1024); @@ -325,8 +324,7 @@ partial class Dump _speedStopwatch.Restart(); - if(!sense && - !_dev.Error) + if(!sense && !_dev.Error) { if(cdiReadyReadAsAudio) { diff --git a/Aaru.Core/Devices/Dumping/CompactDisc/Data.cs b/Aaru.Core/Devices/Dumping/CompactDisc/Data.cs index 013e30b85..62e076cee 100644 --- a/Aaru.Core/Devices/Dumping/CompactDisc/Data.cs +++ b/Aaru.Core/Devices/Dumping/CompactDisc/Data.cs @@ -159,12 +159,10 @@ partial class Dump { if(j > (ulong)lastSector) { - if(!failedCrossingLeadOut && - !inData) + if(!failedCrossingLeadOut && !inData) blocksToRead += (uint)sectorsForOffset; - if(sectorsForOffset > 0 && - !inData) + if(sectorsForOffset > 0 && !inData) crossingLeadOut = true; break; @@ -194,12 +192,10 @@ partial class Dump } } - if(track.Sequence != 0 && - i + blocksToRead - (ulong)sectorsForOffset > track.EndSector + 1) + if(track.Sequence != 0 && i + blocksToRead - (ulong)sectorsForOffset > track.EndSector + 1) blocksToRead = (uint)(track.EndSector + 1 - i + (ulong)sectorsForOffset); - if(blocksToRead == 1 && - !inData) + if(blocksToRead == 1 && !inData) blocksToRead += (uint)sectorsForOffset; if(blocksToRead == 0) @@ -269,23 +265,17 @@ partial class Dump crossingLeadOut = false; } - if(currentSpeed > maxSpeed && - currentSpeed > 0) + if(currentSpeed > maxSpeed && currentSpeed > 0) maxSpeed = currentSpeed; - if(currentSpeed < minSpeed && - currentSpeed > 0) + if(currentSpeed < minSpeed && currentSpeed > 0) minSpeed = currentSpeed; UpdateProgress?. - Invoke( - string.Format(Localization.Core.Reading_sector_0_of_1_2, i, blocks, - ByteSize.FromMegabytes(currentSpeed).Per(_oneSecond).Humanize()), - (long)i, (long)blocks); + Invoke(string.Format(Localization.Core.Reading_sector_0_of_1_2, i, blocks, ByteSize.FromMegabytes(currentSpeed).Per(_oneSecond).Humanize()), + (long)i, (long)blocks); - if(crossingLeadOut && - failedCrossingLeadOut && - blocksToRead > 1) + if(crossingLeadOut && failedCrossingLeadOut && blocksToRead > 1) blocksToRead--; if(_supportsPlextorD8 && !inData) @@ -396,8 +386,7 @@ partial class Dump DecodedSense? decSense = Sense.Decode(senseBuf); // Try to workaround firmware - if(decSense is { ASC: 0x11, ASCQ: 0x05 } || - decSense?.ASC == 0x64) + if(decSense is { ASC: 0x11, ASCQ: 0x05 } || decSense?.ASC == 0x64) { sense = _dev.ReadCd(out cmdBuf, out _, firstSectorToRead, blockSize, blocksToRead, MmcSectorTypes.AllTypes, false, false, true, MmcHeaderCodes.AllHeaders, @@ -435,19 +424,15 @@ partial class Dump double elapsed; // Overcome the track mode change drive error - if(inData && - !nextData && - sense) + if(inData && !nextData && sense) { _speedStopwatch.Restart(); for(uint r = 0; r < blocksToRead; r++) { UpdateProgress?. - Invoke( - string.Format(Localization.Core.Reading_sector_0_of_1_2, i + r, blocks, - ByteSize.FromMegabytes(currentSpeed).Per(_oneSecond).Humanize()), - (long)i + r, (long)blocks); + Invoke(string.Format(Localization.Core.Reading_sector_0_of_1_2, i + r, blocks, ByteSize.FromMegabytes(currentSpeed).Per(_oneSecond).Humanize()), + (long)i + r, (long)blocks); if(_supportsPlextorD8) { @@ -504,8 +489,7 @@ partial class Dump out cmdDuration); } - if(!sense && - !_dev.Error) + if(!sense && !_dev.Error) { mhddLog.Write(i + r, cmdDuration); ibgLog.Write(i + r, currentSpeed * 1024); @@ -655,8 +639,7 @@ partial class Dump continue; } - if(!sense && - !_dev.Error) + if(!sense && !_dev.Error) { if(crossingLeadOut && failedCrossingLeadOut) { @@ -665,9 +648,7 @@ partial class Dump } // Because one block has been partially used to fix the offset - if(_fixOffset && - !inData && - offsetBytes != 0) + if(_fixOffset && !inData && offsetBytes != 0) { FixOffsetData(offsetBytes, sectorSize, sectorsForOffset, supportedSubchannel, ref blocksToRead, subSize, ref cmdBuf, blockSize, failedCrossingLeadOut); diff --git a/Aaru.Core/Devices/Dumping/CompactDisc/Dump.cs b/Aaru.Core/Devices/Dumping/CompactDisc/Dump.cs index 7acd7f8c7..facf19d55 100644 --- a/Aaru.Core/Devices/Dumping/CompactDisc/Dump.cs +++ b/Aaru.Core/Devices/Dumping/CompactDisc/Dump.cs @@ -362,9 +362,9 @@ sealed partial class Dump // Check if subchannel is BCD if(supportedSubchannel != MmcSubchannel.None) { - sense = _dev.ReadCd(out cmdBuf, out _, (firstLba / 75 + 1) * 75 + 35, blockSize, 1, - MmcSectorTypes.AllTypes, false, false, true, MmcHeaderCodes.AllHeaders, true, true, - MmcErrorField.None, supportedSubchannel, _dev.Timeout, out _); + sense = _dev.ReadCd(out cmdBuf, out _, (firstLba / 75 + 1) * 75 + 35, blockSize, 1, MmcSectorTypes.AllTypes, + false, false, true, MmcHeaderCodes.AllHeaders, true, true, MmcErrorField.None, + supportedSubchannel, _dev.Timeout, out _); if(!sense) { @@ -471,8 +471,7 @@ sealed partial class Dump ResumeSupport.Process(true, true, blocks, _dev.Manufacturer, _dev.Model, _dev.Serial, _dev.PlatformId, ref _resume, ref currentTry, ref extents, _dev.FirmwareRevision, _private, _force); - if(currentTry == null || - extents == null) + if(currentTry == null || extents == null) { StoppingErrorMessage?.Invoke(Localization.Core.Could_not_process_resume_file_not_continuing); @@ -482,8 +481,7 @@ sealed partial class Dump // Read media tags ReadCdTags(ref dskType, mediaTags, out sessions, out firstTrackLastSession); - if(!outputOptical.OpticalCapabilities.HasFlag(OpticalImageCapabilities.CanStoreSessions) && - sessions > 1) + if(!outputOptical.OpticalCapabilities.HasFlag(OpticalImageCapabilities.CanStoreSessions) && sessions > 1) { // TODO: Disabled until 6.0 /*if(!_force) @@ -578,8 +576,7 @@ sealed partial class Dump tracks = trkList.ToArray(); } - if(tracks.Any(t => t.Type == TrackType.Audio) && - desiredSubchannel != MmcSubchannel.Raw) + if(tracks.Any(t => t.Type == TrackType.Audio) && desiredSubchannel != MmcSubchannel.Raw) { _dumpLog.WriteLine(Localization.Core.WARNING_If_disc_says_CDG_CDEG_CDMIDI_dump_will_be_incorrect); @@ -789,8 +786,7 @@ sealed partial class Dump _maximumReadable /= 2; } - if(!_dev.Error || - _maximumReadable == 1) + if(!_dev.Error || _maximumReadable == 1) break; } @@ -805,8 +801,7 @@ sealed partial class Dump var cdiWithHiddenTrack1 = false; - if(dskType is MediaType.CDIREADY && - tracks.Min(t => t.Sequence) == 1) + if(dskType is MediaType.CDIREADY && tracks.Min(t => t.Sequence) == 1) { cdiWithHiddenTrack1 = true; dskType = MediaType.CDI; @@ -843,7 +838,8 @@ sealed partial class Dump _dumpLog.WriteLine(outputOptical.ErrorMessage); StoppingErrorMessage?.Invoke(Localization.Core.Error_creating_output_image_not_continuing + - Environment.NewLine + outputOptical.ErrorMessage); + Environment.NewLine + + outputOptical.ErrorMessage); return; } @@ -879,14 +875,14 @@ sealed partial class Dump // Send track list to output plugin. This may fail if subchannel is set but unsupported. ret = outputOptical.SetTracks(tracks.ToList()); - if(!ret && - desiredSubchannel == MmcSubchannel.None) + if(!ret && desiredSubchannel == MmcSubchannel.None) { _dumpLog.WriteLine(Localization.Core.Error_sending_tracks_to_output_image_not_continuing); _dumpLog.WriteLine(outputOptical.ErrorMessage); StoppingErrorMessage?.Invoke(Localization.Core.Error_sending_tracks_to_output_image_not_continuing + - Environment.NewLine + outputOptical.ErrorMessage); + Environment.NewLine + + outputOptical.ErrorMessage); return; } @@ -930,7 +926,10 @@ sealed partial class Dump _dumpLog.WriteLine(Localization.Core.Setting_flags_for_track_0, track.Sequence); UpdateStatus?.Invoke(string.Format(Localization.Core.Setting_flags_for_track_0, track.Sequence)); - outputOptical.WriteSectorTag(new[] { kvp.Value }, kvp.Key, SectorTagType.CdTrackFlags); + outputOptical.WriteSectorTag(new[] + { + kvp.Value + }, kvp.Key, SectorTagType.CdTrackFlags); } // Set MCN @@ -938,9 +937,7 @@ sealed partial class Dump { sense = _dev.ReadMcn(out mcn, out _, out _, _dev.Timeout, out _); - if(!sense && - mcn != null && - mcn != "0000000000000") + if(!sense && mcn != null && mcn != "0000000000000") { UpdateStatus?.Invoke(string.Format(Localization.Core.Found_Media_Catalogue_Number_0, mcn)); _dumpLog.WriteLine(Localization.Core.Found_Media_Catalogue_Number_0, mcn); @@ -966,8 +963,7 @@ sealed partial class Dump } } - if(supportedSubchannel != MmcSubchannel.None && - desiredSubchannel != MmcSubchannel.None) + if(supportedSubchannel != MmcSubchannel.None && desiredSubchannel != MmcSubchannel.None) { subchannelExtents = new HashSet(); @@ -1123,8 +1119,7 @@ sealed partial class Dump } } - if(!_fixOffset || - tracks.All(t => t.Type != TrackType.Audio)) + if(!_fixOffset || tracks.All(t => t.Type != TrackType.Audio)) { offsetBytes = 0; sectorsForOffset = 0; @@ -1335,9 +1330,7 @@ sealed partial class Dump ref totalDuration, subLog, desiredSubchannel, tracks, isrcs, ref mcn, subchannelExtents, smallestPregapLbaPerTrack); - if(dskType is MediaType.CDR or MediaType.CDRW && - _resume.BadBlocks.Count > 0 && - _ignoreCdrRunOuts > 0) + if(dskType is MediaType.CDR or MediaType.CDRW && _resume.BadBlocks.Count > 0 && _ignoreCdrRunOuts > 0) { HandleCdrRunOutSectors(blocks, desiredSubchannel, extents, subchannelExtents, subLog, supportsLongSectors, trackFlags, tracks); @@ -1353,9 +1346,7 @@ sealed partial class Dump subchannelExtents.Remove((int)e); } - if(subchannelExtents.Count > 0 && - _retryPasses > 0 && - _retrySubchannel) + if(subchannelExtents.Count > 0 && _retryPasses > 0 && _retrySubchannel) { RetrySubchannel(readcd, subSize, supportedSubchannel, ref totalDuration, subLog, desiredSubchannel, tracks, isrcs, ref mcn, subchannelExtents, smallestPregapLbaPerTrack); @@ -1414,7 +1405,8 @@ sealed partial class Dump if(!outputOptical.SetImageInfo(metadata)) { - ErrorMessage?.Invoke(Localization.Core.Error_0_setting_metadata + Environment.NewLine + + ErrorMessage?.Invoke(Localization.Core.Error_0_setting_metadata + + Environment.NewLine + outputOptical.ErrorMessage); } @@ -1433,8 +1425,7 @@ sealed partial class Dump _dumpLog.WriteLine(Localization.Core.Setting_ISRC_for_track_0_to_1, isrc.Key, isrc.Value); } - if(mcn != null && - outputOptical.WriteMediaTag(Encoding.ASCII.GetBytes(mcn), MediaTagType.CD_MCN)) + if(mcn != null && outputOptical.WriteMediaTag(Encoding.ASCII.GetBytes(mcn), MediaTagType.CD_MCN)) { UpdateStatus?.Invoke(string.Format(Localization.Core.Setting_disc_Media_Catalogue_Number_to_0, mcn)); _dumpLog.WriteLine(Localization.Core.Setting_disc_Media_Catalogue_Number_to_0, mcn); @@ -1454,9 +1445,7 @@ sealed partial class Dump continue; } - if(trk.Indexes.TryGetValue(0, out int idx0) && - trk.Indexes.TryGetValue(1, out int idx1) && - idx0 == idx1) + if(trk.Indexes.TryGetValue(0, out int idx0) && trk.Indexes.TryGetValue(1, out int idx1) && idx0 == idx1) trk.Indexes.Remove(0); } @@ -1492,17 +1481,17 @@ sealed partial class Dump UpdateStatus?.Invoke(""); UpdateStatus?. - Invoke(string.Format( - Localization.Core.Took_a_total_of_0_1_processing_commands_2_checksumming_3_writing_4_closing, - _dumpStopwatch.Elapsed.Humanize(minUnit: TimeUnit.Second), - totalDuration.Milliseconds().Humanize(minUnit: TimeUnit.Second), - totalChkDuration.Milliseconds().Humanize(minUnit: TimeUnit.Second), - imageWriteDuration.Seconds().Humanize(minUnit: TimeUnit.Second), - _imageCloseStopwatch.Elapsed.Humanize(minUnit: TimeUnit.Second))); + Invoke(string.Format(Localization.Core.Took_a_total_of_0_1_processing_commands_2_checksumming_3_writing_4_closing, + _dumpStopwatch.Elapsed.Humanize(minUnit: TimeUnit.Second), + totalDuration.Milliseconds().Humanize(minUnit: TimeUnit.Second), + totalChkDuration.Milliseconds().Humanize(minUnit: TimeUnit.Second), + imageWriteDuration.Seconds().Humanize(minUnit: TimeUnit.Second), + _imageCloseStopwatch.Elapsed.Humanize(minUnit: TimeUnit.Second))); UpdateStatus?.Invoke(string.Format(Localization.Core.Average_speed_0, ByteSize.FromBytes(blockSize * (blocks + 1)). - Per(totalDuration.Milliseconds()).Humanize())); + Per(totalDuration.Milliseconds()). + Humanize())); if(maxSpeed > 0) { diff --git a/Aaru.Core/Devices/Dumping/CompactDisc/Error.cs b/Aaru.Core/Devices/Dumping/CompactDisc/Error.cs index dd2fb3010..9a8085ff4 100644 --- a/Aaru.Core/Devices/Dumping/CompactDisc/Error.cs +++ b/Aaru.Core/Devices/Dumping/CompactDisc/Error.cs @@ -95,9 +95,7 @@ partial class Dump _ => PlextorSubchannel.None }; - if(_resume.BadBlocks.Count <= 0 || - _aborted || - _retryPasses <= 0) + if(_resume.BadBlocks.Count <= 0 || _aborted || _retryPasses <= 0) return; var pass = 1; @@ -127,7 +125,7 @@ partial class Dump if(dcMode10?.Pages != null) { foreach(Modes.ModePage modePage in dcMode10.Value.Pages.Where(modePage => - modePage is { Page: 0x01, Subpage: 0x00 })) + modePage is { Page: 0x01, Subpage: 0x00 })) currentModePage = modePage; } } @@ -138,8 +136,10 @@ partial class Dump if(dcMode6?.Pages != null) { - foreach(Modes.ModePage modePage in dcMode6.Value.Pages.Where(modePage => - modePage is { Page: 0x01, Subpage: 0x00 })) + foreach(Modes.ModePage modePage in dcMode6.Value.Pages.Where(modePage => modePage is + { + Page: 0x01, Subpage: 0x00 + })) currentModePage = modePage; } } @@ -227,10 +227,8 @@ partial class Dump { PulseProgress?.Invoke(runningPersistent ? string. - Format( - Localization.Core. - Retrying_sector_0_pass_1_recovering_partial_data_forward, - badSector, pass) + Format(Localization.Core.Retrying_sector_0_pass_1_recovering_partial_data_forward, + badSector, pass) : string.Format(Localization.Core.Retrying_sector_0_pass_1_forward, badSector, pass)); } @@ -238,10 +236,8 @@ partial class Dump { PulseProgress?.Invoke(runningPersistent ? string. - Format( - Localization.Core. - Retrying_sector_0_pass_1_recovering_partial_data_reverse, - badSector, pass) + Format(Localization.Core.Retrying_sector_0_pass_1_recovering_partial_data_reverse, + badSector, pass) : string.Format(Localization.Core.Retrying_sector_0_pass_1_reverse, badSector, pass)); } @@ -251,9 +247,7 @@ partial class Dump byte sectorsToReRead = 1; var badSectorToReRead = (uint)badSector; - if(_fixOffset && - audioExtents.Contains(badSector) && - offsetBytes != 0) + if(_fixOffset && audioExtents.Contains(badSector) && offsetBytes != 0) { if(offsetBytes < 0) { @@ -286,8 +280,7 @@ partial class Dump DecodedSense? decSense = Sense.Decode(senseBuf); // Try to workaround firmware - if(decSense is { ASC: 0x11, ASCQ: 0x05 } || - decSense?.ASC == 0x64) + if(decSense is { ASC: 0x11, ASCQ: 0x05 } || decSense?.ASC == 0x64) { sense = _dev.ReadCd(out cmdBuf, out _, badSectorToReRead, blockSize, sectorsToReRead, MmcSectorTypes.AllTypes, false, false, true, MmcHeaderCodes.AllHeaders, @@ -309,8 +302,7 @@ partial class Dump DecodedSense? decSense = Sense.Decode(senseBuf); // Try to workaround firmware - if(decSense is { ASC: 0x11, ASCQ: 0x05 } || - decSense?.ASC == 0x64) + if(decSense is { ASC: 0x11, ASCQ: 0x05 } || decSense?.ASC == 0x64) { sense = _dev.ReadCd(out cmdBuf, out _, badSectorToReRead, blockSize, sectorsToReRead, MmcSectorTypes.Cdda, false, false, false, MmcHeaderCodes.None, true, @@ -343,9 +335,7 @@ partial class Dump } // Because one block has been partially used to fix the offset - if(_fixOffset && - audioExtents.Contains(badSector) && - offsetBytes != 0) + if(_fixOffset && audioExtents.Contains(badSector) && offsetBytes != 0) { uint blocksToRead = sectorsToReRead; @@ -353,8 +343,7 @@ partial class Dump ref cmdBuf, blockSize, false); } - if(!sense && - !_dev.Error) + if(!sense && !_dev.Error) { _resume.BadBlocks.Remove(badSector); extents.Add(badSector); @@ -406,9 +395,7 @@ partial class Dump } } - if(pass < _retryPasses && - !_aborted && - _resume.BadBlocks.Count > 0) + if(pass < _retryPasses && !_aborted && _resume.BadBlocks.Count > 0) { pass++; forward = !forward; @@ -546,7 +533,10 @@ partial class Dump var md = new Modes.DecodedMode { Header = new Modes.ModeHeader(), - Pages = new[] { currentModePage.Value } + Pages = new[] + { + currentModePage.Value + } }; md6 = Modes.EncodeMode6(md, _dev.ScsiType); @@ -586,8 +576,7 @@ partial class Dump PlextorSubchannel supportedPlextorSubchannel; var outputOptical = _outputPlugin as IWritableOpticalImage; - if(supportedSubchannel == MmcSubchannel.None || - desiredSubchannel == MmcSubchannel.None) + if(supportedSubchannel == MmcSubchannel.None || desiredSubchannel == MmcSubchannel.None) return; supportedPlextorSubchannel = supportedSubchannel switch @@ -677,9 +666,7 @@ partial class Dump _dumpLog.WriteLine(Localization.Core.Correctly_retried_sector_0_subchannel_in_pass_1, badSector, pass); } - if(pass < _retryPasses && - !_aborted && - subchannelExtents.Count > 0) + if(pass < _retryPasses && !_aborted && subchannelExtents.Count > 0) { pass++; forward = !forward; diff --git a/Aaru.Core/Devices/Dumping/CompactDisc/LeadOuts.cs b/Aaru.Core/Devices/Dumping/CompactDisc/LeadOuts.cs index bfea45dfc..555a38cbb 100644 --- a/Aaru.Core/Devices/Dumping/CompactDisc/LeadOuts.cs +++ b/Aaru.Core/Devices/Dumping/CompactDisc/LeadOuts.cs @@ -114,12 +114,10 @@ partial class Dump double cmdDuration = 0; - if(currentSpeed > maxSpeed && - currentSpeed > 0) + if(currentSpeed > maxSpeed && currentSpeed > 0) maxSpeed = currentSpeed; - if(currentSpeed < minSpeed && - currentSpeed > 0) + if(currentSpeed < minSpeed && currentSpeed > 0) minSpeed = currentSpeed; PulseProgress?.Invoke(string.Format(Localization.Core.Reading_sector_0_at_lead_out_1, i, @@ -151,8 +149,7 @@ partial class Dump else if(read6) sense = _dev.Read6(out cmdBuf, out senseBuf, (uint)i, blockSize, 1, _dev.Timeout, out cmdDuration); - if(!sense && - !_dev.Error) + if(!sense && !_dev.Error) { mhddLog.Write(i, cmdDuration); ibgLog.Write(i, currentSpeed * 1024); @@ -295,12 +292,10 @@ partial class Dump double cmdDuration = 0; - if(currentSpeed > maxSpeed && - currentSpeed > 0) + if(currentSpeed > maxSpeed && currentSpeed > 0) maxSpeed = currentSpeed; - if(currentSpeed < minSpeed && - currentSpeed > 0) + if(currentSpeed < minSpeed && currentSpeed > 0) minSpeed = currentSpeed; PulseProgress?.Invoke(string.Format(Localization.Core.Reading_sector_0_at_lead_out_1, i, @@ -332,8 +327,7 @@ partial class Dump else if(read6) sense = _dev.Read6(out cmdBuf, out senseBuf, (uint)i, blockSize, 1, _dev.Timeout, out cmdDuration); - if(!sense && - !_dev.Error) + if(!sense && !_dev.Error) { mhddLog.Write(i, cmdDuration, _maximumReadable); ibgLog.Write(i, currentSpeed * 1024); diff --git a/Aaru.Core/Devices/Dumping/CompactDisc/Pregap.cs b/Aaru.Core/Devices/Dumping/CompactDisc/Pregap.cs index 1832fef26..7313f9545 100644 --- a/Aaru.Core/Devices/Dumping/CompactDisc/Pregap.cs +++ b/Aaru.Core/Devices/Dumping/CompactDisc/Pregap.cs @@ -98,8 +98,7 @@ partial class Dump // ReSharper restore IntVariableOverflowInUncheckedContext - if(!sense && - !_dev.Error) + if(!sense && !_dev.Error) { firstTrackPregapMs.Write(cmdBuf, 0, (int)blockSize); gotFirstTrackPregap = true; @@ -163,8 +162,7 @@ partial class Dump Dictionary pregaps = new(); inexactPositioning = false; - if(!supportsPqSubchannel && - !supportsRwSubchannel) + if(!supportsPqSubchannel && !supportsRwSubchannel) return; // Check if subchannel is BCD @@ -220,9 +218,7 @@ partial class Dump continue; } - if(t > 0 && - tracks[t - 1].Type == tracks[t].Type && - dumping) + if(t > 0 && tracks[t - 1].Type == tracks[t].Type && dumping) { AaruConsole.DebugWriteLine(PREGAP_MODULE_NAME, Localization.Core.Skipping_track_0, track.Sequence); @@ -331,9 +327,7 @@ partial class Dump posQ = subBuf[7] * 60 * 75 + subBuf[8] * 75 + subBuf[9] - 150; - if(subBuf[1] != track.Sequence - 1 || - subBuf[2] == 0 || - posQ != lba) + if(subBuf[1] != track.Sequence - 1 || subBuf[2] == 0 || posQ != lba) break; pregaps[track.Sequence] = 0; @@ -347,8 +341,7 @@ partial class Dump // Calculate pregap lba = (int)track.StartSector - 150; - while(lba > (int)previousTrack.StartSector && - lba <= (int)track.StartSector) + while(lba > (int)previousTrack.StartSector && lba <= (int)track.StartSector) { // Some drives crash if you try to read just before the previous read, so seek away first if(!forward) @@ -463,17 +456,13 @@ partial class Dump { dumpLog?. WriteLine(string. - Format( - Localization.Core. - Could_not_read_subchannel_for_this_track_supposing_0_sectors, - pregaps[track.Sequence])); + Format(Localization.Core.Could_not_read_subchannel_for_this_track_supposing_0_sectors, + pregaps[track.Sequence])); updateStatus?. Invoke(string. - Format( - Localization.Core. - Could_not_read_subchannel_for_this_track_supposing_0_sectors, - pregaps[track.Sequence])); + Format(Localization.Core.Could_not_read_subchannel_for_this_track_supposing_0_sectors, + pregaps[track.Sequence])); } break; @@ -547,8 +536,7 @@ partial class Dump } // Same track, but not pregap - if(subBuf[1] == track.Sequence && - subBuf[2] > 0) + if(subBuf[1] == track.Sequence && subBuf[2] > 0) { lba--; forward = false; @@ -568,8 +556,8 @@ partial class Dump if(diff != 0) { - AaruConsole.DebugWriteLine(PREGAP_MODULE_NAME, - Localization.Core.Invalid_Q_position_for_LBA_0_got_1, lba, posQ); + AaruConsole.DebugWriteLine(PREGAP_MODULE_NAME, Localization.Core.Invalid_Q_position_for_LBA_0_got_1, + lba, posQ); inexactPositioning = true; } @@ -626,8 +614,7 @@ partial class Dump // Minus five, to ensure dumping will fix if there is a pregap LBA 0 var red = 5; - while(trk.Pregap > 0 && - red > 0) + while(trk.Pregap > 0 && red > 0) { trk.Pregap--; red--; diff --git a/Aaru.Core/Devices/Dumping/CompactDisc/Recordable.cs b/Aaru.Core/Devices/Dumping/CompactDisc/Recordable.cs index 3b95c6962..136883cdf 100644 --- a/Aaru.Core/Devices/Dumping/CompactDisc/Recordable.cs +++ b/Aaru.Core/Devices/Dumping/CompactDisc/Recordable.cs @@ -100,8 +100,7 @@ partial class Dump continue; } - if(track.Type != TrackType.Audio && - track.Type != TrackType.Data) + if(track.Type != TrackType.Audio && track.Type != TrackType.Data) { SectorBuilder sb = new(); sb.ReconstructPrefix(ref sector, track.Type, (long)s); diff --git a/Aaru.Core/Devices/Dumping/CompactDisc/Tags.cs b/Aaru.Core/Devices/Dumping/CompactDisc/Tags.cs index 310c21045..a04c9a64f 100644 --- a/Aaru.Core/Devices/Dumping/CompactDisc/Tags.cs +++ b/Aaru.Core/Devices/Dumping/CompactDisc/Tags.cs @@ -91,8 +91,7 @@ partial class Dump { DiscInformation.StandardDiscInformation? discInfo = DiscInformation.Decode000b(cmdBuf); - if(discInfo.HasValue && - mediaType == MediaType.CD) + if(discInfo.HasValue && mediaType == MediaType.CD) { mediaType = discInfo.Value.DiscType switch { @@ -107,8 +106,7 @@ partial class Dump UpdateStatus?.Invoke(Localization.Core.Reading_PMA); sense = _dev.ReadPma(out cmdBuf, out _, _dev.Timeout, out _); - if(!sense && - PMA.Decode(cmdBuf).HasValue) + if(!sense && PMA.Decode(cmdBuf).HasValue) { tmpBuf = new byte[cmdBuf.Length - 4]; Array.Copy(cmdBuf, 4, tmpBuf, 0, cmdBuf.Length - 4); diff --git a/Aaru.Core/Devices/Dumping/CompactDisc/Tracks.cs b/Aaru.Core/Devices/Dumping/CompactDisc/Tracks.cs index 70475a631..600672080 100644 --- a/Aaru.Core/Devices/Dumping/CompactDisc/Tracks.cs +++ b/Aaru.Core/Devices/Dumping/CompactDisc/Tracks.cs @@ -114,8 +114,7 @@ partial class Dump ? TrackType.Data : TrackType.Audio, StartSector = - (ulong)(trk.PHOUR * 3600 * 75 + trk.PMIN * 60 * 75 + trk.PSEC * 75 + trk.PFRAME - - 150), + (ulong)(trk.PHOUR * 3600 * 75 + trk.PMIN * 60 * 75 + trk.PSEC * 75 + trk.PFRAME - 150), BytesPerSector = (int)sectorSize, RawBytesPerSector = (int)sectorSize }); @@ -185,8 +184,7 @@ partial class Dump TOC.CDTOC? oldToc = TOC.Decode(cmdBuf); - if((sense || !oldToc.HasValue) && - !force) + if((sense || !oldToc.HasValue) && !force) { dumpLog?.WriteLine(Localization.Core. Could_not_read_TOC_if_you_want_to_continue_use_force_and_will_try_from_LBA_0_to_360000); diff --git a/Aaru.Core/Devices/Dumping/CompactDisc/Trim.cs b/Aaru.Core/Devices/Dumping/CompactDisc/Trim.cs index 22d3f5392..a324681f5 100644 --- a/Aaru.Core/Devices/Dumping/CompactDisc/Trim.cs +++ b/Aaru.Core/Devices/Dumping/CompactDisc/Trim.cs @@ -99,10 +99,7 @@ partial class Dump _ => PlextorSubchannel.None }; - if(_resume.BadBlocks.Count <= 0 || - _aborted || - !_trim || - !newTrim) + if(_resume.BadBlocks.Count <= 0 || _aborted || !_trim || !newTrim) return; UpdateStatus?.Invoke(Localization.Core.Trimming_skipped_sectors); @@ -133,9 +130,7 @@ partial class Dump byte sectorsToTrim = 1; var badSectorToRead = (uint)badSector; - if(_fixOffset && - audioExtents.Contains(badSector) && - offsetBytes != 0) + if(_fixOffset && audioExtents.Contains(badSector) && offsetBytes != 0) { if(offsetBytes < 0) { @@ -166,8 +161,7 @@ partial class Dump DecodedSense? decSense = Sense.Decode(senseBuf); // Try to workaround firmware - if(decSense is { ASC: 0x11, ASCQ: 0x05 } || - decSense?.ASC == 0x64) + if(decSense is { ASC: 0x11, ASCQ: 0x05 } || decSense?.ASC == 0x64) { sense = _dev.ReadCd(out cmdBuf, out _, badSectorToRead, blockSize, sectorsToTrim, MmcSectorTypes.AllTypes, false, false, true, MmcHeaderCodes.AllHeaders, @@ -233,8 +227,7 @@ partial class Dump continue; } - if(!sense && - !_dev.Error) + if(!sense && !_dev.Error) { _resume.BadBlocks.Remove(badSector); extents.Add(badSector); @@ -242,9 +235,7 @@ partial class Dump } // Because one block has been partially used to fix the offset - if(_fixOffset && - audioExtents.Contains(badSector) && - offsetBytes != 0) + if(_fixOffset && audioExtents.Contains(badSector) && offsetBytes != 0) { uint blocksToRead = sectorsToTrim; @@ -281,8 +272,7 @@ partial class Dump outputOptical.SetTracks(tracks.ToList()); - if(track.StartSector != trkStartBefore && - !_resume.BadBlocks.Contains(track.StartSector)) + if(track.StartSector != trkStartBefore && !_resume.BadBlocks.Contains(track.StartSector)) { _resume.BadBlocks.Add(track.StartSector); diff --git a/Aaru.Core/Devices/Dumping/Dump.cs b/Aaru.Core/Devices/Dumping/Dump.cs index 53bb00590..e990d4f6d 100644 --- a/Aaru.Core/Devices/Dumping/Dump.cs +++ b/Aaru.Core/Devices/Dumping/Dump.cs @@ -230,7 +230,8 @@ public partial class Dump _ctx = AaruContext.Create(Settings.Settings.MainDbPath); // Search for device in main database - _dbDev = _ctx.Devices.FirstOrDefault(d => d.Manufacturer == _dev.Manufacturer && d.Model == _dev.Model && + _dbDev = _ctx.Devices.FirstOrDefault(d => d.Manufacturer == _dev.Manufacturer && + d.Model == _dev.Model && d.Revision == _dev.FirmwareRevision); if(_dbDev is null) @@ -293,8 +294,7 @@ public partial class Dump _errorLog.Close(); _dumpLog.Close(); - if(_resume == null || - !_doResume) + if(_resume == null || !_doResume) return; _resume.LastWriteDate = DateTime.UtcNow; diff --git a/Aaru.Core/Devices/Dumping/LinearMemory/Retrode.cs b/Aaru.Core/Devices/Dumping/LinearMemory/Retrode.cs index 8a885ecfc..d48a2c776 100644 --- a/Aaru.Core/Devices/Dumping/LinearMemory/Retrode.cs +++ b/Aaru.Core/Devices/Dumping/LinearMemory/Retrode.cs @@ -163,10 +163,7 @@ public partial class Dump break; } - if(!sfcFound && - !genesisFound && - !smsFound && - !n64Found) + if(!sfcFound && !genesisFound && !smsFound && !n64Found) { StoppingErrorMessage?.Invoke(Localization.Core.No_cartridge_found_not_dumping); _dumpLog.WriteLine(Localization.Core.No_cartridge_found_not_dumping); @@ -177,17 +174,11 @@ public partial class Dump var cluster = BitConverter.ToUInt16(buffer, romPos + 0x1A); var romSize = BitConverter.ToUInt32(buffer, romPos + 0x1C); - MediaType mediaType = gbaFound - ? MediaType.GameBoyAdvanceGamePak - : gbFound || gbcFound - ? MediaType.GameBoyGamePak - : n64Found - ? MediaType.N64GamePak - : smsFound - ? MediaType.MasterSystemCartridge - : genesisFound - ? MediaType.MegaDriveCartridge - : MediaType.SNESGamePak; + MediaType mediaType = gbaFound ? MediaType.GameBoyAdvanceGamePak : + gbFound || gbcFound ? MediaType.GameBoyGamePak : + n64Found ? MediaType.N64GamePak : + smsFound ? MediaType.MasterSystemCartridge : + genesisFound ? MediaType.MegaDriveCartridge : MediaType.SNESGamePak; uint blocksToRead = 64; double totalDuration = 0; @@ -196,8 +187,7 @@ public partial class Dump double minSpeed = double.MaxValue; byte[] senseBuf; - if(_outputPlugin is not IByteAddressableImage outputBai || - !outputBai.SupportedMediaTypes.Contains(mediaType)) + if(_outputPlugin is not IByteAddressableImage outputBai || !outputBai.SupportedMediaTypes.Contains(mediaType)) { _dumpLog.WriteLine(Localization.Core.The_specified_format_does_not_support_the_inserted_cartridge); @@ -257,7 +247,8 @@ public partial class Dump _dumpLog.WriteLine(outputBai.ErrorMessage); StoppingErrorMessage?.Invoke(Localization.Core.Error_creating_output_image_not_continuing + - Environment.NewLine + outputBai.ErrorMessage); + Environment.NewLine + + outputBai.ErrorMessage); return; } @@ -285,19 +276,15 @@ public partial class Dump if(romSectors - i < blocksToRead) blocksToRead = (uint)(romSectors - i); - if(currentSpeed > maxSpeed && - currentSpeed > 0) + if(currentSpeed > maxSpeed && currentSpeed > 0) maxSpeed = currentSpeed; - if(currentSpeed < minSpeed && - currentSpeed > 0) + if(currentSpeed < minSpeed && currentSpeed > 0) minSpeed = currentSpeed; UpdateProgress?. - Invoke( - string.Format(Localization.Core.Reading_byte_0_of_1_2, i * 512, romSize, - ByteSize.FromMegabytes(currentSpeed).Per(_oneSecond).Humanize()), - (long)i * 512, romSize); + Invoke(string.Format(Localization.Core.Reading_byte_0_of_1_2, i * 512, romSize, ByteSize.FromMegabytes(currentSpeed).Per(_oneSecond).Humanize()), + (long)i * 512, romSize); sense = _dev.Read10(out readBuffer, out senseBuf, 0, false, true, false, false, (uint)(startSector + i), 512, 0, (ushort)blocksToRead, _dev.Timeout, out double cmdDuration); @@ -306,8 +293,7 @@ public partial class Dump _writeStopwatch.Restart(); - if(!sense && - !_dev.Error) + if(!sense && !_dev.Error) { outputBai.WriteBytes(readBuffer, 0, readBuffer.Length, out _); imageWriteDuration += _writeStopwatch.Elapsed.TotalSeconds; @@ -341,30 +327,24 @@ public partial class Dump _speedStopwatch.Stop(); - if(romRemaining > 0 && - !_aborted) + if(romRemaining > 0 && !_aborted) { - if(currentSpeed > maxSpeed && - currentSpeed > 0) + if(currentSpeed > maxSpeed && currentSpeed > 0) maxSpeed = currentSpeed; - if(currentSpeed < minSpeed && - currentSpeed > 0) + if(currentSpeed < minSpeed && currentSpeed > 0) minSpeed = currentSpeed; UpdateProgress?. - Invoke( - string.Format(Localization.Core.Reading_byte_0_of_1_2, romSectors * 512, romSize, - ByteSize.FromMegabytes(currentSpeed).Per(_oneSecond).Humanize()), - (long)romSectors * 512, romSize); + Invoke(string.Format(Localization.Core.Reading_byte_0_of_1_2, romSectors * 512, romSize, ByteSize.FromMegabytes(currentSpeed).Per(_oneSecond).Humanize()), + (long)romSectors * 512, romSize); sense = _dev.Read10(out readBuffer, out senseBuf, 0, false, true, false, false, romSectors, 512, 0, 1, _dev.Timeout, out double cmdDuration); totalDuration += cmdDuration; - if(!sense && - !_dev.Error) + if(!sense && !_dev.Error) { _writeStopwatch.Restart(); outputBai.WriteBytes(readBuffer, 0, (int)romRemaining, out _); @@ -401,11 +381,13 @@ public partial class Dump _dumpStopwatch.Elapsed.Humanize(minUnit: TimeUnit.Second))); _dumpLog.WriteLine(string.Format(Localization.Core.Average_dump_speed_0, - ByteSize.FromBytes(512 * (romSectors + 1)).Per(totalDuration.Milliseconds()). + ByteSize.FromBytes(512 * (romSectors + 1)). + Per(totalDuration.Milliseconds()). Humanize())); _dumpLog.WriteLine(string.Format(Localization.Core.Average_write_speed_0, - ByteSize.FromBytes(512 * (romSectors + 1)).Per(imageWriteDuration.Seconds()). + ByteSize.FromBytes(512 * (romSectors + 1)). + Per(imageWriteDuration.Seconds()). Humanize())); var metadata = new CommonTypes.Structs.ImageInfo @@ -416,7 +398,8 @@ public partial class Dump if(!outputBai.SetImageInfo(metadata)) { - ErrorMessage?.Invoke(Localization.Core.Error_0_setting_metadata + Environment.NewLine + + ErrorMessage?.Invoke(Localization.Core.Error_0_setting_metadata + + Environment.NewLine + outputBai.ErrorMessage); } @@ -452,16 +435,16 @@ public partial class Dump UpdateStatus?.Invoke(""); UpdateStatus?. - Invoke(string.Format( - Localization.Core.Took_a_total_of_0_1_processing_commands_2_checksumming_3_writing_4_closing, - _dumpStopwatch.Elapsed.Humanize(minUnit: TimeUnit.Second), - totalDuration.Milliseconds().Humanize(minUnit: TimeUnit.Second), - totalChkDuration.Milliseconds().Humanize(minUnit: TimeUnit.Second), - imageWriteDuration.Seconds().Humanize(minUnit: TimeUnit.Second), - _imageCloseStopwatch.Elapsed.Humanize(minUnit: TimeUnit.Second))); + Invoke(string.Format(Localization.Core.Took_a_total_of_0_1_processing_commands_2_checksumming_3_writing_4_closing, + _dumpStopwatch.Elapsed.Humanize(minUnit: TimeUnit.Second), + totalDuration.Milliseconds().Humanize(minUnit: TimeUnit.Second), + totalChkDuration.Milliseconds().Humanize(minUnit: TimeUnit.Second), + imageWriteDuration.Seconds().Humanize(minUnit: TimeUnit.Second), + _imageCloseStopwatch.Elapsed.Humanize(minUnit: TimeUnit.Second))); UpdateStatus?.Invoke(string.Format(Localization.Core.Average_speed_0, - ByteSize.FromBytes(512 * (romSectors + 1)).Per(totalDuration.Milliseconds()). + ByteSize.FromBytes(512 * (romSectors + 1)). + Per(totalDuration.Milliseconds()). Humanize())); if(maxSpeed > 0) diff --git a/Aaru.Core/Devices/Dumping/MMC.cs b/Aaru.Core/Devices/Dumping/MMC.cs index 142c366cf..483eb7d51 100644 --- a/Aaru.Core/Devices/Dumping/MMC.cs +++ b/Aaru.Core/Devices/Dumping/MMC.cs @@ -212,8 +212,7 @@ partial class Dump sense = _dev.ModeSense6(out cmdBuf, out _, false, ScsiModeSensePageControl.Current, 0x00, _dev.Timeout, out _); - if(!sense && - !_dev.Error) + if(!sense && !_dev.Error) decMode = Modes.DecodeMode6(cmdBuf, PeripheralDeviceTypes.MultiMediaDevice); } else @@ -239,8 +238,7 @@ partial class Dump sense = _dev.ModeSense10(out cmdBuf, out _, false, false, ScsiModeSensePageControl.Current, 0x00, 0x00, _dev.Timeout, out _); - if(!sense && - !_dev.Error) + if(!sense && !_dev.Error) decMode = Modes.DecodeMode10(cmdBuf, PeripheralDeviceTypes.MultiMediaDevice); } else @@ -387,8 +385,7 @@ partial class Dump if(!sense) { - if(DMI.IsXbox(cmdBuf) || - DMI.IsXbox360(cmdBuf)) + if(DMI.IsXbox(cmdBuf) || DMI.IsXbox360(cmdBuf)) { if(DMI.IsXbox(cmdBuf)) dskType = MediaType.XGD; @@ -558,11 +555,9 @@ partial class Dump { UpdateStatus?. Invoke(string. - Format( - Localization.Core. - Drive_reports_0_copy_protection_not_yet_supported_dump_incorrect, - (CSS_CPRM.DecodeLeadInCopyright(cmdBuf)?.CopyrightType ?? - CopyrightType.NoProtection).ToString())); + Format(Localization.Core.Drive_reports_0_copy_protection_not_yet_supported_dump_incorrect, + (CSS_CPRM.DecodeLeadInCopyright(cmdBuf)?.CopyrightType ?? + CopyrightType.NoProtection).ToString())); } } } @@ -889,8 +884,7 @@ partial class Dump CSS_CPRM.LeadInCopyright? cpy = CSS_CPRM.DecodeLeadInCopyright(tmp); - if(cpy.HasValue && - cpy.Value.CopyrightType != CopyrightType.NoProtection) + if(cpy.HasValue && cpy.Value.CopyrightType != CopyrightType.NoProtection) sidecar.OpticalDiscs[0].CopyProtection = cpy.Value.CopyrightType.ToString(); break; diff --git a/Aaru.Core/Devices/Dumping/Metadata.cs b/Aaru.Core/Devices/Dumping/Metadata.cs index e25761411..5f297034d 100644 --- a/Aaru.Core/Devices/Dumping/Metadata.cs +++ b/Aaru.Core/Devices/Dumping/Metadata.cs @@ -103,7 +103,8 @@ partial class Dump _sidecarStopwatch.Elapsed.Humanize(minUnit: TimeUnit.Second)); _dumpLog.WriteLine(Localization.Core.Average_checksum_speed_0, - ByteSize.FromBytes(blockSize * (blocks + 1)).Per(totalChkDuration.Milliseconds()). + ByteSize.FromBytes(blockSize * (blocks + 1)). + Per(totalChkDuration.Milliseconds()). Humanize()); if(_preSidecar != null) @@ -127,10 +128,11 @@ partial class Dump if(filesystems.Count > 0) { foreach(var filesystem in filesystems.Select(o => new - { - o.start, - o.type - }).Distinct()) + { + o.start, + o.type + }). + Distinct()) _dumpLog.WriteLine(Localization.Core.Found_filesystem_0_at_sector_1, filesystem.type, filesystem.start); } diff --git a/Aaru.Core/Devices/Dumping/MiniDisc.cs b/Aaru.Core/Devices/Dumping/MiniDisc.cs index 7a6ea99a9..cce3e56e6 100644 --- a/Aaru.Core/Devices/Dumping/MiniDisc.cs +++ b/Aaru.Core/Devices/Dumping/MiniDisc.cs @@ -89,9 +89,7 @@ partial class Dump sense = _dev.ModeSense6(out byte[] cmdBuf, out _, true, ScsiModeSensePageControl.Current, 0x3F, 5, out _); - if(!sense && - !_dev.Error && - Modes.DecodeMode6(cmdBuf, _dev.ScsiType).HasValue) + if(!sense && !_dev.Error && Modes.DecodeMode6(cmdBuf, _dev.ScsiType).HasValue) decMode = Modes.DecodeMode6(cmdBuf, _dev.ScsiType); if(decMode.HasValue) @@ -171,20 +169,17 @@ partial class Dump sense = _dev.MiniDiscGetType(out cmdBuf, out _, _dev.Timeout, out _); - if(!sense && - !_dev.Error) + if(!sense && !_dev.Error) mediaTags.Add(MediaTagType.MiniDiscType, cmdBuf); sense = _dev.MiniDiscD5(out cmdBuf, out _, _dev.Timeout, out _); - if(!sense && - !_dev.Error) + if(!sense && !_dev.Error) mediaTags.Add(MediaTagType.MiniDiscD5, cmdBuf); sense = _dev.MiniDiscReadDataTOC(out cmdBuf, out _, _dev.Timeout, out _); - if(!sense && - !_dev.Error) + if(!sense && !_dev.Error) mediaTags.Add(MediaTagType.MiniDiscDTOC, cmdBuf); var utocMs = new MemoryStream(); @@ -243,7 +238,8 @@ partial class Dump _dumpLog.WriteLine(outputFormat.ErrorMessage); StoppingErrorMessage?.Invoke(Localization.Core.Error_creating_output_image_not_continuing + - Environment.NewLine + outputFormat.ErrorMessage); + Environment.NewLine + + outputFormat.ErrorMessage); return; } @@ -273,11 +269,9 @@ partial class Dump UpdateStatus?. Invoke(string. - Format( - Localization.Core. - Setting_geometry_to_0_cylinders_1_heads_2_sectors_per_track, - rigidPage.Value.Cylinders, rigidPage.Value.Heads, - (uint)(blocks / (rigidPage.Value.Cylinders * rigidPage.Value.Heads)))); + Format(Localization.Core.Setting_geometry_to_0_cylinders_1_heads_2_sectors_per_track, + rigidPage.Value.Cylinders, rigidPage.Value.Heads, + (uint)(blocks / (rigidPage.Value.Cylinders * rigidPage.Value.Heads)))); outputFormat.SetGeometry(rigidPage.Value.Cylinders, rigidPage.Value.Heads, (uint)(blocks / (rigidPage.Value.Cylinders * rigidPage.Value.Heads))); @@ -300,11 +294,9 @@ partial class Dump UpdateStatus?. Invoke(string. - Format( - Localization.Core. - Setting_geometry_to_0_cylinders_1_heads_2_sectors_per_track, - flexiblePage.Value.Cylinders, flexiblePage.Value.Heads, - flexiblePage.Value.SectorsPerTrack)); + Format(Localization.Core.Setting_geometry_to_0_cylinders_1_heads_2_sectors_per_track, + flexiblePage.Value.Cylinders, flexiblePage.Value.Heads, + flexiblePage.Value.SectorsPerTrack)); outputFormat.SetGeometry(flexiblePage.Value.Cylinders, flexiblePage.Value.Heads, flexiblePage.Value.SectorsPerTrack); @@ -324,8 +316,7 @@ partial class Dump _dev.PlatformId, ref _resume, ref currentTry, ref extents, _dev.FirmwareRevision, _private, _force); - if(currentTry == null || - extents == null) + if(currentTry == null || extents == null) { StoppingErrorMessage?.Invoke(Localization.Core.Could_not_process_resume_file_not_continuing); @@ -375,27 +366,22 @@ partial class Dump if(blocks - i < blocksToRead) blocksToRead = (uint)(blocks - i); - if(currentSpeed > maxSpeed && - currentSpeed > 0) + if(currentSpeed > maxSpeed && currentSpeed > 0) maxSpeed = currentSpeed; - if(currentSpeed < minSpeed && - currentSpeed > 0) + if(currentSpeed < minSpeed && currentSpeed > 0) minSpeed = currentSpeed; UpdateProgress?. - Invoke( - string.Format(Localization.Core.Reading_sector_0_of_1_2, i, blocks, - ByteSize.FromMegabytes(currentSpeed).Per(_oneSecond).Humanize()), - (long)i, (long)blocks); + Invoke(string.Format(Localization.Core.Reading_sector_0_of_1_2, i, blocks, ByteSize.FromMegabytes(currentSpeed).Per(_oneSecond).Humanize()), + (long)i, (long)blocks); sense = _dev.Read6(out readBuffer, out _, (uint)i, blockSize, (byte)blocksToRead, _dev.Timeout, out double cmdDuration); totalDuration += cmdDuration; - if(!sense && - !_dev.Error) + if(!sense && !_dev.Error) { mhddLog.Write(i, cmdDuration, blocksToRead); ibgLog.Write(i, currentSpeed * 1024); @@ -478,10 +464,7 @@ partial class Dump #region Trimming - if(_resume.BadBlocks.Count > 0 && - !_aborted && - _trim && - newTrim) + if(_resume.BadBlocks.Count > 0 && !_aborted && _trim && newTrim) { _trimStopwatch.Restart(); UpdateStatus?.Invoke(Localization.Core.Trimming_skipped_sectors); @@ -528,9 +511,7 @@ partial class Dump #region Error handling - if(_resume.BadBlocks.Count > 0 && - !_aborted && - _retryPasses > 0) + if(_resume.BadBlocks.Count > 0 && !_aborted && _retryPasses > 0) { var pass = 1; var forward = true; @@ -553,7 +534,7 @@ partial class Dump if(dcMode6?.Pages != null) { foreach(Modes.ModePage modePage in dcMode6.Value.Pages.Where(modePage => - modePage is { Page: 0x01, Subpage: 0x00 })) + modePage is { Page: 0x01, Subpage: 0x00 })) currentModePage = modePage; } } @@ -649,10 +630,8 @@ partial class Dump { PulseProgress?.Invoke(runningPersistent ? string. - Format( - Localization.Core. - Retrying_sector_0_pass_1_recovering_partial_data_forward, - badSector, pass) + Format(Localization.Core.Retrying_sector_0_pass_1_recovering_partial_data_forward, + badSector, pass) : string.Format(Localization.Core.Retrying_sector_0_pass_1_forward, badSector, pass)); } @@ -660,10 +639,8 @@ partial class Dump { PulseProgress?.Invoke(runningPersistent ? string. - Format( - Localization.Core. - Retrying_sector_0_pass_1_recovering_partial_data_reverse, - badSector, pass) + Format(Localization.Core.Retrying_sector_0_pass_1_recovering_partial_data_reverse, + badSector, pass) : string.Format(Localization.Core.Retrying_sector_0_pass_1_reverse, badSector, pass)); } @@ -673,8 +650,7 @@ partial class Dump totalDuration += cmdDuration; - if(!sense && - !_dev.Error) + if(!sense && !_dev.Error) { _resume.BadBlocks.Remove(badSector); extents.Add(badSector); @@ -690,9 +666,7 @@ partial class Dump outputFormat.WriteSector(readBuffer, badSector); } - if(pass < _retryPasses && - !_aborted && - _resume.BadBlocks.Count > 0) + if(pass < _retryPasses && !_aborted && _resume.BadBlocks.Count > 0) { pass++; forward = !forward; @@ -709,7 +683,10 @@ partial class Dump var md = new Modes.DecodedMode { Header = new Modes.ModeHeader(), - Pages = new[] { currentModePage.Value } + Pages = new[] + { + currentModePage.Value + } }; md6 = Modes.EncodeMode6(md, _dev.ScsiType); @@ -741,7 +718,8 @@ partial class Dump if(!outputFormat.SetImageInfo(metadata)) { - ErrorMessage?.Invoke(Localization.Core.Error_0_setting_metadata + Environment.NewLine + + ErrorMessage?.Invoke(Localization.Core.Error_0_setting_metadata + + Environment.NewLine + outputFormat.ErrorMessage); } @@ -813,7 +791,8 @@ partial class Dump _sidecarStopwatch.Elapsed.Humanize(minUnit: TimeUnit.Second)); _dumpLog.WriteLine(Localization.Core.Average_checksum_speed_0, - ByteSize.FromBytes(blockSize * (blocks + 1)).Per(totalChkDuration.Milliseconds()). + ByteSize.FromBytes(blockSize * (blocks + 1)). + Per(totalChkDuration.Milliseconds()). Humanize()); if(_preSidecar != null) @@ -835,10 +814,11 @@ partial class Dump if(filesystems.Count > 0) { foreach(var filesystem in filesystems.Select(o => new - { - o.start, - o.type - }).Distinct()) + { + o.start, + o.type + }). + Distinct()) { UpdateStatus?.Invoke(string.Format(Localization.Core.Found_filesystem_0_at_sector_1, filesystem.type, filesystem.start)); @@ -853,8 +833,7 @@ partial class Dump sidecar.BlockMedias[0].MediaType = xmlType.type; sidecar.BlockMedias[0].MediaSubType = xmlType.subType; - if(!_dev.IsRemovable || - _dev.IsUsb) + if(!_dev.IsRemovable || _dev.IsUsb) { if(_dev.Type == DeviceType.ATAPI) sidecar.BlockMedias[0].Interface = "ATAPI"; @@ -896,17 +875,17 @@ partial class Dump UpdateStatus?.Invoke(""); UpdateStatus?. - Invoke(string.Format( - Localization.Core.Took_a_total_of_0_1_processing_commands_2_checksumming_3_writing_4_closing, - _dumpStopwatch.Elapsed.Humanize(minUnit: TimeUnit.Second), - totalDuration.Milliseconds().Humanize(minUnit: TimeUnit.Second), - totalChkDuration.Milliseconds().Humanize(minUnit: TimeUnit.Second), - imageWriteDuration.Seconds().Humanize(minUnit: TimeUnit.Second), - _imageCloseStopwatch.Elapsed.Humanize(minUnit: TimeUnit.Second))); + Invoke(string.Format(Localization.Core.Took_a_total_of_0_1_processing_commands_2_checksumming_3_writing_4_closing, + _dumpStopwatch.Elapsed.Humanize(minUnit: TimeUnit.Second), + totalDuration.Milliseconds().Humanize(minUnit: TimeUnit.Second), + totalChkDuration.Milliseconds().Humanize(minUnit: TimeUnit.Second), + imageWriteDuration.Seconds().Humanize(minUnit: TimeUnit.Second), + _imageCloseStopwatch.Elapsed.Humanize(minUnit: TimeUnit.Second))); UpdateStatus?.Invoke(string.Format(Localization.Core.Average_speed_0, ByteSize.FromBytes(blockSize * (blocks + 1)). - Per(totalDuration.Milliseconds()).Humanize())); + Per(totalDuration.Milliseconds()). + Humanize())); if(maxSpeed > 0) { diff --git a/Aaru.Core/Devices/Dumping/PlayStationPortable/MemoryStick.cs b/Aaru.Core/Devices/Dumping/PlayStationPortable/MemoryStick.cs index 0abfccd57..17004bee1 100644 --- a/Aaru.Core/Devices/Dumping/PlayStationPortable/MemoryStick.cs +++ b/Aaru.Core/Devices/Dumping/PlayStationPortable/MemoryStick.cs @@ -138,7 +138,8 @@ public partial class Dump _dumpLog.WriteLine(outputFormat.ErrorMessage); StoppingErrorMessage?.Invoke(Localization.Core.Error_creating_output_image_not_continuing + - Environment.NewLine + outputFormat.ErrorMessage); + Environment.NewLine + + outputFormat.ErrorMessage); return; } @@ -153,8 +154,7 @@ public partial class Dump _dev.PlatformId, ref _resume, ref currentTry, ref extents, _dev.FirmwareRevision, _private, _force); - if(currentTry == null || - extents == null) + if(currentTry == null || extents == null) { StoppingErrorMessage?.Invoke(Localization.Core.Could_not_process_resume_file_not_continuing); @@ -202,27 +202,22 @@ public partial class Dump if(blocks - i < blocksToRead) blocksToRead = (uint)(blocks - i); - if(currentSpeed > maxSpeed && - currentSpeed > 0) + if(currentSpeed > maxSpeed && currentSpeed > 0) maxSpeed = currentSpeed; - if(currentSpeed < minSpeed && - currentSpeed > 0) + if(currentSpeed < minSpeed && currentSpeed > 0) minSpeed = currentSpeed; UpdateProgress?. - Invoke( - string.Format(Localization.Core.Reading_sector_0_of_1_2, i, blocks, - ByteSize.FromMegabytes(currentSpeed).Per(_oneSecond).Humanize()), - (long)i, blocks); + Invoke(string.Format(Localization.Core.Reading_sector_0_of_1_2, i, blocks, ByteSize.FromMegabytes(currentSpeed).Per(_oneSecond).Humanize()), + (long)i, blocks); sense = _dev.Read12(out readBuffer, out senseBuf, 0, false, true, false, false, (uint)i, blockSize, 0, blocksToRead, false, _dev.Timeout, out double cmdDuration); totalDuration += cmdDuration; - if(!sense && - !_dev.Error) + if(!sense && !_dev.Error) { mhddLog.Write(i, cmdDuration, blocksToRead); ibgLog.Write(i, currentSpeed * 1024); @@ -307,10 +302,7 @@ public partial class Dump #region Trimming - if(_resume.BadBlocks.Count > 0 && - !_aborted && - _trim && - newTrim) + if(_resume.BadBlocks.Count > 0 && !_aborted && _trim && newTrim) { _trimStopwatch.Restart(); UpdateStatus?.Invoke(Localization.Core.Trimming_skipped_sectors); @@ -359,9 +351,7 @@ public partial class Dump #region Error handling - if(_resume.BadBlocks.Count > 0 && - !_aborted && - _retryPasses > 0) + if(_resume.BadBlocks.Count > 0 && !_aborted && _retryPasses > 0) { var pass = 1; var forward = true; @@ -389,7 +379,7 @@ public partial class Dump if(dcMode10.HasValue) { foreach(Modes.ModePage modePage in dcMode10.Value.Pages.Where(modePage => - modePage is { Page: 0x01, Subpage: 0x00 })) + modePage is { Page: 0x01, Subpage: 0x00 })) currentModePage = modePage; } } @@ -401,7 +391,7 @@ public partial class Dump if(dcMode6.HasValue) { foreach(Modes.ModePage modePage in dcMode6.Value.Pages.Where(modePage => - modePage is { Page: 0x01, Subpage: 0x00 })) + modePage is { Page: 0x01, Subpage: 0x00 })) currentModePage = modePage; } } @@ -496,10 +486,8 @@ public partial class Dump { PulseProgress?.Invoke(runningPersistent ? string. - Format( - Localization.Core. - Retrying_sector_0_pass_1_recovering_partial_data_forward, - badSector, pass) + Format(Localization.Core.Retrying_sector_0_pass_1_recovering_partial_data_forward, + badSector, pass) : string.Format(Localization.Core.Retrying_sector_0_pass_1_forward, badSector, pass)); } @@ -507,10 +495,8 @@ public partial class Dump { PulseProgress?.Invoke(runningPersistent ? string. - Format( - Localization.Core. - Retrying_sector_0_pass_1_recovering_partial_data_reverse, - badSector, pass) + Format(Localization.Core.Retrying_sector_0_pass_1_recovering_partial_data_reverse, + badSector, pass) : string.Format(Localization.Core.Retrying_sector_0_pass_1_reverse, badSector, pass)); } @@ -523,8 +509,7 @@ public partial class Dump if(sense || _dev.Error) _errorLog?.WriteLine(badSector, _dev.Error, _dev.LastError, senseBuf); - if(!sense && - !_dev.Error) + if(!sense && !_dev.Error) { _resume.BadBlocks.Remove(badSector); extents.Add(badSector); @@ -540,9 +525,7 @@ public partial class Dump outputFormat.WriteSector(readBuffer, badSector); } - if(pass < _retryPasses && - !_aborted && - _resume.BadBlocks.Count > 0) + if(pass < _retryPasses && !_aborted && _resume.BadBlocks.Count > 0) { pass++; forward = !forward; @@ -559,7 +542,10 @@ public partial class Dump var md = new Modes.DecodedMode { Header = new Modes.ModeHeader(), - Pages = new[] { currentModePage.Value } + Pages = new[] + { + currentModePage.Value + } }; md6 = Modes.EncodeMode6(md, _dev.ScsiType); @@ -589,7 +575,8 @@ public partial class Dump if(!outputFormat.SetImageInfo(metadata)) { - ErrorMessage?.Invoke(Localization.Core.Error_0_setting_metadata + Environment.NewLine + + ErrorMessage?.Invoke(Localization.Core.Error_0_setting_metadata + + Environment.NewLine + outputFormat.ErrorMessage); } @@ -663,7 +650,8 @@ public partial class Dump _sidecarStopwatch.Elapsed.Humanize(minUnit: TimeUnit.Second)); _dumpLog.WriteLine(Localization.Core.Average_checksum_speed_0, - ByteSize.FromBytes(blockSize * (blocks + 1)).Per(totalChkDuration.Milliseconds()). + ByteSize.FromBytes(blockSize * (blocks + 1)). + Per(totalChkDuration.Milliseconds()). Humanize()); if(_preSidecar != null) @@ -685,10 +673,11 @@ public partial class Dump if(filesystems.Count > 0) { foreach(var filesystem in filesystems.Select(o => new - { - o.start, - o.type - }).Distinct()) + { + o.start, + o.type + }). + Distinct()) { UpdateStatus?.Invoke(string.Format(Localization.Core.Found_filesystem_0_at_sector_1, filesystem.type, filesystem.start)); @@ -733,17 +722,17 @@ public partial class Dump UpdateStatus?.Invoke(""); UpdateStatus?. - Invoke(string.Format( - Localization.Core.Took_a_total_of_0_1_processing_commands_2_checksumming_3_writing_4_closing, - _dumpStopwatch.Elapsed.Humanize(minUnit: TimeUnit.Second), - totalDuration.Milliseconds().Humanize(minUnit: TimeUnit.Second), - totalChkDuration.Milliseconds().Humanize(minUnit: TimeUnit.Second), - imageWriteDuration.Seconds().Humanize(minUnit: TimeUnit.Second), - _imageCloseStopwatch.Elapsed.Humanize(minUnit: TimeUnit.Second))); + Invoke(string.Format(Localization.Core.Took_a_total_of_0_1_processing_commands_2_checksumming_3_writing_4_closing, + _dumpStopwatch.Elapsed.Humanize(minUnit: TimeUnit.Second), + totalDuration.Milliseconds().Humanize(minUnit: TimeUnit.Second), + totalChkDuration.Milliseconds().Humanize(minUnit: TimeUnit.Second), + imageWriteDuration.Seconds().Humanize(minUnit: TimeUnit.Second), + _imageCloseStopwatch.Elapsed.Humanize(minUnit: TimeUnit.Second))); UpdateStatus?.Invoke(string.Format(Localization.Core.Average_speed_0, ByteSize.FromBytes(blockSize * (blocks + 1)). - Per(totalDuration.Milliseconds()).Humanize())); + Per(totalDuration.Milliseconds()). + Humanize())); if(maxSpeed > 0) { diff --git a/Aaru.Core/Devices/Dumping/PlayStationPortable/UMD.cs b/Aaru.Core/Devices/Dumping/PlayStationPortable/UMD.cs index dbeee09ba..6a5c816bb 100644 --- a/Aaru.Core/Devices/Dumping/PlayStationPortable/UMD.cs +++ b/Aaru.Core/Devices/Dumping/PlayStationPortable/UMD.cs @@ -146,7 +146,8 @@ public partial class Dump _dumpLog.WriteLine(outputOptical.ErrorMessage); StoppingErrorMessage?.Invoke(Localization.Core.Error_creating_output_image_not_continuing + - Environment.NewLine + outputOptical.ErrorMessage); + Environment.NewLine + + outputOptical.ErrorMessage); return; } @@ -175,8 +176,7 @@ public partial class Dump _dev.PlatformId, ref _resume, ref currentTry, ref extents, _dev.FirmwareRevision, _private, _force); - if(currentTry == null || - extents == null) + if(currentTry == null || extents == null) { StoppingErrorMessage?.Invoke(Localization.Core.Could_not_process_resume_file_not_continuing); @@ -224,19 +224,15 @@ public partial class Dump if(blocks - i < blocksToRead) blocksToRead = (uint)(blocks - i); - if(currentSpeed > maxSpeed && - currentSpeed > 0) + if(currentSpeed > maxSpeed && currentSpeed > 0) maxSpeed = currentSpeed; - if(currentSpeed < minSpeed && - currentSpeed > 0) + if(currentSpeed < minSpeed && currentSpeed > 0) minSpeed = currentSpeed; UpdateProgress?. - Invoke( - string.Format(Localization.Core.Reading_sector_0_of_1_2, i, blocks, - ByteSize.FromMegabytes(currentSpeed).Per(_oneSecond).Humanize()), - (long)i, (long)blocks); + Invoke(string.Format(Localization.Core.Reading_sector_0_of_1_2, i, blocks, ByteSize.FromMegabytes(currentSpeed).Per(_oneSecond).Humanize()), + (long)i, (long)blocks); sense = _dev.Read12(out readBuffer, out senseBuf, 0, false, true, false, false, (uint)(umdStart + i * 4), 512, 0, blocksToRead * 4, false, _dev.Timeout, out double cmdDuration); @@ -245,8 +241,7 @@ public partial class Dump _writeStopwatch.Restart(); - if(!sense && - !_dev.Error) + if(!sense && !_dev.Error) { mhddLog.Write(i, cmdDuration, blocksToRead); ibgLog.Write(i, currentSpeed * 1024); @@ -328,10 +323,7 @@ public partial class Dump #region Trimming - if(_resume.BadBlocks.Count > 0 && - !_aborted && - _trim && - newTrim) + if(_resume.BadBlocks.Count > 0 && !_aborted && _trim && newTrim) { _trimStopwatch.Restart(); _dumpLog.WriteLine(Localization.Core.Trimming_skipped_sectors); @@ -378,9 +370,7 @@ public partial class Dump #region Error handling - if(_resume.BadBlocks.Count > 0 && - !_aborted && - _retryPasses > 0) + if(_resume.BadBlocks.Count > 0 && !_aborted && _retryPasses > 0) { var pass = 1; var forward = true; @@ -403,7 +393,7 @@ public partial class Dump if(dcMode6.HasValue) { foreach(Modes.ModePage modePage in dcMode6.Value.Pages.Where(modePage => - modePage is { Page: 0x01, Subpage: 0x00 })) + modePage is { Page: 0x01, Subpage: 0x00 })) currentModePage = modePage; } } @@ -497,10 +487,8 @@ public partial class Dump { PulseProgress?.Invoke(runningPersistent ? string. - Format( - Localization.Core. - Retrying_sector_0_pass_1_recovering_partial_data_forward, - badSector, pass) + Format(Localization.Core.Retrying_sector_0_pass_1_recovering_partial_data_forward, + badSector, pass) : string.Format(Localization.Core.Retrying_sector_0_pass_1_forward, badSector, pass)); } @@ -508,10 +496,8 @@ public partial class Dump { PulseProgress?.Invoke(runningPersistent ? string. - Format( - Localization.Core. - Retrying_sector_0_pass_1_recovering_partial_data_reverse, - badSector, pass) + Format(Localization.Core.Retrying_sector_0_pass_1_recovering_partial_data_reverse, + badSector, pass) : string.Format(Localization.Core.Retrying_sector_0_pass_1_reverse, badSector, pass)); } @@ -525,8 +511,7 @@ public partial class Dump if(sense || _dev.Error) _errorLog?.WriteLine(badSector, _dev.Error, _dev.LastError, senseBuf); - if(!sense && - !_dev.Error) + if(!sense && !_dev.Error) { _resume.BadBlocks.Remove(badSector); extents.Add(badSector); @@ -542,9 +527,7 @@ public partial class Dump outputOptical.WriteSector(readBuffer, badSector); } - if(pass < _retryPasses && - !_aborted && - _resume.BadBlocks.Count > 0) + if(pass < _retryPasses && !_aborted && _resume.BadBlocks.Count > 0) { pass++; forward = !forward; @@ -561,7 +544,10 @@ public partial class Dump var md = new Modes.DecodedMode { Header = new Modes.ModeHeader(), - Pages = new[] { currentModePage.Value } + Pages = new[] + { + currentModePage.Value + } }; md6 = Modes.EncodeMode6(md, _dev.ScsiType); @@ -592,7 +578,8 @@ public partial class Dump if(!outputOptical.SetImageInfo(metadata)) { - ErrorMessage?.Invoke(Localization.Core.Error_0_setting_metadata + Environment.NewLine + + ErrorMessage?.Invoke(Localization.Core.Error_0_setting_metadata + + Environment.NewLine + outputOptical.ErrorMessage); } @@ -626,17 +613,17 @@ public partial class Dump UpdateStatus?.Invoke(""); UpdateStatus?. - Invoke(string.Format( - Localization.Core.Took_a_total_of_0_1_processing_commands_2_checksumming_3_writing_4_closing, - _dumpStopwatch.Elapsed.Humanize(minUnit: TimeUnit.Second), - totalDuration.Milliseconds().Humanize(minUnit: TimeUnit.Second), - totalChkDuration.Milliseconds().Humanize(minUnit: TimeUnit.Second), - imageWriteDuration.Seconds().Humanize(minUnit: TimeUnit.Second), - _imageCloseStopwatch.Elapsed.Humanize(minUnit: TimeUnit.Second))); + Invoke(string.Format(Localization.Core.Took_a_total_of_0_1_processing_commands_2_checksumming_3_writing_4_closing, + _dumpStopwatch.Elapsed.Humanize(minUnit: TimeUnit.Second), + totalDuration.Milliseconds().Humanize(minUnit: TimeUnit.Second), + totalChkDuration.Milliseconds().Humanize(minUnit: TimeUnit.Second), + imageWriteDuration.Seconds().Humanize(minUnit: TimeUnit.Second), + _imageCloseStopwatch.Elapsed.Humanize(minUnit: TimeUnit.Second))); UpdateStatus?.Invoke(string.Format(Localization.Core.Average_speed_0, ByteSize.FromBytes(blockSize * (blocks + 1)). - Per(totalDuration.Milliseconds()).Humanize())); + Per(totalDuration.Milliseconds()). + Humanize())); if(maxSpeed > 0) { diff --git a/Aaru.Core/Devices/Dumping/ResumeSupport.cs b/Aaru.Core/Devices/Dumping/ResumeSupport.cs index 9a519f829..67e24bf38 100644 --- a/Aaru.Core/Devices/Dumping/ResumeSupport.cs +++ b/Aaru.Core/Devices/Dumping/ResumeSupport.cs @@ -84,8 +84,7 @@ static class ResumeSupport throw new InvalidOperationException(Localization.Core.Resume_specifies_not_tape_but_device_is_tape); } - if(resume.Removable != removable && - !force) + if(resume.Removable != removable && !force) { if(resume.Removable) { @@ -97,60 +96,47 @@ static class ResumeSupport Resume_specifies_non_removable_but_device_is_removable); } - if(!isTape && - resume.LastBlock != blocks - 1 && - !force) + if(!isTape && resume.LastBlock != blocks - 1 && !force) { throw new - InvalidOperationException(string.Format( - Localization.Core. - Resume_file_different_number_of_blocks_not_continuing, - resume.LastBlock + 1, blocks)); + InvalidOperationException(string.Format(Localization.Core.Resume_file_different_number_of_blocks_not_continuing, + resume.LastBlock + 1, blocks)); } foreach(DumpHardware oldTry in resume.Tries) { - if(!removable && - !force) + if(!removable && !force) { if(oldTry.Manufacturer != manufacturer) { throw new InvalidOperationException(string. - Format( - Localization.Core. - Resume_file_different_manufacturer_not_continuing, - oldTry.Manufacturer, manufacturer)); + Format(Localization.Core.Resume_file_different_manufacturer_not_continuing, + oldTry.Manufacturer, manufacturer)); } if(oldTry.Model != model) { throw new InvalidOperationException(string. - Format( - Localization.Core. - Resume_file_different_model_not_continuing, - oldTry.Model, model)); + Format(Localization.Core.Resume_file_different_model_not_continuing, + oldTry.Model, model)); } if(oldTry.Serial != serial) { throw new InvalidOperationException(string. - Format( - Localization.Core. - Resume_file_different_serial_number_not_continuing, - oldTry.Serial, serial)); + Format(Localization.Core.Resume_file_different_serial_number_not_continuing, + oldTry.Serial, serial)); } if(oldTry.Firmware != firmware) { throw new InvalidOperationException(string. - Format( - Localization.Core. - Resume_file_different_firmware_revision_not_continuing, - oldTry.Firmware, firmware)); + Format(Localization.Core.Resume_file_different_firmware_revision_not_continuing, + oldTry.Firmware, firmware)); } } @@ -162,8 +148,11 @@ static class ResumeSupport oldTry.Software.Version != Version.GetVersion()) continue; - if(removable && (oldTry.Manufacturer != manufacturer || oldTry.Model != model || - oldTry.Serial != serial || oldTry.Firmware != firmware)) + if(removable && + (oldTry.Manufacturer != manufacturer || + oldTry.Model != model || + oldTry.Serial != serial || + oldTry.Firmware != firmware)) continue; currentTry = oldTry; diff --git a/Aaru.Core/Devices/Dumping/SSC.cs b/Aaru.Core/Devices/Dumping/SSC.cs index 370795c4d..1dfb803cc 100644 --- a/Aaru.Core/Devices/Dumping/SSC.cs +++ b/Aaru.Core/Devices/Dumping/SSC.cs @@ -78,14 +78,14 @@ partial class Dump InitProgress?.Invoke(); - if(decSense.HasValue && - decSense.Value.SenseKey != SenseKeys.NoSense) + if(decSense.HasValue && decSense.Value.SenseKey != SenseKeys.NoSense) { _dumpLog.WriteLine(Localization.Core.Device_not_ready_Sense, decSense.Value.SenseKey, decSense.Value.ASC, decSense.Value.ASCQ); StoppingErrorMessage?.Invoke(Localization.Core.Drive_has_status_error_please_correct_Sense_follows + - Environment.NewLine + decSense.Value.Description); + Environment.NewLine + + decSense.Value.Description); return; } @@ -120,7 +120,8 @@ partial class Dump decSense.Value.ASC != 0x00)) { StoppingErrorMessage?.Invoke(Localization.Core.Drive_could_not_rewind_please_correct_Sense_follows + - Environment.NewLine + decSense.Value.Description); + Environment.NewLine + + decSense.Value.Description); _dumpLog.WriteLine(Localization.Core.Drive_could_not_rewind_please_correct_Sense_follows); @@ -141,12 +142,12 @@ partial class Dump decSense = Sense.Decode(senseBuf); if(decSense.HasValue && - (decSense.Value.ASC == 0x20 && decSense.Value.ASCQ != 0x00 || decSense.Value.ASC != 0x20 && - decSense.Value.SenseKey != - SenseKeys.IllegalRequest)) + (decSense.Value.ASC == 0x20 && decSense.Value.ASCQ != 0x00 || + decSense.Value.ASC != 0x20 && decSense.Value.SenseKey != SenseKeys.IllegalRequest)) { StoppingErrorMessage?.Invoke(Localization.Core.Could_not_get_position_Sense_follows + - Environment.NewLine + decSense.Value.Description); + Environment.NewLine + + decSense.Value.Description); _dumpLog.WriteLine(Localization.Core.Could_not_get_position_Sense_follows); @@ -170,7 +171,8 @@ partial class Dump if(sense) { StoppingErrorMessage?.Invoke(Localization.Core.Drive_could_not_rewind_please_correct_Sense_follows + - Environment.NewLine + decSense?.Description); + Environment.NewLine + + decSense?.Description); _dumpLog.WriteLine(Localization.Core.Drive_could_not_rewind_please_correct_Sense_follows); @@ -196,7 +198,8 @@ partial class Dump decSense.Value.ASC != 0x00)) { StoppingErrorMessage?.Invoke(Localization.Core.Drive_could_not_rewind_please_correct_Sense_follows + - Environment.NewLine + decSense.Value.Description); + Environment.NewLine + + decSense.Value.Description); _dumpLog.WriteLine(Localization.Core.Drive_could_not_rewind_please_correct_Sense_follows); @@ -213,7 +216,8 @@ partial class Dump decSense = Sense.Decode(senseBuf); StoppingErrorMessage?.Invoke(Localization.Core.Drive_could_not_rewind_please_correct_Sense_follows + - Environment.NewLine + decSense?.Description); + Environment.NewLine + + decSense?.Description); _dumpLog.WriteLine(Localization.Core.Drive_could_not_rewind_please_correct_Sense_follows); @@ -248,8 +252,7 @@ partial class Dump sense = _dev.ModeSense10(out cmdBuf, out senseBuf, false, true, ScsiModeSensePageControl.Current, 0x3F, 0xFF, 5, out duration); - if(!sense || - _dev.Error) + if(!sense || _dev.Error) { sense = _dev.ModeSense10(out cmdBuf, out senseBuf, false, true, ScsiModeSensePageControl.Current, 0x3F, 0x00, 5, out duration); @@ -257,8 +260,7 @@ partial class Dump Modes.DecodedMode? decMode = null; - if(!sense && - !_dev.Error) + if(!sense && !_dev.Error) { if(Modes.DecodeMode10(cmdBuf, _dev.ScsiType).HasValue) decMode = Modes.DecodeMode10(cmdBuf, _dev.ScsiType); @@ -278,8 +280,7 @@ partial class Dump if(sense || _dev.Error) sense = _dev.ModeSense(out cmdBuf, out senseBuf, 5, out duration); - if(!sense && - !_dev.Error) + if(!sense && !_dev.Error) { if(Modes.DecodeMode6(cmdBuf, _dev.ScsiType).HasValue) decMode = Modes.DecodeMode6(cmdBuf, _dev.ScsiType); @@ -365,9 +366,10 @@ partial class Dump if(!eom) { - StoppingErrorMessage?.Invoke( - Localization.Core.Drive_could_not_return_back_Sense_follows + - Environment.NewLine + decSense.Value.Description); + StoppingErrorMessage?.Invoke(Localization.Core. + Drive_could_not_return_back_Sense_follows + + Environment.NewLine + + decSense.Value.Description); _dumpLog.WriteLine(Localization.Core.Drive_could_not_return_back_Sense_follows); @@ -382,15 +384,15 @@ partial class Dump transferLen = 1; sense = _dev.Read6(out cmdBuf, out senseBuf, false, fixedLen, transferLen, blockSize, - _dev.Timeout, - out duration); + _dev.Timeout, out duration); if(sense) { decSense = Sense.Decode(senseBuf); StoppingErrorMessage?.Invoke(Localization.Core.Drive_could_not_read_Sense_follows + - Environment.NewLine + decSense.Value.Description); + Environment.NewLine + + decSense.Value.Description); _dumpLog.WriteLine(Localization.Core.Drive_could_not_read_Sense_follows); @@ -426,8 +428,8 @@ partial class Dump transferLen = blockSize; - UpdateStatus?.Invoke(string.Format( - Localization.Core.Blocksize_changed_to_0_bytes_at_block_1, + UpdateStatus?. + Invoke(string.Format(Localization.Core.Blocksize_changed_to_0_bytes_at_block_1, blockSize, currentBlock)); _dumpLog.WriteLine(Localization.Core.Blocksize_changed_to_0_bytes_at_block_1, blockSize, @@ -444,7 +446,8 @@ partial class Dump StoppingErrorMessage?.Invoke(Localization.Core. Drive_could_not_go_back_one_block_Sense_follows + - Environment.NewLine + decSense.Value.Description); + Environment.NewLine + + decSense.Value.Description); _dumpLog.WriteLine(Localization.Core.Drive_could_not_go_back_one_block_Sense_follows); @@ -458,7 +461,8 @@ partial class Dump } StoppingErrorMessage?.Invoke(Localization.Core.Drive_could_not_read_Sense_follows + - Environment.NewLine + decSense.Value.Description); + Environment.NewLine + + decSense.Value.Description); _dumpLog.WriteLine(Localization.Core.Drive_could_not_read_Sense_follows); @@ -469,7 +473,8 @@ partial class Dump } default: StoppingErrorMessage?.Invoke(Localization.Core.Drive_could_not_read_Sense_follows + - Environment.NewLine + decSense.Value.Description); + Environment.NewLine + + decSense.Value.Description); _dumpLog.WriteLine(Localization.Core.Drive_could_not_read_Sense_follows); @@ -503,7 +508,8 @@ partial class Dump if(!eom) { StoppingErrorMessage?.Invoke(Localization.Core.Drive_could_not_return_back_Sense_follows + - Environment.NewLine + decSense.Value.Description); + Environment.NewLine + + decSense.Value.Description); _dumpLog.WriteLine(Localization.Core.Drive_could_not_return_back_Sense_follows); @@ -521,8 +527,7 @@ partial class Dump _dev.PlatformId, ref _resume, ref currentTry, ref extents, _dev.FirmwareRevision, _private, _force, true); - if(currentTry == null || - extents == null) + if(currentTry == null || extents == null) { StoppingErrorMessage?.Invoke(Localization.Core.Could_not_process_resume_file_not_continuing); @@ -772,7 +777,8 @@ partial class Dump decSense.Value.ASC != 0x00)) { StoppingErrorMessage?.Invoke(Localization.Core.Drive_could_not_rewind_please_correct_Sense_follows + - Environment.NewLine + decSense.Value.Description); + Environment.NewLine + + decSense.Value.Description); _dumpLog.WriteLine(Localization.Core.Drive_could_not_rewind_please_correct_Sense_follows); @@ -792,7 +798,8 @@ partial class Dump _dumpLog.WriteLine(outputTape.ErrorMessage); StoppingErrorMessage?.Invoke(Localization.Core.Error_setting_output_image_in_tape_mode_not_continuing + - Environment.NewLine + outputTape.ErrorMessage); + Environment.NewLine + + outputTape.ErrorMessage); return; } @@ -806,7 +813,8 @@ partial class Dump _dumpLog.WriteLine(outputTape.ErrorMessage); StoppingErrorMessage?.Invoke(Localization.Core.Error_creating_output_image_not_continuing + - Environment.NewLine + outputTape.ErrorMessage); + Environment.NewLine + + outputTape.ErrorMessage); return; } @@ -828,8 +836,7 @@ partial class Dump FirstBlock = currentBlock }; - if((canLocate || canLocateLong) && - _resume.NextBlock > 0) + if((canLocate || canLocateLong) && _resume.NextBlock > 0) { currentBlock = _resume.NextBlock; @@ -905,12 +912,10 @@ partial class Dump continue; } - if(currentSpeed > maxSpeed && - currentSpeed > 0) + if(currentSpeed > maxSpeed && currentSpeed > 0) maxSpeed = currentSpeed; - if(currentSpeed < minSpeed && - currentSpeed > 0) + if(currentSpeed < minSpeed && currentSpeed > 0) minSpeed = currentSpeed; PulseProgress?.Invoke(string.Format(Localization.Core.Reading_block_0_1, currentBlock, @@ -921,9 +926,7 @@ partial class Dump totalDuration += duration; - if(sense && - senseBuf?.Length != 0 && - !ArrayHelpers.ArrayIsNullOrEmpty(senseBuf)) + if(sense && senseBuf?.Length != 0 && !ArrayHelpers.ArrayIsNullOrEmpty(senseBuf)) { decSense = Sense.Decode(senseBuf); @@ -945,9 +948,7 @@ partial class Dump Sense.DecodeDescriptor04(desc04, out filemark, out eom, out ili); } - if(decSense.Value is { ASC: 0x00, ASCQ: 0x00 } && - ili && - valid) + if(decSense.Value is { ASC: 0x00, ASCQ: 0x00 } && ili && valid) { blockSize = (uint)((int)blockSize - BitConverter.ToInt32(BitConverter.GetBytes(information), 0)); @@ -969,7 +970,8 @@ partial class Dump decSense = Sense.Decode(senseBuf); StoppingErrorMessage?.Invoke(Localization.Core.Drive_could_not_go_back_one_block_Sense_follows + - Environment.NewLine + decSense.Value.Description); + Environment.NewLine + + decSense.Value.Description); outputTape.Close(); _dumpLog.WriteLine(Localization.Core.Drive_could_not_go_back_one_block_Sense_follows); @@ -1042,10 +1044,8 @@ partial class Dump if(decSense is null) { StoppingErrorMessage?. - Invoke(string.Format( - Localization.Core. - Drive_could_not_read_block_0_Sense_cannot_be_decoded_look_at_log_for_dump, - currentBlock)); + Invoke(string.Format(Localization.Core.Drive_could_not_read_block_0_Sense_cannot_be_decoded_look_at_log_for_dump, + currentBlock)); _dumpLog.WriteLine(string.Format(Localization.Core.Drive_could_not_read_block_0_Sense_bytes_follow, currentBlock)); @@ -1148,10 +1148,7 @@ partial class Dump #region Error handling - if(_resume.BadBlocks.Count > 0 && - !_aborted && - _retryPasses > 0 && - (canLocate || canLocateLong)) + if(_resume.BadBlocks.Count > 0 && !_aborted && _retryPasses > 0 && (canLocate || canLocateLong)) { var pass = 1; var forward = false; @@ -1183,10 +1180,8 @@ partial class Dump { PulseProgress?.Invoke(runningPersistent ? string. - Format( - Localization.Core. - Retrying_sector_0_pass_1_recovering_partial_data_forward, - badBlock, pass) + Format(Localization.Core.Retrying_sector_0_pass_1_recovering_partial_data_forward, + badBlock, pass) : string.Format(Localization.Core.Retrying_sector_0_pass_1_forward, badBlock, pass)); } @@ -1194,10 +1189,8 @@ partial class Dump { PulseProgress?.Invoke(runningPersistent ? string. - Format( - Localization.Core. - Retrying_sector_0_pass_1_recovering_partial_data_reverse, - badBlock, pass) + Format(Localization.Core.Retrying_sector_0_pass_1_recovering_partial_data_reverse, + badBlock, pass) : string.Format(Localization.Core.Retrying_sector_0_pass_1_reverse, badBlock, pass)); } @@ -1287,8 +1280,7 @@ partial class Dump totalDuration += duration; - if(!sense && - !_dev.Error) + if(!sense && !_dev.Error) { _resume.BadBlocks.Remove(badBlock); extents.Add(badBlock); @@ -1303,9 +1295,7 @@ partial class Dump outputTape.WriteSector(cmdBuf, badBlock); } - if(pass < _retryPasses && - !_aborted && - _resume.BadBlocks.Count > 0) + if(pass < _retryPasses && !_aborted && _resume.BadBlocks.Count > 0) { pass++; forward = !forward; @@ -1345,7 +1335,8 @@ partial class Dump if(!outputTape.SetImageInfo(metadata)) { - ErrorMessage?.Invoke(Localization.Core.Error_0_setting_metadata + Environment.NewLine + + ErrorMessage?.Invoke(Localization.Core.Error_0_setting_metadata + + Environment.NewLine + outputTape.ErrorMessage); } @@ -1425,7 +1416,8 @@ partial class Dump _sidecarStopwatch.Elapsed.Humanize(minUnit: TimeUnit.Second)); _dumpLog.WriteLine(Localization.Core.Average_checksum_speed_0, - ByteSize.FromBytes(blockSize * (blocks + 1)).Per(totalChkDuration.Milliseconds()). + ByteSize.FromBytes(blockSize * (blocks + 1)). + Per(totalChkDuration.Milliseconds()). Humanize()); if(_preSidecar != null) @@ -1447,10 +1439,11 @@ partial class Dump if(filesystems.Count > 0) { foreach(var filesystem in filesystems.Select(o => new - { - o.start, - o.type - }).Distinct()) + { + o.start, + o.type + }). + Distinct()) { UpdateStatus?.Invoke(string.Format(Localization.Core.Found_filesystem_0_at_sector_1, filesystem.type, filesystem.start)); @@ -1468,8 +1461,7 @@ partial class Dump sidecar.BlockMedias[0].MediaSubType = xmlType.subType; // TODO: Implement device firmware revision - if(!_dev.IsRemovable || - _dev.IsUsb) + if(!_dev.IsRemovable || _dev.IsUsb) { if(_dev.Type == DeviceType.ATAPI) sidecar.BlockMedias[0].Interface = "ATAPI"; @@ -1509,17 +1501,17 @@ partial class Dump UpdateStatus?.Invoke(""); UpdateStatus?. - Invoke(string.Format( - Localization.Core.Took_a_total_of_0_1_processing_commands_2_checksumming_3_writing_4_closing, - _sidecarStopwatch.Elapsed.Humanize(minUnit: TimeUnit.Second), - totalDuration.Milliseconds().Humanize(minUnit: TimeUnit.Second), - totalChkDuration.Milliseconds().Humanize(minUnit: TimeUnit.Second), - imageWriteDuration.Seconds().Humanize(minUnit: TimeUnit.Second), - _imageCloseStopwatch.Elapsed.Humanize(minUnit: TimeUnit.Second))); + Invoke(string.Format(Localization.Core.Took_a_total_of_0_1_processing_commands_2_checksumming_3_writing_4_closing, + _sidecarStopwatch.Elapsed.Humanize(minUnit: TimeUnit.Second), + totalDuration.Milliseconds().Humanize(minUnit: TimeUnit.Second), + totalChkDuration.Milliseconds().Humanize(minUnit: TimeUnit.Second), + imageWriteDuration.Seconds().Humanize(minUnit: TimeUnit.Second), + _imageCloseStopwatch.Elapsed.Humanize(minUnit: TimeUnit.Second))); UpdateStatus?.Invoke(string.Format(Localization.Core.Average_speed_0, ByteSize.FromBytes(blockSize * (blocks + 1)). - Per(totalDuration.Milliseconds()).Humanize())); + Per(totalDuration.Milliseconds()). + Humanize())); if(maxSpeed > 0) { diff --git a/Aaru.Core/Devices/Dumping/Sbc/Data.cs b/Aaru.Core/Devices/Dumping/Sbc/Data.cs index b684df0fc..1e6da47f4 100644 --- a/Aaru.Core/Devices/Dumping/Sbc/Data.cs +++ b/Aaru.Core/Devices/Dumping/Sbc/Data.cs @@ -91,29 +91,22 @@ partial class Dump if(blocks - i < blocksToRead) blocksToRead = (uint)(blocks - i); - if(currentSpeed > maxSpeed && - currentSpeed > 0) + if(currentSpeed > maxSpeed && currentSpeed > 0) maxSpeed = currentSpeed; - if(currentSpeed < minSpeed && - currentSpeed > 0) + if(currentSpeed < minSpeed && currentSpeed > 0) minSpeed = currentSpeed; UpdateProgress?. - Invoke( - string.Format(Localization.Core.Reading_sector_0_of_1_2, i, blocks, - ByteSize.FromMegabytes(currentSpeed).Per(_oneSecond).Humanize()), - (long)i, (long)blocks); + Invoke(string.Format(Localization.Core.Reading_sector_0_of_1_2, i, blocks, ByteSize.FromMegabytes(currentSpeed).Per(_oneSecond).Humanize()), + (long)i, (long)blocks); sense = scsiReader.ReadBlocks(out buffer, i, blocksToRead, out double cmdDuration, out _, out _); totalDuration += cmdDuration; - if(!sense && - !_dev.Error) + if(!sense && !_dev.Error) { - if(Settings.Settings.Current.EnableDecryption && - discKey != null && - _titleKeys) + if(Settings.Settings.Current.EnableDecryption && discKey != null && _titleKeys) { for(ulong j = 0; j < blocksToRead; j++) { @@ -137,8 +130,10 @@ partial class Dump if(titleKey.HasValue) { - outputFormat.WriteSectorTag(new[] { titleKey.Value.CMI }, i + j, - SectorTagType.DvdSectorCmi); + outputFormat.WriteSectorTag(new[] + { + titleKey.Value.CMI + }, i + j, SectorTagType.DvdSectorCmi); } else continue; @@ -147,11 +142,15 @@ partial class Dump if((titleKey.Value.CMI & 0x80) >> 7 == 0) { // The CMI indicates this sector is not encrypted. - outputFormat.WriteSectorTag(new byte[] { 0, 0, 0, 0, 0 }, i + j, - SectorTagType.DvdSectorTitleKey); + outputFormat.WriteSectorTag(new byte[] + { + 0, 0, 0, 0, 0 + }, i + j, SectorTagType.DvdSectorTitleKey); - outputFormat.WriteSectorTag(new byte[] { 0, 0, 0, 0, 0 }, i + j, - SectorTagType.DvdTitleKeyDecrypted); + outputFormat.WriteSectorTag(new byte[] + { + 0, 0, 0, 0, 0 + }, i + j, SectorTagType.DvdTitleKeyDecrypted); _resume.MissingTitleKeys.Remove(i + j); @@ -162,11 +161,15 @@ partial class Dump // not encrypted even if the CMI says it is. if(titleKey.Value.Key.All(k => k == 0)) { - outputFormat.WriteSectorTag(new byte[] { 0, 0, 0, 0, 0 }, i + j, - SectorTagType.DvdSectorTitleKey); + outputFormat.WriteSectorTag(new byte[] + { + 0, 0, 0, 0, 0 + }, i + j, SectorTagType.DvdSectorTitleKey); - outputFormat.WriteSectorTag(new byte[] { 0, 0, 0, 0, 0 }, i + j, - SectorTagType.DvdTitleKeyDecrypted); + outputFormat.WriteSectorTag(new byte[] + { + 0, 0, 0, 0, 0 + }, i + j, SectorTagType.DvdTitleKeyDecrypted); _resume.MissingTitleKeys.Remove(i + j); diff --git a/Aaru.Core/Devices/Dumping/Sbc/Dump.cs b/Aaru.Core/Devices/Dumping/Sbc/Dump.cs index 8516b18a6..33809ddd5 100644 --- a/Aaru.Core/Devices/Dumping/Sbc/Dump.cs +++ b/Aaru.Core/Devices/Dumping/Sbc/Dump.cs @@ -111,15 +111,13 @@ partial class Dump { mediaTags = new Dictionary(); - if(_dev.IsUsb && - _dev.UsbDescriptors != null) + if(_dev.IsUsb && _dev.UsbDescriptors != null) mediaTags.Add(MediaTagType.USB_Descriptors, null); if(_dev.Type == DeviceType.ATAPI) mediaTags.Add(MediaTagType.ATAPI_IDENTIFY, null); - if(_dev.IsPcmcia && - _dev.Cis != null) + if(_dev.IsPcmcia && _dev.Cis != null) mediaTags.Add(MediaTagType.PCMCIA_CIS, null); sense = _dev.ScsiInquiry(out byte[] cmdBuf, out _); @@ -137,15 +135,13 @@ partial class Dump sense = _dev.ModeSense10(out cmdBuf, out _, false, true, ScsiModeSensePageControl.Current, 0x3F, 0xFF, 5, out _); - if(!sense || - _dev.Error) + if(!sense || _dev.Error) { sense = _dev.ModeSense10(out cmdBuf, out _, false, true, ScsiModeSensePageControl.Current, 0x3F, 0x00, 5, out _); } - if(!sense && - !_dev.Error) + if(!sense && !_dev.Error) { if(Modes.DecodeMode10(cmdBuf, _dev.ScsiType).HasValue) { @@ -169,8 +165,7 @@ partial class Dump if(sense || _dev.Error) sense = _dev.ModeSense(out cmdBuf, out _, 5, out _); - if(!sense && - !_dev.Error) + if(!sense && !_dev.Error) { if(Modes.DecodeMode6(cmdBuf, _dev.ScsiType).HasValue) { @@ -189,7 +184,8 @@ partial class Dump // TODO: Fix this containsFloppyPage = decMode.Value.Pages?.Aggregate(containsFloppyPage, (current, modePage) => - current | modePage.Page == 0x05) == true; + current | modePage.Page == 0x05) == + true; } } } @@ -231,8 +227,7 @@ partial class Dump return; } - if(blocks != 0 && - blockSize != 0) + if(blocks != 0 && blockSize != 0) { blocks++; @@ -367,7 +362,8 @@ partial class Dump _dumpLog.WriteLine(outputFormat.ErrorMessage); StoppingErrorMessage?.Invoke(Localization.Core.Error_creating_output_image_not_continuing + - Environment.NewLine + outputFormat.ErrorMessage); + Environment.NewLine + + outputFormat.ErrorMessage); return; } @@ -402,8 +398,7 @@ partial class Dump { writeSingleOpticalTrack = false; - if(discInformation?.Sessions > 1 && - !canStoreNotCdSessions) + if(discInformation?.Sessions > 1 && !canStoreNotCdSessions) { if(_force) { @@ -525,7 +520,8 @@ partial class Dump _dumpLog.WriteLine(outputFormat.ErrorMessage); StoppingErrorMessage?.Invoke(Localization.Core.Error_creating_output_image_not_continuing + - Environment.NewLine + outputFormat.ErrorMessage); + Environment.NewLine + + outputFormat.ErrorMessage); return; } @@ -554,7 +550,8 @@ partial class Dump StoppingErrorMessage?.Invoke(Localization.Core. Error_sending_tracks_to_output_image_not_continuing + - Environment.NewLine + opticalPlugin.ErrorMessage); + Environment.NewLine + + opticalPlugin.ErrorMessage); return; } @@ -610,11 +607,9 @@ partial class Dump UpdateStatus?. Invoke(string. - Format( - Localization.Core. - Setting_geometry_to_0_cylinders_1_heads_2_sectors_per_track, - rigidPage.Value.Cylinders, rigidPage.Value.Heads, - (uint)(blocks / (rigidPage.Value.Cylinders * rigidPage.Value.Heads)))); + Format(Localization.Core.Setting_geometry_to_0_cylinders_1_heads_2_sectors_per_track, + rigidPage.Value.Cylinders, rigidPage.Value.Heads, + (uint)(blocks / (rigidPage.Value.Cylinders * rigidPage.Value.Heads)))); outputFormat.SetGeometry(rigidPage.Value.Cylinders, rigidPage.Value.Heads, (uint)(blocks / (rigidPage.Value.Cylinders * rigidPage.Value.Heads))); @@ -637,11 +632,9 @@ partial class Dump UpdateStatus?. Invoke(string. - Format( - Localization.Core. - Setting_geometry_to_0_cylinders_1_heads_2_sectors_per_track, - flexiblePage.Value.Cylinders, flexiblePage.Value.Heads, - flexiblePage.Value.SectorsPerTrack)); + Format(Localization.Core.Setting_geometry_to_0_cylinders_1_heads_2_sectors_per_track, + flexiblePage.Value.Cylinders, flexiblePage.Value.Heads, + flexiblePage.Value.SectorsPerTrack)); outputFormat.SetGeometry(flexiblePage.Value.Cylinders, flexiblePage.Value.Heads, flexiblePage.Value.SectorsPerTrack); @@ -665,7 +658,8 @@ partial class Dump _dumpLog.WriteLine(outputFormat.ErrorMessage); StoppingErrorMessage?.Invoke(Localization.Core.Error_creating_output_image_not_continuing + - Environment.NewLine + outputFormat.ErrorMessage); + Environment.NewLine + + outputFormat.ErrorMessage); return; } @@ -705,8 +699,8 @@ partial class Dump bool discIs80Mm = mediaTags?.TryGetValue(MediaTagType.DVD_PFI, out byte[] pfiBytes) == true && PFI.Decode(pfiBytes, dskType)?.DiscSize == DVDSize.Eighty || - mediaTags?.TryGetValue(MediaTagType.BD_DI, out byte[] diBytes) == true && DI. - Decode(diBytes)?.Units?.Any(s => s.DiscSize == DI.BluSize.Eighty) == true; + mediaTags?.TryGetValue(MediaTagType.BD_DI, out byte[] diBytes) == true && + DI.Decode(diBytes)?.Units?.Any(s => s.DiscSize == DI.BluSize.Eighty) == true; Spiral.DiscParameters discSpiralParameters = Spiral.DiscParametersFromMediaType(dskType, discIs80Mm); @@ -724,8 +718,7 @@ partial class Dump _mediaGraph?.PaintSectorsBad(_resume.BadBlocks); } - if(currentTry == null || - extents == null) + if(currentTry == null || extents == null) { StoppingErrorMessage?.Invoke(Localization.Core.Could_not_process_resume_file_not_continuing); @@ -786,9 +779,7 @@ partial class Dump ReadSbcData(blocks, blocksToRead, blockSize, currentTry, extents, ref currentSpeed, ref minSpeed, ref maxSpeed, ref totalDuration, scsiReader, mhddLog, ibgLog, ref imageWriteDuration, ref newTrim, ref dvdDecrypt, - mediaTags.TryGetValue(MediaTagType.DVD_DiscKey_Decrypted, out byte[] tag) - ? tag - : null); + mediaTags.TryGetValue(MediaTagType.DVD_DiscKey_Decrypted, out byte[] tag) ? tag : null); } _dumpStopwatch.Stop(); @@ -821,10 +812,7 @@ partial class Dump #region Trimming - if(_resume.BadBlocks.Count > 0 && - !_aborted && - _trim && - newTrim) + if(_resume.BadBlocks.Count > 0 && !_aborted && _trim && newTrim) { _trimStopwatch.Restart(); UpdateStatus?.Invoke(Localization.Core.Trimming_skipped_sectors); @@ -850,9 +838,7 @@ partial class Dump #region Error handling - if(_resume.BadBlocks.Count > 0 && - !_aborted && - _retryPasses > 0) + if(_resume.BadBlocks.Count > 0 && !_aborted && _retryPasses > 0) RetrySbcData(scsiReader, currentTry, extents, ref totalDuration, blankExtents); if(_resume.MissingTitleKeys?.Count > 0 && @@ -884,7 +870,8 @@ partial class Dump // Cannot write tag to image StoppingErrorMessage?.Invoke(string.Format(Localization.Core.Cannot_write_tag_0, tag.Key)); - _dumpLog.WriteLine(string.Format(Localization.Core.Cannot_write_tag_0, tag.Key) + Environment.NewLine + + _dumpLog.WriteLine(string.Format(Localization.Core.Cannot_write_tag_0, tag.Key) + + Environment.NewLine + outputFormat.ErrorMessage); return; @@ -892,23 +879,21 @@ partial class Dump } else { - if(!_dev.IsRemovable || - _dev.IsUsb) + if(!_dev.IsRemovable || _dev.IsUsb) { - if(_dev.IsUsb && - _dev.UsbDescriptors != null) + if(_dev.IsUsb && _dev.UsbDescriptors != null) { UpdateStatus?.Invoke(Localization.Core.Reading_USB_descriptors); _dumpLog.WriteLine(Localization.Core.Reading_USB_descriptors); ret = outputFormat.WriteMediaTag(_dev.UsbDescriptors, MediaTagType.USB_Descriptors); - if(!ret && - !_force) + if(!ret && !_force) { _dumpLog.WriteLine(Localization.Core.Cannot_write_USB_descriptors); StoppingErrorMessage?.Invoke(Localization.Core.Cannot_write_USB_descriptors + - Environment.NewLine + outputFormat.ErrorMessage); + Environment.NewLine + + outputFormat.ErrorMessage); return; } @@ -929,13 +914,13 @@ partial class Dump ret = outputFormat.WriteMediaTag(cmdBuf, MediaTagType.ATAPI_IDENTIFY); - if(!ret && - !_force) + if(!ret && !_force) { _dumpLog.WriteLine(Localization.Core.Cannot_write_ATAPI_IDENTIFY_PACKET_DEVICE); StoppingErrorMessage?.Invoke(Localization.Core.Cannot_write_ATAPI_IDENTIFY_PACKET_DEVICE + - Environment.NewLine + outputFormat.ErrorMessage); + Environment.NewLine + + outputFormat.ErrorMessage); return; } @@ -950,12 +935,12 @@ partial class Dump _dumpLog.WriteLine(Localization.Core.Requesting_SCSI_INQUIRY); ret = outputFormat.WriteMediaTag(cmdBuf, MediaTagType.SCSI_INQUIRY); - if(!ret && - !_force) + if(!ret && !_force) { StoppingErrorMessage?.Invoke(Localization.Core.Cannot_write_SCSI_INQUIRY); - _dumpLog.WriteLine(Localization.Core.Cannot_write_SCSI_INQUIRY + Environment.NewLine + + _dumpLog.WriteLine(Localization.Core.Cannot_write_SCSI_INQUIRY + + Environment.NewLine + outputFormat.ErrorMessage); return; @@ -967,27 +952,25 @@ partial class Dump sense = _dev.ModeSense10(out cmdBuf, out _, false, true, ScsiModeSensePageControl.Current, 0x3F, 0xFF, 5, out _); - if(!sense || - _dev.Error) + if(!sense || _dev.Error) { sense = _dev.ModeSense10(out cmdBuf, out _, false, true, ScsiModeSensePageControl.Current, 0x3F, 0x00, 5, out _); } - if(!sense && - !_dev.Error) + if(!sense && !_dev.Error) { if(Modes.DecodeMode10(cmdBuf, _dev.ScsiType).HasValue) { ret = outputFormat.WriteMediaTag(cmdBuf, MediaTagType.SCSI_MODESENSE_10); - if(!ret && - !_force) + if(!ret && !_force) { _dumpLog.WriteLine(Localization.Core.Cannot_write_SCSI_MODE_SENSE_10); StoppingErrorMessage?.Invoke(Localization.Core.Cannot_write_SCSI_MODE_SENSE_10 + - Environment.NewLine + outputFormat.ErrorMessage); + Environment.NewLine + + outputFormat.ErrorMessage); return; } @@ -1009,20 +992,19 @@ partial class Dump if(sense || _dev.Error) sense = _dev.ModeSense(out cmdBuf, out _, 5, out _); - if(!sense && - !_dev.Error) + if(!sense && !_dev.Error) { if(Modes.DecodeMode6(cmdBuf, _dev.ScsiType).HasValue) { ret = outputFormat.WriteMediaTag(cmdBuf, MediaTagType.SCSI_MODESENSE_6); - if(!ret && - !_force) + if(!ret && !_force) { _dumpLog.WriteLine(Localization.Core.Cannot_write_SCSI_MODE_SENSE_6); StoppingErrorMessage?.Invoke(Localization.Core.Cannot_write_SCSI_MODE_SENSE_6 + - Environment.NewLine + outputFormat.ErrorMessage); + Environment.NewLine + + outputFormat.ErrorMessage); return; } @@ -1051,7 +1033,8 @@ partial class Dump if(!outputFormat.SetImageInfo(metadata)) { - ErrorMessage?.Invoke(Localization.Core.Error_0_setting_metadata + Environment.NewLine + + ErrorMessage?.Invoke(Localization.Core.Error_0_setting_metadata + + Environment.NewLine + outputFormat.ErrorMessage); } @@ -1139,11 +1122,9 @@ partial class Dump } // All USB flash drives report as removable, even if the media is not removable - if(!_dev.IsRemovable || - _dev.IsUsb) + if(!_dev.IsRemovable || _dev.IsUsb) { - if(_dev.IsUsb && - _dev.UsbDescriptors != null) + if(_dev.IsUsb && _dev.UsbDescriptors != null) { if(outputFormat.SupportedMediaTags.Contains(MediaTagType.USB_Descriptors)) { @@ -1241,15 +1222,13 @@ partial class Dump sense = _dev.ModeSense10(out cmdBuf, out _, false, true, ScsiModeSensePageControl.Current, 0x3F, 0xFF, 5, out _); - if(!sense || - _dev.Error) + if(!sense || _dev.Error) { sense = _dev.ModeSense10(out cmdBuf, out _, false, true, ScsiModeSensePageControl.Current, 0x3F, 0x00, 5, out _); } - if(!sense && - !_dev.Error) + if(!sense && !_dev.Error) { if(Modes.DecodeMode10(cmdBuf, _dev.ScsiType).HasValue) { @@ -1280,8 +1259,7 @@ partial class Dump if(sense || _dev.Error) sense = _dev.ModeSense(out cmdBuf, out _, 5, out _); - if(!sense && - !_dev.Error) + if(!sense && !_dev.Error) { if(Modes.DecodeMode6(cmdBuf, _dev.ScsiType).HasValue) { @@ -1312,10 +1290,11 @@ partial class Dump if(filesystems.Count > 0) { foreach(var filesystem in filesystems.Select(o => new - { - o.start, - o.type - }).Distinct()) + { + o.start, + o.type + }). + Distinct()) { UpdateStatus?.Invoke(string.Format(Localization.Core.Found_filesystem_0_at_sector_1, filesystem.type, filesystem.start)); @@ -1333,8 +1312,7 @@ partial class Dump sidecar.BlockMedias[0].MediaSubType = xmlType.subType; // TODO: Implement device firmware revision - if(!_dev.IsRemovable || - _dev.IsUsb) + if(!_dev.IsRemovable || _dev.IsUsb) { if(_dev.Type == DeviceType.ATAPI) sidecar.BlockMedias[0].Interface = "ATAPI"; @@ -1377,17 +1355,17 @@ partial class Dump UpdateStatus?.Invoke(""); UpdateStatus?. - Invoke(string.Format( - Localization.Core.Took_a_total_of_0_1_processing_commands_2_checksumming_3_writing_4_closing, - _dumpStopwatch.Elapsed.Humanize(minUnit: TimeUnit.Second), - totalDuration.Milliseconds().Humanize(minUnit: TimeUnit.Second), - totalChkDuration.Milliseconds().Humanize(minUnit: TimeUnit.Second), - imageWriteDuration.Seconds().Humanize(minUnit: TimeUnit.Second), - _imageCloseStopwatch.Elapsed.Humanize(minUnit: TimeUnit.Second))); + Invoke(string.Format(Localization.Core.Took_a_total_of_0_1_processing_commands_2_checksumming_3_writing_4_closing, + _dumpStopwatch.Elapsed.Humanize(minUnit: TimeUnit.Second), + totalDuration.Milliseconds().Humanize(minUnit: TimeUnit.Second), + totalChkDuration.Milliseconds().Humanize(minUnit: TimeUnit.Second), + imageWriteDuration.Seconds().Humanize(minUnit: TimeUnit.Second), + _imageCloseStopwatch.Elapsed.Humanize(minUnit: TimeUnit.Second))); UpdateStatus?.Invoke(string.Format(Localization.Core.Average_speed_0, ByteSize.FromBytes(blockSize * (blocks + 1)). - Per(totalDuration.Milliseconds())).Humanize()); + Per(totalDuration.Milliseconds())). + Humanize()); if(maxSpeed > 0) { diff --git a/Aaru.Core/Devices/Dumping/Sbc/Error.cs b/Aaru.Core/Devices/Dumping/Sbc/Error.cs index cf896e8e8..61aeee883 100644 --- a/Aaru.Core/Devices/Dumping/Sbc/Error.cs +++ b/Aaru.Core/Devices/Dumping/Sbc/Error.cs @@ -89,7 +89,7 @@ partial class Dump if(dcMode10?.Pages != null) { foreach(Modes.ModePage modePage in dcMode10.Value.Pages.Where(modePage => - modePage is { Page: 0x01, Subpage: 0x00 })) + modePage is { Page: 0x01, Subpage: 0x00 })) currentModePage = modePage; } } @@ -100,8 +100,10 @@ partial class Dump if(dcMode6?.Pages != null) { - foreach(Modes.ModePage modePage in dcMode6.Value.Pages.Where(modePage => - modePage is { Page: 0x01, Subpage: 0x00 })) + foreach(Modes.ModePage modePage in dcMode6.Value.Pages.Where(modePage => modePage is + { + Page: 0x01, Subpage: 0x00 + })) currentModePage = modePage; } } @@ -249,10 +251,8 @@ partial class Dump { PulseProgress?.Invoke(runningPersistent ? string. - Format( - Localization.Core. - Retrying_sector_0_pass_1_recovering_partial_data_forward, - badSector, pass) + Format(Localization.Core.Retrying_sector_0_pass_1_recovering_partial_data_forward, + badSector, pass) : string.Format(Localization.Core.Retrying_sector_0_pass_1_forward, badSector, pass)); } @@ -260,10 +260,8 @@ partial class Dump { PulseProgress?.Invoke(runningPersistent ? string. - Format( - Localization.Core. - Retrying_sector_0_pass_1_recovering_partial_data_reverse, - badSector, pass) + Format(Localization.Core.Retrying_sector_0_pass_1_recovering_partial_data_reverse, + badSector, pass) : string.Format(Localization.Core.Retrying_sector_0_pass_1_reverse, badSector, pass)); } @@ -301,9 +299,7 @@ partial class Dump outputFormat.WriteSector(buffer, badSector); } - if(pass < _retryPasses && - !_aborted && - _resume.BadBlocks.Count > 0) + if(pass < _retryPasses && !_aborted && _resume.BadBlocks.Count > 0) { pass++; forward = !forward; @@ -320,7 +316,10 @@ partial class Dump var md = new Modes.DecodedMode { Header = new Modes.ModeHeader(), - Pages = new[] { currentModePage.Value } + Pages = new[] + { + currentModePage.Value + } }; md6 = Modes.EncodeMode6(md, _dev.ScsiType); @@ -384,17 +383,24 @@ partial class Dump if(!titleKey.HasValue) continue; - outputFormat.WriteSectorTag(new[] { titleKey.Value.CMI }, missingKey, SectorTagType.DvdSectorCmi); + outputFormat.WriteSectorTag(new[] + { + titleKey.Value.CMI + }, missingKey, SectorTagType.DvdSectorCmi); // If the CMI bit is 1, the sector is using copy protection, else it is not // If the decoded title key is zeroed, there should be no copy protection - if((titleKey.Value.CMI & 0x80) >> 7 == 0 || - titleKey.Value.Key.All(k => k == 0)) + if((titleKey.Value.CMI & 0x80) >> 7 == 0 || titleKey.Value.Key.All(k => k == 0)) { - outputFormat.WriteSectorTag(new byte[] { 0, 0, 0, 0, 0 }, missingKey, SectorTagType.DvdSectorTitleKey); + outputFormat.WriteSectorTag(new byte[] + { + 0, 0, 0, 0, 0 + }, missingKey, SectorTagType.DvdSectorTitleKey); - outputFormat.WriteSectorTag(new byte[] { 0, 0, 0, 0, 0 }, missingKey, - SectorTagType.DvdTitleKeyDecrypted); + outputFormat.WriteSectorTag(new byte[] + { + 0, 0, 0, 0, 0 + }, missingKey, SectorTagType.DvdTitleKeyDecrypted); _resume.MissingTitleKeys.Remove(missingKey); @@ -421,9 +427,7 @@ partial class Dump } } - if(pass < _retryPasses && - !_aborted && - _resume.MissingTitleKeys.Count > 0) + if(pass < _retryPasses && !_aborted && _resume.MissingTitleKeys.Count > 0) { pass++; forward = !forward; diff --git a/Aaru.Core/Devices/Dumping/Sbc/Optical.cs b/Aaru.Core/Devices/Dumping/Sbc/Optical.cs index 0065ac3de..326589814 100644 --- a/Aaru.Core/Devices/Dumping/Sbc/Optical.cs +++ b/Aaru.Core/Devices/Dumping/Sbc/Optical.cs @@ -67,8 +67,7 @@ partial class Dump DecodedSense? decodedSense = Sense.Decode(buffer); - if(_dev.LastError != 0 || - decodedSense?.SenseKey == SenseKeys.IllegalRequest) + if(_dev.LastError != 0 || decodedSense?.SenseKey == SenseKeys.IllegalRequest) { UpdateStatus?.Invoke(Localization.Core.The_current_environment_doesn_t_support_the_medium_scan_command); @@ -77,8 +76,7 @@ partial class Dump } // TODO: Find a place where MEDIUM SCAN works properly - else if(buffer?.Length > 0 && - !ArrayHelpers.ArrayIsNullOrEmpty(buffer)) + else if(buffer?.Length > 0 && !ArrayHelpers.ArrayIsNullOrEmpty(buffer)) AaruConsole.WriteLine(Localization.Core.MEDIUM_SCAN_github_plead_message); changingCounter = false; @@ -115,11 +113,8 @@ partial class Dump c = (uint)(blocks - b); UpdateProgress?. - Invoke( - written - ? string.Format(Localization.Core.Scanning_for_0_written_blocks_starting_in_block_1, c, b) - : string.Format(Localization.Core.Scanning_for_0_blank_blocks_starting_in_block_1, c, b), - b, (long)blocks); + Invoke(written ? string.Format(Localization.Core.Scanning_for_0_written_blocks_starting_in_block_1, c, b) : string.Format(Localization.Core.Scanning_for_0_blank_blocks_starting_in_block_1, c, b), + b, (long)blocks); conditionMet = _dev.MediumScan(out _, written, false, false, false, false, b, c, c, out _, out _, uint.MaxValue, out _); @@ -205,25 +200,20 @@ partial class Dump if(extent.Item2 + 1 - i < blocksToRead) blocksToRead = (uint)(extent.Item2 + 1 - i); - if(currentSpeed > maxSpeed && - currentSpeed > 0) + if(currentSpeed > maxSpeed && currentSpeed > 0) maxSpeed = currentSpeed; - if(currentSpeed < minSpeed && - currentSpeed > 0) + if(currentSpeed < minSpeed && currentSpeed > 0) minSpeed = currentSpeed; UpdateProgress?. - Invoke( - string.Format(Localization.Core.Reading_sector_0_of_1_2, i, blocks, - ByteSize.FromMegabytes(currentSpeed).Per(_oneSecond).Humanize()), - (long)i, (long)blocks); + Invoke(string.Format(Localization.Core.Reading_sector_0_of_1_2, i, blocks, ByteSize.FromMegabytes(currentSpeed).Per(_oneSecond).Humanize()), + (long)i, (long)blocks); sense = scsiReader.ReadBlocks(out buffer, i, blocksToRead, out double cmdDuration, out _, out _); totalDuration += cmdDuration; - if(!sense && - !_dev.Error) + if(!sense && !_dev.Error) { mhddLog.Write(i, cmdDuration, blocksToRead); ibgLog.Write(i, currentSpeed * 1024); diff --git a/Aaru.Core/Devices/Dumping/Sbc/Trim.cs b/Aaru.Core/Devices/Dumping/Sbc/Trim.cs index 51a5f7dec..781c0dacb 100644 --- a/Aaru.Core/Devices/Dumping/Sbc/Trim.cs +++ b/Aaru.Core/Devices/Dumping/Sbc/Trim.cs @@ -84,8 +84,7 @@ partial class Dump continue; } - if((sense || _dev.Error) && - !recoveredError) + if((sense || _dev.Error) && !recoveredError) continue; _resume.BadBlocks.Remove(badSector); diff --git a/Aaru.Core/Devices/Dumping/SecureDigital.cs b/Aaru.Core/Devices/Dumping/SecureDigital.cs index 93a9c674a..51e324551 100644 --- a/Aaru.Core/Devices/Dumping/SecureDigital.cs +++ b/Aaru.Core/Devices/Dumping/SecureDigital.cs @@ -226,8 +226,9 @@ public partial class Dump } else { - supportsCmd23 = Decoders.SecureDigital.Decoders.DecodeSCR(scr)?.CommandSupport. - HasFlag(CommandSupport.SetBlockCount) ?? false; + supportsCmd23 = Decoders.SecureDigital.Decoders.DecodeSCR(scr)?. + CommandSupport.HasFlag(CommandSupport.SetBlockCount) ?? + false; mediaTags.Add(MediaTagType.SD_SCR, null); } @@ -298,8 +299,7 @@ public partial class Dump if(error) blocksToRead /= 2; - if(!error || - blocksToRead == 1) + if(!error || blocksToRead == 1) break; } @@ -315,9 +315,7 @@ public partial class Dump } } - if(_useBufferedReads && - blocksToRead > 1 && - !supportsCmd23) + if(_useBufferedReads && blocksToRead > 1 && !supportsCmd23) { while(true) { @@ -326,8 +324,7 @@ public partial class Dump if(error) blocksToRead /= 2; - if(!error || - blocksToRead == 1) + if(!error || blocksToRead == 1) break; // Device is in timeout, reopen to reset @@ -344,9 +341,7 @@ public partial class Dump } } - if(!_useBufferedReads && - blocksToRead > 1 && - !supportsCmd23) + if(!_useBufferedReads && blocksToRead > 1 && !supportsCmd23) { while(true) { @@ -360,8 +355,7 @@ public partial class Dump if(_dev.LastError == 110) _dev.ReOpen(); - if(!error || - blocksToRead == 1) + if(!error || blocksToRead == 1) break; } @@ -423,8 +417,7 @@ public partial class Dump ResumeSupport.Process(true, false, blocks, _dev.Manufacturer, _dev.Model, _dev.Serial, _dev.PlatformId, ref _resume, ref currentTry, ref extents, _dev.FirmwareRevision, _private, _force); - if(currentTry == null || - extents == null) + if(currentTry == null || extents == null) { StoppingErrorMessage?.Invoke(Localization.Core.Could_not_process_resume_file_not_continuing); @@ -472,7 +465,8 @@ public partial class Dump _dumpLog.WriteLine(outputFormat.ErrorMessage); StoppingErrorMessage?.Invoke(Localization.Core.Error_creating_output_image_not_continuing + - Environment.NewLine + outputFormat.ErrorMessage); + Environment.NewLine + + outputFormat.ErrorMessage); return; } @@ -509,12 +503,12 @@ public partial class Dump : MediaTagType.MMC_CID); // Cannot write CID to image - if(!ret && - !_force) + if(!ret && !_force) { _dumpLog.WriteLine(Localization.Core.Cannot_write_CID_to_output_image); - StoppingErrorMessage?.Invoke(Localization.Core.Cannot_write_CID_to_output_image + Environment.NewLine + + StoppingErrorMessage?.Invoke(Localization.Core.Cannot_write_CID_to_output_image + + Environment.NewLine + outputFormat.ErrorMessage); return; @@ -530,12 +524,12 @@ public partial class Dump : MediaTagType.MMC_CSD); // Cannot write CSD to image - if(!ret && - !_force) + if(!ret && !_force) { _dumpLog.WriteLine(Localization.Core.Cannot_write_CSD_to_output_image); - StoppingErrorMessage?.Invoke(Localization.Core.Cannot_write_CSD_to_output_image + Environment.NewLine + + StoppingErrorMessage?.Invoke(Localization.Core.Cannot_write_CSD_to_output_image + + Environment.NewLine + outputFormat.ErrorMessage); return; @@ -547,13 +541,13 @@ public partial class Dump ret = outputFormat.WriteMediaTag(ecsd, MediaTagType.MMC_ExtendedCSD); // Cannot write Extended CSD to image - if(!ret && - !_force) + if(!ret && !_force) { _dumpLog.WriteLine(Localization.Core.Cannot_write_Extended_CSD_to_output_image); StoppingErrorMessage?.Invoke(Localization.Core.Cannot_write_Extended_CSD_to_output_image + - Environment.NewLine + outputFormat.ErrorMessage); + Environment.NewLine + + outputFormat.ErrorMessage); return; } @@ -568,12 +562,12 @@ public partial class Dump : MediaTagType.MMC_OCR); // Cannot write OCR to image - if(!ret && - !_force) + if(!ret && !_force) { _dumpLog.WriteLine(Localization.Core.Cannot_write_OCR_to_output_image); - StoppingErrorMessage?.Invoke(Localization.Core.Cannot_write_OCR_to_output_image + Environment.NewLine + + StoppingErrorMessage?.Invoke(Localization.Core.Cannot_write_OCR_to_output_image + + Environment.NewLine + outputFormat.ErrorMessage); return; @@ -585,12 +579,12 @@ public partial class Dump ret = outputFormat.WriteMediaTag(scr, MediaTagType.SD_SCR); // Cannot write SCR to image - if(!ret && - !_force) + if(!ret && !_force) { _dumpLog.WriteLine(Localization.Core.Cannot_write_SCR_to_output_image); - StoppingErrorMessage?.Invoke(Localization.Core.Cannot_write_SCR_to_output_image + Environment.NewLine + + StoppingErrorMessage?.Invoke(Localization.Core.Cannot_write_SCR_to_output_image + + Environment.NewLine + outputFormat.ErrorMessage); return; @@ -646,19 +640,15 @@ public partial class Dump if(blocks - i < blocksToRead) blocksToRead = (byte)(blocks - i); - if(currentSpeed > maxSpeed && - currentSpeed > 0) + if(currentSpeed > maxSpeed && currentSpeed > 0) maxSpeed = currentSpeed; - if(currentSpeed < minSpeed && - currentSpeed > 0) + if(currentSpeed < minSpeed && currentSpeed > 0) minSpeed = currentSpeed; UpdateProgress?. - Invoke( - string.Format(Localization.Core.Reading_sector_0_of_1_2, i, blocks, - ByteSize.FromMegabytes(currentSpeed).Per(_oneSecond).Humanize()), - (long)i, (long)blocks); + Invoke(string.Format(Localization.Core.Reading_sector_0_of_1_2, i, blocks, ByteSize.FromMegabytes(currentSpeed).Per(_oneSecond).Humanize()), + (long)i, (long)blocks); if(blocksToRead == 1) { @@ -757,10 +747,7 @@ public partial class Dump #region Trimming - if(_resume.BadBlocks.Count > 0 && - !_aborted && - _trim && - newTrim) + if(_resume.BadBlocks.Count > 0 && !_aborted && _trim && newTrim) { _trimStopwatch.Restart(); UpdateStatus?.Invoke(Localization.Core.Trimming_skipped_sectors); @@ -814,9 +801,7 @@ public partial class Dump #region Error handling - if(_resume.BadBlocks.Count > 0 && - !_aborted && - _retryPasses > 0) + if(_resume.BadBlocks.Count > 0 && !_aborted && _retryPasses > 0) { var pass = 1; var forward = true; @@ -865,9 +850,7 @@ public partial class Dump _dumpLog.WriteLine(Localization.Core.Correctly_retried_block_0_in_pass_1, badSector, pass); } - if(pass < _retryPasses && - !_aborted && - _resume.BadBlocks.Count > 0) + if(pass < _retryPasses && !_aborted && _resume.BadBlocks.Count > 0) { pass++; forward = !forward; @@ -897,7 +880,8 @@ public partial class Dump if(!outputFormat.SetImageInfo(metadata)) { - ErrorMessage?.Invoke(Localization.Core.Error_0_setting_metadata + Environment.NewLine + + ErrorMessage?.Invoke(Localization.Core.Error_0_setting_metadata + + Environment.NewLine + outputFormat.ErrorMessage); } @@ -971,7 +955,8 @@ public partial class Dump _sidecarStopwatch.Elapsed.Humanize(minUnit: TimeUnit.Second)); _dumpLog.WriteLine(Localization.Core.Average_checksum_speed_0, - ByteSize.FromBytes(blockSize * (blocks + 1)).Per(totalChkDuration.Milliseconds()). + ByteSize.FromBytes(blockSize * (blocks + 1)). + Per(totalChkDuration.Milliseconds()). Humanize()); (string type, string subType) xmlType = (null, null); @@ -1023,17 +1008,17 @@ public partial class Dump UpdateStatus?.Invoke(""); UpdateStatus?. - Invoke(string.Format( - Localization.Core.Took_a_total_of_0_1_processing_commands_2_checksumming_3_writing_4_closing, - _dumpStopwatch.Elapsed.Humanize(minUnit: TimeUnit.Second), - totalDuration.Milliseconds().Humanize(minUnit: TimeUnit.Second), - totalChkDuration.Milliseconds().Humanize(minUnit: TimeUnit.Second), - imageWriteDuration.Seconds().Humanize(minUnit: TimeUnit.Second), - _imageCloseStopwatch.Elapsed.Humanize(minUnit: TimeUnit.Second))); + Invoke(string.Format(Localization.Core.Took_a_total_of_0_1_processing_commands_2_checksumming_3_writing_4_closing, + _dumpStopwatch.Elapsed.Humanize(minUnit: TimeUnit.Second), + totalDuration.Milliseconds().Humanize(minUnit: TimeUnit.Second), + totalChkDuration.Milliseconds().Humanize(minUnit: TimeUnit.Second), + imageWriteDuration.Seconds().Humanize(minUnit: TimeUnit.Second), + _imageCloseStopwatch.Elapsed.Humanize(minUnit: TimeUnit.Second))); UpdateStatus?.Invoke(string.Format(Localization.Core.Average_speed_0, ByteSize.FromBytes(blockSize * (blocks + 1)). - Per(totalDuration.Milliseconds()).Humanize())); + Per(totalDuration.Milliseconds()). + Humanize())); if(maxSpeed > 0) { diff --git a/Aaru.Core/Devices/Dumping/XGD.cs b/Aaru.Core/Devices/Dumping/XGD.cs index b2312ae3d..1c1fe2a61 100644 --- a/Aaru.Core/Devices/Dumping/XGD.cs +++ b/Aaru.Core/Devices/Dumping/XGD.cs @@ -205,11 +205,11 @@ partial class Dump Array.Copy(readBuffer, 4, tmpBuf, 0, readBuffer.Length - 4); mediaTags.Add(MediaTagType.DVD_PFI, tmpBuf); - AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Core.Video_partition_total_size_0_sectors, - totalSize); + AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Core.Video_partition_total_size_0_sectors, totalSize); ulong l0Video = (PFI.Decode(readBuffer, MediaType.DVDROM)?.Layer0EndPSN ?? 0) - - (PFI.Decode(readBuffer, MediaType.DVDROM)?.DataAreaStartPSN ?? 0) + 1; + (PFI.Decode(readBuffer, MediaType.DVDROM)?.DataAreaStartPSN ?? 0) + + 1; ulong l1Video = totalSize - l0Video + 1; UpdateStatus?.Invoke(Localization.Core.Reading_Disc_Manufacturing_Information); @@ -236,19 +236,22 @@ partial class Dump UpdateStatus?.Invoke(Localization.Core.Video_partition_is_too_big_did_lock_work_Trying_cold_values); _dumpLog.WriteLine(Localization.Core.Video_partition_is_too_big_did_lock_work_Trying_cold_values); - totalSize = (ulong)((coldReadCapacity[0] << 24) + (coldReadCapacity[1] << 16) + (coldReadCapacity[2] << 8) + - coldReadCapacity[3]) & 0xFFFFFFFF; + totalSize = (ulong)((coldReadCapacity[0] << 24) + + (coldReadCapacity[1] << 16) + + (coldReadCapacity[2] << 8) + + coldReadCapacity[3]) & + 0xFFFFFFFF; tmpBuf = new byte[coldPfi.Length - 4]; Array.Copy(coldPfi, 4, tmpBuf, 0, coldPfi.Length - 4); mediaTags.Remove(MediaTagType.DVD_PFI); mediaTags.Add(MediaTagType.DVD_PFI, tmpBuf); - AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Core.Video_partition_total_size_0_sectors, - totalSize); + AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Core.Video_partition_total_size_0_sectors, totalSize); l0Video = (PFI.Decode(coldPfi, MediaType.DVDROM)?.Layer0EndPSN ?? 0) - - (PFI.Decode(coldPfi, MediaType.DVDROM)?.DataAreaStartPSN ?? 0) + 1; + (PFI.Decode(coldPfi, MediaType.DVDROM)?.DataAreaStartPSN ?? 0) + + 1; l1Video = totalSize - l0Video + 1; @@ -291,10 +294,10 @@ partial class Dump ulong gameSize = ((ulong)((readBuffer[0] << 24) + (readBuffer[1] << 16) + (readBuffer[2] << 8) + readBuffer[3]) & - 0xFFFFFFFF) + 1; + 0xFFFFFFFF) + + 1; - AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Core.Game_partition_total_size_0_sectors, - gameSize); + AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Core.Game_partition_total_size_0_sectors, gameSize); // Get middle zone size AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Core.Getting_middle_zone_size); @@ -453,8 +456,7 @@ partial class Dump if(sense || _dev.Error) blocksToRead /= 2; - if(!_dev.Error || - blocksToRead == 1) + if(!_dev.Error || blocksToRead == 1) break; } @@ -513,7 +515,8 @@ partial class Dump _dumpLog.WriteLine(outputFormat.ErrorMessage); StoppingErrorMessage?.Invoke(Localization.Core.Error_creating_output_image_not_continuing + - Environment.NewLine + outputFormat.ErrorMessage); + Environment.NewLine + + outputFormat.ErrorMessage); return; } @@ -529,8 +532,7 @@ partial class Dump ResumeSupport.Process(true, true, totalSize, _dev.Manufacturer, _dev.Model, _dev.Serial, _dev.PlatformId, ref _resume, ref currentTry, ref extents, _dev.FirmwareRevision, _private, _force); - if(currentTry == null || - extents == null) + if(currentTry == null || extents == null) StoppingErrorMessage?.Invoke(Localization.Core.Could_not_process_resume_file_not_continuing); if(_createGraph) @@ -606,7 +608,8 @@ partial class Dump else { extentStart = (xboxSs.Value.Layer0EndPSN + 1) * 2 - - ((xboxSs.Value.Extents[e].StartPSN ^ 0xFFFFFF) + 1) - 0x30000; + ((xboxSs.Value.Extents[e].StartPSN ^ 0xFFFFFF) + 1) - + 0x30000; } if(xboxSs.Value.Extents[e].EndPSN <= xboxSs.Value.Layer0EndPSN) @@ -614,7 +617,8 @@ partial class Dump else { extentEnd = (xboxSs.Value.Layer0EndPSN + 1) * 2 - - ((xboxSs.Value.Extents[e].EndPSN ^ 0xFFFFFF) + 1) - 0x30000; + ((xboxSs.Value.Extents[e].EndPSN ^ 0xFFFFFF) + 1) - + 0x30000; } } @@ -644,27 +648,22 @@ partial class Dump if(extentStart - i < blocksToRead) blocksToRead = (uint)(extentStart - i); - if(currentSpeed > maxSpeed && - currentSpeed > 0) + if(currentSpeed > maxSpeed && currentSpeed > 0) maxSpeed = currentSpeed; - if(currentSpeed < minSpeed && - currentSpeed > 0) + if(currentSpeed < minSpeed && currentSpeed > 0) minSpeed = currentSpeed; UpdateProgress?. - Invoke( - string.Format(Localization.Core.Reading_sector_0_of_1_2, i, blocks, - ByteSize.FromMegabytes(currentSpeed).Per(_oneSecond).Humanize()), - (long)i, (long)totalSize); + Invoke(string.Format(Localization.Core.Reading_sector_0_of_1_2, i, blocks, ByteSize.FromMegabytes(currentSpeed).Per(_oneSecond).Humanize()), + (long)i, (long)totalSize); sense = _dev.Read12(out readBuffer, out senseBuf, 0, false, false, false, false, (uint)i, blockSize, 0, blocksToRead, false, _dev.Timeout, out cmdDuration); totalDuration += cmdDuration; - if(!sense && - !_dev.Error) + if(!sense && !_dev.Error) { mhddLog.Write(i, cmdDuration, blocksToRead); ibgLog.Write(i, currentSpeed * 1024); @@ -704,8 +703,10 @@ partial class Dump i += _skip - blocksToRead; string[] senseLines = Sense.PrettifySense(senseBuf). - Split(new[] { Environment.NewLine }, - StringSplitOptions.RemoveEmptyEntries); + Split(new[] + { + Environment.NewLine + }, StringSplitOptions.RemoveEmptyEntries); foreach(string senseLine in senseLines) _dumpLog.WriteLine(senseLine); @@ -790,10 +791,8 @@ partial class Dump blocksToRead = (uint)(middleZone - 1 - middle); UpdateProgress?. - Invoke( - string.Format(Localization.Core.Reading_sector_0_of_1_2, middle + currentSector, totalSize, - ByteSize.FromMegabytes(currentSpeed).Per(_oneSecond).Humanize()), - (long)(middle + currentSector), (long)totalSize); + Invoke(string.Format(Localization.Core.Reading_sector_0_of_1_2, middle + currentSector, totalSize, ByteSize.FromMegabytes(currentSpeed).Per(_oneSecond).Humanize()), + (long)(middle + currentSector), (long)totalSize); mhddLog.Write(middle + currentSector, cmdDuration, blocksToRead); ibgLog.Write(middle + currentSector, currentSpeed * 1024); @@ -853,27 +852,22 @@ partial class Dump if(l0Video + l1Video - l1 < blocksToRead) blocksToRead = (uint)(l0Video + l1Video - l1); - if(currentSpeed > maxSpeed && - currentSpeed > 0) + if(currentSpeed > maxSpeed && currentSpeed > 0) maxSpeed = currentSpeed; - if(currentSpeed < minSpeed && - currentSpeed > 0) + if(currentSpeed < minSpeed && currentSpeed > 0) minSpeed = currentSpeed; UpdateProgress?. - Invoke( - string.Format(Localization.Core.Reading_sector_0_of_1_2, currentSector, totalSize, - ByteSize.FromMegabytes(currentSpeed).Per(_oneSecond).Humanize()), - (long)currentSector, (long)totalSize); + Invoke(string.Format(Localization.Core.Reading_sector_0_of_1_2, currentSector, totalSize, ByteSize.FromMegabytes(currentSpeed).Per(_oneSecond).Humanize()), + (long)currentSector, (long)totalSize); sense = _dev.Read12(out readBuffer, out senseBuf, 0, false, false, false, false, (uint)l1, blockSize, 0, blocksToRead, false, _dev.Timeout, out cmdDuration); totalDuration += cmdDuration; - if(!sense && - !_dev.Error) + if(!sense && !_dev.Error) { mhddLog.Write(currentSector, cmdDuration, blocksToRead); ibgLog.Write(currentSector, currentSpeed * 1024); @@ -907,7 +901,10 @@ partial class Dump l1 += _skip - blocksToRead; string[] senseLines = Sense.PrettifySense(senseBuf). - Split(new[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries); + Split(new[] + { + Environment.NewLine + }, StringSplitOptions.RemoveEmptyEntries); foreach(string senseLine in senseLines) _dumpLog.WriteLine(senseLine); @@ -984,10 +981,7 @@ partial class Dump #region Trimming - if(_resume.BadBlocks.Count > 0 && - !_aborted && - _trim && - newTrim) + if(_resume.BadBlocks.Count > 0 && !_aborted && _trim && newTrim) { _trimStopwatch.Restart(); UpdateStatus?.Invoke(Localization.Core.Trimming_skipped_sectors); @@ -1040,9 +1034,7 @@ partial class Dump #region Error handling - if(_resume.BadBlocks.Count > 0 && - !_aborted && - _retryPasses > 0) + if(_resume.BadBlocks.Count > 0 && !_aborted && _retryPasses > 0) { List tmpList = new(); @@ -1083,7 +1075,7 @@ partial class Dump if(dcMode10.HasValue) { foreach(Modes.ModePage modePage in dcMode10.Value.Pages.Where(modePage => - modePage is { Page: 0x01, Subpage: 0x00 })) + modePage is { Page: 0x01, Subpage: 0x00 })) currentModePage = modePage; } } @@ -1095,7 +1087,7 @@ partial class Dump if(dcMode6.HasValue) { foreach(Modes.ModePage modePage in dcMode6.Value.Pages.Where(modePage => - modePage is { Page: 0x01, Subpage: 0x00 })) + modePage is { Page: 0x01, Subpage: 0x00 })) currentModePage = modePage; } } @@ -1181,10 +1173,8 @@ partial class Dump { PulseProgress?.Invoke(runningPersistent ? string. - Format( - Localization.Core. - Retrying_sector_0_pass_1_recovering_partial_data_forward, - badSector, pass) + Format(Localization.Core.Retrying_sector_0_pass_1_recovering_partial_data_forward, + badSector, pass) : string.Format(Localization.Core.Retrying_sector_0_pass_1_forward, badSector, pass)); } @@ -1192,10 +1182,8 @@ partial class Dump { PulseProgress?.Invoke(runningPersistent ? string. - Format( - Localization.Core. - Retrying_sector_0_pass_1_recovering_partial_data_reverse, - badSector, pass) + Format(Localization.Core.Retrying_sector_0_pass_1_recovering_partial_data_reverse, + badSector, pass) : string.Format(Localization.Core.Retrying_sector_0_pass_1_reverse, badSector, pass)); } @@ -1208,8 +1196,7 @@ partial class Dump if(sense || _dev.Error) _errorLog?.WriteLine(currentSector, _dev.Error, _dev.LastError, senseBuf); - if(!sense && - !_dev.Error) + if(!sense && !_dev.Error) { _resume.BadBlocks.Remove(badSector); extents.Add(badSector); @@ -1225,9 +1212,7 @@ partial class Dump outputFormat.WriteSector(readBuffer, badSector); } - if(pass < _retryPasses && - !_aborted && - _resume.BadBlocks.Count > 0) + if(pass < _retryPasses && !_aborted && _resume.BadBlocks.Count > 0) { pass++; forward = !forward; @@ -1244,7 +1229,10 @@ partial class Dump var md = new Modes.DecodedMode { Header = new Modes.ModeHeader(), - Pages = new[] { currentModePage.Value } + Pages = new[] + { + currentModePage.Value + } }; md6 = Modes.EncodeMode6(md, _dev.ScsiType); @@ -1284,7 +1272,8 @@ partial class Dump _dumpLog.WriteLine(string.Format(Localization.Core.Cannot_write_tag_0, tag.Key)); StoppingErrorMessage?.Invoke(string.Format(Localization.Core.Cannot_write_tag_0, tag.Key) + - Environment.NewLine + outputFormat.ErrorMessage); + Environment.NewLine + + outputFormat.ErrorMessage); return; } @@ -1306,7 +1295,8 @@ partial class Dump if(!outputFormat.SetImageInfo(metadata)) { - ErrorMessage?.Invoke(Localization.Core.Error_0_setting_metadata + Environment.NewLine + + ErrorMessage?.Invoke(Localization.Core.Error_0_setting_metadata + + Environment.NewLine + outputFormat.ErrorMessage); } @@ -1355,17 +1345,17 @@ partial class Dump UpdateStatus?.Invoke(""); UpdateStatus?. - Invoke(string.Format( - Localization.Core.Took_a_total_of_0_1_processing_commands_2_checksumming_3_writing_4_closing, - _dumpStopwatch.Elapsed.Humanize(minUnit: TimeUnit.Second), - totalDuration.Milliseconds().Humanize(minUnit: TimeUnit.Second), - totalChkDuration.Milliseconds().Humanize(minUnit: TimeUnit.Second), - imageWriteDuration.Seconds().Humanize(minUnit: TimeUnit.Second), - _imageCloseStopwatch.Elapsed.Humanize(minUnit: TimeUnit.Second))); + Invoke(string.Format(Localization.Core.Took_a_total_of_0_1_processing_commands_2_checksumming_3_writing_4_closing, + _dumpStopwatch.Elapsed.Humanize(minUnit: TimeUnit.Second), + totalDuration.Milliseconds().Humanize(minUnit: TimeUnit.Second), + totalChkDuration.Milliseconds().Humanize(minUnit: TimeUnit.Second), + imageWriteDuration.Seconds().Humanize(minUnit: TimeUnit.Second), + _imageCloseStopwatch.Elapsed.Humanize(minUnit: TimeUnit.Second))); UpdateStatus?.Invoke(string.Format(Localization.Core.Average_speed_0, ByteSize.FromBytes(blockSize * (blocks + 1)). - Per(totalDuration.Milliseconds()).Humanize())); + Per(totalDuration.Milliseconds()). + Humanize())); if(maxSpeed > 0) { diff --git a/Aaru.Core/Devices/Info/DeviceInfo.cs b/Aaru.Core/Devices/Info/DeviceInfo.cs index 335fd7460..fd42ddfee 100644 --- a/Aaru.Core/Devices/Info/DeviceInfo.cs +++ b/Aaru.Core/Devices/Info/DeviceInfo.cs @@ -95,15 +95,13 @@ public partial class DeviceInfo AaruConsole.DebugWriteLine(MODULE_NAME, "SECTOR = 0x{0:X2}", errorRegisters.Sector); - AaruConsole.DebugWriteLine(MODULE_NAME, "CYLHIGH = 0x{0:X2}", - errorRegisters.CylinderHigh); + AaruConsole.DebugWriteLine(MODULE_NAME, "CYLHIGH = 0x{0:X2}", errorRegisters.CylinderHigh); AaruConsole.DebugWriteLine(MODULE_NAME, "CYLLOW = 0x{0:X2}", errorRegisters.CylinderLow); AaruConsole.DebugWriteLine(MODULE_NAME, "DEVICE = 0x{0:X2}", errorRegisters.DeviceHead); - AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Core.Error_code_equals_0, - dev.LastError); + AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Core.Error_code_equals_0, dev.LastError); break; } @@ -138,15 +136,13 @@ public partial class DeviceInfo AaruConsole.DebugWriteLine(MODULE_NAME, "SECTOR = 0x{0:X2}", errorRegisters.Sector); - AaruConsole.DebugWriteLine(MODULE_NAME, "CYLHIGH = 0x{0:X2}", - errorRegisters.CylinderHigh); + AaruConsole.DebugWriteLine(MODULE_NAME, "CYLHIGH = 0x{0:X2}", errorRegisters.CylinderHigh); AaruConsole.DebugWriteLine(MODULE_NAME, "CYLLOW = 0x{0:X2}", errorRegisters.CylinderLow); AaruConsole.DebugWriteLine(MODULE_NAME, "DEVICE = 0x{0:X2}", errorRegisters.DeviceHead); - AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Core.Error_code_equals_0, - dev.LastError); + AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Core.Error_code_equals_0, dev.LastError); break; } @@ -201,8 +197,7 @@ public partial class DeviceInfo sense = dev.ModeSense10(out byte[] modeBuf, out senseBuf, false, true, ScsiModeSensePageControl.Current, 0x3F, 0xFF, 5, out _); - if(!sense && - !dev.Error) + if(!sense && !dev.Error) ScsiModeSense10 = modeBuf; if(sense || dev.Error) @@ -210,13 +205,11 @@ public partial class DeviceInfo sense = dev.ModeSense10(out modeBuf, out senseBuf, false, true, ScsiModeSensePageControl.Current, 0x3F, 0x00, 5, out _); - if(!sense && - !dev.Error) + if(!sense && !dev.Error) ScsiModeSense10 = modeBuf; } - if(!sense && - !dev.Error) + if(!sense && !dev.Error) ScsiMode = Modes.DecodeMode10(modeBuf, devType); bool useMode10 = !(sense || dev.Error || !ScsiMode.HasValue); @@ -224,8 +217,7 @@ public partial class DeviceInfo sense = dev.ModeSense6(out modeBuf, out senseBuf, false, ScsiModeSensePageControl.Current, 0x3F, 0xFF, 5, out _); - if(!sense && - !dev.Error) + if(!sense && !dev.Error) ScsiModeSense6 = modeBuf; if(sense || dev.Error) @@ -233,8 +225,7 @@ public partial class DeviceInfo sense = dev.ModeSense6(out modeBuf, out senseBuf, false, ScsiModeSensePageControl.Current, 0x3F, 0x00, 5, out _); - if(!sense && - !dev.Error) + if(!sense && !dev.Error) ScsiModeSense6 = modeBuf; } @@ -242,14 +233,11 @@ public partial class DeviceInfo { sense = dev.ModeSense(out modeBuf, out senseBuf, 5, out _); - if(!sense && - !dev.Error) + if(!sense && !dev.Error) ScsiModeSense6 = modeBuf; } - if(!sense && - !dev.Error && - !useMode10) + if(!sense && !dev.Error && !useMode10) ScsiMode = Modes.DecodeMode6(modeBuf, devType); switch(devType) @@ -584,8 +572,7 @@ public partial class DeviceInfo sense = dev.ReadExtendedCsd(out mmcBuf, out _, dev.Timeout, out _); - if(!sense && - !ArrayHelpers.ArrayIsNullOrEmpty(mmcBuf)) + if(!sense && !ArrayHelpers.ArrayIsNullOrEmpty(mmcBuf)) ExtendedCSD = mmcBuf; } diff --git a/Aaru.Core/Devices/Reader.cs b/Aaru.Core/Devices/Reader.cs index 71ce87f79..b81295b6a 100644 --- a/Aaru.Core/Devices/Reader.cs +++ b/Aaru.Core/Devices/Reader.cs @@ -148,8 +148,8 @@ sealed partial class Reader ReadBlocks(out buffer, block, 1, out duration, out recoveredError, out blankCheck); internal bool ReadBlocks(out byte[] buffer, ulong block, out double duration, out bool recoveredError, - out bool blankCheck) => ReadBlocks(out buffer, block, BlocksToRead, out duration, - out recoveredError, out blankCheck); + out bool blankCheck) => ReadBlocks(out buffer, block, BlocksToRead, out duration, + out recoveredError, out blankCheck); internal bool ReadBlocks(out byte[] buffer, ulong block, uint count, out double duration, out bool recoveredError, out bool blankCheck) diff --git a/Aaru.Core/Devices/ReaderATA.cs b/Aaru.Core/Devices/ReaderATA.cs index adf031101..f4482f375 100644 --- a/Aaru.Core/Devices/ReaderATA.cs +++ b/Aaru.Core/Devices/ReaderATA.cs @@ -64,8 +64,7 @@ sealed partial class Reader if(_dev.Type != DeviceType.ATA) return; - if(_ataId.CurrentCylinders > 0 && - _ataId is { CurrentHeads: > 0, CurrentSectorsPerTrack: > 0 }) + if(_ataId.CurrentCylinders > 0 && _ataId is { CurrentHeads: > 0, CurrentSectorsPerTrack: > 0 }) { Cylinders = _ataId.CurrentCylinders; Heads = (byte)_ataId.CurrentHeads; @@ -172,19 +171,14 @@ sealed partial class Reader if(IsLba) { - if(Blocks > 0xFFFFFFF && - !_ataReadLba48 && - !_ataReadDmaLba48) + if(Blocks > 0xFFFFFFF && !_ataReadLba48 && !_ataReadDmaLba48) { ErrorMessage = Localization.Core.Device_needs_48_bit_LBA_commands_but_I_cant_issue_them_Aborting; return true; } - if(!_ataReadLba && - !_ataReadRetryLba && - !_ataReadDmaLba && - !_ataReadDmaRetryLba) + if(!_ataReadLba && !_ataReadRetryLba && !_ataReadDmaLba && !_ataReadDmaRetryLba) { ErrorMessage = Localization.Core.Device_needs_28_bit_LBA_commands_but_I_cant_issue_them_Aborting; @@ -193,10 +187,7 @@ sealed partial class Reader } else { - if(!_ataRead && - !_ataReadRetry && - !_ataReadDma && - !_ataReadDmaRetry) + if(!_ataRead && !_ataReadRetry && !_ataReadDma && !_ataReadDmaRetry) { ErrorMessage = Localization.Core.Device_needs_CHS_commands_but_I_cant_issue_them_Aborting; @@ -236,13 +227,11 @@ sealed partial class Reader bool AtaGetBlockSize() { - if((_ataId.PhysLogSectorSize & 0x8000) == 0x0000 && - (_ataId.PhysLogSectorSize & 0x4000) == 0x4000) + if((_ataId.PhysLogSectorSize & 0x8000) == 0x0000 && (_ataId.PhysLogSectorSize & 0x4000) == 0x4000) { if((_ataId.PhysLogSectorSize & 0x1000) == 0x1000) { - if(_ataId.LogicalSectorWords <= 255 || - _ataId.LogicalAlignment == 0xFFFF) + if(_ataId.LogicalSectorWords <= 255 || _ataId.LogicalAlignment == 0xFFFF) LogicalBlockSize = 512; else LogicalBlockSize = _ataId.LogicalSectorWords * 2; @@ -325,13 +314,11 @@ sealed partial class Reader if(error) BlocksToRead /= 2; - if(!error || - BlocksToRead == 1) + if(!error || BlocksToRead == 1) break; } - if(!error || - !IsLba) + if(!error || !IsLba) return false; BlocksToRead = 1; diff --git a/Aaru.Core/Devices/ReaderSCSI.cs b/Aaru.Core/Devices/ReaderSCSI.cs index 664157ad1..a43fa5543 100644 --- a/Aaru.Core/Devices/ReaderSCSI.cs +++ b/Aaru.Core/Devices/ReaderSCSI.cs @@ -93,10 +93,7 @@ sealed partial class Reader _read16 = !_dev.Read16(out _, out senseBuf, 0, false, false, false, lba, LogicalBlockSize, 0, 1, false, _timeout, out _); - if(_read6 || - _read10 || - _read12 || - _read16) + if(_read6 || _read10 || _read12 || _read16) break; lba = (uint)rnd.Next(1, (int)Blocks); @@ -131,9 +128,8 @@ sealed partial class Reader } case true when !_read10 && !_read12 && !_read16 && Blocks > 0x001FFFFF + 1: ErrorMessage = - string.Format( - Localization.Core.Device_only_supports_SCSI_READ_6_but_has_more_than_0_blocks_1_blocks_total, - 0x001FFFFF + 1, Blocks); + string.Format(Localization.Core.Device_only_supports_SCSI_READ_6_but_has_more_than_0_blocks_1_blocks_total, + 0x001FFFFF + 1, Blocks); return true; } @@ -144,13 +140,11 @@ sealed partial class Reader if(_read10) _read12 = false; - if(!_read16 && - Blocks > 0xFFFFFFFF + (long)1) + if(!_read16 && Blocks > 0xFFFFFFFF + (long)1) { ErrorMessage = - string.Format( - Localization.Core.Device_only_supports_SCSI_READ_10_but_has_more_than_0_blocks_1_blocks_total, - 0xFFFFFFFF + (long)1, Blocks); + string.Format(Localization.Core.Device_only_supports_SCSI_READ_10_but_has_more_than_0_blocks_1_blocks_total, + 0xFFFFFFFF + (long)1, Blocks); return true; } @@ -234,21 +228,20 @@ sealed partial class Reader case 512: { foreach(ushort testSize in new ushort[] - { - // Long sector sizes for floppies - 514, + { + // Long sector sizes for floppies + 514, - // Long sector sizes for SuperDisk - 536, 558, + // Long sector sizes for SuperDisk + 536, 558, - // Long sector sizes for 512-byte magneto-opticals - 600, 610, 630 - }) + // Long sector sizes for 512-byte magneto-opticals + 600, 610, 630 + }) { testSense = _dev.ReadLong16(out _, out senseBuf, false, 0, testSize, _timeout, out _); - if(!testSense && - !_dev.Error) + if(!testSense && !_dev.Error) { _readLong16 = true; LongBlockSize = testSize; @@ -275,18 +268,17 @@ sealed partial class Reader case 1024: { foreach(ushort testSize in new ushort[] - { - // Long sector sizes for floppies - 1026, + { + // Long sector sizes for floppies + 1026, - // Long sector sizes for 1024-byte magneto-opticals - 1200 - }) + // Long sector sizes for 1024-byte magneto-opticals + 1200 + }) { testSense = _dev.ReadLong16(out _, out senseBuf, false, 0, testSize, _timeout, out _); - if(!testSense && - !_dev.Error) + if(!testSense && !_dev.Error) { _readLong16 = true; LongBlockSize = testSize; @@ -314,8 +306,7 @@ sealed partial class Reader { testSense = _dev.ReadLong16(out _, out senseBuf, false, 0, 2380, _timeout, out _); - if(!testSense && - !_dev.Error) + if(!testSense && !_dev.Error) { _readLong16 = true; LongBlockSize = 2380; @@ -326,8 +317,7 @@ sealed partial class Reader testSense = _dev.ReadLong10(out _, out senseBuf, false, false, 0, 2380, _timeout, out _); - if(!testSense && - !_dev.Error) + if(!testSense && !_dev.Error) { _readLong10 = true; LongBlockSize = 2380; @@ -341,8 +331,7 @@ sealed partial class Reader { testSense = _dev.ReadLong16(out _, out senseBuf, false, 0, 4760, _timeout, out _); - if(!testSense && - !_dev.Error) + if(!testSense && !_dev.Error) { _readLong16 = true; LongBlockSize = 4760; @@ -353,8 +342,7 @@ sealed partial class Reader testSense = _dev.ReadLong10(out _, out senseBuf, false, false, 0, 4760, _timeout, out _); - if(!testSense && - !_dev.Error) + if(!testSense && !_dev.Error) { _readLong10 = true; LongBlockSize = 4760; @@ -368,8 +356,7 @@ sealed partial class Reader { testSense = _dev.ReadLong16(out _, out senseBuf, false, 0, 9424, _timeout, out _); - if(!testSense && - !_dev.Error) + if(!testSense && !_dev.Error) { _readLong16 = true; LongBlockSize = 9424; @@ -380,8 +367,7 @@ sealed partial class Reader testSense = _dev.ReadLong10(out _, out senseBuf, false, false, 0, 9424, _timeout, out _); - if(!testSense && - !_dev.Error) + if(!testSense && !_dev.Error) { _readLong10 = true; LongBlockSize = 9424; @@ -394,8 +380,7 @@ sealed partial class Reader } } - if(!CanReadRaw && - _dev.Manufacturer == "SYQUEST") + if(!CanReadRaw && _dev.Manufacturer == "SYQUEST") { testSense = _dev.SyQuestReadLong10(out _, out senseBuf, 0, 0xFFFF, _timeout, out _); @@ -475,13 +460,11 @@ sealed partial class Reader } } - if(!CanReadRaw && - LogicalBlockSize == 256) + if(!CanReadRaw && LogicalBlockSize == 256) { testSense = _dev.SyQuestReadLong6(out _, out senseBuf, 0, 262, _timeout, out _); - if(!testSense && - !_dev.Error) + if(!testSense && !_dev.Error) { _syqReadLong6 = true; LongBlockSize = 262; @@ -511,13 +494,11 @@ sealed partial class Reader } // READ LONG (10) for some DVD drives - if(!CanReadRaw && - _dev.Manufacturer == "MATSHITA") + if(!CanReadRaw && _dev.Manufacturer == "MATSHITA") { testSense = _dev.ReadLong10(out _, out senseBuf, false, false, 0, 37856, _timeout, out _); - if(!testSense && - !_dev.Error) + if(!testSense && !_dev.Error) { _readLongDvd = true; LongBlockSize = 37856; @@ -635,8 +616,7 @@ sealed partial class Reader BlocksToRead /= 2; } - if(!_dev.Error || - BlocksToRead == 1) + if(!_dev.Error || BlocksToRead == 1) break; } @@ -730,8 +710,7 @@ sealed partial class Reader if(sense || _dev.Error) _errorLog?.WriteLine(block, _dev.Error, _dev.LastError, senseBuf); - if(!sense && - !_dev.Error) + if(!sense && !_dev.Error) return false; recoveredError = Sense.Decode(senseBuf)?.SenseKey == SenseKeys.RecoveredError; diff --git a/Aaru.Core/Devices/Report/ATA.cs b/Aaru.Core/Devices/Report/ATA.cs index cfa1451e1..834e68ec1 100644 --- a/Aaru.Core/Devices/Report/ATA.cs +++ b/Aaru.Core/Devices/Report/ATA.cs @@ -79,8 +79,7 @@ public sealed partial class DeviceReport if(ataId.UnformattedBPS != 0) mediaTest.UnformattedBPS = ataId.UnformattedBPS; - if(ataId.Cylinders > 0 && - ataId is { Heads: > 0, SectorsPerTrack: > 0 }) + if(ataId.Cylinders > 0 && ataId is { Heads: > 0, SectorsPerTrack: > 0 }) { mediaTest.CHS = new Chs { @@ -92,8 +91,7 @@ public sealed partial class DeviceReport mediaTest.Blocks = (ulong)(ataId.Cylinders * ataId.Heads * ataId.SectorsPerTrack); } - if(ataId.CurrentCylinders > 0 && - ataId is { CurrentHeads: > 0, CurrentSectorsPerTrack: > 0 }) + if(ataId.CurrentCylinders > 0 && ataId is { CurrentHeads: > 0, CurrentSectorsPerTrack: > 0 }) { mediaTest.CurrentCHS = new Chs { @@ -121,8 +119,7 @@ public sealed partial class DeviceReport mediaTest.Blocks = ataId.LBA48Sectors; } - if(ataId.NominalRotationRate != 0x0000 && - ataId.NominalRotationRate != 0xFFFF) + if(ataId.NominalRotationRate != 0x0000 && ataId.NominalRotationRate != 0xFFFF) { if(ataId.NominalRotationRate == 0x0001) mediaTest.SolidStateDevice = true; @@ -136,13 +133,11 @@ public sealed partial class DeviceReport uint logicalSectorSize; uint physicalSectorSize; - if((ataId.PhysLogSectorSize & 0x8000) == 0x0000 && - (ataId.PhysLogSectorSize & 0x4000) == 0x4000) + if((ataId.PhysLogSectorSize & 0x8000) == 0x0000 && (ataId.PhysLogSectorSize & 0x4000) == 0x4000) { if((ataId.PhysLogSectorSize & 0x1000) == 0x1000) { - if(ataId.LogicalSectorWords <= 255 || - ataId.LogicalAlignment == 0xFFFF) + if(ataId.LogicalSectorWords <= 255 || ataId.LogicalAlignment == 0xFFFF) logicalSectorSize = 512; else logicalSectorSize = ataId.LogicalSectorWords * 2; @@ -167,13 +162,11 @@ public sealed partial class DeviceReport { mediaTest.PhysicalBlockSize = physicalSectorSize; - if((ataId.LogicalAlignment & 0x8000) == 0x0000 && - (ataId.LogicalAlignment & 0x4000) == 0x4000) + if((ataId.LogicalAlignment & 0x8000) == 0x0000 && (ataId.LogicalAlignment & 0x4000) == 0x4000) mediaTest.LogicalAlignment = (ushort)(ataId.LogicalAlignment & 0x3FFF); } - if(ataId.EccBytes != 0x0000 && - ataId.EccBytes != 0xFFFF) + if(ataId.EccBytes != 0x0000 && ataId.EccBytes != 0xFFFF) mediaTest.LongBlockSize = logicalSectorSize + ataId.EccBytes; if(ataId.UnformattedBPS > logicalSectorSize && @@ -198,8 +191,8 @@ public sealed partial class DeviceReport sense = _dev.Read(out readBuf, out errorChs, false, 0, 0, 1, 1, _dev.Timeout, out _); }); - mediaTest.SupportsReadSectors = !sense && (errorChs.Status & 0x01) != 0x01 && errorChs.Error == 0 && - readBuf.Length > 0; + mediaTest.SupportsReadSectors = + !sense && (errorChs.Status & 0x01) != 0x01 && errorChs.Error == 0 && readBuf.Length > 0; AaruConsole.DebugWriteLine(ATA_MODULE_NAME, Localization.Core.Sense_0_Status_1_Error_2_Length_3, sense, errorChs.Status, errorChs.Error, readBuf.Length); @@ -212,8 +205,8 @@ public sealed partial class DeviceReport sense = _dev.Read(out readBuf, out errorChs, true, 0, 0, 1, 1, _dev.Timeout, out _); }); - mediaTest.SupportsReadRetry = !sense && (errorChs.Status & 0x01) != 0x01 && errorChs.Error == 0 && - readBuf.Length > 0; + mediaTest.SupportsReadRetry = + !sense && (errorChs.Status & 0x01) != 0x01 && errorChs.Error == 0 && readBuf.Length > 0; AaruConsole.DebugWriteLine(ATA_MODULE_NAME, Localization.Core.Sense_0_Status_1_Error_2_Length_3, sense, errorChs.Status, errorChs.Error, readBuf.Length); @@ -226,8 +219,8 @@ public sealed partial class DeviceReport sense = _dev.ReadDma(out readBuf, out errorChs, false, 0, 0, 1, 1, _dev.Timeout, out _); }); - mediaTest.SupportsReadDma = !sense && (errorChs.Status & 0x01) != 0x01 && errorChs.Error == 0 && - readBuf.Length > 0; + mediaTest.SupportsReadDma = + !sense && (errorChs.Status & 0x01) != 0x01 && errorChs.Error == 0 && readBuf.Length > 0; AaruConsole.DebugWriteLine(ATA_MODULE_NAME, Localization.Core.Sense_0_Status_1_Error_2_Length_3, sense, errorChs.Status, errorChs.Error, readBuf.Length); @@ -240,8 +233,8 @@ public sealed partial class DeviceReport sense = _dev.ReadDma(out readBuf, out errorChs, true, 0, 0, 1, 1, _dev.Timeout, out _); }); - mediaTest.SupportsReadDmaRetry = !sense && (errorChs.Status & 0x01) != 0x01 && errorChs.Error == 0 && - readBuf.Length > 0; + mediaTest.SupportsReadDmaRetry = + !sense && (errorChs.Status & 0x01) != 0x01 && errorChs.Error == 0 && readBuf.Length > 0; AaruConsole.DebugWriteLine(ATA_MODULE_NAME, Localization.Core.Sense_0_Status_1_Error_2_Length_3, sense, errorChs.Status, errorChs.Error, readBuf.Length); @@ -257,8 +250,7 @@ public sealed partial class DeviceReport mediaTest.SupportsSeek = !sense && (errorChs.Status & 0x01) != 0x01 && errorChs.Error == 0; AaruConsole.DebugWriteLine(ATA_MODULE_NAME, Localization.Core.Sense_0_Status_1_Error_2, sense, - errorChs.Status, - errorChs.Error); + errorChs.Status, errorChs.Error); Spectre.ProgressSingleSpinner(ctx => { @@ -266,8 +258,8 @@ public sealed partial class DeviceReport sense = _dev.Read(out readBuf, out errorLba, false, 0, 1, _dev.Timeout, out _); }); - mediaTest.SupportsReadLba = !sense && (errorLba.Status & 0x01) != 0x01 && errorLba.Error == 0 && - readBuf.Length > 0; + mediaTest.SupportsReadLba = + !sense && (errorLba.Status & 0x01) != 0x01 && errorLba.Error == 0 && readBuf.Length > 0; AaruConsole.DebugWriteLine(ATA_MODULE_NAME, Localization.Core.Sense_0_Status_1_Error_2_Length_3, sense, errorChs.Status, errorChs.Error, readBuf.Length); @@ -280,8 +272,8 @@ public sealed partial class DeviceReport sense = _dev.Read(out readBuf, out errorLba, true, 0, 1, _dev.Timeout, out _); }); - mediaTest.SupportsReadRetryLba = !sense && (errorLba.Status & 0x01) != 0x01 && errorLba.Error == 0 && - readBuf.Length > 0; + mediaTest.SupportsReadRetryLba = + !sense && (errorLba.Status & 0x01) != 0x01 && errorLba.Error == 0 && readBuf.Length > 0; AaruConsole.DebugWriteLine(ATA_MODULE_NAME, Localization.Core.Sense_0_Status_1_Error_2_Length_3, sense, errorChs.Status, errorChs.Error, readBuf.Length); @@ -294,8 +286,8 @@ public sealed partial class DeviceReport sense = _dev.ReadDma(out readBuf, out errorLba, false, 0, 1, _dev.Timeout, out _); }); - mediaTest.SupportsReadDmaLba = !sense && (errorLba.Status & 0x01) != 0x01 && errorLba.Error == 0 && - readBuf.Length > 0; + mediaTest.SupportsReadDmaLba = + !sense && (errorLba.Status & 0x01) != 0x01 && errorLba.Error == 0 && readBuf.Length > 0; AaruConsole.DebugWriteLine(ATA_MODULE_NAME, Localization.Core.Sense_0_Status_1_Error_2_Length_3, sense, errorChs.Status, errorChs.Error, readBuf.Length); @@ -308,8 +300,8 @@ public sealed partial class DeviceReport sense = _dev.ReadDma(out readBuf, out errorLba, true, 0, 1, _dev.Timeout, out _); }); - mediaTest.SupportsReadDmaRetryLba = !sense && (errorLba.Status & 0x01) != 0x01 && errorLba.Error == 0 && - readBuf.Length > 0; + mediaTest.SupportsReadDmaRetryLba = + !sense && (errorLba.Status & 0x01) != 0x01 && errorLba.Error == 0 && readBuf.Length > 0; AaruConsole.DebugWriteLine(ATA_MODULE_NAME, Localization.Core.Sense_0_Status_1_Error_2_Length_3, sense, errorChs.Status, errorChs.Error, readBuf.Length); @@ -325,8 +317,7 @@ public sealed partial class DeviceReport mediaTest.SupportsSeekLba = !sense && (errorLba.Status & 0x01) != 0x01 && errorLba.Error == 0; AaruConsole.DebugWriteLine(ATA_MODULE_NAME, Localization.Core.Sense_0_Status_1_Error_2, sense, - errorChs.Status, - errorChs.Error); + errorChs.Status, errorChs.Error); Spectre.ProgressSingleSpinner(ctx => { @@ -334,8 +325,8 @@ public sealed partial class DeviceReport sense = _dev.Read(out readBuf, out AtaErrorRegistersLba28 _, 0, 1, _dev.Timeout, out _); }); - mediaTest.SupportsReadLba48 = !sense && (errorLba48.Status & 0x01) != 0x01 && errorLba48.Error == 0 && - readBuf.Length > 0; + mediaTest.SupportsReadLba48 = + !sense && (errorLba48.Status & 0x01) != 0x01 && errorLba48.Error == 0 && readBuf.Length > 0; AaruConsole.DebugWriteLine(ATA_MODULE_NAME, Localization.Core.Sense_0_Status_1_Error_2_Length_3, sense, errorChs.Status, errorChs.Error, readBuf.Length); @@ -348,8 +339,8 @@ public sealed partial class DeviceReport sense = _dev.ReadDma(out readBuf, out errorLba48, 0, 1, _dev.Timeout, out _); }); - mediaTest.SupportsReadDmaLba48 = !sense && (errorLba48.Status & 0x01) != 0x01 && errorLba48.Error == 0 && - readBuf.Length > 0; + mediaTest.SupportsReadDmaLba48 = + !sense && (errorLba48.Status & 0x01) != 0x01 && errorLba48.Error == 0 && readBuf.Length > 0; AaruConsole.DebugWriteLine(ATA_MODULE_NAME, Localization.Core.Sense_0_Status_1_Error_2_Length_3, sense, errorChs.Status, errorChs.Error, readBuf.Length); @@ -367,8 +358,7 @@ public sealed partial class DeviceReport { ataId = Identify.Decode(buffer).Value; - if(ataId.EccBytes != 0x0000 && - ataId.EccBytes != 0xFFFF) + if(ataId.EccBytes != 0x0000 && ataId.EccBytes != 0xFFFF) mediaTest.LongBlockSize = logicalSectorSize + ataId.EccBytes; if(ataId.UnformattedBPS > logicalSectorSize && @@ -384,8 +374,11 @@ public sealed partial class DeviceReport _dev.Timeout, out _); }); - mediaTest.SupportsReadLong = !sense && (errorChs.Status & 0x01) != 0x01 && errorChs.Error == 0 && - readBuf.Length > 0 && BitConverter.ToUInt64(readBuf, 0) != checkCorrectRead; + mediaTest.SupportsReadLong = !sense && + (errorChs.Status & 0x01) != 0x01 && + errorChs.Error == 0 && + readBuf.Length > 0 && + BitConverter.ToUInt64(readBuf, 0) != checkCorrectRead; AaruConsole.DebugWriteLine(ATA_MODULE_NAME, Localization.Core.Sense_0_Status_1_Error_2_Length_3, sense, errorChs.Status, errorChs.Error, readBuf.Length); @@ -400,9 +393,11 @@ public sealed partial class DeviceReport _dev.Timeout, out _); }); - mediaTest.SupportsReadLongRetry = !sense && (errorChs.Status & 0x01) != 0x01 && errorChs.Error == 0 && - readBuf.Length > 0 && BitConverter.ToUInt64(readBuf, 0) != - checkCorrectRead; + mediaTest.SupportsReadLongRetry = !sense && + (errorChs.Status & 0x01) != 0x01 && + errorChs.Error == 0 && + readBuf.Length > 0 && + BitConverter.ToUInt64(readBuf, 0) != checkCorrectRead; AaruConsole.DebugWriteLine(ATA_MODULE_NAME, Localization.Core.Sense_0_Status_1_Error_2_Length_3, sense, errorChs.Status, errorChs.Error, readBuf.Length); @@ -417,8 +412,11 @@ public sealed partial class DeviceReport out _); }); - mediaTest.SupportsReadLongLba = !sense && (errorLba.Status & 0x01) != 0x01 && errorLba.Error == 0 && - readBuf.Length > 0 && BitConverter.ToUInt64(readBuf, 0) != checkCorrectRead; + mediaTest.SupportsReadLongLba = !sense && + (errorLba.Status & 0x01) != 0x01 && + errorLba.Error == 0 && + readBuf.Length > 0 && + BitConverter.ToUInt64(readBuf, 0) != checkCorrectRead; AaruConsole.DebugWriteLine(ATA_MODULE_NAME, Localization.Core.Sense_0_Status_1_Error_2_Length_3, sense, errorChs.Status, errorChs.Error, readBuf.Length); @@ -433,9 +431,11 @@ public sealed partial class DeviceReport out _); }); - mediaTest.SupportsReadLongRetryLba = !sense && (errorLba.Status & 0x01) != 0x01 && errorLba.Error == 0 && - readBuf.Length > 0 && BitConverter.ToUInt64(readBuf, 0) != - checkCorrectRead; + mediaTest.SupportsReadLongRetryLba = !sense && + (errorLba.Status & 0x01) != 0x01 && + errorLba.Error == 0 && + readBuf.Length > 0 && + BitConverter.ToUInt64(readBuf, 0) != checkCorrectRead; AaruConsole.DebugWriteLine(ATA_MODULE_NAME, Localization.Core.Sense_0_Status_1_Error_2_Length_3, sense, errorChs.Status, errorChs.Error, readBuf.Length); @@ -464,8 +464,7 @@ public sealed partial class DeviceReport if(ataId.UnformattedBPS != 0) capabilities.UnformattedBPS = ataId.UnformattedBPS; - if(ataId.Cylinders > 0 && - ataId is { Heads: > 0, SectorsPerTrack: > 0 }) + if(ataId.Cylinders > 0 && ataId is { Heads: > 0, SectorsPerTrack: > 0 }) { capabilities.CHS = new Chs { @@ -477,8 +476,7 @@ public sealed partial class DeviceReport capabilities.Blocks = (ulong)(ataId.Cylinders * ataId.Heads * ataId.SectorsPerTrack); } - if(ataId.CurrentCylinders > 0 && - ataId is { CurrentHeads: > 0, CurrentSectorsPerTrack: > 0 }) + if(ataId.CurrentCylinders > 0 && ataId is { CurrentHeads: > 0, CurrentSectorsPerTrack: > 0 }) { capabilities.CurrentCHS = new Chs { @@ -502,8 +500,7 @@ public sealed partial class DeviceReport capabilities.Blocks = ataId.LBA48Sectors; } - if(ataId.NominalRotationRate != 0x0000 && - ataId.NominalRotationRate != 0xFFFF) + if(ataId.NominalRotationRate != 0x0000 && ataId.NominalRotationRate != 0xFFFF) { if(ataId.NominalRotationRate == 0x0001) capabilities.SolidStateDevice = true; @@ -517,13 +514,11 @@ public sealed partial class DeviceReport uint logicalSectorSize; uint physicalSectorSize; - if((ataId.PhysLogSectorSize & 0x8000) == 0x0000 && - (ataId.PhysLogSectorSize & 0x4000) == 0x4000) + if((ataId.PhysLogSectorSize & 0x8000) == 0x0000 && (ataId.PhysLogSectorSize & 0x4000) == 0x4000) { if((ataId.PhysLogSectorSize & 0x1000) == 0x1000) { - if(ataId.LogicalSectorWords <= 255 || - ataId.LogicalAlignment == 0xFFFF) + if(ataId.LogicalSectorWords <= 255 || ataId.LogicalAlignment == 0xFFFF) logicalSectorSize = 512; else logicalSectorSize = ataId.LogicalSectorWords * 2; @@ -548,13 +543,11 @@ public sealed partial class DeviceReport { capabilities.PhysicalBlockSize = physicalSectorSize; - if((ataId.LogicalAlignment & 0x8000) == 0x0000 && - (ataId.LogicalAlignment & 0x4000) == 0x4000) + if((ataId.LogicalAlignment & 0x8000) == 0x0000 && (ataId.LogicalAlignment & 0x4000) == 0x4000) capabilities.LogicalAlignment = (ushort)(ataId.LogicalAlignment & 0x3FFF); } - if(ataId.EccBytes != 0x0000 && - ataId.EccBytes != 0xFFFF) + if(ataId.EccBytes != 0x0000 && ataId.EccBytes != 0xFFFF) capabilities.LongBlockSize = logicalSectorSize + ataId.EccBytes; if(ataId.UnformattedBPS > logicalSectorSize && @@ -579,8 +572,8 @@ public sealed partial class DeviceReport sense = _dev.Read(out readBuf, out errorChs, false, 0, 0, 1, 1, _dev.Timeout, out _); }); - capabilities.SupportsReadSectors = !sense && (errorChs.Status & 0x01) != 0x01 && errorChs.Error == 0 && - readBuf.Length > 0; + capabilities.SupportsReadSectors = + !sense && (errorChs.Status & 0x01) != 0x01 && errorChs.Error == 0 && readBuf.Length > 0; AaruConsole.DebugWriteLine(ATA_MODULE_NAME, Localization.Core.Sense_0_Status_1_Error_2_Length_3, sense, errorChs.Status, errorChs.Error, readBuf.Length); @@ -621,8 +614,8 @@ public sealed partial class DeviceReport sense = _dev.ReadDma(out readBuf, out errorChs, true, 0, 0, 1, 1, _dev.Timeout, out _); }); - capabilities.SupportsReadDmaRetry = !sense && (errorChs.Status & 0x01) != 0x01 && errorChs.Error == 0 && - readBuf.Length > 0; + capabilities.SupportsReadDmaRetry = + !sense && (errorChs.Status & 0x01) != 0x01 && errorChs.Error == 0 && readBuf.Length > 0; AaruConsole.DebugWriteLine(ATA_MODULE_NAME, Localization.Core.Sense_0_Status_1_Error_2_Length_3, sense, errorChs.Status, errorChs.Error, readBuf.Length); @@ -660,8 +653,8 @@ public sealed partial class DeviceReport sense = _dev.Read(out readBuf, out errorLba, true, 0, 1, _dev.Timeout, out _); }); - capabilities.SupportsReadRetryLba = !sense && (errorLba.Status & 0x01) != 0x01 && errorLba.Error == 0 && - readBuf.Length > 0; + capabilities.SupportsReadRetryLba = + !sense && (errorLba.Status & 0x01) != 0x01 && errorLba.Error == 0 && readBuf.Length > 0; AaruConsole.DebugWriteLine(ATA_MODULE_NAME, Localization.Core.Sense_0_Status_1_Error_2_Length_3, sense, errorLba.Status, errorLba.Error, readBuf.Length); @@ -674,8 +667,8 @@ public sealed partial class DeviceReport sense = _dev.ReadDma(out readBuf, out errorLba, false, 0, 1, _dev.Timeout, out _); }); - capabilities.SupportsReadDmaLba = !sense && (errorLba.Status & 0x01) != 0x01 && errorLba.Error == 0 && - readBuf.Length > 0; + capabilities.SupportsReadDmaLba = + !sense && (errorLba.Status & 0x01) != 0x01 && errorLba.Error == 0 && readBuf.Length > 0; AaruConsole.DebugWriteLine(ATA_MODULE_NAME, Localization.Core.Sense_0_Status_1_Error_2_Length_3, sense, errorLba.Status, errorLba.Error, readBuf.Length); @@ -713,8 +706,8 @@ public sealed partial class DeviceReport sense = _dev.Read(out readBuf, out errorLba48, 0, 1, _dev.Timeout, out _); }); - capabilities.SupportsReadLba48 = !sense && (errorLba48.Status & 0x01) != 0x01 && errorLba48.Error == 0 && - readBuf.Length > 0; + capabilities.SupportsReadLba48 = + !sense && (errorLba48.Status & 0x01) != 0x01 && errorLba48.Error == 0 && readBuf.Length > 0; AaruConsole.DebugWriteLine(ATA_MODULE_NAME, Localization.Core.Sense_0_Status_1_Error_2_Length_3, sense, errorLba48.Status, errorLba48.Error, readBuf.Length); @@ -727,8 +720,8 @@ public sealed partial class DeviceReport sense = _dev.ReadDma(out readBuf, out errorLba48, 0, 1, _dev.Timeout, out _); }); - capabilities.SupportsReadDmaLba48 = !sense && (errorLba48.Status & 0x01) != 0x01 && errorLba48.Error == 0 && - readBuf.Length > 0; + capabilities.SupportsReadDmaLba48 = + !sense && (errorLba48.Status & 0x01) != 0x01 && errorLba48.Error == 0 && readBuf.Length > 0; AaruConsole.DebugWriteLine(ATA_MODULE_NAME, Localization.Core.Sense_0_Status_1_Error_2_Length_3, sense, errorLba48.Status, errorLba48.Error, readBuf.Length); @@ -746,8 +739,7 @@ public sealed partial class DeviceReport { ataId = Identify.Decode(buffer).Value; - if(ataId.EccBytes != 0x0000 && - ataId.EccBytes != 0xFFFF) + if(ataId.EccBytes != 0x0000 && ataId.EccBytes != 0xFFFF) capabilities.LongBlockSize = logicalSectorSize + ataId.EccBytes; if(ataId.UnformattedBPS > logicalSectorSize && @@ -763,8 +755,11 @@ public sealed partial class DeviceReport _dev.Timeout, out _); }); - capabilities.SupportsReadLong = !sense && (errorChs.Status & 0x01) != 0x01 && errorChs.Error == 0 && - readBuf.Length > 0 && BitConverter.ToUInt64(readBuf, 0) != checkCorrectRead; + capabilities.SupportsReadLong = !sense && + (errorChs.Status & 0x01) != 0x01 && + errorChs.Error == 0 && + readBuf.Length > 0 && + BitConverter.ToUInt64(readBuf, 0) != checkCorrectRead; AaruConsole.DebugWriteLine(ATA_MODULE_NAME, Localization.Core.Sense_0_Status_1_Error_2_Length_3, sense, errorChs.Status, errorChs.Error, readBuf.Length); @@ -779,9 +774,11 @@ public sealed partial class DeviceReport _dev.Timeout, out _); }); - capabilities.SupportsReadLongRetry = !sense && (errorChs.Status & 0x01) != 0x01 && errorChs.Error == 0 && - readBuf.Length > 0 && - BitConverter.ToUInt64(readBuf, 0) != checkCorrectRead; + capabilities.SupportsReadLongRetry = !sense && + (errorChs.Status & 0x01) != 0x01 && + errorChs.Error == 0 && + readBuf.Length > 0 && + BitConverter.ToUInt64(readBuf, 0) != checkCorrectRead; AaruConsole.DebugWriteLine(ATA_MODULE_NAME, Localization.Core.Sense_0_Status_1_Error_2_Length_3, sense, errorChs.Status, errorChs.Error, readBuf.Length); @@ -796,8 +793,11 @@ public sealed partial class DeviceReport out _); }); - capabilities.SupportsReadLongLba = !sense && (errorLba.Status & 0x01) != 0x01 && errorLba.Error == 0 && - readBuf.Length > 0 && BitConverter.ToUInt64(readBuf, 0) != checkCorrectRead; + capabilities.SupportsReadLongLba = !sense && + (errorLba.Status & 0x01) != 0x01 && + errorLba.Error == 0 && + readBuf.Length > 0 && + BitConverter.ToUInt64(readBuf, 0) != checkCorrectRead; AaruConsole.DebugWriteLine(ATA_MODULE_NAME, Localization.Core.Sense_0_Status_1_Error_2_Length_3, sense, errorLba.Status, errorLba.Error, readBuf.Length); @@ -812,9 +812,11 @@ public sealed partial class DeviceReport out _); }); - capabilities.SupportsReadLongRetryLba = !sense && (errorLba.Status & 0x01) != 0x01 && errorLba.Error == 0 && - readBuf.Length > 0 && BitConverter.ToUInt64(readBuf, 0) != - checkCorrectRead; + capabilities.SupportsReadLongRetryLba = !sense && + (errorLba.Status & 0x01) != 0x01 && + errorLba.Error == 0 && + readBuf.Length > 0 && + BitConverter.ToUInt64(readBuf, 0) != checkCorrectRead; AaruConsole.DebugWriteLine(ATA_MODULE_NAME, Localization.Core.Sense_0_Status_1_Error_2_Length_3, sense, errorLba.Status, errorLba.Error, readBuf.Length); diff --git a/Aaru.Core/Devices/Report/GdRomSwapTrick.cs b/Aaru.Core/Devices/Report/GdRomSwapTrick.cs index c27a78a78..6717f0283 100644 --- a/Aaru.Core/Devices/Report/GdRomSwapTrick.cs +++ b/Aaru.Core/Devices/Report/GdRomSwapTrick.cs @@ -53,8 +53,7 @@ public sealed partial class DeviceReport var pressedKey = new ConsoleKeyInfo(); - while(pressedKey.Key != ConsoleKey.Y && - pressedKey.Key != ConsoleKey.N) + while(pressedKey.Key != ConsoleKey.Y && pressedKey.Key != ConsoleKey.N) { AaruConsole.Write(Localization.Core. Have_you_previously_tried_with_a_GD_ROM_disc_and_did_the_computer_hang_or_crash_Q); @@ -256,8 +255,7 @@ public sealed partial class DeviceReport return; } - if(newLeadOutTrack.PMIN >= 0xA0 && - !tocIsNotBcd) + if(newLeadOutTrack.PMIN >= 0xA0 && !tocIsNotBcd) newLeadOutTrack.PMIN -= 0x90; if(newLeadOutTrack.PMIN != leadOutTrack.PMIN || @@ -1112,14 +1110,14 @@ public sealed partial class DeviceReport while(true) { report.GdRomSwapDiscCapabilities.Lba100000PqReadable = !_dev.ReadCd(out byte[] lba100000PqBuffer, - out byte[] lba100000PqSenseBuffer, - 100000, 2368, cluster, - MmcSectorTypes.AllTypes, false, - false, true, - MmcHeaderCodes.AllHeaders, true, - true, MmcErrorField.None, - MmcSubchannel.Q16, _dev.Timeout, - out _); + out byte[] lba100000PqSenseBuffer, + 100000, 2368, cluster, + MmcSectorTypes.AllTypes, false, + false, true, + MmcHeaderCodes.AllHeaders, true, + true, MmcErrorField.None, + MmcSubchannel.Q16, _dev.Timeout, + out _); report.GdRomSwapDiscCapabilities.Lba100000PqData = lba100000PqBuffer; report.GdRomSwapDiscCapabilities.Lba100000PqSense = lba100000PqSenseBuffer; @@ -1176,14 +1174,14 @@ public sealed partial class DeviceReport while(true) { report.GdRomSwapDiscCapabilities.Lba450000PqReadable = !_dev.ReadCd(out byte[] lba450000PqBuffer, - out byte[] lba450000PqSenseBuffer, - 450000, 2368, cluster, - MmcSectorTypes.AllTypes, false, - false, true, - MmcHeaderCodes.AllHeaders, true, - true, MmcErrorField.None, - MmcSubchannel.Q16, _dev.Timeout, - out _); + out byte[] lba450000PqSenseBuffer, + 450000, 2368, cluster, + MmcSectorTypes.AllTypes, false, + false, true, + MmcHeaderCodes.AllHeaders, true, + true, MmcErrorField.None, + MmcSubchannel.Q16, _dev.Timeout, + out _); report.GdRomSwapDiscCapabilities.Lba450000PqData = lba450000PqBuffer; report.GdRomSwapDiscCapabilities.Lba450000PqSense = lba450000PqSenseBuffer; @@ -1209,14 +1207,14 @@ public sealed partial class DeviceReport while(true) { report.GdRomSwapDiscCapabilities.Lba400000PqReadable = !_dev.ReadCd(out byte[] lba400000PqBuffer, - out byte[] lba400000PqSenseBuffer, - 400000, 2368, cluster, - MmcSectorTypes.AllTypes, false, - false, true, - MmcHeaderCodes.AllHeaders, true, - true, MmcErrorField.None, - MmcSubchannel.Q16, _dev.Timeout, - out _); + out byte[] lba400000PqSenseBuffer, + 400000, 2368, cluster, + MmcSectorTypes.AllTypes, false, + false, true, + MmcHeaderCodes.AllHeaders, true, + true, MmcErrorField.None, + MmcSubchannel.Q16, _dev.Timeout, + out _); report.GdRomSwapDiscCapabilities.Lba400000PqData = lba400000PqBuffer; report.GdRomSwapDiscCapabilities.Lba400000PqSense = lba400000PqSenseBuffer; @@ -1304,14 +1302,14 @@ public sealed partial class DeviceReport while(true) { report.GdRomSwapDiscCapabilities.Lba100000RwReadable = !_dev.ReadCd(out byte[] lba100000RwBuffer, - out byte[] lba100000RwSenseBuffer, - 100000, 2448, cluster, - MmcSectorTypes.AllTypes, false, - false, true, - MmcHeaderCodes.AllHeaders, true, - true, MmcErrorField.None, - MmcSubchannel.Raw, _dev.Timeout, - out _); + out byte[] lba100000RwSenseBuffer, + 100000, 2448, cluster, + MmcSectorTypes.AllTypes, false, + false, true, + MmcHeaderCodes.AllHeaders, true, + true, MmcErrorField.None, + MmcSubchannel.Raw, _dev.Timeout, + out _); report.GdRomSwapDiscCapabilities.Lba100000RwData = lba100000RwBuffer; report.GdRomSwapDiscCapabilities.Lba100000RwSense = lba100000RwSenseBuffer; @@ -1368,14 +1366,14 @@ public sealed partial class DeviceReport while(true) { report.GdRomSwapDiscCapabilities.Lba450000RwReadable = !_dev.ReadCd(out byte[] lba450000RwBuffer, - out byte[] lba450000RwSenseBuffer, - 450000, 2448, cluster, - MmcSectorTypes.AllTypes, false, - false, true, - MmcHeaderCodes.AllHeaders, true, - true, MmcErrorField.None, - MmcSubchannel.Raw, _dev.Timeout, - out _); + out byte[] lba450000RwSenseBuffer, + 450000, 2448, cluster, + MmcSectorTypes.AllTypes, false, + false, true, + MmcHeaderCodes.AllHeaders, true, + true, MmcErrorField.None, + MmcSubchannel.Raw, _dev.Timeout, + out _); report.GdRomSwapDiscCapabilities.Lba450000RwData = lba450000RwBuffer; report.GdRomSwapDiscCapabilities.Lba450000RwSense = lba450000RwSenseBuffer; @@ -1401,14 +1399,14 @@ public sealed partial class DeviceReport while(true) { report.GdRomSwapDiscCapabilities.Lba400000RwReadable = !_dev.ReadCd(out byte[] lba400000RwBuffer, - out byte[] lba400000RwSenseBuffer, - 400000, 2448, cluster, - MmcSectorTypes.AllTypes, false, - false, true, - MmcHeaderCodes.AllHeaders, true, - true, MmcErrorField.None, - MmcSubchannel.Raw, _dev.Timeout, - out _); + out byte[] lba400000RwSenseBuffer, + 400000, 2448, cluster, + MmcSectorTypes.AllTypes, false, + false, true, + MmcHeaderCodes.AllHeaders, true, + true, MmcErrorField.None, + MmcSubchannel.Raw, _dev.Timeout, + out _); report.GdRomSwapDiscCapabilities.Lba400000RwData = lba400000RwBuffer; report.GdRomSwapDiscCapabilities.Lba400000RwSense = lba400000RwSenseBuffer; @@ -1504,8 +1502,7 @@ public sealed partial class DeviceReport pressedKey = new ConsoleKeyInfo(); - while(pressedKey.Key != ConsoleKey.Y && - pressedKey.Key != ConsoleKey.N) + while(pressedKey.Key != ConsoleKey.Y && pressedKey.Key != ConsoleKey.N) { AaruConsole.Write(Localization.Core.Test_read_whole_high_density_area_proceed_Q); @@ -1676,11 +1673,9 @@ public sealed partial class DeviceReport ? _dev.ReadCd(out buffer, out senseBuffer, lba, blockSize, cluster, MmcSectorTypes.Cdda, false, false, false, MmcHeaderCodes.None, true, false, MmcErrorField.None, subchannel, _dev.Timeout, out _) - : _dev.ReadCd(out buffer, out senseBuffer, lba, blockSize, - cluster, MmcSectorTypes.AllTypes, false, false, - true, MmcHeaderCodes.AllHeaders, true, true, - MmcErrorField.None, subchannel, _dev.Timeout, - out _); + : _dev.ReadCd(out buffer, out senseBuffer, lba, blockSize, cluster, MmcSectorTypes.AllTypes, + false, false, true, MmcHeaderCodes.AllHeaders, true, true, MmcErrorField.None, + subchannel, _dev.Timeout, out _); if(sense) { diff --git a/Aaru.Core/Devices/Report/MMC.cs b/Aaru.Core/Devices/Report/MMC.cs index 64e86747f..6538f107e 100644 --- a/Aaru.Core/Devices/Report/MMC.cs +++ b/Aaru.Core/Devices/Report/MMC.cs @@ -602,13 +602,13 @@ public sealed partial class DeviceReport sense = _dev.ReadCapacity(out buffer, out senseBuffer, _dev.Timeout, out _); }); - if(!sense && - !_dev.Error) + if(!sense && !_dev.Error) { mediaTest.SupportsReadCapacity = true; mediaTest.Blocks = ((ulong)((buffer[0] << 24) + (buffer[1] << 16) + (buffer[2] << 8) + buffer[3]) & - 0xFFFFFFFF) + 1; + 0xFFFFFFFF) + + 1; mediaTest.BlockSize = (uint)((buffer[5] << 24) + (buffer[5] << 16) + (buffer[6] << 8) + buffer[7]); } @@ -619,8 +619,7 @@ public sealed partial class DeviceReport sense = _dev.ReadCapacity16(out buffer, out buffer, _dev.Timeout, out _); }); - if(!sense && - !_dev.Error) + if(!sense && !_dev.Error) { mediaTest.SupportsReadCapacity16 = true; var temp = new byte[8]; @@ -640,8 +639,7 @@ public sealed partial class DeviceReport 0x00, _dev.Timeout, out _); }); - if(!sense && - !_dev.Error) + if(!sense && !_dev.Error) { decMode = Modes.DecodeMode10(buffer, _dev.ScsiType); @@ -654,8 +652,7 @@ public sealed partial class DeviceReport sense = _dev.ModeSense(out buffer, out senseBuffer, _dev.Timeout, out _); }); - if(!sense && - !_dev.Error) + if(!sense && !_dev.Error) { decMode ??= Modes.DecodeMode6(buffer, _dev.ScsiType); @@ -906,8 +903,7 @@ public sealed partial class DeviceReport break; } - if(mediaType.StartsWith("BD-R", StringComparison.Ordinal) && - mediaType != "BD-ROM") + if(mediaType.StartsWith("BD-R", StringComparison.Ordinal) && mediaType != "BD-ROM") { Spectre.ProgressSingleSpinner(ctx => { @@ -984,8 +980,7 @@ public sealed partial class DeviceReport mediaTest.EmbossedPfiData = buffer; } - if(mediaType.StartsWith("DVD+R", StringComparison.Ordinal) || - mediaType == "DVD+MRW") + if(mediaType.StartsWith("DVD+R", StringComparison.Ordinal) || mediaType == "DVD+MRW") { Spectre.ProgressSingleSpinner(ctx => { @@ -1295,8 +1290,7 @@ public sealed partial class DeviceReport mediaTest.ReadCdMsfFullData = buffer; } - if(mediaTest.SupportsReadCdRaw == true || - mediaType == "Audio CD") + if(mediaTest.SupportsReadCdRaw == true || mediaType == "Audio CD") { Spectre.ProgressSingleSpinner(ctx => { @@ -1339,7 +1333,10 @@ public sealed partial class DeviceReport { ctx.AddTask(Localization.Core.Trying_to_read_CD_Lead_In).IsIndeterminate(); - foreach(int i in new[] { -5000, -4000, -3000, -2000, -1000, -500, -250 }) + foreach(int i in new[] + { + -5000, -4000, -3000, -2000, -1000, -500, -250 + }) { if(mediaType == "Audio CD") { @@ -1960,14 +1957,12 @@ public sealed partial class DeviceReport } } - if(mediaTest.SupportsReadLong == true && - mediaTest.LongBlockSize == mediaTest.BlockSize) + if(mediaTest.SupportsReadLong == true && mediaTest.LongBlockSize == mediaTest.BlockSize) { // DVDs sense = _dev.ReadLong10(out buffer, out senseBuffer, false, false, 16, 37856, _dev.Timeout, out _); - if(!sense && - !_dev.Error) + if(!sense && !_dev.Error) { mediaTest.ReadLong10Data = buffer; mediaTest.SupportsReadLong = true; @@ -2024,8 +2019,7 @@ public sealed partial class DeviceReport { ctx.AddTask(Localization.Core.Trying_MediaTek_READ_DRAM_command).IsIndeterminate(); - if(mediaType == "Audio CD" && - mediaTest.SupportsReadCd == true) + if(mediaType == "Audio CD" && mediaTest.SupportsReadCd == true) { _dev.ReadCd(out _, out _, 0, 2352, 1, MmcSectorTypes.Cdda, false, false, false, MmcHeaderCodes.None, true, false, MmcErrorField.None, MmcSubchannel.None, _dev.Timeout, out _); @@ -2092,8 +2086,7 @@ public sealed partial class DeviceReport if(!(mediaTest.Blocks > 0)) return; - if(mediaType == "Audio CD" && - mediaTest.SupportsReadCd == true) + if(mediaType == "Audio CD" && mediaTest.SupportsReadCd == true) { _dev.ReadCd(out _, out _, (uint)(mediaTest.Blocks + 1), 2352, 1, MmcSectorTypes.Cdda, false, false, false, MmcHeaderCodes.None, true, false, MmcErrorField.None, MmcSubchannel.None, @@ -2207,8 +2200,7 @@ public sealed partial class DeviceReport FullTOC.TrackDataDescriptor secondSessionFirstTrack = decodedToc.TrackDescriptors.FirstOrDefault(t => t is { SessionNumber: > 1, POINT: <= 99 }); - if(firstSessionLeadOutTrack.SessionNumber == 0 || - secondSessionFirstTrack.SessionNumber == 0) + if(firstSessionLeadOutTrack.SessionNumber == 0 || secondSessionFirstTrack.SessionNumber == 0) { AaruConsole.ErrorWriteLine(Localization.Core. Could_not_find_second_session_Have_you_inserted_the_correct_type_of_disc); @@ -2228,12 +2220,14 @@ public sealed partial class DeviceReport // Skip Lead-Out pre-gap var firstSessionLeadOutLba = (uint)(firstSessionLeadOutTrack.PMIN * 60 * 75 + firstSessionLeadOutTrack.PSEC * 75 + - firstSessionLeadOutTrack.PFRAME + 150); + firstSessionLeadOutTrack.PFRAME + + 150); // Skip second session track pre-gap var secondSessionLeadInLba = (uint)(secondSessionFirstTrack.PMIN * 60 * 75 + secondSessionFirstTrack.PSEC * 75 + - secondSessionFirstTrack.PFRAME - 300); + secondSessionFirstTrack.PFRAME - + 300); Spectre.ProgressSingleSpinner(ctx => { diff --git a/Aaru.Core/Devices/Report/SSC.cs b/Aaru.Core/Devices/Report/SSC.cs index 039bc15a9..059266744 100644 --- a/Aaru.Core/Devices/Report/SSC.cs +++ b/Aaru.Core/Devices/Report/SSC.cs @@ -174,8 +174,7 @@ public sealed partial class DeviceReport _dev.Timeout, out _); }); - if(!sense && - !_dev.Error) + if(!sense && !_dev.Error) { decMode = Modes.DecodeMode10(buffer, _dev.ScsiType); seqTest.ModeSense10Data = buffer; @@ -187,8 +186,7 @@ public sealed partial class DeviceReport sense = _dev.ModeSense(out buffer, out _, _dev.Timeout, out _); }); - if(!sense && - !_dev.Error) + if(!sense && !_dev.Error) { decMode ??= Modes.DecodeMode6(buffer, _dev.ScsiType); diff --git a/Aaru.Core/Devices/Report/Scsi.cs b/Aaru.Core/Devices/Report/Scsi.cs index 02a175ce8..3d341b537 100644 --- a/Aaru.Core/Devices/Report/Scsi.cs +++ b/Aaru.Core/Devices/Report/Scsi.cs @@ -121,7 +121,8 @@ public sealed partial class DeviceReport Spectre.ProgressSingleSpinner(ctx => { ProgressTask task = ctx.AddTask(Localization.Core.Querying_SCSI_EVPD_pages, - maxValue: evpdPages.Count(page => page != 0x80)).IsIndeterminate(); + maxValue: evpdPages.Count(page => page != 0x80)). + IsIndeterminate(); foreach(byte page in evpdPages.Where(page => page != 0x80)) { @@ -231,10 +232,10 @@ public sealed partial class DeviceReport IsIndeterminate(); foreach(ScsiModeSensePageControl pageControl in new[] - { - ScsiModeSensePageControl.Default, ScsiModeSensePageControl.Current, - ScsiModeSensePageControl.Changeable - }) + { + ScsiModeSensePageControl.Default, ScsiModeSensePageControl.Current, + ScsiModeSensePageControl.Changeable + }) { var saveBuffer = false; @@ -256,8 +257,7 @@ public sealed partial class DeviceReport sense = _dev.ModeSense10(out mode10Buffer, out _, false, false, pageControl, 0x3F, 0x00, _dev.Timeout, out _); - if(!sense && - !_dev.Error) + if(!sense && !_dev.Error) { v2.SCSI.SupportsModeSense10 = true; decMode ??= Modes.DecodeMode10(mode10Buffer, devType); @@ -314,10 +314,10 @@ public sealed partial class DeviceReport IsIndeterminate(); foreach(ScsiModeSensePageControl pageControl in new[] - { - ScsiModeSensePageControl.Default, ScsiModeSensePageControl.Current, - ScsiModeSensePageControl.Changeable - }) + { + ScsiModeSensePageControl.Default, ScsiModeSensePageControl.Current, + ScsiModeSensePageControl.Changeable + }) { var saveBuffer = false; @@ -349,8 +349,7 @@ public sealed partial class DeviceReport sense = _dev.ModeSense6(out mode6Buffer, out _, false, pageControl, 0x00, 0x00, _dev.Timeout, out _); - if(!sense && - !_dev.Error) + if(!sense && !_dev.Error) { v2.SCSI.SupportsModeSense6 = true; decMode ??= Modes.DecodeMode6(mode6Buffer, devType); @@ -453,8 +452,7 @@ public sealed partial class DeviceReport modePages.Add(modePage); - if(modePage.page == 0x2A && - modePage.subpage == 0x00) + if(modePage.page == 0x2A && modePage.subpage == 0x00) cdromMode = page.PageResponse; } @@ -477,13 +475,13 @@ public sealed partial class DeviceReport sense = _dev.ReadCapacity(out buffer, out senseBuffer, _dev.Timeout, out _); }); - if(!sense && - !_dev.Error) + if(!sense && !_dev.Error) { mediaTest.SupportsReadCapacity = true; mediaTest.Blocks = ((ulong)((buffer[0] << 24) + (buffer[1] << 16) + (buffer[2] << 8) + buffer[3]) & - 0xFFFFFFFF) + 1; + 0xFFFFFFFF) + + 1; mediaTest.BlockSize = (uint)((buffer[4] << 24) + (buffer[5] << 16) + (buffer[6] << 8) + buffer[7]); } @@ -494,8 +492,7 @@ public sealed partial class DeviceReport sense = _dev.ReadCapacity16(out buffer, out buffer, _dev.Timeout, out _); }); - if(!sense && - !_dev.Error) + if(!sense && !_dev.Error) { mediaTest.SupportsReadCapacity16 = true; var temp = new byte[8]; @@ -515,8 +512,7 @@ public sealed partial class DeviceReport 0x00, _dev.Timeout, out _); }); - if(!sense && - !_dev.Error) + if(!sense && !_dev.Error) { decMode = Modes.DecodeMode10(buffer, _dev.ScsiType); mediaTest.ModeSense10Data = buffer; @@ -528,8 +524,7 @@ public sealed partial class DeviceReport sense = _dev.ModeSense(out buffer, out senseBuffer, _dev.Timeout, out _); }); - if(!sense && - !_dev.Error) + if(!sense && !_dev.Error) { decMode ??= Modes.DecodeMode6(buffer, _dev.ScsiType); @@ -660,22 +655,22 @@ public sealed partial class DeviceReport case 512: { foreach(ushort testSize in new ushort[] - { - // Long sector sizes for floppies - 514, + { + // Long sector sizes for floppies + 514, - // Long sector sizes for SuperDisk - 536, 558, + // Long sector sizes for SuperDisk + 536, 558, - // Long sector sizes for 512-byte magneto-opticals - 600, 610, 630 - }) + // Long sector sizes for 512-byte magneto-opticals + 600, 610, 630 + }) { sense = mediaTest.SupportsReadLong16 == true ? _dev.ReadLong16(out buffer, out senseBuffer, false, 0, testSize, _dev.Timeout, out _) - : _dev.ReadLong10(out buffer, out senseBuffer, false, - false, 0, testSize, _dev.Timeout, out _); + : _dev.ReadLong10(out buffer, out senseBuffer, false, false, 0, testSize, + _dev.Timeout, out _); if(sense || _dev.Error) continue; @@ -690,19 +685,19 @@ public sealed partial class DeviceReport case 1024: { foreach(ushort testSize in new ushort[] - { - // Long sector sizes for floppies - 1026, + { + // Long sector sizes for floppies + 1026, - // Long sector sizes for 1024-byte magneto-opticals - 1200 - }) + // Long sector sizes for 1024-byte magneto-opticals + 1200 + }) { sense = mediaTest.SupportsReadLong16 == true ? _dev.ReadLong16(out buffer, out senseBuffer, false, 0, testSize, _dev.Timeout, out _) - : _dev.ReadLong10(out buffer, out senseBuffer, false, - false, 0, testSize, _dev.Timeout, out _); + : _dev.ReadLong10(out buffer, out senseBuffer, false, false, 0, testSize, + _dev.Timeout, out _); if(sense || _dev.Error) continue; @@ -721,8 +716,7 @@ public sealed partial class DeviceReport : _dev.ReadLong10(out buffer, out senseBuffer, false, false, 0, 2380, _dev.Timeout, out _); - if(!sense && - !_dev.Error) + if(!sense && !_dev.Error) mediaTest.LongBlockSize = 2380; break; @@ -734,8 +728,7 @@ public sealed partial class DeviceReport : _dev.ReadLong10(out buffer, out senseBuffer, false, false, 0, 4760, _dev.Timeout, out _); - if(!sense && - !_dev.Error) + if(!sense && !_dev.Error) mediaTest.LongBlockSize = 4760; break; @@ -747,8 +740,7 @@ public sealed partial class DeviceReport : _dev.ReadLong10(out buffer, out senseBuffer, false, false, 0, 9424, _dev.Timeout, out _); - if(!sense && - !_dev.Error) + if(!sense && !_dev.Error) mediaTest.LongBlockSize = 9424; break; @@ -786,13 +778,13 @@ public sealed partial class DeviceReport sense = _dev.ReadCapacity(out buffer, out senseBuffer, _dev.Timeout, out _); }); - if(!sense && - !_dev.Error) + if(!sense && !_dev.Error) { capabilities.SupportsReadCapacity = true; capabilities.Blocks = ((ulong)((buffer[0] << 24) + (buffer[1] << 16) + (buffer[2] << 8) + buffer[3]) & - 0xFFFFFFFF) + 1; + 0xFFFFFFFF) + + 1; capabilities.BlockSize = (uint)((buffer[4] << 24) + (buffer[5] << 16) + (buffer[6] << 8) + buffer[7]); } @@ -803,8 +795,7 @@ public sealed partial class DeviceReport sense = _dev.ReadCapacity16(out buffer, out buffer, _dev.Timeout, out _); }); - if(!sense && - !_dev.Error) + if(!sense && !_dev.Error) { capabilities.SupportsReadCapacity16 = true; var temp = new byte[8]; @@ -824,8 +815,7 @@ public sealed partial class DeviceReport 0x00, _dev.Timeout, out _); }); - if(!sense && - !_dev.Error) + if(!sense && !_dev.Error) { decMode = Modes.DecodeMode10(buffer, _dev.ScsiType); capabilities.ModeSense10Data = buffer; @@ -837,8 +827,7 @@ public sealed partial class DeviceReport sense = _dev.ModeSense(out buffer, out senseBuffer, _dev.Timeout, out _); }); - if(!sense && - !_dev.Error) + if(!sense && !_dev.Error) { decMode ??= Modes.DecodeMode6(buffer, _dev.ScsiType); @@ -970,29 +959,30 @@ public sealed partial class DeviceReport { ctx.AddTask(capabilities.SupportsReadLong16 == true ? Localization.Core.Trying_SCSI_READ_LONG_16 - : Localization.Core.Trying_SCSI_READ_LONG_10).IsIndeterminate(); + : Localization.Core.Trying_SCSI_READ_LONG_10). + IsIndeterminate(); switch(capabilities.BlockSize) { case 512: { foreach(ushort testSize in new ushort[] - { - // Long sector sizes for floppies - 514, + { + // Long sector sizes for floppies + 514, - // Long sector sizes for SuperDisk - 536, 558, + // Long sector sizes for SuperDisk + 536, 558, - // Long sector sizes for 512-byte magneto-opticals - 600, 610, 630 - }) + // Long sector sizes for 512-byte magneto-opticals + 600, 610, 630 + }) { sense = capabilities.SupportsReadLong16 == true ? _dev.ReadLong16(out buffer, out senseBuffer, false, 0, testSize, _dev.Timeout, out _) - : _dev.ReadLong10(out buffer, out senseBuffer, false, - false, 0, testSize, _dev.Timeout, out _); + : _dev.ReadLong10(out buffer, out senseBuffer, false, false, 0, testSize, + _dev.Timeout, out _); if(sense || _dev.Error) continue; @@ -1008,19 +998,19 @@ public sealed partial class DeviceReport case 1024: { foreach(ushort testSize in new ushort[] - { - // Long sector sizes for floppies - 1026, + { + // Long sector sizes for floppies + 1026, - // Long sector sizes for 1024-byte magneto-opticals - 1200 - }) + // Long sector sizes for 1024-byte magneto-opticals + 1200 + }) { sense = capabilities.SupportsReadLong16 == true ? _dev.ReadLong16(out buffer, out senseBuffer, false, 0, testSize, _dev.Timeout, out _) - : _dev.ReadLong10(out buffer, out senseBuffer, false, - false, 0, testSize, _dev.Timeout, out _); + : _dev.ReadLong10(out buffer, out senseBuffer, false, false, 0, testSize, + _dev.Timeout, out _); if(sense || _dev.Error) continue; diff --git a/Aaru.Core/Devices/Scanning/ATA.cs b/Aaru.Core/Devices/Scanning/ATA.cs index 5ad9f69db..5b0ea7c6c 100644 --- a/Aaru.Core/Devices/Scanning/ATA.cs +++ b/Aaru.Core/Devices/Scanning/ATA.cs @@ -56,8 +56,7 @@ public sealed partial class MediaScan bool sense = _dev.AtaIdentify(out byte[] cmdBuf, out _); - if(!sense && - Identify.Decode(cmdBuf).HasValue) + if(!sense && Identify.Decode(cmdBuf).HasValue) { // Initialize reader var ataReader = new Reader(_dev, timeout, cmdBuf, null); @@ -141,19 +140,15 @@ public sealed partial class MediaScan if(results.Blocks - i < blocksToRead) blocksToRead = (byte)(results.Blocks - i); - if(currentSpeed > results.MaxSpeed && - currentSpeed > 0) + if(currentSpeed > results.MaxSpeed && currentSpeed > 0) results.MaxSpeed = currentSpeed; - if(currentSpeed < results.MinSpeed && - currentSpeed > 0) + if(currentSpeed < results.MinSpeed && currentSpeed > 0) results.MinSpeed = currentSpeed; UpdateProgress?. - Invoke( - string.Format(Localization.Core.Reading_sector_0_of_1_2, i, results.Blocks, - ByteSize.FromMegabytes(currentSpeed).Per(_oneSecond).Humanize()), - (long)i, (long)results.Blocks); + Invoke(string.Format(Localization.Core.Reading_sector_0_of_1_2, i, results.Blocks, ByteSize.FromMegabytes(currentSpeed).Per(_oneSecond).Humanize()), + (long)i, (long)results.Blocks); bool error = ataReader.ReadBlocks(out cmdBuf, i, blocksToRead, out duration, out _, out _); @@ -241,12 +236,10 @@ public sealed partial class MediaScan ataReader.Seek(seekPos, out seekCur); - if(seekCur > results.SeekMax && - seekCur > 0) + if(seekCur > results.SeekMax && seekCur > 0) results.SeekMax = seekCur; - if(seekCur < results.SeekMin && - seekCur > 0) + if(seekCur < results.SeekMin && seekCur > 0) results.SeekMin = seekCur; results.SeekTotal += seekCur; @@ -278,17 +271,16 @@ public sealed partial class MediaScan if(_aborted) break; - if(currentSpeed > results.MaxSpeed && - currentSpeed > 0) + if(currentSpeed > results.MaxSpeed && currentSpeed > 0) results.MaxSpeed = currentSpeed; - if(currentSpeed < results.MinSpeed && - currentSpeed > 0) + if(currentSpeed < results.MinSpeed && currentSpeed > 0) results.MinSpeed = currentSpeed; PulseProgress?.Invoke(string.Format(Localization.Core.Reading_cylinder_0_head_1_sector_2_3, cy, hd, sc, - ByteSize.FromMegabytes(currentSpeed).Per(_oneSecond). + ByteSize.FromMegabytes(currentSpeed). + Per(_oneSecond). Humanize())); bool error = ataReader.ReadChs(out cmdBuf, cy, hd, sc, out duration, out _); @@ -380,12 +372,10 @@ public sealed partial class MediaScan ataReader.SeekChs(seekCy, seekHd, seekSc, out seekCur); - if(seekCur > results.SeekMax && - seekCur > 0) + if(seekCur > results.SeekMax && seekCur > 0) results.SeekMax = seekCur; - if(seekCur < results.SeekMin && - seekCur > 0) + if(seekCur < results.SeekMin && seekCur > 0) results.SeekMin = seekCur; results.SeekTotal += seekCur; diff --git a/Aaru.Core/Devices/Scanning/SCSI.cs b/Aaru.Core/Devices/Scanning/SCSI.cs index 9145472e9..74d670a69 100644 --- a/Aaru.Core/Devices/Scanning/SCSI.cs +++ b/Aaru.Core/Devices/Scanning/SCSI.cs @@ -188,8 +188,7 @@ public sealed partial class MediaScan results.Blocks = scsiReader.GetDeviceBlocks(); foundReadCommand = !scsiReader.FindReadCommand(); - if(!foundReadCommand && - _dev.ScsiType != PeripheralDeviceTypes.MultiMediaDevice) + if(!foundReadCommand && _dev.ScsiType != PeripheralDeviceTypes.MultiMediaDevice) { StoppingErrorMessage?.Invoke(Localization.Core.Unable_to_read_medium); @@ -198,8 +197,7 @@ public sealed partial class MediaScan blockSize = scsiReader.LogicalBlockSize; - if(results.Blocks != 0 && - blockSize != 0) + if(results.Blocks != 0 && blockSize != 0) { results.Blocks++; @@ -323,8 +321,7 @@ public sealed partial class MediaScan if(_dev.Error || sense) blocksToRead /= 2; - if(!_dev.Error || - blocksToRead == 1) + if(!_dev.Error || blocksToRead == 1) break; } } @@ -358,19 +355,15 @@ public sealed partial class MediaScan if(results.Blocks - i < blocksToRead) blocksToRead = (uint)(results.Blocks - i); - if(currentSpeed > results.MaxSpeed && - currentSpeed > 0) + if(currentSpeed > results.MaxSpeed && currentSpeed > 0) results.MaxSpeed = currentSpeed; - if(currentSpeed < results.MinSpeed && - currentSpeed > 0) + if(currentSpeed < results.MinSpeed && currentSpeed > 0) results.MinSpeed = currentSpeed; UpdateProgress?. - Invoke( - string.Format(Localization.Core.Reading_sector_0_of_1_2, i, results.Blocks, - ByteSize.FromMegabytes(currentSpeed).Per(_oneSecond).Humanize()), - (long)i, (long)results.Blocks); + Invoke(string.Format(Localization.Core.Reading_sector_0_of_1_2, i, results.Blocks, ByteSize.FromMegabytes(currentSpeed).Per(_oneSecond).Humanize()), + (long)i, (long)results.Blocks); if(readcd) { @@ -522,25 +515,20 @@ public sealed partial class MediaScan if(results.Blocks - i < blocksToRead) blocksToRead = (uint)(results.Blocks - i); - if(currentSpeed > results.MaxSpeed && - currentSpeed > 0) + if(currentSpeed > results.MaxSpeed && currentSpeed > 0) results.MaxSpeed = currentSpeed; - if(currentSpeed < results.MinSpeed && - currentSpeed > 0) + if(currentSpeed < results.MinSpeed && currentSpeed > 0) results.MinSpeed = currentSpeed; UpdateProgress?. - Invoke( - string.Format(Localization.Core.Reading_sector_0_of_1_2, i, results.Blocks, - ByteSize.FromMegabytes(currentSpeed).Per(_oneSecond).Humanize()), - (long)i, (long)results.Blocks); + Invoke(string.Format(Localization.Core.Reading_sector_0_of_1_2, i, results.Blocks, ByteSize.FromMegabytes(currentSpeed).Per(_oneSecond).Humanize()), + (long)i, (long)results.Blocks); sense = scsiReader.ReadBlocks(out _, i, blocksToRead, out double cmdDuration, out _, out _); results.ProcessingTime += cmdDuration; - if(!sense && - !_dev.Error) + if(!sense && !_dev.Error) { switch(cmdDuration) { @@ -642,12 +630,10 @@ public sealed partial class MediaScan else scsiReader.ReadBlock(out _, seekPos, out seekCur, out _, out _); - if(seekCur > results.SeekMax && - seekCur > 0) + if(seekCur > results.SeekMax && seekCur > 0) results.SeekMax = seekCur; - if(seekCur < results.SeekMin && - seekCur > 0) + if(seekCur < results.SeekMin && seekCur > 0) results.SeekMin = seekCur; results.SeekTotal += seekCur; diff --git a/Aaru.Core/Devices/Scanning/SecureDigital.cs b/Aaru.Core/Devices/Scanning/SecureDigital.cs index 2d07a79bd..e5e7e3c66 100644 --- a/Aaru.Core/Devices/Scanning/SecureDigital.cs +++ b/Aaru.Core/Devices/Scanning/SecureDigital.cs @@ -128,8 +128,9 @@ public sealed partial class MediaScan if(!sense) { - supportsCmd23 = Decoders.SecureDigital.Decoders.DecodeSCR(cmdBuf)?.CommandSupport. - HasFlag(CommandSupport.SetBlockCount) ?? false; + supportsCmd23 = Decoders.SecureDigital.Decoders.DecodeSCR(cmdBuf)?. + CommandSupport.HasFlag(CommandSupport.SetBlockCount) ?? + false; } } @@ -177,8 +178,7 @@ public sealed partial class MediaScan if(sense) blocksToRead /= 2; - if(!sense || - blocksToRead == 1) + if(!sense || blocksToRead == 1) break; } @@ -241,19 +241,15 @@ public sealed partial class MediaScan if(results.Blocks - i < blocksToRead) blocksToRead = (byte)(results.Blocks - i); - if(currentSpeed > results.MaxSpeed && - currentSpeed > 0) + if(currentSpeed > results.MaxSpeed && currentSpeed > 0) results.MaxSpeed = currentSpeed; - if(currentSpeed < results.MinSpeed && - currentSpeed > 0) + if(currentSpeed < results.MinSpeed && currentSpeed > 0) results.MinSpeed = currentSpeed; UpdateProgress?. - Invoke( - string.Format(Localization.Core.Reading_sector_0_of_1_2, i, results.Blocks, - ByteSize.FromBytes(currentSpeed).Per(_oneSecond).Humanize()), - (long)i, (long)results.Blocks); + Invoke(string.Format(Localization.Core.Reading_sector_0_of_1_2, i, results.Blocks, ByteSize.FromBytes(currentSpeed).Per(_oneSecond).Humanize()), + (long)i, (long)results.Blocks); bool error; @@ -356,12 +352,10 @@ public sealed partial class MediaScan _dev.ReadSingleBlock(out cmdBuf, out _, seekPos, blockSize, byteAddressed, timeout, out double seekCur); - if(seekCur > results.SeekMax && - seekCur > 0) + if(seekCur > results.SeekMax && seekCur > 0) results.SeekMax = seekCur; - if(seekCur < results.SeekMin && - seekCur > 0) + if(seekCur < results.SeekMin && seekCur > 0) results.SeekMin = seekCur; results.SeekTotal += seekCur; diff --git a/Aaru.Core/Entropy.cs b/Aaru.Core/Entropy.cs index c1ea1b0e2..3be7d38ab 100644 --- a/Aaru.Core/Entropy.cs +++ b/Aaru.Core/Entropy.cs @@ -104,10 +104,8 @@ public sealed class Entropy }; UpdateProgressEvent?. - Invoke( - string.Format(Localization.Core.Entropying_track_0_of_1, currentTrack.Sequence, - inputTracks.Max(t => t.Sequence)), - currentTrack.Sequence, inputTracks.Max(t => t.Sequence)); + Invoke(string.Format(Localization.Core.Entropying_track_0_of_1, currentTrack.Sequence, inputTracks.Max(t => t.Sequence)), + currentTrack.Sequence, inputTracks.Max(t => t.Sequence)); var entTable = new ulong[256]; ulong trackSize = 0; @@ -123,10 +121,8 @@ public sealed class Entropy for(ulong i = 0; i < trackEntropy.Sectors; i++) { UpdateProgress2Event?. - Invoke( - string.Format(Localization.Core.Entropying_sector_0_of_track_1, i + 1, - currentTrack.Sequence), - (long)(i + 1), (long)currentTrack.EndSector); + Invoke(string.Format(Localization.Core.Entropying_sector_0_of_track_1, i + 1, currentTrack.Sequence), + (long)(i + 1), (long)currentTrack.EndSector); ErrorNumber errno = opticalMediaImage.ReadSector(i, currentTrack.Sequence, out byte[] sector); @@ -156,7 +152,8 @@ public sealed class Entropy EndProgress2Event?.Invoke(); trackEntropy.Entropy += entTable.Select(l => l / (double)trackSize). - Select(frequency => -(frequency * Math.Log(frequency, 2))).Sum(); + Select(frequency => -(frequency * Math.Log(frequency, 2))). + Sum(); if(duplicatedSectors) trackEntropy.UniqueSectors = uniqueSectorsPerTrack.Count; @@ -233,7 +230,8 @@ public sealed class Entropy EndProgressEvent?.Invoke(); entropy.Entropy += entTable.Select(l => l / (double)diskSize). - Select(frequency => -(frequency * Math.Log(frequency, 2))).Sum(); + Select(frequency => -(frequency * Math.Log(frequency, 2))). + Sum(); if(duplicatedSectors) entropy.UniqueSectors = uniqueSectors.Count; @@ -283,7 +281,8 @@ public sealed class Entropy EndProgressEvent?.Invoke(); entropy.Entropy += entTable.Select(l => l / (double)data.Length). - Select(frequency => -(frequency * Math.Log(frequency, 2))).Sum(); + Select(frequency => -(frequency * Math.Log(frequency, 2))). + Sum(); return entropy; } diff --git a/Aaru.Core/Graphics/BlockMap.cs b/Aaru.Core/Graphics/BlockMap.cs index 520109705..d171b26fd 100644 --- a/Aaru.Core/Graphics/BlockMap.cs +++ b/Aaru.Core/Graphics/BlockMap.cs @@ -61,8 +61,7 @@ public class BlockMap : IMediaGraph _sectorsPerSquare = (int)((long)maxSectors / squares); - while(_sectorsPerSquare > 0 && - _squareSize > 4) + while(_sectorsPerSquare > 0 && _squareSize > 4) { _squareSize--; @@ -266,8 +265,8 @@ public class BlockMap : IMediaGraph { foreach(SKRect rect in sectors.Select(sector => GetSquareRectangle(_sectorsPerSquare == 0 ? (int)sector - : (int) - (sector / (ulong)_sectorsPerSquare)))) + : (int)(sector / + (ulong)_sectorsPerSquare)))) { _canvas.DrawRect(rect, new SKPaint { diff --git a/Aaru.Core/Graphics/Spiral.cs b/Aaru.Core/Graphics/Spiral.cs index 0d494f0ff..93726a4ad 100644 --- a/Aaru.Core/Graphics/Spiral.cs +++ b/Aaru.Core/Graphics/Spiral.cs @@ -103,8 +103,7 @@ public sealed class Spiral : IMediaGraph /// Last sector that will be drawn into the spiral public Spiral(int width, int height, DiscParameters parameters, ulong lastSector) { - if(parameters == _gdParameters || - parameters == _gdRecordableParameters) + if(parameters == _gdParameters || parameters == _gdRecordableParameters) _gdrom = true; // GD-ROM LD area ends at 29mm, HD area starts at 30mm radius @@ -197,8 +196,7 @@ public sealed class Spiral : IMediaGraph }); // If there's a recordable information area, get its points - if(recordableAreaEndDiameter > 0 && - recordableAreaStartDiameter > 0) + if(recordableAreaEndDiameter > 0 && recordableAreaStartDiameter > 0) { _recordableInformationPoints = GetSpiralPoints(center, recordableAreaStartDiameter / 2, recordableAreaEndDiameter / 2, _gdrom ? a : a * 1.5f); diff --git a/Aaru.Core/ImageInfo.cs b/Aaru.Core/ImageInfo.cs index 9e4e9d615..f651efee8 100644 --- a/Aaru.Core/ImageInfo.cs +++ b/Aaru.Core/ImageInfo.cs @@ -124,8 +124,7 @@ public static class ImageInfo if(!string.IsNullOrWhiteSpace(imageFormat.Info.Comments)) AaruConsole.WriteLine(Localization.Core.Comments_0_WithMarkup, Markup.Escape(imageFormat.Info.Comments)); - if(imageFormat.Info.MediaSequence != 0 && - imageFormat.Info.LastMediaSequence != 0) + if(imageFormat.Info.MediaSequence != 0 && imageFormat.Info.LastMediaSequence != 0) { AaruConsole.WriteLine(Localization.Core.Media_is_number_0_on_a_set_of_1_medias, imageFormat.Info.MediaSequence, imageFormat.Info.LastMediaSequence); @@ -419,8 +418,7 @@ public static class ImageInfo { errno = imageFormat.ReadMediaTag(MediaTagType.CD_FullTOC, out byte[] toc); - if(errno == ErrorNumber.NoError && - toc.Length > 0) + if(errno == ErrorNumber.NoError && toc.Length > 0) { ushort dataLen = Swapping.Swap(BitConverter.ToUInt16(toc, 0)); @@ -443,8 +441,7 @@ public static class ImageInfo { errno = imageFormat.ReadMediaTag(MediaTagType.CD_PMA, out byte[] pma); - if(errno == ErrorNumber.NoError && - pma.Length > 0) + if(errno == ErrorNumber.NoError && pma.Length > 0) { ushort dataLen = Swapping.Swap(BitConverter.ToUInt16(pma, 0)); @@ -678,8 +675,7 @@ public static class ImageInfo break; default: - AaruConsole.DebugWriteLine(MODULE_NAME, - Localization.Core.Found_unknown_tuple_ID_0, + AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Core.Found_unknown_tuple_ID_0, (byte)tuple.Code); break; diff --git a/Aaru.Core/Logging/ErrorLog.cs b/Aaru.Core/Logging/ErrorLog.cs index 9b6ecaf40..169d4a683 100644 --- a/Aaru.Core/Logging/ErrorLog.cs +++ b/Aaru.Core/Logging/ErrorLog.cs @@ -430,9 +430,7 @@ public sealed class ErrorLog _logSw.WriteLine(Localization.Core.SCSI_reading_LBA_0_operating_system_error_1, block, errno); _logSw.Flush(); - if(senseBuffer is null || - senseBuffer.Length == 0 || - senseBuffer.All(s => s == 0)) + if(senseBuffer is null || senseBuffer.Length == 0 || senseBuffer.All(s => s == 0)) return; } @@ -517,22 +515,16 @@ public sealed class ErrorLog { if(osError) { - _logSw.WriteLine( - byteAddressed - ? Localization.Core.SD_MMC_reading_LBA_0_byte_addressed_operating_system_error_1 - : Localization.Core.SD_MMC_reading_LBA_0_block_addressed_operating_system_error_1, - block, errno); + _logSw.WriteLine(byteAddressed ? Localization.Core.SD_MMC_reading_LBA_0_byte_addressed_operating_system_error_1 : Localization.Core.SD_MMC_reading_LBA_0_block_addressed_operating_system_error_1, + block, errno); _logSw.Flush(); return; } - _logSw.WriteLine( - byteAddressed - ? Localization.Core.SD_MMC_reading_LBA_0_byte_addressed_error_1 - : Localization.Core.SD_MMC_reading_LBA_0_block_addressed_error_1, - block, string.Join(" - ", response.Select(r => $"0x{r:X8}"))); + _logSw.WriteLine(byteAddressed ? Localization.Core.SD_MMC_reading_LBA_0_byte_addressed_error_1 : Localization.Core.SD_MMC_reading_LBA_0_block_addressed_error_1, + block, string.Join(" - ", response.Select(r => $"0x{r:X8}"))); throw new NotImplementedException(); } diff --git a/Aaru.Core/Logging/IBGLog.cs b/Aaru.Core/Logging/IBGLog.cs index aa4e553c9..2dabbaefc 100644 --- a/Aaru.Core/Logging/IBGLog.cs +++ b/Aaru.Core/Logging/IBGLog.cs @@ -249,8 +249,7 @@ sealed class IbgLog if(_ibgSampleRate < 100) return; - if(_ibgIntSpeed > 0 && - !_ibgStartSet) + if(_ibgIntSpeed > 0 && !_ibgStartSet) { _ibgStartSpeed = _ibgIntSpeed / _ibgSnaps / _ibgDivider; _ibgStartSet = true; diff --git a/Aaru.Core/Logging/MHDDLog.cs b/Aaru.Core/Logging/MHDDLog.cs index dc39a7288..d5df24bf7 100644 --- a/Aaru.Core/Logging/MHDDLog.cs +++ b/Aaru.Core/Logging/MHDDLog.cs @@ -59,8 +59,7 @@ sealed class MhddLog internal MhddLog(string outputFile, Device dev, ulong blocks, ulong blockSize, ulong blocksToRead, bool @private, uint mediaGraphDimensions = 0) { - if(dev == null || - string.IsNullOrEmpty(outputFile)) + if(dev == null || string.IsNullOrEmpty(outputFile)) return; if(mediaGraphDimensions > 0) @@ -117,10 +116,16 @@ sealed class MhddLog byte[] scanBlockSizeBytes = Encoding.ASCII.GetBytes(scanBlockSize); byte[] verBytes = Encoding.ASCII.GetBytes(MHDD_VER); - var pointer = (uint)(deviceBytes.Length + modeBytes.Length + fwBytes.Length + snBytes.Length + - sectorsBytes.Length + sectorSizeBytes.Length + scanBlockSizeBytes.Length + - verBytes.Length + 2 * 9 + // New lines - 4); // Pointer + var pointer = (uint)(deviceBytes.Length + + modeBytes.Length + + fwBytes.Length + + snBytes.Length + + sectorsBytes.Length + + sectorSizeBytes.Length + + scanBlockSizeBytes.Length + + verBytes.Length + + 2 * 9 + // New lines + 4); // Pointer var newLine = new byte[2]; newLine[0] = 0x0D; diff --git a/Aaru.Core/Logging/SubchannelLog.cs b/Aaru.Core/Logging/SubchannelLog.cs index bd1c96dab..b14161b23 100644 --- a/Aaru.Core/Logging/SubchannelLog.cs +++ b/Aaru.Core/Logging/SubchannelLog.cs @@ -188,8 +188,7 @@ public class SubchannelLog for(var i = 0; i < 12; i++) { - if(p[i] == 0 || - p[i] == 0xFF) + if(p[i] == 0 || p[i] == 0xFF) continue; corruptedPause = true; diff --git a/Aaru.Core/Media/CompactDisc.cs b/Aaru.Core/Media/CompactDisc.cs index b22883bec..abe621053 100644 --- a/Aaru.Core/Media/CompactDisc.cs +++ b/Aaru.Core/Media/CompactDisc.cs @@ -80,8 +80,7 @@ public static class CompactDisc sub = Subchannel.ConvertQToRaw(sub); // If not desired to fix, or to save, the subchannel, just save as is (or none) - if(!fixSubchannelPosition && - desiredSubchannel != MmcSubchannel.None) + if(!fixSubchannelPosition && desiredSubchannel != MmcSubchannel.None) outputPlugin.WriteSectorsTag(sub, sectorAddress, length, SectorTagType.CdSectorSubchannel); subLog?.WriteEntry(sub, supportedSubchannel == MmcSubchannel.Raw, (long)sectorAddress, length, false, false); @@ -92,8 +91,7 @@ public static class CompactDisc updateStatus, smallestPregapLbaPerTrack, dumping, out newPregapSectors, sectorAddress); - if(!fixSubchannelPosition || - desiredSubchannel == MmcSubchannel.None) + if(!fixSubchannelPosition || desiredSubchannel == MmcSubchannel.None) return indexesChanged; int prePos = int.MinValue; @@ -121,8 +119,7 @@ public static class CompactDisc // Check P and weight for(int p = subPos; p < subPos + 12; p++) { - if(deSub[p] != 0 && - deSub[p] != 255) + if(deSub[p] != 0 && deSub[p] != 255) pOk = false; for(var w = 0; w < 8; w++) @@ -192,10 +189,7 @@ public static class CompactDisc } // RW is not a known pattern or packet, fix it - if(!rwOk && - !rwPacket && - !cdtextPacket && - fixSubchannel) + if(!rwOk && !rwPacket && !cdtextPacket && fixSubchannel) { for(int rw = subPos + 24; rw < subPos + 96; rw++) deSub[rw] = 0; @@ -209,10 +203,7 @@ public static class CompactDisc int aPos; // Fix Q - if(!crcOk && - fixSubchannel && - subPos > 0 && - subPos < deSub.Length - 96) + if(!crcOk && fixSubchannel && subPos > 0 && subPos < deSub.Length - 96) { isrcs.TryGetValue(currentTrack, out string knownGoodIsrc); @@ -258,9 +249,7 @@ public static class CompactDisc } } - if(!pOk || - !crcOk || - !rwOk) + if(!pOk || !crcOk || !rwOk) continue; var aframe = (byte)(q[9] / 16 * 10 + (q[9] & 0x0F)); @@ -417,8 +406,7 @@ public static class CompactDisc continue; // Pregap - if(q[2] == 0 && - trackNo > 1) + if(q[2] == 0 && trackNo > 1) { var pmin = (byte)(q[3] / 16 * 10 + (q[3] & 0x0F)); var psec = (byte)(q[4] / 16 * 10 + (q[4] & 0x0F)); @@ -443,9 +431,8 @@ public static class CompactDisc tracks[i].StartSector -= (ulong)dif; smallestPregapLbaPerTrack[trackNo] = qPos; - if(i > 0 && - tracks[i - 1].EndSector >= tracks[i].StartSector) - tracks[i - 1].EndSector = tracks[i].StartSector - 1; + if(i > 0 && tracks[i - 1].EndSector >= tracks[i].StartSector) + tracks[i - 1].EndSector = tracks[i].StartSector - 1; dumpLog?.WriteLine(string.Format(Localization.Core.Pregap_for_track_0_set_to_1_sectors, trackNo, tracks[i].Pregap)); @@ -468,9 +455,8 @@ public static class CompactDisc tracks[i].Pregap = (ulong)qPos; tracks[i].StartSector -= tracks[i].Pregap - oldPregap; - if(i > 0 && - tracks[i - 1].EndSector >= tracks[i].StartSector) - tracks[i - 1].EndSector = tracks[i].StartSector - 1; + if(i > 0 && tracks[i - 1].EndSector >= tracks[i].StartSector) + tracks[i - 1].EndSector = tracks[i].StartSector - 1; dumpLog?.WriteLine(string.Format(Localization.Core.Pregap_for_track_0_set_to_1_sectors, trackNo, tracks[i].Pregap)); @@ -495,12 +481,10 @@ public static class CompactDisc int aPos = amin * 60 * 75 + asec * 75 + aframe - 150; // Do not set INDEX 1 to a value higher than what the TOC already said. - if(q[2] == 1 && - aPos > (int)tracks[i].StartSector) + if(q[2] == 1 && aPos > (int)tracks[i].StartSector) continue; - if(tracks[i].Indexes.ContainsKey(q[2]) && - aPos >= tracks[i].Indexes[q[2]]) + if(tracks[i].Indexes.ContainsKey(q[2]) && aPos >= tracks[i].Indexes[q[2]]) continue; dumpLog?.WriteLine(string.Format(Localization.Core.Setting_index_0_for_track_1_to_LBA_2, q[2], @@ -824,8 +808,7 @@ public static class CompactDisc Array.Copy(cdTextPack1, 0, cdTextPack1ForCrc, 0, 16); ushort calculatedCdtp1Crc = CRC16CCITTContext.Calculate(cdTextPack1ForCrc); - if(cdTextPack1Crc != calculatedCdtp1Crc && - cdTextPack1Crc != 0) + if(cdTextPack1Crc != calculatedCdtp1Crc && cdTextPack1Crc != 0) status = false; } @@ -836,8 +819,7 @@ public static class CompactDisc Array.Copy(cdTextPack2, 0, cdTextPack2ForCrc, 0, 16); ushort calculatedCdtp2Crc = CRC16CCITTContext.Calculate(cdTextPack2ForCrc); - if(cdTextPack2Crc != calculatedCdtp2Crc && - cdTextPack2Crc != 0) + if(cdTextPack2Crc != calculatedCdtp2Crc && cdTextPack2Crc != 0) status = false; } @@ -848,8 +830,7 @@ public static class CompactDisc Array.Copy(cdTextPack3, 0, cdTextPack3ForCrc, 0, 16); ushort calculatedCdtp3Crc = CRC16CCITTContext.Calculate(cdTextPack3ForCrc); - if(cdTextPack3Crc != calculatedCdtp3Crc && - cdTextPack3Crc != 0) + if(cdTextPack3Crc != calculatedCdtp3Crc && cdTextPack3Crc != 0) status = false; } @@ -861,8 +842,7 @@ public static class CompactDisc Array.Copy(cdTextPack4, 0, cdTextPack4ForCrc, 0, 16); ushort calculatedCdtp4Crc = CRC16CCITTContext.Calculate(cdTextPack4ForCrc); - if(cdTextPack4Crc == calculatedCdtp4Crc || - cdTextPack4Crc == 0) + if(cdTextPack4Crc == calculatedCdtp4Crc || cdTextPack4Crc == 0) return status; return false; @@ -1007,10 +987,7 @@ public static class CompactDisc q[0] = (byte)oldAdr; } - if(preCrcOk && - nextCrcOk && - (nextQ[0] & 0xF0) == (preQ[0] & 0xF0) && - (q[0] & 0xF0) != (nextQ[0] & 0xF0)) + if(preCrcOk && nextCrcOk && (nextQ[0] & 0xF0) == (preQ[0] & 0xF0) && (q[0] & 0xF0) != (nextQ[0] & 0xF0)) { q[0] = (byte)((q[0] & 0x03) + (nextQ[0] & 0xF0)); @@ -1037,8 +1014,7 @@ public static class CompactDisc if(preCrcOk && nextCrcOk) { - if(preQ[1] == nextQ[1] && - preQ[1] != q[1]) + if(preQ[1] == nextQ[1] && preQ[1] != q[1]) { q[1] = preQ[1]; fixedTno = true; @@ -1053,8 +1029,7 @@ public static class CompactDisc if(preCrcOk && nextCrcOk) { - if(preQ[2] == nextQ[2] && - preQ[2] != q[2]) + if(preQ[2] == nextQ[2] && preQ[2] != q[2]) { q[2] = preQ[2]; fixedIndex = true; @@ -1145,9 +1120,7 @@ public static class CompactDisc } // Next is not pregap and we didn't fix relative position with previous - if(nextQ[2] > 0 && - nextCrcOk && - !fixedRelPos) + if(nextQ[2] > 0 && nextCrcOk && !fixedRelPos) { rmin = (byte)(nextQ[3] / 16 * 10 + (nextQ[3] & 0x0F)); rsec = (byte)(nextQ[4] / 16 * 10 + (nextQ[4] & 0x0F)); @@ -1262,9 +1235,7 @@ public static class CompactDisc } // Next is not pregap and we didn't fix relative position with previous - if(nextQ[2] > 0 && - nextCrcOk && - !fixedAbsPos) + if(nextQ[2] > 0 && nextCrcOk && !fixedAbsPos) { rmin = (byte)(nextQ[7] / 16 * 10 + (nextQ[7] & 0x0F)); rsec = (byte)(nextQ[8] / 16 * 10 + (nextQ[8] & 0x0F)); @@ -1350,12 +1321,7 @@ public static class CompactDisc bool relOk = dPos == 1; - if(q[0] != preQ[0] || - q[1] != preQ[1] || - q[2] != preQ[2] || - q[6] != 0 || - !absOk || - !relOk) + if(q[0] != preQ[0] || q[1] != preQ[1] || q[2] != preQ[2] || q[6] != 0 || !absOk || !relOk) return false; CRC16CCITTContext.Data(q, 10, out qCrc); @@ -1388,12 +1354,7 @@ public static class CompactDisc bool relOk = dPos == 1; - if(q[0] != nextQ[0] || - q[1] != nextQ[1] || - q[2] != nextQ[2] || - q[6] != 0 || - !absOk || - !relOk) + if(q[0] != nextQ[0] || q[1] != nextQ[1] || q[2] != nextQ[2] || q[6] != 0 || !absOk || !relOk) return false; CRC16CCITTContext.Data(q, 10, out qCrc); @@ -1488,9 +1449,7 @@ public static class CompactDisc return true; } - if(!fixCrc || - !nextCrcOk || - !preCrcOk) + if(!fixCrc || !nextCrcOk || !preCrcOk) return false; CRC16CCITTContext.Data(q, 10, out qCrc); @@ -1587,9 +1546,7 @@ public static class CompactDisc return true; } - if(!fixCrc || - !nextCrcOk || - !preCrcOk) + if(!fixCrc || !nextCrcOk || !preCrcOk) return false; CRC16CCITTContext.Data(q, 10, out qCrc); diff --git a/Aaru.Core/Media/Detection/MMC.cs b/Aaru.Core/Media/Detection/MMC.cs index 16fb1638c..4c923bf66 100644 --- a/Aaru.Core/Media/Detection/MMC.cs +++ b/Aaru.Core/Media/Detection/MMC.cs @@ -80,10 +80,16 @@ public static class MMC 0x50, 0x6C, 0x61, 0x79, 0x53, 0x74, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x35, 0x00, 0x00, 0x00, 0x00 }; - static readonly byte[] _operaId = { 0x01, 0x5A, 0x5A, 0x5A, 0x5A, 0x5A, 0x01 }; + static readonly byte[] _operaId = + { + 0x01, 0x5A, 0x5A, 0x5A, 0x5A, 0x5A, 0x01 + }; // Only present on bootable CDs, but those make more than 99% of all available - static readonly byte[] _fmTownsBootId = { 0x49, 0x50, 0x4C, 0x34, 0xEB, 0x55, 0x06 }; + static readonly byte[] _fmTownsBootId = + { + 0x49, 0x50, 0x4C, 0x34, 0xEB, 0x55, 0x06 + }; /// Present on first two seconds of second track, says "COPYRIGHT BANDAI" static readonly byte[] _playdiaCopyright = "COPYRIGHT BANDAI"u8.ToArray(); @@ -125,7 +131,10 @@ public static class MMC if(sector?.Length != 2352) return false; - byte[] syncMark = { 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00 }; + byte[] syncMark = + { + 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00 + }; var testMark = new byte[12]; Array.Copy(sector, 0, testMark, 0, 12); @@ -140,7 +149,10 @@ public static class MMC if(sector?.Length != 2352) return false; - byte[] syncMark = { 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00 }; + byte[] syncMark = + { + 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00 + }; var testMark = new byte[12]; @@ -196,12 +208,14 @@ public static class MMC if(sector16?.Length != 2352) return false; - byte[] cdiMark = { 0x01, 0x43, 0x44, 0x2D }; + byte[] cdiMark = + { + 0x01, 0x43, 0x44, 0x2D + }; bool isData = IsData(sector0); - if(!isData || - sector0[0xF] != 2 && sector0[0xF] != 1) + if(!isData || sector0[0xF] != 2 && sector0[0xF] != 1) return false; var testMark = new byte[4]; @@ -212,8 +226,7 @@ public static class MMC static bool IsVideoNowColor(byte[] videoFrame) { - if(videoFrame is null || - videoFrame.Length < _videoNowColorFrameMarker.Length) + if(videoFrame is null || videoFrame.Length < _videoNowColorFrameMarker.Length) return false; var buffer = new byte[_videoNowColorFrameMarker.Length]; @@ -447,8 +460,7 @@ public static class MMC break; case 0x20: - AaruConsole.DebugWriteLine(MODULE_NAME, - Localization.Core.TOC_says_disc_type_is_CD_ROM_XA); + AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Core.TOC_says_disc_type_is_CD_ROM_XA); mediaType = MediaType.CDROMXA; @@ -457,7 +469,7 @@ public static class MMC } foreach(FullTOC.TrackDataDescriptor track in - decodedToc.Value.TrackDescriptors.Where(t => t.POINT is > 0 and <= 0x99)) + decodedToc.Value.TrackDescriptors.Where(t => t.POINT is > 0 and <= 0x99)) { if(track.TNO == 1 && ((TocControl)(track.CONTROL & 0x0D) == TocControl.DataTrack || @@ -467,8 +479,11 @@ public static class MMC if((TocControl)(track.CONTROL & 0x0D) == TocControl.DataTrack || (TocControl)(track.CONTROL & 0x0D) == TocControl.DataTrackIncremental) { - var startAddress = (uint)(track.PHOUR * 3600 * 75 + track.PMIN * 60 * 75 + - track.PSEC * 75 + track.PFRAME - 150); + var startAddress = (uint)(track.PHOUR * 3600 * 75 + + track.PMIN * 60 * 75 + + track.PSEC * 75 + + track.PFRAME - + 150); if(startAddress < startOfFirstDataTrack) startOfFirstDataTrack = startAddress; @@ -504,19 +519,14 @@ public static class MMC break; } - if(hasDataTrack && - !hasAudioTrack && - sessions == 1) + if(hasDataTrack && !hasAudioTrack && sessions == 1) { - AaruConsole.DebugWriteLine(MODULE_NAME, - Localization.Core.Disc_has_only_data_in_a_session_CD_ROM); + AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Core.Disc_has_only_data_in_a_session_CD_ROM); mediaType = MediaType.CDROM; } - if(hasVideoTrack && - !hasDataTrack && - sessions == 1) + if(hasVideoTrack && !hasDataTrack && sessions == 1) { AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Core.Disc_has_video_tracks_CD_Video); @@ -534,7 +544,9 @@ public static class MMC TocControl.DataTrackIncremental)). Select(track => (uint)(track.PHOUR * 3600 * 75 + track.PMIN * 60 * 75 + - track.PSEC * 75 + track.PFRAME - 150) + + track.PSEC * 75 + + track.PFRAME - + 150) + 16)) { sense = dev.ReadCd(out cmdBuf, out _, startAddress, 2352, 1, MmcSectorTypes.AllTypes, false, false, @@ -559,8 +571,7 @@ public static class MMC cmdBuf[15] != 0x02) continue; - AaruConsole.DebugWriteLine(MODULE_NAME, - Localization.Core.Disc_has_a_mode_two_data_track_CD_ROM_XA); + AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Core.Disc_has_a_mode_two_data_track_CD_ROM_XA); mediaType = MediaType.CDROMXA; @@ -578,14 +589,14 @@ public static class MMC var firstSectorSecondSessionFirstTrack = (uint)(secondSessionFirstTrackTrack.PHOUR * 3600 * 75 + secondSessionFirstTrackTrack.PMIN * 60 * 75 + secondSessionFirstTrackTrack.PSEC * 75 + - secondSessionFirstTrackTrack.PFRAME - 150); + secondSessionFirstTrackTrack.PFRAME - + 150); sense = dev.ReadCd(out cmdBuf, out _, firstSectorSecondSessionFirstTrack, 2352, 1, MmcSectorTypes.AllTypes, false, false, true, MmcHeaderCodes.AllHeaders, true, true, MmcErrorField.None, MmcSubchannel.None, dev.Timeout, out _); - if(!sense && - !dev.Error) + if(!sense && !dev.Error) firstTrackSecondSession = cmdBuf; else { @@ -593,8 +604,7 @@ public static class MMC false, false, true, MmcHeaderCodes.AllHeaders, true, true, MmcErrorField.None, MmcSubchannel.None, dev.Timeout, out _); - if(!sense && - !dev.Error) + if(!sense && !dev.Error) firstTrackSecondSession = cmdBuf; } @@ -602,8 +612,7 @@ public static class MMC MmcSectorTypes.AllTypes, false, false, true, MmcHeaderCodes.AllHeaders, true, true, MmcErrorField.None, MmcSubchannel.None, dev.Timeout, out _); - if(!sense && - !dev.Error) + if(!sense && !dev.Error) firstTrackSecondSessionAudio = cmdBuf; else { @@ -611,8 +620,7 @@ public static class MMC MmcSectorTypes.Cdda, false, false, false, MmcHeaderCodes.None, true, false, MmcErrorField.None, MmcSubchannel.None, dev.Timeout, out _); - if(!sense && - !dev.Error) + if(!sense && !dev.Error) firstTrackSecondSessionAudio = cmdBuf; } } @@ -648,8 +656,11 @@ public static class MMC if(firstTrack?.POINT is >= 1 and < 0xA0) { - var firstTrackSector = (uint)(firstTrack.Value.PHOUR * 3600 * 75 + firstTrack.Value.PMIN * 60 * 75 + - firstTrack.Value.PSEC * 75 + firstTrack.Value.PFRAME - 150); + var firstTrackSector = (uint)(firstTrack.Value.PHOUR * 3600 * 75 + + firstTrack.Value.PMIN * 60 * 75 + + firstTrack.Value.PSEC * 75 + + firstTrack.Value.PFRAME - + 150); // Check for hidden data before start of track 1 if(firstTrackSector > 0) @@ -658,8 +669,7 @@ public static class MMC MmcHeaderCodes.AllHeaders, true, true, MmcErrorField.None, MmcSubchannel.None, dev.Timeout, out _); - if(!dev.Error && - !sense) + if(!dev.Error && !sense) { hiddenTrack = true; @@ -671,8 +681,7 @@ public static class MMC false, true, MmcHeaderCodes.AllHeaders, true, true, MmcErrorField.None, MmcSubchannel.None, dev.Timeout, out _); - if(!sense && - IsCdi(sector0, sector16)) + if(!sense && IsCdi(sector0, sector16)) { mediaType = MediaType.CDIREADY; @@ -756,8 +765,7 @@ public static class MMC MmcHeaderCodes.AllHeaders, true, true, MmcErrorField.None, MmcSubchannel.None, dev.Timeout, out _); - if(!sense && - !dev.Error) + if(!sense && !dev.Error) { sector0 = new byte[2048]; Array.Copy(cmdBuf, 16, sector0, 0, 2048); @@ -766,8 +774,7 @@ public static class MMC MmcHeaderCodes.AllHeaders, true, true, MmcErrorField.None, MmcSubchannel.None, dev.Timeout, out _); - if(!sense && - !dev.Error) + if(!sense && !dev.Error) { sector1 = new byte[2048]; Array.Copy(cmdBuf, 16, sector1, 0, 2048); @@ -777,8 +784,7 @@ public static class MMC MmcHeaderCodes.AllHeaders, true, true, MmcErrorField.None, MmcSubchannel.None, dev.Timeout, out _); - if(!sense && - !dev.Error) + if(!sense && !dev.Error) { playdia1 = new byte[2048]; Array.Copy(cmdBuf, 24, playdia1, 0, 2048); @@ -788,8 +794,7 @@ public static class MMC MmcHeaderCodes.AllHeaders, true, true, MmcErrorField.None, MmcSubchannel.None, dev.Timeout, out _); - if(!sense && - !dev.Error) + if(!sense && !dev.Error) { playdia2 = new byte[2048]; Array.Copy(cmdBuf, 24, playdia2, 0, 2048); @@ -801,8 +806,7 @@ public static class MMC false, false, true, MmcHeaderCodes.AllHeaders, true, true, MmcErrorField.None, MmcSubchannel.None, dev.Timeout, out _); - if(!sense && - !dev.Error) + if(!sense && !dev.Error) { firstDataSectorNotZero = new byte[2048]; Array.Copy(cmdBuf, 16, firstDataSectorNotZero, 0, 2048); @@ -812,8 +816,7 @@ public static class MMC MmcSectorTypes.AllTypes, false, false, true, MmcHeaderCodes.AllHeaders, true, true, MmcErrorField.None, MmcSubchannel.None, dev.Timeout, out _); - if(!sense && - !dev.Error) + if(!sense && !dev.Error) { secondDataSectorNotZero = new byte[2048]; Array.Copy(cmdBuf, 16, secondDataSectorNotZero, 0, 2048); @@ -843,8 +846,7 @@ public static class MMC MmcHeaderCodes.None, true, false, MmcErrorField.None, MmcSubchannel.None, dev.Timeout, out _); - if(!sense && - !dev.Error) + if(!sense && !dev.Error) { sector0 = new byte[2048]; Array.Copy(cmdBuf, 0, sector0, 0, 2048); @@ -853,8 +855,7 @@ public static class MMC MmcHeaderCodes.None, true, false, MmcErrorField.None, MmcSubchannel.None, dev.Timeout, out _); - if(!sense && - !dev.Error) + if(!sense && !dev.Error) { sector1 = new byte[2048]; Array.Copy(cmdBuf, 1, sector0, 0, 2048); @@ -864,8 +865,7 @@ public static class MMC MmcHeaderCodes.None, true, false, MmcErrorField.None, MmcSubchannel.None, dev.Timeout, out _); - if(!sense && - !dev.Error) + if(!sense && !dev.Error) { playdia1 = new byte[2048]; Array.Copy(cmdBuf, 0, playdia1, 0, 2048); @@ -875,8 +875,7 @@ public static class MMC MmcHeaderCodes.None, true, false, MmcErrorField.None, MmcSubchannel.None, dev.Timeout, out _); - if(!sense && - !dev.Error) + if(!sense && !dev.Error) { playdia2 = new byte[2048]; Array.Copy(cmdBuf, 0, playdia2, 0, 2048); @@ -888,8 +887,7 @@ public static class MMC false, false, false, MmcHeaderCodes.None, true, false, MmcErrorField.None, MmcSubchannel.None, dev.Timeout, out _); - if(!sense && - !dev.Error) + if(!sense && !dev.Error) { firstDataSectorNotZero = new byte[2048]; Array.Copy(cmdBuf, 0, firstDataSectorNotZero, 0, 2048); @@ -899,8 +897,7 @@ public static class MMC MmcSectorTypes.Mode2, false, false, false, MmcHeaderCodes.None, true, false, MmcErrorField.None, MmcSubchannel.None, dev.Timeout, out _); - if(!sense && - !dev.Error) + if(!sense && !dev.Error) { secondDataSectorNotZero = new byte[2048]; Array.Copy(cmdBuf, 0, secondDataSectorNotZero, 0, 2048); @@ -930,8 +927,7 @@ public static class MMC MmcHeaderCodes.None, true, false, MmcErrorField.None, MmcSubchannel.None, dev.Timeout, out _); - if(!sense && - !dev.Error) + if(!sense && !dev.Error) { sector0 = cmdBuf; @@ -939,16 +935,14 @@ public static class MMC MmcHeaderCodes.None, true, false, MmcErrorField.None, MmcSubchannel.None, dev.Timeout, out _); - if(!sense && - !dev.Error) + if(!sense && !dev.Error) sector1 = cmdBuf; sense = dev.ReadCd(out cmdBuf, out _, 0, 2048, 12, MmcSectorTypes.Mode1, false, false, false, MmcHeaderCodes.None, true, false, MmcErrorField.None, MmcSubchannel.None, dev.Timeout, out _); - if(!sense && - !dev.Error) + if(!sense && !dev.Error) ps2BootSectors = cmdBuf; if(startOfFirstDataTrack != uint.MaxValue) @@ -957,16 +951,14 @@ public static class MMC MmcSectorTypes.Mode1, false, false, false, MmcHeaderCodes.None, true, false, MmcErrorField.None, MmcSubchannel.None, dev.Timeout, out _); - if(!sense && - !dev.Error) + if(!sense && !dev.Error) firstDataSectorNotZero = cmdBuf; sense = dev.ReadCd(out cmdBuf, out _, startOfFirstDataTrack + 1, 2048, 1, MmcSectorTypes.Mode1, false, false, false, MmcHeaderCodes.None, true, false, MmcErrorField.None, MmcSubchannel.None, dev.Timeout, out _); - if(!sense && - !dev.Error) + if(!sense && !dev.Error) secondDataSectorNotZero = cmdBuf; } } @@ -997,24 +989,20 @@ public static class MMC sense = dev.Read16(out cmdBuf, out _, 0, false, false, false, 0, 2048, 0, 1, false, dev.Timeout, out _); - if(!sense && - !dev.Error) + if(!sense && !dev.Error) { sector0 = cmdBuf; sense = dev.Read16(out cmdBuf, out _, 0, false, false, false, 1, 2048, 0, 1, false, dev.Timeout, out _); - if(!sense && - !dev.Error) + if(!sense && !dev.Error) sector1 = cmdBuf; sense = dev.Read16(out cmdBuf, out _, 0, false, false, false, 0, 2048, 0, 12, false, dev.Timeout, out _); - if(!sense && - !dev.Error && - cmdBuf.Length == 0x6000) + if(!sense && !dev.Error && cmdBuf.Length == 0x6000) ps2BootSectors = cmdBuf; } else @@ -1022,24 +1010,20 @@ public static class MMC sense = dev.Read12(out cmdBuf, out _, 0, false, false, false, false, 0, 2048, 0, 1, false, dev.Timeout, out _); - if(!sense && - !dev.Error) + if(!sense && !dev.Error) { sector0 = cmdBuf; sense = dev.Read12(out cmdBuf, out _, 0, false, false, false, false, 1, 2048, 0, 1, false, dev.Timeout, out _); - if(!sense && - !dev.Error) + if(!sense && !dev.Error) sector1 = cmdBuf; sense = dev.Read12(out cmdBuf, out _, 0, false, false, false, false, 0, 2048, 0, 12, false, dev.Timeout, out _); - if(!sense && - !dev.Error && - cmdBuf.Length == 0x6000) + if(!sense && !dev.Error && cmdBuf.Length == 0x6000) ps2BootSectors = cmdBuf; } else @@ -1047,46 +1031,38 @@ public static class MMC sense = dev.Read10(out cmdBuf, out _, 0, false, false, false, false, 0, 2048, 0, 1, dev.Timeout, out _); - if(!sense && - !dev.Error) + if(!sense && !dev.Error) { sector0 = cmdBuf; sense = dev.Read10(out cmdBuf, out _, 0, false, false, false, false, 1, 2048, 0, 1, dev.Timeout, out _); - if(!sense && - !dev.Error) + if(!sense && !dev.Error) sector1 = cmdBuf; sense = dev.Read10(out cmdBuf, out _, 0, false, false, false, false, 0, 2048, 0, 12, dev.Timeout, out _); - if(!sense && - !dev.Error && - cmdBuf.Length == 0x6000) + if(!sense && !dev.Error && cmdBuf.Length == 0x6000) ps2BootSectors = cmdBuf; } else { sense = dev.Read6(out cmdBuf, out _, 0, 2048, 1, dev.Timeout, out _); - if(!sense && - !dev.Error) + if(!sense && !dev.Error) { sector0 = cmdBuf; sense = dev.Read6(out cmdBuf, out _, 1, 2048, 1, dev.Timeout, out _); - if(!sense && - !dev.Error) + if(!sense && !dev.Error) sector1 = cmdBuf; sense = dev.Read6(out cmdBuf, out _, 0, 2048, 12, dev.Timeout, out _); - if(!sense && - !dev.Error && - cmdBuf.Length == 0x6000) + if(!sense && !dev.Error && cmdBuf.Length == 0x6000) ps2BootSectors = cmdBuf; } } @@ -1207,8 +1183,7 @@ public static class MMC break; // If it is PVD or end of descriptor chain, break - if(isoSector[0] == 1 || - isoSector[0] == 255) + if(isoSector[0] == 1 || isoSector[0] == 255) break; isoSectorPosition++; @@ -1226,8 +1201,7 @@ public static class MMC var rootStart = BitConverter.ToUInt32(isoSector, 158); var rootLength = BitConverter.ToUInt32(isoSector, 166); - if(rootStart == 0 || - rootLength == 0) + if(rootStart == 0 || rootLength == 0) return; rootLength /= 2048; @@ -1273,8 +1247,7 @@ public static class MMC if(name.EndsWith(";1", StringComparison.InvariantCulture)) name = name[..^2]; - if(name == "PHOTO_CD" && - (isoSector[rootPos + 25] & 0x02) == 0x02) + if(name == "PHOTO_CD" && (isoSector[rootPos + 25] & 0x02) == 0x02) { pcdStart = BitConverter.ToUInt32(isoSector, rootPos + 2); pcdLength = BitConverter.ToUInt32(isoSector, rootPos + 10) / 2048; @@ -1443,8 +1416,7 @@ public static class MMC string ps2BootSectorsHash = Sha256Context.Data(ps2BootSectors, out _); - AaruConsole.DebugWriteLine(MODULE_NAME, - Localization.Core.PlayStation_2_boot_sectors_SHA256_0, + AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Core.PlayStation_2_boot_sectors_SHA256_0, ps2BootSectorsHash); if(ps2BootSectorsHash is PS2_PAL_HASH or PS2_NTSC_HASH or PS2_JAPANESE_HASH) @@ -1482,8 +1454,7 @@ public static class MMC } } - if(playdia1 != null && - playdia2 != null) + if(playdia1 != null && playdia2 != null) { var pd1 = new byte[_playdiaCopyright.Length]; var pd2 = new byte[_playdiaCopyright.Length]; @@ -1491,8 +1462,7 @@ public static class MMC Array.Copy(playdia1, 38, pd1, 0, pd1.Length); Array.Copy(playdia2, 0, pd2, 0, pd1.Length); - if(_playdiaCopyright.SequenceEqual(pd1) && - _playdiaCopyright.SequenceEqual(pd2)) + if(_playdiaCopyright.SequenceEqual(pd1) && _playdiaCopyright.SequenceEqual(pd2)) { mediaType = MediaType.Playdia; @@ -1674,8 +1644,7 @@ public static class MMC break; // If it is PVD or end of descriptor chain, break - if(isoSector[0] == 1 || - isoSector[0] == 255) + if(isoSector[0] == 1 || isoSector[0] == 255) break; isoSectorPosition++; @@ -1693,8 +1662,7 @@ public static class MMC var rootStart = BitConverter.ToUInt32(isoSector, 158); var rootLength = BitConverter.ToUInt32(isoSector, 166); - if(rootStart == 0 || - rootLength == 0) + if(rootStart == 0 || rootLength == 0) return; rootLength /= 2048; @@ -1851,8 +1819,7 @@ public static class MMC string line = sr.ReadLine(); // End of file - if(line is null || - line.Length == 0) + if(line is null || line.Length == 0) { if(lineNumber == 0) correctNeoGeoCd = false; @@ -1906,8 +1873,7 @@ public static class MMC } // Second part must be a single digit - if(split[1].Length != 1 || - !byte.TryParse(split[1], out _)) + if(split[1].Length != 1 || !byte.TryParse(split[1], out _)) { correctNeoGeoCd = false; @@ -2173,8 +2139,7 @@ public static class MMC string line = sr.ReadLine(); // End of file - if(line is null || - line.Length == 0) + if(line is null || line.Length == 0) break; line = line.Replace(" ", ""); @@ -2206,8 +2171,7 @@ public static class MMC break; } - if(ps1BootFile != null && - rootEntries.Contains(ps1BootFile.ToUpperInvariant())) + if(ps1BootFile != null && rootEntries.Contains(ps1BootFile.ToUpperInvariant())) { mediaType = MediaType.PS1CD; @@ -2215,8 +2179,7 @@ public static class MMC Localization.Core.Found_correct_SYSTEM_CNF_file_in_root_PS1); } - if(ps2BootFile != null && - rootEntries.Contains(ps2BootFile.ToUpperInvariant())) + if(ps2BootFile != null && rootEntries.Contains(ps2BootFile.ToUpperInvariant())) { mediaType = MediaType.PS2CD; @@ -2248,8 +2211,7 @@ public static class MMC string ps2BootSectorsHash = Sha256Context.Data(ps2BootSectors, out _); - AaruConsole.DebugWriteLine(MODULE_NAME, - Localization.Core.PlayStation_2_boot_sectors_SHA256_0, + AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Core.PlayStation_2_boot_sectors_SHA256_0, ps2BootSectorsHash); if(ps2BootSectorsHash is PS2_PAL_HASH or PS2_NTSC_HASH or PS2_JAPANESE_HASH) @@ -2290,8 +2252,7 @@ public static class MMC tmp = new byte[_ps4Id.Length]; Array.Copy(sector1, 512, tmp, 0, tmp.Length); - if(tmp.SequenceEqual(_ps4Id) && - mediaType == MediaType.BDROM) + if(tmp.SequenceEqual(_ps4Id) && mediaType == MediaType.BDROM) { mediaType = MediaType.PS4BD; @@ -2300,8 +2261,7 @@ public static class MMC } } - if(blurayDi is { Units.Length: > 0 } && - blurayDi?.Units[0].DiscTypeIdentifier != null) + if(blurayDi is { Units.Length: > 0 } && blurayDi?.Units[0].DiscTypeIdentifier != null) { string blurayType = StringHandlers.CToString(blurayDi?.Units[0].DiscTypeIdentifier); diff --git a/Aaru.Core/Media/Info/CompactDisc.cs b/Aaru.Core/Media/Info/CompactDisc.cs index 5ce57099e..611dee3cb 100644 --- a/Aaru.Core/Media/Info/CompactDisc.cs +++ b/Aaru.Core/Media/Info/CompactDisc.cs @@ -92,7 +92,10 @@ public static class CompactDisc if(dataTrack != null) { // Build sync - sectorSync = new byte[] { 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00 }; + sectorSync = new byte[] + { + 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00 + }; tmpBuf = new byte[sectorSync.Length]; @@ -107,8 +110,7 @@ public static class CompactDisc sense = dev.PlextorReadCdDa(out cmdBuf, out _, wantedLba, sectorSize, 3, PlextorSubchannel.None, dev.Timeout, out _); - if(!sense && - !dev.Error) + if(!sense && !dev.Error) { supportsPlextorReadCdDa = true; @@ -144,7 +146,8 @@ public static class CompactDisc } if(!offsetFound && - (debug || dbDev?.ATAPI?.RemovableMedias?.Any(d => d.CanReadCdScrambled == true) == true || + (debug || + dbDev?.ATAPI?.RemovableMedias?.Any(d => d.CanReadCdScrambled == true) == true || dbDev?.SCSI?.RemovableMedias?.Any(d => d.CanReadCdScrambled == true) == true || dbDev?.SCSI?.MultiMediaDevice?.TestedMedia?.Any(d => d.CanReadCdScrambled == true) == true || dev.Manufacturer.Equals("hl-dt-st", StringComparison.InvariantCultureIgnoreCase))) @@ -153,8 +156,7 @@ public static class CompactDisc false, false, MmcHeaderCodes.None, true, false, MmcErrorField.None, MmcSubchannel.None, dev.Timeout, out _); - if(!sense && - !dev.Error) + if(!sense && !dev.Error) { // Clear cache for(var i = 0; i < 63; i++) @@ -212,8 +214,7 @@ public static class CompactDisc for(var i = 1; i < tracks.Length; i++) { - if(tracks[i - 1].Type == TrackType.Audio || - tracks[i].Type != TrackType.Audio) + if(tracks[i - 1].Type == TrackType.Audio || tracks[i].Type != TrackType.Audio) continue; dataTrack = tracks[i - 1]; @@ -222,8 +223,7 @@ public static class CompactDisc break; } - if(dataTrack is null || - audioTrack is null) + if(dataTrack is null || audioTrack is null) return; // Found them diff --git a/Aaru.Core/Media/Info/ScsiInfo.cs b/Aaru.Core/Media/Info/ScsiInfo.cs index 683bb557e..0ae451981 100644 --- a/Aaru.Core/Media/Info/ScsiInfo.cs +++ b/Aaru.Core/Media/Info/ScsiInfo.cs @@ -62,8 +62,7 @@ public sealed class ScsiInfo /// Device public ScsiInfo(Device dev) { - if(dev.Type != DeviceType.SCSI && - dev.Type != DeviceType.ATAPI) + if(dev.Type != DeviceType.SCSI && dev.Type != DeviceType.ATAPI) return; MediaType = MediaType.Unknown; @@ -210,11 +209,9 @@ public sealed class ScsiInfo if(!sense) ReadCapacity16 = cmdBuf; - if(ReadCapacity == null || - Blocks is 0xFFFFFFFF or 0) + if(ReadCapacity == null || Blocks is 0xFFFFFFFF or 0) { - if(ReadCapacity16 == null && - Blocks == 0) + if(ReadCapacity16 == null && Blocks == 0) { if(dev.ScsiType != PeripheralDeviceTypes.MultiMediaDevice) { @@ -234,8 +231,7 @@ public sealed class ScsiInfo } } - if(Blocks != 0 && - BlockSize != 0) + if(Blocks != 0 && BlockSize != 0) Blocks++; break; @@ -248,8 +244,7 @@ public sealed class ScsiInfo { sense = dev.ReportDensitySupport(out medBuf, out senseBuf, true, dev.Timeout, out _); - if(!sense && - !seqBuf.SequenceEqual(medBuf)) + if(!sense && !seqBuf.SequenceEqual(medBuf)) { DensitySupport = seqBuf; DensitySupportHeader = Decoders.SCSI.SSC.DensitySupport.DecodeDensity(seqBuf); @@ -262,8 +257,7 @@ public sealed class ScsiInfo { sense = dev.ReportDensitySupport(out medBuf, out senseBuf, true, true, dev.Timeout, out _); - if(!sense && - !seqBuf.SequenceEqual(medBuf)) + if(!sense && !seqBuf.SequenceEqual(medBuf)) { MediaTypeSupport = medBuf; MediaTypeSupportHeader = Decoders.SCSI.SSC.DensitySupport.DecodeMediumType(seqBuf); @@ -304,11 +298,9 @@ public sealed class ScsiInfo if(sense) { - AaruConsole.DebugWriteLine(MODULE_NAME, "READ GET CONFIGURATION:\n{0}", - Sense.PrettifySense(senseBuf)); + AaruConsole.DebugWriteLine(MODULE_NAME, "READ GET CONFIGURATION:\n{0}", Sense.PrettifySense(senseBuf)); - if(dev.IsUsb && - scsiMediumType is 0x40 or 0x41 or 0x42) + if(dev.IsUsb && scsiMediumType is 0x40 or 0x41 or 0x42) MediaType = MediaType.FlashDrive; } else @@ -316,8 +308,7 @@ public sealed class ScsiInfo MmcConfiguration = cmdBuf; Features.SeparatedFeatures ftr = Features.Separate(cmdBuf); - AaruConsole.DebugWriteLine(MODULE_NAME, - Localization.Core.GET_CONFIGURATION_current_profile_is_0, + AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Core.GET_CONFIGURATION_current_profile_is_0, ftr.CurrentProfile); switch(ftr.CurrentProfile) @@ -455,8 +446,7 @@ public sealed class ScsiInfo } } - if(MediaType == MediaType.PD650 && - Blocks == 1281856) + if(MediaType == MediaType.PD650 && Blocks == 1281856) MediaType = MediaType.PD650_WORM; sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.Dvd, 0, 0, @@ -476,8 +466,7 @@ public sealed class ScsiInfo if(sense) { - AaruConsole.DebugWriteLine(MODULE_NAME, - Localization.Core.READ_DISC_STRUCTURE_Write_Protection_Status_0, + AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Core.READ_DISC_STRUCTURE_Write_Protection_Status_0, Sense.PrettifySense(senseBuf)); } else @@ -496,10 +485,9 @@ public sealed class ScsiInfo if(MediaType is MediaType.DVDDownload or MediaType.DVDPR or MediaType.DVDPRDL or MediaType.DVDPRW or MediaType.DVDPRWDL or MediaType.DVDR or MediaType.DVDRAM or MediaType.DVDRDL - or MediaType.DVDROM - or MediaType.DVDRW or MediaType.DVDRWDL or MediaType.HDDVDR or MediaType.HDDVDRAM - or MediaType.HDDVDRDL - or MediaType.HDDVDROM or MediaType.HDDVDRW or MediaType.HDDVDRWDL) + or MediaType.DVDROM or MediaType.DVDRW or MediaType.DVDRWDL or MediaType.HDDVDR + or MediaType.HDDVDRAM or MediaType.HDDVDRDL or MediaType.HDDVDROM or MediaType.HDDVDRW + or MediaType.HDDVDRWDL) { sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.Dvd, 0, 0, MmcDiscStructureFormat.PhysicalInformation, 0, dev.Timeout, out _); @@ -614,8 +602,7 @@ public sealed class ScsiInfo if(sense) { - AaruConsole.DebugWriteLine(MODULE_NAME, - Localization.Core.READ_DISC_STRUCTURE_DVD_AACS_0, + AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Core.READ_DISC_STRUCTURE_DVD_AACS_0, Sense.PrettifySense(senseBuf)); } else @@ -645,8 +632,7 @@ public sealed class ScsiInfo if(sense) { - AaruConsole.DebugWriteLine(MODULE_NAME, - Localization.Core.READ_DISC_STRUCTURE_Medium_Status_0, + AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Core.READ_DISC_STRUCTURE_Medium_Status_0, Sense.PrettifySense(senseBuf)); } else @@ -779,8 +765,7 @@ public sealed class ScsiInfo if(sense) { - AaruConsole.DebugWriteLine(MODULE_NAME, - Localization.Core.READ_DISC_STRUCTURE_Pre_Recorded_Info_0, + AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Core.READ_DISC_STRUCTURE_Pre_Recorded_Info_0, Sense.PrettifySense(senseBuf)); } else @@ -807,8 +792,7 @@ public sealed class ScsiInfo if(sense) { - AaruConsole.DebugWriteLine(MODULE_NAME, - Localization.Core.READ_DISC_STRUCTURE_DVD_R_Media_ID_0, + AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Core.READ_DISC_STRUCTURE_DVD_R_Media_ID_0, Sense.PrettifySense(senseBuf)); } else @@ -820,8 +804,7 @@ public sealed class ScsiInfo if(sense) { - AaruConsole.DebugWriteLine(MODULE_NAME, - Localization.Core.READ_DISC_STRUCTURE_DVD_R_PFI_0, + AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Core.READ_DISC_STRUCTURE_DVD_R_PFI_0, Sense.PrettifySense(senseBuf)); } else @@ -876,8 +859,7 @@ public sealed class ScsiInfo if(sense) { - AaruConsole.DebugWriteLine(MODULE_NAME, - Localization.Core.READ_DISC_STRUCTURE_HD_DVD_CMI_0, + AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Core.READ_DISC_STRUCTURE_HD_DVD_CMI_0, Sense.PrettifySense(senseBuf)); } else @@ -911,8 +893,7 @@ public sealed class ScsiInfo if(sense) { - AaruConsole.DebugWriteLine(MODULE_NAME, - Localization.Core.READ_DISC_STRUCTURE_Last_RMD_0, + AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Core.READ_DISC_STRUCTURE_Last_RMD_0, Sense.PrettifySense(senseBuf)); } else @@ -932,8 +913,7 @@ public sealed class ScsiInfo if(sense) { - AaruConsole.DebugWriteLine(MODULE_NAME, - Localization.Core.READ_DISC_STRUCTURE_Layer_Capacity_0, + AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Core.READ_DISC_STRUCTURE_Layer_Capacity_0, Sense.PrettifySense(senseBuf)); } else @@ -1093,8 +1073,7 @@ public sealed class ScsiInfo if(sense) { - AaruConsole.DebugWriteLine(MODULE_NAME, - "READ DISC STRUCTURE: Spare Area Information\n{0}", + AaruConsole.DebugWriteLine(MODULE_NAME, "READ DISC STRUCTURE: Spare Area Information\n{0}", Sense.PrettifySense(senseBuf)); } else @@ -1105,8 +1084,7 @@ public sealed class ScsiInfo if(sense) { - AaruConsole.DebugWriteLine(MODULE_NAME, - Localization.Core.READ_DISC_STRUCTURE_Raw_DFL_0, + AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Core.READ_DISC_STRUCTURE_Raw_DFL_0, Sense.PrettifySense(senseBuf)); } else @@ -1192,8 +1170,7 @@ public sealed class ScsiInfo if(sense) { - AaruConsole.DebugWriteLine(MODULE_NAME, - Localization.Core.READ_TOC_PMA_ATIP_Session_Info_0, + AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Core.READ_TOC_PMA_ATIP_Session_Info_0, Sense.PrettifySense(senseBuf)); } else if(cmdBuf.Length > 4) @@ -1212,8 +1189,7 @@ public sealed class ScsiInfo if(sense) { - AaruConsole.DebugWriteLine(MODULE_NAME, - Localization.Core.READ_TOC_PMA_ATIP_Raw_TOC_0, + AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Core.READ_TOC_PMA_ATIP_Raw_TOC_0, Sense.PrettifySense(senseBuf)); } else if(cmdBuf.Length > 4) @@ -1237,8 +1213,7 @@ public sealed class ScsiInfo if(sense) { - AaruConsole.DebugWriteLine(MODULE_NAME, - Localization.Core.READ_TOC_PMA_ATIP_CD_TEXT_0, + AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Core.READ_TOC_PMA_ATIP_CD_TEXT_0, Sense.PrettifySense(senseBuf)); } else if(cmdBuf.Length > 4) @@ -1249,9 +1224,7 @@ public sealed class ScsiInfo sense = dev.ReadMcn(out string mcn, out _, out _, dev.Timeout, out _); - if(!sense && - mcn != null && - mcn != "0000000000000") + if(!sense && mcn != null && mcn != "0000000000000") Mcn = mcn; Isrcs = new Dictionary(); @@ -1260,9 +1233,7 @@ public sealed class ScsiInfo { sense = dev.ReadIsrc(i, out string isrc, out _, out _, dev.Timeout, out _); - if(!sense && - isrc != null && - isrc != "000000000000") + if(!sense && isrc != null && isrc != "000000000000") Isrcs.Add(i, isrc); } @@ -1277,8 +1248,7 @@ public sealed class ScsiInfo #region Nintendo - if(MediaType == MediaType.Unknown && - Blocks > 0) + if(MediaType == MediaType.Unknown && Blocks > 0) { sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.Dvd, 0, 0, MmcDiscStructureFormat.PhysicalInformation, 0, dev.Timeout, out _); @@ -1367,8 +1337,7 @@ public sealed class ScsiInfo DecodedXboxSecuritySector = SS.Decode(cmdBuf); // Get video partition size - AaruConsole.DebugWriteLine(MODULE_NAME, - Localization.Core.Getting_video_partition_size); + AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Core.Getting_video_partition_size); sense = dev.KreonLock(out senseBuf, dev.Timeout, out _); @@ -1401,11 +1370,12 @@ public sealed class ScsiInfo break; } - AaruConsole.DebugWriteLine(MODULE_NAME, - Localization.Core.Video_partition_total_size_0_sectors, totalSize); + AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Core.Video_partition_total_size_0_sectors, + totalSize); ulong l0Video = PFI.Decode(cmdBuf, MediaType).Value.Layer0EndPSN - - PFI.Decode(cmdBuf, MediaType).Value.DataAreaStartPSN + 1; + PFI.Decode(cmdBuf, MediaType).Value.DataAreaStartPSN + + 1; ulong l1Video = totalSize - l0Video + 1; @@ -1431,10 +1401,11 @@ public sealed class ScsiInfo ulong gameSize = ((ulong)((cmdBuf[0] << 24) + (cmdBuf[1] << 16) + (cmdBuf[2] << 8) + cmdBuf[3]) & - 0xFFFFFFFF) + 1; + 0xFFFFFFFF) + + 1; - AaruConsole.DebugWriteLine(MODULE_NAME, - Localization.Core.Game_partition_total_size_0_sectors, gameSize); + AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Core.Game_partition_total_size_0_sectors, + gameSize); // Get middle zone size AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Core.Getting_middle_zone_size); @@ -1469,12 +1440,15 @@ public sealed class ScsiInfo break; } - AaruConsole.DebugWriteLine(MODULE_NAME, - Localization.Core.Unlocked_total_size_0_sectors, totalSize); + AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Core.Unlocked_total_size_0_sectors, + totalSize); - ulong middleZone = - totalSize - (PFI.Decode(cmdBuf, MediaType).Value.Layer0EndPSN - - PFI.Decode(cmdBuf, MediaType).Value.DataAreaStartPSN + 1) - gameSize + 1; + ulong middleZone = totalSize - + (PFI.Decode(cmdBuf, MediaType).Value.Layer0EndPSN - + PFI.Decode(cmdBuf, MediaType).Value.DataAreaStartPSN + + 1) - + gameSize + + 1; totalSize = l0Video + l1Video + middleZone * 2 + gameSize; ulong layerBreak = l0Video + middleZone + gameSize / 2; @@ -1503,13 +1477,10 @@ public sealed class ScsiInfo break; } - if(MediaType == MediaType.Unknown && - dev.IsUsb && - containsFloppyPage) + if(MediaType == MediaType.Unknown && dev.IsUsb && containsFloppyPage) MediaType = MediaType.FlashDrive; - if(MediaType == MediaType.Unknown && - !dev.IsRemovable) + if(MediaType == MediaType.Unknown && !dev.IsRemovable) MediaType = MediaType.GENERIC_HDD; if(DeviceInfo.ScsiType != PeripheralDeviceTypes.MultiMediaDevice || diff --git a/Aaru.Core/Options.cs b/Aaru.Core/Options.cs index ed034fec4..9355477fa 100644 --- a/Aaru.Core/Options.cs +++ b/Aaru.Core/Options.cs @@ -88,8 +88,7 @@ public static class Options sb = new StringBuilder(); inValue = false; - if(string.IsNullOrEmpty(name) || - string.IsNullOrEmpty(value)) + if(string.IsNullOrEmpty(name) || string.IsNullOrEmpty(value)) continue; if(parsed.ContainsKey(name)) @@ -191,8 +190,7 @@ public static class Options value = sb.ToString(); - if(string.IsNullOrEmpty(name) || - string.IsNullOrEmpty(value)) + if(string.IsNullOrEmpty(name) || string.IsNullOrEmpty(value)) return parsed; if(parsed.ContainsKey(name)) diff --git a/Aaru.Core/Partitions.cs b/Aaru.Core/Partitions.cs index dedd7c2dc..014ff682c 100644 --- a/Aaru.Core/Partitions.cs +++ b/Aaru.Core/Partitions.cs @@ -206,8 +206,10 @@ public static class Partitions } } - Partition[] childArray = childPartitions.OrderBy(part => part.Start).ThenBy(part => part.Length). - ThenBy(part => part.Scheme).ToArray(); + Partition[] childArray = childPartitions.OrderBy(part => part.Start). + ThenBy(part => part.Length). + ThenBy(part => part.Scheme). + ToArray(); for(long i = 0; i < childArray.LongLength; i++) childArray[i].Sequence = (ulong)i; @@ -219,8 +221,7 @@ public static class Partitions /// List of partitions public static void AddSchemesToStats(List partitions) { - if(partitions == null || - partitions.Count == 0) + if(partitions == null || partitions.Count == 0) return; List schemes = new(); diff --git a/Aaru.Core/PluginBase.cs b/Aaru.Core/PluginBase.cs index 5f4c480fc..eaccd4915 100644 --- a/Aaru.Core/PluginBase.cs +++ b/Aaru.Core/PluginBase.cs @@ -112,15 +112,13 @@ public sealed class PluginBase { foreach(Type type in pluginRegister.GetAllFilesystemPlugins() ?? Enumerable.Empty()) { - if(Activator.CreateInstance(type) is IFilesystem plugin && - !Filesystems.ContainsKey(plugin.Name.ToLower())) + if(Activator.CreateInstance(type) is IFilesystem plugin && !Filesystems.ContainsKey(plugin.Name.ToLower())) Filesystems.Add(plugin.Name.ToLower(), type); } foreach(Type type in pluginRegister.GetAllFilterPlugins() ?? Enumerable.Empty()) { - if(Activator.CreateInstance(type) is IFilter plugin && - !Filters.ContainsKey(plugin.Name.ToLower())) + if(Activator.CreateInstance(type) is IFilter plugin && !Filters.ContainsKey(plugin.Name.ToLower())) Filters.Add(plugin.Name.ToLower(), type); } @@ -133,15 +131,13 @@ public sealed class PluginBase foreach(Type type in pluginRegister.GetAllMediaImagePlugins() ?? Enumerable.Empty()) { - if(Activator.CreateInstance(type) is IMediaImage plugin && - !MediaImages.ContainsKey(plugin.Name.ToLower())) + if(Activator.CreateInstance(type) is IMediaImage plugin && !MediaImages.ContainsKey(plugin.Name.ToLower())) MediaImages.Add(plugin.Name.ToLower(), type); } foreach(Type type in pluginRegister.GetAllPartitionPlugins() ?? Enumerable.Empty()) { - if(Activator.CreateInstance(type) is IPartition plugin && - !Partitions.ContainsKey(plugin.Name.ToLower())) + if(Activator.CreateInstance(type) is IPartition plugin && !Partitions.ContainsKey(plugin.Name.ToLower())) Partitions.Add(plugin.Name.ToLower(), type); } @@ -168,8 +164,7 @@ public sealed class PluginBase foreach(Type type in pluginRegister.GetAllArchivePlugins() ?? Enumerable.Empty()) { - if(Activator.CreateInstance(type) is IArchive plugin && - !Archives.ContainsKey(plugin.Name.ToLower())) + if(Activator.CreateInstance(type) is IArchive plugin && !Archives.ContainsKey(plugin.Name.ToLower())) Archives.Add(plugin.Name.ToLower(), type); } diff --git a/Aaru.Core/PrintScsiModePages.cs b/Aaru.Core/PrintScsiModePages.cs index 7e7a9a152..17e769a12 100644 --- a/Aaru.Core/PrintScsiModePages.cs +++ b/Aaru.Core/PrintScsiModePages.cs @@ -59,8 +59,7 @@ public static class PrintScsiModePages { case 0x00: { - if(devType == PeripheralDeviceTypes.MultiMediaDevice && - page.Subpage == 0) + if(devType == PeripheralDeviceTypes.MultiMediaDevice && page.Subpage == 0) AaruConsole.WriteLine(Modes.PrettifyModePage_00_SFF(page.PageResponse)); else { diff --git a/Aaru.Core/Remote.cs b/Aaru.Core/Remote.cs index b5d72f6c8..70f04e688 100644 --- a/Aaru.Core/Remote.cs +++ b/Aaru.Core/Remote.cs @@ -79,7 +79,8 @@ public static class Remote HttpResponseMessage response = httpClient. PostAsync("/api/uploadreportv2", new StringContent(json, Encoding.UTF8, - "application/json")).GetAwaiter(). + "application/json")). + GetAwaiter(). GetResult(); if(!response.IsSuccessStatusCode) @@ -121,8 +122,7 @@ public static class Remote mctx.Database.EnsureCreated(); mctx.Database. - ExecuteSqlRaw( - "CREATE TABLE IF NOT EXISTS \"__EFMigrationsHistory\" (\"MigrationId\" TEXT PRIMARY KEY, \"ProductVersion\" TEXT)"); + ExecuteSqlRaw("CREATE TABLE IF NOT EXISTS \"__EFMigrationsHistory\" (\"MigrationId\" TEXT PRIMARY KEY, \"ProductVersion\" TEXT)"); foreach(string migration in mctx.Database.GetPendingMigrations()) { @@ -198,7 +198,9 @@ public static class Remote if(create) { - AnsiConsole.Progress().AutoClear(true).HideCompleted(true). + AnsiConsole.Progress(). + AutoClear(true). + HideCompleted(true). Columns(new TaskDescriptionColumn(), new ProgressBarColumn(), new PercentageColumn()). Start(ctx => { @@ -214,7 +216,9 @@ public static class Remote AaruConsole.WriteLine(Localization.Core.Added_0_usb_vendors, sync.UsbVendors.Count); - AnsiConsole.Progress().AutoClear(true).HideCompleted(true). + AnsiConsole.Progress(). + AutoClear(true). + HideCompleted(true). Columns(new TaskDescriptionColumn(), new ProgressBarColumn(), new PercentageColumn()). Start(ctx => { @@ -232,7 +236,9 @@ public static class Remote AaruConsole.WriteLine(Localization.Core.Added_0_usb_products, sync.UsbProducts.Count); - AnsiConsole.Progress().AutoClear(true).HideCompleted(true). + AnsiConsole.Progress(). + AutoClear(true). + HideCompleted(true). Columns(new TaskDescriptionColumn(), new ProgressBarColumn(), new PercentageColumn()). Start(ctx => { @@ -252,7 +258,9 @@ public static class Remote AaruConsole.WriteLine(Localization.Core.Added_0_CompactDisc_read_offsets, sync.Offsets.Count); - AnsiConsole.Progress().AutoClear(true).HideCompleted(true). + AnsiConsole.Progress(). + AutoClear(true). + HideCompleted(true). Columns(new TaskDescriptionColumn(), new ProgressBarColumn(), new PercentageColumn()). Start(ctx => { @@ -273,7 +281,9 @@ public static class Remote AaruConsole.WriteLine(Localization.Core.Added_0_known_devices, sync.Devices.Count); - AnsiConsole.Progress().AutoClear(true).HideCompleted(true). + AnsiConsole.Progress(). + AutoClear(true). + HideCompleted(true). Columns(new TaskDescriptionColumn(), new ProgressBarColumn(), new PercentageColumn()). Start(ctx => { @@ -321,7 +331,9 @@ public static class Remote long modifiedDevices = 0; long modifiedNesHeaders = 0; - AnsiConsole.Progress().AutoClear(true).HideCompleted(true). + AnsiConsole.Progress(). + AutoClear(true). + HideCompleted(true). Columns(new TaskDescriptionColumn(), new ProgressBarColumn(), new PercentageColumn()). Start(ctx => { @@ -352,7 +364,9 @@ public static class Remote AaruConsole.WriteLine(Localization.Core.Added_0_usb_vendors, addedVendors); AaruConsole.WriteLine(Localization.Core.Modified_0_USB_vendors, modifiedVendors); - AnsiConsole.Progress().AutoClear(true).HideCompleted(true). + AnsiConsole.Progress(). + AutoClear(true). + HideCompleted(true). Columns(new TaskDescriptionColumn(), new ProgressBarColumn(), new PercentageColumn()). Start(ctx => { @@ -387,7 +401,9 @@ public static class Remote AaruConsole.WriteLine(Localization.Core.Added_0_usb_products, addedProducts); AaruConsole.WriteLine(Localization.Core.Modified_0_USB_products, modifiedProducts); - AnsiConsole.Progress().AutoClear(true).HideCompleted(true). + AnsiConsole.Progress(). + AutoClear(true). + HideCompleted(true). Columns(new TaskDescriptionColumn(), new ProgressBarColumn(), new PercentageColumn()). Start(ctx => { @@ -425,7 +441,9 @@ public static class Remote AaruConsole.WriteLine(Localization.Core.Added_0_CompactDisc_read_offsets, addedOffsets); AaruConsole.WriteLine(Localization.Core.Modified_0_CompactDisc_read_offsets, modifiedOffsets); - AnsiConsole.Progress().AutoClear(true).HideCompleted(true). + AnsiConsole.Progress(). + AutoClear(true). + HideCompleted(true). Columns(new TaskDescriptionColumn(), new ProgressBarColumn(), new PercentageColumn()). Start(ctx => { @@ -469,7 +487,9 @@ public static class Remote AaruConsole.WriteLine(Localization.Core.Added_0_known_devices, addedDevices); AaruConsole.WriteLine(Localization.Core.Modified_0_known_devices, modifiedDevices); - AnsiConsole.Progress().AutoClear(true).HideCompleted(true). + AnsiConsole.Progress(). + AutoClear(true). + HideCompleted(true). Columns(new TaskDescriptionColumn(), new ProgressBarColumn(), new PercentageColumn()). Start(ctx => { diff --git a/Aaru.Core/Sidecar/AudioMedia.cs b/Aaru.Core/Sidecar/AudioMedia.cs index 0a37ea915..a8603ba82 100644 --- a/Aaru.Core/Sidecar/AudioMedia.cs +++ b/Aaru.Core/Sidecar/AudioMedia.cs @@ -74,8 +74,7 @@ public sealed partial class Sidecar } }; - if(image.Info.MediaSequence != 0 && - image.Info.LastMediaSequence != 0) + if(image.Info.MediaSequence != 0 && image.Info.LastMediaSequence != 0) { sidecar.AudioMedias[0].Sequence.MediaSequence = (uint)image.Info.MediaSequence; sidecar.AudioMedias[0].Sequence.TotalMedia = (uint)image.Info.LastMediaSequence; diff --git a/Aaru.Core/Sidecar/BlockMedia.cs b/Aaru.Core/Sidecar/BlockMedia.cs index 62d1300ec..d5cb7f500 100644 --- a/Aaru.Core/Sidecar/BlockMedia.cs +++ b/Aaru.Core/Sidecar/BlockMedia.cs @@ -90,8 +90,7 @@ public sealed partial class Sidecar } }; - if(image.Info.MediaSequence != 0 && - image.Info.LastMediaSequence != 0) + if(image.Info.MediaSequence != 0 && image.Info.LastMediaSequence != 0) { sidecar.BlockMedias[0].Sequence.MediaSequence = (uint)image.Info.MediaSequence; sidecar.BlockMedias[0].Sequence.TotalMedia = (uint)image.Info.LastMediaSequence; @@ -570,7 +569,7 @@ public sealed partial class Sidecar List filesInPartition = new(); foreach(CommonTypes.Structs.TapeFile tapeFile in - tapeImage.Files.Where(f => f.Partition == tapePartition.Number)) + tapeImage.Files.Where(f => f.Partition == tapePartition.Number)) { var thisFile = new TapeFile { @@ -827,8 +826,7 @@ public sealed partial class Sidecar UpdateStatus(Localization.Core.Saving_metadata); - if(image.Info.Cylinders > 0 && - image.Info is { Heads: > 0, SectorsPerTrack: > 0 }) + if(image.Info.Cylinders > 0 && image.Info is { Heads: > 0, SectorsPerTrack: > 0 }) { sidecar.BlockMedias[0].Cylinders = image.Info.Cylinders; sidecar.BlockMedias[0].Heads = (ushort)image.Info.Heads; @@ -1005,8 +1003,7 @@ public sealed partial class Sidecar var scpFilter = new ZZZNoFilter(); scpFilter.Open(scpFilePath); - if(image.Info.Heads <= 2 && - scpImage.Identify(scpFilter)) + if(image.Info.Heads <= 2 && scpImage.Identify(scpFilter)) { try { @@ -1053,8 +1050,10 @@ public sealed partial class Sidecar if(scpImage.ScpTracks.TryGetValue(t, out SuperCardPro.TrackHeader scpTrack)) { var trackContents = - new byte[scpTrack.Entries.Last().dataOffset + scpTrack.Entries.Last().trackLength - - scpImage.Header.offsets[t] + 1]; + new byte[scpTrack.Entries.Last().dataOffset + + scpTrack.Entries.Last().trackLength - + scpImage.Header.offsets[t] + + 1]; scpStream.Position = scpImage.Header.offsets[t]; scpStream.EnsureRead(trackContents, 0, trackContents.Length); @@ -1066,14 +1065,14 @@ public sealed partial class Sidecar } sidecar.BlockMedias[0].Track = scpBlockTrackTypes.OrderBy(t => t.Cylinder). - ThenBy(t => t.Head).ToList(); + ThenBy(t => t.Head). + ToList(); } else { AaruConsole. - ErrorWriteLine( - Localization.Core.SCP_image_do_not_same_number_tracks_0_disk_image_1_ignoring, - scpImage.Header.end + 1, image.Info.Cylinders); + ErrorWriteLine(Localization.Core.SCP_image_do_not_same_number_tracks_0_disk_image_1_ignoring, + scpImage.Header.end + 1, image.Info.Cylinders); } } else @@ -1121,8 +1120,7 @@ public sealed partial class Sidecar var kfFilter = new ZZZNoFilter(); kfFilter.Open(kfFile); - if(image.Info.Heads <= 2 && - kfImage.Identify(kfFilter)) + if(image.Info.Heads <= 2 && kfImage.Identify(kfFilter)) { try { @@ -1180,22 +1178,21 @@ public sealed partial class Sidecar } sidecar.BlockMedias[0].Track = kfBlockTrackTypes.OrderBy(t => t.Cylinder). - ThenBy(t => t.Head).ToList(); + ThenBy(t => t.Head). + ToList(); } else { AaruConsole. - ErrorWriteLine( - Localization.Core.KryoFlux_image_do_not_same_number_tracks_0_disk_image_1_ignoring, - kfImage.Info.Cylinders, image.Info.Cylinders); + ErrorWriteLine(Localization.Core.KryoFlux_image_do_not_same_number_tracks_0_disk_image_1_ignoring, + kfImage.Info.Cylinders, image.Info.Cylinders); } } else { AaruConsole. - ErrorWriteLine( - Localization.Core.KryoFlux_image_do_not_same_number_heads_0_disk_image_1_ignoring, - kfImage.Info.Heads, image.Info.Heads); + ErrorWriteLine(Localization.Core.KryoFlux_image_do_not_same_number_heads_0_disk_image_1_ignoring, + kfImage.Info.Heads, image.Info.Heads); } } } diff --git a/Aaru.Core/Sidecar/Files.cs b/Aaru.Core/Sidecar/Files.cs index 40a786546..afb1d0aaa 100644 --- a/Aaru.Core/Sidecar/Files.cs +++ b/Aaru.Core/Sidecar/Files.cs @@ -55,8 +55,7 @@ public sealed partial class Sidecar List directories = new(); List files = new(); - while(filesystem.ReadDir(node, out string dirent) == ErrorNumber.NoError && - dirent is not null) + while(filesystem.ReadDir(node, out string dirent) == ErrorNumber.NoError && dirent is not null) { ret = filesystem.Stat(dirent, out FileEntryInfo stat); @@ -115,8 +114,7 @@ public sealed partial class Sidecar List directories = new(); List files = new(); - while(filesystem.ReadDir(node, out string dirent) == ErrorNumber.NoError && - dirent is not null) + while(filesystem.ReadDir(node, out string dirent) == ErrorNumber.NoError && dirent is not null) { ret = filesystem.Stat(path + "/" + filename + "/" + dirent, out FileEntryInfo entryStat); diff --git a/Aaru.Core/Sidecar/OpticalDisc.cs b/Aaru.Core/Sidecar/OpticalDisc.cs index 273151f1d..2dabf6a04 100644 --- a/Aaru.Core/Sidecar/OpticalDisc.cs +++ b/Aaru.Core/Sidecar/OpticalDisc.cs @@ -86,8 +86,7 @@ public sealed partial class Sidecar } }; - if(image.Info.MediaSequence != 0 && - image.Info.LastMediaSequence != 0) + if(image.Info.MediaSequence != 0 && image.Info.LastMediaSequence != 0) { sidecar.OpticalDiscs[0].Sequence.MediaSequence = (uint)image.Info.MediaSequence; sidecar.OpticalDiscs[0].Sequence.TotalMedia = (uint)image.Info.LastMediaSequence; @@ -183,16 +182,13 @@ public sealed partial class Sidecar _ => dskType }; - if(dskType == MediaType.DVDR && - pfi.Value.PartVersion >= 6) + if(dskType == MediaType.DVDR && pfi.Value.PartVersion >= 6) dskType = MediaType.DVDRDL; - if(dskType == MediaType.DVDRW && - pfi.Value.PartVersion >= 15) + if(dskType == MediaType.DVDRW && pfi.Value.PartVersion >= 15) dskType = MediaType.DVDRWDL; - if(dskType == MediaType.GOD && - pfi.Value.DiscSize == DVDSize.OneTwenty) + if(dskType == MediaType.GOD && pfi.Value.DiscSize == DVDSize.OneTwenty) dskType = MediaType.WOD; sidecar.OpticalDiscs[0].Dimensions = new Dimensions(); @@ -246,8 +242,7 @@ public sealed partial class Sidecar trksLst = new List(); } - if(sidecar.OpticalDiscs[0].Dimensions == null && - image.Info.MediaType != MediaType.Unknown) + if(sidecar.OpticalDiscs[0].Dimensions == null && image.Info.MediaType != MediaType.Unknown) sidecar.OpticalDiscs[0].Dimensions = Dimensions.FromMediaType(image.Info.MediaType); if(_aborted) @@ -299,8 +294,7 @@ public sealed partial class Sidecar xmlTrk.StartSector = trk.StartSector; xmlTrk.EndSector = trk.EndSector; - if(trk.Indexes?.TryGetValue(0, out int idx0) == true && - idx0 >= 0) + if(trk.Indexes?.TryGetValue(0, out int idx0) == true && idx0 >= 0) xmlTrk.StartSector = (ulong)idx0; switch(sidecar.OpticalDiscs[0].DiscType) @@ -513,8 +507,7 @@ public sealed partial class Sidecar // For fast debugging, skip checksum //skipChecksum: - var trkPartitions = - partitions.Where(p => p.Start >= trk.StartSector && p.End <= trk.EndSector).ToList(); + var trkPartitions = partitions.Where(p => p.Start >= trk.StartSector && p.End <= trk.EndSector).ToList(); xmlTrk.FileSystemInformation = new List(); @@ -663,11 +656,13 @@ public sealed partial class Sidecar if(trk.Indexes?.Count > 0) { - xmlTrk.Indexes = trk.Indexes?.OrderBy(i => i.Key).Select(i => new TrackIndex - { - Index = i.Key, - Value = i.Value - }).ToList(); + xmlTrk.Indexes = trk.Indexes?.OrderBy(i => i.Key). + Select(i => new TrackIndex + { + Index = i.Key, + Value = i.Value + }). + ToList(); } trksLst.Add(xmlTrk); @@ -679,10 +674,10 @@ public sealed partial class Sidecar sidecar.OpticalDiscs[0].Track = trksLst; // All XGD3 all have the same number of blocks - if(dskType == MediaType.XGD2 && - sidecar.OpticalDiscs[0].Track.Count == 1) + if(dskType == MediaType.XGD2 && sidecar.OpticalDiscs[0].Track.Count == 1) { - ulong blocks = sidecar.OpticalDiscs[0].Track[0].EndSector - sidecar.OpticalDiscs[0].Track[0].StartSector + + ulong blocks = sidecar.OpticalDiscs[0].Track[0].EndSector - + sidecar.OpticalDiscs[0].Track[0].StartSector + 1; if(blocks is 25063 or 4229664 or 4246304) // Wxripper unlock diff --git a/Aaru.Core/Spectre.cs b/Aaru.Core/Spectre.cs index 2a6306ec2..66b1903a8 100644 --- a/Aaru.Core/Spectre.cs +++ b/Aaru.Core/Spectre.cs @@ -8,6 +8,9 @@ public static class Spectre { /// Initializes a progress bar with a single spinner /// Action to execute in the progress bar - public static void ProgressSingleSpinner(Action action) => AnsiConsole.Progress().AutoClear(true). - HideCompleted(true).Columns(new TaskDescriptionColumn(), new SpinnerColumn()).Start(action); + public static void ProgressSingleSpinner(Action action) => AnsiConsole.Progress(). + AutoClear(true). + HideCompleted(true). + Columns(new TaskDescriptionColumn(), new SpinnerColumn()). + Start(action); } \ No newline at end of file diff --git a/Aaru.Core/Statistics.cs b/Aaru.Core/Statistics.cs index 1f9130573..a14eac227 100644 --- a/Aaru.Core/Statistics.cs +++ b/Aaru.Core/Statistics.cs @@ -160,7 +160,8 @@ public static class Statistics { dto.Filesystems = new List(); - foreach(string nvs in ctx.Filesystems.Where(c => !c.Synchronized).Select(c => c.Name). + foreach(string nvs in ctx.Filesystems.Where(c => !c.Synchronized). + Select(c => c.Name). Distinct()) { dto.Filesystems.Add(new NameValueStats @@ -189,7 +190,8 @@ public static class Statistics { dto.MediaFormats = new List(); - foreach(string nvs in ctx.MediaFormats.Where(c => !c.Synchronized).Select(c => c.Name). + foreach(string nvs in ctx.MediaFormats.Where(c => !c.Synchronized). + Select(c => c.Name). Distinct()) { dto.MediaFormats.Add(new NameValueStats @@ -277,19 +279,22 @@ public static class Statistics { dto.OperatingSystems = new List(); - foreach(string osName in ctx.OperatingSystems.Where(c => !c.Synchronized).Select(c => c.Name). + foreach(string osName in ctx.OperatingSystems.Where(c => !c.Synchronized). + Select(c => c.Name). Distinct()) { foreach(string osVersion in ctx.OperatingSystems. Where(c => !c.Synchronized && c.Name == osName). - Select(c => c.Version).Distinct()) + Select(c => c.Version). + Distinct()) { dto.OperatingSystems.Add(new OsStats { name = osName, version = osVersion, - Value = ctx.OperatingSystems.LongCount(c => !c.Synchronized && c.Name == osName && - c.Version == osVersion) + Value = ctx.OperatingSystems.LongCount(c => !c.Synchronized && + c.Name == osName && + c.Version == osVersion) }); } } @@ -300,12 +305,14 @@ public static class Statistics dto.RemoteApplications = new List(); foreach(string remoteAppName in ctx.RemoteApplications.Where(c => !c.Synchronized). - Select(c => c.Name).Distinct()) + Select(c => c.Name). + Distinct()) { foreach(string remoteAppVersion in ctx.RemoteApplications. Where(c => !c.Synchronized && c.Name == remoteAppName). - Select(c => c.Version).Distinct()) + Select(c => c.Version). + Distinct()) { dto.RemoteApplications.Add(new OsStats { @@ -323,7 +330,8 @@ public static class Statistics { dto.RemoteArchitectures = new List(); - foreach(string nvs in ctx.RemoteArchitectures.Where(c => !c.Synchronized).Select(c => c.Name). + foreach(string nvs in ctx.RemoteArchitectures.Where(c => !c.Synchronized). + Select(c => c.Name). Distinct()) { dto.RemoteArchitectures.Add(new NameValueStats @@ -339,18 +347,21 @@ public static class Statistics dto.RemoteOperatingSystems = new List(); foreach(string remoteOsName in ctx.RemoteOperatingSystems.Where(c => !c.Synchronized). - Select(c => c.Name).Distinct()) + Select(c => c.Name). + Distinct()) { foreach(string remoteOsVersion in ctx.RemoteOperatingSystems. Where(c => !c.Synchronized && c.Name == remoteOsName). - Select(c => c.Version).Distinct()) + Select(c => c.Version). + Distinct()) { dto.RemoteOperatingSystems.Add(new OsStats { - name = remoteOsName, + name = remoteOsName, version = remoteOsVersion, Value = ctx.RemoteOperatingSystems.LongCount(c => !c.Synchronized && - c.Name == remoteOsName && c.Version == remoteOsVersion) + c.Name == remoteOsName && + c.Version == remoteOsVersion) }); } } @@ -410,11 +421,13 @@ public static class Statistics if(ctx.Filesystems.Any(c => !c.Synchronized)) { - foreach(string nvs in ctx.Filesystems.Where(c => !c.Synchronized).Select(c => c.Name). + foreach(string nvs in ctx.Filesystems.Where(c => !c.Synchronized). + Select(c => c.Name). Distinct()) { Filesystem existing = - ctx.Filesystems.FirstOrDefault(c => c.Synchronized && c.Name == nvs) ?? new Filesystem + ctx.Filesystems.FirstOrDefault(c => c.Synchronized && c.Name == nvs) ?? + new Filesystem { Name = nvs, Synchronized = true @@ -447,11 +460,13 @@ public static class Statistics if(ctx.MediaFormats.Any(c => !c.Synchronized)) { - foreach(string nvs in ctx.MediaFormats.Where(c => !c.Synchronized).Select(c => c.Name). + foreach(string nvs in ctx.MediaFormats.Where(c => !c.Synchronized). + Select(c => c.Name). Distinct()) { MediaFormat existing = - ctx.MediaFormats.FirstOrDefault(c => c.Synchronized && c.Name == nvs) ?? new MediaFormat + ctx.MediaFormats.FirstOrDefault(c => c.Synchronized && c.Name == nvs) ?? + new MediaFormat { Name = nvs, Synchronized = true @@ -469,12 +484,12 @@ public static class Statistics { foreach(string nvs in ctx.Partitions.Where(c => !c.Synchronized).Select(c => c.Name).Distinct()) { - Partition existing = - ctx.Partitions.FirstOrDefault(c => c.Synchronized && c.Name == nvs) ?? new Partition - { - Name = nvs, - Synchronized = true - }; + Partition existing = ctx.Partitions.FirstOrDefault(c => c.Synchronized && c.Name == nvs) ?? + new Partition + { + Name = nvs, + Synchronized = true + }; existing.Count += (ulong)ctx.Partitions.LongCount(c => !c.Synchronized && c.Name == nvs); @@ -520,7 +535,8 @@ public static class Statistics ctx.Medias.Update(existing); - ctx.Medias.RemoveRange(ctx.Medias.Where(c => !c.Synchronized && c.Type == media && + ctx.Medias.RemoveRange(ctx.Medias.Where(c => !c.Synchronized && + c.Type == media && c.Real)); } @@ -542,7 +558,8 @@ public static class Statistics ctx.Medias.Update(existing); - ctx.Medias.RemoveRange(ctx.Medias.Where(c => !c.Synchronized && c.Type == media && + ctx.Medias.RemoveRange(ctx.Medias.Where(c => !c.Synchronized && + c.Type == media && !c.Real)); } } @@ -559,16 +576,19 @@ public static class Statistics if(ctx.OperatingSystems.Any(c => !c.Synchronized)) { - foreach(string osName in ctx.OperatingSystems.Where(c => !c.Synchronized).Select(c => c.Name). + foreach(string osName in ctx.OperatingSystems.Where(c => !c.Synchronized). + Select(c => c.Name). Distinct()) { foreach(string osVersion in ctx.OperatingSystems. Where(c => !c.Synchronized && c.Name == osName). - Select(c => c.Version).Distinct()) + Select(c => c.Version). + Distinct()) { OperatingSystem existing = - ctx.OperatingSystems.FirstOrDefault(c => c.Synchronized && c.Name == osName && - c.Version == osVersion) ?? + ctx.OperatingSystems.FirstOrDefault(c => c.Synchronized && + c.Name == osName && + c.Version == osVersion) ?? new OperatingSystem { Synchronized = true, @@ -577,14 +597,15 @@ public static class Statistics }; existing.Count += - (ulong)ctx.OperatingSystems.LongCount(c => !c.Synchronized && c.Name == osName && - c.Version == osVersion); + (ulong)ctx.OperatingSystems.LongCount(c => !c.Synchronized && + c.Name == osName && + c.Version == osVersion); ctx.OperatingSystems.Update(existing); ctx.OperatingSystems.RemoveRange(ctx.OperatingSystems.Where(c => !c.Synchronized && - c.Name == osName && - c.Version == osVersion)); + c.Name == osName && + c.Version == osVersion)); } } } @@ -592,12 +613,14 @@ public static class Statistics if(ctx.RemoteApplications.Any(c => !c.Synchronized)) { foreach(string remoteAppName in ctx.RemoteApplications.Where(c => !c.Synchronized). - Select(c => c.Name).Distinct()) + Select(c => c.Name). + Distinct()) { foreach(string remoteAppVersion in ctx.RemoteApplications. Where(c => !c.Synchronized && c.Name == remoteAppName). - Select(c => c.Version).Distinct()) + Select(c => c.Version). + Distinct()) { RemoteApplication existing = ctx.RemoteApplications.FirstOrDefault(c => c.Synchronized && @@ -618,15 +641,16 @@ public static class Statistics ctx.RemoteApplications.Update(existing); ctx.RemoteApplications.RemoveRange(ctx.RemoteApplications.Where(c => !c.Synchronized && - c.Name == remoteAppName && - c.Version == remoteAppVersion)); + c.Name == remoteAppName && + c.Version == remoteAppVersion)); } } } if(ctx.RemoteArchitectures.Any(c => !c.Synchronized)) { - foreach(string nvs in ctx.RemoteArchitectures.Where(c => !c.Synchronized).Select(c => c.Name). + foreach(string nvs in ctx.RemoteArchitectures.Where(c => !c.Synchronized). + Select(c => c.Name). Distinct()) { RemoteArchitecture existing = @@ -643,16 +667,18 @@ public static class Statistics ctx.RemoteArchitectures.Update(existing); ctx.RemoteArchitectures.RemoveRange(ctx.RemoteArchitectures.Where(c => !c.Synchronized && - c.Name == nvs)); + c.Name == nvs)); } } foreach(string remoteOsName in ctx.RemoteOperatingSystems.Where(c => !c.Synchronized). - Select(c => c.Name).Distinct()) + Select(c => c.Name). + Distinct()) { foreach(string remoteOsVersion in ctx.RemoteOperatingSystems. Where(c => !c.Synchronized && c.Name == remoteOsName). - Select(c => c.Version).Distinct()) + Select(c => c.Version). + Distinct()) { RemoteOperatingSystem existing = ctx.RemoteOperatingSystems.FirstOrDefault(c => c.Synchronized && @@ -673,9 +699,9 @@ public static class Statistics ctx.RemoteOperatingSystems.Update(existing); ctx.RemoteOperatingSystems.RemoveRange(ctx.RemoteOperatingSystems.Where(c => - !c.Synchronized && - c.Name == remoteOsName && - c.Version == remoteOsVersion)); + !c.Synchronized && + c.Name == remoteOsName && + c.Version == remoteOsVersion)); } } @@ -876,8 +902,10 @@ public static class Statistics using var ctx = AaruContext.Create(Settings.Settings.LocalDbPath); - if(ctx.SeenDevices.Any(d => d.Manufacturer == dev.Manufacturer && d.Model == dev.Model && - d.Revision == dev.FirmwareRevision && d.Bus == deviceBus)) + if(ctx.SeenDevices.Any(d => d.Manufacturer == dev.Manufacturer && + d.Model == dev.Model && + d.Revision == dev.FirmwareRevision && + d.Bus == deviceBus)) return; ctx.SeenDevices.Add(new DeviceStat diff --git a/Aaru.Database/Context.cs b/Aaru.Database/Context.cs index 393291509..7e5562fcd 100644 --- a/Aaru.Database/Context.cs +++ b/Aaru.Database/Context.cs @@ -120,136 +120,208 @@ public sealed class AaruContext : DbContext base.OnModelCreating(modelBuilder); modelBuilder.Entity("Aaru.CommonTypes.Metadata.Ata", - b => b.HasOne("Aaru.CommonTypes.Metadata.TestedMedia", "ReadCapabilities").WithMany(). - HasForeignKey("ReadCapabilitiesId").OnDelete(DeleteBehavior.SetNull)); + b => b.HasOne("Aaru.CommonTypes.Metadata.TestedMedia", "ReadCapabilities"). + WithMany(). + HasForeignKey("ReadCapabilitiesId"). + OnDelete(DeleteBehavior.SetNull)); modelBuilder.Entity("Aaru.CommonTypes.Metadata.BlockDescriptor", - b => b.HasOne("Aaru.CommonTypes.Metadata.ScsiMode", null).WithMany("BlockDescriptors"). - HasForeignKey("ScsiModeId").OnDelete(DeleteBehavior.Cascade)); + b => b.HasOne("Aaru.CommonTypes.Metadata.ScsiMode", null). + WithMany("BlockDescriptors"). + HasForeignKey("ScsiModeId"). + OnDelete(DeleteBehavior.Cascade)); modelBuilder.Entity("Aaru.CommonTypes.Metadata.DensityCode", - b => b.HasOne("Aaru.CommonTypes.Metadata.SscSupportedMedia", null).WithMany("DensityCodes"). - HasForeignKey("SscSupportedMediaId").OnDelete(DeleteBehavior.Cascade)); + b => b.HasOne("Aaru.CommonTypes.Metadata.SscSupportedMedia", null). + WithMany("DensityCodes"). + HasForeignKey("SscSupportedMediaId"). + OnDelete(DeleteBehavior.Cascade)); modelBuilder.Entity("Aaru.CommonTypes.Metadata.Mmc", - b => b.HasOne("Aaru.CommonTypes.Metadata.MmcFeatures", "Features").WithMany(). - HasForeignKey("FeaturesId").OnDelete(DeleteBehavior.SetNull)); + b => b.HasOne("Aaru.CommonTypes.Metadata.MmcFeatures", "Features"). + WithMany(). + HasForeignKey("FeaturesId"). + OnDelete(DeleteBehavior.SetNull)); modelBuilder.Entity("Aaru.CommonTypes.Metadata.Scsi", b => { - b.HasOne("Aaru.CommonTypes.Metadata.ScsiMode", "ModeSense").WithMany().HasForeignKey("ModeSenseId"). + b.HasOne("Aaru.CommonTypes.Metadata.ScsiMode", "ModeSense"). + WithMany(). + HasForeignKey("ModeSenseId"). OnDelete(DeleteBehavior.SetNull); - b.HasOne("Aaru.CommonTypes.Metadata.Mmc", "MultiMediaDevice").WithMany(). - HasForeignKey("MultiMediaDeviceId").OnDelete(DeleteBehavior.SetNull); + b.HasOne("Aaru.CommonTypes.Metadata.Mmc", "MultiMediaDevice"). + WithMany(). + HasForeignKey("MultiMediaDeviceId"). + OnDelete(DeleteBehavior.SetNull); - b.HasOne("Aaru.CommonTypes.Metadata.TestedMedia", "ReadCapabilities").WithMany(). - HasForeignKey("ReadCapabilitiesId").OnDelete(DeleteBehavior.SetNull); + b.HasOne("Aaru.CommonTypes.Metadata.TestedMedia", "ReadCapabilities"). + WithMany(). + HasForeignKey("ReadCapabilitiesId"). + OnDelete(DeleteBehavior.SetNull); - b.HasOne("Aaru.CommonTypes.Metadata.Ssc", "SequentialDevice").WithMany(). - HasForeignKey("SequentialDeviceId").OnDelete(DeleteBehavior.SetNull); + b.HasOne("Aaru.CommonTypes.Metadata.Ssc", "SequentialDevice"). + WithMany(). + HasForeignKey("SequentialDeviceId"). + OnDelete(DeleteBehavior.SetNull); }); modelBuilder.Entity("Aaru.CommonTypes.Metadata.ScsiPage", b => { - b.HasOne("Aaru.CommonTypes.Metadata.Scsi", null).WithMany("EVPDPages").HasForeignKey("ScsiId"). + b.HasOne("Aaru.CommonTypes.Metadata.Scsi", null). + WithMany("EVPDPages"). + HasForeignKey("ScsiId"). OnDelete(DeleteBehavior.SetNull); - b.HasOne("Aaru.CommonTypes.Metadata.ScsiMode", null).WithMany("ModePages").HasForeignKey("ScsiModeId"). + b.HasOne("Aaru.CommonTypes.Metadata.ScsiMode", null). + WithMany("ModePages"). + HasForeignKey("ScsiModeId"). OnDelete(DeleteBehavior.SetNull); }); modelBuilder.Entity("Aaru.CommonTypes.Metadata.SscSupportedMedia", b => { - b.HasOne("Aaru.CommonTypes.Metadata.Ssc", null).WithMany("SupportedMediaTypes").HasForeignKey("SscId"). + b.HasOne("Aaru.CommonTypes.Metadata.Ssc", null). + WithMany("SupportedMediaTypes"). + HasForeignKey("SscId"). OnDelete(DeleteBehavior.SetNull); - b.HasOne("Aaru.CommonTypes.Metadata.TestedSequentialMedia", null).WithMany("SupportedMediaTypes"). - HasForeignKey("TestedSequentialMediaId").OnDelete(DeleteBehavior.SetNull); + b.HasOne("Aaru.CommonTypes.Metadata.TestedSequentialMedia", null). + WithMany("SupportedMediaTypes"). + HasForeignKey("TestedSequentialMediaId"). + OnDelete(DeleteBehavior.SetNull); }); modelBuilder.Entity("Aaru.CommonTypes.Metadata.SupportedDensity", b => { - b.HasOne("Aaru.CommonTypes.Metadata.Ssc", null).WithMany("SupportedDensities").HasForeignKey("SscId"). + b.HasOne("Aaru.CommonTypes.Metadata.Ssc", null). + WithMany("SupportedDensities"). + HasForeignKey("SscId"). OnDelete(DeleteBehavior.Cascade); - b.HasOne("Aaru.CommonTypes.Metadata.TestedSequentialMedia", null).WithMany("SupportedDensities"). - HasForeignKey("TestedSequentialMediaId").OnDelete(DeleteBehavior.Cascade); + b.HasOne("Aaru.CommonTypes.Metadata.TestedSequentialMedia", null). + WithMany("SupportedDensities"). + HasForeignKey("TestedSequentialMediaId"). + OnDelete(DeleteBehavior.Cascade); }); modelBuilder.Entity("Aaru.CommonTypes.Metadata.TestedMedia", b => { - b.HasOne("Aaru.CommonTypes.Metadata.Ata", null).WithMany("RemovableMedias").HasForeignKey("AtaId"). + b.HasOne("Aaru.CommonTypes.Metadata.Ata", null). + WithMany("RemovableMedias"). + HasForeignKey("AtaId"). OnDelete(DeleteBehavior.SetNull); - b.HasOne("Aaru.CommonTypes.Metadata.Chs", "CHS").WithMany().HasForeignKey("CHSId"). + b.HasOne("Aaru.CommonTypes.Metadata.Chs", "CHS"). + WithMany(). + HasForeignKey("CHSId"). OnDelete(DeleteBehavior.SetNull); - b.HasOne("Aaru.CommonTypes.Metadata.Chs", "CurrentCHS").WithMany().HasForeignKey("CurrentCHSId"). + b.HasOne("Aaru.CommonTypes.Metadata.Chs", "CurrentCHS"). + WithMany(). + HasForeignKey("CurrentCHSId"). OnDelete(DeleteBehavior.SetNull); - b.HasOne("Aaru.CommonTypes.Metadata.Mmc", null).WithMany("TestedMedia").HasForeignKey("MmcId"). + b.HasOne("Aaru.CommonTypes.Metadata.Mmc", null). + WithMany("TestedMedia"). + HasForeignKey("MmcId"). OnDelete(DeleteBehavior.Cascade); - b.HasOne("Aaru.CommonTypes.Metadata.Scsi", null).WithMany("RemovableMedias").HasForeignKey("ScsiId"). + b.HasOne("Aaru.CommonTypes.Metadata.Scsi", null). + WithMany("RemovableMedias"). + HasForeignKey("ScsiId"). OnDelete(DeleteBehavior.SetNull); }); modelBuilder.Entity("Aaru.CommonTypes.Metadata.TestedSequentialMedia", - b => b.HasOne("Aaru.CommonTypes.Metadata.Ssc", null).WithMany("TestedMedia"). - HasForeignKey("SscId").OnDelete(DeleteBehavior.SetNull)); + b => b.HasOne("Aaru.CommonTypes.Metadata.Ssc", null). + WithMany("TestedMedia"). + HasForeignKey("SscId"). + OnDelete(DeleteBehavior.SetNull)); modelBuilder.Entity("Aaru.Database.Models.Device", b => { - b.HasOne("Aaru.CommonTypes.Metadata.Ata", "ATA").WithMany().HasForeignKey("ATAId"). + b.HasOne("Aaru.CommonTypes.Metadata.Ata", "ATA"). + WithMany(). + HasForeignKey("ATAId"). OnDelete(DeleteBehavior.SetNull); - b.HasOne("Aaru.CommonTypes.Metadata.Ata", "ATAPI").WithMany().HasForeignKey("ATAPIId"). + b.HasOne("Aaru.CommonTypes.Metadata.Ata", "ATAPI"). + WithMany(). + HasForeignKey("ATAPIId"). OnDelete(DeleteBehavior.SetNull); - b.HasOne("Aaru.CommonTypes.Metadata.FireWire", "FireWire").WithMany().HasForeignKey("FireWireId"). + b.HasOne("Aaru.CommonTypes.Metadata.FireWire", "FireWire"). + WithMany(). + HasForeignKey("FireWireId"). OnDelete(DeleteBehavior.SetNull); - b.HasOne("Aaru.CommonTypes.Metadata.MmcSd", "MultiMediaCard").WithMany().HasForeignKey("MultiMediaCardId"). + b.HasOne("Aaru.CommonTypes.Metadata.MmcSd", "MultiMediaCard"). + WithMany(). + HasForeignKey("MultiMediaCardId"). OnDelete(DeleteBehavior.SetNull); - b.HasOne("Aaru.CommonTypes.Metadata.Pcmcia", "PCMCIA").WithMany().HasForeignKey("PCMCIAId"). + b.HasOne("Aaru.CommonTypes.Metadata.Pcmcia", "PCMCIA"). + WithMany(). + HasForeignKey("PCMCIAId"). OnDelete(DeleteBehavior.SetNull); - b.HasOne("Aaru.CommonTypes.Metadata.Scsi", "SCSI").WithMany().HasForeignKey("SCSIId"). + b.HasOne("Aaru.CommonTypes.Metadata.Scsi", "SCSI"). + WithMany(). + HasForeignKey("SCSIId"). OnDelete(DeleteBehavior.SetNull); - b.HasOne("Aaru.CommonTypes.Metadata.MmcSd", "SecureDigital").WithMany().HasForeignKey("SecureDigitalId"). + b.HasOne("Aaru.CommonTypes.Metadata.MmcSd", "SecureDigital"). + WithMany(). + HasForeignKey("SecureDigitalId"). OnDelete(DeleteBehavior.SetNull); - b.HasOne("Aaru.CommonTypes.Metadata.Usb", "USB").WithMany().HasForeignKey("USBId"). + b.HasOne("Aaru.CommonTypes.Metadata.Usb", "USB"). + WithMany(). + HasForeignKey("USBId"). OnDelete(DeleteBehavior.SetNull); }); modelBuilder.Entity("Aaru.Database.Models.Report", b => { - b.HasOne("Aaru.CommonTypes.Metadata.Ata", "ATA").WithMany().HasForeignKey("ATAId"). + b.HasOne("Aaru.CommonTypes.Metadata.Ata", "ATA"). + WithMany(). + HasForeignKey("ATAId"). OnDelete(DeleteBehavior.SetNull); - b.HasOne("Aaru.CommonTypes.Metadata.Ata", "ATAPI").WithMany().HasForeignKey("ATAPIId"). + b.HasOne("Aaru.CommonTypes.Metadata.Ata", "ATAPI"). + WithMany(). + HasForeignKey("ATAPIId"). OnDelete(DeleteBehavior.SetNull); - b.HasOne("Aaru.CommonTypes.Metadata.FireWire", "FireWire").WithMany().HasForeignKey("FireWireId"). + b.HasOne("Aaru.CommonTypes.Metadata.FireWire", "FireWire"). + WithMany(). + HasForeignKey("FireWireId"). OnDelete(DeleteBehavior.SetNull); - b.HasOne("Aaru.CommonTypes.Metadata.MmcSd", "MultiMediaCard").WithMany().HasForeignKey("MultiMediaCardId"). + b.HasOne("Aaru.CommonTypes.Metadata.MmcSd", "MultiMediaCard"). + WithMany(). + HasForeignKey("MultiMediaCardId"). OnDelete(DeleteBehavior.SetNull); - b.HasOne("Aaru.CommonTypes.Metadata.Pcmcia", "PCMCIA").WithMany().HasForeignKey("PCMCIAId"). + b.HasOne("Aaru.CommonTypes.Metadata.Pcmcia", "PCMCIA"). + WithMany(). + HasForeignKey("PCMCIAId"). OnDelete(DeleteBehavior.SetNull); - b.HasOne("Aaru.CommonTypes.Metadata.Scsi", "SCSI").WithMany().HasForeignKey("SCSIId"). + b.HasOne("Aaru.CommonTypes.Metadata.Scsi", "SCSI"). + WithMany(). + HasForeignKey("SCSIId"). OnDelete(DeleteBehavior.SetNull); - b.HasOne("Aaru.CommonTypes.Metadata.MmcSd", "SecureDigital").WithMany().HasForeignKey("SecureDigitalId"). + b.HasOne("Aaru.CommonTypes.Metadata.MmcSd", "SecureDigital"). + WithMany(). + HasForeignKey("SecureDigitalId"). OnDelete(DeleteBehavior.SetNull); - b.HasOne("Aaru.CommonTypes.Metadata.Usb", "USB").WithMany().HasForeignKey("USBId"). + b.HasOne("Aaru.CommonTypes.Metadata.Usb", "USB"). + WithMany(). + HasForeignKey("USBId"). OnDelete(DeleteBehavior.SetNull); }); diff --git a/Aaru.Decoders b/Aaru.Decoders index d3efb5822..acbc11af9 160000 --- a/Aaru.Decoders +++ b/Aaru.Decoders @@ -1 +1 @@ -Subproject commit d3efb58222c5e73047663d0142511e657a1c743d +Subproject commit acbc11af95f09d28f277650cad868dea5d8c8050 diff --git a/Aaru.Decryption b/Aaru.Decryption index 9f529da3c..7786e94ee 160000 --- a/Aaru.Decryption +++ b/Aaru.Decryption @@ -1 +1 @@ -Subproject commit 9f529da3c6527de8363b55e21f99cd504c2f2e1b +Subproject commit 7786e94ee52c8f65802f1fc071db994ab1b88c60 diff --git a/Aaru.Devices/Device/AtaCommands/Ata48.cs b/Aaru.Devices/Device/AtaCommands/Ata48.cs index 1e88c78b7..8abdd2c58 100644 --- a/Aaru.Devices/Device/AtaCommands/Ata48.cs +++ b/Aaru.Devices/Device/AtaCommands/Ata48.cs @@ -63,12 +63,14 @@ public partial class Device if((statusRegisters.Status & 0x23) == 0) { - lba = (ulong)((statusRegisters.LbaHighCurrent << 16) + (statusRegisters.LbaMidCurrent << 8) + + lba = (ulong)((statusRegisters.LbaHighCurrent << 16) + + (statusRegisters.LbaMidCurrent << 8) + statusRegisters.LbaLowCurrent); lba <<= 24; - lba += (ulong)((statusRegisters.LbaHighPrevious << 16) + (statusRegisters.LbaMidPrevious << 8) + + lba += (ulong)((statusRegisters.LbaHighPrevious << 16) + + (statusRegisters.LbaMidPrevious << 8) + statusRegisters.LbaLowPrevious); } @@ -246,12 +248,14 @@ public partial class Device if((statusRegisters.Status & 0x23) == 0) { - lba = (ulong)((statusRegisters.LbaHighCurrent << 16) + (statusRegisters.LbaMidCurrent << 8) + + lba = (ulong)((statusRegisters.LbaHighCurrent << 16) + + (statusRegisters.LbaMidCurrent << 8) + statusRegisters.LbaLowCurrent); lba <<= 24; - lba += (ulong)((statusRegisters.LbaHighPrevious << 16) + (statusRegisters.LbaMidPrevious << 8) + + lba += (ulong)((statusRegisters.LbaHighPrevious << 16) + + (statusRegisters.LbaMidPrevious << 8) + statusRegisters.LbaLowPrevious); } diff --git a/Aaru.Devices/Device/Constructor.cs b/Aaru.Devices/Device/Constructor.cs index 793ac3524..66fd3d855 100644 --- a/Aaru.Devices/Device/Constructor.cs +++ b/Aaru.Devices/Device/Constructor.cs @@ -225,8 +225,7 @@ public partial class Device Features.SeparatedFeatures features = Features.Separate(featureBuffer); - if(features.Descriptors?.Length != 1 || - features.Descriptors[0].Code != 0x0108) + if(features.Descriptors?.Length != 1 || features.Descriptors[0].Code != 0x0108) return dev; Feature_0108? serialFeature = Features.Decode_0108(features.Descriptors[0].Data); diff --git a/Aaru.Devices/Device/List.cs b/Aaru.Devices/Device/List.cs index d32c1f677..4d1d531f6 100644 --- a/Aaru.Devices/Device/List.cs +++ b/Aaru.Devices/Device/List.cs @@ -116,8 +116,7 @@ public partial class Device { var aaruUri = new Uri(aaruRemote); - if(aaruUri.Scheme != "aaru" && - aaruUri.Scheme != "dic") + if(aaruUri.Scheme != "aaru" && aaruUri.Scheme != "dic") { AaruConsole.ErrorWriteLine(Localization.Invalid_remote_URI); diff --git a/Aaru.Devices/Device/ScsiCommands/Kreon.cs b/Aaru.Devices/Device/ScsiCommands/Kreon.cs index 50a540a75..5aa5a12ee 100644 --- a/Aaru.Devices/Device/ScsiCommands/Kreon.cs +++ b/Aaru.Devices/Device/ScsiCommands/Kreon.cs @@ -144,10 +144,7 @@ public partial class Device if(sense) return true; - if(buffer[0] != 0xA5 || - buffer[1] != 0x5A || - buffer[2] != 0x5A || - buffer[3] != 0xA5) + if(buffer[0] != 0xA5 || buffer[1] != 0x5A || buffer[2] != 0x5A || buffer[3] != 0xA5) return true; for(var i = 4; i < 26; i += 2) diff --git a/Aaru.Devices/Device/ScsiCommands/MMC.cs b/Aaru.Devices/Device/ScsiCommands/MMC.cs index d7ee4c9ed..f7d2c0717 100644 --- a/Aaru.Devices/Device/ScsiCommands/MMC.cs +++ b/Aaru.Devices/Device/ScsiCommands/MMC.cs @@ -683,11 +683,10 @@ public partial class Device Error = LastError != 0; AaruConsole.DebugWriteLine(SCSI_MODULE_NAME, - Localization.READ_READ_SUB_CHANNEL_MCN_Sense_1_Last_Error_2_took_0_ms, - duration, sense, LastError); + Localization.READ_READ_SUB_CHANNEL_MCN_Sense_1_Last_Error_2_took_0_ms, duration, + sense, LastError); - if(!sense && - (buffer[8] & 0x80) == 0x80) + if(!sense && (buffer[8] & 0x80) == 0x80) mcn = Encoding.ASCII.GetString(buffer, 9, 13); return sense; @@ -729,8 +728,7 @@ public partial class Device READ_READ_SUB_CHANNEL_ISRC_Track_Number_1_Sense_2_Last_Error_3_took_0_ms, duration, trackNumber, sense, LastError); - if(!sense && - (buffer[8] & 0x80) == 0x80) + if(!sense && (buffer[8] & 0x80) == 0x80) isrc = Encoding.ASCII.GetString(buffer, 9, 12); return sense; diff --git a/Aaru.Devices/Device/ScsiCommands/Optical.cs b/Aaru.Devices/Device/ScsiCommands/Optical.cs index 81a7ea09f..c023e1754 100644 --- a/Aaru.Devices/Device/ScsiCommands/Optical.cs +++ b/Aaru.Devices/Device/ScsiCommands/Optical.cs @@ -90,8 +90,7 @@ public partial class Device cdb[4] = (byte)((lba & 0xFF00) >> 8); cdb[5] = (byte)(lba & 0xFF); - if(requested > 0 || - scanLength > 1) + if(requested > 0 || scanLength > 1) { buffer = new byte[8]; buffer[0] = (byte)((requested & 0xFF000000) >> 24); diff --git a/Aaru.Devices/Device/ScsiCommands/SPC.cs b/Aaru.Devices/Device/ScsiCommands/SPC.cs index 008fbc016..f7ea7bdb4 100644 --- a/Aaru.Devices/Device/ScsiCommands/SPC.cs +++ b/Aaru.Devices/Device/ScsiCommands/SPC.cs @@ -74,7 +74,10 @@ public partial class Device buffer = new byte[36]; senseBuffer = new byte[64]; - byte[] cdb = { (byte)ScsiCommands.Inquiry, 0, 0, 0, 36, 0 }; + byte[] cdb = + { + (byte)ScsiCommands.Inquiry, 0, 0, 0, 36, 0 + }; LastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out bool sense); @@ -86,7 +89,10 @@ public partial class Device var pagesLength = (byte)(buffer[4] + 5); - cdb = new byte[] { (byte)ScsiCommands.Inquiry, 0, 0, 0, pagesLength, 0 }; + cdb = new byte[] + { + (byte)ScsiCommands.Inquiry, 0, 0, 0, pagesLength, 0 + }; buffer = new byte[pagesLength]; senseBuffer = new byte[64]; @@ -145,7 +151,10 @@ public partial class Device buffer = new byte[36]; senseBuffer = new byte[64]; - byte[] cdb = { (byte)ScsiCommands.Inquiry, 1, page, 0, 36, 0 }; + byte[] cdb = + { + (byte)ScsiCommands.Inquiry, 1, page, 0, 36, 0 + }; LastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out bool sense); @@ -161,7 +170,10 @@ public partial class Device var pagesLength = (byte)(buffer[3] + 4); - cdb = new byte[] { (byte)ScsiCommands.Inquiry, 1, page, 0, pagesLength, 0 }; + cdb = new byte[] + { + (byte)ScsiCommands.Inquiry, 1, page, 0, pagesLength, 0 + }; buffer = new byte[pagesLength]; senseBuffer = new byte[64]; @@ -185,7 +197,10 @@ public partial class Device { senseBuffer = new byte[64]; - byte[] cdb = { (byte)ScsiCommands.TestUnitReady, 0, 0, 0, 0, 0 }; + byte[] cdb = + { + (byte)ScsiCommands.TestUnitReady, 0, 0, 0, 0, 0 + }; byte[] buffer = Array.Empty(); diff --git a/Aaru.Devices/Device/ScsiCommands/SSC.cs b/Aaru.Devices/Device/ScsiCommands/SSC.cs index 7456e7bbf..9feb2d709 100644 --- a/Aaru.Devices/Device/ScsiCommands/SSC.cs +++ b/Aaru.Devices/Device/ScsiCommands/SSC.cs @@ -376,7 +376,8 @@ public partial class Device /// Duration. public bool Read16(out byte[] buffer, out byte[] senseBuffer, ulong objectId, uint blocks, uint blockSize, uint timeout, out double duration) => Read16(out buffer, out senseBuffer, false, true, 0, - objectId, blocks, blockSize, timeout, out duration); + objectId, blocks, blockSize, timeout, + out duration); /// Reads a number of fixed-length blocks starting at specified block from the specified partition /// Buffer. diff --git a/Aaru.Devices/Device/ScsiCommands/SyQuest.cs b/Aaru.Devices/Device/ScsiCommands/SyQuest.cs index 4b02a55ce..ef2a7ffb4 100644 --- a/Aaru.Devices/Device/ScsiCommands/SyQuest.cs +++ b/Aaru.Devices/Device/ScsiCommands/SyQuest.cs @@ -91,8 +91,7 @@ public partial class Device if(readLong) cdb[5] += 0x40; - if(!inhibitDma && - !readLong) + if(!inhibitDma && !readLong) buffer = transferLength == 0 ? new byte[256 * blockSize] : new byte[transferLength * blockSize]; else if(readLong) { @@ -172,8 +171,7 @@ public partial class Device if(readLong) cdb[9] += 0x40; - if(!inhibitDma && - !readLong) + if(!inhibitDma && !readLong) buffer = new byte[transferLength * blockSize]; else if(readLong) { diff --git a/Aaru.Devices/Linux/Command.cs b/Aaru.Devices/Linux/Command.cs index d8bfe71ee..187da79b8 100644 --- a/Aaru.Devices/Linux/Command.cs +++ b/Aaru.Devices/Linux/Command.cs @@ -153,8 +153,7 @@ partial class Device cdb[0] = (byte)ScsiCommands.AtaPassThrough16; cdb[1] = (byte)((byte)protocol << 1 & 0x1E); - if(transferRegister != AtaTransferRegister.NoTransfer && - protocol != AtaProtocol.NonData) + if(transferRegister != AtaTransferRegister.NoTransfer && protocol != AtaProtocol.NonData) { switch(protocol) { @@ -188,8 +187,7 @@ partial class Device int error = SendScsiCommand(cdb, ref buffer, out byte[] senseBuffer, timeout, AtaProtocolToScsiDirection(protocol), out duration, out sense); - if(senseBuffer.Length < 22 || - senseBuffer[8] != 0x09 && senseBuffer[9] != 0x0C) + if(senseBuffer.Length < 22 || senseBuffer[8] != 0x09 && senseBuffer[9] != 0x0C) return error; errorRegisters.Error = senseBuffer[11]; @@ -226,8 +224,7 @@ partial class Device cdb[0] = (byte)ScsiCommands.AtaPassThrough16; cdb[1] = (byte)((byte)protocol << 1 & 0x1E); - if(transferRegister != AtaTransferRegister.NoTransfer && - protocol != AtaProtocol.NonData) + if(transferRegister != AtaTransferRegister.NoTransfer && protocol != AtaProtocol.NonData) { switch(protocol) { @@ -261,8 +258,7 @@ partial class Device int error = SendScsiCommand(cdb, ref buffer, out byte[] senseBuffer, timeout, AtaProtocolToScsiDirection(protocol), out duration, out sense); - if(senseBuffer.Length < 22 || - senseBuffer[8] != 0x09 && senseBuffer[9] != 0x0C) + if(senseBuffer.Length < 22 || senseBuffer[8] != 0x09 && senseBuffer[9] != 0x0C) return error; errorRegisters.Error = senseBuffer[11]; @@ -300,8 +296,7 @@ partial class Device cdb[1] = (byte)((byte)protocol << 1 & 0x1E); cdb[1] |= 0x01; - if(transferRegister != AtaTransferRegister.NoTransfer && - protocol != AtaProtocol.NonData) + if(transferRegister != AtaTransferRegister.NoTransfer && protocol != AtaProtocol.NonData) { switch(protocol) { @@ -340,8 +335,7 @@ partial class Device int error = SendScsiCommand(cdb, ref buffer, out byte[] senseBuffer, timeout, AtaProtocolToScsiDirection(protocol), out duration, out sense); - if(senseBuffer.Length < 22 || - senseBuffer[8] != 0x09 && senseBuffer[9] != 0x0C) + if(senseBuffer.Length < 22 || senseBuffer[8] != 0x09 && senseBuffer[9] != 0x0C) return error; errorRegisters.Error = senseBuffer[11]; @@ -612,8 +606,7 @@ partial class Device int error = Marshal.GetLastWin32Error(); - if(error != 13 && - error != 30) + if(error != 13 && error != 30) { LastError = Marshal.GetLastWin32Error(); Error = true; diff --git a/Aaru.Devices/Linux/Device.cs b/Aaru.Devices/Linux/Device.cs index 74e9e78c7..c310209b4 100644 --- a/Aaru.Devices/Linux/Device.cs +++ b/Aaru.Devices/Linux/Device.cs @@ -382,8 +382,7 @@ partial class Device : Devices.Device string possibleDir = Path.Combine(resolvedLink, "pcmcia_socket", subdirs[0]); - if(!File.Exists(possibleDir + "/card_type") || - !File.Exists(possibleDir + "/cis")) + if(!File.Exists(possibleDir + "/card_type") || !File.Exists(possibleDir + "/cis")) continue; var cisFs = new FileStream(possibleDir + "/cis", FileMode.Open, FileAccess.Read); diff --git a/Aaru.Devices/Linux/ListDevices.cs b/Aaru.Devices/Linux/ListDevices.cs index e09fc0046..321b14af0 100644 --- a/Aaru.Devices/Linux/ListDevices.cs +++ b/Aaru.Devices/Linux/ListDevices.cs @@ -91,8 +91,7 @@ static class ListDevices StreamReader sr; - if(File.Exists(Path.Combine(sysdevs[i], "device/vendor")) && - string.IsNullOrEmpty(devices[i].Vendor)) + 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); devices[i].Vendor = sr.ReadLine()?.Trim(); @@ -109,15 +108,13 @@ static class ListDevices else if(devices[i].Path.StartsWith("/dev/loop", StringComparison.CurrentCulture)) devices[i].Model = "Linux"; - if(File.Exists(Path.Combine(sysdevs[i], "device/serial")) && - string.IsNullOrEmpty(devices[i].Serial)) + 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); devices[i].Serial = sr.ReadLine()?.Trim(); } - if(string.IsNullOrEmpty(devices[i].Vendor) || - devices[i].Vendor == "ATA") + if(string.IsNullOrEmpty(devices[i].Vendor) || devices[i].Vendor == "ATA") { if(devices[i].Model != null) { diff --git a/Aaru.Devices/Remote/Command.cs b/Aaru.Devices/Remote/Command.cs index ffc7542bc..3ed3a192e 100644 --- a/Aaru.Devices/Remote/Command.cs +++ b/Aaru.Devices/Remote/Command.cs @@ -180,8 +180,7 @@ public partial class Device ref command.buffer, out command.response, out double cmdDuration, out bool cmdSense, timeout); - if(error == 0 && - singleError != 0) + if(error == 0 && singleError != 0) error = singleError; duration += cmdDuration; diff --git a/Aaru.Devices/Remote/Remote.cs b/Aaru.Devices/Remote/Remote.cs index 5d35ba6c5..fa74cbaa6 100644 --- a/Aaru.Devices/Remote/Remote.cs +++ b/Aaru.Devices/Remote/Remote.cs @@ -62,8 +62,7 @@ public class Remote : IDisposable /// Network error. public Remote(Uri uri) { - if(uri.Scheme != "aaru" && - uri.Scheme != "dic") + if(uri.Scheme != "aaru" && uri.Scheme != "dic") throw new ArgumentException(Localization.Invalid_remote_protocol, nameof(uri.Scheme)); _host = uri.DnsSafeHost; @@ -102,8 +101,7 @@ public class Remote : IDisposable AaruPacketHeader hdr = Marshal.ByteArrayToStructureLittleEndian(hdrBuf); - if(hdr.remote_id != Consts.REMOTE_ID || - hdr.packet_id != Consts.PACKET_ID) + if(hdr.remote_id != Consts.REMOTE_ID || hdr.packet_id != Consts.PACKET_ID) { AaruConsole.ErrorWriteLine(Localization.Received_data_is_not_an_Aaru_Remote_Packet); @@ -253,8 +251,7 @@ public class Remote : IDisposable AaruPacketHeader hdr = Marshal.ByteArrayToStructureLittleEndian(hdrBuf); - if(hdr.remote_id != Consts.REMOTE_ID || - hdr.packet_id != Consts.PACKET_ID) + if(hdr.remote_id != Consts.REMOTE_ID || hdr.packet_id != Consts.PACKET_ID) { AaruConsole.ErrorWriteLine(Localization.Received_data_is_not_an_Aaru_Remote_Packet); @@ -347,8 +344,7 @@ public class Remote : IDisposable AaruPacketHeader hdr = Marshal.ByteArrayToStructureLittleEndian(hdrBuf); - if(hdr.remote_id != Consts.REMOTE_ID || - hdr.packet_id != Consts.PACKET_ID) + if(hdr.remote_id != Consts.REMOTE_ID || hdr.packet_id != Consts.PACKET_ID) { AaruConsole.ErrorWriteLine(Localization.Received_data_is_not_an_Aaru_Remote_Packet); @@ -360,9 +356,8 @@ public class Remote : IDisposable if(hdr.packetType != AaruPacketType.Nop) { AaruConsole. - ErrorWriteLine( - Localization.Remote_ListDevices_Expected_List_Devices_Response_Packet_got_packet_type_0, - hdr.packetType); + ErrorWriteLine(Localization.Remote_ListDevices_Expected_List_Devices_Response_Packet_got_packet_type_0, + hdr.packetType); return Array.Empty(); } @@ -470,8 +465,7 @@ public class Remote : IDisposable AaruPacketHeader hdr = Marshal.ByteArrayToStructureLittleEndian(hdrBuf); - if(hdr.remote_id != Consts.REMOTE_ID || - hdr.packet_id != Consts.PACKET_ID) + if(hdr.remote_id != Consts.REMOTE_ID || hdr.packet_id != Consts.PACKET_ID) { AaruConsole.ErrorWriteLine(Localization.Received_data_is_not_an_Aaru_Remote_Packet); lastError = -1; @@ -590,8 +584,7 @@ public class Remote : IDisposable AaruPacketHeader hdr = Marshal.ByteArrayToStructureLittleEndian(hdrBuf); - if(hdr.remote_id != Consts.REMOTE_ID || - hdr.packet_id != Consts.PACKET_ID) + if(hdr.remote_id != Consts.REMOTE_ID || hdr.packet_id != Consts.PACKET_ID) { AaruConsole.ErrorWriteLine(Localization.Received_data_is_not_an_Aaru_Remote_Packet); @@ -700,8 +693,7 @@ public class Remote : IDisposable AaruPacketHeader hdr = Marshal.ByteArrayToStructureLittleEndian(hdrBuf); - if(hdr.remote_id != Consts.REMOTE_ID || - hdr.packet_id != Consts.PACKET_ID) + if(hdr.remote_id != Consts.REMOTE_ID || hdr.packet_id != Consts.PACKET_ID) { AaruConsole.ErrorWriteLine(Localization.Received_data_is_not_an_Aaru_Remote_Packet); @@ -809,8 +801,7 @@ public class Remote : IDisposable AaruPacketHeader hdr = Marshal.ByteArrayToStructureLittleEndian(hdrBuf); - if(hdr.remote_id != Consts.REMOTE_ID || - hdr.packet_id != Consts.PACKET_ID) + if(hdr.remote_id != Consts.REMOTE_ID || hdr.packet_id != Consts.PACKET_ID) { AaruConsole.ErrorWriteLine(Localization.Received_data_is_not_an_Aaru_Remote_Packet); @@ -919,8 +910,7 @@ public class Remote : IDisposable AaruPacketHeader hdr = Marshal.ByteArrayToStructureLittleEndian(hdrBuf); - if(hdr.remote_id != Consts.REMOTE_ID || - hdr.packet_id != Consts.PACKET_ID) + if(hdr.remote_id != Consts.REMOTE_ID || hdr.packet_id != Consts.PACKET_ID) { AaruConsole.ErrorWriteLine(Localization.Received_data_is_not_an_Aaru_Remote_Packet); @@ -1035,8 +1025,7 @@ public class Remote : IDisposable AaruPacketHeader hdr = Marshal.ByteArrayToStructureLittleEndian(hdrBuf); - if(hdr.remote_id != Consts.REMOTE_ID || - hdr.packet_id != Consts.PACKET_ID) + if(hdr.remote_id != Consts.REMOTE_ID || hdr.packet_id != Consts.PACKET_ID) { AaruConsole.ErrorWriteLine(Localization.Received_data_is_not_an_Aaru_Remote_Packet); @@ -1117,8 +1106,7 @@ public class Remote : IDisposable AaruPacketHeader hdr = Marshal.ByteArrayToStructureLittleEndian(hdrBuf); - if(hdr.remote_id != Consts.REMOTE_ID || - hdr.packet_id != Consts.PACKET_ID) + if(hdr.remote_id != Consts.REMOTE_ID || hdr.packet_id != Consts.PACKET_ID) { AaruConsole.ErrorWriteLine(Localization.Received_data_is_not_an_Aaru_Remote_Packet); @@ -1197,8 +1185,7 @@ public class Remote : IDisposable AaruPacketHeader hdr = Marshal.ByteArrayToStructureLittleEndian(hdrBuf); - if(hdr.remote_id != Consts.REMOTE_ID || - hdr.packet_id != Consts.PACKET_ID) + if(hdr.remote_id != Consts.REMOTE_ID || hdr.packet_id != Consts.PACKET_ID) { AaruConsole.ErrorWriteLine(Localization.Received_data_is_not_an_Aaru_Remote_Packet); @@ -1327,8 +1314,7 @@ public class Remote : IDisposable AaruPacketHeader hdr = Marshal.ByteArrayToStructureLittleEndian(hdrBuf); - if(hdr.remote_id != Consts.REMOTE_ID || - hdr.packet_id != Consts.PACKET_ID) + if(hdr.remote_id != Consts.REMOTE_ID || hdr.packet_id != Consts.PACKET_ID) { AaruConsole.ErrorWriteLine(Localization.Received_data_is_not_an_Aaru_Remote_Packet); @@ -1421,8 +1407,7 @@ public class Remote : IDisposable AaruPacketHeader hdr = Marshal.ByteArrayToStructureLittleEndian(hdrBuf); - if(hdr.remote_id != Consts.REMOTE_ID || - hdr.packet_id != Consts.PACKET_ID) + if(hdr.remote_id != Consts.REMOTE_ID || hdr.packet_id != Consts.PACKET_ID) { AaruConsole.ErrorWriteLine(Localization.Received_data_is_not_an_Aaru_Remote_Packet); @@ -1504,8 +1489,7 @@ public class Remote : IDisposable AaruPacketHeader hdr = Marshal.ByteArrayToStructureLittleEndian(hdrBuf); - if(hdr.remote_id != Consts.REMOTE_ID || - hdr.packet_id != Consts.PACKET_ID) + if(hdr.remote_id != Consts.REMOTE_ID || hdr.packet_id != Consts.PACKET_ID) { AaruConsole.ErrorWriteLine(Localization.Received_data_is_not_an_Aaru_Remote_Packet); @@ -1635,17 +1619,17 @@ public class Remote : IDisposable int off = tmp.Length; foreach(AaruCmdSdhci cmd in commands.Select(command => new AaruCmdSdhci - { - application = command.isApplication, - argument = command.argument, - block_size = command.blockSize, - blocks = command.blocks, - buf_len = (uint)(command.buffer?.Length ?? 0), - command = command.command, - flags = command.flags, - timeout = timeout, - write = command.write - })) + { + application = command.isApplication, + argument = command.argument, + block_size = command.blockSize, + blocks = command.blocks, + buf_len = (uint)(command.buffer?.Length ?? 0), + command = command.command, + flags = command.flags, + timeout = timeout, + write = command.write + })) { tmp = Marshal.StructureToByteArrayLittleEndian(cmd); Array.Copy(tmp, 0, buf, off, tmp.Length); @@ -1654,7 +1638,7 @@ public class Remote : IDisposable } foreach(Devices.Device.MmcSingleCommand command in - commands.Where(command => (command.buffer?.Length ?? 0) != 0)) + commands.Where(command => (command.buffer?.Length ?? 0) != 0)) { Array.Copy(command.buffer, 0, buf, off, command.buffer.Length); @@ -1683,8 +1667,7 @@ public class Remote : IDisposable AaruPacketHeader hdr = Marshal.ByteArrayToStructureLittleEndian(hdrBuf); - if(hdr.remote_id != Consts.REMOTE_ID || - hdr.packet_id != Consts.PACKET_ID) + if(hdr.remote_id != Consts.REMOTE_ID || hdr.packet_id != Consts.PACKET_ID) { AaruConsole.ErrorWriteLine(Localization.Received_data_is_not_an_Aaru_Remote_Packet); @@ -1731,8 +1714,7 @@ public class Remote : IDisposable command.response = cmdRes.response; duration += cmdRes.duration; - if(cmdRes.error_no != 0 && - error == 0) + if(cmdRes.error_no != 0 && error == 0) error = (int)cmdRes.error_no; if(cmdRes.sense != 0) @@ -1827,8 +1809,7 @@ public class Remote : IDisposable AaruPacketHeader hdr = Marshal.ByteArrayToStructureLittleEndian(hdrBuf); - if(hdr.remote_id != Consts.REMOTE_ID || - hdr.packet_id != Consts.PACKET_ID) + if(hdr.remote_id != Consts.REMOTE_ID || hdr.packet_id != Consts.PACKET_ID) { AaruConsole.ErrorWriteLine(Localization.Received_data_is_not_an_Aaru_Remote_Packet); @@ -1931,8 +1912,7 @@ public class Remote : IDisposable AaruPacketHeader hdr = Marshal.ByteArrayToStructureLittleEndian(hdrBuf); - if(hdr.remote_id != Consts.REMOTE_ID || - hdr.packet_id != Consts.PACKET_ID) + if(hdr.remote_id != Consts.REMOTE_ID || hdr.packet_id != Consts.PACKET_ID) { AaruConsole.ErrorWriteLine(Localization.Received_data_is_not_an_Aaru_Remote_Packet); diff --git a/Aaru.Devices/Windows/Command.cs b/Aaru.Devices/Windows/Command.cs index 033f1950b..381778121 100644 --- a/Aaru.Devices/Windows/Command.cs +++ b/Aaru.Devices/Windows/Command.cs @@ -525,35 +525,28 @@ partial class Device commandDescriptor.responseType = 0; - if(flags.HasFlag(MmcFlags.ResponseR1) || - flags.HasFlag(MmcFlags.ResponseSpiR1)) + if(flags.HasFlag(MmcFlags.ResponseR1) || flags.HasFlag(MmcFlags.ResponseSpiR1)) commandDescriptor.responseType = SdResponseType.R1; - if(flags.HasFlag(MmcFlags.ResponseR1B) || - flags.HasFlag(MmcFlags.ResponseSpiR1B)) + if(flags.HasFlag(MmcFlags.ResponseR1B) || flags.HasFlag(MmcFlags.ResponseSpiR1B)) commandDescriptor.responseType = SdResponseType.R1b; - if(flags.HasFlag(MmcFlags.ResponseR2) || - flags.HasFlag(MmcFlags.ResponseSpiR2)) + if(flags.HasFlag(MmcFlags.ResponseR2) || flags.HasFlag(MmcFlags.ResponseSpiR2)) commandDescriptor.responseType = SdResponseType.R2; - if(flags.HasFlag(MmcFlags.ResponseR3) || - flags.HasFlag(MmcFlags.ResponseSpiR3)) + if(flags.HasFlag(MmcFlags.ResponseR3) || flags.HasFlag(MmcFlags.ResponseSpiR3)) commandDescriptor.responseType = SdResponseType.R3; - if(flags.HasFlag(MmcFlags.ResponseR4) || - flags.HasFlag(MmcFlags.ResponseSpiR4)) + if(flags.HasFlag(MmcFlags.ResponseR4) || flags.HasFlag(MmcFlags.ResponseSpiR4)) commandDescriptor.responseType = SdResponseType.R4; - if(flags.HasFlag(MmcFlags.ResponseR5) || - flags.HasFlag(MmcFlags.ResponseSpiR5)) + if(flags.HasFlag(MmcFlags.ResponseR5) || flags.HasFlag(MmcFlags.ResponseSpiR5)) commandDescriptor.responseType = SdResponseType.R5; if(flags.HasFlag(MmcFlags.ResponseR6)) commandDescriptor.responseType = SdResponseType.R6; - var commandB = - new byte[commandData.size + commandData.protocolArgumentSize + commandData.deviceDataBufferSize]; + var commandB = new byte[commandData.size + commandData.protocolArgumentSize + commandData.deviceDataBufferSize]; Array.Copy(buffer, 0, commandB, commandData.size + commandData.protocolArgumentSize, buffer.Length); IntPtr hBuf = Marshal.AllocHGlobal(commandB.Length); @@ -611,8 +604,7 @@ partial class Device command.argument, command.blockSize, command.blocks, ref command.buffer, out command.response, out double cmdDuration, out bool cmdSense, timeout); - if(error == 0 && - singleError != 0) + if(error == 0 && singleError != 0) error = singleError; duration += cmdDuration; diff --git a/Aaru.Devices/Windows/Device.cs b/Aaru.Devices/Windows/Device.cs index 7d01cabb1..990c26a39 100644 --- a/Aaru.Devices/Windows/Device.cs +++ b/Aaru.Devices/Windows/Device.cs @@ -112,8 +112,7 @@ partial class Device : Devices.Device Marshal.Copy(descriptorPtr, descriptorB, 0, 1000); - if(!hasError && - error == 0) + if(!hasError && error == 0) { var descriptor = new StorageDeviceDescriptor { @@ -235,12 +234,9 @@ partial class Device : Devices.Device sdBuffer = new byte[4]; dev.LastError = - dev.SendMmcCommand( - dev._cachedScr != null - ? (MmcCommands)SecureDigitalCommands.SendOperatingCondition - : MmcCommands.SendOpCond, - false, true, MmcFlags.ResponseSpiR3 | MmcFlags.ResponseR3 | MmcFlags.CommandBcr, 0, - 4, 1, ref sdBuffer, out _, out _, out sense); + dev.SendMmcCommand(dev._cachedScr != null ? (MmcCommands)SecureDigitalCommands.SendOperatingCondition : MmcCommands.SendOpCond, + false, true, MmcFlags.ResponseSpiR3 | MmcFlags.ResponseR3 | MmcFlags.CommandBcr, 0, + 4, 1, ref sdBuffer, out _, out _, out sense); if(!sense) { @@ -292,10 +288,10 @@ partial class Device : Devices.Device // I have to search for USB disks, floppies and CD-ROMs as separate device types foreach(string devGuid in new[] - { - Usb.GUID_DEVINTERFACE_FLOPPY, Usb.GUID_DEVINTERFACE_CDROM, Usb.GUID_DEVINTERFACE_DISK, - Usb.GUID_DEVINTERFACE_TAPE - }) + { + Usb.GUID_DEVINTERFACE_FLOPPY, Usb.GUID_DEVINTERFACE_CDROM, Usb.GUID_DEVINTERFACE_DISK, + Usb.GUID_DEVINTERFACE_TAPE + }) { usbDevice = Usb.FindDrivePath(devicePath, devGuid); diff --git a/Aaru.Devices/Windows/ListDevices.cs b/Aaru.Devices/Windows/ListDevices.cs index 9516d2d7d..ad5f59eb6 100644 --- a/Aaru.Devices/Windows/ListDevices.cs +++ b/Aaru.Devices/Windows/ListDevices.cs @@ -104,8 +104,7 @@ static class ListDevices string physId = devId; // TODO: This can be done better - if(devId.Length == 2 && - devId[1] == ':') + if(devId.Length == 2 && devId[1] == ':') physId = "\\\\?\\" + devId; SafeFileHandle fd = Extern.CreateFile(physId, 0, FileShare.Read | FileShare.Write, IntPtr.Zero, @@ -182,8 +181,7 @@ static class ListDevices info.Serial = HexStringToString(info.Serial).Trim(); } - if(string.IsNullOrEmpty(info.Vendor) || - info.Vendor == "ATA") + if(string.IsNullOrEmpty(info.Vendor) || info.Vendor == "ATA") { string[] pieces = info.Model?.Split(' '); diff --git a/Aaru.Dto b/Aaru.Dto index 3e28fad2a..6c69fe747 160000 --- a/Aaru.Dto +++ b/Aaru.Dto @@ -1 +1 @@ -Subproject commit 3e28fad2a6d32fab3a38fdc444cbe214b6e8c809 +Subproject commit 6c69fe747a99ce4b023cdd0922a26820a6751660 diff --git a/Aaru.Filesystems/AODOS/Info.cs b/Aaru.Filesystems/AODOS/Info.cs index 3ff68299c..a6baa4037 100644 --- a/Aaru.Filesystems/AODOS/Info.cs +++ b/Aaru.Filesystems/AODOS/Info.cs @@ -60,8 +60,7 @@ public sealed partial class AODOS return false; // Does AO-DOS support any other kind of disk? - if(imagePlugin.Info.Sectors != 800 && - imagePlugin.Info.Sectors != 1600) + if(imagePlugin.Info.Sectors != 800 && imagePlugin.Info.Sectors != 1600) return false; ErrorNumber errno = imagePlugin.ReadSector(0, out byte[] sector); diff --git a/Aaru.Filesystems/APFS/Info.cs b/Aaru.Filesystems/APFS/Info.cs index d78255af2..7f9e6156c 100644 --- a/Aaru.Filesystems/APFS/Info.cs +++ b/Aaru.Filesystems/APFS/Info.cs @@ -103,7 +103,8 @@ public sealed partial class APFS sbInformation.AppendFormat(Localization._0_bytes_per_block, nxSb.blockSize).AppendLine(); sbInformation.AppendFormat(Localization.Container_has_0_bytes_in_1_blocks, - nxSb.containerBlocks * nxSb.blockSize, nxSb.containerBlocks).AppendLine(); + nxSb.containerBlocks * nxSb.blockSize, nxSb.containerBlocks). + AppendLine(); information = sbInformation.ToString(); diff --git a/Aaru.Filesystems/Acorn/Info.cs b/Aaru.Filesystems/Acorn/Info.cs index 23830fbb8..3ed120a19 100644 --- a/Aaru.Filesystems/Acorn/Info.cs +++ b/Aaru.Filesystems/Acorn/Info.cs @@ -82,9 +82,7 @@ public sealed partial class AcornADFS AaruConsole.DebugWriteLine(MODULE_NAME, "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) + if(oldMap0.checksum == oldChk0 && oldMap1.checksum != oldChk1 && sector.Length >= 512) { errno = imagePlugin.ReadSector(0, out sector); @@ -215,8 +213,7 @@ public sealed partial class AcornADFS AaruConsole.DebugWriteLine(MODULE_NAME, "bootChk = {0}", bootChk); AaruConsole.DebugWriteLine(MODULE_NAME, "bBlock.checksum = {0}", bootSector[0x1FF]); - if(newChk == sector[0] && - newChk != 0) + if(newChk == sector[0] && newChk != 0) { NewMap nmap = Marshal.ByteArrayToStructureLittleEndian(sector); drSb = nmap.discRecord; @@ -240,8 +237,7 @@ public sealed partial class AcornADFS if(drSb.log2secsize is < 8 or > 10) return false; - if(drSb.idlen < drSb.log2secsize + 3 || - drSb.idlen > 19) + if(drSb.idlen < drSb.log2secsize + 3 || drSb.idlen > 19) return false; if(drSb.disc_size_high >> drSb.log2secsize != 0) @@ -295,9 +291,7 @@ public sealed partial class AcornADFS OldMapSector1 oldMap1 = Marshal.ByteArrayToStructureLittleEndian(sector); // 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) + if(oldMap0.checksum == oldChk0 && oldMap1.checksum != oldChk1 && sector.Length >= 512) { errno = imagePlugin.ReadSector(0, out sector); @@ -355,8 +349,7 @@ public sealed partial class AcornADFS OldDirectory oldRoot = Marshal.ByteArrayToStructureLittleEndian(sector); - if(oldRoot.header.magic == OLD_DIR_MAGIC && - oldRoot.tail.magic == OLD_DIR_MAGIC) + if(oldRoot.header.magic == OLD_DIR_MAGIC && oldRoot.tail.magic == OLD_DIR_MAGIC) namebytes = oldRoot.tail.name; else { @@ -384,8 +377,7 @@ public sealed partial class AcornADFS oldRoot = Marshal.ByteArrayToStructureLittleEndian(sector); - if(oldRoot.header.magic == OLD_DIR_MAGIC && - oldRoot.tail.magic == OLD_DIR_MAGIC) + if(oldRoot.header.magic == OLD_DIR_MAGIC && oldRoot.tail.magic == OLD_DIR_MAGIC) namebytes = oldRoot.tail.name; else { @@ -406,8 +398,7 @@ public sealed partial class AcornADFS NewDirectory newRoot = Marshal.ByteArrayToStructureLittleEndian(sector); - if(newRoot.header.magic == NEW_DIR_MAGIC && - newRoot.tail.magic == NEW_DIR_MAGIC) + if(newRoot.header.magic == NEW_DIR_MAGIC && newRoot.tail.magic == NEW_DIR_MAGIC) namebytes = newRoot.tail.title; } } @@ -467,8 +458,7 @@ public sealed partial class AcornADFS AaruConsole.DebugWriteLine(MODULE_NAME, "bootChk = {0}", bootChk); AaruConsole.DebugWriteLine(MODULE_NAME, "bBlock.checksum = {0}", bootSector[0x1FF]); - if(newChk == sector[0] && - newChk != 0) + if(newChk == sector[0] && newChk != 0) { NewMap nmap = Marshal.ByteArrayToStructureLittleEndian(sector); drSb = nmap.discRecord; @@ -509,8 +499,7 @@ public sealed partial class AcornADFS if(drSb.log2secsize is < 8 or > 10) return; - if(drSb.idlen < drSb.log2secsize + 3 || - drSb.idlen > 19) + if(drSb.idlen < drSb.log2secsize + 3 || drSb.idlen > 19) return; if(drSb.disc_size_high >> drSb.log2secsize != 0) diff --git a/Aaru.Filesystems/AmigaDOS/Info.cs b/Aaru.Filesystems/AmigaDOS/Info.cs index e7fafc46d..24f72ae77 100644 --- a/Aaru.Filesystems/AmigaDOS/Info.cs +++ b/Aaru.Filesystems/AmigaDOS/Info.cs @@ -80,8 +80,7 @@ public sealed partial class AmigaDOSPlugin } // Not FFS or MuFS? - if((bblk.diskType & FFS_MASK) != FFS_MASK && - (bblk.diskType & MUFS_MASK) != MUFS_MASK) + if((bblk.diskType & FFS_MASK) != FFS_MASK && (bblk.diskType & MUFS_MASK) != MUFS_MASK) return false; // Clear checksum on sector @@ -158,8 +157,7 @@ public sealed partial class AmigaDOSPlugin rblk.sec_type = BigEndianBitConverter.ToUInt32(sector, sector.Length - 4); AaruConsole.DebugWriteLine(MODULE_NAME, "rblk.sec_type = {0}", rblk.sec_type); - if(rblk.sec_type == SUBTYPE_ROOT && - rblk.checksum == rsum) + if(rblk.sec_type == SUBTYPE_ROOT && rblk.checksum == rsum) return true; } @@ -256,8 +254,7 @@ public sealed partial class AmigaDOSPlugin rootBlk.sec_type = BigEndianBitConverter.ToUInt32(rootBlockSector, rootBlockSector.Length - 4); AaruConsole.DebugWriteLine(MODULE_NAME, "rootBlk.sec_type = {0}", rootBlk.sec_type); - if(rootBlk.sec_type != SUBTYPE_ROOT || - rootBlk.checksum != rsum) + if(rootBlk.sec_type != SUBTYPE_ROOT || rootBlk.checksum != rsum) continue; errno = imagePlugin.ReadSectors(rootPtr, sectorsPerBlock, out rootBlockSector); @@ -339,15 +336,13 @@ public sealed partial class AmigaDOSPlugin if(rootBlk.bitmapFlag == 0xFFFFFFFF) sbInformation.AppendLine(Localization.Volume_bitmap_is_valid); - if(rootBlk.bitmapExtensionBlock != 0x00000000 && - rootBlk.bitmapExtensionBlock != 0xFFFFFFFF) + if(rootBlk.bitmapExtensionBlock != 0x00000000 && rootBlk.bitmapExtensionBlock != 0xFFFFFFFF) { sbInformation.AppendFormat(Localization.Bitmap_extension_at_block_0, rootBlk.bitmapExtensionBlock). AppendLine(); } - if((bootBlk.diskType & 0xFF) == 4 || - (bootBlk.diskType & 0xFF) == 5) + if((bootBlk.diskType & 0xFF) == 4 || (bootBlk.diskType & 0xFF) == 5) sbInformation.AppendFormat(Localization.Directory_cache_starts_at_block_0, rootBlk.extension).AppendLine(); ulong blocks = (partition.End - partition.Start + 1) * imagePlugin.Info.SectorSize / blockSize; diff --git a/Aaru.Filesystems/AppleCommon/Info.cs b/Aaru.Filesystems/AppleCommon/Info.cs index 86bc77d68..6440c08f4 100644 --- a/Aaru.Filesystems/AppleCommon/Info.cs +++ b/Aaru.Filesystems/AppleCommon/Info.cs @@ -37,8 +37,7 @@ static partial class AppleCommon { internal static string GetBootBlockInformation(byte[] bbSector, Encoding encoding) { - if(bbSector is null || - bbSector.Length < 0x100) + if(bbSector is null || bbSector.Length < 0x100) return null; BootBlock bb = Marshal.ByteArrayToStructureBigEndian(bbSector); @@ -60,9 +59,9 @@ static partial class AppleCommon if((bb.bbVersion & 0x2000) > 0) { sb. - AppendFormat( - Localization.System_heap_will_be_extended_by_0_bytes_and_a_1_fraction_of_the_available_RAM, - bb.bbSysHeapExtra, bb.bbSysHeapFract).AppendLine(); + AppendFormat(Localization.System_heap_will_be_extended_by_0_bytes_and_a_1_fraction_of_the_available_RAM, + bb.bbSysHeapExtra, bb.bbSysHeapFract). + AppendLine(); } } } @@ -94,10 +93,12 @@ static partial class AppleCommon AppendLine(); sb.AppendFormat(Localization.Startup_screen_filename_0, - StringHandlers.PascalToString(bb.bbScreenName, encoding)).AppendLine(); + StringHandlers.PascalToString(bb.bbScreenName, encoding)). + AppendLine(); sb.AppendFormat(Localization.First_program_to_execute_at_boot_0, - StringHandlers.PascalToString(bb.bbHelloName, encoding)).AppendLine(); + StringHandlers.PascalToString(bb.bbHelloName, encoding)). + AppendLine(); sb.AppendFormat(Localization.Clipboard_filename_0, StringHandlers.PascalToString(bb.bbScrapName, encoding)). AppendLine(); diff --git a/Aaru.Filesystems/AppleDOS/AppleDOS.cs b/Aaru.Filesystems/AppleDOS/AppleDOS.cs index 7dd2e2020..988d961b3 100644 --- a/Aaru.Filesystems/AppleDOS/AppleDOS.cs +++ b/Aaru.Filesystems/AppleDOS/AppleDOS.cs @@ -78,7 +78,9 @@ public sealed partial class AppleDOS : IReadOnlyFilesystem static Dictionary GetDefaultOptions() => new() { - { "debug", false.ToString() } + { + "debug", false.ToString() + } }; #region Caches diff --git a/Aaru.Filesystems/AppleDOS/Dir.cs b/Aaru.Filesystems/AppleDOS/Dir.cs index 4e14da449..e0080f7fa 100644 --- a/Aaru.Filesystems/AppleDOS/Dir.cs +++ b/Aaru.Filesystems/AppleDOS/Dir.cs @@ -60,8 +60,7 @@ public sealed partial class AppleDOS if(!_mounted) return ErrorNumber.AccessDenied; - if(!string.IsNullOrEmpty(path) && - string.Compare(path, "/", StringComparison.OrdinalIgnoreCase) != 0) + if(!string.IsNullOrEmpty(path) && string.Compare(path, "/", StringComparison.OrdinalIgnoreCase) != 0) return ErrorNumber.NotSupported; var contents = _catalogCache.Keys.ToList(); @@ -130,8 +129,7 @@ public sealed partial class AppleDOS _fileTypeCache = new Dictionary(); _lockedFiles = new List(); - if(lba == 0 || - lba > _device.Info.Sectors) + if(lba == 0 || lba > _device.Info.Sectors) return ErrorNumber.InvalidArgument; while(lba != 0) @@ -167,8 +165,7 @@ public sealed partial class AppleDOS _catalogCache.TryAdd(filename, ts); _fileTypeCache.TryAdd(filename, (byte)(entry.typeAndFlags & 0x7F)); - if((entry.typeAndFlags & 0x80) == 0x80 && - !_lockedFiles.Contains(filename)) + if((entry.typeAndFlags & 0x80) == 0x80 && !_lockedFiles.Contains(filename)) _lockedFiles.Add(filename); } diff --git a/Aaru.Filesystems/AppleDOS/File.cs b/Aaru.Filesystems/AppleDOS/File.cs index 9ea012c73..6b9629ac2 100644 --- a/Aaru.Filesystems/AppleDOS/File.cs +++ b/Aaru.Filesystems/AppleDOS/File.cs @@ -50,7 +50,10 @@ public sealed partial class AppleDOS if(!_mounted) return ErrorNumber.AccessDenied; - string[] pathElements = path.Split(new[] { '/' }, StringSplitOptions.RemoveEmptyEntries); + string[] pathElements = path.Split(new[] + { + '/' + }, StringSplitOptions.RemoveEmptyEntries); if(pathElements.Length != 1) return ErrorNumber.NotSupported; @@ -66,9 +69,10 @@ public sealed partial class AppleDOS if(_lockedFiles.Contains(filename)) attributes |= FileAttributes.ReadOnly; - if(_debug && (string.Compare(path, "$", StringComparison.InvariantCulture) == 0 || - string.Compare(path, "$Boot", StringComparison.InvariantCulture) == 0 || - string.Compare(path, "$Vtoc", StringComparison.InvariantCulture) == 0)) + if(_debug && + (string.Compare(path, "$", StringComparison.InvariantCulture) == 0 || + string.Compare(path, "$Boot", StringComparison.InvariantCulture) == 0 || + string.Compare(path, "$Vtoc", StringComparison.InvariantCulture) == 0)) attributes |= FileAttributes.System; return ErrorNumber.NoError; @@ -81,7 +85,10 @@ public sealed partial class AppleDOS if(!_mounted) return ErrorNumber.AccessDenied; - string[] pathElements = path.Split(new[] { '/' }, StringSplitOptions.RemoveEmptyEntries); + string[] pathElements = path.Split(new[] + { + '/' + }, StringSplitOptions.RemoveEmptyEntries); if(pathElements.Length != 1) return ErrorNumber.NotSupported; @@ -92,9 +99,10 @@ public sealed partial class AppleDOS if(filename.Length > 30) return ErrorNumber.NameTooLong; - if(_debug && (string.Compare(path, "$", StringComparison.InvariantCulture) == 0 || - string.Compare(path, "$Boot", StringComparison.InvariantCulture) == 0 || - string.Compare(path, "$Vtoc", StringComparison.InvariantCulture) == 0)) + if(_debug && + (string.Compare(path, "$", StringComparison.InvariantCulture) == 0 || + string.Compare(path, "$Boot", StringComparison.InvariantCulture) == 0 || + string.Compare(path, "$Vtoc", StringComparison.InvariantCulture) == 0)) { if(string.Compare(path, "$", StringComparison.InvariantCulture) == 0) file = _catalogBlocks; @@ -150,8 +158,7 @@ public sealed partial class AppleDOS if(!_mounted) return ErrorNumber.AccessDenied; - if(buffer is null || - buffer.Length < length) + if(buffer is null || buffer.Length < length) return ErrorNumber.InvalidArgument; if(node is not AppleDosFileNode mynode) @@ -177,7 +184,10 @@ public sealed partial class AppleDOS if(!_mounted) return ErrorNumber.AccessDenied; - string[] pathElements = path.Split(new[] { '/' }, StringSplitOptions.RemoveEmptyEntries); + string[] pathElements = path.Split(new[] + { + '/' + }, StringSplitOptions.RemoveEmptyEntries); if(pathElements.Length != 1) return ErrorNumber.NotSupported; @@ -195,9 +205,10 @@ public sealed partial class AppleDOS _fileSizeCache.TryGetValue(filename, out int fileSize); GetAttributes(path, out FileAttributes attrs); - if(_debug && (string.Compare(path, "$", StringComparison.InvariantCulture) == 0 || - string.Compare(path, "$Boot", StringComparison.InvariantCulture) == 0 || - string.Compare(path, "$Vtoc", StringComparison.InvariantCulture) == 0)) + if(_debug && + (string.Compare(path, "$", StringComparison.InvariantCulture) == 0 || + string.Compare(path, "$Boot", StringComparison.InvariantCulture) == 0 || + string.Compare(path, "$Vtoc", StringComparison.InvariantCulture) == 0)) { if(string.Compare(path, "$", StringComparison.InvariantCulture) == 0) stat.Length = _catalogBlocks.Length; @@ -225,7 +236,10 @@ public sealed partial class AppleDOS ErrorNumber CacheFile(string path) { - string[] pathElements = path.Split(new[] { '/' }, StringSplitOptions.RemoveEmptyEntries); + string[] pathElements = path.Split(new[] + { + '/' + }, StringSplitOptions.RemoveEmptyEntries); if(pathElements.Length != 1) return ErrorNumber.NotSupported; diff --git a/Aaru.Filesystems/AppleDOS/Info.cs b/Aaru.Filesystems/AppleDOS/Info.cs index abb828388..3a48592ca 100644 --- a/Aaru.Filesystems/AppleDOS/Info.cs +++ b/Aaru.Filesystems/AppleDOS/Info.cs @@ -42,12 +42,10 @@ public sealed partial class AppleDOS /// public bool Identify(IMediaImage imagePlugin, Partition partition) { - if(imagePlugin.Info.Sectors != 455 && - imagePlugin.Info.Sectors != 560) + if(imagePlugin.Info.Sectors != 455 && imagePlugin.Info.Sectors != 560) return false; - if(partition.Start > 0 || - imagePlugin.Info.SectorSize != 256) + if(partition.Start > 0 || imagePlugin.Info.SectorSize != 256) return false; int spt = imagePlugin.Info.Sectors == 455 ? 13 : 16; @@ -59,8 +57,10 @@ public sealed partial class AppleDOS _vtoc = Marshal.ByteArrayToStructureLittleEndian(vtocB); - 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; } /// diff --git a/Aaru.Filesystems/AppleDOS/Super.cs b/Aaru.Filesystems/AppleDOS/Super.cs index c4e1637b5..6a5f3c2c4 100644 --- a/Aaru.Filesystems/AppleDOS/Super.cs +++ b/Aaru.Filesystems/AppleDOS/Super.cs @@ -51,8 +51,7 @@ public sealed partial class AppleDOS _start = partition.Start; _encoding = encoding ?? new Apple2(); - if(_device.Info.Sectors != 455 && - _device.Info.Sectors != 560) + if(_device.Info.Sectors != 455 && _device.Info.Sectors != 560) { AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Incorrect_device_size); diff --git a/Aaru.Filesystems/AppleDOS/Xattr.cs b/Aaru.Filesystems/AppleDOS/Xattr.cs index 30c86f16f..bd3d7d994 100644 --- a/Aaru.Filesystems/AppleDOS/Xattr.cs +++ b/Aaru.Filesystems/AppleDOS/Xattr.cs @@ -48,7 +48,10 @@ public sealed partial class AppleDOS if(!_mounted) return ErrorNumber.AccessDenied; - string[] pathElements = path.Split(new[] { '/' }, StringSplitOptions.RemoveEmptyEntries); + string[] pathElements = path.Split(new[] + { + '/' + }, StringSplitOptions.RemoveEmptyEntries); if(pathElements.Length != 1) return ErrorNumber.NotSupported; @@ -60,9 +63,10 @@ public sealed partial class AppleDOS xattrs = new List(); - if(_debug && (string.Compare(path, "$", StringComparison.InvariantCulture) == 0 || - string.Compare(path, "$Boot", StringComparison.InvariantCulture) == 0 || - string.Compare(path, "$Vtoc", StringComparison.InvariantCulture) == 0)) {} + if(_debug && + (string.Compare(path, "$", StringComparison.InvariantCulture) == 0 || + string.Compare(path, "$Boot", StringComparison.InvariantCulture) == 0 || + string.Compare(path, "$Vtoc", StringComparison.InvariantCulture) == 0)) {} else { if(!_catalogCache.ContainsKey(filename)) @@ -83,7 +87,10 @@ public sealed partial class AppleDOS if(!_mounted) return ErrorNumber.AccessDenied; - string[] pathElements = path.Split(new[] { '/' }, StringSplitOptions.RemoveEmptyEntries); + string[] pathElements = path.Split(new[] + { + '/' + }, StringSplitOptions.RemoveEmptyEntries); if(pathElements.Length != 1) return ErrorNumber.NotSupported; @@ -93,9 +100,10 @@ public sealed partial class AppleDOS if(filename.Length > 30) return ErrorNumber.NameTooLong; - if(_debug && (string.Compare(path, "$", StringComparison.InvariantCulture) == 0 || - string.Compare(path, "$Boot", StringComparison.InvariantCulture) == 0 || - string.Compare(path, "$Vtoc", StringComparison.InvariantCulture) == 0)) + if(_debug && + (string.Compare(path, "$", StringComparison.InvariantCulture) == 0 || + string.Compare(path, "$Boot", StringComparison.InvariantCulture) == 0 || + string.Compare(path, "$Vtoc", StringComparison.InvariantCulture) == 0)) return ErrorNumber.NoSuchExtendedAttribute; if(!_catalogCache.ContainsKey(filename)) @@ -112,8 +120,7 @@ public sealed partial class AppleDOS return ErrorNumber.NoError; } - if(string.Compare(xattr, "com.apple.dos.tracksectorlist", StringComparison.InvariantCulture) != 0 || - !_debug) + if(string.Compare(xattr, "com.apple.dos.tracksectorlist", StringComparison.InvariantCulture) != 0 || !_debug) return ErrorNumber.NoSuchExtendedAttribute; if(!_extentCache.TryGetValue(filename, out byte[] ts)) diff --git a/Aaru.Filesystems/AppleHFS/Info.cs b/Aaru.Filesystems/AppleHFS/Info.cs index 3abdffbca..9d325443f 100644 --- a/Aaru.Filesystems/AppleHFS/Info.cs +++ b/Aaru.Filesystems/AppleHFS/Info.cs @@ -60,8 +60,10 @@ public sealed partial class AppleHFS if(errno != ErrorNumber.NoError) return false; - foreach(int offset in new[] { 0, 0x200, 0x400, 0x600, 0x800, 0xA00 }.Where( - offset => mdbSector.Length >= offset + 0x7C + 2)) + foreach(int offset in new[] + { + 0, 0x200, 0x400, 0x600, 0x800, 0xA00 + }.Where(offset => mdbSector.Length >= offset + 0x7C + 2)) { drSigWord = BigEndianBitConverter.ToUInt16(mdbSector, offset); @@ -120,7 +122,10 @@ public sealed partial class AppleHFS if(errno != ErrorNumber.NoError) return; - foreach(int offset in new[] { 0, 0x200, 0x400, 0x600, 0x800, 0xA00 }) + foreach(int offset in new[] + { + 0, 0x200, 0x400, 0x600, 0x800, 0xA00 + }) { drSigWord = BigEndianBitConverter.ToUInt16(tmpSector, offset); @@ -239,8 +244,7 @@ public sealed partial class AppleHFS sb.AppendFormat(Localization.CNID_of_bootable_Mac_OS_8_or_9_directory_0, mdb.drFndrInfo3).AppendLine(); sb.AppendFormat(Localization.CNID_of_bootable_Mac_OS_X_directory_0, mdb.drFndrInfo5).AppendLine(); - if(mdb.drFndrInfo6 != 0 && - mdb.drFndrInfo7 != 0) + if(mdb.drFndrInfo6 != 0 && mdb.drFndrInfo7 != 0) sb.AppendFormat(Localization.Mac_OS_X_Volume_ID_0_1, mdb.drFndrInfo6, mdb.drFndrInfo7).AppendLine(); if(mdb.drEmbedSigWord == AppleCommon.HFSP_MAGIC) @@ -264,9 +268,7 @@ public sealed partial class AppleHFS sb.AppendLine(); sb.AppendLine(bootBlockInfo); } - else if(mdb.drFndrInfo0 != 0 || - mdb.drFndrInfo3 != 0 || - mdb.drFndrInfo5 != 0) + else if(mdb.drFndrInfo0 != 0 || mdb.drFndrInfo3 != 0 || mdb.drFndrInfo5 != 0) sb.AppendLine(Localization.Volume_is_bootable); else sb.AppendLine(Localization.Volume_is_not_bootable); @@ -278,8 +280,8 @@ public sealed partial class AppleHFS if(mdb.drVolBkUp > 0) metadata.BackupDate = DateHandlers.MacToDateTime(mdb.drVolBkUp); - metadata.Bootable = bootBlockInfo != null || mdb.drFndrInfo0 != 0 || mdb.drFndrInfo3 != 0 || - mdb.drFndrInfo5 != 0; + metadata.Bootable = + bootBlockInfo != null || mdb.drFndrInfo0 != 0 || mdb.drFndrInfo3 != 0 || mdb.drFndrInfo5 != 0; metadata.Clusters = mdb.drNmAlBlks; metadata.ClusterSize = mdb.drAlBlkSiz; @@ -297,8 +299,7 @@ public sealed partial class AppleHFS metadata.Type = FS_TYPE; metadata.VolumeName = StringHandlers.PascalToString(mdb.drVN, encoding); - if(mdb.drFndrInfo6 != 0 && - mdb.drFndrInfo7 != 0) + if(mdb.drFndrInfo6 != 0 && mdb.drFndrInfo7 != 0) metadata.VolumeSerial = $"{mdb.drFndrInfo6:X8}{mdb.drFndrInfo7:X8}"; } diff --git a/Aaru.Filesystems/AppleHFSPlus/Info.cs b/Aaru.Filesystems/AppleHFSPlus/Info.cs index 00c901d53..b6788e6cb 100644 --- a/Aaru.Filesystems/AppleHFSPlus/Info.cs +++ b/Aaru.Filesystems/AppleHFSPlus/Info.cs @@ -158,8 +158,7 @@ public sealed partial class AppleHFSPlus vh.signature = BigEndianBitConverter.ToUInt16(vhSector, 0x400); - if(vh.signature != AppleCommon.HFSP_MAGIC && - vh.signature != AppleCommon.HFSX_MAGIC) + if(vh.signature != AppleCommon.HFSP_MAGIC && vh.signature != AppleCommon.HFSX_MAGIC) return; var sb = new StringBuilder(); @@ -214,7 +213,8 @@ public sealed partial class AppleHFSPlus sb.AppendLine(Localization.Volume_is_locked_by_software); sb.AppendFormat(Localization.Implementation_that_last_mounted_the_volume_0, - Encoding.ASCII.GetString(vh.lastMountedVersion)).AppendLine(); + Encoding.ASCII.GetString(vh.lastMountedVersion)). + AppendLine(); if((vh.attributes & 0x2000) == 0x2000) sb.AppendFormat(Localization.Journal_starts_at_allocation_block_0, vh.journalInfoBlock).AppendLine(); @@ -262,8 +262,7 @@ public sealed partial class AppleHFSPlus sb.AppendFormat(Localization.CNID_of_bootable_Mac_OS_8_or_9_directory_0, vh.drFndrInfo3).AppendLine(); sb.AppendFormat(Localization.CNID_of_bootable_Mac_OS_X_directory_0, vh.drFndrInfo5).AppendLine(); - if(vh.drFndrInfo6 != 0 && - vh.drFndrInfo7 != 0) + if(vh.drFndrInfo6 != 0 && vh.drFndrInfo7 != 0) sb.AppendFormat(Localization.Mac_OS_X_Volume_ID_0_1, vh.drFndrInfo6, vh.drFndrInfo7).AppendLine(); metadata = new FileSystem(); @@ -292,8 +291,7 @@ public sealed partial class AppleHFSPlus _ => metadata.Type }; - if(vh.drFndrInfo6 != 0 && - vh.drFndrInfo7 != 0) + if(vh.drFndrInfo6 != 0 && vh.drFndrInfo7 != 0) metadata.VolumeSerial = $"{vh.drFndrInfo6:X8}{vh.drFndrInfo7:X8}"; metadata.SystemIdentifier = Encoding.ASCII.GetString(vh.lastMountedVersion); diff --git a/Aaru.Filesystems/AppleMFS/AppleMFS.cs b/Aaru.Filesystems/AppleMFS/AppleMFS.cs index e2a4f9c9a..5ba4a1586 100644 --- a/Aaru.Filesystems/AppleMFS/AppleMFS.cs +++ b/Aaru.Filesystems/AppleMFS/AppleMFS.cs @@ -86,6 +86,8 @@ public sealed partial class AppleMFS : IReadOnlyFilesystem static Dictionary GetDefaultOptions() => new() { - { "debug", false.ToString() } + { + "debug", false.ToString() + } }; } \ No newline at end of file diff --git a/Aaru.Filesystems/AppleMFS/Dir.cs b/Aaru.Filesystems/AppleMFS/Dir.cs index bc97fd382..07d134568 100644 --- a/Aaru.Filesystems/AppleMFS/Dir.cs +++ b/Aaru.Filesystems/AppleMFS/Dir.cs @@ -49,8 +49,7 @@ public sealed partial class AppleMFS if(!_mounted) return ErrorNumber.AccessDenied; - if(!string.IsNullOrEmpty(path) && - string.Compare(path, "/", StringComparison.OrdinalIgnoreCase) != 0) + if(!string.IsNullOrEmpty(path) && string.Compare(path, "/", StringComparison.OrdinalIgnoreCase) != 0) return ErrorNumber.NotSupported; var contents = _idToFilename.Select(kvp => kvp.Value).ToList(); @@ -147,7 +146,8 @@ public sealed partial class AppleMFS 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(). + string lowerFilename = StringHandlers.PascalToString(entry.flNam, _encoding). + ToLowerInvariant(). Replace('/', ':'); if(entry.flFlags.HasFlag(FileFlags.Used) && diff --git a/Aaru.Filesystems/AppleMFS/File.cs b/Aaru.Filesystems/AppleMFS/File.cs index 0cb5dde49..aa86e47b3 100644 --- a/Aaru.Filesystems/AppleMFS/File.cs +++ b/Aaru.Filesystems/AppleMFS/File.cs @@ -50,7 +50,10 @@ public sealed partial class AppleMFS if(!_mounted) return ErrorNumber.AccessDenied; - string[] pathElements = path.Split(new[] { '/' }, StringSplitOptions.RemoveEmptyEntries); + string[] pathElements = path.Split(new[] + { + '/' + }, StringSplitOptions.RemoveEmptyEntries); if(pathElements.Length != 1) return ErrorNumber.NotSupported; @@ -174,8 +177,7 @@ public sealed partial class AppleMFS if(!_mounted) return ErrorNumber.AccessDenied; - if(buffer is null || - buffer.Length < length) + if(buffer is null || buffer.Length < length) return ErrorNumber.InvalidArgument; if(node is not AppleMfsFileNode mynode) @@ -201,7 +203,10 @@ public sealed partial class AppleMFS if(!_mounted) return ErrorNumber.AccessDenied; - string[] pathElements = path.Split(new[] { '/' }, StringSplitOptions.RemoveEmptyEntries); + string[] pathElements = path.Split(new[] + { + '/' + }, StringSplitOptions.RemoveEmptyEntries); if(pathElements.Length != 1) return ErrorNumber.NotSupported; @@ -225,8 +230,7 @@ public sealed partial class AppleMFS if(string.Compare(path, "$", StringComparison.InvariantCulture) == 0) { - stat.Blocks = _directoryBlocks.Length / stat.BlockSize + - _directoryBlocks.Length % stat.BlockSize; + stat.Blocks = _directoryBlocks.Length / stat.BlockSize + _directoryBlocks.Length % stat.BlockSize; stat.Length = _directoryBlocks.Length; } @@ -236,8 +240,7 @@ public sealed partial class AppleMFS stat.Length = _blockMapBytes.Length; } - else if(string.Compare(path, "$Boot", StringComparison.InvariantCulture) == 0 && - _bootBlocks != null) + else if(string.Compare(path, "$Boot", StringComparison.InvariantCulture) == 0 && _bootBlocks != null) { stat.Blocks = _bootBlocks.Length / stat.BlockSize + _bootBlocks.Length % stat.BlockSize; stat.Length = _bootBlocks.Length; @@ -297,7 +300,10 @@ public sealed partial class AppleMFS if(!_mounted) return ErrorNumber.AccessDenied; - string[] pathElements = path.Split(new[] { '/' }, StringSplitOptions.RemoveEmptyEntries); + string[] pathElements = path.Split(new[] + { + '/' + }, StringSplitOptions.RemoveEmptyEntries); if(pathElements.Length != 1) return ErrorNumber.NotSupported; @@ -341,14 +347,14 @@ public sealed partial class AppleMFS { byte[] sectors; - ErrorNumber errno = - tags - ? _device. - ReadSectorsTag((ulong)((nextBlock - 2) * _sectorsPerBlock) + _volMdb.drAlBlSt + _partitionStart, - (uint)_sectorsPerBlock, SectorTagType.AppleSectorTag, out sectors) - : _device. - ReadSectors((ulong)((nextBlock - 2) * _sectorsPerBlock) + _volMdb.drAlBlSt + _partitionStart, - (uint)_sectorsPerBlock, out sectors); + ErrorNumber errno = tags + ? _device. + ReadSectorsTag((ulong)((nextBlock - 2) * _sectorsPerBlock) + _volMdb.drAlBlSt + _partitionStart, + (uint)_sectorsPerBlock, SectorTagType.AppleSectorTag, + out sectors) + : _device. + ReadSectors((ulong)((nextBlock - 2) * _sectorsPerBlock) + _volMdb.drAlBlSt + _partitionStart, + (uint)_sectorsPerBlock, out sectors); if(errno != ErrorNumber.NoError) return errno; diff --git a/Aaru.Filesystems/AppleMFS/Xattr.cs b/Aaru.Filesystems/AppleMFS/Xattr.cs index af30a60e6..8a9e5320c 100644 --- a/Aaru.Filesystems/AppleMFS/Xattr.cs +++ b/Aaru.Filesystems/AppleMFS/Xattr.cs @@ -51,7 +51,10 @@ public sealed partial class AppleMFS if(!_mounted) return ErrorNumber.AccessDenied; - string[] pathElements = path.Split(new[] { '/' }, StringSplitOptions.RemoveEmptyEntries); + string[] pathElements = path.Split(new[] + { + '/' + }, StringSplitOptions.RemoveEmptyEntries); if(pathElements.Length != 1) return ErrorNumber.NotSupported; @@ -90,9 +93,7 @@ public sealed partial class AppleMFS xattrs.Add("com.apple.FinderInfo"); - if(_debug && - _device.Info.ReadableSectorTags.Contains(SectorTagType.AppleSectorTag) && - entry.flLgLen > 0) + if(_debug && _device.Info.ReadableSectorTags.Contains(SectorTagType.AppleSectorTag) && entry.flLgLen > 0) xattrs.Add("com.apple.macintosh.tags"); xattrs.Sort(); @@ -106,7 +107,10 @@ public sealed partial class AppleMFS if(!_mounted) return ErrorNumber.AccessDenied; - string[] pathElements = path.Split(new[] { '/' }, StringSplitOptions.RemoveEmptyEntries); + string[] pathElements = path.Split(new[] + { + '/' + }, StringSplitOptions.RemoveEmptyEntries); if(pathElements.Length != 1) return ErrorNumber.NotSupported; diff --git a/Aaru.Filesystems/AtheOS/Info.cs b/Aaru.Filesystems/AtheOS/Info.cs index 554b782b2..951634fde 100644 --- a/Aaru.Filesystems/AtheOS/Info.cs +++ b/Aaru.Filesystems/AtheOS/Info.cs @@ -110,7 +110,8 @@ public sealed partial class AtheOS sb.AppendFormat(Localization._0_bytes_per_block, afsSb.block_size).AppendLine(); sb.AppendFormat(Localization._0_blocks_in_volume_1_bytes, afsSb.num_blocks, - afsSb.num_blocks * afsSb.block_size).AppendLine(); + afsSb.num_blocks * afsSb.block_size). + AppendLine(); sb.AppendFormat(Localization._0_used_blocks_1_bytes, afsSb.used_blocks, afsSb.used_blocks * afsSb.block_size). AppendLine(); @@ -118,39 +119,41 @@ public sealed partial class AtheOS sb.AppendFormat(Localization._0_bytes_per_i_node, afsSb.inode_size).AppendLine(); sb.AppendFormat(Localization._0_blocks_per_allocation_group_1_bytes, afsSb.blocks_per_ag, - afsSb.blocks_per_ag * afsSb.block_size).AppendLine(); + afsSb.blocks_per_ag * afsSb.block_size). + AppendLine(); sb.AppendFormat(Localization._0_allocation_groups_in_volume, afsSb.num_ags).AppendLine(); sb.AppendFormat(Localization.Journal_resides_in_block_0_of_allocation_group_1_and_runs_for_2_blocks_3_bytes, afsSb.log_blocks_start, afsSb.log_blocks_ag, afsSb.log_blocks_len, - afsSb.log_blocks_len * afsSb.block_size).AppendLine(); + afsSb.log_blocks_len * afsSb.block_size). + AppendLine(); sb.AppendFormat(Localization.Journal_starts_in_byte_0_and_has_1_bytes_in_2_blocks, afsSb.log_start, - afsSb.log_size, afsSb.log_valid_blocks).AppendLine(); + afsSb.log_size, afsSb.log_valid_blocks). + AppendLine(); sb. - AppendFormat( - Localization. - 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(Localization.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( - Localization. - Directory_containing_files_scheduled_for_deletion_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(Localization.Directory_containing_files_scheduled_for_deletion_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( - Localization.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(Localization.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(Localization._0_blocks_for_bootloader_1_bytes, afsSb.boot_size, - afsSb.boot_size * afsSb.block_size).AppendLine(); + afsSb.boot_size * afsSb.block_size). + AppendLine(); information = sb.ToString(); diff --git a/Aaru.Filesystems/BFS/Info.cs b/Aaru.Filesystems/BFS/Info.cs index 4b2ecad9d..1a46b4af0 100644 --- a/Aaru.Filesystems/BFS/Info.cs +++ b/Aaru.Filesystems/BFS/Info.cs @@ -59,8 +59,7 @@ public sealed partial class BeFS var magic = BitConverter.ToUInt32(sbSector, 0x20); var magicBe = BigEndianBitConverter.ToUInt32(sbSector, 0x20); - if(magic == BEFS_MAGIC1 || - magicBe == BEFS_MAGIC1) + if(magic == BEFS_MAGIC1 || magicBe == BEFS_MAGIC1) return true; if(sbSector.Length >= 0x400) @@ -69,8 +68,7 @@ public sealed partial class BeFS magicBe = BigEndianBitConverter.ToUInt32(sbSector, 0x220); } - if(magic == BEFS_MAGIC1 || - magicBe == BEFS_MAGIC1) + if(magic == BEFS_MAGIC1 || magicBe == BEFS_MAGIC1) return true; errno = imagePlugin.ReadSector(1 + partition.Start, out sbSector); @@ -167,7 +165,8 @@ public sealed partial class BeFS sb.AppendFormat(Localization.Indices_i_node_size_0_blocks_Should_be_one, besb.indices_len).AppendLine(); sb.AppendFormat(Localization.blockshift_0_1_should_be_2, besb.block_shift, 1 << (int)besb.block_shift, - besb.block_size).AppendLine(); + besb.block_size). + AppendLine(); } switch(besb.flags) @@ -200,28 +199,27 @@ public sealed partial class BeFS sb.AppendFormat(Localization._0_bytes_per_i_node, besb.inode_size).AppendLine(); sb.AppendFormat(Localization._0_blocks_per_allocation_group_1_bytes, besb.blocks_per_ag, - besb.blocks_per_ag * besb.block_size).AppendLine(); + besb.blocks_per_ag * besb.block_size). + AppendLine(); sb.AppendFormat(Localization._0_allocation_groups_in_volume, besb.num_ags).AppendLine(); sb.AppendFormat(Localization.Journal_resides_in_block_0_of_allocation_group_1_and_runs_for_2_blocks_3_bytes, besb.log_blocks_start, besb.log_blocks_ag, besb.log_blocks_len, - besb.log_blocks_len * besb.block_size).AppendLine(); + besb.log_blocks_len * besb.block_size). + AppendLine(); sb.AppendFormat(Localization.Journal_starts_in_byte_0_and_ends_in_byte_1, besb.log_start, besb.log_end). AppendLine(); sb. - AppendFormat( - Localization. - 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). + AppendFormat(Localization.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( - Localization.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). + AppendFormat(Localization.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(); diff --git a/Aaru.Filesystems/BTRFS/Info.cs b/Aaru.Filesystems/BTRFS/Info.cs index 97ccbd8f7..8a0f7b711 100644 --- a/Aaru.Filesystems/BTRFS/Info.cs +++ b/Aaru.Filesystems/BTRFS/Info.cs @@ -120,8 +120,7 @@ public sealed partial class BTRFS AaruConsole.DebugWriteLine(MODULE_NAME, "btrfsSb.stripesize = {0}", btrfsSb.stripesize); AaruConsole.DebugWriteLine(MODULE_NAME, "btrfsSb.n = {0}", btrfsSb.n); - AaruConsole.DebugWriteLine(MODULE_NAME, "btrfsSb.chunk_root_generation = {0}", - btrfsSb.chunk_root_generation); + AaruConsole.DebugWriteLine(MODULE_NAME, "btrfsSb.chunk_root_generation = {0}", btrfsSb.chunk_root_generation); AaruConsole.DebugWriteLine(MODULE_NAME, "btrfsSb.compat_flags = 0x{0:X16}", btrfsSb.compat_flags); AaruConsole.DebugWriteLine(MODULE_NAME, "btrfsSb.compat_ro_flags = 0x{0:X16}", btrfsSb.compat_ro_flags); @@ -134,21 +133,17 @@ public sealed partial class BTRFS AaruConsole.DebugWriteLine(MODULE_NAME, "btrfsSb.dev_item.bytes = {0}", btrfsSb.dev_item.bytes); AaruConsole.DebugWriteLine(MODULE_NAME, "btrfsSb.dev_item.used = {0}", btrfsSb.dev_item.used); - AaruConsole.DebugWriteLine(MODULE_NAME, "btrfsSb.dev_item.optimal_align = {0}", - btrfsSb.dev_item.optimal_align); + AaruConsole.DebugWriteLine(MODULE_NAME, "btrfsSb.dev_item.optimal_align = {0}", btrfsSb.dev_item.optimal_align); - AaruConsole.DebugWriteLine(MODULE_NAME, "btrfsSb.dev_item.optimal_width = {0}", - btrfsSb.dev_item.optimal_width); + AaruConsole.DebugWriteLine(MODULE_NAME, "btrfsSb.dev_item.optimal_width = {0}", btrfsSb.dev_item.optimal_width); - AaruConsole.DebugWriteLine(MODULE_NAME, "btrfsSb.dev_item.minimal_size = {0}", - btrfsSb.dev_item.minimal_size); + AaruConsole.DebugWriteLine(MODULE_NAME, "btrfsSb.dev_item.minimal_size = {0}", btrfsSb.dev_item.minimal_size); AaruConsole.DebugWriteLine(MODULE_NAME, "btrfsSb.dev_item.type = {0}", btrfsSb.dev_item.type); AaruConsole.DebugWriteLine(MODULE_NAME, "btrfsSb.dev_item.generation = {0}", btrfsSb.dev_item.generation); - AaruConsole.DebugWriteLine(MODULE_NAME, "btrfsSb.dev_item.start_offset = {0}", - btrfsSb.dev_item.start_offset); + AaruConsole.DebugWriteLine(MODULE_NAME, "btrfsSb.dev_item.start_offset = {0}", btrfsSb.dev_item.start_offset); AaruConsole.DebugWriteLine(MODULE_NAME, "btrfsSb.dev_item.dev_group = {0}", btrfsSb.dev_item.dev_group); @@ -169,7 +164,8 @@ public sealed partial class BTRFS sbInformation.AppendFormat(Localization.Log_tree_starts_at_LBA_0, btrfsSb.log_lba).AppendLine(); sbInformation.AppendFormat(Localization.Volume_has_0_bytes_spanned_in_1_devices, btrfsSb.total_bytes, - btrfsSb.num_devices).AppendLine(); + btrfsSb.num_devices). + AppendLine(); sbInformation.AppendFormat(Localization.Volume_has_0_bytes_used, btrfsSb.bytes_used).AppendLine(); sbInformation.AppendFormat(Localization._0_bytes_sector, btrfsSb.sectorsize).AppendLine(); diff --git a/Aaru.Filesystems/CBM/Info.cs b/Aaru.Filesystems/CBM/Info.cs index ade10a172..afd2846bf 100644 --- a/Aaru.Filesystems/CBM/Info.cs +++ b/Aaru.Filesystems/CBM/Info.cs @@ -70,8 +70,7 @@ public sealed partial class CBM Header cbmHdr = Marshal.ByteArrayToStructureLittleEndian
(sector); - if(cbmHdr.diskDosVersion == 0x44 && - cbmHdr is { dosVersion: 0x33, diskVersion: 0x44 }) + if(cbmHdr.diskDosVersion == 0x44 && cbmHdr is { dosVersion: 0x33, diskVersion: 0x44 }) return true; } else @@ -119,18 +118,26 @@ public sealed partial class CBM Header cbmHdr = Marshal.ByteArrayToStructureLittleEndian
(sector); sbInformation.AppendFormat(Localization.Directory_starts_at_track_0_sector_1, cbmHdr.directoryTrack, - cbmHdr.directorySector).AppendLine(); + cbmHdr.directorySector). + AppendLine(); - sbInformation.AppendFormat(Localization.Disk_DOS_Version_0, - Encoding.ASCII.GetString(new[] { cbmHdr.diskDosVersion })).AppendLine(); + sbInformation.AppendFormat(Localization.Disk_DOS_Version_0, Encoding.ASCII.GetString(new[] + { + cbmHdr.diskDosVersion + })). + AppendLine(); - sbInformation. - AppendFormat(Localization.DOS_Version_0, Encoding.ASCII.GetString(new[] { cbmHdr.dosVersion })). - AppendLine(); + sbInformation.AppendFormat(Localization.DOS_Version_0, Encoding.ASCII.GetString(new[] + { + cbmHdr.dosVersion + })). + AppendLine(); - sbInformation. - AppendFormat(Localization.Disk_Version_0, Encoding.ASCII.GetString(new[] { cbmHdr.diskVersion })). - AppendLine(); + sbInformation.AppendFormat(Localization.Disk_Version_0, Encoding.ASCII.GetString(new[] + { + cbmHdr.diskVersion + })). + AppendLine(); sbInformation.AppendFormat(Localization.Disk_ID_0, cbmHdr.diskId).AppendLine(); @@ -150,14 +157,18 @@ public sealed partial class CBM BAM cbmBam = Marshal.ByteArrayToStructureLittleEndian(sector); sbInformation.AppendFormat(Localization.Directory_starts_at_track_0_sector_1, cbmBam.directoryTrack, - cbmBam.directorySector).AppendLine(); + cbmBam.directorySector). + AppendLine(); sbInformation.AppendFormat(Localization.Disk_DOS_type_0, - Encoding.ASCII.GetString(BitConverter.GetBytes(cbmBam.dosType))).AppendLine(); + Encoding.ASCII.GetString(BitConverter.GetBytes(cbmBam.dosType))). + AppendLine(); - sbInformation. - AppendFormat(Localization.DOS_Version_0, Encoding.ASCII.GetString(new[] { cbmBam.dosVersion })). - AppendLine(); + sbInformation.AppendFormat(Localization.DOS_Version_0, Encoding.ASCII.GetString(new[] + { + cbmBam.dosVersion + })). + AppendLine(); sbInformation.AppendFormat(Localization.Disk_ID_0, cbmBam.diskId).AppendLine(); diff --git a/Aaru.Filesystems/CPM/Definitions.cs b/Aaru.Filesystems/CPM/Definitions.cs index 30bcac224..1bea96c16 100644 --- a/Aaru.Filesystems/CPM/Definitions.cs +++ b/Aaru.Filesystems/CPM/Definitions.cs @@ -50,10 +50,8 @@ public sealed partial class CPM { _definitions = JsonSerializer. - Deserialize( - Assembly.GetExecutingAssembly(). - GetManifestResourceStream("Aaru.Filesystems.CPM.cpmdefs.json") ?? new MemoryStream(), - typeof(CpmDefinitions), CpmDefinitionsContext.Default) as CpmDefinitions; + Deserialize(Assembly.GetExecutingAssembly().GetManifestResourceStream("Aaru.Filesystems.CPM.cpmdefs.json") ?? new MemoryStream(), + typeof(CpmDefinitions), CpmDefinitionsContext.Default) as CpmDefinitions; if(_definitions is null) return false; @@ -73,8 +71,7 @@ public sealed partial class CPM def.side1.sectorIds[i] = i + 1; } - if(def.sides != 2 || - def.side2 != null) + if(def.sides != 2 || def.side2 != null) continue; { diff --git a/Aaru.Filesystems/CPM/Dir.cs b/Aaru.Filesystems/CPM/Dir.cs index 2b1e38eb1..41a7be7c0 100644 --- a/Aaru.Filesystems/CPM/Dir.cs +++ b/Aaru.Filesystems/CPM/Dir.cs @@ -50,8 +50,7 @@ public sealed partial class CPM if(!_mounted) return ErrorNumber.AccessDenied; - if(!string.IsNullOrEmpty(path) && - string.Compare(path, "/", StringComparison.OrdinalIgnoreCase) != 0) + if(!string.IsNullOrEmpty(path) && string.Compare(path, "/", StringComparison.OrdinalIgnoreCase) != 0) return ErrorNumber.NotSupported; node = new CpmDirNode @@ -124,15 +123,13 @@ public sealed partial class CPM { for(var f = 0; f < 8; f++) { - if(entry.filename[f] < 0x20 && - entry.filename[f] != 0x00) + if(entry.filename[f] < 0x20 && entry.filename[f] != 0x00) return false; } for(var e = 0; e < 3; e++) { - if(entry.extension[e] < 0x20 && - entry.extension[e] != 0x00) + if(entry.extension[e] < 0x20 && entry.extension[e] != 0x00) return false; } @@ -147,15 +144,13 @@ public sealed partial class CPM { for(var f = 0; f < 8; f++) { - if(entry.filename[f] < 0x20 && - entry.filename[f] != 0x00) + if(entry.filename[f] < 0x20 && entry.filename[f] != 0x00) return false; } for(var e = 0; e < 3; e++) { - if(entry.extension[e] < 0x20 && - entry.extension[e] != 0x00) + if(entry.extension[e] < 0x20 && entry.extension[e] != 0x00) return false; } diff --git a/Aaru.Filesystems/CPM/File.cs b/Aaru.Filesystems/CPM/File.cs index 570a1f40d..0005a75b0 100644 --- a/Aaru.Filesystems/CPM/File.cs +++ b/Aaru.Filesystems/CPM/File.cs @@ -46,7 +46,10 @@ public sealed partial class CPM if(!_mounted) return ErrorNumber.AccessDenied; - string[] pathElements = path.Split(new[] { '/' }, StringSplitOptions.RemoveEmptyEntries); + string[] pathElements = path.Split(new[] + { + '/' + }, StringSplitOptions.RemoveEmptyEntries); if(pathElements.Length != 1) return ErrorNumber.NotSupported; @@ -76,7 +79,10 @@ public sealed partial class CPM if(!_mounted) return ErrorNumber.AccessDenied; - string[] pathElements = path.Split(new[] { '/' }, StringSplitOptions.RemoveEmptyEntries); + string[] pathElements = path.Split(new[] + { + '/' + }, StringSplitOptions.RemoveEmptyEntries); if(pathElements.Length != 1) return ErrorNumber.NotSupported; @@ -117,8 +123,7 @@ public sealed partial class CPM if(!_mounted) return ErrorNumber.AccessDenied; - if(buffer is null || - buffer.Length < length) + if(buffer is null || buffer.Length < length) return ErrorNumber.InvalidArgument; if(node is not CpmFileNode mynode) @@ -152,13 +157,15 @@ public sealed partial class CPM if(!_mounted) return ErrorNumber.AccessDenied; - string[] pathElements = path.Split(new[] { '/' }, StringSplitOptions.RemoveEmptyEntries); + string[] pathElements = path.Split(new[] + { + '/' + }, StringSplitOptions.RemoveEmptyEntries); if(pathElements.Length != 1) return ErrorNumber.NotSupported; - if(!string.IsNullOrEmpty(path) && - string.Compare(path, "/", StringComparison.OrdinalIgnoreCase) != 0) + if(!string.IsNullOrEmpty(path) && string.Compare(path, "/", StringComparison.OrdinalIgnoreCase) != 0) { return _statCache.TryGetValue(pathElements[0].ToUpperInvariant(), out stat) ? ErrorNumber.NoError diff --git a/Aaru.Filesystems/CPM/Info.cs b/Aaru.Filesystems/CPM/Info.cs index 40e05da3b..09e6f7e41 100644 --- a/Aaru.Filesystems/CPM/Info.cs +++ b/Aaru.Filesystems/CPM/Info.cs @@ -191,9 +191,7 @@ public sealed partial class CPM var sig3 = BitConverter.ToUInt32(sector, 0x7C); // PCW16 extended boot record - if(sig1 == 0x4D2F5043 && - sig2 == 0x004B5344 && - sig3 == sig1) + if(sig1 == 0x4D2F5043 && sig2 == 0x004B5344 && sig3 == sig1) amsSbOffset = 0x80; // Read the superblock @@ -211,8 +209,7 @@ public sealed partial class CPM sectorSize = (ulong)(128 << amsSb.psh); // Compare device limits from superblock to real limits - if(sectorSize == imagePlugin.Info.SectorSize && - sectorCount == imagePlugin.Info.Sectors) + if(sectorSize == imagePlugin.Info.SectorSize && sectorCount == imagePlugin.Info.Sectors) { _cpmFound = true; firstDirectorySector = (ulong)(amsSb.off * amsSb.spt); @@ -431,11 +428,9 @@ public sealed partial class CPM byte formatByte; // Check for alternate location of format ID - if(sector.Last() == 0x00 || - sector.Last() == 0xFF) + if(sector.Last() == 0x00 || sector.Last() == 0xFF) { - if(sector[0x40] == 0x94 || - sector[0x40] == 0x26) + if(sector[0x40] == 0x94 || sector[0x40] == 0x26) formatByte = sector[0x40]; else formatByte = sector.Last(); @@ -920,14 +915,12 @@ public sealed partial class CPM // Load all definitions AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Trying_to_load_definitions); - if(LoadDefinitions() && - _definitions?.definitions is { Count: > 0 }) + if(LoadDefinitions() && _definitions?.definitions is { Count: > 0 }) { AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Trying_all_known_definitions); foreach(CpmDefinition def in from def in _definitions.definitions - let sectors = - (ulong)(def.cylinders * def.sides * def.sectorsPerTrack) + let sectors = (ulong)(def.cylinders * def.sides * def.sectorsPerTrack) where sectors == imagePlugin.Info.Sectors && def.bytesPerSector == imagePlugin.Info.SectorSize select def) @@ -970,7 +963,8 @@ public sealed partial class CPM // Head changes after whole side else if(string.Compare(def.order, "CYLINDERS", - StringComparison.InvariantCultureIgnoreCase) == 0) + StringComparison.InvariantCultureIgnoreCase) == + 0) { for(var m = 0; m < def.side1.sectorIds.Length; m++) _sectorMask[m] = def.side1.sectorIds[m] - def.side1.sectorIds[0]; @@ -979,14 +973,17 @@ public sealed partial class CPM for(var 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.side1.sectorIds[m] - + def.side1.sectorIds[0] + + def.side1.sectorIds.Length + def.side2.sectorIds.Length; } } // TODO: Implement COLUMBIA ordering else if(string.Compare(def.order, "COLUMBIA", - StringComparison.InvariantCultureIgnoreCase) == 0) + StringComparison.InvariantCultureIgnoreCase) == + 0) { AaruConsole.DebugWriteLine(MODULE_NAME, Localization. @@ -1023,11 +1020,8 @@ public sealed partial class CPM { errno = imagePlugin. - ReadSector( - (ulong)((int)offset + (int)partition.Start + - p / _sectorMask.Length * _sectorMask.Length + - _sectorMask[p % _sectorMask.Length]), - out byte[] dirSector); + ReadSector((ulong)((int)offset + (int)partition.Start + p / _sectorMask.Length * _sectorMask.Length + _sectorMask[p % _sectorMask.Length]), + out byte[] dirSector); if(errno != ErrorNumber.NoError) break; @@ -1163,10 +1157,7 @@ public sealed partial class CPM metadata = new FileSystem(); // As the identification is so complex, just call Identify() and relay on its findings - if(!Identify(imagePlugin, partition) || - !_cpmFound || - _workingDefinition == null || - _dpb == null) + if(!Identify(imagePlugin, partition) || !_cpmFound || _workingDefinition == null || _dpb == null) return; var sb = new StringBuilder(); diff --git a/Aaru.Filesystems/CPM/Super.cs b/Aaru.Filesystems/CPM/Super.cs index 9a462e390..e4507b684 100644 --- a/Aaru.Filesystems/CPM/Super.cs +++ b/Aaru.Filesystems/CPM/Super.cs @@ -61,10 +61,7 @@ public sealed partial class CPM _encoding = encoding ?? Encoding.GetEncoding("IBM437"); // As the identification is so complex, just call Identify() and relay on its findings - if(!Identify(_device, partition) || - !_cpmFound || - _workingDefinition == null || - _dpb == null) + if(!Identify(_device, partition) || !_cpmFound || _workingDefinition == null || _dpb == null) return ErrorNumber.InvalidArgument; // Build the software interleaving sector mask @@ -90,14 +87,16 @@ public sealed partial class CPM for(var m = 0; m < _workingDefinition.side2.sectorIds.Length; m++) { _sectorMask[m + _workingDefinition.side1.sectorIds.Length] = - _workingDefinition.side2.sectorIds[m] - _workingDefinition.side2.sectorIds[0] + + _workingDefinition.side2.sectorIds[m] - + _workingDefinition.side2.sectorIds[0] + _workingDefinition.side1.sectorIds.Length; } } // Head changes after whole side else if(string.Compare(_workingDefinition.order, "CYLINDERS", - StringComparison.InvariantCultureIgnoreCase) == 0) + StringComparison.InvariantCultureIgnoreCase) == + 0) { for(var m = 0; m < _workingDefinition.side1.sectorIds.Length; m++) _sectorMask[m] = _workingDefinition.side1.sectorIds[m] - _workingDefinition.side1.sectorIds[0]; @@ -106,8 +105,10 @@ public sealed partial class CPM for(var 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; + _workingDefinition.side1.sectorIds[m] - + _workingDefinition.side1.sectorIds[0] + + _workingDefinition.side1.sectorIds.Length + + _workingDefinition.side2.sectorIds.Length; } // TODO: Implement CYLINDERS ordering @@ -157,10 +158,8 @@ public sealed partial class CPM for(var p = 0; p <= (int)(partition.End - partition.Start); p++) { ErrorNumber errno = - _device.ReadSector( - (ulong)((int)partition.Start + p / _sectorMask.Length * _sectorMask.Length + - _sectorMask[p % _sectorMask.Length]), - out byte[] readSector); + _device.ReadSector((ulong)((int)partition.Start + p / _sectorMask.Length * _sectorMask.Length + _sectorMask[p % _sectorMask.Length]), + out byte[] readSector); if(errno != ErrorNumber.NoError) return errno; diff --git a/Aaru.Filesystems/CPM/Xattr.cs b/Aaru.Filesystems/CPM/Xattr.cs index 8a4f76c34..485e07573 100644 --- a/Aaru.Filesystems/CPM/Xattr.cs +++ b/Aaru.Filesystems/CPM/Xattr.cs @@ -46,7 +46,10 @@ public sealed partial class CPM if(!_mounted) return ErrorNumber.AccessDenied; - string[] pathElements = path.Split(new[] { '/' }, StringSplitOptions.RemoveEmptyEntries); + string[] pathElements = path.Split(new[] + { + '/' + }, StringSplitOptions.RemoveEmptyEntries); if(pathElements.Length != 1) return ErrorNumber.NotSupported; @@ -76,7 +79,10 @@ public sealed partial class CPM if(!_mounted) return ErrorNumber.AccessDenied; - string[] pathElements = path.Split(new[] { '/' }, StringSplitOptions.RemoveEmptyEntries); + string[] pathElements = path.Split(new[] + { + '/' + }, StringSplitOptions.RemoveEmptyEntries); if(pathElements.Length != 1) return ErrorNumber.NotSupported; diff --git a/Aaru.Filesystems/EFS/Info.cs b/Aaru.Filesystems/EFS/Info.cs index 021677a41..43ebbc47b 100644 --- a/Aaru.Filesystems/EFS/Info.cs +++ b/Aaru.Filesystems/EFS/Info.cs @@ -159,12 +159,11 @@ public sealed partial class EFS efsSb = Marshal.ByteArrayToStructureBigEndian(sector); - AaruConsole.DebugWriteLine(MODULE_NAME, Localization.magic_at_0_equals_1_expected_2_or_3, 1, - efsSb.sb_magic, EFS_MAGIC, EFS_MAGIC_NEW); + AaruConsole.DebugWriteLine(MODULE_NAME, Localization.magic_at_0_equals_1_expected_2_or_3, 1, efsSb.sb_magic, + EFS_MAGIC, EFS_MAGIC_NEW); } - if(efsSb.sb_magic != EFS_MAGIC && - efsSb.sb_magic != EFS_MAGIC_NEW) + if(efsSb.sb_magic != EFS_MAGIC && efsSb.sb_magic != EFS_MAGIC_NEW) return; var sb = new StringBuilder(); diff --git a/Aaru.Filesystems/F2FS/Info.cs b/Aaru.Filesystems/F2FS/Info.cs index 97ac5a442..3bd49df6d 100644 --- a/Aaru.Filesystems/F2FS/Info.cs +++ b/Aaru.Filesystems/F2FS/Info.cs @@ -116,7 +116,8 @@ public sealed partial class F2FS sb.AppendFormat(Localization._0_bytes_per_sector, 1 << (int)f2fsSb.log_sectorsize).AppendLine(); sb.AppendFormat(Localization._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(Localization._0_blocks_per_segment, f2fsSb.log_blocks_per_seg).AppendLine(); sb.AppendFormat(Localization._0_blocks_in_volume, f2fsSb.block_count).AppendLine(); @@ -128,7 +129,8 @@ public sealed partial class F2FS sb.AppendFormat(Localization.Volume_UUID_0, f2fsSb.uuid).AppendLine(); sb.AppendFormat(Localization.Volume_name_0, - StringHandlers.CToString(f2fsSb.volume_name, Encoding.Unicode, true)).AppendLine(); + StringHandlers.CToString(f2fsSb.volume_name, Encoding.Unicode, true)). + AppendLine(); sb.AppendFormat(Localization.Volume_last_mounted_on_kernel_version_0, StringHandlers.CToString(f2fsSb.version)). AppendLine(); diff --git a/Aaru.Filesystems/FAT/BPB.cs b/Aaru.Filesystems/FAT/BPB.cs index 982b60272..b8f42ac09 100644 --- a/Aaru.Filesystems/FAT/BPB.cs +++ b/Aaru.Filesystems/FAT/BPB.cs @@ -60,11 +60,21 @@ public sealed partial class FAT : humanBpb.clusters == expectedClusters; // Check OEM for Human68k is correct - bool humanOemCorrect = bpbSector[2] >= 0x20 && bpbSector[3] >= 0x20 && bpbSector[4] >= 0x20 && - bpbSector[5] >= 0x20 && bpbSector[6] >= 0x20 && bpbSector[7] >= 0x20 && - bpbSector[8] >= 0x20 && bpbSector[9] >= 0x20 && bpbSector[10] >= 0x20 && - bpbSector[11] >= 0x20 && bpbSector[12] >= 0x20 && bpbSector[13] >= 0x20 && - bpbSector[14] >= 0x20 && bpbSector[15] >= 0x20 && bpbSector[16] >= 0x20 && + bool humanOemCorrect = bpbSector[2] >= 0x20 && + bpbSector[3] >= 0x20 && + bpbSector[4] >= 0x20 && + bpbSector[5] >= 0x20 && + bpbSector[6] >= 0x20 && + bpbSector[7] >= 0x20 && + bpbSector[8] >= 0x20 && + bpbSector[9] >= 0x20 && + bpbSector[10] >= 0x20 && + bpbSector[11] >= 0x20 && + bpbSector[12] >= 0x20 && + bpbSector[13] >= 0x20 && + bpbSector[14] >= 0x20 && + bpbSector[15] >= 0x20 && + bpbSector[16] >= 0x20 && bpbSector[17] >= 0x20; // Check correct branch for Human68k @@ -176,10 +186,14 @@ public sealed partial class FAT apricotBpb.mainBPB.sectors /= 4; } - andosOemCorrect = dos33Bpb.oem_name[0] < 0x20 && dos33Bpb.oem_name[1] >= 0x20 && - dos33Bpb.oem_name[2] >= 0x20 && dos33Bpb.oem_name[3] >= 0x20 && - dos33Bpb.oem_name[4] >= 0x20 && dos33Bpb.oem_name[5] >= 0x20 && - dos33Bpb.oem_name[6] >= 0x20 && dos33Bpb.oem_name[7] >= 0x20; + andosOemCorrect = dos33Bpb.oem_name[0] < 0x20 && + dos33Bpb.oem_name[1] >= 0x20 && + dos33Bpb.oem_name[2] >= 0x20 && + dos33Bpb.oem_name[3] >= 0x20 && + dos33Bpb.oem_name[4] >= 0x20 && + dos33Bpb.oem_name[5] >= 0x20 && + dos33Bpb.oem_name[6] >= 0x20 && + dos33Bpb.oem_name[7] >= 0x20; if(bitsInBpsFat32 == 1 && correctSpcFat32 && @@ -285,7 +299,8 @@ public sealed partial class FAT dos33Bpb.sectors <= partition.End - partition.Start + 1) { if(atariBpb.jump[0] == 0x60 || - atariBpb.jump[0] == 0xE9 && atariBpb.jump[1] == 0x00 && + atariBpb.jump[0] == 0xE9 && + atariBpb.jump[1] == 0x00 && Encoding.ASCII.GetString(dos33Bpb.oem_name) != "NEXT " || partition.Type is "GEM" or "BGM") { @@ -308,11 +323,11 @@ public sealed partial class FAT useDos32Bpb = true; minBootNearJump = 0x1E; } - else if(dos30Bpb.sptrk is > 0 and < 64 && - dos30Bpb.heads is > 0 and < 256) + else if(dos30Bpb.sptrk is > 0 and < 64 && dos30Bpb.heads is > 0 and < 256) { if(atariBpb.jump[0] == 0x60 || - atariBpb.jump[0] == 0xE9 && atariBpb.jump[1] == 0x00 && + atariBpb.jump[0] == 0xE9 && + atariBpb.jump[1] == 0x00 && Encoding.ASCII.GetString(dos33Bpb.oem_name) != "NEXT ") { AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Using_Atari_BPB); @@ -328,7 +343,8 @@ public sealed partial class FAT else { if(atariBpb.jump[0] == 0x60 || - atariBpb.jump[0] == 0xE9 && atariBpb.jump[1] == 0x00 && + atariBpb.jump[0] == 0xE9 && + atariBpb.jump[1] == 0x00 && Encoding.ASCII.GetString(dos33Bpb.oem_name) != "NEXT ") { AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Using_Atari_BPB); @@ -372,7 +388,10 @@ public sealed partial class FAT // Volume is software interleaved 2:1 var rootMs = new MemoryStream(); - foreach(ulong rootSector in new ulong[] { 0x17, 0x19, 0x1B, 0x1D, 0x1E, 0x20 }) + foreach(ulong rootSector in new ulong[] + { + 0x17, 0x19, 0x1B, 0x1D, 0x1E, 0x20 + }) { imagePlugin.ReadSector(rootSector, out byte[] tmp); rootMs.Write(tmp, 0, tmp.Length); @@ -613,8 +632,9 @@ public sealed partial class FAT } // This assumes a bootable sector will jump somewhere or disable interrupts in x86 code - bootable |= bpbSector[0] == 0xFA || bpbSector[0] == 0xEB && bpbSector[1] <= 0x7F || - bpbSector[0] == 0xE9 && BitConverter.ToUInt16(bpbSector, 1) <= 0x1FC; + bootable |= bpbSector[0] == 0xFA || + bpbSector[0] == 0xEB && bpbSector[1] <= 0x7F || + bpbSector[0] == 0xE9 && BitConverter.ToUInt16(bpbSector, 1) <= 0x1FC; fakeBpb.boot_code = bpbSector; @@ -794,8 +814,7 @@ public sealed partial class FAT fakeBpb.sptrk = apricotBpb.spt; bootable = apricotBpb.bootType > 0; - if(apricotBpb.bootLocation > 0 && - apricotBpb.bootLocation + apricotBpb.bootSize < imagePlugin.Info.Sectors) + if(apricotBpb.bootLocation > 0 && apricotBpb.bootLocation + apricotBpb.bootSize < imagePlugin.Info.Sectors) { imagePlugin.ReadSectors(apricotBpb.bootLocation, (uint)(apricotBpb.sectorSize * apricotBpb.bootSize) / imagePlugin.Info.SectorSize, diff --git a/Aaru.Filesystems/FAT/Dir.cs b/Aaru.Filesystems/FAT/Dir.cs index 7a9e96c41..2dfa73fec 100644 --- a/Aaru.Filesystems/FAT/Dir.cs +++ b/Aaru.Filesystems/FAT/Dir.cs @@ -61,8 +61,7 @@ public sealed partial class FAT if(!_mounted) return ErrorNumber.AccessDenied; - if(string.IsNullOrWhiteSpace(path) || - path == "/") + if(string.IsNullOrWhiteSpace(path) || path == "/") { node = new FatDirNode { @@ -90,7 +89,10 @@ public sealed partial class FAT return ErrorNumber.NoError; } - string[] pieces = cutPath.Split(new[] { '/' }, StringSplitOptions.RemoveEmptyEntries); + string[] pieces = cutPath.Split(new[] + { + '/' + }, StringSplitOptions.RemoveEmptyEntries); KeyValuePair entry = _rootDirectoryCache.FirstOrDefault(t => t.Key.ToLower(_cultureInfo) == pieces[0]); @@ -172,8 +174,7 @@ public sealed partial class FAT if(dirent.attributes.HasFlag(FatAttributes.LFN)) { - if(_namespace != Namespace.Lfn && - _namespace != Namespace.Ecs) + if(_namespace != Namespace.Lfn && _namespace != Namespace.Ecs) continue; LfnEntry lfnEntry = @@ -207,8 +208,7 @@ public sealed partial class FAT } // Not a correct entry - if(dirent.filename[0] < DIRENT_MIN && - dirent.filename[0] != DIRENT_E5) + if(dirent.filename[0] < DIRENT_MIN && dirent.filename[0] != DIRENT_E5) continue; // Self @@ -233,8 +233,7 @@ public sealed partial class FAT Dirent = dirent }; - if(_namespace is Namespace.Lfn or Namespace.Ecs && - lastLfnName != null) + if(_namespace is Namespace.Lfn or Namespace.Ecs && lastLfnName != null) { byte calculatedLfnChecksum = LfnChecksum(dirent.filename, dirent.extension); @@ -254,13 +253,11 @@ public sealed partial class FAT string name = _encoding.GetString(dirent.filename).TrimEnd(); string extension = _encoding.GetString(dirent.extension).TrimEnd(); - if(name == "" && - extension == "") + if(name == "" && extension == "") { AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Found_empty_filename_in_0, path); - if(!_debug || - dirent is { size: > 0, start_cluster: 0 }) + if(!_debug || dirent is { size: > 0, start_cluster: 0 }) continue; // Skip invalid name // If debug, add it @@ -325,12 +322,9 @@ public sealed partial class FAT } // Check OS/2 .LONGNAME - if(_eaCache != null && - _namespace is Namespace.Os2 or Namespace.Ecs && - !_fat32) + if(_eaCache != null && _namespace is Namespace.Os2 or Namespace.Ecs && !_fat32) { - var filesWithEas = - currentDirectory.Where(t => t.Value.Dirent.ea_handle != 0).ToList(); + var filesWithEas = currentDirectory.Where(t => t.Value.Dirent.ea_handle != 0).ToList(); foreach(KeyValuePair fileWithEa in filesWithEas) { @@ -371,8 +365,8 @@ public sealed partial class FAT // Check FAT32.IFS EAs if(_fat32 || _debug) { - var fat32EaSidecars = - currentDirectory.Where(t => t.Key.EndsWith(FAT32_EA_TAIL, true, _cultureInfo)).ToList(); + var fat32EaSidecars = currentDirectory.Where(t => t.Key.EndsWith(FAT32_EA_TAIL, true, _cultureInfo)). + ToList(); foreach(KeyValuePair sidecar in fat32EaSidecars) { diff --git a/Aaru.Filesystems/FAT/FAT.cs b/Aaru.Filesystems/FAT/FAT.cs index ecbb31ca1..0a9678740 100644 --- a/Aaru.Filesystems/FAT/FAT.cs +++ b/Aaru.Filesystems/FAT/FAT.cs @@ -88,17 +88,29 @@ public sealed partial class FAT : IReadOnlyFilesystem /// public Dictionary Namespaces => new() { - { "dos", Localization.DOS_8_3_all_uppercase }, - { "nt", Localization.Windows_NT_8_3_mixed_case }, - { "os2", Localization.OS2_LONGNAME_extended_attribute }, - { "ecs", Localization.Use_LFN_when_available_with_fallback_to_LONGNAME_default }, - { "lfn", Localization.Long_file_names } + { + "dos", Localization.DOS_8_3_all_uppercase + }, + { + "nt", Localization.Windows_NT_8_3_mixed_case + }, + { + "os2", Localization.OS2_LONGNAME_extended_attribute + }, + { + "ecs", Localization.Use_LFN_when_available_with_fallback_to_LONGNAME_default + }, + { + "lfn", Localization.Long_file_names + } }; #endregion static Dictionary GetDefaultOptions() => new() { - { "debug", false.ToString() } + { + "debug", false.ToString() + } }; } \ No newline at end of file diff --git a/Aaru.Filesystems/FAT/File.cs b/Aaru.Filesystems/FAT/File.cs index e30191cc6..1b60f2241 100644 --- a/Aaru.Filesystems/FAT/File.cs +++ b/Aaru.Filesystems/FAT/File.cs @@ -73,8 +73,7 @@ public sealed partial class FAT if(err != ErrorNumber.NoError) return err; - if(stat.Attributes.HasFlag(FileAttributes.Directory) && - !_debug) + if(stat.Attributes.HasFlag(FileAttributes.Directory) && !_debug) return ErrorNumber.IsDirectory; uint[] clusters = GetClusters((uint)stat.Inode); @@ -115,8 +114,7 @@ public sealed partial class FAT if(!_mounted) return ErrorNumber.AccessDenied; - if(buffer is null || - buffer.Length < length) + if(buffer is null || buffer.Length < length) return ErrorNumber.InvalidArgument; if(node is not FatFileNode mynode) @@ -183,14 +181,12 @@ public sealed partial class FAT Links = 1 }; - if(entry.cdate > 0 || - entry.ctime > 0) + if(entry.cdate > 0 || entry.ctime > 0) stat.CreationTime = DateHandlers.DosToDateTime(entry.cdate, entry.ctime); if(_namespace != Namespace.Human) { - if(entry.mdate > 0 || - entry.mtime > 0) + if(entry.mdate > 0 || entry.mtime > 0) stat.LastWriteTime = DateHandlers.DosToDateTime(entry.mdate, entry.mtime); if(entry.ctime_ms > 0) @@ -204,8 +200,7 @@ public sealed partial class FAT { stat.Attributes |= FileAttributes.Directory; - if(_fat32 && entry.ea_handle << 16 > 0 || - entry.start_cluster > 0) + if(_fat32 && entry.ea_handle << 16 > 0 || entry.start_cluster > 0) { stat.Blocks = _fat32 ? GetClusters((uint)((entry.ea_handle << 16) + entry.start_cluster))?.Length ?? 0 @@ -259,8 +254,7 @@ public sealed partial class FAT if(_fat32) { - while((nextCluster & FAT32_MASK) > 0 && - (nextCluster & FAT32_MASK) <= FAT32_RESERVED) + while((nextCluster & FAT32_MASK) > 0 && (nextCluster & FAT32_MASK) <= FAT32_RESERVED) { clusters.Add(nextCluster); @@ -276,8 +270,7 @@ public sealed partial class FAT nextCluster = BitConverter.ToUInt32(fatData, nextEntry * 4); - nextSector = nextCluster / _fatEntriesPerSector + _fatFirstSector + - (_useFirstFat ? 0 : _sectorsPerFat); + nextSector = nextCluster / _fatEntriesPerSector + _fatFirstSector + (_useFirstFat ? 0 : _sectorsPerFat); nextEntry = (int)(nextCluster % _fatEntriesPerSector); } @@ -314,7 +307,10 @@ public sealed partial class FAT string cutPath = path.StartsWith('/') ? path[1..].ToLower(_cultureInfo) : path.ToLower(_cultureInfo); - string[] pieces = cutPath.Split(new[] { '/' }, StringSplitOptions.RemoveEmptyEntries); + string[] pieces = cutPath.Split(new[] + { + '/' + }, StringSplitOptions.RemoveEmptyEntries); if(pieces.Length == 0) return ErrorNumber.InvalidArgument; diff --git a/Aaru.Filesystems/FAT/Info.cs b/Aaru.Filesystems/FAT/Info.cs index e1e9e58cc..069e96eaf 100644 --- a/Aaru.Filesystems/FAT/Info.cs +++ b/Aaru.Filesystems/FAT/Info.cs @@ -100,11 +100,21 @@ public sealed partial class FAT : humanBpb.clusters == expectedClusters; // Check OEM for Human68k is correct - bool humanOemCorrect = bpbSector[2] >= 0x20 && bpbSector[3] >= 0x20 && bpbSector[4] >= 0x20 && - bpbSector[5] >= 0x20 && bpbSector[6] >= 0x20 && bpbSector[7] >= 0x20 && - bpbSector[8] >= 0x20 && bpbSector[9] >= 0x20 && bpbSector[10] >= 0x20 && - bpbSector[11] >= 0x20 && bpbSector[12] >= 0x20 && bpbSector[13] >= 0x20 && - bpbSector[14] >= 0x20 && bpbSector[15] >= 0x20 && bpbSector[16] >= 0x20 && + bool humanOemCorrect = bpbSector[2] >= 0x20 && + bpbSector[3] >= 0x20 && + bpbSector[4] >= 0x20 && + bpbSector[5] >= 0x20 && + bpbSector[6] >= 0x20 && + bpbSector[7] >= 0x20 && + bpbSector[8] >= 0x20 && + bpbSector[9] >= 0x20 && + bpbSector[10] >= 0x20 && + bpbSector[11] >= 0x20 && + bpbSector[12] >= 0x20 && + bpbSector[13] >= 0x20 && + bpbSector[14] >= 0x20 && + bpbSector[15] >= 0x20 && + bpbSector[16] >= 0x20 && bpbSector[17] >= 0x20; // Check correct branch for Human68k @@ -115,10 +125,7 @@ public sealed partial class FAT AaruConsole.DebugWriteLine(MODULE_NAME, "humanBranchCorrect = {0}", humanBranchCorrect); // If all Human68k checks are correct, it is a Human68k FAT16 - if(humanClustersCorrect && - humanOemCorrect && - humanBranchCorrect && - expectedClusters > 0) + if(humanClustersCorrect && humanOemCorrect && humanBranchCorrect && expectedClusters > 0) return true; Array.Copy(bpbSector, 0x02, atariOem, 0, 6); @@ -147,11 +154,21 @@ public sealed partial class FAT string msxString = Encoding.ASCII.GetString(msxId); string fat32String = Encoding.ASCII.GetString(fat32Id); - bool atariOemCorrect = atariOem[0] >= 0x20 && atariOem[1] >= 0x20 && atariOem[2] >= 0x20 && - atariOem[3] >= 0x20 && atariOem[4] >= 0x20 && atariOem[5] >= 0x20; + bool atariOemCorrect = atariOem[0] >= 0x20 && + atariOem[1] >= 0x20 && + atariOem[2] >= 0x20 && + atariOem[3] >= 0x20 && + atariOem[4] >= 0x20 && + atariOem[5] >= 0x20; - bool dosOemCorrect = dosOem[0] >= 0x20 && dosOem[1] >= 0x20 && dosOem[2] >= 0x20 && dosOem[3] >= 0x20 && - dosOem[4] >= 0x20 && dosOem[5] >= 0x20 && dosOem[6] >= 0x20 && dosOem[7] >= 0x20; + bool dosOemCorrect = dosOem[0] >= 0x20 && + dosOem[1] >= 0x20 && + dosOem[2] >= 0x20 && + dosOem[3] >= 0x20 && + dosOem[4] >= 0x20 && + dosOem[5] >= 0x20 && + dosOem[6] >= 0x20 && + dosOem[7] >= 0x20; string oemString = Encoding.ASCII.GetString(dosOem); @@ -234,16 +251,18 @@ public sealed partial class FAT var hpfsMagic1 = BitConverter.ToUInt32(hpfsSbSector, 0x000); var hpfsMagic2 = BitConverter.ToUInt32(hpfsSbSector, 0x004); - if(hpfsMagic1 == 0xF995E849 && - hpfsMagic2 == 0xFA53E9C5) + if(hpfsMagic1 == 0xF995E849 && hpfsMagic2 == 0xFA53E9C5) return false; } switch(bitsInBps) { // FAT32 for sure - case 1 when correctSpc && numberOfFats <= 2 && fatSectors == 0 && fat32Signature == 0x29 && - fat32String == "FAT32 ": + case 1 when correctSpc && + numberOfFats <= 2 && + fatSectors == 0 && + fat32Signature == 0x29 && + fat32String == "FAT32 ": return true; // short FAT32 @@ -255,21 +274,30 @@ public sealed partial class FAT : sectors <= partition.End - partition.Start + 1; // MSX-DOS FAT12 - case 1 when correctSpc && numberOfFats <= 2 && rootEntries > 0 && - sectors <= partition.End - partition.Start + 1 && fatSectors > 0 && - msxString == "VOL_ID": + case 1 when correctSpc && + numberOfFats <= 2 && + rootEntries > 0 && + sectors <= partition.End - partition.Start + 1 && + fatSectors > 0 && + msxString == "VOL_ID": return true; // EBPB - case 1 when correctSpc && numberOfFats <= 2 && rootEntries > 0 && fatSectors > 0 && + case 1 when correctSpc && + numberOfFats <= 2 && + rootEntries > 0 && + fatSectors > 0 && bpbSignature is 0x28 or 0x29: return sectors == 0 ? bigSectors <= partition.End - partition.Start + 1 : sectors <= partition.End - partition.Start + 1; // BPB - case 1 when correctSpc && reservedSecs < partition.End - partition.Start && numberOfFats <= 2 && - rootEntries > 0 && fatSectors > 0: + case 1 when correctSpc && + reservedSecs < partition.End - partition.Start && + numberOfFats <= 2 && + rootEntries > 0 && + fatSectors > 0: return sectors == 0 ? bigSectors <= partition.End - partition.Start + 1 : sectors <= partition.End - partition.Start + 1; @@ -313,7 +341,10 @@ public sealed partial class FAT // Volume is software interleaved 2:1 var rootMs = new MemoryStream(); - foreach(ulong rootSector in new ulong[] { 0x17, 0x19, 0x1B, 0x1D, 0x1E, 0x20 }) + foreach(ulong rootSector in new ulong[] + { + 0x17, 0x19, 0x1B, 0x1D, 0x1E, 0x20 + }) { errno = imagePlugin.ReadSector(rootSector, out byte[] tmp); @@ -409,8 +440,7 @@ public sealed partial class FAT break; } - if(fat2SectorNo > partition.End || - fat2SectorNo == 0) + if(fat2SectorNo > partition.End || fat2SectorNo == 0) return false; AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Second_fat_starts_at_0, fat2SectorNo); @@ -507,9 +537,7 @@ public sealed partial class FAT if(fat32Bpb.oem_name != null) { - if(fat32Bpb.oem_name[5] == 0x49 && - fat32Bpb.oem_name[6] == 0x48 && - fat32Bpb.oem_name[7] == 0x43) + if(fat32Bpb.oem_name[5] == 0x49 && fat32Bpb.oem_name[6] == 0x48 && fat32Bpb.oem_name[7] == 0x43) sb.AppendLine(Localization.Volume_has_been_modified_by_Windows_9x_Me_Volume_Tracker); else metadata.SystemIdentifier = StringHandlers.CToString(fat32Bpb.oem_name); @@ -526,21 +554,24 @@ public sealed partial class FAT if(fat32Bpb is { big_sectors: 0, signature: 0x28 }) { sb.AppendFormat(Localization._0_sectors_on_volume_1_bytes, shortFat32Bpb.huge_sectors, - shortFat32Bpb.huge_sectors * shortFat32Bpb.bps).AppendLine(); + shortFat32Bpb.huge_sectors * shortFat32Bpb.bps). + AppendLine(); metadata.Clusters = shortFat32Bpb.huge_sectors / shortFat32Bpb.spc; } else if(fat32Bpb.sectors == 0) { sb.AppendFormat(Localization._0_sectors_on_volume_1_bytes, fat32Bpb.big_sectors, - fat32Bpb.big_sectors * fat32Bpb.bps).AppendLine(); + fat32Bpb.big_sectors * fat32Bpb.bps). + AppendLine(); metadata.Clusters = fat32Bpb.big_sectors / fat32Bpb.spc; } else { sb.AppendFormat(Localization._0_sectors_on_volume_1_bytes, fat32Bpb.sectors, - fat32Bpb.sectors * fat32Bpb.bps).AppendLine(); + fat32Bpb.sectors * fat32Bpb.bps). + AppendLine(); metadata.Clusters = (ulong)(fat32Bpb.sectors / fat32Bpb.spc); } @@ -603,7 +634,8 @@ public sealed partial class FAT // This will mean that the volume will boot, even if just to say "this is not bootable change disk"...... metadata.Bootable = fat32Bpb.jump[0] == 0xEB && fat32Bpb.jump[1] >= minBootNearJump && fat32Bpb.jump[1] < 0x80 || - fat32Bpb.jump[0] == 0xE9 && fat32Bpb.jump.Length >= 3 && + fat32Bpb.jump[0] == 0xE9 && + fat32Bpb.jump.Length >= 3 && BitConverter.ToUInt16(fat32Bpb.jump, 1) >= minBootNearJump && BitConverter.ToUInt16(fat32Bpb.jump, 1) <= 0x1FC; @@ -611,8 +643,10 @@ public sealed partial class FAT // First root directory sector rootDirectorySector = - (ulong)((fat32Bpb.root_cluster - 2) * fat32Bpb.spc + fat32Bpb.big_spfat * fat32Bpb.fats_no + - fat32Bpb.rsectors) * sectorsPerRealSector; + (ulong)((fat32Bpb.root_cluster - 2) * fat32Bpb.spc + + fat32Bpb.big_spfat * fat32Bpb.fats_no + + fat32Bpb.rsectors) * + sectorsPerRealSector; sectorsForRootDirectory = 1; @@ -657,7 +691,8 @@ public sealed partial class FAT var atariSb = new StringBuilder(); atariSb.AppendFormat(Localization.cmdload_will_be_loaded_with_value_0, - BigEndianBitConverter.ToUInt16(bpbSector, 0x01E)).AppendLine(); + BigEndianBitConverter.ToUInt16(bpbSector, 0x01E)). + AppendLine(); atariSb.AppendFormat(Localization.Boot_program_will_be_loaded_at_address_0, atariBpb.ldaaddr). AppendLine(); @@ -721,8 +756,9 @@ public sealed partial class FAT if(bpbKind != BpbKind.Human) { - int reservedSectors = fakeBpb.rsectors + fakeBpb.fats_no * fakeBpb.spfat + - fakeBpb.root_ent * 32 / fakeBpb.bps; + int reservedSectors = fakeBpb.rsectors + + fakeBpb.fats_no * fakeBpb.spfat + + fakeBpb.root_ent * 32 / fakeBpb.bps; if(fakeBpb.sectors == 0) { @@ -743,8 +779,7 @@ public sealed partial class FAT // This will walk all the FAT entries and check if they're valid FAT12 or FAT16 entries. // If the whole table is valid in both senses, it considers the type entry in the BPB. // BeOS is known to set the type as FAT16 but treat it as FAT12. - if(!isFat12 && - !isFat16) + if(!isFat12 && !isFat16) { if(clusters < 4089) { @@ -795,8 +830,7 @@ public sealed partial class FAT isFat16 = fakeBpb.fs_type != null && Encoding.ASCII.GetString(fakeBpb.fs_type) == "FAT16 "; } - if(!isFat12 && - !isFat16) + if(!isFat12 && !isFat16) isFat12 = true; } else @@ -841,9 +875,7 @@ public sealed partial class FAT if(bpbKind == BpbKind.Atari) { - if(atariBpb.serial_no[0] == 0x49 && - atariBpb.serial_no[1] == 0x48 && - atariBpb.serial_no[2] == 0x43) + if(atariBpb.serial_no[0] == 0x49 && atariBpb.serial_no[1] == 0x48 && atariBpb.serial_no[2] == 0x43) sb.AppendLine(Localization.Volume_has_been_modified_by_Windows_9x_Me_Volume_Tracker); else { @@ -858,9 +890,7 @@ public sealed partial class FAT } else if(fakeBpb.oem_name != null) { - if(fakeBpb.oem_name[5] == 0x49 && - fakeBpb.oem_name[6] == 0x48 && - fakeBpb.oem_name[7] == 0x43) + if(fakeBpb.oem_name[5] == 0x49 && fakeBpb.oem_name[6] == 0x48 && fakeBpb.oem_name[7] == 0x43) sb.AppendLine(Localization.Volume_has_been_modified_by_Windows_9x_Me_Volume_Tracker); else { @@ -896,9 +926,8 @@ public sealed partial class FAT fakeBpb.oem_name[6] >= 0x20 && fakeBpb.oem_name[6] <= 0x7F && fakeBpb.oem_name[7] >= 0x20 && - fakeBpb.oem_name[7] <= 0x7F => StringHandlers.CToString( - fakeBpb.oem_name, encoding, - start: 1), + fakeBpb.oem_name[7] <= 0x7F => + StringHandlers.CToString(fakeBpb.oem_name, encoding, start: 1), _ => metadata.SystemIdentifier }; } @@ -917,12 +946,14 @@ public sealed partial class FAT if(fakeBpb.sectors == 0) { sb.AppendFormat(Localization._0_sectors_on_volume_1_bytes, fakeBpb.big_sectors, - fakeBpb.big_sectors * fakeBpb.bps).AppendLine(); + fakeBpb.big_sectors * fakeBpb.bps). + AppendLine(); } else { sb.AppendFormat(Localization._0_sectors_on_volume_1_bytes, fakeBpb.sectors, - fakeBpb.sectors * fakeBpb.bps).AppendLine(); + fakeBpb.sectors * fakeBpb.bps). + AppendLine(); } } else @@ -945,8 +976,7 @@ public sealed partial class FAT sb.AppendFormat(Localization._0_sectors_per_FAT, fakeBpb.spfat).AppendLine(); - if(fakeBpb.sptrk is > 0 and < 64 && - fakeBpb.heads is > 0 and < 256) + if(fakeBpb.sptrk is > 0 and < 64 && fakeBpb.heads is > 0 and < 256) { sb.AppendFormat(Localization._0_sectors_per_track, fakeBpb.sptrk).AppendLine(); sb.AppendFormat(Localization._0_heads, fakeBpb.heads).AppendLine(); @@ -983,8 +1013,7 @@ public sealed partial class FAT AppendLine(); } } - else if(bpbKind == BpbKind.Atari && - metadata.VolumeSerial != null) + else if(bpbKind == BpbKind.Atari && metadata.VolumeSerial != null) sb.AppendFormat(Localization.Volume_Serial_Number_0, metadata.VolumeSerial).AppendLine(); bootChk = Sha1Context.Data(fakeBpb.boot_code, out _); @@ -995,12 +1024,12 @@ public sealed partial class FAT // Check that jumps to a correct boot code position and has boot signature set. // This will mean that the volume will boot, even if just to say "this is not bootable change disk"...... - if(metadata.Bootable == false && - fakeBpb.jump != null) + if(metadata.Bootable == false && fakeBpb.jump != null) { metadata.Bootable |= fakeBpb.jump[0] == 0xEB && fakeBpb.jump[1] >= minBootNearJump && fakeBpb.jump[1] < 0x80 || - fakeBpb.jump[0] == 0xE9 && fakeBpb.jump.Length >= 3 && + fakeBpb.jump[0] == 0xE9 && + fakeBpb.jump.Length >= 3 && BitConverter.ToUInt16(fakeBpb.jump, 1) >= minBootNearJump && BitConverter.ToUInt16(fakeBpb.jump, 1) <= 0x1FC; } @@ -1029,7 +1058,10 @@ public sealed partial class FAT { var rootMs = new MemoryStream(); - foreach(ulong rootSector in new ulong[] { 0x17, 0x19, 0x1B, 0x1D, 0x1E, 0x20 }) + foreach(ulong rootSector in new ulong[] + { + 0x17, 0x19, 0x1B, 0x1D, 0x1E, 0x20 + }) { errno = imagePlugin.ReadSector(rootSector, out byte[] tmp); @@ -1045,18 +1077,15 @@ public sealed partial class FAT for(var i = 0; i < rootDirectory.Length; i += 32) { // Not a correct entry - if(rootDirectory[i] < DIRENT_MIN && - rootDirectory[i] != DIRENT_E5) + if(rootDirectory[i] < DIRENT_MIN && rootDirectory[i] != DIRENT_E5) continue; // Deleted or subdirectory entry - if(rootDirectory[i] == DIRENT_SUBDIR || - rootDirectory[i] == DIRENT_DELETED) + if(rootDirectory[i] == DIRENT_SUBDIR || rootDirectory[i] == DIRENT_DELETED) continue; // Not a volume label - if(rootDirectory[i + 0x0B] != 0x08 && - rootDirectory[i + 0x0B] != 0x28) + if(rootDirectory[i + 0x0B] != 0x08 && rootDirectory[i + 0x0B] != 0x28) continue; DirectoryEntry entry = Marshal.ByteArrayToStructureLittleEndian(rootDirectory, i, 32); @@ -1088,7 +1117,8 @@ public sealed partial class FAT if(entry.adate > 0) { sb.AppendFormat(Localization.Volume_last_accessed_on_0_d, - DateHandlers.DosToDateTime(entry.adate, 0)).AppendLine(); + DateHandlers.DosToDateTime(entry.adate, 0)). + AppendLine(); } break; diff --git a/Aaru.Filesystems/FAT/Super.cs b/Aaru.Filesystems/FAT/Super.cs index f6f2e477e..75283ac27 100644 --- a/Aaru.Filesystems/FAT/Super.cs +++ b/Aaru.Filesystems/FAT/Super.cs @@ -128,9 +128,8 @@ public sealed partial class FAT uint sectorsForRootDirectory = 0; uint rootDirectoryCluster = 0; - _encoding = encoding ?? (bpbKind == BpbKind.Human - ? Encoding.GetEncoding("shift_jis") - : Encoding.GetEncoding("IBM437")); + _encoding = encoding ?? + (bpbKind == BpbKind.Human ? Encoding.GetEncoding("shift_jis") : Encoding.GetEncoding("IBM437")); switch(bpbKind) { @@ -208,7 +207,8 @@ public sealed partial class FAT // This will mean that the volume will boot, even if just to say "this is not bootable change disk"...... Metadata.Bootable = fat32Bpb.jump[0] == 0xEB && fat32Bpb.jump[1] >= minBootNearJump && fat32Bpb.jump[1] < 0x80 || - fat32Bpb.jump[0] == 0xE9 && fat32Bpb.jump.Length >= 3 && + fat32Bpb.jump[0] == 0xE9 && + fat32Bpb.jump.Length >= 3 && BitConverter.ToUInt16(fat32Bpb.jump, 1) >= minBootNearJump && BitConverter.ToUInt16(fat32Bpb.jump, 1) <= 0x1FC; @@ -294,8 +294,9 @@ public sealed partial class FAT if(bpbKind != BpbKind.Human) { - int reservedSectors = fakeBpb.rsectors + fakeBpb.fats_no * fakeBpb.spfat + - fakeBpb.root_ent * 32 / fakeBpb.bps; + int reservedSectors = fakeBpb.rsectors + + fakeBpb.fats_no * fakeBpb.spfat + + fakeBpb.root_ent * 32 / fakeBpb.bps; if(fakeBpb.sectors == 0) { @@ -316,8 +317,7 @@ public sealed partial class FAT // This will walk all the FAT entries and check if they're valid FAT12 or FAT16 entries. // If the whole table is valid in both senses, it considers the type entry in the BPB. // BeOS is known to set the type as FAT16 but treat it as FAT12. - if(!_fat12 && - !_fat16) + if(!_fat12 && !_fat16) { if(clusters < 4089) { @@ -360,8 +360,7 @@ public sealed partial class FAT _fat16 = fat16Valid; // Check BPB type - if(_fat12 == _fat16 && - fakeBpb.fs_type != null) + if(_fat12 == _fat16 && fakeBpb.fs_type != null) { _fat12 = Encoding.ASCII.GetString(fakeBpb.fs_type) == "FAT12 "; _fat16 = Encoding.ASCII.GetString(fakeBpb.fs_type) == "FAT16 "; @@ -385,9 +384,7 @@ public sealed partial class FAT if(bpbKind == BpbKind.Atari) { - if(atariBpb.serial_no[0] != 0x49 || - atariBpb.serial_no[1] != 0x48 || - atariBpb.serial_no[2] != 0x43) + if(atariBpb.serial_no[0] != 0x49 || atariBpb.serial_no[1] != 0x48 || atariBpb.serial_no[2] != 0x43) { Metadata.VolumeSerial = $"{atariBpb.serial_no[0]:X2}{atariBpb.serial_no[1]:X2}{atariBpb.serial_no[2] :X2}"; @@ -395,7 +392,8 @@ public sealed partial class FAT _statfs.Id = new FileSystemId { IsInt = true, - Serial32 = (uint)((atariBpb.serial_no[0] << 16) + (atariBpb.serial_no[1] << 8) + + Serial32 = (uint)((atariBpb.serial_no[0] << 16) + + (atariBpb.serial_no[1] << 8) + atariBpb.serial_no[2]) }; } @@ -407,9 +405,7 @@ public sealed partial class FAT } else if(fakeBpb.oem_name != null) { - if(fakeBpb.oem_name[5] != 0x49 || - fakeBpb.oem_name[6] != 0x48 || - fakeBpb.oem_name[7] != 0x43) + if(fakeBpb.oem_name[5] != 0x49 || fakeBpb.oem_name[6] != 0x48 || fakeBpb.oem_name[7] != 0x43) { Metadata.SystemIdentifier = fakeBpb.oem_name[0] switch { @@ -443,9 +439,8 @@ public sealed partial class FAT fakeBpb.oem_name[6] >= 0x20 && fakeBpb.oem_name[6] <= 0x7F && fakeBpb.oem_name[7] >= 0x20 && - fakeBpb.oem_name[7] <= 0x7F => StringHandlers.CToString( - fakeBpb.oem_name, _encoding, - start: 1), + fakeBpb.oem_name[7] <= 0x7F => + StringHandlers.CToString(fakeBpb.oem_name, _encoding, start: 1), _ => Metadata.SystemIdentifier }; } @@ -489,12 +484,12 @@ public sealed partial class FAT // Check that jumps to a correct boot code position and has boot signature set. // This will mean that the volume will boot, even if just to say "this is not bootable change disk"...... - if(Metadata.Bootable == false && - fakeBpb.jump != null) + if(Metadata.Bootable == false && fakeBpb.jump != null) { Metadata.Bootable |= fakeBpb.jump[0] == 0xEB && fakeBpb.jump[1] >= minBootNearJump && fakeBpb.jump[1] < 0x80 || - fakeBpb.jump[0] == 0xE9 && fakeBpb.jump.Length >= 3 && + fakeBpb.jump[0] == 0xE9 && + fakeBpb.jump.Length >= 3 && BitConverter.ToUInt16(fakeBpb.jump, 1) >= minBootNearJump && BitConverter.ToUInt16(fakeBpb.jump, 1) <= 0x1FC; } @@ -537,7 +532,10 @@ public sealed partial class FAT { var rootMs = new MemoryStream(); - foreach(ulong rootSector in new ulong[] { 0x17, 0x19, 0x1B, 0x1D, 0x1E, 0x20 }) + foreach(ulong rootSector in new ulong[] + { + 0x17, 0x19, 0x1B, 0x1D, 0x1E, 0x20 + }) { errno = imagePlugin.ReadSector(rootSector, out byte[] tmp); @@ -560,8 +558,8 @@ public sealed partial class FAT foreach(uint cluster in rootDirectoryClusters) { - errno = imagePlugin.ReadSectors(_firstClusterSector + cluster * _sectorsPerCluster, - _sectorsPerCluster, out byte[] buffer); + errno = imagePlugin.ReadSectors(_firstClusterSector + cluster * _sectorsPerCluster, _sectorsPerCluster, + out byte[] buffer); if(errno != ErrorNumber.NoError) return errno; @@ -593,8 +591,7 @@ public sealed partial class FAT if(entry.attributes.HasFlag(FatAttributes.LFN)) { - if(_namespace != Namespace.Lfn && - _namespace != Namespace.Ecs) + if(_namespace != Namespace.Lfn && _namespace != Namespace.Ecs) continue; LfnEntry lfnEntry = @@ -627,8 +624,7 @@ public sealed partial class FAT } // Not a correct entry - if(entry.filename[0] < DIRENT_MIN && - entry.filename[0] != DIRENT_E5) + if(entry.filename[0] < DIRENT_MIN && entry.filename[0] != DIRENT_E5) continue; // Self @@ -680,8 +676,7 @@ public sealed partial class FAT Dirent = entry }; - if(_namespace is Namespace.Lfn or Namespace.Ecs && - lastLfnName != null) + if(_namespace is Namespace.Lfn or Namespace.Ecs && lastLfnName != null) { byte calculatedLfnChecksum = LfnChecksum(entry.filename, entry.extension); @@ -715,13 +710,11 @@ public sealed partial class FAT else filename = name; - if(name == "" && - extension == "") + if(name == "" && extension == "") { AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Found_empty_filename_in_root_directory); - if(!_debug || - entry is { size: > 0, start_cluster: 0 }) + if(!_debug || entry is { size: > 0, start_cluster: 0 }) continue; // Skip invalid name // If debug, add it @@ -766,8 +759,7 @@ public sealed partial class FAT completeEntry.HumanName = filename; } - if(!_fat32 && - filename == "EA DATA. SF") + if(!_fat32 && filename == "EA DATA. SF") { _eaDirEntry = entry; lastLfnName = null; @@ -917,12 +909,9 @@ public sealed partial class FAT _eaCache = new Dictionary>(); // Check OS/2 .LONGNAME - if(_eaCache != null && - _namespace is Namespace.Os2 or Namespace.Ecs && - !_fat32) + if(_eaCache != null && _namespace is Namespace.Os2 or Namespace.Ecs && !_fat32) { - var rootFilesWithEas = - _rootDirectoryCache.Where(t => t.Value.Dirent.ea_handle != 0).ToList(); + var rootFilesWithEas = _rootDirectoryCache.Where(t => t.Value.Dirent.ea_handle != 0).ToList(); foreach(KeyValuePair fileWithEa in rootFilesWithEas) { @@ -963,8 +952,8 @@ public sealed partial class FAT // Check FAT32.IFS EAs if(_fat32 || _debug) { - var fat32EaSidecars = - _rootDirectoryCache.Where(t => t.Key.EndsWith(FAT32_EA_TAIL, true, _cultureInfo)).ToList(); + var fat32EaSidecars = _rootDirectoryCache.Where(t => t.Key.EndsWith(FAT32_EA_TAIL, true, _cultureInfo)). + ToList(); foreach(KeyValuePair sidecar in fat32EaSidecars) { diff --git a/Aaru.Filesystems/FAT/Xattr.cs b/Aaru.Filesystems/FAT/Xattr.cs index e78eaad03..00b95a1d4 100644 --- a/Aaru.Filesystems/FAT/Xattr.cs +++ b/Aaru.Filesystems/FAT/Xattr.cs @@ -51,8 +51,7 @@ public sealed partial class FAT return ErrorNumber.AccessDenied; // No other xattr recognized yet - if(_cachedEaData is null && - !_fat32) + if(_cachedEaData is null && !_fat32) return ErrorNumber.NotSupported; if(path[0] == '/') @@ -67,8 +66,7 @@ public sealed partial class FAT ErrorNumber err = GetFileEntry(path, out CompleteDirectoryEntry entry); - if(err != ErrorNumber.NoError || - entry is null) + if(err != ErrorNumber.NoError || entry is null) return err; xattrs = new List(); @@ -187,8 +185,7 @@ public sealed partial class FAT Dictionary GetEas(byte[] eaData) { - if(eaData is null || - eaData.Length < 4) + if(eaData is null || eaData.Length < 4) return null; Dictionary eas = new(); diff --git a/Aaru.Filesystems/FATX/Dir.cs b/Aaru.Filesystems/FATX/Dir.cs index a30d4436a..4e76fc1ab 100644 --- a/Aaru.Filesystems/FATX/Dir.cs +++ b/Aaru.Filesystems/FATX/Dir.cs @@ -47,8 +47,7 @@ public sealed partial class XboxFatPlugin if(!_mounted) return ErrorNumber.AccessDenied; - if(string.IsNullOrWhiteSpace(path) || - path == "/") + if(string.IsNullOrWhiteSpace(path) || path == "/") { node = new FatxDirNode { @@ -74,7 +73,10 @@ public sealed partial class XboxFatPlugin return ErrorNumber.NoError; } - string[] pieces = cutPath.Split(new[] { '/' }, StringSplitOptions.RemoveEmptyEntries); + string[] pieces = cutPath.Split(new[] + { + '/' + }, StringSplitOptions.RemoveEmptyEntries); KeyValuePair entry = _rootDirectory.FirstOrDefault(t => t.Key.ToLower(_cultureInfo) == pieces[0]); diff --git a/Aaru.Filesystems/FATX/FATX.cs b/Aaru.Filesystems/FATX/FATX.cs index fbc3bf6d0..08fc04707 100644 --- a/Aaru.Filesystems/FATX/FATX.cs +++ b/Aaru.Filesystems/FATX/FATX.cs @@ -103,6 +103,8 @@ public sealed partial class XboxFatPlugin : IReadOnlyFilesystem static Dictionary GetDefaultOptions() => new() { - { "debug", false.ToString() } + { + "debug", false.ToString() + } }; } \ No newline at end of file diff --git a/Aaru.Filesystems/FATX/File.cs b/Aaru.Filesystems/FATX/File.cs index 3d85b7d8d..bc6c06fb7 100644 --- a/Aaru.Filesystems/FATX/File.cs +++ b/Aaru.Filesystems/FATX/File.cs @@ -73,8 +73,7 @@ public sealed partial class XboxFatPlugin if(err != ErrorNumber.NoError) return err; - if(stat.Attributes.HasFlag(FileAttributes.Directory) && - !_debug) + if(stat.Attributes.HasFlag(FileAttributes.Directory) && !_debug) return ErrorNumber.IsDirectory; uint[] clusters = GetClusters((uint)stat.Inode); @@ -112,8 +111,7 @@ public sealed partial class XboxFatPlugin if(!_mounted) return ErrorNumber.AccessDenied; - if(buffer is null || - buffer.Length < length) + if(buffer is null || buffer.Length < length) return ErrorNumber.InvalidArgument; if(node is not FatxFileNode mynode) @@ -249,8 +247,7 @@ public sealed partial class XboxFatPlugin if(_fat16 is null) { - while((nextCluster & FAT32_MASK) > 0 && - (nextCluster & FAT32_MASK) <= FAT32_RESERVED) + while((nextCluster & FAT32_MASK) > 0 && (nextCluster & FAT32_MASK) <= FAT32_RESERVED) { clusters.Add(nextCluster); nextCluster = _fat32[nextCluster]; @@ -274,7 +271,10 @@ public sealed partial class XboxFatPlugin string cutPath = path.StartsWith('/') ? path[1..].ToLower(_cultureInfo) : path.ToLower(_cultureInfo); - string[] pieces = cutPath.Split(new[] { '/' }, StringSplitOptions.RemoveEmptyEntries); + string[] pieces = cutPath.Split(new[] + { + '/' + }, StringSplitOptions.RemoveEmptyEntries); if(pieces.Length == 0) return ErrorNumber.InvalidArgument; diff --git a/Aaru.Filesystems/FATX/Info.cs b/Aaru.Filesystems/FATX/Info.cs index 4a7c72710..d9b534e42 100644 --- a/Aaru.Filesystems/FATX/Info.cs +++ b/Aaru.Filesystems/FATX/Info.cs @@ -90,7 +90,8 @@ public sealed partial class XboxFatPlugin sb.AppendLine(Localization.FATX_filesystem); sb.AppendFormat(Localization._0_logical_sectors_1_bytes_per_physical_sector, logicalSectorsPerPhysicalSectors, - logicalSectorsPerPhysicalSectors * imagePlugin.Info.SectorSize).AppendLine(); + logicalSectorsPerPhysicalSectors * imagePlugin.Info.SectorSize). + AppendLine(); sb.AppendFormat(Localization._0_sectors_1_bytes_per_cluster, fatxSb.sectorsPerCluster, fatxSb.sectorsPerCluster * logicalSectorsPerPhysicalSectors * imagePlugin.Info.SectorSize). @@ -109,7 +110,8 @@ public sealed partial class XboxFatPlugin metadata = new FileSystem { Type = FS_TYPE, - ClusterSize = (uint)(fatxSb.sectorsPerCluster * logicalSectorsPerPhysicalSectors * + ClusterSize = (uint)(fatxSb.sectorsPerCluster * + logicalSectorsPerPhysicalSectors * imagePlugin.Info.SectorSize), VolumeName = volumeLabel, VolumeSerial = $"{fatxSb.id:X8}" diff --git a/Aaru.Filesystems/FATX/Super.cs b/Aaru.Filesystems/FATX/Super.cs index 647f8e09b..dd2e18d77 100644 --- a/Aaru.Filesystems/FATX/Super.cs +++ b/Aaru.Filesystems/FATX/Super.cs @@ -96,7 +96,8 @@ public sealed partial class XboxFatPlugin Metadata = new FileSystem { Type = Localization.FATX_filesystem, - ClusterSize = (uint)(_superblock.sectorsPerCluster * logicalSectorsPerPhysicalSectors * + ClusterSize = (uint)(_superblock.sectorsPerCluster * + logicalSectorsPerPhysicalSectors * imagePlugin.Info.SectorSize), VolumeName = volumeLabel, VolumeSerial = $"{_superblock.id:X8}" diff --git a/Aaru.Filesystems/FFS/Info.cs b/Aaru.Filesystems/FFS/Info.cs index 5e7641a72..81a1e4622 100644 --- a/Aaru.Filesystems/FFS/Info.cs +++ b/Aaru.Filesystems/FFS/Info.cs @@ -297,8 +297,7 @@ public sealed partial class FFSPlugin } // This is for sure, as it is shared with a sectors/track with non-x86 SunOS, Epoch is absurdly high for that - if(sb.fs_old_npsect > SunOSEpoch && - DateHandlers.UnixToDateTime(sb.fs_old_npsect) < DateTime.Now) + if(sb.fs_old_npsect > SunOSEpoch && DateHandlers.UnixToDateTime(sb.fs_old_npsect) < DateTime.Now) { fs_type_42bsd = false; fs_type_sun86 = true; @@ -306,8 +305,7 @@ public sealed partial class FFSPlugin fs_type_43bsd = false; } - if(sb.fs_cgrotor > 0x00000000 && - (uint)sb.fs_cgrotor < 0xFFFFFFFF) + if(sb.fs_cgrotor > 0x00000000 && (uint)sb.fs_cgrotor < 0xFFFFFFFF) { fs_type_42bsd = false; fs_type_sun = false; @@ -365,13 +363,15 @@ public sealed partial class FFSPlugin metadata.ModificationDate = DateHandlers.UnixToDateTime(sb.fs_old_time); sbInformation.AppendFormat(Localization._0_blocks_in_volume_1_bytes, sb.fs_old_size, - (long)sb.fs_old_size * sb.fs_fsize).AppendLine(); + (long)sb.fs_old_size * sb.fs_fsize). + AppendLine(); metadata.Clusters = (ulong)sb.fs_old_size; metadata.ClusterSize = (uint)sb.fs_fsize; sbInformation.AppendFormat(Localization._0_data_blocks_in_volume_1_bytes, sb.fs_old_dsize, - (long)sb.fs_old_dsize * sb.fs_fsize).AppendLine(); + (long)sb.fs_old_dsize * sb.fs_fsize). + AppendLine(); sbInformation.AppendFormat(Localization._0_cylinder_groups_in_volume, sb.fs_ncg).AppendLine(); sbInformation.AppendFormat(Localization._0_bytes_in_a_basic_block, sb.fs_bsize).AppendLine(); @@ -448,7 +448,8 @@ public sealed partial class FFSPlugin sbInformation.AppendFormat(Localization._0_directories, sb.fs_old_cstotal.cs_ndir).AppendLine(); sbInformation.AppendFormat(Localization._0_free_blocks_1_bytes, sb.fs_old_cstotal.cs_nbfree, - (long)sb.fs_old_cstotal.cs_nbfree * sb.fs_fsize).AppendLine(); + (long)sb.fs_old_cstotal.cs_nbfree * sb.fs_fsize). + AppendLine(); metadata.FreeClusters = (ulong)sb.fs_old_cstotal.cs_nbfree; sbInformation.AppendFormat(Localization._0_free_inodes, sb.fs_old_cstotal.cs_nifree).AppendLine(); @@ -494,7 +495,8 @@ public sealed partial class FFSPlugin sbInformation.AppendFormat(Localization._0_directories, sb.fs_cstotal.cs_ndir).AppendLine(); sbInformation.AppendFormat(Localization._0_free_blocks_1_bytes, sb.fs_cstotal.cs_nbfree, - sb.fs_cstotal.cs_nbfree * sb.fs_fsize).AppendLine(); + sb.fs_cstotal.cs_nbfree * sb.fs_fsize). + AppendLine(); metadata.FreeClusters = (ulong)sb.fs_cstotal.cs_nbfree; sbInformation.AppendFormat(Localization._0_free_inodes, sb.fs_cstotal.cs_nifree).AppendLine(); diff --git a/Aaru.Filesystems/HAMMER/Info.cs b/Aaru.Filesystems/HAMMER/Info.cs index 511c7e317..89df4bbb9 100644 --- a/Aaru.Filesystems/HAMMER/Info.cs +++ b/Aaru.Filesystems/HAMMER/Info.cs @@ -124,10 +124,12 @@ public sealed partial class HAMMER if(superBlock.vol_no == superBlock.vol_rootvol) { sb.AppendFormat(Localization.Filesystem_contains_0_big_blocks_1_bytes, superBlock.vol0_stat_bigblocks, - superBlock.vol0_stat_bigblocks * HAMMER_BIGBLOCK_SIZE).AppendLine(); + superBlock.vol0_stat_bigblocks * HAMMER_BIGBLOCK_SIZE). + AppendLine(); sb.AppendFormat(Localization.Filesystem_has_0_big_blocks_free_1_bytes, superBlock.vol0_stat_freebigblocks, - superBlock.vol0_stat_freebigblocks * HAMMER_BIGBLOCK_SIZE).AppendLine(); + superBlock.vol0_stat_freebigblocks * HAMMER_BIGBLOCK_SIZE). + AppendLine(); sb.AppendFormat(Localization.Filesystem_has_0_inodes_used, superBlock.vol0_stat_inodes).AppendLine(); diff --git a/Aaru.Filesystems/HPFS/Info.cs b/Aaru.Filesystems/HPFS/Info.cs index 95989cab6..952f80aab 100644 --- a/Aaru.Filesystems/HPFS/Info.cs +++ b/Aaru.Filesystems/HPFS/Info.cs @@ -230,10 +230,7 @@ public sealed partial class HPFS metadata = new FileSystem(); // Theoretically everything from BPB to SB is boot code, should I hash everything or only the sector loaded by BIOS itself? - if(bpb.jump[0] == 0xEB && - bpb.jump[1] > 0x3C && - bpb.jump[1] < 0x80 && - bpb.signature2 == 0xAA55) + if(bpb.jump[0] == 0xEB && bpb.jump[1] > 0x3C && bpb.jump[1] < 0x80 && bpb.signature2 == 0xAA55) { metadata.Bootable = true; string bootChk = Sha1Context.Data(bpb.boot_code, out byte[] _); diff --git a/Aaru.Filesystems/HPOFS/Consts.cs b/Aaru.Filesystems/HPOFS/Consts.cs index 491ca2708..1f3f5d6aa 100644 --- a/Aaru.Filesystems/HPOFS/Consts.cs +++ b/Aaru.Filesystems/HPOFS/Consts.cs @@ -33,6 +33,9 @@ public sealed partial class HPOFS // Do not translate const string FS_TYPE = "hpofs"; readonly byte[] _medinfoSignature = "MEDINFO "u8.ToArray(); - readonly byte[] _type = { 0x48, 0x50, 0x4F, 0x46, 0x53, 0x00, 0x00, 0x00 }; + readonly byte[] _type = + { + 0x48, 0x50, 0x4F, 0x46, 0x53, 0x00, 0x00, 0x00 + }; readonly byte[] _volinfoSignature = "VOLINFO "u8.ToArray(); } \ No newline at end of file diff --git a/Aaru.Filesystems/HPOFS/Info.cs b/Aaru.Filesystems/HPOFS/Info.cs index 906dac540..9691baf7b 100644 --- a/Aaru.Filesystems/HPOFS/Info.cs +++ b/Aaru.Filesystems/HPOFS/Info.cs @@ -170,8 +170,7 @@ public sealed partial class HPOFS AaruConsole.DebugWriteLine(MODULE_NAME, "vib.unknown4 = \"{0}\"", StringHandlers.SpacePaddedToString(vib.unknown4)); - AaruConsole.DebugWriteLine(MODULE_NAME, "vib.owner = \"{0}\"", - StringHandlers.SpacePaddedToString(vib.owner)); + AaruConsole.DebugWriteLine(MODULE_NAME, "vib.owner = \"{0}\"", StringHandlers.SpacePaddedToString(vib.owner)); AaruConsole.DebugWriteLine(MODULE_NAME, "vib.unknown5 = \"{0}\"", StringHandlers.SpacePaddedToString(vib.unknown5)); @@ -205,12 +204,14 @@ public sealed partial class HPOFS AppendLine(); sb.AppendFormat(Localization.Volume_created_on_0, - DateHandlers.DosToDateTime(mib.creationDate, mib.creationTime)).AppendLine(); + DateHandlers.DosToDateTime(mib.creationDate, mib.creationTime)). + AppendLine(); sb.AppendFormat(Localization.Volume_uses_0_codepage_1, mib.codepageType is > 0 and < 3 ? mib.codepageType == 2 ? Localization.EBCDIC : Localization.ASCII - : Localization.Unknown_codepage, mib.codepage).AppendLine(); + : Localization.Unknown_codepage, mib.codepage). + AppendLine(); sb.AppendFormat(Localization.RPS_level_0, mib.rps).AppendLine(); sb.AppendFormat(Localization.Filesystem_version_0_1, mib.major, mib.minor).AppendLine(); diff --git a/Aaru.Filesystems/ISO9660/Date.cs b/Aaru.Filesystems/ISO9660/Date.cs index 2d4be8ad3..b5f7e5ee9 100644 --- a/Aaru.Filesystems/ISO9660/Date.cs +++ b/Aaru.Filesystems/ISO9660/Date.cs @@ -36,10 +36,9 @@ public sealed partial class ISO9660 { static DateTime? DecodeIsoDateTime(byte[] timestamp) => timestamp?.Length switch { - 7 => DecodeIsoDateTime( - Marshal. - ByteArrayToStructureLittleEndian( - timestamp)), + 7 => DecodeIsoDateTime(Marshal. + ByteArrayToStructureLittleEndian< + IsoTimestamp>(timestamp)), 17 => DateHandlers.Iso9660ToDateTime(timestamp), _ => null }; diff --git a/Aaru.Filesystems/ISO9660/Dir.cs b/Aaru.Filesystems/ISO9660/Dir.cs index fcdb6198f..1e6a6d4db 100644 --- a/Aaru.Filesystems/ISO9660/Dir.cs +++ b/Aaru.Filesystems/ISO9660/Dir.cs @@ -53,8 +53,7 @@ public sealed partial class ISO9660 if(!_mounted) return ErrorNumber.AccessDenied; - if(string.IsNullOrWhiteSpace(path) || - path == "/") + if(string.IsNullOrWhiteSpace(path) || path == "/") { node = new Iso9660DirNode { @@ -82,7 +81,10 @@ public sealed partial class ISO9660 return ErrorNumber.NoError; } - string[] pieces = cutPath.Split(new[] { '/' }, StringSplitOptions.RemoveEmptyEntries); + string[] pieces = cutPath.Split(new[] + { + '/' + }, StringSplitOptions.RemoveEmptyEntries); KeyValuePair entry = _rootDirectoryCache.FirstOrDefault(t => t.Key.Equals(pieces[0], StringComparison.CurrentCultureIgnoreCase)); @@ -99,8 +101,9 @@ public sealed partial class ISO9660 for(var p = 0; p < pieces.Length; p++) { - entry = currentDirectory.FirstOrDefault( - t => t.Key.Equals(pieces[p], StringComparison.CurrentCultureIgnoreCase)); + entry = + currentDirectory.FirstOrDefault(t => t.Key.Equals(pieces[p], + StringComparison.CurrentCultureIgnoreCase)); if(string.IsNullOrEmpty(entry.Key)) return ErrorNumber.NoSuchFile; @@ -116,22 +119,25 @@ public sealed partial class ISO9660 if(entry.Value.Extents.Count == 0) return ErrorNumber.InvalidArgument; - currentDirectory = _cdi - ? DecodeCdiDirectory(entry.Value.Extents[0].extent + entry.Value.XattrLength, - entry.Value.Extents[0].size) - : _highSierra - ? DecodeHighSierraDirectory( - entry.Value.Extents[0].extent + entry.Value.XattrLength, - entry.Value.Extents[0].size) - : DecodeIsoDirectory(entry.Value.Extents[0].extent + entry.Value.XattrLength, - entry.Value.Extents[0].size); + currentDirectory = + _cdi + ? + DecodeCdiDirectory(entry.Value.Extents[0].extent + entry.Value.XattrLength, + entry.Value.Extents[0].size) + : _highSierra + ? DecodeHighSierraDirectory(entry.Value.Extents[0].extent + entry.Value.XattrLength, + entry.Value.Extents[0].size) + : DecodeIsoDirectory(entry.Value.Extents[0].extent + entry.Value.XattrLength, + entry.Value.Extents[0].size); if(_usePathTable) { foreach(DecodedDirectoryEntry subDirectory in _cdi ? GetSubdirsFromCdiPathTable(currentPath) - : _highSierra - ? GetSubdirsFromHighSierraPathTable(currentPath) + : + _highSierra + ? + GetSubdirsFromHighSierraPathTable(currentPath) : GetSubdirsFromIsoPathTable(currentPath)) currentDirectory[subDirectory.Filename] = subDirectory; } @@ -238,8 +244,7 @@ public sealed partial class ISO9660 // Special entries for current and parent directories, skip them if(record.name_len == 1) { - if(data[entryOff + _directoryRecordSize] == 0 || - data[entryOff + _directoryRecordSize] == 1) + if(data[entryOff + _directoryRecordSize] == 0 || data[entryOff + _directoryRecordSize] == 1) { entryOff += record.length; @@ -278,8 +283,7 @@ public sealed partial class ISO9660 if(entry.CdiSystemArea.Value.attributes.HasFlag(CdiAttributes.Directory)) entry.Flags |= FileFlags.Directory; - if(!entry.CdiSystemArea.Value.attributes.HasFlag(CdiAttributes.Directory) || - !_usePathTable) + if(!entry.CdiSystemArea.Value.attributes.HasFlag(CdiAttributes.Directory) || !_usePathTable) entries[entry.Filename] = entry; entryOff += record.length; @@ -320,8 +324,7 @@ public sealed partial class ISO9660 // Special entries for current and parent directories, skip them if(record.name_len == 1) { - if(data[entryOff + _directoryRecordSize] == 0 || - data[entryOff + _directoryRecordSize] == 1) + if(data[entryOff + _directoryRecordSize] == 0 || data[entryOff + _directoryRecordSize] == 1) { entryOff += record.length; @@ -393,8 +396,7 @@ public sealed partial class ISO9660 // Special entries for current and parent directories, skip them if(record.name_len == 1) { - if(data[entryOff + _directoryRecordSize] == 0 || - data[entryOff + _directoryRecordSize] == 1) + if(data[entryOff + _directoryRecordSize] == 0 || data[entryOff + _directoryRecordSize] == 1) { entryOff += record.length; @@ -406,11 +408,10 @@ public sealed partial class ISO9660 { Size = record.size, Flags = record.flags, - Filename = - _joliet - ? Encoding.BigEndianUnicode.GetString(data, entryOff + _directoryRecordSize, - record.name_len) - : Encoding.GetString(data, entryOff + _directoryRecordSize, record.name_len), + Filename = _joliet + ? Encoding.BigEndianUnicode.GetString(data, entryOff + _directoryRecordSize, + record.name_len) + : Encoding.GetString(data, entryOff + _directoryRecordSize, record.name_len), FileUnitSize = record.file_unit_size, Interleave = record.interleave, VolumeSequenceNumber = record.volume_sequence_number, @@ -614,8 +615,7 @@ public sealed partial class ISO9660 var appleId = (AppleId)data[systemAreaOff + 3]; // Old AAIP - if(appleId == AppleId.ProDOS && - appleLength != 7) + if(appleId == AppleId.ProDOS && appleLength != 7) goto case AAIP_MAGIC; switch(appleId) @@ -831,8 +831,7 @@ public sealed partial class ISO9660 systemAreaOff + Marshal.SizeOf(), Marshal.SizeOf()); - if(!continueSymlink || - entry.SymbolicLink is null) + if(!continueSymlink || entry.SymbolicLink is null) entry.SymbolicLink = ""; if(slc.flags.HasFlag(SymlinkComponentFlags.Root)) @@ -844,18 +843,20 @@ public sealed partial class ISO9660 if(slc.flags.HasFlag(SymlinkComponentFlags.Parent)) entry.SymbolicLink += ".."; - if(!continueSymlinkComponent && - !slc.flags.HasFlag(SymlinkComponentFlags.Root)) + if(!continueSymlinkComponent && !slc.flags.HasFlag(SymlinkComponentFlags.Root)) entry.SymbolicLink += "/"; entry.SymbolicLink += slc.flags.HasFlag(SymlinkComponentFlags.Networkname) - ? Environment.MachineName + ? + Environment.MachineName : _joliet ? Encoding.BigEndianUnicode.GetString(data, - systemAreaOff + Marshal.SizeOf() + + systemAreaOff + + Marshal.SizeOf() + Marshal.SizeOf(), slc.length) : Encoding.GetString(data, - systemAreaOff + Marshal.SizeOf() + + systemAreaOff + + Marshal.SizeOf() + Marshal.SizeOf(), slc.length); @@ -877,7 +878,7 @@ public sealed partial class ISO9660 AlternateName alternateName = Marshal.ByteArrayToStructureLittleEndian(data, systemAreaOff, - Marshal.SizeOf()); + Marshal.SizeOf()); byte[] nm; @@ -1049,8 +1050,7 @@ public sealed partial class ISO9660 errno = ReadSingleExtent(ca.offset, ca.ca_length, ca.block, out byte[] caData); // TODO: Check continuation area definition, this is not a proper fix - if(errno == ErrorNumber.NoError && - caData.Length > 0) + if(errno == ErrorNumber.NoError && caData.Length > 0) DecodeSystemArea(caData, 0, (int)ca.ca_length, ref entry, out hasResourceFork); systemAreaOff += ceLength; @@ -1114,7 +1114,10 @@ public sealed partial class ISO9660 ? path[1..].ToLower(CultureInfo.CurrentUICulture) : path.ToLower(CultureInfo.CurrentUICulture); - string[] pieces = cutPath.Split(new[] { '/' }, StringSplitOptions.RemoveEmptyEntries); + string[] pieces = cutPath.Split(new[] + { + '/' + }, StringSplitOptions.RemoveEmptyEntries); var currentParent = 1; var currentPiece = 0; @@ -1122,7 +1125,10 @@ public sealed partial class ISO9660 while(currentPiece < pieces.Length) { PathTableEntryInternal currentEntry = _pathTable.FirstOrDefault(p => p.Parent == currentParent && - p.Name.Equals(pieces[currentPiece], StringComparison.CurrentCultureIgnoreCase)); + p.Name. + Equals(pieces[currentPiece], + StringComparison. + CurrentCultureIgnoreCase)); if(currentEntry is null) break; diff --git a/Aaru.Filesystems/ISO9660/File.cs b/Aaru.Filesystems/ISO9660/File.cs index 947288912..818354f14 100644 --- a/Aaru.Filesystems/ISO9660/File.cs +++ b/Aaru.Filesystems/ISO9660/File.cs @@ -77,8 +77,7 @@ public sealed partial class ISO9660 if(err != ErrorNumber.NoError) return err; - if(entry.Flags.HasFlag(FileFlags.Directory) && - !_debug) + if(entry.Flags.HasFlag(FileFlags.Directory) && !_debug) return ErrorNumber.IsDirectory; if(entry.Extents is null) @@ -118,8 +117,7 @@ public sealed partial class ISO9660 if(!_mounted) return ErrorNumber.AccessDenied; - if(buffer is null || - buffer.Length < length) + if(buffer is null || buffer.Length < length) return ErrorNumber.InvalidArgument; if(node is not Iso9660FileNode mynode) @@ -382,9 +380,7 @@ public sealed partial class ISO9660 if(entry.SymbolicLink != null) stat.Attributes |= FileAttributes.Symlink; - if(entry.XattrLength == 0 || - _cdi || - _highSierra) + if(entry.XattrLength == 0 || _cdi || _highSierra) return ErrorNumber.NoError; if(entry.CdiSystemArea != null) @@ -475,7 +471,10 @@ public sealed partial class ISO9660 ? path[1..].ToLower(CultureInfo.CurrentUICulture) : path.ToLower(CultureInfo.CurrentUICulture); - string[] pieces = cutPath.Split(new[] { '/' }, StringSplitOptions.RemoveEmptyEntries); + string[] pieces = cutPath.Split(new[] + { + '/' + }, StringSplitOptions.RemoveEmptyEntries); if(pieces.Length == 0) return ErrorNumber.InvalidArgument; @@ -504,11 +503,10 @@ public sealed partial class ISO9660 if(string.IsNullOrEmpty(dirent.Key)) { - if(!_joliet && - !pieces[^1].EndsWith(";1", StringComparison.Ordinal)) + if(!_joliet && !pieces[^1].EndsWith(";1", StringComparison.Ordinal)) { - dirent = parent.FirstOrDefault( - t => t.Key.Equals(pieces[^1] + ";1", StringComparison.CurrentCultureIgnoreCase)); + dirent = parent.FirstOrDefault(t => t.Key.Equals(pieces[^1] + ";1", + StringComparison.CurrentCultureIgnoreCase)); if(string.IsNullOrEmpty(dirent.Key)) return ErrorNumber.NoSuchFile; diff --git a/Aaru.Filesystems/ISO9660/ISO9660.cs b/Aaru.Filesystems/ISO9660/ISO9660.cs index 4eca2fb36..7b9674a49 100644 --- a/Aaru.Filesystems/ISO9660/ISO9660.cs +++ b/Aaru.Filesystems/ISO9660/ISO9660.cs @@ -79,24 +79,37 @@ public sealed partial class ISO9660 : IReadOnlyFilesystem new (string name, Type type, string description)[] { ("use_path_table", typeof(bool), "Use path table for directory traversal"), - ("use_trans_tbl", typeof(bool), "Use TRANS.TBL for filenames"), ("use_evd", typeof(bool), - "If present, use Enhanced Volume Descriptor with specified encoding (overrides namespace)") + ("use_trans_tbl", typeof(bool), "Use TRANS.TBL for filenames"), + ("use_evd", typeof(bool), + "If present, use Enhanced Volume Descriptor with specified encoding (overrides namespace)") }; /// public Dictionary Namespaces => new() { - { "normal", "Primary Volume Descriptor, ignoring ;1 suffixes" }, - { "vms", "Primary Volume Descriptor, showing version suffixes" }, - { "joliet", "Joliet Volume Descriptor (default)" }, - { "rrip", "Rock Ridge" }, - { "romeo", "Primary Volume Descriptor using the specified encoding codepage" } + { + "normal", "Primary Volume Descriptor, ignoring ;1 suffixes" + }, + { + "vms", "Primary Volume Descriptor, showing version suffixes" + }, + { + "joliet", "Joliet Volume Descriptor (default)" + }, + { + "rrip", "Rock Ridge" + }, + { + "romeo", "Primary Volume Descriptor using the specified encoding codepage" + } }; #endregion static Dictionary GetDefaultOptions() => new() { - { "debug", false.ToString() } + { + "debug", false.ToString() + } }; } \ No newline at end of file diff --git a/Aaru.Filesystems/ISO9660/Info.cs b/Aaru.Filesystems/ISO9660/Info.cs index 11278bf90..62f898f15 100644 --- a/Aaru.Filesystems/ISO9660/Info.cs +++ b/Aaru.Filesystems/ISO9660/Info.cs @@ -82,7 +82,8 @@ public sealed partial class ISO9660 AaruConsole.DebugWriteLine(MODULE_NAME, "HSMagic = {0}", Encoding.ASCII.GetString(hsMagic)); return Encoding.ASCII.GetString(vdMagic) == ISO_MAGIC || - Encoding.ASCII.GetString(hsMagic) == HIGH_SIERRA_MAGIC || Encoding.ASCII.GetString(vdMagic) == CDI_MAGIC; + Encoding.ASCII.GetString(hsMagic) == HIGH_SIERRA_MAGIC || + Encoding.ASCII.GetString(vdMagic) == CDI_MAGIC; } /// @@ -211,8 +212,7 @@ public sealed partial class ISO9660 // Check if this is Joliet if(svd.version == 1) { - 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' || @@ -247,9 +247,7 @@ public sealed partial class ISO9660 metadata = new FileSystem(); - if(pvd == null && - hsvd == null && - fsvd == null) + if(pvd == null && hsvd == null && fsvd == null) { information = Localization.ERROR_Could_not_find_primary_volume_descriptor; @@ -314,8 +312,7 @@ public sealed partial class ISO9660 } // Walk thru root directory to see system area extensions in use - while(rootOff + Marshal.SizeOf() < rootDir.Length && - !cdiInfo) + while(rootOff + Marshal.SizeOf() < rootDir.Length && !cdiInfo) { DirectoryRecord record = Marshal.ByteArrayToStructureLittleEndian(rootDir, rootOff, @@ -325,8 +322,7 @@ public sealed partial class ISO9660 saOff += saOff % 2; int saLen = record.length - saOff; - if(saLen > 0 && - rootOff + saOff + saLen <= rootDir.Length) + if(saLen > 0 && rootOff + saOff + saLen <= rootDir.Length) { var sa = new byte[saLen]; Array.Copy(rootDir, rootOff + saOff, sa, 0, saLen); @@ -406,8 +402,7 @@ public sealed partial class ISO9660 switch(nextSignature) { case APPLE_MAGIC: - if(sa[saOff + 3] == 1 && - sa[saOff + 2] == 7) + if(sa[saOff + 3] == 1 && sa[saOff + 2] == 7) apple = true; else apple |= sa[saOff + 3] != 1; @@ -438,8 +433,8 @@ public sealed partial class 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]; @@ -467,7 +462,8 @@ public sealed partial class ISO9660 (highSierraInfo ? hsvd.Value.logical_block_size : pvd.Value.logical_block_size); if((ca.ca_length_be + ca.offset_be) % - (highSierraInfo ? hsvd.Value.logical_block_size : pvd.Value.logical_block_size) > 0) + (highSierraInfo ? hsvd.Value.logical_block_size : pvd.Value.logical_block_size) > + 0) caLen++; errno = imagePlugin.ReadSectors(ca.block_be, caLen, out byte[] caSectors); @@ -487,8 +483,7 @@ public sealed partial class ISO9660 { // Apple never said to include its extensions inside a continuation area, but just in case case APPLE_MAGIC: - if(caData[caOff + 3] == 1 && - caData[caOff + 2] == 7) + if(caData[caOff + 3] == 1 && caData[caOff + 2] == 7) apple = true; else apple |= caData[caOff + 3] != 1; @@ -504,14 +499,13 @@ public sealed partial class ISO9660 rrip |= nextSignature is RRIP_MAGIC or RRIP_POSIX_ATTRIBUTES or RRIP_POSIX_DEV_NO or RRIP_SYMLINK or RRIP_NAME or RRIP_CHILDLINK or RRIP_PARENTLINK or RRIP_RELOCATED_DIR - or RRIP_TIMESTAMPS - or RRIP_SPARSE; + or RRIP_TIMESTAMPS or RRIP_SPARSE; 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]; } @@ -729,8 +723,7 @@ public sealed partial class ISO9660 AaruConsole.DebugWriteLine(MODULE_NAME, "initialEntry.load_rba = {0}", initialEntry.load_rba); - AaruConsole.DebugWriteLine(MODULE_NAME, "initialEntry.sector_count = {0}", - initialEntry.sector_count); + AaruConsole.DebugWriteLine(MODULE_NAME, "initialEntry.sector_count = {0}", initialEntry.sector_count); byte[] bootImage = null; @@ -754,17 +747,20 @@ public sealed partial class ISO9660 isoMetadata.AppendFormat("\t" + Localization.Bootable_on_0, valentry.platform_id).AppendLine(); isoMetadata.AppendFormat("\t" + Localization.Bootable_image_starts_at_sector_0_and_runs_for_1_sectors, - initialEntry.load_rba, initialEntry.sector_count).AppendLine(); + initialEntry.load_rba, initialEntry.sector_count). + AppendLine(); if(valentry.platform_id == ElToritoPlatform.x86) { isoMetadata.AppendFormat("\t" + Localization.Bootable_image_will_be_loaded_at_segment_0, - initialEntry.load_seg == 0 ? 0x7C0 : initialEntry.load_seg).AppendLine(); + initialEntry.load_seg == 0 ? 0x7C0 : initialEntry.load_seg). + AppendLine(); } else { isoMetadata.AppendFormat("\t" + Localization.Bootable_image_will_be_loaded_at_0, - (uint)initialEntry.load_seg * 10).AppendLine(); + (uint)initialEntry.load_seg * 10). + AppendLine(); } switch(initialEntry.boot_type) @@ -787,7 +783,8 @@ public sealed partial class ISO9660 break; default: isoMetadata.AppendFormat("\t" + Localization.Image_uses_unknown_emulation_type_0, - (byte)initialEntry.boot_type).AppendLine(); + (byte)initialEntry.boot_type). + AppendLine(); break; } @@ -851,7 +848,8 @@ public sealed partial class ISO9660 isoMetadata. AppendFormat("\t\t" + Localization.Bootable_image_starts_at_sector_0_and_runs_for_1_sectors, - sectionEntry.load_rba, sectionEntry.sector_count).AppendLine(); + sectionEntry.load_rba, sectionEntry.sector_count). + AppendLine(); if(valentry.platform_id == ElToritoPlatform.x86) { @@ -862,7 +860,8 @@ public sealed partial class ISO9660 else { isoMetadata.AppendFormat("\t\t" + Localization.Bootable_image_will_be_loaded_at_0, - (uint)sectionEntry.load_seg * 10).AppendLine(); + (uint)sectionEntry.load_seg * 10). + AppendLine(); } switch((ElToritoEmulation)((byte)sectionEntry.boot_type & 0xF)) @@ -872,29 +871,31 @@ public sealed partial class ISO9660 break; case ElToritoEmulation.Md2Hd: - isoMetadata.AppendLine("\t\t" + Localization. - Image_emulates_a_high_density_MD2HD_floppy); + isoMetadata.AppendLine("\t\t" + + Localization.Image_emulates_a_high_density_MD2HD_floppy); break; case ElToritoEmulation.Mf2Hd: - isoMetadata.AppendLine("\t\t" + Localization. - Image_emulates_a_high_density_MF2HD_floppy); + isoMetadata.AppendLine("\t\t" + + Localization.Image_emulates_a_high_density_MF2HD_floppy); break; case ElToritoEmulation.Mf2Ed: - isoMetadata.AppendLine("\t\t" + Localization. - Image_emulates_a_extra_density_MF2ED_floppy); + isoMetadata.AppendLine("\t\t" + + Localization.Image_emulates_a_extra_density_MF2ED_floppy); break; default: isoMetadata.AppendFormat("\t\t" + Localization.Image_uses_unknown_emulation_type_0, - (byte)initialEntry.boot_type).AppendLine(); + (byte)initialEntry.boot_type). + AppendLine(); break; } isoMetadata.AppendFormat("\t\t" + Localization.Selection_criteria_type_0, - sectionEntry.selection_criteria_type).AppendLine(); + sectionEntry.selection_criteria_type). + AppendLine(); isoMetadata.AppendFormat("\t\t" + Localization.System_type_0, sectionEntry.system_type). AppendLine(); @@ -902,7 +903,8 @@ public sealed partial class ISO9660 if(bootImage != null) { isoMetadata.AppendFormat("\t\t" + Localization.Bootable_image_SHA1_0, - Sha1Context.Data(bootImage, out _)).AppendLine(); + Sha1Context.Data(bootImage, out _)). + AppendLine(); } } else diff --git a/Aaru.Filesystems/ISO9660/Mode2.cs b/Aaru.Filesystems/ISO9660/Mode2.cs index 6fa7ccf87..93ce453f3 100644 --- a/Aaru.Filesystems/ISO9660/Mode2.cs +++ b/Aaru.Filesystems/ISO9660/Mode2.cs @@ -91,15 +91,24 @@ public sealed partial class ISO9660 data[1], (Mode2Submode)data[2], data[3]); break; - case 2352 when data[0] != 0x00 || data[1] != 0xFF || data[2] != 0xFF || data[3] != 0xFF || - data[4] != 0xFF || data[5] != 0xFF || data[6] != 0xFF || data[7] != 0xFF || - data[8] != 0xFF || data[9] != 0xFF || data[10] != 0xFF || data[11] != 0x00: + case 2352 when data[0] != 0x00 || + data[1] != 0xFF || + data[2] != 0xFF || + data[3] != 0xFF || + data[4] != 0xFF || + data[5] != 0xFF || + data[6] != 0xFF || + data[7] != 0xFF || + data[8] != 0xFF || + data[9] != 0xFF || + data[10] != 0xFF || + data[11] != 0x00: AaruConsole.DebugWriteLine(MODULE_NAME, Localization.tor_Sector_0_Raw_Audio, realSector); break; case 2352 when data[15] != 2: - AaruConsole.DebugWriteLine(MODULE_NAME, Localization.tor_Sector_0_1_2_3_Raw_Mode_4, - realSector, data[12], data[13], data[14], data[15]); + AaruConsole.DebugWriteLine(MODULE_NAME, Localization.tor_Sector_0_1_2_3_Raw_Mode_4, realSector, + data[12], data[13], data[14], data[15]); break; case 2352: @@ -155,8 +164,8 @@ public sealed partial class ISO9660 break; case 2324: - AaruConsole.DebugWriteLine(MODULE_NAME, - Localization.tor_Sector_0_Cooked_Mode_two_Form_two, dstSector); + AaruConsole.DebugWriteLine(MODULE_NAME, Localization.tor_Sector_0_Cooked_Mode_two_Form_two, + dstSector); break; case 2336: @@ -168,11 +177,19 @@ public sealed partial class ISO9660 data[0], data[1], (Mode2Submode)data[2], data[3]); break; - case 2352 when data[0] != 0x00 || data[1] != 0xFF || data[2] != 0xFF || data[3] != 0xFF || - data[4] != 0xFF || data[5] != 0xFF || data[6] != 0xFF || data[7] != 0xFF || - data[8] != 0xFF || data[9] != 0xFF || data[10] != 0xFF || data[11] != 0x00: - AaruConsole.DebugWriteLine(MODULE_NAME, Localization.tor_Sector_0_Raw_Audio, - dstSector); + case 2352 when data[0] != 0x00 || + data[1] != 0xFF || + data[2] != 0xFF || + data[3] != 0xFF || + data[4] != 0xFF || + data[5] != 0xFF || + data[6] != 0xFF || + data[7] != 0xFF || + data[8] != 0xFF || + data[9] != 0xFF || + data[10] != 0xFF || + data[11] != 0x00: + AaruConsole.DebugWriteLine(MODULE_NAME, Localization.tor_Sector_0_Raw_Audio, dstSector); break; case 2352 when data[15] != 2: diff --git a/Aaru.Filesystems/ISO9660/PathTable.cs b/Aaru.Filesystems/ISO9660/PathTable.cs index e6aac76b3..74c86549c 100644 --- a/Aaru.Filesystems/ISO9660/PathTable.cs +++ b/Aaru.Filesystems/ISO9660/PathTable.cs @@ -36,8 +36,7 @@ public sealed partial class ISO9660 { PathTableEntryInternal[] DecodePathTable(byte[] data) { - if(data is null || - data.Length == 0) + if(data is null || data.Length == 0) return null; List table = new(); @@ -94,9 +93,9 @@ public sealed partial class ISO9660 { HighSierraPathTableEntry entry = Marshal.ByteArrayToStructureBigEndian(data, off, - Marshal. - SizeOf< - HighSierraPathTableEntry>()); + Marshal. + SizeOf< + HighSierraPathTableEntry>()); if(entry.name_len == 0) break; diff --git a/Aaru.Filesystems/ISO9660/Structs/CDi.cs b/Aaru.Filesystems/ISO9660/Structs/CDi.cs index 74b0c534e..698e0007e 100644 --- a/Aaru.Filesystems/ISO9660/Structs/CDi.cs +++ b/Aaru.Filesystems/ISO9660/Structs/CDi.cs @@ -51,14 +51,12 @@ public sealed partial class ISO9660 ApplicationIdentifier = StringHandlers.CToString(pvd.application_data).TrimEnd() }; - if(pvd.creation_date[0] == '0' || - pvd.creation_date[0] == 0x00) + if(pvd.creation_date[0] == '0' || pvd.creation_date[0] == 0x00) decodedVd.CreationTime = DateTime.MinValue; else decodedVd.CreationTime = DateHandlers.HighSierraToDateTime(pvd.creation_date); - if(pvd.modification_date[0] == '0' || - pvd.modification_date[0] == 0x00) + if(pvd.modification_date[0] == '0' || pvd.modification_date[0] == 0x00) decodedVd.HasModificationTime = false; else { @@ -66,8 +64,7 @@ public sealed partial class ISO9660 decodedVd.ModificationTime = DateHandlers.HighSierraToDateTime(pvd.modification_date); } - if(pvd.expiration_date[0] == '0' || - pvd.expiration_date[0] == 0x00) + if(pvd.expiration_date[0] == '0' || pvd.expiration_date[0] == 0x00) decodedVd.HasExpirationTime = false; else { @@ -75,8 +72,7 @@ public sealed partial class ISO9660 decodedVd.ExpirationTime = DateHandlers.HighSierraToDateTime(pvd.expiration_date); } - if(pvd.effective_date[0] == '0' || - pvd.effective_date[0] == 0x00) + if(pvd.effective_date[0] == '0' || pvd.effective_date[0] == 0x00) decodedVd.HasEffectiveTime = false; else { diff --git a/Aaru.Filesystems/ISO9660/Structs/HighSierra.cs b/Aaru.Filesystems/ISO9660/Structs/HighSierra.cs index b9be758f4..c38402afc 100644 --- a/Aaru.Filesystems/ISO9660/Structs/HighSierra.cs +++ b/Aaru.Filesystems/ISO9660/Structs/HighSierra.cs @@ -48,14 +48,12 @@ public sealed partial class ISO9660 ApplicationIdentifier = Encoding.ASCII.GetString(pvd.application_data).TrimEnd().Trim('\0') }; - if(pvd.creation_date[0] == '0' || - pvd.creation_date[0] == 0x00) + if(pvd.creation_date[0] == '0' || pvd.creation_date[0] == 0x00) decodedVd.CreationTime = DateTime.MinValue; else decodedVd.CreationTime = DateHandlers.HighSierraToDateTime(pvd.creation_date); - if(pvd.modification_date[0] == '0' || - pvd.modification_date[0] == 0x00) + if(pvd.modification_date[0] == '0' || pvd.modification_date[0] == 0x00) decodedVd.HasModificationTime = false; else { @@ -63,8 +61,7 @@ public sealed partial class ISO9660 decodedVd.ModificationTime = DateHandlers.HighSierraToDateTime(pvd.modification_date); } - if(pvd.expiration_date[0] == '0' || - pvd.expiration_date[0] == 0x00) + if(pvd.expiration_date[0] == '0' || pvd.expiration_date[0] == 0x00) decodedVd.HasExpirationTime = false; else { @@ -72,8 +69,7 @@ public sealed partial class ISO9660 decodedVd.ExpirationTime = DateHandlers.HighSierraToDateTime(pvd.expiration_date); } - if(pvd.effective_date[0] == '0' || - pvd.effective_date[0] == 0x00) + if(pvd.effective_date[0] == '0' || pvd.effective_date[0] == 0x00) decodedVd.HasEffectiveTime = false; else { diff --git a/Aaru.Filesystems/ISO9660/Structs/ISO.cs b/Aaru.Filesystems/ISO9660/Structs/ISO.cs index b2cbe7f56..c81b40b34 100644 --- a/Aaru.Filesystems/ISO9660/Structs/ISO.cs +++ b/Aaru.Filesystems/ISO9660/Structs/ISO.cs @@ -52,14 +52,12 @@ public sealed partial class ISO9660 ApplicationIdentifier = StringHandlers.CToString(pvd.application_id, encoding).TrimEnd() }; - if(pvd.creation_date[0] == '0' || - pvd.creation_date[0] == 0x00) + if(pvd.creation_date[0] == '0' || pvd.creation_date[0] == 0x00) decodedVd.CreationTime = DateTime.MinValue; else decodedVd.CreationTime = DateHandlers.Iso9660ToDateTime(pvd.creation_date); - if(pvd.modification_date[0] == '0' || - pvd.modification_date[0] == 0x00) + if(pvd.modification_date[0] == '0' || pvd.modification_date[0] == 0x00) decodedVd.HasModificationTime = false; else { @@ -67,8 +65,7 @@ public sealed partial class ISO9660 decodedVd.ModificationTime = DateHandlers.Iso9660ToDateTime(pvd.modification_date); } - if(pvd.expiration_date[0] == '0' || - pvd.expiration_date[0] == 0x00) + if(pvd.expiration_date[0] == '0' || pvd.expiration_date[0] == 0x00) decodedVd.HasExpirationTime = false; else { @@ -76,8 +73,7 @@ public sealed partial class ISO9660 decodedVd.ExpirationTime = DateHandlers.Iso9660ToDateTime(pvd.expiration_date); } - if(pvd.effective_date[0] == '0' || - pvd.effective_date[0] == 0x00) + if(pvd.effective_date[0] == '0' || pvd.effective_date[0] == 0x00) decodedVd.HasEffectiveTime = false; else { diff --git a/Aaru.Filesystems/ISO9660/Structs/Joliet.cs b/Aaru.Filesystems/ISO9660/Structs/Joliet.cs index ae5544e69..a509127ab 100644 --- a/Aaru.Filesystems/ISO9660/Structs/Joliet.cs +++ b/Aaru.Filesystems/ISO9660/Structs/Joliet.cs @@ -41,24 +41,26 @@ public sealed partial class ISO9660 { SystemIdentifier = Encoding.BigEndianUnicode.GetString(jolietvd.system_id).Replace('\u0000', ' ').TrimEnd(), VolumeIdentifier = Encoding.BigEndianUnicode.GetString(jolietvd.volume_id).Replace('\u0000', ' ').TrimEnd(), - VolumeSetIdentifier = Encoding.BigEndianUnicode.GetString(jolietvd.volume_set_id).Replace('\u0000', ' '). + VolumeSetIdentifier = Encoding.BigEndianUnicode.GetString(jolietvd.volume_set_id). + Replace('\u0000', ' '). TrimEnd(), - PublisherIdentifier = Encoding.BigEndianUnicode.GetString(jolietvd.publisher_id).Replace('\u0000', ' '). + PublisherIdentifier = Encoding.BigEndianUnicode.GetString(jolietvd.publisher_id). + Replace('\u0000', ' '). TrimEnd(), - DataPreparerIdentifier = Encoding.BigEndianUnicode.GetString(jolietvd.preparer_id).Replace('\u0000', ' '). + DataPreparerIdentifier = Encoding.BigEndianUnicode.GetString(jolietvd.preparer_id). + Replace('\u0000', ' '). TrimEnd(), - ApplicationIdentifier = Encoding.BigEndianUnicode.GetString(jolietvd.application_id).Replace('\u0000', ' '). + ApplicationIdentifier = Encoding.BigEndianUnicode.GetString(jolietvd.application_id). + Replace('\u0000', ' '). TrimEnd() }; - if(jolietvd.creation_date[0] < 0x31 || - jolietvd.creation_date[0] > 0x39) + if(jolietvd.creation_date[0] < 0x31 || jolietvd.creation_date[0] > 0x39) decodedVd.CreationTime = DateTime.MinValue; else decodedVd.CreationTime = DateHandlers.Iso9660ToDateTime(jolietvd.creation_date); - if(jolietvd.modification_date[0] < 0x31 || - jolietvd.modification_date[0] > 0x39) + if(jolietvd.modification_date[0] < 0x31 || jolietvd.modification_date[0] > 0x39) decodedVd.HasModificationTime = false; else { @@ -66,8 +68,7 @@ public sealed partial class ISO9660 decodedVd.ModificationTime = DateHandlers.Iso9660ToDateTime(jolietvd.modification_date); } - if(jolietvd.expiration_date[0] < 0x31 || - jolietvd.expiration_date[0] > 0x39) + if(jolietvd.expiration_date[0] < 0x31 || jolietvd.expiration_date[0] > 0x39) decodedVd.HasExpirationTime = false; else { @@ -75,8 +76,7 @@ public sealed partial class ISO9660 decodedVd.ExpirationTime = DateHandlers.Iso9660ToDateTime(jolietvd.expiration_date); } - if(jolietvd.effective_date[0] < 0x31 || - jolietvd.effective_date[0] > 0x39) + if(jolietvd.effective_date[0] < 0x31 || jolietvd.effective_date[0] > 0x39) decodedVd.HasEffectiveTime = false; else { diff --git a/Aaru.Filesystems/ISO9660/Super.cs b/Aaru.Filesystems/ISO9660/Super.cs index 5dc226b3f..5735a6ac5 100644 --- a/Aaru.Filesystems/ISO9660/Super.cs +++ b/Aaru.Filesystems/ISO9660/Super.cs @@ -210,8 +210,7 @@ public sealed partial class ISO9660 // Check if this is Joliet if(svd.version == 1) { - 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' || @@ -261,9 +260,7 @@ public sealed partial class ISO9660 Metadata = new FileSystem(); - if(pvd == null && - hsvd == null && - fsvd == null) + if(pvd == null && hsvd == null && fsvd == null) { AaruConsole.ErrorWriteLine(Localization.ERROR_Could_not_find_primary_volume_descriptor); @@ -348,13 +345,10 @@ public sealed partial class ISO9660 } // High Sierra and CD-i do not support Joliet or RRIP - if((_highSierra || _cdi) && - _namespace != Namespace.Normal && - _namespace != Namespace.Vms) + if((_highSierra || _cdi) && _namespace != Namespace.Normal && _namespace != Namespace.Vms) _namespace = Namespace.Normal; - if(jolietvd is null && - _namespace == Namespace.Joliet) + if(jolietvd is null && _namespace == Namespace.Joliet) _namespace = Namespace.Normal; uint rootLocation; @@ -373,8 +367,7 @@ public sealed partial class ISO9660 rootSize = _highSierra ? hsvd.Value.root_directory_record.size : pvd.Value.root_directory_record.size; - if(_pathTable?.Length > 1 && - rootLocation != _pathTable[0].Extent) + if(_pathTable?.Length > 1 && rootLocation != _pathTable[0].Extent) { AaruConsole.DebugWriteLine(MODULE_NAME, Localization. @@ -521,17 +514,14 @@ public sealed partial class ISO9660 if(_namespace != Namespace.Joliet) { - _rootDirectoryCache = _cdi - ? DecodeCdiDirectory(rootLocation + rootXattrLength, rootSize) - : _highSierra - ? DecodeHighSierraDirectory(rootLocation + rootXattrLength, rootSize) - : DecodeIsoDirectory(rootLocation + rootXattrLength, rootSize); + _rootDirectoryCache = _cdi ? DecodeCdiDirectory(rootLocation + rootXattrLength, rootSize) : + _highSierra ? DecodeHighSierraDirectory(rootLocation + rootXattrLength, rootSize) : + DecodeIsoDirectory(rootLocation + rootXattrLength, rootSize); } Metadata.Type = fsFormat; - if(jolietvd != null && - _namespace is Namespace.Joliet or Namespace.Rrip) + if(jolietvd != null && _namespace is Namespace.Joliet or Namespace.Rrip) { rootLocation = jolietvd.Value.root_directory_record.extent; rootXattrLength = jolietvd.Value.root_directory_record.xattr_len; @@ -794,11 +784,9 @@ public sealed partial class ISO9660 if(_usePathTable) { - foreach(DecodedDirectoryEntry subDirectory in _cdi - ? GetSubdirsFromCdiPathTable("") - : _highSierra - ? GetSubdirsFromHighSierraPathTable("") - : GetSubdirsFromIsoPathTable("")) + foreach(DecodedDirectoryEntry subDirectory in _cdi ? GetSubdirsFromCdiPathTable("") : + _highSierra ? GetSubdirsFromHighSierraPathTable("") : + GetSubdirsFromIsoPathTable("")) _rootDirectoryCache[subDirectory.Filename] = subDirectory; } diff --git a/Aaru.Filesystems/ISO9660/Xattr.cs b/Aaru.Filesystems/ISO9660/Xattr.cs index 1b8a5b690..35c34e676 100644 --- a/Aaru.Filesystems/ISO9660/Xattr.cs +++ b/Aaru.Filesystems/ISO9660/Xattr.cs @@ -81,9 +81,7 @@ public sealed partial class ISO9660 if(entry.AmigaComment != null) xattrs.Add("com.amiga.comments"); - if(entry.Flags.HasFlag(FileFlags.Directory) || - entry.Extents == null || - entry.Extents.Count == 0) + if(entry.Flags.HasFlag(FileFlags.Directory) || entry.Extents == null || entry.Extents.Count == 0) return ErrorNumber.NoError; ErrorNumber errno = _image.ReadSectorLong(entry.Extents[0].extent * _blockSize / 2048, out byte[] sector); @@ -116,11 +114,11 @@ public sealed partial class ISO9660 switch(xattr) { case "org.iso.9660.ea": - return entry.XattrLength == 0 - ? ErrorNumber.NoSuchExtendedAttribute - : entry.Extents is null - ? ErrorNumber.InvalidArgument - : ReadSingleExtent(entry.XattrLength * _blockSize, entry.Extents[0].extent, out buf); + return entry.XattrLength == 0 ? ErrorNumber.NoSuchExtendedAttribute : + entry.Extents is null ? ErrorNumber.InvalidArgument : + ReadSingleExtent(entry.XattrLength * _blockSize, + entry.Extents[0].extent, + out buf); case "org.iso.9660.AssociatedFile": if(entry.AssociatedFile is null) diff --git a/Aaru.Filesystems/JFS/Info.cs b/Aaru.Filesystems/JFS/Info.cs index cf3bd97e1..26a67f0e6 100644 --- a/Aaru.Filesystems/JFS/Info.cs +++ b/Aaru.Filesystems/JFS/Info.cs @@ -161,7 +161,8 @@ public sealed partial class JFS sb.AppendLine(Localization.Volume_is_dirty); sb.AppendFormat(Localization.Volume_was_last_updated_on_0_, - DateHandlers.UnixUnsignedToDateTime(jfsSb.s_time.tv_sec, jfsSb.s_time.tv_nsec)).AppendLine(); + DateHandlers.UnixUnsignedToDateTime(jfsSb.s_time.tv_sec, jfsSb.s_time.tv_nsec)). + AppendLine(); if(jfsSb.s_version == 1) sb.AppendFormat(Localization.Volume_name_0, StringHandlers.CToString(jfsSb.s_fpack, encoding)).AppendLine(); diff --git a/Aaru.Filesystems/LisaFS/Dir.cs b/Aaru.Filesystems/LisaFS/Dir.cs index 8eb468acd..49f687dd6 100644 --- a/Aaru.Filesystems/LisaFS/Dir.cs +++ b/Aaru.Filesystems/LisaFS/Dir.cs @@ -182,10 +182,7 @@ public sealed partial class LisaFS offset += 54; // Check that the entry is correct, not empty or garbage - if(entV2.filenameLen != 0 && - entV2.filenameLen <= E_NAME && - entV2.fileType != 0 && - entV2.fileID > 0) + if(entV2.filenameLen != 0 && entV2.filenameLen <= E_NAME && entV2.fileType != 0 && entV2.fileID > 0) catalogV2.Add(entV2); } @@ -229,8 +226,7 @@ public sealed partial class LisaFS DecodeTag(tag, out LisaTag.PriamTag catTag); - if(catTag.FileId != FILEID_CATALOG || - catTag.RelPage != 0) + if(catTag.FileId != FILEID_CATALOG || catTag.RelPage != 0) continue; errno = _device.ReadSectors(i, 4, out firstCatalogBlock); @@ -323,8 +319,7 @@ public sealed partial class LisaFS break; // Normal entry - else if(buf[offset + 0x24] == 0x03 && - buf[offset] == 0x24) + else if(buf[offset + 0x24] == 0x03 && buf[offset] == 0x24) { var entry = new CatalogEntry { @@ -358,8 +353,7 @@ public sealed partial class LisaFS } // Subdirectory entry - else if(buf[offset + 0x24] == 0x01 && - buf[offset] == 0x24) + else if(buf[offset + 0x24] == 0x01 && buf[offset] == 0x24) { var entry = new CatalogEntry { diff --git a/Aaru.Filesystems/LisaFS/Extent.cs b/Aaru.Filesystems/LisaFS/Extent.cs index 0d08facc7..7f7757057 100644 --- a/Aaru.Filesystems/LisaFS/Extent.cs +++ b/Aaru.Filesystems/LisaFS/Extent.cs @@ -48,8 +48,7 @@ public sealed partial class LisaFS if(!_mounted) return ErrorNumber.AccessDenied; - if(fileId < 4 || - fileId == 4 && _mddf.fsversion != LISA_V2 && _mddf.fsversion != LISA_V1) + if(fileId < 4 || fileId == 4 && _mddf.fsversion != LISA_V2 && _mddf.fsversion != LISA_V1) return ErrorNumber.InvalidArgument; if(_extentCache.TryGetValue(fileId, out file)) @@ -120,8 +119,7 @@ public sealed partial class LisaFS if(errno != ErrorNumber.NoError) return errno; - if(sector[0] >= 32 || - sector[0] == 0) + if(sector[0] >= 32 || sector[0] == 0) return ErrorNumber.InvalidArgument; file.filenameLen = sector[0]; diff --git a/Aaru.Filesystems/LisaFS/File.cs b/Aaru.Filesystems/LisaFS/File.cs index 489e4e5ce..3b9dd0995 100644 --- a/Aaru.Filesystems/LisaFS/File.cs +++ b/Aaru.Filesystems/LisaFS/File.cs @@ -110,8 +110,7 @@ public sealed partial class LisaFS if(!_mounted) return ErrorNumber.AccessDenied; - if(buffer is null || - buffer.Length < length) + if(buffer is null || buffer.Length < length) return ErrorNumber.InvalidArgument; if(node is not LisaFileNode mynode) @@ -244,19 +243,16 @@ public sealed partial class LisaFS buf = null; ErrorNumber errno; - if(!_mounted || - !_debug) + if(!_mounted || !_debug) return ErrorNumber.AccessDenied; if(fileId is > 4 or <= 0) { - if(fileId != FILEID_BOOT_SIGNED && - fileId != FILEID_LOADER_SIGNED) + if(fileId != FILEID_BOOT_SIGNED && fileId != FILEID_LOADER_SIGNED) return ErrorNumber.InvalidArgument; } - if(_systemFileCache.TryGetValue(fileId, out buf) && - !tags) + if(_systemFileCache.TryGetValue(fileId, out buf) && !tags) return ErrorNumber.NoError; var count = 0; @@ -349,8 +345,7 @@ public sealed partial class LisaFS if(fileId <= 4) { - if(!_debug || - fileId == 0) + if(!_debug || fileId == 0) return ErrorNumber.NoSuchFile; stat = new FileEntryInfo(); @@ -361,9 +356,7 @@ public sealed partial class LisaFS if(error != ErrorNumber.NoError) return error; - if(fileId < 0 && - fileId != FILEID_BOOT_SIGNED && - fileId != FILEID_LOADER_SIGNED) + if(fileId < 0 && fileId != FILEID_BOOT_SIGNED && fileId != FILEID_LOADER_SIGNED) { error = ReadExtentsFile((short)(fileId * -1), out file); @@ -445,12 +438,10 @@ public sealed partial class LisaFS tags &= _debug; - if(fileId < 4 || - fileId == 4 && _mddf.fsversion != LISA_V2 && _mddf.fsversion != LISA_V1) + if(fileId < 4 || fileId == 4 && _mddf.fsversion != LISA_V2 && _mddf.fsversion != LISA_V1) return ErrorNumber.InvalidArgument; - if(!tags && - _fileCache.TryGetValue(fileId, out buf)) + if(!tags && _fileCache.TryGetValue(fileId, out buf)) return ErrorNumber.NoError; ErrorNumber error = ReadExtentsFile(fileId, out ExtentFile file); @@ -473,12 +464,14 @@ public sealed partial class LisaFS { byte[] sector; - ErrorNumber errno = - !tags - ? _device.ReadSectors((ulong)file.extents[i].start + _mddf.mddf_block + _volumePrefix, - (uint)file.extents[i].length, out sector) - : _device.ReadSectorsTag((ulong)file.extents[i].start + _mddf.mddf_block + _volumePrefix, - (uint)file.extents[i].length, SectorTagType.AppleSectorTag, out sector); + ErrorNumber errno = !tags + ? _device. + ReadSectors((ulong)file.extents[i].start + _mddf.mddf_block + _volumePrefix, + (uint)file.extents[i].length, out sector) + : _device. + ReadSectorsTag((ulong)file.extents[i].start + _mddf.mddf_block + _volumePrefix, + (uint)file.extents[i].length, SectorTagType.AppleSectorTag, + out sector); if(errno != ErrorNumber.NoError) return errno; @@ -513,7 +506,10 @@ public sealed partial class LisaFS if(!_mounted) return ErrorNumber.AccessDenied; - string[] pathElements = path.Split(new[] { '/' }, StringSplitOptions.RemoveEmptyEntries); + string[] pathElements = path.Split(new[] + { + '/' + }, StringSplitOptions.RemoveEmptyEntries); switch(pathElements.Length) { @@ -591,8 +587,7 @@ public sealed partial class LisaFS isDir = entry.fileType == 0x01; // Not last path element, and it's not a directory - if(lvl != pathElements.Length - 1 && - !isDir) + if(lvl != pathElements.Length - 1 && !isDir) return ErrorNumber.NotDirectory; // Arrived last path element diff --git a/Aaru.Filesystems/LisaFS/Info.cs b/Aaru.Filesystems/LisaFS/Info.cs index 1b00a3e3c..2860bc9f2 100644 --- a/Aaru.Filesystems/LisaFS/Info.cs +++ b/Aaru.Filesystems/LisaFS/Info.cs @@ -68,8 +68,7 @@ public sealed partial class LisaFS AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Sector_0_file_ID_1, i, searchTag.FileId); - if(beforeMddf == -1 && - searchTag.FileId == FILEID_LOADER_SIGNED) + if(beforeMddf == -1 && searchTag.FileId == FILEID_LOADER_SIGNED) beforeMddf = i - 1; if(searchTag.FileId != FILEID_MDDF) @@ -157,8 +156,7 @@ public sealed partial class LisaFS AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Sector_0_file_ID_1, i, searchTag.FileId); - if(beforeMddf == -1 && - searchTag.FileId == FILEID_LOADER_SIGNED) + if(beforeMddf == -1 && searchTag.FileId == FILEID_LOADER_SIGNED) beforeMddf = i - 1; if(searchTag.FileId != FILEID_MDDF) @@ -345,10 +343,12 @@ public sealed partial class LisaFS sb.AppendFormat(Localization.Volume_is_number_0_of_1, infoMddf.volnum, infoMddf.vol_sequence).AppendLine(); sb.AppendFormat(Localization.Serial_number_of_Lisa_computer_that_created_this_volume_0, - infoMddf.machine_id).AppendLine(); + infoMddf.machine_id). + AppendLine(); sb.AppendFormat(Localization.Serial_number_of_Lisa_computer_that_can_use_this_volume_software_0, - infoMddf.serialization).AppendLine(); + infoMddf.serialization). + AppendLine(); sb.AppendFormat(Localization.Volume_created_on_0, infoMddf.dtvc).AppendLine(); sb.AppendFormat(Localization.Volume_catalog_created_on_0, infoMddf.dtcc).AppendLine(); @@ -376,7 +376,8 @@ public sealed partial class LisaFS sb.AppendFormat(Localization.Overmount_stamp_0, infoMddf.overmount_stamp).AppendLine(); sb.AppendFormat(Localization.S_Records_start_at_0_and_spans_for_1_blocks, - infoMddf.srec_ptr + infoMddf.mddf_block + beforeMddf, infoMddf.srec_len).AppendLine(); + infoMddf.srec_ptr + infoMddf.mddf_block + beforeMddf, infoMddf.srec_len). + AppendLine(); sb.AppendLine(infoMddf.vol_left_mounted == 0 ? Localization.Volume_is_clean : Localization.Volume_is_dirty); diff --git a/Aaru.Filesystems/LisaFS/LisaFS.cs b/Aaru.Filesystems/LisaFS/LisaFS.cs index 11096cdc2..8b03a9a80 100644 --- a/Aaru.Filesystems/LisaFS/LisaFS.cs +++ b/Aaru.Filesystems/LisaFS/LisaFS.cs @@ -72,15 +72,21 @@ public sealed partial class LisaFS : IReadOnlyFilesystem /// public Dictionary Namespaces => new() { - { "workshop", "Filenames as shown by the Lisa Pascal Workshop (default)" }, - { "office", "Filenames as shown by the Lisa Office System (not yet implemented)" } + { + "workshop", "Filenames as shown by the Lisa Pascal Workshop (default)" + }, + { + "office", "Filenames as shown by the Lisa Office System (not yet implemented)" + } }; #endregion static Dictionary GetDefaultOptions() => new() { - { "debug", false.ToString() } + { + "debug", false.ToString() + } }; #region Caches diff --git a/Aaru.Filesystems/LisaFS/Structs.cs b/Aaru.Filesystems/LisaFS/Structs.cs index 6c131f4f3..f0946d1ea 100644 --- a/Aaru.Filesystems/LisaFS/Structs.cs +++ b/Aaru.Filesystems/LisaFS/Structs.cs @@ -435,6 +435,8 @@ public sealed partial class LisaFS public byte scavenge_flag; } +#region Nested type: MDDF + #endregion #region Nested type: SRecord diff --git a/Aaru.Filesystems/LisaFS/Super.cs b/Aaru.Filesystems/LisaFS/Super.cs index 402c1381c..34c3d5d8b 100644 --- a/Aaru.Filesystems/LisaFS/Super.cs +++ b/Aaru.Filesystems/LisaFS/Super.cs @@ -87,8 +87,7 @@ public sealed partial class LisaFS AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Sector_0_file_ID_1, i, searchTag.FileId); - if(_volumePrefix == _device.Info.Sectors && - searchTag.FileId == FILEID_LOADER_SIGNED) + if(_volumePrefix == _device.Info.Sectors && searchTag.FileId == FILEID_LOADER_SIGNED) _volumePrefix = i - 1; if(searchTag.FileId != FILEID_MDDF) @@ -249,7 +248,9 @@ public sealed partial class LisaFS _directoryDtcCache = new Dictionary { - { DIRID_ROOT, _mddf.dtcc } + { + DIRID_ROOT, _mddf.dtcc + } }; // Read the Catalog File diff --git a/Aaru.Filesystems/LisaFS/Xattr.cs b/Aaru.Filesystems/LisaFS/Xattr.cs index 827ffc26f..4a7f899e5 100644 --- a/Aaru.Filesystems/LisaFS/Xattr.cs +++ b/Aaru.Filesystems/LisaFS/Xattr.cs @@ -83,8 +83,7 @@ public sealed partial class LisaFS // System files if(fileId < 4) { - if(!_debug || - fileId == 0) + if(!_debug || fileId == 0) return ErrorNumber.InvalidArgument; xattrs = new List(); @@ -146,8 +145,7 @@ public sealed partial class LisaFS // System files if(fileId < 4) { - if(!_debug || - fileId == 0) + if(!_debug || fileId == 0) return ErrorNumber.InvalidArgument; // Only MDDF contains an extended attributes @@ -187,8 +185,7 @@ public sealed partial class LisaFS return ErrorNumber.NoError; } - if(!ArrayHelpers.ArrayIsNullOrEmpty(file.LisaInfo) && - xattr == "com.apple.lisa.label") + if(!ArrayHelpers.ArrayIsNullOrEmpty(file.LisaInfo) && xattr == "com.apple.lisa.label") { buf = new byte[128]; Array.Copy(file.LisaInfo, 0, buf, 0, 128); diff --git a/Aaru.Filesystems/Locus/Info.cs b/Aaru.Filesystems/Locus/Info.cs index 439e2a3fe..7b19b73e4 100644 --- a/Aaru.Filesystems/Locus/Info.cs +++ b/Aaru.Filesystems/Locus/Info.cs @@ -190,7 +190,8 @@ public sealed partial class Locus AppendLine(); sb.AppendFormat(Localization.Volume_has_0_blocks_of_1_bytes_each_total_2_bytes, locusSb.s_fsize, blockSize, - locusSb.s_fsize * blockSize).AppendLine(); + locusSb.s_fsize * blockSize). + AppendLine(); sb.AppendFormat(Localization._0_blocks_free_1_bytes, locusSb.s_tfree, locusSb.s_tfree * blockSize).AppendLine(); sb.AppendFormat(Localization.Inode_list_uses_0_blocks, locusSb.s_isize).AppendLine(); @@ -198,7 +199,8 @@ public sealed partial class Locus sb.AppendFormat(Localization.Next_free_inode_search_will_start_at_inode_0, locusSb.s_lasti).AppendLine(); sb.AppendFormat(Localization.There_are_an_estimate_of_0_free_inodes_before_next_search_start, - locusSb.s_nbehind).AppendLine(); + locusSb.s_nbehind). + AppendLine(); if(locusSb.s_flags.HasFlag(Flags.SB_RDONLY)) sb.AppendLine(Localization.Read_only_volume); diff --git a/Aaru.Filesystems/MinixFS/Info.cs b/Aaru.Filesystems/MinixFS/Info.cs index 225b88c88..b2c07c85c 100644 --- a/Aaru.Filesystems/MinixFS/Info.cs +++ b/Aaru.Filesystems/MinixFS/Info.cs @@ -223,8 +223,7 @@ public sealed partial class MinixFS ? Marshal.ByteArrayToStructureLittleEndian(minixSbSector) : Marshal.ByteArrayToStructureBigEndian(minixSbSector); - if(magic != MINIX3_MAGIC && - magic != MINIX3_CIGAM) + if(magic != MINIX3_MAGIC && magic != MINIX3_CIGAM) mnxSb.s_blocksize = 1024; sb.AppendLine(minixVersion); @@ -245,10 +244,12 @@ public sealed partial class MinixFS sb.AppendFormat(Localization._0_inodes_in_volume, mnxSb.s_ninodes).AppendLine(); sb.AppendFormat(Localization._0_blocks_on_inode_map_1_bytes, mnxSb.s_imap_blocks, - mnxSb.s_imap_blocks * mnxSb.s_blocksize).AppendLine(); + mnxSb.s_imap_blocks * mnxSb.s_blocksize). + AppendLine(); sb.AppendFormat(Localization._0_blocks_on_zone_map_1_bytes, mnxSb.s_zmap_blocks, - mnxSb.s_zmap_blocks * mnxSb.s_blocksize).AppendLine(); + mnxSb.s_zmap_blocks * mnxSb.s_blocksize). + AppendLine(); sb.AppendFormat(Localization.First_data_zone_0, mnxSb.s_firstdatazone).AppendLine(); @@ -282,10 +283,12 @@ public sealed partial class MinixFS sb.AppendFormat(Localization._0_inodes_in_volume, mnxSb.s_ninodes).AppendLine(); sb.AppendFormat(Localization._0_blocks_on_inode_map_1_bytes, mnxSb.s_imap_blocks, - mnxSb.s_imap_blocks * 1024).AppendLine(); + mnxSb.s_imap_blocks * 1024). + AppendLine(); sb.AppendFormat(Localization._0_blocks_on_zone_map_1_bytes, mnxSb.s_zmap_blocks, - mnxSb.s_zmap_blocks * 1024).AppendLine(); + mnxSb.s_zmap_blocks * 1024). + AppendLine(); sb.AppendFormat(Localization.First_data_zone_0, mnxSb.s_firstdatazone).AppendLine(); diff --git a/Aaru.Filesystems/NTFS/Info.cs b/Aaru.Filesystems/NTFS/Info.cs index 9ef2cbca6..5305b4146 100644 --- a/Aaru.Filesystems/NTFS/Info.cs +++ b/Aaru.Filesystems/NTFS/Info.cs @@ -120,7 +120,8 @@ public sealed partial class NTFS if(ntfsBb.mft_rc_clusters > 0) { sb.AppendFormat(Localization._0_clusters_per_MFT_record_1_bytes, ntfsBb.mft_rc_clusters, - ntfsBb.mft_rc_clusters * ntfsBb.bps * ntfsBb.spc).AppendLine(); + ntfsBb.mft_rc_clusters * ntfsBb.bps * ntfsBb.spc). + AppendLine(); } else sb.AppendFormat(Localization._0_bytes_per_MFT_record, 1 << -ntfsBb.mft_rc_clusters).AppendLine(); @@ -128,7 +129,8 @@ public sealed partial class NTFS if(ntfsBb.index_blk_cts > 0) { sb.AppendFormat(Localization._0_clusters_per_Index_block_1_bytes, ntfsBb.index_blk_cts, - ntfsBb.index_blk_cts * ntfsBb.bps * ntfsBb.spc).AppendLine(); + ntfsBb.index_blk_cts * ntfsBb.bps * ntfsBb.spc). + AppendLine(); } else sb.AppendFormat(Localization._0_bytes_per_Index_block, 1 << -ntfsBb.index_blk_cts).AppendLine(); @@ -139,10 +141,7 @@ public sealed partial class NTFS metadata = new FileSystem(); - if(ntfsBb.jump[0] == 0xEB && - ntfsBb.jump[1] > 0x4E && - ntfsBb.jump[1] < 0x80 && - ntfsBb.signature2 == 0xAA55) + if(ntfsBb.jump[0] == 0xEB && ntfsBb.jump[1] > 0x4E && ntfsBb.jump[1] < 0x80 && ntfsBb.signature2 == 0xAA55) { metadata.Bootable = true; string bootChk = Sha1Context.Data(ntfsBb.boot_code, out _); diff --git a/Aaru.Filesystems/Nintendo/Helpers.cs b/Aaru.Filesystems/Nintendo/Helpers.cs index e5ff1fae4..883ba2ca8 100644 --- a/Aaru.Filesystems/Nintendo/Helpers.cs +++ b/Aaru.Filesystems/Nintendo/Helpers.cs @@ -95,10 +95,9 @@ public sealed partial class NintendoPlugin NintendoPlugin_RegionCodeToString_Taiwan, "U" => Localization. NintendoPlugin_RegionCodeToString_Australia, - _ => string.Format( - Localization. - NintendoPlugin_RegionCodeToString_unknown_region_code_0, - regionCode) + _ => string. + Format(Localization.NintendoPlugin_RegionCodeToString_unknown_region_code_0, + regionCode) }; [SuppressMessage("ReSharper", "StringLiteralTypo")] @@ -125,9 +124,9 @@ public sealed partial class NintendoPlugin "4Q" => "Disney Interactive", "GD" => "Square Enix", "7D" => "Sierra", - _ => string.Format( - Localization.Unknown_publisher_0, - publisherCode) + _ => string. + Format(Localization.Unknown_publisher_0, + publisherCode) }; static string PartitionTypeToString(uint type) => type switch @@ -135,7 +134,7 @@ public sealed partial class NintendoPlugin 0 => Localization.data, 1 => Localization.update, 2 => Localization.channel, - _ => string.Format( - Localization.unknown_partition_type_0, type) + _ => string.Format(Localization.unknown_partition_type_0, + type) }; } \ No newline at end of file diff --git a/Aaru.Filesystems/Nintendo/Info.cs b/Aaru.Filesystems/Nintendo/Info.cs index dfb49da0f..c6a3daf91 100644 --- a/Aaru.Filesystems/Nintendo/Info.cs +++ b/Aaru.Filesystems/Nintendo/Info.cs @@ -132,8 +132,7 @@ public sealed partial class NintendoPlugin fields.FirstPartitions[i].Offset = BigEndianBitConverter.ToUInt32(header, (int)(offset1 + i * 8 + 0)) << 2; - fields.FirstPartitions[i].Type = - BigEndianBitConverter.ToUInt32(header, (int)(offset1 + i * 8 + 4)); + fields.FirstPartitions[i].Type = BigEndianBitConverter.ToUInt32(header, (int)(offset1 + i * 8 + 4)); } for(var i = 0; i < fields.SecondPartitions.Length; i++) @@ -144,8 +143,7 @@ public sealed partial class NintendoPlugin fields.FirstPartitions[i].Offset = BigEndianBitConverter.ToUInt32(header, (int)(offset2 + i * 8 + 0)) << 2; - fields.FirstPartitions[i].Type = - BigEndianBitConverter.ToUInt32(header, (int)(offset2 + i * 8 + 4)); + fields.FirstPartitions[i].Type = BigEndianBitConverter.ToUInt32(header, (int)(offset2 + i * 8 + 4)); } for(var i = 0; i < fields.ThirdPartitions.Length; i++) @@ -156,8 +154,7 @@ public sealed partial class NintendoPlugin fields.FirstPartitions[i].Offset = BigEndianBitConverter.ToUInt32(header, (int)(offset3 + i * 8 + 0)) << 2; - fields.FirstPartitions[i].Type = - BigEndianBitConverter.ToUInt32(header, (int)(offset3 + i * 8 + 4)); + fields.FirstPartitions[i].Type = BigEndianBitConverter.ToUInt32(header, (int)(offset3 + i * 8 + 4)); } for(var i = 0; i < fields.FourthPartitions.Length; i++) @@ -168,8 +165,7 @@ public sealed partial class NintendoPlugin fields.FirstPartitions[i].Offset = BigEndianBitConverter.ToUInt32(header, (int)(offset4 + i * 8 + 0)) << 2; - fields.FirstPartitions[i].Type = - BigEndianBitConverter.ToUInt32(header, (int)(offset4 + i * 8 + 4)); + fields.FirstPartitions[i].Type = BigEndianBitConverter.ToUInt32(header, (int)(offset4 + i * 8 + 4)); } fields.Region = header[0x4E000]; @@ -213,8 +209,8 @@ public sealed partial class NintendoPlugin AaruConsole.DebugWriteLine(MODULE_NAME, "firstPartitions[{1}].offset = {0}", fields.FirstPartitions[i].Offset, i); - AaruConsole.DebugWriteLine(MODULE_NAME, "firstPartitions[{1}].type = {0}", - fields.FirstPartitions[i].Type, i); + AaruConsole.DebugWriteLine(MODULE_NAME, "firstPartitions[{1}].type = {0}", fields.FirstPartitions[i].Type, + i); } for(var i = 0; i < fields.SecondPartitions.Length; i++) @@ -222,8 +218,8 @@ public sealed partial class NintendoPlugin AaruConsole.DebugWriteLine(MODULE_NAME, "secondPartitions[{1}].offset = {0}", fields.SecondPartitions[i].Offset, i); - AaruConsole.DebugWriteLine(MODULE_NAME, "secondPartitions[{1}].type = {0}", - fields.SecondPartitions[i].Type, i); + AaruConsole.DebugWriteLine(MODULE_NAME, "secondPartitions[{1}].type = {0}", fields.SecondPartitions[i].Type, + i); } for(var i = 0; i < fields.ThirdPartitions.Length; i++) @@ -231,8 +227,8 @@ public sealed partial class NintendoPlugin AaruConsole.DebugWriteLine(MODULE_NAME, "thirdPartitions[{1}].offset = {0}", fields.ThirdPartitions[i].Offset, i); - AaruConsole.DebugWriteLine(MODULE_NAME, "thirdPartitions[{1}].type = {0}", - fields.ThirdPartitions[i].Type, i); + AaruConsole.DebugWriteLine(MODULE_NAME, "thirdPartitions[{1}].type = {0}", fields.ThirdPartitions[i].Type, + i); } for(var i = 0; i < fields.FourthPartitions.Length; i++) @@ -240,8 +236,8 @@ public sealed partial class NintendoPlugin AaruConsole.DebugWriteLine(MODULE_NAME, "fourthPartitions[{1}].offset = {0}", fields.FourthPartitions[i].Offset, i); - AaruConsole.DebugWriteLine(MODULE_NAME, "fourthPartitions[{1}].type = {0}", - fields.FourthPartitions[i].Type, i); + AaruConsole.DebugWriteLine(MODULE_NAME, "fourthPartitions[{1}].type = {0}", fields.FourthPartitions[i].Type, + i); } AaruConsole.DebugWriteLine(MODULE_NAME, "region = {0}", fields.Region); @@ -291,28 +287,32 @@ public sealed partial class NintendoPlugin { sbInformation.AppendFormat(Localization.First_0_partition_starts_at_sector_1, PartitionTypeToString(fields.FirstPartitions[i].Type), - fields.FirstPartitions[i].Offset / 2048).AppendLine(); + fields.FirstPartitions[i].Offset / 2048). + AppendLine(); } for(var i = 0; i < fields.SecondPartitions.Length; i++) { sbInformation.AppendFormat(Localization.Second_0_partition_starts_at_sector_1, PartitionTypeToString(fields.SecondPartitions[i].Type), - fields.SecondPartitions[i].Offset / 2048).AppendLine(); + fields.SecondPartitions[i].Offset / 2048). + AppendLine(); } for(var i = 0; i < fields.ThirdPartitions.Length; i++) { sbInformation.AppendFormat(Localization.Third_0_partition_starts_at_sector_1, PartitionTypeToString(fields.ThirdPartitions[i].Type), - fields.ThirdPartitions[i].Offset / 2048).AppendLine(); + fields.ThirdPartitions[i].Offset / 2048). + AppendLine(); } for(var i = 0; i < fields.FourthPartitions.Length; i++) { sbInformation.AppendFormat(Localization.Fourth_0_partition_starts_at_sector_1, PartitionTypeToString(fields.FourthPartitions[i].Type), - fields.FourthPartitions[i].Offset / 2048).AppendLine(); + fields.FourthPartitions[i].Offset / 2048). + AppendLine(); } // sbInformation.AppendFormat("Region byte is {0}", fields.region).AppendLine(); diff --git a/Aaru.Filesystems/ODS/Info.cs b/Aaru.Filesystems/ODS/Info.cs index e757fb1e2..9b8bc0284 100644 --- a/Aaru.Filesystems/ODS/Info.cs +++ b/Aaru.Filesystems/ODS/Info.cs @@ -144,21 +144,24 @@ public sealed partial class ODS StringHandlers.CToString(homeblock.format) != "DECFILE11B ") sb.AppendLine(Localization.The_following_information_may_be_incorrect_for_this_volume); - if(homeblock.resfiles < 5 || - homeblock.devtype != 0) + if(homeblock.resfiles < 5 || homeblock.devtype != 0) sb.AppendLine(Localization.This_volume_may_be_corrupted); sb.AppendFormat(Localization.Volume_format_is_0, - StringHandlers.SpacePaddedToString(homeblock.format, encoding)).AppendLine(); + StringHandlers.SpacePaddedToString(homeblock.format, encoding)). + AppendLine(); sb.AppendFormat(Localization.Volume_is_Level_0_revision_1, (homeblock.struclev & 0xFF00) >> 8, - homeblock.struclev & 0xFF).AppendLine(); + homeblock.struclev & 0xFF). + AppendLine(); sb.AppendFormat(Localization.Lowest_structure_in_the_volume_is_Level_0_revision_1, - (homeblock.lowstruclev & 0xFF00) >> 8, homeblock.lowstruclev & 0xFF).AppendLine(); + (homeblock.lowstruclev & 0xFF00) >> 8, homeblock.lowstruclev & 0xFF). + AppendLine(); sb.AppendFormat(Localization.Highest_structure_in_the_volume_is_Level_0_revision_1, - (homeblock.highstruclev & 0xFF00) >> 8, homeblock.highstruclev & 0xFF).AppendLine(); + (homeblock.highstruclev & 0xFF00) >> 8, homeblock.highstruclev & 0xFF). + AppendLine(); sb.AppendFormat(Localization._0_sectors_per_cluster_1_bytes, homeblock.cluster, homeblock.cluster * 512). AppendLine(); @@ -167,13 +170,15 @@ public sealed partial class ODS AppendLine(); sb.AppendFormat(Localization.Secondary_home_block_is_on_sector_0_VBN_1, homeblock.alhomelbn, - homeblock.alhomevbn).AppendLine(); + homeblock.alhomevbn). + AppendLine(); sb.AppendFormat(Localization.Volume_bitmap_starts_in_sector_0_VBN_1, homeblock.ibmaplbn, homeblock.ibmapvbn). AppendLine(); sb.AppendFormat(Localization.Volume_bitmap_runs_for_0_sectors_1_bytes, homeblock.ibmapsize, - homeblock.ibmapsize * 512).AppendLine(); + homeblock.ibmapsize * 512). + AppendLine(); sb.AppendFormat(Localization.Backup_INDEXF_SYS_is_in_sector_0_VBN_1, homeblock.altidxlbn, homeblock.altidxvbn). AppendLine(); @@ -181,11 +186,11 @@ public sealed partial class ODS sb.AppendFormat(Localization._0_maximum_files_on_the_volume, homeblock.maxfiles).AppendLine(); sb.AppendFormat(Localization._0_reserved_files, homeblock.resfiles).AppendLine(); - if(homeblock is { rvn: > 0, setcount: > 0 } && - StringHandlers.CToString(homeblock.strucname) != " ") + if(homeblock is { rvn: > 0, setcount: > 0 } && StringHandlers.CToString(homeblock.strucname) != " ") { sb.AppendFormat(Localization.Volume_is_0_of_1_in_set_2, homeblock.rvn, homeblock.setcount, - StringHandlers.SpacePaddedToString(homeblock.strucname, encoding)).AppendLine(); + StringHandlers.SpacePaddedToString(homeblock.strucname, encoding)). + AppendLine(); } sb.AppendFormat(Localization.Volume_owner_is_0_ID_1, diff --git a/Aaru.Filesystems/Opera/Dir.cs b/Aaru.Filesystems/Opera/Dir.cs index bc845fb85..1cc754fe9 100644 --- a/Aaru.Filesystems/Opera/Dir.cs +++ b/Aaru.Filesystems/Opera/Dir.cs @@ -48,8 +48,7 @@ public sealed partial class OperaFS if(!_mounted) return ErrorNumber.AccessDenied; - if(string.IsNullOrWhiteSpace(path) || - path == "/") + if(string.IsNullOrWhiteSpace(path) || path == "/") { node = new OperaDirNode { @@ -77,7 +76,10 @@ public sealed partial class OperaFS return ErrorNumber.NoError; } - string[] pieces = cutPath.Split(new[] { '/' }, StringSplitOptions.RemoveEmptyEntries); + string[] pieces = cutPath.Split(new[] + { + '/' + }, StringSplitOptions.RemoveEmptyEntries); KeyValuePair entry = _rootDirectoryCache.FirstOrDefault(t => t.Key.Equals(pieces[0], StringComparison.CurrentCultureIgnoreCase)); @@ -94,8 +96,9 @@ public sealed partial class OperaFS for(var p = 0; p < pieces.Length; p++) { - entry = currentDirectory.FirstOrDefault( - t => t.Key.Equals(pieces[p], StringComparison.CurrentCultureIgnoreCase)); + entry = + currentDirectory.FirstOrDefault(t => t.Key.Equals(pieces[p], + StringComparison.CurrentCultureIgnoreCase)); if(string.IsNullOrEmpty(entry.Key)) return ErrorNumber.NoSuchFile; diff --git a/Aaru.Filesystems/Opera/File.cs b/Aaru.Filesystems/Opera/File.cs index 7e786b66b..d7e91fcb5 100644 --- a/Aaru.Filesystems/Opera/File.cs +++ b/Aaru.Filesystems/Opera/File.cs @@ -71,8 +71,7 @@ public sealed partial class OperaFS if(err != ErrorNumber.NoError) return err; - if((entry.Entry.flags & FLAGS_MASK) == (uint)FileFlags.Directory && - !_debug) + if((entry.Entry.flags & FLAGS_MASK) == (uint)FileFlags.Directory && !_debug) return ErrorNumber.IsDirectory; if(entry.Pointers.Length < 1) @@ -109,8 +108,7 @@ public sealed partial class OperaFS if(!_mounted) return ErrorNumber.AccessDenied; - if(buffer is null || - buffer.Length < length) + if(buffer is null || buffer.Length < length) return ErrorNumber.InvalidArgument; if(node is not OperaFileNode mynode) @@ -204,7 +202,10 @@ public sealed partial class OperaFS ? path[1..].ToLower(CultureInfo.CurrentUICulture) : path.ToLower(CultureInfo.CurrentUICulture); - string[] pieces = cutPath.Split(new[] { '/' }, StringSplitOptions.RemoveEmptyEntries); + string[] pieces = cutPath.Split(new[] + { + '/' + }, StringSplitOptions.RemoveEmptyEntries); if(pieces.Length == 0) return ErrorNumber.InvalidArgument; diff --git a/Aaru.Filesystems/Opera/Info.cs b/Aaru.Filesystems/Opera/Info.cs index 9fc8d2fb7..d53b034a8 100644 --- a/Aaru.Filesystems/Opera/Info.cs +++ b/Aaru.Filesystems/Opera/Info.cs @@ -57,8 +57,7 @@ public sealed partial class OperaFS Array.Copy(sbSector, 0x001, syncBytes, 0, 5); byte recordVersion = sbSector[0x006]; - if(recordType != 1 || - recordVersion != 1) + if(recordType != 1 || recordVersion != 1) return false; return Encoding.ASCII.GetString(syncBytes) == SYNC; @@ -81,8 +80,7 @@ public sealed partial class OperaFS SuperBlock sb = Marshal.ByteArrayToStructureBigEndian(sbSector); - if(sb.record_type != 1 || - sb.record_version != 1) + if(sb.record_type != 1 || sb.record_version != 1) return; if(Encoding.ASCII.GetString(sb.sync_bytes) != SYNC) @@ -112,17 +110,15 @@ public sealed partial class OperaFS if(sb.block_size != 2048) { superBlockmetadata. - AppendFormat( - Localization.WARNING_Filesystem_indicates_0_bytes_block_while_device_indicates_1_bytes_block, - sb.block_size, 2048); + AppendFormat(Localization.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( - Localization.WARNING_Filesystem_indicates_0_bytes_block_while_device_indicates_1_bytes_block, - sb.block_size, imagePlugin.Info.SectorSize); + AppendFormat(Localization.WARNING_Filesystem_indicates_0_bytes_block_while_device_indicates_1_bytes_block, + sb.block_size, imagePlugin.Info.SectorSize); } superBlockmetadata. @@ -140,7 +136,8 @@ public sealed partial class OperaFS superBlockmetadata.AppendFormat(Localization.Root_directory_block_size_0_bytes, sb.rootdir_bsize).AppendLine(); superBlockmetadata.AppendFormat(Localization.Root_directory_size_0_blocks_1_bytes, sb.rootdir_blocks, - sb.rootdir_bsize * sb.rootdir_blocks).AppendLine(); + sb.rootdir_bsize * sb.rootdir_blocks). + AppendLine(); superBlockmetadata.AppendFormat(Localization.Last_root_directory_copy_0, sb.last_root_copy).AppendLine(); diff --git a/Aaru.Filesystems/Opera/Opera.cs b/Aaru.Filesystems/Opera/Opera.cs index ba2cfd5d1..be66ed0bb 100644 --- a/Aaru.Filesystems/Opera/Opera.cs +++ b/Aaru.Filesystems/Opera/Opera.cs @@ -93,6 +93,8 @@ public sealed partial class OperaFS : IReadOnlyFilesystem static Dictionary GetDefaultOptions() => new() { - { "debug", false.ToString() } + { + "debug", false.ToString() + } }; } \ No newline at end of file diff --git a/Aaru.Filesystems/Opera/Super.cs b/Aaru.Filesystems/Opera/Super.cs index e833d9869..d6ca19cba 100644 --- a/Aaru.Filesystems/Opera/Super.cs +++ b/Aaru.Filesystems/Opera/Super.cs @@ -60,8 +60,7 @@ public sealed partial class OperaFS SuperBlock sb = Marshal.ByteArrayToStructureBigEndian(sbSector); - if(sb.record_type != 1 || - sb.record_version != 1) + if(sb.record_type != 1 || sb.record_version != 1) return ErrorNumber.InvalidArgument; if(Encoding.ASCII.GetString(sb.sync_bytes) != SYNC) diff --git a/Aaru.Filesystems/PCFX/Info.cs b/Aaru.Filesystems/PCFX/Info.cs index 680ffc2b2..3861edbb1 100644 --- a/Aaru.Filesystems/PCFX/Info.cs +++ b/Aaru.Filesystems/PCFX/Info.cs @@ -50,8 +50,7 @@ public sealed partial class PCFX /// public bool Identify(IMediaImage imagePlugin, Partition partition) { - if(2 + partition.Start >= partition.End || - imagePlugin.Info.MetadataMediaType != MetadataMediaType.OpticalDisc) + if(2 + partition.Start >= partition.End || imagePlugin.Info.MetadataMediaType != MetadataMediaType.OpticalDisc) return false; ErrorNumber errno = imagePlugin.ReadSectors(partition.Start, 2, out byte[] sector); diff --git a/Aaru.Filesystems/PFS/Info.cs b/Aaru.Filesystems/PFS/Info.cs index 8f9f39b8d..e9d5186d3 100644 --- a/Aaru.Filesystems/PFS/Info.cs +++ b/Aaru.Filesystems/PFS/Info.cs @@ -112,7 +112,8 @@ public sealed partial class PFS sbInformation.AppendFormat(Localization.Volume_created_on_0, DateHandlers.AmigaToDateTime(rootBlock.creationday, rootBlock.creationminute, - rootBlock.creationtick)).AppendLine(); + rootBlock.creationtick)). + AppendLine(); if(rootBlock.extension > 0) { diff --git a/Aaru.Filesystems/ProDOS/Info.cs b/Aaru.Filesystems/ProDOS/Info.cs index 06fadf034..7795e8594 100644 --- a/Aaru.Filesystems/ProDOS/Info.cs +++ b/Aaru.Filesystems/ProDOS/Info.cs @@ -75,10 +75,14 @@ public sealed partial class ProDOSPlugin if(errno != ErrorNumber.NoError) return false; - foreach(int offset in new[] { 0, 0x200, 0x400, 0x600, 0x800, 0xA00 }.Where( - offset => tmp.Length > offset + 0x200 && BitConverter.ToUInt16(tmp, offset) == 0 && + foreach(int offset in new[] + { + 0, 0x200, 0x400, 0x600, 0x800, 0xA00 + }.Where(offset => tmp.Length > offset + 0x200 && + BitConverter.ToUInt16(tmp, offset) == 0 && (byte)((tmp[offset + 0x04] & STORAGE_TYPE_MASK) >> 4) == ROOT_DIRECTORY_TYPE && - tmp[offset + 0x23] == ENTRY_LENGTH && tmp[offset + 0x24] == ENTRIES_PER_BLOCK)) + tmp[offset + 0x23] == ENTRY_LENGTH && + tmp[offset + 0x24] == ENTRIES_PER_BLOCK)) { Array.Copy(tmp, offset, rootDirectoryKeyBlock, 0, 0x200); apmFromHddOnCd = true; @@ -154,10 +158,13 @@ public sealed partial class ProDOSPlugin if(errno != ErrorNumber.NoError) return; - foreach(int offset in new[] { 0, 0x200, 0x400, 0x600, 0x800, 0xA00 }.Where( - offset => BitConverter.ToUInt16(tmp, offset) == 0 && + foreach(int offset in new[] + { + 0, 0x200, 0x400, 0x600, 0x800, 0xA00 + }.Where(offset => BitConverter.ToUInt16(tmp, offset) == 0 && (byte)((tmp[offset + 0x04] & STORAGE_TYPE_MASK) >> 4) == ROOT_DIRECTORY_TYPE && - tmp[offset + 0x23] == ENTRY_LENGTH && tmp[offset + 0x24] == ENTRIES_PER_BLOCK)) + tmp[offset + 0x23] == ENTRY_LENGTH && + tmp[offset + 0x24] == ENTRIES_PER_BLOCK)) { Array.Copy(tmp, offset, rootDirectoryKeyBlockBytes, 0, 0x200); apmFromHddOnCd = true; @@ -203,9 +210,8 @@ public sealed partial class ProDOSPlugin AaruConsole.DebugWriteLine(MODULE_NAME, "temp_timestamp_right = 0x{0:X4}", tempTimestampRight); AaruConsole.DebugWriteLine(MODULE_NAME, "temp_timestamp = 0x{0:X8}", tempTimestamp); - AaruConsole.DebugWriteLine(MODULE_NAME, - Localization.Datetime_field_year_0_month_1_day_2_hour_3_minute_4, year, month, - day, hour, minute); + AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Datetime_field_year_0_month_1_day_2_hour_3_minute_4, + year, month, day, hour, minute); rootDirectoryKeyBlock.header.creation_time = new DateTime(year, month, day, hour, minute, 0); dateCorrect = true; @@ -231,8 +237,7 @@ public sealed partial class ProDOSPlugin AppendLine(); } - if(rootDirectoryKeyBlock.header.version != VERSION1 || - rootDirectoryKeyBlock.header.min_version != VERSION1) + if(rootDirectoryKeyBlock.header.version != VERSION1 || rootDirectoryKeyBlock.header.min_version != VERSION1) { sbInformation.AppendLine(Localization.Warning_Detected_unknown_ProDOS_version_ProDOS_filesystem); sbInformation.AppendLine(Localization.All_of_the_following_information_may_be_incorrect); @@ -243,7 +248,8 @@ public sealed partial class ProDOSPlugin else { sbInformation.AppendFormat(Localization.Unknown_ProDOS_version_with_field_0_used_to_create_this_volume, - rootDirectoryKeyBlock.header.version).AppendLine(); + rootDirectoryKeyBlock.header.version). + AppendLine(); } if(rootDirectoryKeyBlock.header.min_version == VERSION1) @@ -251,9 +257,9 @@ public sealed partial class ProDOSPlugin else { sbInformation. - AppendFormat( - Localization.Unknown_ProDOS_version_with_field_0_is_at_least_required_for_reading_this_volume, - rootDirectoryKeyBlock.header.min_version).AppendLine(); + AppendFormat(Localization.Unknown_ProDOS_version_with_field_0_is_at_least_required_for_reading_this_volume, + rootDirectoryKeyBlock.header.min_version). + AppendLine(); } sbInformation.AppendFormat(Localization.Volume_name_is_0, rootDirectoryKeyBlock.header.volume_name). @@ -314,8 +320,8 @@ public sealed partial class ProDOSPlugin Type = FS_TYPE }; - metadata.ClusterSize = (uint)((partition.End - partition.Start + 1) * imagePlugin.Info.SectorSize / - metadata.Clusters); + metadata.ClusterSize = + (uint)((partition.End - partition.Start + 1) * imagePlugin.Info.SectorSize / metadata.Clusters); if(!dateCorrect) return; diff --git a/Aaru.Filesystems/QNX4/Info.cs b/Aaru.Filesystems/QNX4/Info.cs index c0da96083..d9e694c56 100644 --- a/Aaru.Filesystems/QNX4/Info.cs +++ b/Aaru.Filesystems/QNX4/Info.cs @@ -79,7 +79,8 @@ public sealed partial class QNX4 return false; // Check inodes are in use - return (qnxSb.rootDir.di_status & 0x01) == 0x01 && (qnxSb.inode.di_status & 0x01) == 0x01 && + return (qnxSb.rootDir.di_status & 0x01) == 0x01 && + (qnxSb.inode.di_status & 0x01) == 0x01 && (qnxSb.boot.di_status & 0x01) == 0x01; // All hail filesystems without identification marks @@ -176,9 +177,11 @@ public sealed partial class QNX4 AaruConsole.DebugWriteLine(MODULE_NAME, "qnxSb.altBoot.di_status = {0}", qnxSb.altBoot.di_status); */ - information = Localization.QNX4_filesystem + "\n" + + information = Localization.QNX4_filesystem + + "\n" + string.Format(Localization.Created_on_0, - DateHandlers.UnixUnsignedToDateTime(qnxSb.rootDir.di_ftime)) + "\n"; + DateHandlers.UnixUnsignedToDateTime(qnxSb.rootDir.di_ftime)) + + "\n"; metadata = new FileSystem { diff --git a/Aaru.Filesystems/QNX6/Info.cs b/Aaru.Filesystems/QNX6/Info.cs index 12bbe45f7..d7216c39a 100644 --- a/Aaru.Filesystems/QNX6/Info.cs +++ b/Aaru.Filesystems/QNX6/Info.cs @@ -109,7 +109,8 @@ public sealed partial class QNX6 sb.AppendFormat(Localization._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(); metadata = new FileSystem { diff --git a/Aaru.Filesystems/RBF/Info.cs b/Aaru.Filesystems/RBF/Info.cs index dea4028bc..3a4860c9f 100644 --- a/Aaru.Filesystems/RBF/Info.cs +++ b/Aaru.Filesystems/RBF/Info.cs @@ -51,7 +51,10 @@ public sealed partial class RBF : IFilesystem // Documentation says ID should be sector 0 // I've found that OS-9/X68000 has it on sector 4 // I've read OS-9/Apple2 has it on sector 15 - foreach(int i in new[] { 0, 4, 15 }) + foreach(int i in new[] + { + 0, 4, 15 + }) { var location = (ulong)i; @@ -77,8 +80,7 @@ public sealed partial class RBF : IFilesystem AaruConsole.DebugWriteLine(MODULE_NAME, Localization.magic_at_0_equals_1_or_2_expected_3_or_4, location, rbfSb.dd_sync, rbf9000Sb.rid_sync, RBF_SYNC, RBF_CNYS); - if(rbfSb.dd_sync == RBF_SYNC || - rbf9000Sb.rid_sync is RBF_SYNC or RBF_CNYS) + if(rbfSb.dd_sync == RBF_SYNC || rbf9000Sb.rid_sync is RBF_SYNC or RBF_CNYS) return true; } @@ -99,7 +101,10 @@ public sealed partial class RBF : IFilesystem var rbfSb = new IdSector(); var rbf9000Sb = new NewIdSector(); - foreach(int i in new[] { 0, 4, 15 }) + foreach(int i in new[] + { + 0, 4, 15 + }) { var location = (ulong)i; var sbSize = (uint)(Marshal.SizeOf() / imagePlugin.Info.SectorSize); @@ -121,14 +126,11 @@ public sealed partial class RBF : IFilesystem AaruConsole.DebugWriteLine(MODULE_NAME, Localization.magic_at_0_equals_1_or_2_expected_3_or_4, location, rbfSb.dd_sync, rbf9000Sb.rid_sync, RBF_SYNC, RBF_CNYS); - if(rbfSb.dd_sync == RBF_SYNC || - rbf9000Sb.rid_sync is RBF_SYNC or RBF_CNYS) + if(rbfSb.dd_sync == RBF_SYNC || rbf9000Sb.rid_sync is RBF_SYNC or RBF_CNYS) break; } - if(rbfSb.dd_sync != RBF_SYNC && - rbf9000Sb.rid_sync != RBF_SYNC && - rbf9000Sb.rid_sync != RBF_CNYS) + if(rbfSb.dd_sync != RBF_SYNC && rbf9000Sb.rid_sync != RBF_SYNC && rbf9000Sb.rid_sync != RBF_CNYS) return; if(rbf9000Sb.rid_sync == RBF_CNYS) @@ -167,7 +169,8 @@ public sealed partial class RBF : IFilesystem sb.AppendLine(Localization.Disk_is_48_TPI); sb.AppendFormat(Localization.Allocation_bitmap_descriptor_starts_at_block_0, - rbf9000Sb.rid_bitmap == 0 ? 1 : rbf9000Sb.rid_bitmap).AppendLine(); + rbf9000Sb.rid_bitmap == 0 ? 1 : rbf9000Sb.rid_bitmap). + AppendLine(); if(rbf9000Sb.rid_firstboot > 0) { @@ -191,7 +194,8 @@ public sealed partial class RBF : IFilesystem AppendLine(); sb.AppendFormat(Localization.Volume_identification_block_was_last_written_on_0, - DateHandlers.UnixToDateTime(rbf9000Sb.rid_mtime)).AppendLine(); + DateHandlers.UnixToDateTime(rbf9000Sb.rid_mtime)). + AppendLine(); sb.AppendFormat(Localization.Volume_name_0, StringHandlers.CToString(rbf9000Sb.rid_name, encoding)). AppendLine(); @@ -217,7 +221,8 @@ public sealed partial class RBF : IFilesystem sb.AppendFormat(Localization._0_bytes_per_sector, 256 << rbfSb.dd_lsnsize).AppendLine(); sb.AppendFormat(Localization._0_sectors_per_cluster_1_bytes, rbfSb.dd_bit, - rbfSb.dd_bit * (256 << rbfSb.dd_lsnsize)).AppendLine(); + rbfSb.dd_bit * (256 << rbfSb.dd_lsnsize)). + AppendLine(); // TODO: Convert to flags? sb.AppendLine((rbfSb.dd_fmt & 0x01) == 0x01 @@ -238,15 +243,16 @@ public sealed partial class RBF : IFilesystem sb.AppendLine(Localization.Disk_is_48_TPI); sb.AppendFormat(Localization.Allocation_bitmap_descriptor_starts_at_block_0, - rbfSb.dd_maplsn == 0 ? 1 : rbfSb.dd_maplsn).AppendLine(); + rbfSb.dd_maplsn == 0 ? 1 : rbfSb.dd_maplsn). + AppendLine(); sb.AppendFormat(Localization._0_bytes_in_allocation_bitmap, rbfSb.dd_map).AppendLine(); - if(LSNToUInt32(rbfSb.dd_bt) > 0 && - rbfSb.dd_bsz > 0) + if(LSNToUInt32(rbfSb.dd_bt) > 0 && rbfSb.dd_bsz > 0) { sb.AppendFormat(Localization.Boot_file_starts_at_block_0_and_has_1_bytes, LSNToUInt32(rbfSb.dd_bt), - rbfSb.dd_bsz).AppendLine(); + rbfSb.dd_bsz). + AppendLine(); } sb.AppendFormat(Localization.Root_directory_descriptor_starts_at_block_0, LSNToUInt32(rbfSb.dd_dir)). diff --git a/Aaru.Filesystems/RT11/Info.cs b/Aaru.Filesystems/RT11/Info.cs index 900cddcac..2a4882a30 100644 --- a/Aaru.Filesystems/RT11/Info.cs +++ b/Aaru.Filesystems/RT11/Info.cs @@ -102,7 +102,8 @@ public sealed partial class RT11 check += BitConverter.ToUInt16(hbSector, i); sb.AppendFormat(Localization.Volume_format_is_0, - StringHandlers.SpacePaddedToString(homeblock.format, Encoding.ASCII)).AppendLine(); + StringHandlers.SpacePaddedToString(homeblock.format, Encoding.ASCII)). + AppendLine(); sb.AppendFormat(Localization._0_sectors_per_cluster_1_bytes, homeblock.cluster, homeblock.cluster * 512). AppendLine(); diff --git a/Aaru.Filesystems/ReFS/Consts.cs b/Aaru.Filesystems/ReFS/Consts.cs index d96e3767c..93d775c6b 100644 --- a/Aaru.Filesystems/ReFS/Consts.cs +++ b/Aaru.Filesystems/ReFS/Consts.cs @@ -34,6 +34,9 @@ public sealed partial class ReFS { const uint FSRS = 0x53525346; - const string FS_TYPE = "refs"; - readonly byte[] _signature = { 0x52, 0x65, 0x46, 0x53, 0x00, 0x00, 0x00, 0x00 }; + const string FS_TYPE = "refs"; + readonly byte[] _signature = + { + 0x52, 0x65, 0x46, 0x53, 0x00, 0x00, 0x00, 0x00 + }; } \ No newline at end of file diff --git a/Aaru.Filesystems/ReFS/Info.cs b/Aaru.Filesystems/ReFS/Info.cs index b221d3dae..b727bd3b7 100644 --- a/Aaru.Filesystems/ReFS/Info.cs +++ b/Aaru.Filesystems/ReFS/Info.cs @@ -65,7 +65,8 @@ public sealed partial class ReFS : IFilesystem VolumeHeader vhdr = Marshal.ByteArrayToStructureLittleEndian(sector); - return vhdr.identifier == FSRS && ArrayHelpers.ArrayIsNullOrEmpty(vhdr.mustBeZero) && + return vhdr.identifier == FSRS && + ArrayHelpers.ArrayIsNullOrEmpty(vhdr.mustBeZero) && vhdr.signature.SequenceEqual(_signature); } @@ -132,7 +133,8 @@ public sealed partial class ReFS : IFilesystem sb.AppendFormat(Localization.Volume_uses_0_bytes_per_sector, vhdr.bytesPerSector).AppendLine(); sb.AppendFormat(Localization.Volume_uses_0_sectors_per_cluster_1_bytes, vhdr.sectorsPerCluster, - vhdr.sectorsPerCluster * vhdr.bytesPerSector).AppendLine(); + vhdr.sectorsPerCluster * vhdr.bytesPerSector). + AppendLine(); sb.AppendFormat(Localization.Volume_has_0_sectors_1_bytes, vhdr.sectors, vhdr.sectors * vhdr.bytesPerSector). AppendLine(); diff --git a/Aaru.Filesystems/Reiser/Consts.cs b/Aaru.Filesystems/Reiser/Consts.cs index 1bc191a35..8609e02d8 100644 --- a/Aaru.Filesystems/Reiser/Consts.cs +++ b/Aaru.Filesystems/Reiser/Consts.cs @@ -36,7 +36,16 @@ public sealed partial class Reiser const string FS_TYPE = "reiserfs"; - readonly byte[] _magic35 = { 0x52, 0x65, 0x49, 0x73, 0x45, 0x72, 0x46, 0x73, 0x00, 0x00 }; - readonly byte[] _magic36 = { 0x52, 0x65, 0x49, 0x73, 0x45, 0x72, 0x32, 0x46, 0x73, 0x00 }; - readonly byte[] _magicJr = { 0x52, 0x65, 0x49, 0x73, 0x45, 0x72, 0x33, 0x46, 0x73, 0x00 }; + readonly byte[] _magic35 = + { + 0x52, 0x65, 0x49, 0x73, 0x45, 0x72, 0x46, 0x73, 0x00, 0x00 + }; + readonly byte[] _magic36 = + { + 0x52, 0x65, 0x49, 0x73, 0x45, 0x72, 0x32, 0x46, 0x73, 0x00 + }; + readonly byte[] _magicJr = + { + 0x52, 0x65, 0x49, 0x73, 0x45, 0x72, 0x33, 0x46, 0x73, 0x00 + }; } \ No newline at end of file diff --git a/Aaru.Filesystems/Reiser/Info.cs b/Aaru.Filesystems/Reiser/Info.cs index 94d8725df..44ed2962c 100644 --- a/Aaru.Filesystems/Reiser/Info.cs +++ b/Aaru.Filesystems/Reiser/Info.cs @@ -71,7 +71,8 @@ public sealed partial class Reiser : IFilesystem Superblock reiserSb = Marshal.ByteArrayToStructureLittleEndian(sector); - return _magic35.SequenceEqual(reiserSb.magic) || _magic36.SequenceEqual(reiserSb.magic) || + return _magic35.SequenceEqual(reiserSb.magic) || + _magic36.SequenceEqual(reiserSb.magic) || _magicJr.SequenceEqual(reiserSb.magic); } @@ -121,7 +122,8 @@ public sealed partial class Reiser : IFilesystem sb.AppendLine(Localization.Reiser_Jr_filesystem); sb.AppendFormat(Localization.Volume_has_0_blocks_with_1_blocks_free, reiserSb.block_count, - reiserSb.free_blocks).AppendLine(); + reiserSb.free_blocks). + AppendLine(); sb.AppendFormat(Localization._0_bytes_per_block, reiserSb.blocksize).AppendLine(); sb.AppendFormat(Localization.Root_directory_resides_on_block_0, reiserSb.root_block).AppendLine(); @@ -130,7 +132,8 @@ public sealed partial class Reiser : IFilesystem sb.AppendLine(Localization.Volume_has_not_been_cleanly_umounted); sb.AppendFormat(Localization.Volume_last_checked_on_0, - DateHandlers.UnixUnsignedToDateTime(reiserSb.last_check)).AppendLine(); + DateHandlers.UnixUnsignedToDateTime(reiserSb.last_check)). + AppendLine(); if(reiserSb.version >= 2) { diff --git a/Aaru.Filesystems/SFS/Info.cs b/Aaru.Filesystems/SFS/Info.cs index f8dde3225..1d20519fd 100644 --- a/Aaru.Filesystems/SFS/Info.cs +++ b/Aaru.Filesystems/SFS/Info.cs @@ -77,13 +77,16 @@ public sealed partial class SFS sbInformation.AppendFormat(Localization.Volume_version_0, rootBlock.version).AppendLine(); sbInformation.AppendFormat(Localization.Volume_starts_on_device_byte_0_and_ends_on_byte_1, rootBlock.firstbyte, - rootBlock.lastbyte).AppendLine(); + rootBlock.lastbyte). + AppendLine(); sbInformation.AppendFormat(Localization.Volume_has_0_blocks_of_1_bytes_each, rootBlock.totalblocks, - rootBlock.blocksize).AppendLine(); + rootBlock.blocksize). + AppendLine(); sbInformation.AppendFormat(Localization.Volume_created_on_0, - DateHandlers.UnixUnsignedToDateTime(rootBlock.datecreated).AddYears(8)).AppendLine(); + DateHandlers.UnixUnsignedToDateTime(rootBlock.datecreated).AddYears(8)). + AppendLine(); sbInformation.AppendFormat(Localization.Bitmap_starts_at_block_0, rootBlock.bitmapbase).AppendLine(); diff --git a/Aaru.Filesystems/SolarFS/Info.cs b/Aaru.Filesystems/SolarFS/Info.cs index a08a5f183..a0fc225ca 100644 --- a/Aaru.Filesystems/SolarFS/Info.cs +++ b/Aaru.Filesystems/SolarFS/Info.cs @@ -108,8 +108,8 @@ public sealed partial class SolarFS Array.Copy(bpbSector, 0x1B, bpb.unk3, 0, 10); bpb.unk4 = BitConverter.ToUInt32(bpbSector, 0x26); - AaruConsole.DebugWriteLine(MODULE_NAME, "BPB.x86_jump: 0x{0:X2}{1:X2}{2:X2}", bpb.x86_jump[0], - bpb.x86_jump[1], bpb.x86_jump[2]); + AaruConsole.DebugWriteLine(MODULE_NAME, "BPB.x86_jump: 0x{0:X2}{1:X2}{2:X2}", bpb.x86_jump[0], bpb.x86_jump[1], + bpb.x86_jump[2]); AaruConsole.DebugWriteLine(MODULE_NAME, "BPB.OEMName: \"{0}\"", bpb.OEMName); AaruConsole.DebugWriteLine(MODULE_NAME, "BPB.bps: {0}", bpb.bps); @@ -141,18 +141,17 @@ public sealed partial class SolarFS if(bpb.bps != imagePlugin.Info.SectorSize) { sb. - AppendFormat( - Localization. - WARNING_Filesystem_describes_a_0_bytes_sector_while_device_describes_a_1_bytes_sector, - bpb.bps, 2048).AppendLine(); + AppendFormat(Localization.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( - Localization.WARNING_Filesystem_describes_a_0_bytes_sector_while_device_describes_a_1_bytes_sector, - bpb.bps, imagePlugin.Info.SectorSize).AppendLine(); + AppendFormat(Localization.WARNING_Filesystem_describes_a_0_bytes_sector_while_device_describes_a_1_bytes_sector, + bpb.bps, imagePlugin.Info.SectorSize). + AppendLine(); } sb.AppendFormat(Localization._0_sectors_on_volume_1_bytes, bpb.sectors, bpb.sectors * bpb.bps).AppendLine(); diff --git a/Aaru.Filesystems/SysV/Info.cs b/Aaru.Filesystems/SysV/Info.cs index e01e2810a..8e1c71df8 100644 --- a/Aaru.Filesystems/SysV/Info.cs +++ b/Aaru.Filesystems/SysV/Info.cs @@ -65,7 +65,8 @@ public sealed partial class SysVfs sb_size_in_sectors = 1; // If not a single sector can store it if(partition.End <= - partition.Start + 4 * (ulong)sb_size_in_sectors + + partition.Start + + 4 * (ulong)sb_size_in_sectors + sb_size_in_sectors) // Device must be bigger than SB location + SB size + offset return false; @@ -87,8 +88,7 @@ public sealed partial class SysVfs ErrorNumber errno = imagePlugin.ReadSectors((ulong)i + partition.Start, sb_size_in_sectors, out byte[] sb_sector); - if(errno != ErrorNumber.NoError || - sb_sector.Length < 0x400) + if(errno != ErrorNumber.NoError || sb_sector.Length < 0x400) continue; var magic = BitConverter.ToUInt32(sb_sector, 0x3F8); @@ -122,31 +122,25 @@ public sealed partial class SysVfs var s_nfree = BitConverter.ToUInt16(sb_sector, 0x006); var s_ninode = BitConverter.ToUInt16(sb_sector, 0x0D0); - if(s_fsize is <= 0 or >= 0xFFFFFFFF || - s_nfree is <= 0 or >= 0xFFFF || - s_ninode is <= 0 or >= 0xFFFF) + if(s_fsize is <= 0 or >= 0xFFFFFFFF || s_nfree is <= 0 or >= 0xFFFF || s_ninode is <= 0 or >= 0xFFFF) continue; - if((s_fsize & 0xFF) == 0x00 && - (s_nfree & 0xFF) == 0x00 && - (s_ninode & 0xFF) == 0x00) + 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_ninode = (ushort)(s_ninode >> 8); } - if((s_fsize & 0xFF000000) != 0x00 || - (s_nfree & 0xFF00) != 0x00 || - (s_ninode & 0xFF00) != 0x00) + 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) + 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 || @@ -297,31 +291,25 @@ public sealed partial class SysVfs var s_nfree = BitConverter.ToUInt16(sb_sector, 0x006); var s_ninode = BitConverter.ToUInt16(sb_sector, 0x0D0); - if(s_fsize is <= 0 or >= 0xFFFFFFFF || - s_nfree is <= 0 or >= 0xFFFF || - s_ninode is <= 0 or >= 0xFFFF) + if(s_fsize is <= 0 or >= 0xFFFFFFFF || s_nfree is <= 0 or >= 0xFFFF || s_ninode is <= 0 or >= 0xFFFF) continue; - if((s_fsize & 0xFF) == 0x00 && - (s_nfree & 0xFF) == 0x00 && - (s_ninode & 0xFF) == 0x00) + 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_ninode = (ushort)(s_ninode >> 8); } - if((s_fsize & 0xFF000000) != 0x00 || - (s_nfree & 0xFF00) != 0x00 || - (s_ninode & 0xFF00) != 0x00) + 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) + 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 && @@ -334,11 +322,7 @@ public sealed partial class SysVfs break; } - if(!sys7th && - !sysv && - !coherent && - !xenix && - !xenix3) + if(!sys7th && !sysv && !coherent && !xenix && !xenix3) return; metadata = new FileSystem(); @@ -454,10 +438,9 @@ public sealed partial class SysVfs if(bs != 2048) { sb. - AppendFormat( - Localization. - WARNING_Filesystem_indicates_0_bytes_block_while_device_indicates_1_bytes_block, - bs, 2048).AppendLine(); + AppendFormat(Localization.WARNING_Filesystem_indicates_0_bytes_block_while_device_indicates_1_bytes_block, + bs, 2048). + AppendLine(); } } else @@ -465,10 +448,9 @@ public sealed partial class SysVfs if(bs != imagePlugin.Info.SectorSize) { sb. - AppendFormat( - Localization. - WARNING_Filesystem_indicates_0_bytes_block_while_device_indicates_1_bytes_block, - bs, imagePlugin.Info.SectorSize).AppendLine(); + AppendFormat(Localization.WARNING_Filesystem_indicates_0_bytes_block_while_device_indicates_1_bytes_block, + bs, imagePlugin.Info.SectorSize). + AppendLine(); } } @@ -675,7 +657,8 @@ public sealed partial class SysVfs sb.AppendLine(Localization.Volume_is_mounted_read_only); sb.AppendFormat(Localization.Superblock_last_updated_on_0, - DateHandlers.UnixUnsignedToDateTime(sysv_sb.s_time)).AppendLine(); + DateHandlers.UnixUnsignedToDateTime(sysv_sb.s_time)). + AppendLine(); if(sysv_sb.s_time != 0) metadata.ModificationDate = DateHandlers.UnixUnsignedToDateTime(sysv_sb.s_time); @@ -730,9 +713,9 @@ public sealed partial class SysVfs if(imagePlugin.Info.SectorSize != 512) { sb. - AppendFormat( - Localization.WARNING_Filesystem_indicates_0_bytes_block_while_device_indicates_1_bytes_block, - 512, 2048).AppendLine(); + AppendFormat(Localization.WARNING_Filesystem_indicates_0_bytes_block_while_device_indicates_1_bytes_block, + 512, 2048). + AppendLine(); } sb.AppendFormat(Localization._0_zones_in_volume_1_bytes, coh_sb.s_fsize, coh_sb.s_fsize * 512).AppendLine(); @@ -760,7 +743,8 @@ public sealed partial class SysVfs sb.AppendLine(Localization.Volume_is_mounted_read_only); sb.AppendFormat(Localization.Superblock_last_updated_on_0, - DateHandlers.UnixUnsignedToDateTime(coh_sb.s_time)).AppendLine(); + DateHandlers.UnixUnsignedToDateTime(coh_sb.s_time)). + AppendLine(); if(coh_sb.s_time != 0) metadata.ModificationDate = DateHandlers.UnixUnsignedToDateTime(coh_sb.s_time); @@ -806,9 +790,9 @@ public sealed partial class SysVfs if(imagePlugin.Info.SectorSize != 512) { sb. - AppendFormat( - Localization.WARNING_Filesystem_indicates_0_bytes_block_while_device_indicates_1_bytes_block, - 512, 2048).AppendLine(); + AppendFormat(Localization.WARNING_Filesystem_indicates_0_bytes_block_while_device_indicates_1_bytes_block, + 512, 2048). + AppendLine(); } sb.AppendFormat(Localization._0_zones_in_volume_1_bytes, v7_sb.s_fsize, v7_sb.s_fsize * 512).AppendLine(); @@ -836,7 +820,8 @@ public sealed partial class SysVfs sb.AppendLine(Localization.Volume_is_mounted_read_only); sb.AppendFormat(Localization.Superblock_last_updated_on_0, - DateHandlers.UnixUnsignedToDateTime(v7_sb.s_time)).AppendLine(); + DateHandlers.UnixUnsignedToDateTime(v7_sb.s_time)). + AppendLine(); if(v7_sb.s_time != 0) metadata.ModificationDate = DateHandlers.UnixUnsignedToDateTime(v7_sb.s_time); diff --git a/Aaru.Filesystems/UCSDPascal/Dir.cs b/Aaru.Filesystems/UCSDPascal/Dir.cs index ba006d099..f841b8f24 100644 --- a/Aaru.Filesystems/UCSDPascal/Dir.cs +++ b/Aaru.Filesystems/UCSDPascal/Dir.cs @@ -51,12 +51,10 @@ public sealed partial class PascalPlugin if(!_mounted) return ErrorNumber.AccessDenied; - if(!string.IsNullOrEmpty(path) && - string.Compare(path, "/", StringComparison.OrdinalIgnoreCase) != 0) + if(!string.IsNullOrEmpty(path) && string.Compare(path, "/", StringComparison.OrdinalIgnoreCase) != 0) return ErrorNumber.NotSupported; - var contents = _fileEntries.Select(ent => StringHandlers.PascalToString(ent.Filename, _encoding)). - ToList(); + var contents = _fileEntries.Select(ent => StringHandlers.PascalToString(ent.Filename, _encoding)).ToList(); if(_debug) { diff --git a/Aaru.Filesystems/UCSDPascal/File.cs b/Aaru.Filesystems/UCSDPascal/File.cs index 7e8a0b378..ccb7782f2 100644 --- a/Aaru.Filesystems/UCSDPascal/File.cs +++ b/Aaru.Filesystems/UCSDPascal/File.cs @@ -48,7 +48,10 @@ public sealed partial class PascalPlugin if(!_mounted) return ErrorNumber.AccessDenied; - string[] pathElements = path.Split(new[] { '/' }, StringSplitOptions.RemoveEmptyEntries); + string[] pathElements = path.Split(new[] + { + '/' + }, StringSplitOptions.RemoveEmptyEntries); if(pathElements.Length != 1) return ErrorNumber.NotSupported; @@ -71,15 +74,19 @@ public sealed partial class PascalPlugin if(!_mounted) return ErrorNumber.AccessDenied; - string[] pathElements = path.Split(new[] { '/' }, StringSplitOptions.RemoveEmptyEntries); + string[] pathElements = path.Split(new[] + { + '/' + }, StringSplitOptions.RemoveEmptyEntries); if(pathElements.Length != 1) return ErrorNumber.NotSupported; byte[] file; - if(_debug && (string.Compare(path, "$", StringComparison.InvariantCulture) == 0 || - string.Compare(path, "$Boot", StringComparison.InvariantCulture) == 0)) + if(_debug && + (string.Compare(path, "$", StringComparison.InvariantCulture) == 0 || + string.Compare(path, "$Boot", StringComparison.InvariantCulture) == 0)) file = string.Compare(path, "$", StringComparison.InvariantCulture) == 0 ? _catalogBlocks : _bootBlocks; else { @@ -133,8 +140,7 @@ public sealed partial class PascalPlugin if(!_mounted) return ErrorNumber.AccessDenied; - if(buffer is null || - buffer.Length < length) + if(buffer is null || buffer.Length < length) return ErrorNumber.InvalidArgument; if(node is not PascalFileNode mynode) @@ -156,7 +162,10 @@ public sealed partial class PascalPlugin { stat = null; - string[] pathElements = path.Split(new[] { '/' }, StringSplitOptions.RemoveEmptyEntries); + string[] pathElements = path.Split(new[] + { + '/' + }, StringSplitOptions.RemoveEmptyEntries); if(pathElements.Length != 1) return ErrorNumber.NotSupported; @@ -218,7 +227,8 @@ public sealed partial class PascalPlugin StringHandlers.PascalToString(ent.Filename, _encoding), StringComparison. - InvariantCultureIgnoreCase) == 0)) + InvariantCultureIgnoreCase) == + 0)) { entry = ent; diff --git a/Aaru.Filesystems/UCSDPascal/Info.cs b/Aaru.Filesystems/UCSDPascal/Info.cs index e81c51d27..af4ebd35f 100644 --- a/Aaru.Filesystems/UCSDPascal/Info.cs +++ b/Aaru.Filesystems/UCSDPascal/Info.cs @@ -104,8 +104,7 @@ public sealed partial class PascalPlugin return false; // Volume record entry type must be volume or secure - if(volEntry.EntryType != PascalFileKind.Volume && - volEntry.EntryType != PascalFileKind.Secure) + if(volEntry.EntryType != PascalFileKind.Volume && volEntry.EntryType != PascalFileKind.Secure) return false; // Volume name is max 7 characters @@ -113,8 +112,7 @@ public sealed partial class PascalPlugin return false; // Volume blocks is equal to volume sectors - if(volEntry.Blocks < 0 || - (ulong)volEntry.Blocks != imagePlugin.Info.Sectors / _multiplier) + if(volEntry.Blocks < 0 || (ulong)volEntry.Blocks != imagePlugin.Info.Sectors / _multiplier) return false; // There can be not less than zero files @@ -171,8 +169,7 @@ public sealed partial class PascalPlugin return; // Volume record entry type must be volume or secure - if(volEntry.EntryType != PascalFileKind.Volume && - volEntry.EntryType != PascalFileKind.Secure) + if(volEntry.EntryType != PascalFileKind.Volume && volEntry.EntryType != PascalFileKind.Secure) return; // Volume name is max 7 characters @@ -180,8 +177,7 @@ public sealed partial class PascalPlugin return; // Volume blocks is equal to volume sectors - if(volEntry.Blocks < 0 || - (ulong)volEntry.Blocks != imagePlugin.Info.Sectors / _multiplier) + if(volEntry.Blocks < 0 || (ulong)volEntry.Blocks != imagePlugin.Info.Sectors / _multiplier) return; // There can be not less than zero files @@ -189,7 +185,8 @@ public sealed partial class PascalPlugin return; sbInformation.AppendFormat(Localization.Volume_record_spans_from_block_0_to_block_1, volEntry.FirstBlock, - volEntry.LastBlock).AppendLine(); + volEntry.LastBlock). + AppendLine(); sbInformation. AppendFormat(Localization.Volume_name_0, StringHandlers.PascalToString(volEntry.VolumeName, encoding)). diff --git a/Aaru.Filesystems/UCSDPascal/Super.cs b/Aaru.Filesystems/UCSDPascal/Super.cs index f17d0f871..83c0e4d93 100644 --- a/Aaru.Filesystems/UCSDPascal/Super.cs +++ b/Aaru.Filesystems/UCSDPascal/Super.cs @@ -87,14 +87,13 @@ public sealed partial class PascalPlugin _mountedVolEntry.LastBoot = BigEndianBitConverter.ToInt16(_catalogBlocks, 0x14); _mountedVolEntry.Tail = BigEndianBitConverter.ToInt32(_catalogBlocks, 0x16); - 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 || + 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 ErrorNumber.InvalidArgument; @@ -123,8 +122,7 @@ public sealed partial class PascalPlugin Array.Copy(_catalogBlocks, offset + 0x06, entry.Filename, 0, 16); - if(entry.Filename[0] <= 15 && - entry.Filename[0] > 0) + if(entry.Filename[0] <= 15 && entry.Filename[0] > 0) _fileEntries.Add(entry); offset += 26; diff --git a/Aaru.Filesystems/UCSDPascal/UCSDPascal.cs b/Aaru.Filesystems/UCSDPascal/UCSDPascal.cs index d539a5358..f7fc3f503 100644 --- a/Aaru.Filesystems/UCSDPascal/UCSDPascal.cs +++ b/Aaru.Filesystems/UCSDPascal/UCSDPascal.cs @@ -100,6 +100,8 @@ public sealed partial class PascalPlugin : IReadOnlyFilesystem static Dictionary GetDefaultOptions() => new() { - { "debug", false.ToString() } + { + "debug", false.ToString() + } }; } \ No newline at end of file diff --git a/Aaru.Filesystems/UDF/Info.cs b/Aaru.Filesystems/UDF/Info.cs index 3c4dca965..3899d3284 100644 --- a/Aaru.Filesystems/UDF/Info.cs +++ b/Aaru.Filesystems/UDF/Info.cs @@ -58,14 +58,43 @@ public sealed partial class UDF if(imagePlugin.Info.SectorSize < 512) return false; - var anchor = new AnchorVolumeDescriptorPointer(); + var anchor = new AnchorVolumeDescriptorPointer(); // All positions where anchor may reside, with the ratio between 512 and 2048bps ulong[][] positions = { - new ulong[] { 256, 1 }, new ulong[] { 512, 1 }, new ulong[] { partition.End - 256, 1 }, - new ulong[] { partition.End, 1 }, new ulong[] { 1024, 4 }, new ulong[] { 2048, 4 }, - new ulong[] { partition.End - 1024, 4 }, new ulong[] { partition.End - 4, 4 } + new ulong[] + { + 256, 1 + }, + new ulong[] + { + 512, 1 + }, + new ulong[] + { + partition.End - 256, 1 + }, + new ulong[] + { + partition.End, 1 + }, + new ulong[] + { + 1024, 4 + }, + new ulong[] + { + 2048, 4 + }, + new ulong[] + { + partition.End - 1024, 4 + }, + new ulong[] + { + partition.End - 4, 4 + } }; var anchorFound = false; @@ -75,9 +104,9 @@ public sealed partial class UDF foreach(ulong[] position in from position in positions.Where(position => position[0] + partition.Start + position[1] <= - partition.End && position[0] < partition.End) - let errno = - imagePlugin.ReadSectors(position[0], (uint)position[1], out sector) + partition.End && + position[0] < partition.End) + let errno = imagePlugin.ReadSectors(position[0], (uint)position[1], out sector) where errno == ErrorNumber.NoError select position) { @@ -85,8 +114,7 @@ public sealed partial class UDF AaruConsole.DebugWriteLine(MODULE_NAME, "anchor.tag.tagIdentifier = {0}", anchor.tag.tagIdentifier); - AaruConsole.DebugWriteLine(MODULE_NAME, "anchor.tag.descriptorVersion = {0}", - anchor.tag.descriptorVersion); + AaruConsole.DebugWriteLine(MODULE_NAME, "anchor.tag.descriptorVersion = {0}", anchor.tag.descriptorVersion); AaruConsole.DebugWriteLine(MODULE_NAME, "anchor.tag.tagChecksum = 0x{0:X2}", anchor.tag.tagChecksum); AaruConsole.DebugWriteLine(MODULE_NAME, "anchor.tag.reserved = {0}", anchor.tag.reserved); @@ -132,9 +160,8 @@ public sealed partial class UDF { ErrorNumber errno = imagePlugin. - ReadSectors( - partition.Start + anchor.mainVolumeDescriptorSequenceExtent.location * ratio + count * ratio, - ratio, out sector); + ReadSectors(partition.Start + anchor.mainVolumeDescriptorSequenceExtent.location * ratio + count * ratio, + ratio, out sector); if(errno != ErrorNumber.NoError) { @@ -189,9 +216,38 @@ public sealed partial class UDF // All positions where anchor may reside, with the ratio between 512 and 2048bps ulong[][] positions = { - new ulong[] { 256, 1 }, new ulong[] { 512, 1 }, new ulong[] { partition.End - 256, 1 }, - new ulong[] { partition.End, 1 }, new ulong[] { 1024, 4 }, new ulong[] { 2048, 4 }, - new ulong[] { partition.End - 1024, 4 }, new ulong[] { partition.End - 4, 4 } + new ulong[] + { + 256, 1 + }, + new ulong[] + { + 512, 1 + }, + new ulong[] + { + partition.End - 256, 1 + }, + new ulong[] + { + partition.End, 1 + }, + new ulong[] + { + 1024, 4 + }, + new ulong[] + { + 2048, 4 + }, + new ulong[] + { + partition.End - 1024, 4 + }, + new ulong[] + { + partition.End - 4, 4 + } }; uint ratio = 1; @@ -225,9 +281,8 @@ public sealed partial class UDF { errno = imagePlugin. - ReadSectors( - partition.Start + anchor.mainVolumeDescriptorSequenceExtent.location * ratio + count * ratio, - ratio, out sector); + ReadSectors(partition.Start + anchor.mainVolumeDescriptorSequenceExtent.location * ratio + count * ratio, + ratio, out sector); if(errno != ErrorNumber.NoError) continue; @@ -278,10 +333,12 @@ public sealed partial class UDF lvid = new LogicalVolumeIntegrityDescriptor(); sbInformation.AppendFormat(Localization.Volume_is_number_0_of_1, pvd.volumeSequenceNumber, - pvd.maximumVolumeSequenceNumber).AppendLine(); + pvd.maximumVolumeSequenceNumber). + AppendLine(); sbInformation.AppendFormat(Localization.Volume_set_identifier_0, - StringHandlers.DecompressUnicode(pvd.volumeSetIdentifier)).AppendLine(); + StringHandlers.DecompressUnicode(pvd.volumeSetIdentifier)). + AppendLine(); sbInformation. AppendFormat(Localization.Volume_name_0, StringHandlers.DecompressUnicode(lvd.logicalVolumeIdentifier)). @@ -299,7 +356,8 @@ public sealed partial class UDF AppendLine(); sbInformation.AppendFormat(Localization.Volume_conforms_to_0, - encoding.GetString(lvd.domainIdentifier.identifier).TrimEnd('\u0000')).AppendLine(); + encoding.GetString(lvd.domainIdentifier.identifier).TrimEnd('\u0000')). + AppendLine(); sbInformation.AppendFormat(Localization.Volume_was_last_written_by_0, encoding.GetString(pvd.implementationIdentifier.identifier).TrimEnd('\u0000')). @@ -307,15 +365,18 @@ public sealed partial class UDF sbInformation.AppendFormat(Localization.Volume_requires_UDF_version_0_1_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(Localization.Volume_requires_UDF_version_0_1_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(Localization.Volume_cannot_be_written_by_any_UDF_version_higher_than_0_1, Convert.ToInt32($"{(lvidiu.maximumWriteUDF & 0xFF00) >> 8}", 10), - Convert.ToInt32($"{lvidiu.maximumWriteUDF & 0xFF}", 10)).AppendLine(); + Convert.ToInt32($"{lvidiu.maximumWriteUDF & 0xFF}", 10)). + AppendLine(); metadata = new FileSystem { diff --git a/Aaru.Filesystems/UNICOS/Info.cs b/Aaru.Filesystems/UNICOS/Info.cs index 9f3ecd3da..8316228d7 100644 --- a/Aaru.Filesystems/UNICOS/Info.cs +++ b/Aaru.Filesystems/UNICOS/Info.cs @@ -74,8 +74,7 @@ public sealed partial class UNICOS Superblock unicosSb = Marshal.ByteArrayToStructureBigEndian(sector); - AaruConsole.DebugWriteLine(MODULE_NAME, Localization.magic_equals_0_expected_1, unicosSb.s_magic, - UNICOS_MAGIC); + AaruConsole.DebugWriteLine(MODULE_NAME, Localization.magic_equals_0_expected_1, unicosSb.s_magic, UNICOS_MAGIC); return unicosSb.s_magic == UNICOS_MAGIC; } diff --git a/Aaru.Filesystems/UNIXBFS/Info.cs b/Aaru.Filesystems/UNIXBFS/Info.cs index 14335c184..2112f6595 100644 --- a/Aaru.Filesystems/UNIXBFS/Info.cs +++ b/Aaru.Filesystems/UNIXBFS/Info.cs @@ -105,7 +105,8 @@ public sealed partial class BFS sb.AppendLine(Localization.UNIX_Boot_Filesystem); sb.AppendFormat(Localization.Volume_goes_from_byte_0_to_byte_1_for_2_bytes, bfsSb.s_start, bfsSb.s_end, - bfsSb.s_end - bfsSb.s_start).AppendLine(); + bfsSb.s_end - bfsSb.s_start). + AppendLine(); sb.AppendFormat(Localization.Filesystem_name_0, bfsSb.s_fsname).AppendLine(); sb.AppendFormat(Localization.Volume_name_0, bfsSb.s_volume).AppendLine(); diff --git a/Aaru.Filesystems/VMfs/Info.cs b/Aaru.Filesystems/VMfs/Info.cs index 3dde32e8c..61a1da616 100644 --- a/Aaru.Filesystems/VMfs/Info.cs +++ b/Aaru.Filesystems/VMfs/Info.cs @@ -102,10 +102,12 @@ public sealed partial class VMfs sbInformation.AppendFormat(Localization.Volume_UUID_0, volInfo.uuid).AppendLine(); sbInformation.AppendFormat(Localization.Volume_created_on_0, - DateHandlers.UnixUnsignedToDateTime(ctimeSecs, ctimeNanoSecs)).AppendLine(); + DateHandlers.UnixUnsignedToDateTime(ctimeSecs, ctimeNanoSecs)). + AppendLine(); sbInformation.AppendFormat(Localization.Volume_last_modified_on_0, - DateHandlers.UnixUnsignedToDateTime(mtimeSecs, mtimeNanoSecs)).AppendLine(); + DateHandlers.UnixUnsignedToDateTime(mtimeSecs, mtimeNanoSecs)). + AppendLine(); information = sbInformation.ToString(); diff --git a/Aaru.Filesystems/VxFS/Info.cs b/Aaru.Filesystems/VxFS/Info.cs index b99ac6cde..63da51199 100644 --- a/Aaru.Filesystems/VxFS/Info.cs +++ b/Aaru.Filesystems/VxFS/Info.cs @@ -92,10 +92,12 @@ public sealed partial class VxFS sbInformation.AppendFormat(Localization.Volume_has_0_free_blocks, vxSb.vs_free).AppendLine(); sbInformation.AppendFormat(Localization.Volume_created_on_0, - DateHandlers.UnixUnsignedToDateTime(vxSb.vs_ctime, vxSb.vs_cutime)).AppendLine(); + DateHandlers.UnixUnsignedToDateTime(vxSb.vs_ctime, vxSb.vs_cutime)). + AppendLine(); sbInformation.AppendFormat(Localization.Volume_last_modified_on_0, - DateHandlers.UnixUnsignedToDateTime(vxSb.vs_wtime, vxSb.vs_wutime)).AppendLine(); + DateHandlers.UnixUnsignedToDateTime(vxSb.vs_wtime, vxSb.vs_wutime)). + AppendLine(); if(vxSb.vs_clean != 0) sbInformation.AppendLine(Localization.Volume_is_dirty); diff --git a/Aaru.Filesystems/XFS/Info.cs b/Aaru.Filesystems/XFS/Info.cs index c9a28aaf5..02bec98b7 100644 --- a/Aaru.Filesystems/XFS/Info.cs +++ b/Aaru.Filesystems/XFS/Info.cs @@ -67,7 +67,10 @@ public sealed partial class XFS var sbpiece = new byte[Marshal.SizeOf()]; - foreach(int location in new[] { 0, 0x200, 0x400 }) + foreach(int location in new[] + { + 0, 0x200, 0x400 + }) { Array.Copy(sector, location, sbpiece, 0, Marshal.SizeOf()); @@ -82,7 +85,10 @@ public sealed partial class XFS } else { - foreach(int i in new[] { 0, 1, 2 }) + foreach(int i in new[] + { + 0, 1, 2 + }) { var location = (ulong)i; @@ -135,13 +141,15 @@ public sealed partial class XFS ErrorNumber errno = imagePlugin.ReadSectors(partition.Start, sbSize, out byte[] sector); - if(errno != ErrorNumber.NoError || - sector.Length < Marshal.SizeOf()) + if(errno != ErrorNumber.NoError || sector.Length < Marshal.SizeOf()) return; var sbpiece = new byte[Marshal.SizeOf()]; - foreach(int location in new[] { 0, 0x200, 0x400 }) + foreach(int location in new[] + { + 0, 0x200, 0x400 + }) { Array.Copy(sector, location, sbpiece, 0, Marshal.SizeOf()); @@ -156,7 +164,10 @@ public sealed partial class XFS } else { - foreach(int i in new[] { 0, 1, 2 }) + foreach(int i in new[] + { + 0, 1, 2 + }) { var location = (ulong)i; var sbSize = (uint)(Marshal.SizeOf() / imagePlugin.Info.SectorSize); @@ -166,8 +177,7 @@ public sealed partial class XFS ErrorNumber errno = imagePlugin.ReadSectors(partition.Start + location, sbSize, out byte[] sector); - if(errno != ErrorNumber.NoError || - sector.Length < Marshal.SizeOf()) + if(errno != ErrorNumber.NoError || sector.Length < Marshal.SizeOf()) return; xfsSb = Marshal.ByteArrayToStructureBigEndian(sector); diff --git a/Aaru.Filesystems/Xia/Info.cs b/Aaru.Filesystems/Xia/Info.cs index afa5e2321..8ddb9e5c3 100644 --- a/Aaru.Filesystems/Xia/Info.cs +++ b/Aaru.Filesystems/Xia/Info.cs @@ -99,13 +99,16 @@ public sealed partial class Xia sb.AppendFormat(Localization._0_inodes, supblk.s_ninodes).AppendLine(); sb.AppendFormat(Localization._0_data_zones_1_bytes, supblk.s_ndatazones, - supblk.s_ndatazones * supblk.s_zone_size).AppendLine(); + supblk.s_ndatazones * supblk.s_zone_size). + AppendLine(); sb.AppendFormat(Localization._0_imap_zones_1_bytes, supblk.s_imap_zones, - supblk.s_imap_zones * supblk.s_zone_size).AppendLine(); + supblk.s_imap_zones * supblk.s_zone_size). + AppendLine(); sb.AppendFormat(Localization._0_zmap_zones_1_bytes, supblk.s_zmap_zones, - supblk.s_zmap_zones * supblk.s_zone_size).AppendLine(); + supblk.s_zmap_zones * supblk.s_zone_size). + AppendLine(); sb.AppendFormat(Localization.First_data_zone_0, supblk.s_firstdatazone).AppendLine(); @@ -113,7 +116,8 @@ public sealed partial class Xia AppendLine(); sb.AppendFormat(Localization._0_zones_reserved_for_kernel_images_1_bytes, supblk.s_kernzones, - supblk.s_kernzones * supblk.s_zone_size).AppendLine(); + supblk.s_kernzones * supblk.s_zone_size). + AppendLine(); sb.AppendFormat(Localization.First_kernel_zone_0, supblk.s_firstkernzone).AppendLine(); diff --git a/Aaru.Filesystems/ZFS/Helpers.cs b/Aaru.Filesystems/ZFS/Helpers.cs index a46bab103..19b6584a3 100644 --- a/Aaru.Filesystems/ZFS/Helpers.cs +++ b/Aaru.Filesystems/ZFS/Helpers.cs @@ -76,8 +76,7 @@ public sealed partial class ZFS { decodedNvList = new Dictionary(); - if(nvlist == null || - nvlist.Length < 16) + if(nvlist == null || nvlist.Length < 16) return false; if(!xdr) @@ -593,7 +592,8 @@ public sealed partial class ZFS else { sb.AppendFormat(Localization._0_equals_1_elements_nvlist_array_unable_to_print, item.name, - item.elements).AppendLine(); + item.elements). + AppendLine(); } break; diff --git a/Aaru.Filesystems/dump/Info.cs b/Aaru.Filesystems/dump/Info.cs index 186bb4b55..081bd6c89 100644 --- a/Aaru.Filesystems/dump/Info.cs +++ b/Aaru.Filesystems/dump/Info.cs @@ -81,9 +81,14 @@ public sealed partial class dump AaruConsole.DebugWriteLine(MODULE_NAME, "aix magic = 0x{0:X8}", aixHdr.c_magic); AaruConsole.DebugWriteLine(MODULE_NAME, "new magic = 0x{0:X8}", newHdr.c_magic); - return oldHdr.c_magic == OFS_MAGIC || aixHdr.c_magic is XIX_MAGIC or 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; + return oldHdr.c_magic == OFS_MAGIC || + aixHdr.c_magic is XIX_MAGIC or 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; } /// @@ -126,9 +131,7 @@ public sealed partial class dump 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) + if(newHdr.c_magic == OFS_CIGAM || newHdr.c_magic == NFS_CIGAM || newHdr.c_magic == UFS2_CIGAM) newHdr = Marshal.ByteArrayToStructureBigEndian(sector); } else if(aixHdr.c_magic is XIX_MAGIC or XIX_CIGAM) diff --git a/Aaru.Filesystems/exFAT/Info.cs b/Aaru.Filesystems/exFAT/Info.cs index dd02327da..f09749d16 100644 --- a/Aaru.Filesystems/exFAT/Info.cs +++ b/Aaru.Filesystems/exFAT/Info.cs @@ -102,10 +102,12 @@ public sealed partial class exFAT sb.AppendFormat(Localization.Partition_offset_0, vbr.offset).AppendLine(); sb.AppendFormat(Localization.Volume_has_0_sectors_of_1_bytes_each_for_a_total_of_2_bytes, vbr.sectors, - 1 << vbr.sectorShift, vbr.sectors * (ulong)(1 << vbr.sectorShift)).AppendLine(); + 1 << vbr.sectorShift, vbr.sectors * (ulong)(1 << vbr.sectorShift)). + AppendLine(); sb.AppendFormat(Localization.Volume_uses_clusters_of_0_sectors_1_bytes_each, 1 << vbr.clusterShift, - (1 << vbr.sectorShift) * (1 << vbr.clusterShift)).AppendLine(); + (1 << vbr.sectorShift) * (1 << vbr.clusterShift)). + AppendLine(); sb.AppendFormat(Localization.First_FAT_starts_at_sector_0_and_runs_for_1_sectors, vbr.fatOffset, vbr.fatLength). AppendLine(); @@ -113,7 +115,8 @@ public sealed partial class exFAT sb.AppendFormat(Localization.Volume_uses_0_FATs, vbr.fats).AppendLine(); sb.AppendFormat(Localization.Cluster_heap_starts_at_sector_0_contains_1_clusters_and_is_2_used, - vbr.clusterHeapOffset, vbr.clusterHeapLength, vbr.heapUsage).AppendLine(); + vbr.clusterHeapOffset, vbr.clusterHeapLength, vbr.heapUsage). + AppendLine(); sb.AppendFormat(Localization.Root_directory_starts_at_cluster_0, vbr.rootDirectoryCluster).AppendLine(); diff --git a/Aaru.Filesystems/ext2FS/Info.cs b/Aaru.Filesystems/ext2FS/Info.cs index 65cb4cfe1..217a8caec 100644 --- a/Aaru.Filesystems/ext2FS/Info.cs +++ b/Aaru.Filesystems/ext2FS/Info.cs @@ -187,7 +187,8 @@ public sealed partial class ext2FS if(supblk.mkfs_t > 0) { sb.AppendFormat(Localization.Volume_was_created_on_0_for_1, - DateHandlers.UnixUnsignedToDateTime(supblk.mkfs_t), extOs).AppendLine(); + DateHandlers.UnixUnsignedToDateTime(supblk.mkfs_t), extOs). + AppendLine(); metadata.CreationDate = DateHandlers.UnixUnsignedToDateTime(supblk.mkfs_t); } @@ -246,13 +247,13 @@ public sealed partial class ext2FS supblk.block_size = 1024; sb.AppendFormat(Localization.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(); + 1024 << (int)supblk.block_size, blocks * (ulong)(1024 << (int)supblk.block_size)). + AppendLine(); metadata.Clusters = blocks; metadata.ClusterSize = (uint)(1024 << (int)supblk.block_size); - if(supblk.mount_t > 0 || - supblk.mount_c > 0) + if(supblk.mount_t > 0 || supblk.mount_c > 0) { if(supblk.mount_t > 0) { @@ -263,26 +264,29 @@ public sealed partial class ext2FS if(supblk.max_mount_c != -1) { sb.AppendFormat(Localization.Volume_has_been_mounted_0_times_of_a_maximum_of_1_mounts_before_checking, - supblk.mount_c, supblk.max_mount_c).AppendLine(); + supblk.mount_c, supblk.max_mount_c). + AppendLine(); } else { sb. - AppendFormat( - Localization.Volume_has_been_mounted_0_times_with_no_maximum_no_of_mounts_before_checking, - supblk.mount_c).AppendLine(); + AppendFormat(Localization.Volume_has_been_mounted_0_times_with_no_maximum_no_of_mounts_before_checking, + supblk.mount_c). + AppendLine(); } if(!string.IsNullOrEmpty(StringHandlers.CToString(supblk.last_mount_dir, encoding))) { sb.AppendFormat(Localization.Last_mounted_at_0, - StringHandlers.CToString(supblk.last_mount_dir, encoding)).AppendLine(); + StringHandlers.CToString(supblk.last_mount_dir, encoding)). + AppendLine(); } if(!string.IsNullOrEmpty(StringHandlers.CToString(supblk.mount_options, encoding))) { sb.AppendFormat(Localization.Last_used_mount_options_were_0, - StringHandlers.CToString(supblk.mount_options, encoding)).AppendLine(); + StringHandlers.CToString(supblk.mount_options, encoding)). + AppendLine(); } } else @@ -303,7 +307,8 @@ public sealed partial class ext2FS if(supblk.check_inv > 0) { sb.AppendFormat(Localization.Last_checked_on_0_should_check_every_1_seconds, - DateHandlers.UnixUnsignedToDateTime(supblk.check_t), supblk.check_inv).AppendLine(); + DateHandlers.UnixUnsignedToDateTime(supblk.check_t), supblk.check_inv). + AppendLine(); } else { @@ -400,7 +405,8 @@ public sealed partial class ext2FS metadata.FreeClusters = free; sb.AppendFormat(Localization._0_inodes_with_1_free_inodes_2, supblk.inodes, supblk.free_inodes, - supblk.free_inodes * 100 / supblk.inodes).AppendLine(); + supblk.free_inodes * 100 / supblk.inodes). + AppendLine(); if(supblk.first_inode > 0) sb.AppendFormat(Localization.First_inode_is_0, supblk.first_inode).AppendLine(); @@ -408,11 +414,11 @@ public sealed partial class ext2FS if(supblk.frag_size > 0) sb.AppendFormat(Localization._0_bytes_per_fragment, supblk.frag_size).AppendLine(); - if(supblk.blocks_per_grp > 0 && - supblk is { flags_per_grp: > 0, inodes_per_grp: > 0 }) + if(supblk.blocks_per_grp > 0 && supblk is { flags_per_grp: > 0, inodes_per_grp: > 0 }) { sb.AppendFormat(Localization._0_blocks_1_flags_and_2_inodes_per_group, supblk.blocks_per_grp, - supblk.flags_per_grp, supblk.inodes_per_grp).AppendLine(); + supblk.flags_per_grp, supblk.inodes_per_grp). + AppendLine(); } if(supblk.first_block > 0) @@ -438,7 +444,8 @@ public sealed partial class ext2FS if(supblk is { mmp_interval: > 0, mmp_block: > 0 }) { sb.AppendFormat(Localization._0_seconds_for_multi_mount_protection_wait_on_block_1, supblk.mmp_interval, - supblk.mmp_block).AppendLine(); + supblk.mmp_block). + AppendLine(); } if(supblk.flex_bg_grp_size > 0) @@ -447,7 +454,8 @@ public sealed partial class ext2FS if(supblk is { hash_seed_1: > 0, hash_seed_2: > 0 } and { hash_seed_3: > 0, hash_seed_4: > 0 }) { sb.AppendFormat(Localization.Hash_seed_0_1_2_3_version_4, supblk.hash_seed_1, supblk.hash_seed_2, - supblk.hash_seed_3, supblk.hash_seed_4, supblk.hash_version).AppendLine(); + 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 || @@ -478,11 +486,10 @@ public sealed partial class ext2FS if(supblk.snapshot_id > 0) { sb. - AppendFormat( - Localization. - 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(Localization.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) @@ -491,16 +498,20 @@ public sealed partial class ext2FS sb.AppendFormat(Localization.First_error_occurred_on_0_last_on_1, DateHandlers.UnixUnsignedToDateTime(supblk.first_error_t), - DateHandlers.UnixUnsignedToDateTime(supblk.last_error_t)).AppendLine(); + DateHandlers.UnixUnsignedToDateTime(supblk.last_error_t)). + AppendLine(); sb.AppendFormat(Localization.First_error_inode_is_0_last_is_1, supblk.first_error_inode, - supblk.last_error_inode).AppendLine(); + supblk.last_error_inode). + AppendLine(); sb.AppendFormat(Localization.First_error_block_is_0_last_is_1, supblk.first_error_block, - supblk.last_error_block).AppendLine(); + supblk.last_error_block). + AppendLine(); sb.AppendFormat(Localization.First_error_function_is_0_last_is_1, supblk.first_error_func, - supblk.last_error_func).AppendLine(); + supblk.last_error_func). + AppendLine(); } } diff --git a/Aaru.Filters/AppleDouble.cs b/Aaru.Filters/AppleDouble.cs index 86a9857d0..240758e1d 100644 --- a/Aaru.Filters/AppleDouble.cs +++ b/Aaru.Filters/AppleDouble.cs @@ -133,8 +133,7 @@ public sealed class AppleDouble : IFilter parentFolder ??= ""; - if(filename is null || - filenameNoExt is null) + if(filename is null || filenameNoExt is null) return false; // Prepend data fork name with "R." @@ -314,8 +313,7 @@ public sealed class AppleDouble : IFilter parentFolder ??= ""; - if(filename is null || - filenameNoExt is null) + if(filename is null || filenameNoExt is null) return ErrorNumber.InvalidArgument; // Prepend data fork name with "R." diff --git a/Aaru.Filters/AppleSingle.cs b/Aaru.Filters/AppleSingle.cs index e07dac53c..408016731 100644 --- a/Aaru.Filters/AppleSingle.cs +++ b/Aaru.Filters/AppleSingle.cs @@ -159,8 +159,7 @@ public sealed class AppleSingle : IFilter /// public bool Identify(byte[] buffer) { - if(buffer == null || - buffer.Length < 26) + if(buffer == null || buffer.Length < 26) return false; var hdrB = new byte[26]; @@ -173,8 +172,7 @@ public sealed class AppleSingle : IFilter /// public bool Identify(Stream stream) { - if(stream == null || - stream.Length < 26) + if(stream == null || stream.Length < 26) return false; var hdrB = new byte[26]; diff --git a/Aaru.Filters/BZip2.cs b/Aaru.Filters/BZip2.cs index ac6e9076d..4ec84d8a6 100644 --- a/Aaru.Filters/BZip2.cs +++ b/Aaru.Filters/BZip2.cs @@ -83,11 +83,7 @@ public class BZip2 : IFilter /// public bool Identify(byte[] buffer) { - if(buffer[0] != 0x42 || - buffer[1] != 0x5A || - buffer[2] != 0x68 || - buffer[3] < 0x31 || - buffer[3] > 0x39) + if(buffer[0] != 0x42 || buffer[1] != 0x5A || buffer[2] != 0x68 || buffer[3] < 0x31 || buffer[3] > 0x39) return false; if(buffer.Length <= 512) @@ -105,11 +101,7 @@ public class BZip2 : IFilter stream.EnsureRead(buffer, 0, 4); stream.Seek(0, SeekOrigin.Begin); - if(buffer[0] != 0x42 || - buffer[1] != 0x5A || - buffer[2] != 0x68 || - buffer[3] < 0x31 || - buffer[3] > 0x39) + if(buffer[0] != 0x42 || buffer[1] != 0x5A || buffer[2] != 0x68 || buffer[3] < 0x31 || buffer[3] > 0x39) return false; if(stream.Length <= 512) @@ -136,11 +128,7 @@ public class BZip2 : IFilter stream.EnsureRead(buffer, 0, 4); stream.Seek(0, SeekOrigin.Begin); - if(buffer[0] != 0x42 || - buffer[1] != 0x5A || - buffer[2] != 0x68 || - buffer[3] < 0x31 || - buffer[3] > 0x39) + if(buffer[0] != 0x42 || buffer[1] != 0x5A || buffer[2] != 0x68 || buffer[3] < 0x31 || buffer[3] > 0x39) return false; if(stream.Length <= 512) diff --git a/Aaru.Filters/LZip.cs b/Aaru.Filters/LZip.cs index a5c8c6749..508ce5ff0 100644 --- a/Aaru.Filters/LZip.cs +++ b/Aaru.Filters/LZip.cs @@ -82,8 +82,11 @@ public sealed class LZip : IFilter public bool HasResourceFork => false; /// - public bool Identify(byte[] buffer) => buffer[0] == 0x4C && buffer[1] == 0x5A && buffer[2] == 0x49 && - buffer[3] == 0x50 && buffer[4] == 0x01; + public bool Identify(byte[] buffer) => buffer[0] == 0x4C && + buffer[1] == 0x5A && + buffer[2] == 0x49 && + buffer[3] == 0x50 && + buffer[4] == 0x01; /// public bool Identify(Stream stream) diff --git a/Aaru.Filters/MacBinary.cs b/Aaru.Filters/MacBinary.cs index 8bc5f1bda..93e76e702 100644 --- a/Aaru.Filters/MacBinary.cs +++ b/Aaru.Filters/MacBinary.cs @@ -150,24 +150,26 @@ public sealed class MacBinary : IFilter /// public bool Identify(byte[] buffer) { - if(buffer == null || - buffer.Length < 128) + if(buffer == null || buffer.Length < 128) return false; var hdrB = new byte[128]; Array.Copy(buffer, 0, hdrB, 0, 128); _header = Marshal.ByteArrayToStructureBigEndian
(hdrB); - return _header.magic == MAGIC || _header.version == 0 && _header.filename[0] > 0 && _header.filename[0] < 64 && - _header.zero1 == 0 && _header is { zero2: 0, reserved: 0 } && + return _header.magic == MAGIC || + _header.version == 0 && + _header.filename[0] > 0 && + _header.filename[0] < 64 && + _header.zero1 == 0 && + _header is { zero2: 0, reserved: 0 } && (_header.dataLength > 0 || _header.resourceLength > 0); } /// public bool Identify(Stream stream) { - if(stream == null || - stream.Length < 128) + if(stream == null || stream.Length < 128) return false; var hdrB = new byte[128]; @@ -175,8 +177,12 @@ public sealed class MacBinary : IFilter stream.EnsureRead(hdrB, 0, 128); _header = Marshal.ByteArrayToStructureBigEndian
(hdrB); - return _header.magic == MAGIC || _header.version == 0 && _header.filename[0] > 0 && _header.filename[0] < 64 && - _header.zero1 == 0 && _header is { zero2: 0, reserved: 0 } && + return _header.magic == MAGIC || + _header.version == 0 && + _header.filename[0] > 0 && + _header.filename[0] < 64 && + _header.zero1 == 0 && + _header is { zero2: 0, reserved: 0 } && (_header.dataLength > 0 || _header.resourceLength > 0); } @@ -197,8 +203,12 @@ public sealed class MacBinary : IFilter fstream.Close(); - return _header.magic == MAGIC || _header.version == 0 && _header.filename[0] > 0 && _header.filename[0] < 64 && - _header.zero1 == 0 && _header is { zero2: 0, reserved: 0 } && + return _header.magic == MAGIC || + _header.version == 0 && + _header.filename[0] > 0 && + _header.filename[0] < 64 && + _header.zero1 == 0 && + _header is { zero2: 0, reserved: 0 } && (_header.dataLength > 0 || _header.resourceLength > 0); } diff --git a/Aaru.Filters/OffsetStream.cs b/Aaru.Filters/OffsetStream.cs index 8854ff365..03ca9790d 100644 --- a/Aaru.Filters/OffsetStream.cs +++ b/Aaru.Filters/OffsetStream.cs @@ -205,8 +205,7 @@ public sealed class OffsetStream : Stream /// Start position /// Last readable position /// Invalid range - public OffsetStream(SafeFileHandle handle, FileAccess access, int bufferSize, bool isAsync, long start, - long end) + public OffsetStream(SafeFileHandle handle, FileAccess access, int bufferSize, bool isAsync, long start, long end) { if(start < 0) throw new ArgumentOutOfRangeException(nameof(start), Localization.Start_cant_be_a_negative_number); @@ -248,8 +247,8 @@ public sealed class OffsetStream : Stream /// Start position /// Last readable position /// Invalid range - 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), Localization.Start_cant_be_a_negative_number); @@ -422,8 +421,7 @@ public sealed class OffsetStream : Stream /// Start position /// Last readable position /// Invalid range - public OffsetStream(byte[] buffer, int index, int count, bool writable, bool publiclyVisible, long start, - long end) + public OffsetStream(byte[] buffer, int index, int count, bool writable, bool publiclyVisible, long start, long end) { if(start < 0) throw new ArgumentOutOfRangeException(nameof(start), Localization.Start_cant_be_a_negative_number); @@ -593,8 +591,7 @@ public sealed class OffsetStream : Stream } /// - public override IAsyncResult BeginRead(byte[] buffer, int offset, int count, AsyncCallback callback, - object state) + public override IAsyncResult BeginRead(byte[] buffer, int offset, int count, AsyncCallback callback, object state) { if(_baseStream.Position + count > _streamEnd) throw new IOException(Localization.Cannot_read_past_stream_end); @@ -603,8 +600,7 @@ public sealed class OffsetStream : Stream } /// - public override IAsyncResult BeginWrite(byte[] buffer, int offset, int count, AsyncCallback callback, - object state) + public override IAsyncResult BeginWrite(byte[] buffer, int offset, int count, AsyncCallback callback, object state) { if(_baseStream.Position + count > _streamEnd) throw new IOException(Localization.Cannot_write_past_stream_end); diff --git a/Aaru.Filters/PCExchange.cs b/Aaru.Filters/PCExchange.cs index b81dcc5bd..c6c4978c0 100644 --- a/Aaru.Filters/PCExchange.cs +++ b/Aaru.Filters/PCExchange.cs @@ -147,14 +147,13 @@ public sealed class PcExchange : IFilter Array.Copy(datEntry.dosName, 0, tmpDosNameB, 0, 8); Array.Copy(datEntry.dosName, 8, tmpDosExtB, 0, 3); - string dosName = Encoding.ASCII.GetString(tmpDosNameB).Trim() + "." + + string dosName = Encoding.ASCII.GetString(tmpDosNameB).Trim() + + "." + Encoding.ASCII.GetString(tmpDosExtB).Trim(); string dosNameLow = dosName.ToLower(CultureInfo.CurrentCulture); - if(baseFilename != macName && - baseFilename != dosName && - baseFilename != dosNameLow) + if(baseFilename != macName && baseFilename != dosName && baseFilename != dosNameLow) continue; dataFound |= @@ -204,14 +203,13 @@ public sealed class PcExchange : IFilter Array.Copy(datEntry.dosName, 0, tmpDosNameB, 0, 8); Array.Copy(datEntry.dosName, 8, tmpDosExtB, 0, 3); - string dosName = Encoding.ASCII.GetString(tmpDosNameB).Trim() + "." + + string dosName = Encoding.ASCII.GetString(tmpDosNameB).Trim() + + "." + Encoding.ASCII.GetString(tmpDosExtB).Trim(); string dosNameLow = dosName.ToLower(CultureInfo.CurrentCulture); - if(baseFilename != macName && - baseFilename != dosName && - baseFilename != dosNameLow) + if(baseFilename != macName && baseFilename != dosName && baseFilename != dosNameLow) continue; if(File.Exists(System.IO.Path.Combine(parentFolder, macName ?? throw new InvalidOperationException()))) diff --git a/Aaru.Filters/XZ.cs b/Aaru.Filters/XZ.cs index a3954acab..04c92781a 100644 --- a/Aaru.Filters/XZ.cs +++ b/Aaru.Filters/XZ.cs @@ -81,9 +81,14 @@ public sealed class XZ : IFilter public bool HasResourceFork => false; /// - public bool Identify(byte[] buffer) => buffer[0] == 0xFD && buffer[1] == 0x37 && buffer[2] == 0x7A && - buffer[3] == 0x58 && buffer[4] == 0x5A && buffer[5] == 0x00 && - buffer[^2] == 0x59 && buffer[^1] == 0x5A; + public bool Identify(byte[] buffer) => buffer[0] == 0xFD && + buffer[1] == 0x37 && + buffer[2] == 0x7A && + buffer[3] == 0x58 && + buffer[4] == 0x5A && + buffer[5] == 0x00 && + buffer[^2] == 0x59 && + buffer[^1] == 0x5A; /// public bool Identify(Stream stream) @@ -100,8 +105,14 @@ public sealed class XZ : IFilter stream.EnsureRead(footer, 0, 2); stream.Seek(0, SeekOrigin.Begin); - return buffer[0] == 0xFD && buffer[1] == 0x37 && buffer[2] == 0x7A && buffer[3] == 0x58 && buffer[4] == 0x5A && - buffer[5] == 0x00 && footer[0] == 0x59 && footer[1] == 0x5A; + return buffer[0] == 0xFD && + buffer[1] == 0x37 && + buffer[2] == 0x7A && + buffer[3] == 0x58 && + buffer[4] == 0x5A && + buffer[5] == 0x00 && + footer[0] == 0x59 && + footer[1] == 0x5A; } /// @@ -123,8 +134,14 @@ public sealed class XZ : IFilter stream.EnsureRead(footer, 0, 2); stream.Seek(0, SeekOrigin.Begin); - return buffer[0] == 0xFD && buffer[1] == 0x37 && buffer[2] == 0x7A && buffer[3] == 0x58 && buffer[4] == 0x5A && - buffer[5] == 0x00 && footer[0] == 0x59 && footer[1] == 0x5A; + return buffer[0] == 0xFD && + buffer[1] == 0x37 && + buffer[2] == 0x7A && + buffer[3] == 0x58 && + buffer[4] == 0x5A && + buffer[5] == 0x00 && + footer[0] == 0x59 && + footer[1] == 0x5A; } /// @@ -248,8 +265,7 @@ public sealed class XZ : IFilter while((buf[i++] & 0x80) == 0x80) { - if(i >= sizeMax || - buf[i] == 0x00) + if(i >= sizeMax || buf[i] == 0x00) return 0; num |= (ulong)(buf[i] & 0x7F) << i * 7; diff --git a/Aaru.Generators/PluginRegisterGenerator.cs b/Aaru.Generators/PluginRegisterGenerator.cs index f2ebabba4..9defc1151 100644 --- a/Aaru.Generators/PluginRegisterGenerator.cs +++ b/Aaru.Generators/PluginRegisterGenerator.cs @@ -301,39 +301,51 @@ public class PluginRegisterGenerator : ISourceGenerator return; if(plugin.BaseList?.Types.Any(t => ((t as SimpleBaseTypeSyntax)?.Type as IdentifierNameSyntax)?.Identifier. - ValueText == "IPluginRegister") == true) + ValueText == + "IPluginRegister") == + true) Register = plugin; if(plugin.BaseList?.Types.Any(t => ((t as SimpleBaseTypeSyntax)?.Type as IdentifierNameSyntax)?.Identifier. - ValueText == "IArchive") == true) + ValueText == + "IArchive") == + true) { if(!Archives.Contains(plugin.Identifier.Text)) Archives.Add(plugin.Identifier.Text); } if(plugin.BaseList?.Types.Any(t => ((t as SimpleBaseTypeSyntax)?.Type as IdentifierNameSyntax)?.Identifier. - ValueText == "IChecksum") == true) + ValueText == + "IChecksum") == + true) { if(!Checksums.Contains(plugin.Identifier.Text)) Checksums.Add(plugin.Identifier.Text); } if(plugin.BaseList?.Types.Any(t => ((t as SimpleBaseTypeSyntax)?.Type as IdentifierNameSyntax)?.Identifier. - ValueText == "IFilesystem") == true) + ValueText == + "IFilesystem") == + true) { if(!FileSystems.Contains(plugin.Identifier.Text)) FileSystems.Add(plugin.Identifier.Text); } if(plugin.BaseList?.Types.Any(t => ((t as SimpleBaseTypeSyntax)?.Type as IdentifierNameSyntax)?.Identifier. - ValueText == "IFilter") == true) + ValueText == + "IFilter") == + true) { if(!Filters.Contains(plugin.Identifier.Text)) Filters.Add(plugin.Identifier.Text); } if(plugin.BaseList?.Types.Any(t => ((t as SimpleBaseTypeSyntax)?.Type as IdentifierNameSyntax)?.Identifier. - ValueText == "IFloppyImage") == true) + ValueText == + "IFloppyImage") == + true) { if(!FloppyImagePlugins.Contains(plugin.Identifier.Text)) FloppyImagePlugins.Add(plugin.Identifier.Text); @@ -341,28 +353,35 @@ public class PluginRegisterGenerator : ISourceGenerator if(plugin.BaseList?.Types.Any(t => ((t as SimpleBaseTypeSyntax)?.Type as IdentifierNameSyntax)?.Identifier. ValueText is "IMediaImage" or "IOpticalMediaImage" or "IFloppyImage" - or "ITapeImage") == true) + or "ITapeImage") == + true) { if(!MediaImagePlugins.Contains(plugin.Identifier.Text)) MediaImagePlugins.Add(plugin.Identifier.Text); } if(plugin.BaseList?.Types.Any(t => ((t as SimpleBaseTypeSyntax)?.Type as IdentifierNameSyntax)?.Identifier. - ValueText == "IPartition") == true) + ValueText == + "IPartition") == + true) { if(!PartitionPlugins.Contains(plugin.Identifier.Text)) PartitionPlugins.Add(plugin.Identifier.Text); } if(plugin.BaseList?.Types.Any(t => ((t as SimpleBaseTypeSyntax)?.Type as IdentifierNameSyntax)?.Identifier. - ValueText == "IReadOnlyFilesystem") == true) + ValueText == + "IReadOnlyFilesystem") == + true) { if(!ReadOnlyFileSystems.Contains(plugin.Identifier.Text)) ReadOnlyFileSystems.Add(plugin.Identifier.Text); } if(plugin.BaseList?.Types.Any(t => ((t as SimpleBaseTypeSyntax)?.Type as IdentifierNameSyntax)?.Identifier. - ValueText == "IWritableFloppyImage") == true) + ValueText == + "IWritableFloppyImage") == + true) { if(!WritableFloppyImagePlugins.Contains(plugin.Identifier.Text)) WritableFloppyImagePlugins.Add(plugin.Identifier.Text); @@ -370,14 +389,17 @@ public class PluginRegisterGenerator : ISourceGenerator if(plugin.BaseList?.Types.Any(t => ((t as SimpleBaseTypeSyntax)?.Type as IdentifierNameSyntax)?.Identifier. ValueText is "IWritableImage" or "IWritableOpticalImage" - or "IWritableTapeImage" or "IByteAddressableImage") == true) + or "IWritableTapeImage" or "IByteAddressableImage") == + true) { if(!WritableImagePlugins.Contains(plugin.Identifier.Text)) WritableImagePlugins.Add(plugin.Identifier.Text); } if(plugin.BaseList?.Types.Any(t => ((t as SimpleBaseTypeSyntax)?.Type as IdentifierNameSyntax)?.Identifier. - ValueText == "IByteAddressableImage") == true) + ValueText == + "IByteAddressableImage") == + true) { if(!ByteAddressableImagePlugins.Contains(plugin.Identifier.Text)) ByteAddressableImagePlugins.Add(plugin.Identifier.Text); diff --git a/Aaru.Gui/ConsoleHandler.cs b/Aaru.Gui/ConsoleHandler.cs index f71516dd9..d014e6be5 100644 --- a/Aaru.Gui/ConsoleHandler.cs +++ b/Aaru.Gui/ConsoleHandler.cs @@ -88,8 +88,7 @@ static class ConsoleHandler static void OnWriteHandler([CanBeNull] string format, [CanBeNull] params object[] arg) { - if(format == null || - arg == null) + if(format == null || arg == null) return; Entries.Add(new LogEntry @@ -103,8 +102,7 @@ static class ConsoleHandler static void OnErrorWriteHandler([CanBeNull] string format, [CanBeNull] params object[] arg) { - if(format == null || - arg == null) + if(format == null || arg == null) return; Entries.Add(new LogEntry @@ -118,8 +116,7 @@ static class ConsoleHandler static void OnVerboseWriteHandler([CanBeNull] string format, [CanBeNull] params object[] arg) { - if(format == null || - arg == null) + if(format == null || arg == null) return; Entries.Add(new LogEntry @@ -133,8 +130,7 @@ static class ConsoleHandler static void OnDebugWriteHandler(string module, [CanBeNull] string format, [CanBeNull] params object[] arg) { - if(format == null || - arg == null) + if(format == null || arg == null) return; Entries.Add(new LogEntry diff --git a/Aaru.Gui/Main.cs b/Aaru.Gui/Main.cs index 6f9ede373..a34d0a821 100644 --- a/Aaru.Gui/Main.cs +++ b/Aaru.Gui/Main.cs @@ -43,6 +43,6 @@ public static class Main } // Avalonia configuration, don't remove; also used by visual designer. - public static AppBuilder BuildAvaloniaApp() => AppBuilder.Configure().UsePlatformDetect(). - UseReactiveUI().UseManagedSystemDialogs(); + public static AppBuilder BuildAvaloniaApp() => + AppBuilder.Configure().UsePlatformDetect().UseReactiveUI().UseManagedSystemDialogs(); } \ No newline at end of file diff --git a/Aaru.Gui/ViewModels/Dialogs/AboutViewModel.cs b/Aaru.Gui/ViewModels/Dialogs/AboutViewModel.cs index 8b6ec3a80..df653b468 100644 --- a/Aaru.Gui/ViewModels/Dialogs/AboutViewModel.cs +++ b/Aaru.Gui/ViewModels/Dialogs/AboutViewModel.cs @@ -75,8 +75,7 @@ public sealed class AboutViewModel : ViewModelBase (Attribute.GetCustomAttribute(assembly, typeof(AssemblyInformationalVersionAttribute)) as AssemblyInformationalVersionAttribute)?.InformationalVersion; - if(name is null || - version is null) + if(name is null || version is null) continue; Assemblies.Add(new AssemblyModel diff --git a/Aaru.Gui/ViewModels/Dialogs/ConsoleViewModel.cs b/Aaru.Gui/ViewModels/Dialogs/ConsoleViewModel.cs index 99019ab72..08ec47260 100644 --- a/Aaru.Gui/ViewModels/Dialogs/ConsoleViewModel.cs +++ b/Aaru.Gui/ViewModels/Dialogs/ConsoleViewModel.cs @@ -99,8 +99,11 @@ public sealed class ConsoleViewModel : ViewModelBase dlgSave.Filters?.Add(new FileDialogFilter { - Extensions = new List(new[] { "log" }), - Name = UI.Dialog_Log_files + Extensions = new List(new[] + { + "log" + }), + Name = UI.Dialog_Log_files }); string result = await dlgSave.ShowAsync(_view); @@ -158,10 +161,8 @@ public sealed class ConsoleViewModel : ViewModelBase { await MessageBoxManager.GetMessageBoxStandard(UI.Title_Error, string. - Format( - UI. - Exception_0_trying_to_save_logfile_details_has_been_sent_to_console, - exception.Message), ButtonEnum.Ok, Icon.Error). + Format(UI.Exception_0_trying_to_save_logfile_details_has_been_sent_to_console, + exception.Message), ButtonEnum.Ok, Icon.Error). ShowWindowDialogAsync(_view); AaruConsole.ErrorWriteLine("Console", exception.Message); diff --git a/Aaru.Gui/ViewModels/Dialogs/EncodingsViewModel.cs b/Aaru.Gui/ViewModels/Dialogs/EncodingsViewModel.cs index 98f8b9312..886e3a3f5 100644 --- a/Aaru.Gui/ViewModels/Dialogs/EncodingsViewModel.cs +++ b/Aaru.Gui/ViewModels/Dialogs/EncodingsViewModel.cs @@ -55,17 +55,20 @@ public sealed class EncodingsViewModel : ViewModelBase Task.Run(() => { - var encodings = Encoding.GetEncodings().Select(info => new EncodingModel - { - Name = info.Name, - DisplayName = info.GetEncoding().EncodingName - }).ToList(); + var encodings = Encoding.GetEncodings(). + Select(info => new EncodingModel + { + Name = info.Name, + DisplayName = info.GetEncoding().EncodingName + }). + ToList(); - encodings.AddRange(Claunia.Encoding.Encoding.GetEncodings().Select(info => new EncodingModel - { - Name = info.Name, - DisplayName = info.DisplayName - })); + encodings.AddRange(Claunia.Encoding.Encoding.GetEncodings(). + Select(info => new EncodingModel + { + Name = info.Name, + DisplayName = info.DisplayName + })); foreach(EncodingModel encoding in encodings.OrderBy(t => t.DisplayName)) Encodings.Add(encoding); diff --git a/Aaru.Gui/ViewModels/Dialogs/StatisticsViewModel.cs b/Aaru.Gui/ViewModels/Dialogs/StatisticsViewModel.cs index 915a8f2a6..2e16ca45c 100644 --- a/Aaru.Gui/ViewModels/Dialogs/StatisticsViewModel.cs +++ b/Aaru.Gui/ViewModels/Dialogs/StatisticsViewModel.cs @@ -132,7 +132,8 @@ public sealed class StatisticsViewModel : ViewModelBase if(ctx.Commands.Any(c => c.Name == "fs-info")) { - ulong count = ctx.Commands.Where(c => c.Name == "fs-info" && c.Synchronized).Select(c => c.Count). + ulong count = ctx.Commands.Where(c => c.Name == "fs-info" && c.Synchronized). + Select(c => c.Count). FirstOrDefault(); count += (ulong)ctx.Commands.LongCount(c => c.Name == "fs-info" && !c.Synchronized); @@ -143,7 +144,8 @@ public sealed class StatisticsViewModel : ViewModelBase if(ctx.Commands.Any(c => c.Name == "checksum")) { - ulong count = ctx.Commands.Where(c => c.Name == "checksum" && c.Synchronized).Select(c => c.Count). + ulong count = ctx.Commands.Where(c => c.Name == "checksum" && c.Synchronized). + Select(c => c.Count). FirstOrDefault(); count += (ulong)ctx.Commands.LongCount(c => c.Name == "checksum" && !c.Synchronized); @@ -154,7 +156,8 @@ public sealed class StatisticsViewModel : ViewModelBase if(ctx.Commands.Any(c => c.Name == "compare")) { - ulong count = ctx.Commands.Where(c => c.Name == "compare" && c.Synchronized).Select(c => c.Count). + ulong count = ctx.Commands.Where(c => c.Name == "compare" && c.Synchronized). + Select(c => c.Count). FirstOrDefault(); count += (ulong)ctx.Commands.LongCount(c => c.Name == "compare" && !c.Synchronized); @@ -165,7 +168,8 @@ public sealed class StatisticsViewModel : ViewModelBase if(ctx.Commands.Any(c => c.Name == "convert-image")) { - ulong count = ctx.Commands.Where(c => c.Name == "convert-image" && c.Synchronized).Select(c => c.Count). + ulong count = ctx.Commands.Where(c => c.Name == "convert-image" && c.Synchronized). + Select(c => c.Count). FirstOrDefault(); count += (ulong)ctx.Commands.LongCount(c => c.Name == "convert-image" && !c.Synchronized); @@ -177,7 +181,8 @@ public sealed class StatisticsViewModel : ViewModelBase if(ctx.Commands.Any(c => c.Name == "create-sidecar")) { ulong count = ctx.Commands.Where(c => c.Name == "create-sidecar" && c.Synchronized). - Select(c => c.Count).FirstOrDefault(); + Select(c => c.Count). + FirstOrDefault(); count += (ulong)ctx.Commands.LongCount(c => c.Name == "create-sidecar" && !c.Synchronized); @@ -187,7 +192,8 @@ public sealed class StatisticsViewModel : ViewModelBase if(ctx.Commands.Any(c => c.Name == "decode")) { - ulong count = ctx.Commands.Where(c => c.Name == "decode" && c.Synchronized).Select(c => c.Count). + ulong count = ctx.Commands.Where(c => c.Name == "decode" && c.Synchronized). + Select(c => c.Count). FirstOrDefault(); count += (ulong)ctx.Commands.LongCount(c => c.Name == "decode" && !c.Synchronized); @@ -198,7 +204,8 @@ public sealed class StatisticsViewModel : ViewModelBase if(ctx.Commands.Any(c => c.Name == "device-info")) { - ulong count = ctx.Commands.Where(c => c.Name == "device-info" && c.Synchronized).Select(c => c.Count). + ulong count = ctx.Commands.Where(c => c.Name == "device-info" && c.Synchronized). + Select(c => c.Count). FirstOrDefault(); count += (ulong)ctx.Commands.LongCount(c => c.Name == "device-info" && !c.Synchronized); @@ -209,7 +216,8 @@ public sealed class StatisticsViewModel : ViewModelBase if(ctx.Commands.Any(c => c.Name == "device-report")) { - ulong count = ctx.Commands.Where(c => c.Name == "device-report" && c.Synchronized).Select(c => c.Count). + ulong count = ctx.Commands.Where(c => c.Name == "device-report" && c.Synchronized). + Select(c => c.Count). FirstOrDefault(); count += (ulong)ctx.Commands.LongCount(c => c.Name == "device-report" && !c.Synchronized); @@ -220,7 +228,8 @@ public sealed class StatisticsViewModel : ViewModelBase if(ctx.Commands.Any(c => c.Name == "dump-media")) { - ulong count = ctx.Commands.Where(c => c.Name == "dump-media" && c.Synchronized).Select(c => c.Count). + ulong count = ctx.Commands.Where(c => c.Name == "dump-media" && c.Synchronized). + Select(c => c.Count). FirstOrDefault(); count += (ulong)ctx.Commands.LongCount(c => c.Name == "dump-media" && !c.Synchronized); @@ -231,7 +240,8 @@ public sealed class StatisticsViewModel : ViewModelBase if(ctx.Commands.Any(c => c.Name == "entropy")) { - ulong count = ctx.Commands.Where(c => c.Name == "entropy" && c.Synchronized).Select(c => c.Count). + ulong count = ctx.Commands.Where(c => c.Name == "entropy" && c.Synchronized). + Select(c => c.Count). FirstOrDefault(); count += (ulong)ctx.Commands.LongCount(c => c.Name == "entropy" && !c.Synchronized); @@ -242,7 +252,8 @@ public sealed class StatisticsViewModel : ViewModelBase if(ctx.Commands.Any(c => c.Name == "formats")) { - ulong count = ctx.Commands.Where(c => c.Name == "formats" && c.Synchronized).Select(c => c.Count). + ulong count = ctx.Commands.Where(c => c.Name == "formats" && c.Synchronized). + Select(c => c.Count). FirstOrDefault(); count += (ulong)ctx.Commands.LongCount(c => c.Name == "formats" && !c.Synchronized); @@ -253,7 +264,8 @@ public sealed class StatisticsViewModel : ViewModelBase if(ctx.Commands.Any(c => c.Name == "image-info")) { - ulong count = ctx.Commands.Where(c => c.Name == "image-info" && c.Synchronized).Select(c => c.Count). + ulong count = ctx.Commands.Where(c => c.Name == "image-info" && c.Synchronized). + Select(c => c.Count). FirstOrDefault(); count += (ulong)ctx.Commands.LongCount(c => c.Name == "image-info" && !c.Synchronized); @@ -264,7 +276,8 @@ public sealed class StatisticsViewModel : ViewModelBase if(ctx.Commands.Any(c => c.Name == "media-info")) { - ulong count = ctx.Commands.Where(c => c.Name == "media-info" && c.Synchronized).Select(c => c.Count). + ulong count = ctx.Commands.Where(c => c.Name == "media-info" && c.Synchronized). + Select(c => c.Count). FirstOrDefault(); count += (ulong)ctx.Commands.LongCount(c => c.Name == "media-info" && !c.Synchronized); @@ -275,7 +288,8 @@ public sealed class StatisticsViewModel : ViewModelBase if(ctx.Commands.Any(c => c.Name == "media-scan")) { - ulong count = ctx.Commands.Where(c => c.Name == "media-scan" && c.Synchronized).Select(c => c.Count). + ulong count = ctx.Commands.Where(c => c.Name == "media-scan" && c.Synchronized). + Select(c => c.Count). FirstOrDefault(); count += (ulong)ctx.Commands.LongCount(c => c.Name == "media-scan" && !c.Synchronized); @@ -286,7 +300,8 @@ public sealed class StatisticsViewModel : ViewModelBase if(ctx.Commands.Any(c => c.Name == "printhex")) { - ulong count = ctx.Commands.Where(c => c.Name == "printhex" && c.Synchronized).Select(c => c.Count). + ulong count = ctx.Commands.Where(c => c.Name == "printhex" && c.Synchronized). + Select(c => c.Count). FirstOrDefault(); count += (ulong)ctx.Commands.LongCount(c => c.Name == "printhex" && !c.Synchronized); @@ -297,7 +312,8 @@ public sealed class StatisticsViewModel : ViewModelBase if(ctx.Commands.Any(c => c.Name == "verify")) { - ulong count = ctx.Commands.Where(c => c.Name == "verify" && c.Synchronized).Select(c => c.Count). + ulong count = ctx.Commands.Where(c => c.Name == "verify" && c.Synchronized). + Select(c => c.Count). FirstOrDefault(); count += (ulong)ctx.Commands.LongCount(c => c.Name == "verify" && !c.Synchronized); @@ -306,10 +322,22 @@ public sealed class StatisticsViewModel : ViewModelBase VerifyText = string.Format(UI.You_have_called_the_Verify_command_0_times, count); } - CommandsVisible = FsInfoVisible || ChecksumVisible || CompareVisible || ConvertImageVisible || - CreateSidecarVisible || DecodeVisible || DeviceInfoVisible || DeviceReportVisible || - DumpMediaVisible || EntropyVisible || FormatsCommandVisible || ImageInfoVisible || - MediaInfoVisible || MediaScanVisible || PrintHexVisible || VerifyVisible; + CommandsVisible = FsInfoVisible || + ChecksumVisible || + CompareVisible || + ConvertImageVisible || + CreateSidecarVisible || + DecodeVisible || + DeviceInfoVisible || + DeviceReportVisible || + DumpMediaVisible || + EntropyVisible || + FormatsCommandVisible || + ImageInfoVisible || + MediaInfoVisible || + MediaScanVisible || + PrintHexVisible || + VerifyVisible; } if(ctx.Filters.Any()) @@ -318,7 +346,8 @@ public sealed class StatisticsViewModel : ViewModelBase foreach(string nvs in ctx.Filters.Select(n => n.Name).Distinct()) { - ulong count = ctx.Filters.Where(c => c.Name == nvs && c.Synchronized).Select(c => c.Count). + ulong count = ctx.Filters.Where(c => c.Name == nvs && c.Synchronized). + Select(c => c.Count). FirstOrDefault(); count += (ulong)ctx.Filters.LongCount(c => c.Name == nvs && !c.Synchronized); @@ -337,7 +366,8 @@ public sealed class StatisticsViewModel : ViewModelBase foreach(string nvs in ctx.MediaFormats.Select(n => n.Name).Distinct()) { - ulong count = ctx.MediaFormats.Where(c => c.Name == nvs && c.Synchronized).Select(c => c.Count). + ulong count = ctx.MediaFormats.Where(c => c.Name == nvs && c.Synchronized). + Select(c => c.Count). FirstOrDefault(); count += (ulong)ctx.MediaFormats.LongCount(c => c.Name == nvs && !c.Synchronized); @@ -356,7 +386,8 @@ public sealed class StatisticsViewModel : ViewModelBase foreach(string nvs in ctx.Partitions.Select(n => n.Name).Distinct()) { - ulong count = ctx.Partitions.Where(c => c.Name == nvs && c.Synchronized).Select(c => c.Count). + ulong count = ctx.Partitions.Where(c => c.Name == nvs && c.Synchronized). + Select(c => c.Count). FirstOrDefault(); count += (ulong)ctx.Partitions.LongCount(c => c.Name == nvs && !c.Synchronized); @@ -375,7 +406,8 @@ public sealed class StatisticsViewModel : ViewModelBase foreach(string nvs in ctx.Filesystems.Select(n => n.Name).Distinct()) { - ulong count = ctx.Filesystems.Where(c => c.Name == nvs && c.Synchronized).Select(c => c.Count). + ulong count = ctx.Filesystems.Where(c => c.Name == nvs && c.Synchronized). + Select(c => c.Count). FirstOrDefault(); count += (ulong)ctx.Filesystems.LongCount(c => c.Name == nvs && !c.Synchronized); @@ -392,8 +424,10 @@ public sealed class StatisticsViewModel : ViewModelBase { DevicesVisible = true; - foreach(DeviceStat ds in ctx.SeenDevices.OrderBy(n => n.Manufacturer).ThenBy(n => n.Manufacturer). - ThenBy(n => n.Revision).ThenBy(n => n.Bus)) + foreach(DeviceStat ds in ctx.SeenDevices.OrderBy(n => n.Manufacturer). + ThenBy(n => n.Manufacturer). + ThenBy(n => n.Revision). + ThenBy(n => n.Bus)) { Devices.Add(new DeviceStatsModel { @@ -412,7 +446,8 @@ public sealed class StatisticsViewModel : ViewModelBase foreach(string media in ctx.Medias.OrderBy(ms => ms.Type).Select(ms => ms.Type).Distinct()) { - ulong count = ctx.Medias.Where(c => c.Type == media && c.Synchronized && c.Real).Select(c => c.Count). + ulong count = ctx.Medias.Where(c => c.Type == media && c.Synchronized && c.Real). + Select(c => c.Count). FirstOrDefault(); count += (ulong)ctx.Medias.LongCount(c => c.Type == media && !c.Synchronized && c.Real); @@ -427,7 +462,8 @@ public sealed class StatisticsViewModel : ViewModelBase }); } - count = ctx.Medias.Where(c => c.Type == media && c.Synchronized && !c.Real).Select(c => c.Count). + count = ctx.Medias.Where(c => c.Type == media && c.Synchronized && !c.Real). + Select(c => c.Count). FirstOrDefault(); count += (ulong)ctx.Medias.LongCount(c => c.Type == media && !c.Synchronized && !c.Real); diff --git a/Aaru.Gui/ViewModels/Panels/DeviceInfoViewModel.cs b/Aaru.Gui/ViewModels/Panels/DeviceInfoViewModel.cs index 26f16d2ff..ed5b4ef4a 100644 --- a/Aaru.Gui/ViewModels/Panels/DeviceInfoViewModel.cs +++ b/Aaru.Gui/ViewModels/Panels/DeviceInfoViewModel.cs @@ -186,8 +186,7 @@ public sealed class DeviceInfoViewModel : ViewModelBase }; } - if(devInfo.AtaIdentify != null || - devInfo.AtapiIdentify != null) + if(devInfo.AtaIdentify != null || devInfo.AtapiIdentify != null) { AtaInfo = new AtaInfo { @@ -365,8 +364,7 @@ public sealed class DeviceInfoViewModel : ViewModelBase MaxBlockSize = blockLimits.Value.maxBlockLen > 0 ? string.Format(Localization.Core.Device_maximum_block_size_is_0_bytes, blockLimits.Value.maxBlockLen) - : Localization.Core. - Device_does_not_specify_a_maximum_block_size; + : Localization.Core.Device_does_not_specify_a_maximum_block_size; MinBlockSize = string.Format(Localization.Core.Device_minimum_block_size_is_0_bytes, blockLimits.Value.minBlockLen); @@ -1016,8 +1014,11 @@ public sealed class DeviceInfoViewModel : ViewModelBase dlgSaveBinary.Filters?.Add(new FileDialogFilter { - Extensions = new List(new[] { "*.bin" }), - Name = UI.Dialog_Binary_files + Extensions = new List(new[] + { + "*.bin" + }), + Name = UI.Dialog_Binary_files }); string result = await dlgSaveBinary.ShowAsync(_view); diff --git a/Aaru.Gui/ViewModels/Panels/FileSystemViewModel.cs b/Aaru.Gui/ViewModels/Panels/FileSystemViewModel.cs index e38de93e1..f1b79a03e 100644 --- a/Aaru.Gui/ViewModels/Panels/FileSystemViewModel.cs +++ b/Aaru.Gui/ViewModels/Panels/FileSystemViewModel.cs @@ -76,9 +76,9 @@ public sealed class FileSystemViewModel([NotNull] FileSystem metadata, string in public string BackupDateText { get; } = string.Format(Localization.Core.Volume_last_backed_up_on_0, metadata.BackupDate); - public string ClustersText { get; } = string.Format( - Localization.Core.Volume_has_0_clusters_of_1_bytes_each_total_of_2_bytes, - metadata.Clusters, metadata.ClusterSize, metadata.Clusters * metadata.ClusterSize); + public string ClustersText { get; } = + string.Format(Localization.Core.Volume_has_0_clusters_of_1_bytes_each_total_of_2_bytes, metadata.Clusters, + metadata.ClusterSize, metadata.Clusters * metadata.ClusterSize); public string FreeClustersText { get; } = string.Format(Localization.Core.Volume_has_0_clusters_free_1, metadata.FreeClusters, diff --git a/Aaru.Gui/ViewModels/Panels/ImageInfoViewModel.cs b/Aaru.Gui/ViewModels/Panels/ImageInfoViewModel.cs index 902faf24b..bfab4109d 100644 --- a/Aaru.Gui/ViewModels/Panels/ImageInfoViewModel.cs +++ b/Aaru.Gui/ViewModels/Panels/ImageInfoViewModel.cs @@ -106,10 +106,13 @@ public sealed class ImageInfoViewModel : ViewModelBase MediaLogo = AssetLoader.Exists(mediaResource) ? new Bitmap(AssetLoader.Open(mediaResource)) - : imageFormat.Info.MetadataMediaType == MetadataMediaType.BlockMedia + : + imageFormat.Info.MetadataMediaType == MetadataMediaType.BlockMedia ? genericHddIcon - : imageFormat.Info.MetadataMediaType == MetadataMediaType.OpticalDisc - ? genericOpticalIcon + : + imageFormat.Info.MetadataMediaType == MetadataMediaType.OpticalDisc + ? + genericOpticalIcon : genericFolderIcon; ImagePathText = string.Format(UI.Path_0, imagePath); @@ -154,8 +157,7 @@ public sealed class ImageInfoViewModel : ViewModelBase string.Format(Localization.Core.Last_modified_on_0, imageFormat.Info.LastModificationTime); } - if(imageFormat.Info.MediaSequence != 0 && - imageFormat.Info.LastMediaSequence != 0) + if(imageFormat.Info.MediaSequence != 0 && imageFormat.Info.LastMediaSequence != 0) { MediaSequenceText = string.Format(Localization.Core.Media_is_number_0_on_a_set_of_1_medias, imageFormat.Info.MediaSequence, imageFormat.Info.LastMediaSequence); @@ -297,8 +299,7 @@ public sealed class ImageInfoViewModel : ViewModelBase { errno = imageFormat.ReadMediaTag(MediaTagType.CD_TOC, out toc); - if(errno == ErrorNumber.NoError && - toc.Length > 0) + if(errno == ErrorNumber.NoError && toc.Length > 0) { ushort dataLen = Swapping.Swap(BitConverter.ToUInt16(toc, 0)); @@ -319,8 +320,7 @@ public sealed class ImageInfoViewModel : ViewModelBase { errno = imageFormat.ReadMediaTag(MediaTagType.CD_FullTOC, out fullToc); - if(errno == ErrorNumber.NoError && - fullToc.Length > 0) + if(errno == ErrorNumber.NoError && fullToc.Length > 0) { ushort dataLen = Swapping.Swap(BitConverter.ToUInt16(fullToc, 0)); @@ -341,8 +341,7 @@ public sealed class ImageInfoViewModel : ViewModelBase { errno = imageFormat.ReadMediaTag(MediaTagType.CD_PMA, out pma); - if(errno == ErrorNumber.NoError && - pma.Length > 0) + if(errno == ErrorNumber.NoError && pma.Length > 0) { ushort dataLen = Swapping.Swap(BitConverter.ToUInt16(pma, 0)); @@ -748,13 +747,18 @@ public sealed class ImageInfoViewModel : ViewModelBase public ReactiveCommand ViewSectorsCommand { get; } public ReactiveCommand DecodeMediaTagCommand { get; } - public bool DriveInformationVisible => DriveManufacturerText != null || DriveModelText != null || - DriveSerialNumberText != null || DriveFirmwareRevisionText != null || - MediaGeometryText != null; + public bool DriveInformationVisible => DriveManufacturerText != null || + DriveModelText != null || + DriveSerialNumberText != null || + DriveFirmwareRevisionText != null || + MediaGeometryText != null; - public bool MediaInformationVisible => MediaSequenceText != null || MediaTitleText != null || - MediaManufacturerText != null || MediaModelText != null || - MediaSerialNumberText != null || MediaBarcodeText != null || + public bool MediaInformationVisible => MediaSequenceText != null || + MediaTitleText != null || + MediaManufacturerText != null || + MediaModelText != null || + MediaSerialNumberText != null || + MediaBarcodeText != null || MediaPartNumberText != null; public string ImageInformationLabel => UI.Title_Image_information; diff --git a/Aaru.Gui/ViewModels/Panels/MediaInfoViewModel.cs b/Aaru.Gui/ViewModels/Panels/MediaInfoViewModel.cs index e299c74ff..941fd746e 100644 --- a/Aaru.Gui/ViewModels/Panels/MediaInfoViewModel.cs +++ b/Aaru.Gui/ViewModels/Panels/MediaInfoViewModel.cs @@ -102,8 +102,7 @@ public sealed class MediaInfoViewModel : ViewModelBase MediaType = scsiInfo.MediaType.ToString(); - if(scsiInfo.Blocks != 0 && - scsiInfo.BlockSize != 0) + if(scsiInfo.Blocks != 0 && scsiInfo.BlockSize != 0) { MediaSize = string.Format(Localization.Core.Media_has_0_blocks_of_1_bytes_each_for_a_total_of_2, scsiInfo.Blocks, scsiInfo.BlockSize, @@ -128,7 +127,8 @@ public sealed class MediaInfoViewModel : ViewModelBase SaveRecognizedFormatLayersVisible = scsiInfo.RecognizedFormatLayers != null; SaveWriteProtectionStatusVisible = scsiInfo.WriteProtectionStatus != null; - MmcVisible = SaveGetConfigurationVisible || SaveRecognizedFormatLayersVisible || + MmcVisible = SaveGetConfigurationVisible || + SaveRecognizedFormatLayersVisible || SaveWriteProtectionStatusVisible; if(scsiInfo.DensitySupportHeader.HasValue) @@ -362,8 +362,11 @@ public sealed class MediaInfoViewModel : ViewModelBase dlgSaveBinary.Filters?.Add(new FileDialogFilter { - Extensions = new List(new[] { "*.bin" }), - Name = UI.Dialog_Binary_files + Extensions = new List(new[] + { + "*.bin" + }), + Name = UI.Dialog_Binary_files }); string result = await dlgSaveBinary.ShowAsync(_view); @@ -400,8 +403,9 @@ public sealed class MediaInfoViewModel : ViewModelBase case CommonTypes.MediaType.GDR or CommonTypes.MediaType.GDROM: await MessageBoxManager. GetMessageBoxStandard(UI.Title_Error, - Localization.Core.GD_ROM_dump_support_is_not_yet_implemented, - ButtonEnum.Ok, Icon.Error).ShowWindowDialogAsync(_view); + Localization.Core.GD_ROM_dump_support_is_not_yet_implemented, ButtonEnum.Ok, + Icon.Error). + ShowWindowDialogAsync(_view); return; case CommonTypes.MediaType.XGD or CommonTypes.MediaType.XGD2 or CommonTypes.MediaType.XGD3 @@ -410,7 +414,8 @@ public sealed class MediaInfoViewModel : ViewModelBase GetMessageBoxStandard(UI.Title_Error, Localization.Core. Dumping_Xbox_Game_Discs_requires_a_drive_with_Kreon_firmware, - ButtonEnum.Ok, Icon.Error).ShowWindowDialogAsync(_view); + ButtonEnum.Ok, Icon.Error). + ShowWindowDialogAsync(_view); return; } @@ -432,8 +437,9 @@ public sealed class MediaInfoViewModel : ViewModelBase case CommonTypes.MediaType.GDROM: await MessageBoxManager. GetMessageBoxStandard(UI.Title_Error, - Localization.Core.GD_ROM_scan_support_is_not_yet_implemented, - ButtonEnum.Ok, Icon.Error).ShowWindowDialogAsync(_view); + Localization.Core.GD_ROM_scan_support_is_not_yet_implemented, ButtonEnum.Ok, + Icon.Error). + ShowWindowDialogAsync(_view); return; @@ -444,7 +450,8 @@ public sealed class MediaInfoViewModel : ViewModelBase await MessageBoxManager.GetMessageBoxStandard(UI.Title_Error, Localization.Core. Scanning_Xbox_discs_is_not_yet_supported, - ButtonEnum.Ok, Icon.Error).ShowWindowDialogAsync(_view); + ButtonEnum.Ok, Icon.Error). + ShowWindowDialogAsync(_view); return; } diff --git a/Aaru.Gui/ViewModels/Panels/PartitionViewModel.cs b/Aaru.Gui/ViewModels/Panels/PartitionViewModel.cs index fb922030a..b413c8a19 100644 --- a/Aaru.Gui/ViewModels/Panels/PartitionViewModel.cs +++ b/Aaru.Gui/ViewModels/Panels/PartitionViewModel.cs @@ -43,8 +43,7 @@ public sealed class PartitionViewModel(Partition partition) string.Format(Localization.Core.Partition_start_sector_0_byte_1, partition.Start, partition.Offset); public string LengthText { get; } = string.Format(Localization.Core.Partition_length_0_sectors_1_bytes, - partition.Length, - partition.Size); + partition.Length, partition.Size); public string DescriptionLabelText { get; } = Localization.Core.Title_Partition_description; public string DescriptionText { get; } = partition.Description; diff --git a/Aaru.Gui/ViewModels/Panels/SubdirectoryViewModel.cs b/Aaru.Gui/ViewModels/Panels/SubdirectoryViewModel.cs index 4453f0861..7db67dedb 100644 --- a/Aaru.Gui/ViewModels/Panels/SubdirectoryViewModel.cs +++ b/Aaru.Gui/ViewModels/Panels/SubdirectoryViewModel.cs @@ -79,8 +79,7 @@ public sealed class SubdirectoryViewModel return; } - while(model.Plugin.ReadDir(node, out string dirent) == ErrorNumber.NoError && - dirent is not null) + while(model.Plugin.ReadDir(node, out string dirent) == ErrorNumber.NoError && dirent is not null) { errno = model.Plugin.Stat(model.Path + "/" + dirent, out FileEntryInfo stat); @@ -93,8 +92,7 @@ public sealed class SubdirectoryViewModel continue; } - if(stat.Attributes.HasFlag(FileAttributes.Directory) && - !model.Listed) + if(stat.Attributes.HasFlag(FileAttributes.Directory) && !model.Listed) { model.Subdirectories.Add(new SubdirectoryModel { @@ -197,8 +195,7 @@ public sealed class SubdirectoryViewModel { char[] chars; - if(filename.Last() == '.' || - filename.Last() == ' ') + if(filename.Last() == '.' || filename.Last() == ' ') chars = new char[filename.Length - 1]; else chars = new char[filename.Length]; @@ -272,9 +269,7 @@ public sealed class SubdirectoryViewModel mboxResult = await MessageBoxManager.GetMessageBoxStandard(UI.Unsupported_filename, string. - Format( - UI. - Filename_0_not_supported_want_to_rename_to_1, + Format(UI.Filename_0_not_supported_want_to_rename_to_1, filename, corrected), ButtonEnum.YesNoCancel, Icon.Warning). ShowWindowDialogAsync(_view); @@ -298,9 +293,9 @@ public sealed class SubdirectoryViewModel if(File.Exists(outputPath)) { mboxResult = await MessageBoxManager.GetMessageBoxStandard(UI.Existing_file, - string.Format( - UI.File_named_0_exists_overwrite_Q, - filename), + string. + Format(UI.File_named_0_exists_overwrite_Q, + filename), ButtonEnum.YesNoCancel, Icon.Warning). ShowWindowDialogAsync(_view); @@ -318,8 +313,10 @@ public sealed class SubdirectoryViewModel catch(IOException) { mboxResult = await MessageBoxManager.GetMessageBoxStandard(UI.Cannot_delete, - UI.Could_note_delete_existe_file_continue_Q, ButtonEnum.YesNo, - Icon.Error).ShowWindowDialogAsync(_view); + UI.Could_note_delete_existe_file_continue_Q, + ButtonEnum.YesNo, + Icon.Error). + ShowWindowDialogAsync(_view); if(mboxResult == ButtonResult.No) return; @@ -344,10 +341,11 @@ public sealed class SubdirectoryViewModel if(error != ErrorNumber.NoError) { mboxResult = await MessageBoxManager.GetMessageBoxStandard(UI.Error_reading_file, - string.Format( - UI.Error_0_reading_file_continue_Q, - error), ButtonEnum.YesNo, - Icon.Error).ShowWindowDialogAsync(_view); + string. + Format(UI.Error_0_reading_file_continue_Q, + error), ButtonEnum.YesNo, + Icon.Error). + ShowWindowDialogAsync(_view); if(mboxResult == ButtonResult.No) return; diff --git a/Aaru.Gui/ViewModels/Tabs/AtaInfoViewModel.cs b/Aaru.Gui/ViewModels/Tabs/AtaInfoViewModel.cs index b0b63f99a..f3145aeb3 100644 --- a/Aaru.Gui/ViewModels/Tabs/AtaInfoViewModel.cs +++ b/Aaru.Gui/ViewModels/Tabs/AtaInfoViewModel.cs @@ -58,8 +58,7 @@ public sealed class AtaInfoViewModel : ViewModelBase _atapi = atapiIdentify; _view = view; - if(ataIdentify == null && - atapiIdentify == null) + if(ataIdentify == null && atapiIdentify == null) return; if(ataIdentify != null) @@ -83,8 +82,7 @@ public sealed class AtaInfoViewModel : ViewModelBase AtaMcptWriteProtectionChecked = (ataMcptError.Value.DeviceHead & 0x08) == 0x08; - var specificData = - (ushort)(ataMcptError.Value.CylinderHigh * 0x100 + ataMcptError.Value.CylinderLow); + var specificData = (ushort)(ataMcptError.Value.CylinderHigh * 0x100 + ataMcptError.Value.CylinderLow); AtaMcptSpecificDataText = string.Format(Localization.Core.Card_specific_data_0, specificData); } @@ -120,8 +118,11 @@ public sealed class AtaInfoViewModel : ViewModelBase dlgSaveBinary.Filters?.Add(new FileDialogFilter { - Extensions = new List(new[] { "*.bin" }), - Name = UI.Dialog_Binary_files + Extensions = new List(new[] + { + "*.bin" + }), + Name = UI.Dialog_Binary_files }); string result = await dlgSaveBinary.ShowAsync(_view); @@ -145,8 +146,11 @@ public sealed class AtaInfoViewModel : ViewModelBase dlgSaveText.Filters?.Add(new FileDialogFilter { - Extensions = new List(new[] { "*.txt" }), - Name = UI.Dialog_Text_files + Extensions = new List(new[] + { + "*.txt" + }), + Name = UI.Dialog_Text_files }); string result = await dlgSaveText.ShowAsync(_view); diff --git a/Aaru.Gui/ViewModels/Tabs/BlurayInfoViewModel.cs b/Aaru.Gui/ViewModels/Tabs/BlurayInfoViewModel.cs index 1cf40ccc6..16bd039d7 100644 --- a/Aaru.Gui/ViewModels/Tabs/BlurayInfoViewModel.cs +++ b/Aaru.Gui/ViewModels/Tabs/BlurayInfoViewModel.cs @@ -179,8 +179,11 @@ public sealed class BlurayInfoViewModel dlgSaveBinary.Filters?.Add(new FileDialogFilter { - Extensions = new List(new[] { "*.bin" }), - Name = UI.Dialog_Binary_files + Extensions = new List(new[] + { + "*.bin" + }), + Name = UI.Dialog_Binary_files }); string result = await dlgSaveBinary.ShowAsync(_view); diff --git a/Aaru.Gui/ViewModels/Tabs/CompactDiscInfoViewModel.cs b/Aaru.Gui/ViewModels/Tabs/CompactDiscInfoViewModel.cs index 725d65f9b..f067eff81 100644 --- a/Aaru.Gui/ViewModels/Tabs/CompactDiscInfoViewModel.cs +++ b/Aaru.Gui/ViewModels/Tabs/CompactDiscInfoViewModel.cs @@ -159,8 +159,11 @@ public sealed class CompactDiscInfoViewModel : ViewModelBase dlgSaveBinary.Filters?.Add(new FileDialogFilter { - Extensions = new List(new[] { "*.bin" }), - Name = UI.Dialog_Binary_files + Extensions = new List(new[] + { + "*.bin" + }), + Name = UI.Dialog_Binary_files }); string result = await dlgSaveBinary.ShowAsync(_view); @@ -180,8 +183,11 @@ public sealed class CompactDiscInfoViewModel : ViewModelBase dlgSaveBinary.Filters?.Add(new FileDialogFilter { - Extensions = new List(new[] { "*.bin" }), - Name = UI.Dialog_Binary_files + Extensions = new List(new[] + { + "*.bin" + }), + Name = UI.Dialog_Binary_files }); string result = await dlgSaveBinary.ShowAsync(_view); @@ -201,8 +207,11 @@ public sealed class CompactDiscInfoViewModel : ViewModelBase dlgSaveBinary.Filters?.Add(new FileDialogFilter { - Extensions = new List(new[] { "*.bin" }), - Name = UI.Dialog_Binary_files + Extensions = new List(new[] + { + "*.bin" + }), + Name = UI.Dialog_Binary_files }); string result = await dlgSaveBinary.ShowAsync(_view); @@ -222,8 +231,11 @@ public sealed class CompactDiscInfoViewModel : ViewModelBase dlgSaveBinary.Filters?.Add(new FileDialogFilter { - Extensions = new List(new[] { "*.bin" }), - Name = UI.Dialog_Binary_files + Extensions = new List(new[] + { + "*.bin" + }), + Name = UI.Dialog_Binary_files }); string result = await dlgSaveBinary.ShowAsync(_view); @@ -243,8 +255,11 @@ public sealed class CompactDiscInfoViewModel : ViewModelBase dlgSaveBinary.Filters?.Add(new FileDialogFilter { - Extensions = new List(new[] { "*.bin" }), - Name = UI.Dialog_Binary_files + Extensions = new List(new[] + { + "*.bin" + }), + Name = UI.Dialog_Binary_files }); string result = await dlgSaveBinary.ShowAsync(_view); @@ -264,8 +279,11 @@ public sealed class CompactDiscInfoViewModel : ViewModelBase dlgSaveBinary.Filters?.Add(new FileDialogFilter { - Extensions = new List(new[] { "*.bin" }), - Name = UI.Dialog_Binary_files + Extensions = new List(new[] + { + "*.bin" + }), + Name = UI.Dialog_Binary_files }); string result = await dlgSaveBinary.ShowAsync(_view); @@ -285,8 +303,11 @@ public sealed class CompactDiscInfoViewModel : ViewModelBase dlgSaveBinary.Filters?.Add(new FileDialogFilter { - Extensions = new List(new[] { "*.bin" }), - Name = UI.Dialog_Binary_files + Extensions = new List(new[] + { + "*.bin" + }), + Name = UI.Dialog_Binary_files }); string result = await dlgSaveBinary.ShowAsync(_view); diff --git a/Aaru.Gui/ViewModels/Tabs/DvdInfoViewModel.cs b/Aaru.Gui/ViewModels/Tabs/DvdInfoViewModel.cs index 8efb2c36c..ebaebb7ad 100644 --- a/Aaru.Gui/ViewModels/Tabs/DvdInfoViewModel.cs +++ b/Aaru.Gui/ViewModels/Tabs/DvdInfoViewModel.cs @@ -132,8 +132,11 @@ public sealed class DvdInfoViewModel dlgSaveBinary.Filters?.Add(new FileDialogFilter { - Extensions = new List(new[] { "*.bin" }), - Name = UI.Dialog_Binary_files + Extensions = new List(new[] + { + "*.bin" + }), + Name = UI.Dialog_Binary_files }); string result = await dlgSaveBinary.ShowAsync(_view); diff --git a/Aaru.Gui/ViewModels/Tabs/DvdWritableInfoViewModel.cs b/Aaru.Gui/ViewModels/Tabs/DvdWritableInfoViewModel.cs index 0c1e0f5e9..da7299b44 100644 --- a/Aaru.Gui/ViewModels/Tabs/DvdWritableInfoViewModel.cs +++ b/Aaru.Gui/ViewModels/Tabs/DvdWritableInfoViewModel.cs @@ -260,8 +260,11 @@ public sealed class DvdWritableInfoViewModel dlgSaveBinary.Filters?.Add(new FileDialogFilter { - Extensions = new List(new[] { "*.bin" }), - Name = UI.Dialog_Binary_files + Extensions = new List(new[] + { + "*.bin" + }), + Name = UI.Dialog_Binary_files }); string result = await dlgSaveBinary.ShowAsync(_view); diff --git a/Aaru.Gui/ViewModels/Tabs/PcmciaInfoViewModel.cs b/Aaru.Gui/ViewModels/Tabs/PcmciaInfoViewModel.cs index 6434ea74a..b3f796f19 100644 --- a/Aaru.Gui/ViewModels/Tabs/PcmciaInfoViewModel.cs +++ b/Aaru.Gui/ViewModels/Tabs/PcmciaInfoViewModel.cs @@ -182,8 +182,11 @@ public class PcmciaInfoViewModel : ViewModelBase dlgSaveBinary.Filters?.Add(new FileDialogFilter { - Extensions = new List(new[] { "*.bin" }), - Name = UI.Dialog_Binary_files + Extensions = new List(new[] + { + "*.bin" + }), + Name = UI.Dialog_Binary_files }); string result = await dlgSaveBinary.ShowAsync(_view); diff --git a/Aaru.Gui/ViewModels/Tabs/ScsiInfoViewModel.cs b/Aaru.Gui/ViewModels/Tabs/ScsiInfoViewModel.cs index 36af44a61..0ecb3afa7 100644 --- a/Aaru.Gui/ViewModels/Tabs/ScsiInfoViewModel.cs +++ b/Aaru.Gui/ViewModels/Tabs/ScsiInfoViewModel.cs @@ -82,8 +82,7 @@ public sealed class ScsiInfoViewModel : ViewModelBase SaveEvpdPageCommand = ReactiveCommand.Create(ExecuteSaveEvpdPageCommand); SaveMmcFeaturesCommand = ReactiveCommand.Create(ExecuteSaveMmcFeaturesCommand); - if(InquiryData == null || - !scsiInquiry.HasValue) + if(InquiryData == null || !scsiInquiry.HasValue) return; ScsiInquiryText = Decoders.SCSI.Inquiry.Prettify(scsiInquiry); @@ -110,8 +109,7 @@ public sealed class ScsiInfoViewModel : ViewModelBase { case 0x00: { - if(scsiType == PeripheralDeviceTypes.MultiMediaDevice && - page.Subpage == 0) + if(scsiType == PeripheralDeviceTypes.MultiMediaDevice && page.Subpage == 0) decodedText = Modes.PrettifyModePage_00_SFF(page.PageResponse); else decodedText = UI.Undecoded; @@ -515,40 +513,52 @@ public sealed class ScsiInfoViewModel : ViewModelBase evpdDecodedPage = EVPD.DecodePageB4(page.Value); break; - case 0xC0 when StringHandlers.CToString(scsiInquiry.Value.VendorIdentification).ToLowerInvariant(). - Trim() == "quantum": + case 0xC0 when StringHandlers.CToString(scsiInquiry.Value.VendorIdentification). + ToLowerInvariant(). + Trim() == + "quantum": evpdPageTitle = UI.Quantum_Firmware_Build_Information_page; evpdDecodedPage = EVPD.PrettifyPage_C0_Quantum(page.Value); break; - case 0xC0 when StringHandlers.CToString(scsiInquiry.Value.VendorIdentification).ToLowerInvariant(). - Trim() == "seagate": + case 0xC0 when StringHandlers.CToString(scsiInquiry.Value.VendorIdentification). + ToLowerInvariant(). + Trim() == + "seagate": evpdPageTitle = UI.Seagate_Firmware_Numbers_page; evpdDecodedPage = EVPD.PrettifyPage_C0_Seagate(page.Value); break; - case 0xC0 when StringHandlers.CToString(scsiInquiry.Value.VendorIdentification).ToLowerInvariant(). - Trim() == "ibm": + case 0xC0 when StringHandlers.CToString(scsiInquiry.Value.VendorIdentification). + ToLowerInvariant(). + Trim() == + "ibm": evpdPageTitle = UI.IBM_Drive_Component_Revision_Levels_page; evpdDecodedPage = EVPD.PrettifyPage_C0_IBM(page.Value); break; - case 0xC1 when StringHandlers.CToString(scsiInquiry.Value.VendorIdentification).ToLowerInvariant(). - Trim() == "ibm": + case 0xC1 when StringHandlers.CToString(scsiInquiry.Value.VendorIdentification). + ToLowerInvariant(). + Trim() == + "ibm": evpdPageTitle = UI.IBM_Drive_Serial_Numbers_page; evpdDecodedPage = EVPD.PrettifyPage_C1_IBM(page.Value); break; case 0xC0 or 0xC1 - when StringHandlers.CToString(scsiInquiry.Value.VendorIdentification).ToLowerInvariant(). - Trim() == "certance": + when StringHandlers.CToString(scsiInquiry.Value.VendorIdentification). + ToLowerInvariant(). + Trim() == + "certance": evpdPageTitle = UI.Certance_Drive_Component_Revision_Levels_page; evpdDecodedPage = EVPD.PrettifyPage_C0_C1_Certance(page.Value); break; case 0xC2 or 0xC3 or 0xC4 or 0xC5 or 0xC6 - when StringHandlers.CToString(scsiInquiry.Value.VendorIdentification).ToLowerInvariant(). - Trim() == "certance": + when StringHandlers.CToString(scsiInquiry.Value.VendorIdentification). + ToLowerInvariant(). + Trim() == + "certance": evpdPageTitle = page.Key switch { 0xC2 => UI.Head_Assembly_Serial_Number, @@ -563,8 +573,10 @@ public sealed class ScsiInfoViewModel : ViewModelBase break; case 0xC0 or 0xC1 or 0xC2 or 0xC3 or 0xC4 or 0xC5 - when StringHandlers.CToString(scsiInquiry.Value.VendorIdentification).ToLowerInvariant(). - Trim() == "hp": + when StringHandlers.CToString(scsiInquiry.Value.VendorIdentification). + ToLowerInvariant(). + Trim() == + "hp": evpdPageTitle = page.Key switch { 0xC0 => UI.HP_Drive_Firmware_Revision_Levels_page, @@ -579,8 +591,10 @@ public sealed class ScsiInfoViewModel : ViewModelBase evpdDecodedPage = EVPD.PrettifyPage_C0_to_C5_HP(page.Value); break; - case 0xDF when StringHandlers.CToString(scsiInquiry.Value.VendorIdentification).ToLowerInvariant(). - Trim() == "certance": + case 0xDF when StringHandlers.CToString(scsiInquiry.Value.VendorIdentification). + ToLowerInvariant(). + Trim() == + "certance": evpdPageTitle = UI.Certance_drive_status_page; evpdDecodedPage = EVPD.PrettifyPage_DF_Certance(page.Value); @@ -593,8 +607,8 @@ public sealed class ScsiInfoViewModel : ViewModelBase evpdPageTitle = string.Format(UI.Page_0_h, page.Key); evpdDecodedPage = UI.Undecoded; - AaruConsole.DebugWriteLine(MODULE_NAME, - Localization.Core.Found_undecoded_SCSI_VPD_page_0, page.Key); + AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Core.Found_undecoded_SCSI_VPD_page_0, + page.Key); break; } @@ -614,8 +628,7 @@ public sealed class ScsiInfoViewModel : ViewModelBase Features.SeparatedFeatures ftr = Features.Separate(_configuration); - AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Core.GET_CONFIGURATION_length_is_0, - ftr.DataLength); + AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Core.GET_CONFIGURATION_length_is_0, ftr.DataLength); AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Core.GET_CONFIGURATION_current_profile_is_0, ftr.CurrentProfile); @@ -799,8 +812,11 @@ public sealed class ScsiInfoViewModel : ViewModelBase dlgSaveBinary.Filters?.Add(new FileDialogFilter { - Extensions = new List(new[] { "*.bin" }), - Name = UI.Dialog_Binary_files + Extensions = new List(new[] + { + "*.bin" + }), + Name = UI.Dialog_Binary_files }); string result = await dlgSaveBinary.ShowAsync(_view); @@ -820,8 +836,11 @@ public sealed class ScsiInfoViewModel : ViewModelBase dlgSaveText.Filters?.Add(new FileDialogFilter { - Extensions = new List(new[] { "*.txt" }), - Name = UI.Dialog_Text_files + Extensions = new List(new[] + { + "*.txt" + }), + Name = UI.Dialog_Text_files }); string result = await dlgSaveText.ShowAsync(_view); @@ -841,8 +860,11 @@ public sealed class ScsiInfoViewModel : ViewModelBase dlgSaveBinary.Filters?.Add(new FileDialogFilter { - Extensions = new List(new[] { "*.bin" }), - Name = UI.Dialog_Binary_files + Extensions = new List(new[] + { + "*.bin" + }), + Name = UI.Dialog_Binary_files }); string result = await dlgSaveBinary.ShowAsync(_view); @@ -862,8 +884,11 @@ public sealed class ScsiInfoViewModel : ViewModelBase dlgSaveBinary.Filters?.Add(new FileDialogFilter { - Extensions = new List(new[] { "*.bin" }), - Name = UI.Dialog_Binary_files + Extensions = new List(new[] + { + "*.bin" + }), + Name = UI.Dialog_Binary_files }); string result = await dlgSaveBinary.ShowAsync(_view); @@ -886,8 +911,11 @@ public sealed class ScsiInfoViewModel : ViewModelBase dlgSaveBinary.Filters?.Add(new FileDialogFilter { - Extensions = new List(new[] { "*.bin" }), - Name = UI.Dialog_Binary_files + Extensions = new List(new[] + { + "*.bin" + }), + Name = UI.Dialog_Binary_files }); string result = await dlgSaveBinary.ShowAsync(_view); @@ -907,8 +935,11 @@ public sealed class ScsiInfoViewModel : ViewModelBase dlgSaveBinary.Filters?.Add(new FileDialogFilter { - Extensions = new List(new[] { "*.bin" }), - Name = UI.Dialog_Binary_files + Extensions = new List(new[] + { + "*.bin" + }), + Name = UI.Dialog_Binary_files }); string result = await dlgSaveBinary.ShowAsync(_view); diff --git a/Aaru.Gui/ViewModels/Tabs/XboxInfoViewModel.cs b/Aaru.Gui/ViewModels/Tabs/XboxInfoViewModel.cs index e97c3f4eb..ae8b660d0 100644 --- a/Aaru.Gui/ViewModels/Tabs/XboxInfoViewModel.cs +++ b/Aaru.Gui/ViewModels/Tabs/XboxInfoViewModel.cs @@ -108,8 +108,11 @@ public sealed class XboxInfoViewModel dlgSaveBinary.Filters?.Add(new FileDialogFilter { - Extensions = new List(new[] { "*.bin" }), - Name = UI.Dialog_Binary_files + Extensions = new List(new[] + { + "*.bin" + }), + Name = UI.Dialog_Binary_files }); string result = await dlgSaveBinary.ShowAsync(_view); diff --git a/Aaru.Gui/ViewModels/Windows/ImageChecksumViewModel.cs b/Aaru.Gui/ViewModels/Windows/ImageChecksumViewModel.cs index c6d9f891a..4c2d32955 100644 --- a/Aaru.Gui/ViewModels/Windows/ImageChecksumViewModel.cs +++ b/Aaru.Gui/ViewModels/Windows/ImageChecksumViewModel.cs @@ -419,9 +419,7 @@ public sealed class ImageChecksumViewModel : ViewModelBase ProgressMax = 1; Progress2Max = (int)(_inputFormat.Info.Sectors / SECTORS_TO_READ); - if(formatHasTracks && - ChecksumTracksChecked && - opticalMediaImage != null) + if(formatHasTracks && ChecksumTracksChecked && opticalMediaImage != null) ProgressMax += opticalMediaImage.Tracks.Count; else { @@ -775,14 +773,10 @@ public sealed class ImageChecksumViewModel : ViewModelBase } if(ChecksumTracksChecked) - { await Dispatcher.UIThread.InvokeAsync(() => { TrackChecksumsVisible = true; }); - } if(ChecksumMediaChecked) - { await Dispatcher.UIThread.InvokeAsync(() => { MediaChecksumsVisible = true; }); - } Statistics.AddCommand("checksum"); diff --git a/Aaru.Gui/ViewModels/Windows/ImageConvertViewModel.cs b/Aaru.Gui/ViewModels/Windows/ImageConvertViewModel.cs index 560dfdd83..36c6d6537 100644 --- a/Aaru.Gui/ViewModels/Windows/ImageConvertViewModel.cs +++ b/Aaru.Gui/ViewModels/Windows/ImageConvertViewModel.cs @@ -597,7 +597,8 @@ public sealed class ImageConvertViewModel : ViewModelBase if(SelectedPlugin is null) { await MessageBoxManager.GetMessageBoxStandard(UI.Title_Error, UI.Error_trying_to_find_selected_plugin, - icon: Icon.Error).ShowWindowDialogAsync(_view); + icon: Icon.Error). + ShowWindowDialogAsync(_view); return; } @@ -613,7 +614,8 @@ public sealed class ImageConvertViewModel : ViewModelBase if(plugin is not IWritableImage outputFormat) { await MessageBoxManager.GetMessageBoxStandard(UI.Title_Error, UI.Error_trying_to_find_selected_plugin, - icon: Icon.Error).ShowWindowDialogAsync(_view); + icon: Icon.Error). + ShowWindowDialogAsync(_view); return; } @@ -714,16 +716,13 @@ public sealed class ImageConvertViewModel : ViewModelBase }); foreach(MediaTagType mediaTag in _inputFormat.Info.ReadableMediaTags.Where(mediaTag => - !outputFormat.SupportedMediaTags.Contains(mediaTag) && !ForceChecked)) + !outputFormat.SupportedMediaTags.Contains(mediaTag) && !ForceChecked)) { await Dispatcher.UIThread.InvokeAsync(async () => await MessageBoxManager. GetMessageBoxStandard(UI.Title_Error, string. - Format( - UI. - Converting_image_will_lose_media_tag_0, - mediaTag), - icon: Icon.Error). + Format(UI.Converting_image_will_lose_media_tag_0, + mediaTag), icon: Icon.Error). ShowWindowDialogAsync(_view)); return; @@ -732,7 +731,7 @@ public sealed class ImageConvertViewModel : ViewModelBase bool useLong = _inputFormat.Info.ReadableSectorTags.Count != 0; foreach(SectorTagType sectorTag in _inputFormat.Info.ReadableSectorTags.Where(sectorTag => - !outputFormat.SupportedSectorTags.Contains(sectorTag))) + !outputFormat.SupportedSectorTags.Contains(sectorTag))) { if(ForceChecked) { @@ -747,11 +746,8 @@ public sealed class ImageConvertViewModel : ViewModelBase await Dispatcher.UIThread.InvokeAsync(async () => await MessageBoxManager. GetMessageBoxStandard(UI.Title_Error, string. - Format( - UI. - Converting_image_will_lose_sector_tag_0, - sectorTag), - icon: Icon.Error). + Format(UI.Converting_image_will_lose_sector_tag_0, + sectorTag), icon: Icon.Error). ShowWindowDialogAsync(_view)); return; @@ -805,8 +801,7 @@ public sealed class ImageConvertViewModel : ViewModelBase GetMessageBoxStandard(UI.Title_Error, string. Format(UI.Error_0_creating_output_image, - outputFormat. - ErrorMessage), + outputFormat.ErrorMessage), icon: Icon.Error). ShowWindowDialogAsync(_view)); @@ -852,9 +847,7 @@ public sealed class ImageConvertViewModel : ViewModelBase await Dispatcher.UIThread.InvokeAsync(async () => await MessageBoxManager. GetMessageBoxStandard(UI.Title_Error, string. - Format( - UI. - Error_0_setting_metadata_not_continuing, + Format(UI.Error_0_setting_metadata_not_continuing, outputFormat. ErrorMessage), icon: Icon.Error). @@ -870,9 +863,7 @@ public sealed class ImageConvertViewModel : ViewModelBase } } - if(tracks != null && - !_cancel && - outputOptical != null) + if(tracks != null && !_cancel && outputOptical != null) { await Dispatcher.UIThread.InvokeAsync(() => { @@ -887,9 +878,7 @@ public sealed class ImageConvertViewModel : ViewModelBase await Dispatcher.UIThread.InvokeAsync(async () => await MessageBoxManager. GetMessageBoxStandard(UI.Title_Error, string. - Format( - UI. - Error_0_sending_tracks_list_to_output_image, + Format(UI.Error_0_sending_tracks_list_to_output_image, outputFormat. ErrorMessage), icon: Icon.Error). @@ -918,8 +907,7 @@ public sealed class ImageConvertViewModel : ViewModelBase errno = _inputFormat.ReadMediaTag(mediaTag, out byte[] tag); - if(errno == ErrorNumber.NoError && - outputFormat.WriteMediaTag(tag, mediaTag)) + if(errno == ErrorNumber.NoError && outputFormat.WriteMediaTag(tag, mediaTag)) continue; if(ForceChecked) @@ -935,29 +923,26 @@ public sealed class ImageConvertViewModel : ViewModelBase { if(errno == ErrorNumber.NoError) { - await Dispatcher.UIThread.InvokeAsync(async () => - await MessageBoxManager. - GetMessageBoxStandard(UI.Title_Error, - string. - Format( - UI. - Error_0_writing_media_tag_not_continuing, - outputFormat.ErrorMessage), - icon: Icon.Error).ShowWindowDialogAsync(_view)); + await Dispatcher.UIThread.InvokeAsync(async () => await MessageBoxManager. + GetMessageBoxStandard(UI.Title_Error, + string. + Format(UI.Error_0_writing_media_tag_not_continuing, + outputFormat. + ErrorMessage), + icon: Icon.Error). + ShowWindowDialogAsync(_view)); AaruConsole.ErrorWriteLine(UI.Error_0_writing_media_tag_not_continuing, outputFormat.ErrorMessage); } else { - await Dispatcher.UIThread.InvokeAsync(async () => - await MessageBoxManager. - GetMessageBoxStandard(UI.Title_Error, - string. - Format( - UI. - Error_0_reading_media_tag_not_continuing, - errno), icon: Icon.Error). - ShowWindowDialogAsync(_view)); + await Dispatcher.UIThread.InvokeAsync(async () => await MessageBoxManager. + GetMessageBoxStandard(UI.Title_Error, + string. + Format(UI.Error_0_reading_media_tag_not_continuing, + errno), + icon: Icon.Error). + ShowWindowDialogAsync(_view)); AaruConsole.ErrorWriteLine(UI.Error_0_reading_media_tag_not_continuing, errno); } @@ -968,8 +953,7 @@ public sealed class ImageConvertViewModel : ViewModelBase ulong doneSectors = 0; - if(tracks == null && - !_cancel) + if(tracks == null && !_cancel) { await Dispatcher.UIThread.InvokeAsync(() => { @@ -1053,10 +1037,9 @@ public sealed class ImageConvertViewModel : ViewModelBase await Dispatcher.UIThread.InvokeAsync(async () => await MessageBoxManager. GetMessageBoxStandard(UI.Title_Error, string. - Format( - UI. - Error_0_reading_sector_1_not_continuing, - errno, doneSectors), + Format(UI.Error_0_reading_sector_1_not_continuing, + errno, + doneSectors), icon: Icon.Error). ShowWindowDialogAsync(_view)); @@ -1093,10 +1076,9 @@ public sealed class ImageConvertViewModel : ViewModelBase await Dispatcher.UIThread.InvokeAsync(async () => await MessageBoxManager. GetMessageBoxStandard(UI.Title_Error, string. - Format( - UI. - Error_0_reading_sector_1_not_continuing, - errno, doneSectors), + Format(UI.Error_0_reading_sector_1_not_continuing, + errno, + doneSectors), icon: Icon.Error). ShowWindowDialogAsync(_view)); @@ -1121,10 +1103,9 @@ public sealed class ImageConvertViewModel : ViewModelBase await Dispatcher.UIThread.InvokeAsync(async () => await MessageBoxManager. GetMessageBoxStandard(UI.Title_Error, string. - Format( - UI. - Error_0_writing_sector_1_not_continuing, - outputFormat.ErrorMessage, + Format(UI.Error_0_writing_sector_1_not_continuing, + outputFormat. + ErrorMessage, doneSectors), icon: Icon.Error). ShowWindowDialogAsync(_view)); @@ -1154,7 +1135,8 @@ public sealed class ImageConvertViewModel : ViewModelBase Dictionary smallestPregapLbaPerTrack = new(); foreach(SectorTagType tag in _inputFormat.Info.ReadableSectorTags. - Where(t => t == SectorTagType.CdTrackIsrc).OrderBy(t => t)) + Where(t => t == SectorTagType.CdTrackIsrc). + OrderBy(t => t)) { foreach(Track track in inputOptical.Tracks) { @@ -1168,7 +1150,8 @@ public sealed class ImageConvertViewModel : ViewModelBase } foreach(SectorTagType tag in _inputFormat.Info.ReadableSectorTags. - Where(t => t == SectorTagType.CdTrackFlags).OrderBy(t => t)) + Where(t => t == SectorTagType.CdTrackFlags). + OrderBy(t => t)) { foreach(Track track in inputOptical.Tracks) { @@ -1255,8 +1238,7 @@ public sealed class ImageConvertViewModel : ViewModelBase { Track track = tracks.LastOrDefault(t => t.StartSector >= doneSectors); - if(tag == SectorTagType.CdSectorSubchannel && - track != null) + if(tag == SectorTagType.CdSectorSubchannel && track != null) { bool indexesChanged = CompactDisc.WriteSubchannelToImage(MmcSubchannel.Raw, MmcSubchannel.Raw, sector, doneSectors, 1, null, isrcs, (byte)track.Sequence, @@ -1287,9 +1269,7 @@ public sealed class ImageConvertViewModel : ViewModelBase await Dispatcher.UIThread.InvokeAsync(async () => await MessageBoxManager. GetMessageBoxStandard(UI.Title_Error, string. - Format( - UI. - Error_0_reading_sector_1_not_continuing, + Format(UI.Error_0_reading_sector_1_not_continuing, errno, doneSectors), icon: Icon.Error). ShowWindowDialogAsync(_view)); @@ -1309,8 +1289,7 @@ public sealed class ImageConvertViewModel : ViewModelBase { Track track = tracks.LastOrDefault(t => t.StartSector >= doneSectors); - if(tag == SectorTagType.CdSectorSubchannel && - track != null) + if(tag == SectorTagType.CdSectorSubchannel && track != null) { bool indexesChanged = CompactDisc.WriteSubchannelToImage(MmcSubchannel.Raw, @@ -1342,9 +1321,7 @@ public sealed class ImageConvertViewModel : ViewModelBase await Dispatcher.UIThread.InvokeAsync(async () => await MessageBoxManager. GetMessageBoxStandard(UI.Title_Error, string. - Format( - UI. - Error_0_reading_sector_1_not_continuing, + Format(UI.Error_0_reading_sector_1_not_continuing, errno, doneSectors), icon: Icon.Error). ShowWindowDialogAsync(_view)); @@ -1371,9 +1348,7 @@ public sealed class ImageConvertViewModel : ViewModelBase await Dispatcher.UIThread.InvokeAsync(async () => await MessageBoxManager. GetMessageBoxStandard(UI.Title_Error, string. - Format( - UI. - Error_0_writing_sector_1_not_continuing, + Format(UI.Error_0_writing_sector_1_not_continuing, outputFormat. ErrorMessage, doneSectors), @@ -1410,9 +1385,10 @@ public sealed class ImageConvertViewModel : ViewModelBase if(trackFlags.Count > 0) { foreach(KeyValuePair flags in trackFlags) - { - outputOptical.WriteSectorTag(new[] { flags.Value }, flags.Key, SectorTagType.CdTrackFlags); - } + outputOptical.WriteSectorTag(new[] + { + flags.Value + }, flags.Key, SectorTagType.CdTrackFlags); } if(mcn != null) @@ -1493,9 +1469,7 @@ public sealed class ImageConvertViewModel : ViewModelBase await Dispatcher.UIThread.InvokeAsync(async () => await MessageBoxManager. GetMessageBoxStandard(UI.Title_Error, string. - Format( - UI. - Error_0_reading_sector_1_not_continuing, + Format(UI.Error_0_reading_sector_1_not_continuing, errno, doneSectors), icon: Icon.Error). ShowWindowDialogAsync(_view)); @@ -1533,9 +1507,7 @@ public sealed class ImageConvertViewModel : ViewModelBase await Dispatcher.UIThread.InvokeAsync(async () => await MessageBoxManager. GetMessageBoxStandard(UI.Title_Error, string. - Format( - UI. - Error_0_reading_sector_1_not_continuing, + Format(UI.Error_0_reading_sector_1_not_continuing, errno, doneSectors), icon: Icon.Error). ShowWindowDialogAsync(_view)); @@ -1559,9 +1531,7 @@ public sealed class ImageConvertViewModel : ViewModelBase await Dispatcher.UIThread.InvokeAsync(async () => await MessageBoxManager. GetMessageBoxStandard(UI.Title_Error, string. - Format( - UI. - Error_0_writing_sector_1_not_continuing, + Format(UI.Error_0_writing_sector_1_not_continuing, outputFormat. ErrorMessage, doneSectors), @@ -1639,16 +1609,13 @@ public sealed class ImageConvertViewModel : ViewModelBase } else { - await Dispatcher.UIThread.InvokeAsync(async () => - await MessageBoxManager. - GetMessageBoxStandard(UI.Title_Error, - string. - Format( - UI. - Error_0_reading_media_tag_not_continuing, - errno), - icon: Icon.Error). - ShowWindowDialogAsync(_view)); + await Dispatcher.UIThread.InvokeAsync(async () => await MessageBoxManager. + GetMessageBoxStandard(UI.Title_Error, + string. + Format(UI.Error_0_reading_media_tag_not_continuing, + errno), + icon: Icon.Error). + ShowWindowDialogAsync(_view)); return; } @@ -1667,17 +1634,14 @@ public sealed class ImageConvertViewModel : ViewModelBase } else { - await Dispatcher.UIThread.InvokeAsync(async () => - await MessageBoxManager. - GetMessageBoxStandard(UI.Title_Error, - string. - Format( - UI. - Error_0_writing_tag_not_continuing, - outputFormat. - ErrorMessage), - icon: Icon.Error). - ShowWindowDialogAsync(_view)); + await Dispatcher.UIThread.InvokeAsync(async () => await MessageBoxManager. + GetMessageBoxStandard(UI.Title_Error, + string. + Format(UI.Error_0_writing_tag_not_continuing, + outputFormat. + ErrorMessage), + icon: Icon.Error). + ShowWindowDialogAsync(_view)); return; } @@ -1739,9 +1703,7 @@ public sealed class ImageConvertViewModel : ViewModelBase await Dispatcher.UIThread.InvokeAsync(async () => await MessageBoxManager. GetMessageBoxStandard(UI.Title_Error, string. - Format( - UI. - Error_0_reading_tag_for_sector_1_not_continuing, + Format(UI.Error_0_reading_tag_for_sector_1_not_continuing, errno, doneSectors), icon: Icon.Error). ShowWindowDialogAsync(_view)); @@ -1764,9 +1726,7 @@ public sealed class ImageConvertViewModel : ViewModelBase await Dispatcher.UIThread.InvokeAsync(async () => await MessageBoxManager. GetMessageBoxStandard(UI.Title_Error, string. - Format( - UI. - Error_0_writing_tag_for_sector_1_not_continuing, + Format(UI.Error_0_writing_tag_for_sector_1_not_continuing, outputFormat. ErrorMessage, doneSectors), @@ -1791,8 +1751,7 @@ public sealed class ImageConvertViewModel : ViewModelBase bool ret; - if(_dumpHardware != null && - !_cancel) + if(_dumpHardware != null && !_cancel) { await Dispatcher.UIThread.InvokeAsync(() => { @@ -1808,8 +1767,7 @@ public sealed class ImageConvertViewModel : ViewModelBase ret = false; - if(_aaruMetadata != null && - !_cancel) + if(_aaruMetadata != null && !_cancel) { await Dispatcher.UIThread.InvokeAsync(() => { @@ -1835,7 +1793,8 @@ public sealed class ImageConvertViewModel : ViewModelBase { await MessageBoxManager. GetMessageBoxStandard(UI.Title_Error, UI.Operation_canceled_the_output_file_is_not_correct, - icon: Icon.Error).ShowWindowDialogAsync(_view); + icon: Icon.Error). + ShowWindowDialogAsync(_view); CloseVisible = true; StopVisible = false; @@ -1850,11 +1809,8 @@ public sealed class ImageConvertViewModel : ViewModelBase await Dispatcher.UIThread.InvokeAsync(async () => await MessageBoxManager. GetMessageBoxStandard(UI.Title_Error, string. - Format( - UI. - Error_0_closing_output_image_Contents_are_not_correct, - outputFormat. - ErrorMessage), + Format(UI.Error_0_closing_output_image_Contents_are_not_correct, + outputFormat.ErrorMessage), icon: Icon.Error). ShowWindowDialogAsync(_view)); @@ -1863,12 +1819,12 @@ public sealed class ImageConvertViewModel : ViewModelBase await Dispatcher.UIThread.InvokeAsync(async () => { - await MessageBoxManager. - GetMessageBoxStandard(warning ? UI.Title_Warning : UI.Title_Conversion_success, - warning - ? UI.Some_warnings_happened_Check_console - : UI.Image_converted_successfully, - icon: warning ? Icon.Warning : Icon.Info).ShowWindowDialogAsync(_view); + await MessageBoxManager.GetMessageBoxStandard(warning ? UI.Title_Warning : UI.Title_Conversion_success, + warning + ? UI.Some_warnings_happened_Check_console + : UI.Image_converted_successfully, + icon: warning ? Icon.Warning : Icon.Info). + ShowWindowDialogAsync(_view); CloseVisible = true; StopVisible = false; @@ -2038,8 +1994,7 @@ public sealed class ImageConvertViewModel : ViewModelBase string result = await dlgDestination.ShowAsync(_view); - if(result is null || - result.Length != 1) + if(result is null || result.Length != 1) { DestinationText = ""; @@ -2098,14 +2053,16 @@ public sealed class ImageConvertViewModel : ViewModelBase dlgMetadata.Filters?.Add(new FileDialogFilter { - Name = UI.Dialog_Aaru_Metadata, - Extensions = new List(new[] { ".json" }) + Name = UI.Dialog_Aaru_Metadata, + Extensions = new List(new[] + { + ".json" + }) }); string[] result = await dlgMetadata.ShowAsync(_view); - if(result is null || - result.Length != 1) + if(result is null || result.Length != 1) return; try @@ -2122,7 +2079,8 @@ public sealed class ImageConvertViewModel : ViewModelBase catch { await MessageBoxManager.GetMessageBoxStandard(UI.Title_Error, UI.Incorrect_metadata_sidecar_file, - icon: Icon.Error).ShowWindowDialogAsync(_view); + icon: Icon.Error). + ShowWindowDialogAsync(_view); } } @@ -2144,14 +2102,16 @@ public sealed class ImageConvertViewModel : ViewModelBase dlgMetadata.Filters?.Add(new FileDialogFilter { - Name = UI.Dialog_Choose_existing_resume_file, - Extensions = new List(new[] { ".json" }) + Name = UI.Dialog_Choose_existing_resume_file, + Extensions = new List(new[] + { + ".json" + }) }); string[] result = await dlgMetadata.ShowAsync(_view); - if(result is null || - result.Length != 1) + if(result is null || result.Length != 1) return; try @@ -2173,7 +2133,8 @@ public sealed class ImageConvertViewModel : ViewModelBase { await MessageBoxManager. GetMessageBoxStandard(UI.Title_Error, UI.Resume_file_does_not_contain_dump_hardware_information, - icon: Icon.Error).ShowWindowDialogAsync(_view); + icon: Icon.Error). + ShowWindowDialogAsync(_view); } } catch diff --git a/Aaru.Gui/ViewModels/Windows/ImageSidecarViewModel.cs b/Aaru.Gui/ViewModels/Windows/ImageSidecarViewModel.cs index c1d2c8e1d..da60d7026 100644 --- a/Aaru.Gui/ViewModels/Windows/ImageSidecarViewModel.cs +++ b/Aaru.Gui/ViewModels/Windows/ImageSidecarViewModel.cs @@ -327,8 +327,11 @@ public sealed class ImageSidecarViewModel : ViewModelBase dlgDestination.Filters?.Add(new FileDialogFilter { - Name = UI.Dialog_Aaru_Metadata, - Extensions = new List(new[] { "*.json" }) + Name = UI.Dialog_Aaru_Metadata, + Extensions = new List(new[] + { + "*.json" + }) }); string result = await dlgDestination.ShowAsync(_view); diff --git a/Aaru.Gui/ViewModels/Windows/MainWindowViewModel.cs b/Aaru.Gui/ViewModels/Windows/MainWindowViewModel.cs index 381d686ff..738e01394 100644 --- a/Aaru.Gui/ViewModels/Windows/MainWindowViewModel.cs +++ b/Aaru.Gui/ViewModels/Windows/MainWindowViewModel.cs @@ -147,13 +147,12 @@ public sealed class MainWindowViewModel : ViewModelBase new Bitmap(AssetLoader.Open(new Uri("avares://Aaru.Gui/Assets/Icons/oxygen/32x32/inode-directory.png"))); _usbIcon = - new - Bitmap(AssetLoader.Open( - new Uri("avares://Aaru.Gui/Assets/Icons/oxygen/32x32/drive-removable-media-usb.png"))); + new Bitmap(AssetLoader. + Open(new Uri("avares://Aaru.Gui/Assets/Icons/oxygen/32x32/drive-removable-media-usb.png"))); _removableIcon = - new Bitmap(AssetLoader.Open( - new Uri("avares://Aaru.Gui/Assets/Icons/oxygen/32x32/drive-removable-media.png"))); + new Bitmap(AssetLoader. + Open(new Uri("avares://Aaru.Gui/Assets/Icons/oxygen/32x32/drive-removable-media.png"))); _sdIcon = new Bitmap(AssetLoader.Open(new Uri("avares://Aaru.Gui/Assets/Icons/oxygen/32x32/media-flash-sd-mmc.png"))); @@ -194,8 +193,8 @@ public sealed class MainWindowViewModel : ViewModelBase { get { - Window mainWindow = (Application.Current?.ApplicationLifetime as - IClassicDesktopStyleApplicationLifetime)?.MainWindow; + Window mainWindow = (Application.Current?.ApplicationLifetime as IClassicDesktopStyleApplicationLifetime)?. + MainWindow; return mainWindow is not null && NativeMenu.GetIsNativeMenuExported(mainWindow); } } @@ -559,8 +558,8 @@ public sealed class MainWindowViewModel : ViewModelBase { if(ImageFormat.Detect(inputFilter) is not IMediaImage imageFormat) { - MessageBoxManager.GetMessageBoxStandard(UI.Title_Error, UI.Image_format_not_identified, - ButtonEnum.Ok, Icon.Error); + MessageBoxManager.GetMessageBoxStandard(UI.Title_Error, UI.Image_format_not_identified, ButtonEnum.Ok, + Icon.Error); return; } @@ -574,8 +573,8 @@ public sealed class MainWindowViewModel : ViewModelBase if(opened != ErrorNumber.NoError) { MessageBoxManager.GetMessageBoxStandard(UI.Title_Error, - string.Format(UI.Error_0_opening_image_format, - opened), ButtonEnum.Ok, Icon.Error); + string.Format(UI.Error_0_opening_image_format, opened), + ButtonEnum.Ok, Icon.Error); AaruConsole.ErrorWriteLine(UI.Unable_to_open_image_format); AaruConsole.ErrorWriteLine(UI.No_error_given); @@ -590,10 +589,13 @@ public sealed class MainWindowViewModel : ViewModelBase Path = result[0], Icon = AssetLoader.Exists(mediaResource) ? new Bitmap(AssetLoader.Open(mediaResource)) - : imageFormat.Info.MetadataMediaType == MetadataMediaType.BlockMedia + : + imageFormat.Info.MetadataMediaType == MetadataMediaType.BlockMedia ? _genericHddIcon - : imageFormat.Info.MetadataMediaType == MetadataMediaType.OpticalDisc - ? _genericOpticalIcon + : + imageFormat.Info.MetadataMediaType == MetadataMediaType.OpticalDisc + ? + _genericOpticalIcon : _genericFolderIcon, FileName = Path.GetFileName(result[0]), Image = imageFormat, @@ -662,9 +664,8 @@ public sealed class MainWindowViewModel : ViewModelBase if(rofs != null) { - ErrorNumber error = - rofs.Mount(imageFormat, partition, null, - new Dictionary(), null); + ErrorNumber error = rofs.Mount(imageFormat, partition, null, + new Dictionary(), null); if(error != ErrorNumber.NoError) rofs = null; @@ -677,10 +678,9 @@ public sealed class MainWindowViewModel : ViewModelBase ? $"{fsMetadata.Type}" : $"{fsMetadata.VolumeName} ({fsMetadata.Type})" : $"{rofs.Metadata.VolumeName} ({rofs.Metadata.Type})", - Filesystem = fs, + Filesystem = fs, ReadOnlyFilesystem = rofs, - ViewModel = new FileSystemViewModel(rofs?.Metadata ?? fsMetadata, - information) + ViewModel = new FileSystemViewModel(rofs?.Metadata ?? fsMetadata, information) }; // TODO: Trap expanding item @@ -785,8 +785,8 @@ public sealed class MainWindowViewModel : ViewModelBase } catch(Exception ex) { - MessageBoxManager.GetMessageBoxStandard(UI.Title_Error, UI.Unable_to_open_image_format, - ButtonEnum.Ok, Icon.Error); + MessageBoxManager.GetMessageBoxStandard(UI.Title_Error, UI.Unable_to_open_image_format, ButtonEnum.Ok, + Icon.Error); AaruConsole.ErrorWriteLine(UI.Unable_to_open_image_format); AaruConsole.ErrorWriteLine(Localization.Core.Error_0, ex.Message); @@ -819,7 +819,9 @@ public sealed class MainWindowViewModel : ViewModelBase AaruConsole.WriteLine(UI.Refreshing_devices); _devicesRoot.Devices.Clear(); - foreach(Devices.DeviceInfo device in Device.ListDevices().Where(d => d.Supported).OrderBy(d => d.Vendor). + foreach(Devices.DeviceInfo device in Device.ListDevices(). + Where(d => d.Supported). + OrderBy(d => d.Vendor). ThenBy(d => d.Model)) { AaruConsole.DebugWriteLine(MODULE_NAME, diff --git a/Aaru.Gui/ViewModels/Windows/MediaDumpViewModel.cs b/Aaru.Gui/ViewModels/Windows/MediaDumpViewModel.cs index b4b3b76c4..c080ff2b0 100644 --- a/Aaru.Gui/ViewModels/Windows/MediaDumpViewModel.cs +++ b/Aaru.Gui/ViewModels/Windows/MediaDumpViewModel.cs @@ -183,17 +183,19 @@ public sealed class MediaDumpViewModel : ViewModelBase } } - Encodings.AddRange(Encoding.GetEncodings().Select(info => new EncodingModel - { - Name = info.Name, - DisplayName = info.GetEncoding().EncodingName - })); + Encodings.AddRange(Encoding.GetEncodings(). + Select(info => new EncodingModel + { + Name = info.Name, + DisplayName = info.GetEncoding().EncodingName + })); - Encodings.AddRange(Claunia.Encoding.Encoding.GetEncodings().Select(info => new EncodingModel - { - Name = info.Name, - DisplayName = info.DisplayName - })); + Encodings.AddRange(Claunia.Encoding.Encoding.GetEncodings(). + Select(info => new EncodingModel + { + Name = info.Name, + DisplayName = info.DisplayName + })); switch(mediaType) { @@ -518,8 +520,11 @@ public sealed class MediaDumpViewModel : ViewModelBase dlgMetadata.Filters?.Add(new FileDialogFilter { - Name = UI.Dialog_Aaru_Metadata, - Extensions = new List(new[] { ".json" }) + Name = UI.Dialog_Aaru_Metadata, + Extensions = new List(new[] + { + ".json" + }) }); string[] result = dlgMetadata.ShowAsync(_view).Result; @@ -548,7 +553,9 @@ public sealed class MediaDumpViewModel : ViewModelBase // ReSharper restore AssignmentIsFullyDiscarded GetMessageBoxStandard(UI.Title_Error, UI.Incorrect_metadata_sidecar_file, ButtonEnum.Ok, - Icon.Error).ShowWindowDialogAsync(_view).Result; + Icon.Error). + ShowWindowDialogAsync(_view). + Result; ExistingMetadata = false; } @@ -738,22 +745,22 @@ public sealed class MediaDumpViewModel : ViewModelBase { await MessageBoxManager. GetMessageBoxStandard(UI.Title_Error, UI.Incorrect_resume_file_cannot_use_it, ButtonEnum.Ok, - Icon.Error).ShowWindowDialogAsync(_view); + Icon.Error). + ShowWindowDialogAsync(_view); Resume = false; return; } - if(_resume == null || - _resume.NextBlock <= _resume.LastBlock || - _resume.BadBlocks.Count != 0 && !_resume.Tape) + if(_resume == null || _resume.NextBlock <= _resume.LastBlock || _resume.BadBlocks.Count != 0 && !_resume.Tape) return; await MessageBoxManager. GetMessageBoxStandard(UI.Title_Warning, - UI.Media_already_dumped_correctly_please_choose_another_destination, - ButtonEnum.Ok, Icon.Warning).ShowWindowDialogAsync(_view); + UI.Media_already_dumped_correctly_please_choose_another_destination, ButtonEnum.Ok, + Icon.Warning). + ShowWindowDialogAsync(_view); Resume = false; } diff --git a/Aaru.Gui/ViewModels/Windows/MediaScanViewModel.cs b/Aaru.Gui/ViewModels/Windows/MediaScanViewModel.cs index c59549c35..6be438ddd 100644 --- a/Aaru.Gui/ViewModels/Windows/MediaScanViewModel.cs +++ b/Aaru.Gui/ViewModels/Windows/MediaScanViewModel.cs @@ -337,10 +337,7 @@ public sealed class MediaScanViewModel : ViewModelBase [SuppressMessage("ReSharper", "AsyncVoidMethod")] async void DoWork() { - if(_devicePath.Length == 2 && - _devicePath[1] == ':' && - _devicePath[0] != '/' && - char.IsLetter(_devicePath[0])) + if(_devicePath.Length == 2 && _devicePath[1] == ':' && _devicePath[0] != '/' && char.IsLetter(_devicePath[0])) _devicePath = "\\\\.\\" + char.ToUpper(_devicePath[0]) + ':'; var dev = Device.Create(_devicePath, out ErrorNumber devErrno); @@ -350,7 +347,8 @@ public sealed class MediaScanViewModel : ViewModelBase case null: await MessageBoxManager. GetMessageBoxStandard(UI.Title_Error, string.Format(UI.Error_0_opening_device, devErrno), - ButtonEnum.Ok, Icon.Error).ShowWindowDialogAsync(_view); + ButtonEnum.Ok, Icon.Error). + ShowWindowDialogAsync(_view); StopVisible = false; StartVisible = true; @@ -370,7 +368,8 @@ public sealed class MediaScanViewModel : ViewModelBase { await MessageBoxManager. GetMessageBoxStandard(UI.Title_Error, string.Format(UI.Error_0_opening_device, dev.LastError), - ButtonEnum.Ok, Icon.Error).ShowWindowDialogAsync(_view); + ButtonEnum.Ok, Icon.Error). + ShowWindowDialogAsync(_view); StopVisible = false; StartVisible = true; diff --git a/Aaru.Gui/ViewModels/Windows/SplashWindowViewModel.cs b/Aaru.Gui/ViewModels/Windows/SplashWindowViewModel.cs index bc091a1e7..0f4c5b411 100644 --- a/Aaru.Gui/ViewModels/Windows/SplashWindowViewModel.cs +++ b/Aaru.Gui/ViewModels/Windows/SplashWindowViewModel.cs @@ -144,8 +144,7 @@ public sealed class SplashWindowViewModel(SplashWindow view) : ViewModelBase ctx.Database.EnsureCreated(); ctx.Database. - ExecuteSqlRaw( - "CREATE TABLE IF NOT EXISTS \"__EFMigrationsHistory\" (\"MigrationId\" TEXT PRIMARY KEY, \"ProductVersion\" TEXT)"); + ExecuteSqlRaw("CREATE TABLE IF NOT EXISTS \"__EFMigrationsHistory\" (\"MigrationId\" TEXT PRIMARY KEY, \"ProductVersion\" TEXT)"); foreach(string migration in ctx.Database.GetPendingMigrations()) { @@ -158,21 +157,29 @@ public sealed class SplashWindowViewModel(SplashWindow view) : ViewModelBase } // Remove duplicates - foreach(var duplicate in ctx.SeenDevices.AsEnumerable().GroupBy(a => new - { - a.Manufacturer, - a.Model, - a.Revision, - a.Bus - }).Where(a => a.Count() > 1).Distinct().Select(a => a.Key)) + foreach(var duplicate in ctx.SeenDevices.AsEnumerable(). + GroupBy(a => new + { + a.Manufacturer, + a.Model, + a.Revision, + a.Bus + }). + Where(a => a.Count() > 1). + Distinct(). + Select(a => a.Key)) { ctx.RemoveRange(ctx.SeenDevices. - Where(d => d.Manufacturer == duplicate.Manufacturer && d.Model == duplicate.Model && - d.Revision == duplicate.Revision && d.Bus == duplicate.Bus).Skip(1)); + Where(d => d.Manufacturer == duplicate.Manufacturer && + d.Model == duplicate.Model && + d.Revision == duplicate.Revision && + d.Bus == duplicate.Bus). + Skip(1)); } // Remove nulls - ctx.RemoveRange(ctx.SeenDevices.Where(d => d.Manufacturer == null && d.Model == null && + ctx.RemoveRange(ctx.SeenDevices.Where(d => d.Manufacturer == null && + d.Model == null && d.Revision == null)); ctx.SaveChanges(); diff --git a/Aaru.Helpers b/Aaru.Helpers index bfe4402f0..e59bc3822 160000 --- a/Aaru.Helpers +++ b/Aaru.Helpers @@ -1 +1 @@ -Subproject commit bfe4402f0a2d448149fd5d36daf0da5d003e7853 +Subproject commit e59bc38221d3ee973fc4b991234d959182f6e502 diff --git a/Aaru.Images/A2R/Helpers.cs b/Aaru.Images/A2R/Helpers.cs index 5e6f7da9d..32b1f703a 100644 --- a/Aaru.Images/A2R/Helpers.cs +++ b/Aaru.Images/A2R/Helpers.cs @@ -111,9 +111,10 @@ public sealed partial class A2R uint over = ticks / 255; if(over == 0) - { - return new[] { (byte)ticks }; - } + return new[] + { + (byte)ticks + }; var expanded = new byte[over + 1]; diff --git a/Aaru.Images/A2R/Properties.cs b/Aaru.Images/A2R/Properties.cs index 4506f56f9..7fc4b8f21 100644 --- a/Aaru.Images/A2R/Properties.cs +++ b/Aaru.Images/A2R/Properties.cs @@ -72,7 +72,10 @@ public sealed partial class A2R #region IWritableImage Members /// - public IEnumerable KnownExtensions => new[] { ".a2r" }; + public IEnumerable KnownExtensions => new[] + { + ".a2r" + }; /// public IEnumerable SupportedMediaTags => null; diff --git a/Aaru.Images/A2R/Write.cs b/Aaru.Images/A2R/Write.cs index 32ee5c6eb..b07a98f71 100644 --- a/Aaru.Images/A2R/Write.cs +++ b/Aaru.Images/A2R/Write.cs @@ -85,9 +85,8 @@ public sealed partial class A2R _writingStream.WriteByte(IsCaptureTypeTiming(dataResolution, dataBuffer) ? (byte)1 : (byte)3); _writingStream. - Write( - BitConverter.GetBytes((ushort)HeadTrackSubToA2rLocation(head, track, subTrack, _infoChunkV3.driveType)), - 0, 2); + Write(BitConverter.GetBytes((ushort)HeadTrackSubToA2rLocation(head, track, subTrack, _infoChunkV3.driveType)), + 0, 2); List a2rIndices = FluxRepresentationsToUInt32List(indexBuffer); @@ -268,7 +267,10 @@ public sealed partial class A2R _writingStream.WriteByte(1); _writingStream.Write(BitConverter.GetBytes(_currentResolution), 0, 4); - byte[] reserved = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; + byte[] reserved = + { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 + }; _writingStream.Write(reserved, 0, 11); @@ -316,7 +318,8 @@ public sealed partial class A2R _writingStream.Write(_metaChunkSignature, 0, 4); byte[] metaString = Encoding.UTF8.GetBytes(Meta.Select(static m => $"{m.Key}\t{m.Value}"). - Aggregate(static (concat, str) => $"{concat}\n{str}") + '\n'); + Aggregate(static (concat, str) => $"{concat}\n{str}") + + '\n'); _writingStream.Write(BitConverter.GetBytes((uint)metaString.Length), 0, 4); _writingStream.Write(metaString, 0, metaString.Length); diff --git a/Aaru.Images/AaruFormat/CdEcc.cs b/Aaru.Images/AaruFormat/CdEcc.cs index 84f42ac53..820f27c27 100644 --- a/Aaru.Images/AaruFormat/CdEcc.cs +++ b/Aaru.Images/AaruFormat/CdEcc.cs @@ -164,8 +164,7 @@ public sealed partial class AaruFormat eccA = _eccBTable[_eccFTable[eccA] ^ eccB]; - if(ecc[major + eccOffset] != eccA || - ecc[major + majorCount + eccOffset] != (eccA ^ eccB)) + if(ecc[major + eccOffset] != eccA || ecc[major + majorCount + eccOffset] != (eccA ^ eccB)) return false; } diff --git a/Aaru.Images/AaruFormat/Helpers.cs b/Aaru.Images/AaruFormat/Helpers.cs index d8589ec36..ce670da5f 100644 --- a/Aaru.Images/AaruFormat/Helpers.cs +++ b/Aaru.Images/AaruFormat/Helpers.cs @@ -534,7 +534,8 @@ public sealed partial class AaruFormat DataType.CompactDiscLeadIn, MediaTagType.DVD_DiscKey_Decrypted => DataType. DvdDiscKeyDecrypted, - _ => throw new ArgumentOutOfRangeException( - nameof(tag), tag, null) + _ => throw new + ArgumentOutOfRangeException(nameof(tag), + tag, null) }; } \ No newline at end of file diff --git a/Aaru.Images/AaruFormat/Properties.cs b/Aaru.Images/AaruFormat/Properties.cs index 79b008108..fcb5b0b71 100644 --- a/Aaru.Images/AaruFormat/Properties.cs +++ b/Aaru.Images/AaruFormat/Properties.cs @@ -115,17 +115,19 @@ public sealed partial class AaruFormat ("md5", typeof(bool), Localization.Calculate_and_store_MD5_of_image_user_data, false), ("sha1", typeof(bool), Localization.Calculate_and_store_SHA1_of_image_user_data, false), ("sha256", typeof(bool), Localization.Calculate_and_store_SHA256_of_image_user_data, false), - ("spamsum", typeof(bool), Localization.Calculate_and_store_SpamSum_of_image_user_data, false), ("deduplicate", - typeof(bool), - Localization. - Store_only_unique_sectors_This_consumes_more_memory_and_is_slower_but_its_enabled_by_default, - true), + ("spamsum", typeof(bool), Localization.Calculate_and_store_SpamSum_of_image_user_data, false), + ("deduplicate", typeof(bool), + Localization.Store_only_unique_sectors_This_consumes_more_memory_and_is_slower_but_its_enabled_by_default, + true), ("compress", typeof(bool), Localization.Compress_user_data_blocks_Other_blocks_will_always_be_compressed, (object)true) }; /// - public IEnumerable KnownExtensions => new[] { ".dicf", ".aaru", ".aaruformat", ".aaruf", ".aif" }; + public IEnumerable KnownExtensions => new[] + { + ".dicf", ".aaru", ".aaruformat", ".aaruf", ".aif" + }; /// public bool IsWriting { get; private set; } diff --git a/Aaru.Images/AaruFormat/Read.cs b/Aaru.Images/AaruFormat/Read.cs index f8f871290..28ef33daa 100644 --- a/Aaru.Images/AaruFormat/Read.cs +++ b/Aaru.Images/AaruFormat/Read.cs @@ -68,8 +68,7 @@ public sealed partial class AaruFormat /// public ErrorNumber Open(IFilter imageFilter) { - AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Memory_snapshot_0_bytes, - GC.GetTotalMemory(false)); + AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Memory_snapshot_0_bytes, GC.GetTotalMemory(false)); _imageStream = imageFilter.GetDataForkStream(); _imageStream.Seek(0, SeekOrigin.Begin); @@ -94,8 +93,7 @@ public sealed partial class AaruFormat _imageInfo.Version = $"{_header.imageMajorVersion}.{_header.imageMinorVersion}"; _imageInfo.MediaType = _header.mediaType; - AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Memory_snapshot_0_bytes, - GC.GetTotalMemory(false)); + AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Memory_snapshot_0_bytes, GC.GetTotalMemory(false)); // Read the index header _imageStream.Position = (long)_header.indexOffset; @@ -103,8 +101,7 @@ public sealed partial class AaruFormat _imageStream.EnsureRead(_structureBytes, 0, _structureBytes.Length); IndexHeader idxHeader = Marshal.SpanToStructureLittleEndian(_structureBytes); - if(idxHeader.identifier != BlockType.Index && - idxHeader.identifier != BlockType.Index2) + if(idxHeader.identifier != BlockType.Index && idxHeader.identifier != BlockType.Index2) { AaruConsole.ErrorWriteLine(Localization.Index_not_found); @@ -118,11 +115,10 @@ public sealed partial class AaruFormat _imageStream.EnsureRead(_structureBytes, 0, _structureBytes.Length); IndexHeader2 idxHeader2 = Marshal.SpanToStructureLittleEndian(_structureBytes); - AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Index_at_0_contains_1_entries, - _header.indexOffset, idxHeader2.entries); + AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Index_at_0_contains_1_entries, _header.indexOffset, + idxHeader2.entries); - AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Memory_snapshot_0_bytes, - GC.GetTotalMemory(false)); + AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Memory_snapshot_0_bytes, GC.GetTotalMemory(false)); // Fill in-memory index _index = new List(); @@ -142,11 +138,10 @@ public sealed partial class AaruFormat } else { - AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Index_at_0_contains_1_entries, - _header.indexOffset, idxHeader.entries); + AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Index_at_0_contains_1_entries, _header.indexOffset, + idxHeader.entries); - AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Memory_snapshot_0_bytes, - GC.GetTotalMemory(false)); + AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Memory_snapshot_0_bytes, GC.GetTotalMemory(false)); // Fill in-memory index _index = new List(); @@ -165,8 +160,7 @@ public sealed partial class AaruFormat } } - AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Memory_snapshot_0_bytes, - GC.GetTotalMemory(false)); + AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Memory_snapshot_0_bytes, GC.GetTotalMemory(false)); _imageInfo.ImageSize = 0; @@ -267,8 +261,7 @@ public sealed partial class AaruFormat decompressStopwatch.Stop(); - AaruConsole.DebugWriteLine(MODULE_NAME, - Localization.Took_0_seconds_to_decompress_block, + AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Took_0_seconds_to_decompress_block, decompressStopwatch.Elapsed.TotalSeconds); AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Memory_snapshot_0_bytes, @@ -294,8 +287,7 @@ public sealed partial class AaruFormat // Check CRC, if not correct, skip it Crc64Context.Data(data, out byte[] blockCrc); - if(BitConverter.ToUInt64(blockCrc, 0) != blockHeader.crc64 && - blockHeader.crc64 != 0) + if(BitConverter.ToUInt64(blockCrc, 0) != blockHeader.crc64 && blockHeader.crc64 != 0) { AaruConsole.DebugWriteLine(MODULE_NAME, Localization. @@ -516,8 +508,7 @@ public sealed partial class AaruFormat Localization.Took_0_seconds_to_decompress_DDT, ddtStopwatch.Elapsed.TotalSeconds); - AaruConsole.DebugWriteLine(MODULE_NAME, - Localization.Memory_snapshot_0_bytes, + AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Memory_snapshot_0_bytes, GC.GetTotalMemory(false)); break; @@ -525,17 +516,15 @@ public sealed partial class AaruFormat _inMemoryDdt = false; _outMemoryDdtPosition = (long)entry.offset; - AaruConsole.DebugWriteLine(MODULE_NAME, - Localization.Memory_snapshot_0_bytes, + AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Memory_snapshot_0_bytes, GC.GetTotalMemory(false)); break; default: AaruConsole. ErrorWriteLine(string. - Format( - Localization.Found_unsupported_compression_algorithm_0, - (ushort)ddtHeader.compression)); + Format(Localization.Found_unsupported_compression_algorithm_0, + (ushort)ddtHeader.compression)); return ErrorNumber.NotSupported; } @@ -582,25 +571,22 @@ public sealed partial class AaruFormat Localization.Took_0_seconds_to_decompress_DDT, ddtStopwatch.Elapsed.TotalSeconds); - AaruConsole.DebugWriteLine(MODULE_NAME, - Localization.Memory_snapshot_0_bytes, + AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Memory_snapshot_0_bytes, GC.GetTotalMemory(false)); break; case CompressionType.None: _imageStream.EnsureRead(decompressedDdt, 0, decompressedDdt.Length); - AaruConsole.DebugWriteLine(MODULE_NAME, - Localization.Memory_snapshot_0_bytes, + AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Memory_snapshot_0_bytes, GC.GetTotalMemory(false)); break; default: AaruConsole. ErrorWriteLine(string. - Format( - Localization.Found_unsupported_compression_algorithm_0, - (ushort)ddtHeader.compression)); + Format(Localization.Found_unsupported_compression_algorithm_0, + (ushort)ddtHeader.compression)); return ErrorNumber.NotSupported; } @@ -691,8 +677,7 @@ public sealed partial class AaruFormat _imageInfo.Creator = Encoding.Unicode.GetString(metadata, (int)metadataBlock.creatorOffset, (int)(metadataBlock.creatorLength - 2)); - AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Setting_creator_0, - _imageInfo.Creator); + AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Setting_creator_0, _imageInfo.Creator); } if(metadataBlock.commentsOffset > 0 && @@ -701,8 +686,7 @@ public sealed partial class AaruFormat _imageInfo.Comments = Encoding.Unicode.GetString(metadata, (int)metadataBlock.commentsOffset, (int)(metadataBlock.commentsLength - 2)); - AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Setting_comments_0, - _imageInfo.Comments); + AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Setting_comments_0, _imageInfo.Comments); } if(metadataBlock.mediaTitleOffset > 0 && @@ -888,12 +872,10 @@ public sealed partial class AaruFormat _trackIsrcs.Add(trackEntry.sequence, trackEntry.isrc); } - if(_trackFlags.Count > 0 && - !_imageInfo.ReadableSectorTags.Contains(SectorTagType.CdTrackFlags)) + if(_trackFlags.Count > 0 && !_imageInfo.ReadableSectorTags.Contains(SectorTagType.CdTrackFlags)) _imageInfo.ReadableSectorTags.Add(SectorTagType.CdTrackFlags); - if(_trackIsrcs.Count > 0 && - !_imageInfo.ReadableSectorTags.Contains(SectorTagType.CdTrackIsrc)) + if(_trackIsrcs.Count > 0 && !_imageInfo.ReadableSectorTags.Contains(SectorTagType.CdTrackIsrc)) _imageInfo.ReadableSectorTags.Add(SectorTagType.CdTrackIsrc); _imageInfo.HasPartitions = true; @@ -915,8 +897,8 @@ public sealed partial class AaruFormat if(cicmBlock.identifier != BlockType.CicmBlock) break; - AaruConsole.DebugWriteLine(MODULE_NAME, - Localization.Found_CICM_XML_metadata_block_at_position_0, entry.offset); + AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Found_CICM_XML_metadata_block_at_position_0, + entry.offset); AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Memory_snapshot_0_bytes, GC.GetTotalMemory(false)); @@ -965,8 +947,8 @@ public sealed partial class AaruFormat if(aaruMetadataBlock.identifier != BlockType.AaruMetadataJsonBlock) break; - AaruConsole.DebugWriteLine(MODULE_NAME, - Localization.Found_Aaru_Metadata_block_at_position_0, entry.offset); + AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Found_Aaru_Metadata_block_at_position_0, + entry.offset); AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Memory_snapshot_0_bytes, GC.GetTotalMemory(false)); @@ -982,8 +964,8 @@ public sealed partial class AaruFormat } catch(JsonException ex) { - AaruConsole.DebugWriteLine(MODULE_NAME, - Localization.Exception_0_processing_Aaru_Metadata_block, ex.Message); + AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Exception_0_processing_Aaru_Metadata_block, + ex.Message); AaruMetadata = null; } @@ -1004,8 +986,8 @@ public sealed partial class AaruFormat if(dumpBlock.identifier != BlockType.DumpHardwareBlock) break; - AaruConsole.DebugWriteLine(MODULE_NAME, - Localization.Found_dump_hardware_block_at_position_0, entry.offset); + AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Found_dump_hardware_block_at_position_0, + entry.offset); AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Memory_snapshot_0_bytes, GC.GetTotalMemory(false)); @@ -1146,8 +1128,8 @@ public sealed partial class AaruFormat if(partitionHeader.identifier != BlockType.TapePartitionBlock) break; - AaruConsole.DebugWriteLine(MODULE_NAME, - Localization.Found_tape_partition_block_at_position_0, entry.offset); + AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Found_tape_partition_block_at_position_0, + entry.offset); var tapePartitionBytes = new byte[partitionHeader.length]; _imageStream.EnsureRead(tapePartitionBytes, 0, tapePartitionBytes.Length); @@ -1240,8 +1222,7 @@ public sealed partial class AaruFormat compactDiscIndexes = new List(); - AaruConsole.DebugWriteLine(MODULE_NAME, - Localization.Found_0_compact_disc_indexes_at_position_1, + AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Found_0_compact_disc_indexes_at_position_1, indexesHeader.entries, entry.offset); for(ushort i = 0; i < indexesHeader.entries; i++) @@ -1272,8 +1253,7 @@ public sealed partial class AaruFormat AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Image_created_on_0, _imageInfo.CreationTime); _imageInfo.LastModificationTime = DateTime.FromFileTimeUtc(_header.lastWrittenTime); - AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Image_last_written_on_0, - _imageInfo.LastModificationTime); + AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Image_last_written_on_0, _imageInfo.LastModificationTime); _imageInfo.MetadataMediaType = GetMetadataMediaType(_header.mediaType); @@ -1287,8 +1267,7 @@ public sealed partial class AaruFormat _imageInfo.ReadableMediaTags.AddRange(_mediaTags.Keys); - AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Memory_snapshot_0_bytes, - GC.GetTotalMemory(false)); + AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Memory_snapshot_0_bytes, GC.GetTotalMemory(false)); // Initialize caches _blockCache = new Dictionary(); @@ -1298,8 +1277,7 @@ public sealed partial class AaruFormat if(!_inMemoryDdt) _ddtEntryCache = new Dictionary(); - AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Memory_snapshot_0_bytes, - GC.GetTotalMemory(false)); + AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Memory_snapshot_0_bytes, GC.GetTotalMemory(false)); // Initialize tracks, sessions and partitions if(_imageInfo.MetadataMediaType == MetadataMediaType.OpticalDisc) @@ -1323,8 +1301,7 @@ public sealed partial class AaruFormat Dictionary leadOutStarts = new(); // Lead-out starts foreach(FullTOC.TrackDataDescriptor trk in - decodedFullToc.Value.TrackDescriptors.Where(trk => trk.ADR is 1 or 4 && - trk.POINT == 0xA2)) + decodedFullToc.Value.TrackDescriptors.Where(trk => trk.ADR is 1 or 4 && trk.POINT == 0xA2)) { int phour, pmin, psec, pframe; @@ -1419,11 +1396,9 @@ public sealed partial class AaruFormat } } - AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Memory_snapshot_0_bytes, - GC.GetTotalMemory(false)); + AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Memory_snapshot_0_bytes, GC.GetTotalMemory(false)); - if(Tracks == null || - Tracks.Count == 0) + if(Tracks == null || Tracks.Count == 0) { Tracks = new List { @@ -1443,14 +1418,15 @@ public sealed partial class AaruFormat _trackFlags = new Dictionary { - { 1, (byte)CdFlags.DataTrack } + { + 1, (byte)CdFlags.DataTrack + } }; _trackIsrcs = new Dictionary(); } - AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Memory_snapshot_0_bytes, - GC.GetTotalMemory(false)); + AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Memory_snapshot_0_bytes, GC.GetTotalMemory(false)); Sessions = new List(); @@ -1466,8 +1442,7 @@ public sealed partial class AaruFormat }); } - AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Memory_snapshot_0_bytes, - GC.GetTotalMemory(false)); + AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Memory_snapshot_0_bytes, GC.GetTotalMemory(false)); foreach(Track track in Tracks.OrderBy(t => t.StartSector)) { @@ -1516,8 +1491,7 @@ public sealed partial class AaruFormat currentTrackOffset += (track.EndSector - track.StartSector + 1) * (ulong)track.BytesPerSector; } - AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Memory_snapshot_0_bytes, - GC.GetTotalMemory(false)); + AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Memory_snapshot_0_bytes, GC.GetTotalMemory(false)); Track[] tracks = Tracks.ToArray(); @@ -1544,18 +1518,16 @@ public sealed partial class AaruFormat trk.SubchannelType = TrackSubchannelType.Raw; } - AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Memory_snapshot_0_bytes, - GC.GetTotalMemory(false)); + AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Memory_snapshot_0_bytes, GC.GetTotalMemory(false)); Tracks = tracks.ToList(); - AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Memory_snapshot_0_bytes, - GC.GetTotalMemory(false)); + AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Memory_snapshot_0_bytes, GC.GetTotalMemory(false)); if(compactDiscIndexes != null) { foreach(CompactDiscIndexEntry compactDiscIndex in compactDiscIndexes.OrderBy(i => i.Track). - ThenBy(i => i.Index)) + ThenBy(i => i.Index)) { Track track = Tracks.FirstOrDefault(t => t.Sequence == compactDiscIndex.Track); @@ -1578,27 +1550,21 @@ public sealed partial class AaruFormat if(_sectorSuffixDdt != null) EccInit(); - AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Memory_snapshot_0_bytes, - GC.GetTotalMemory(false)); + AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Memory_snapshot_0_bytes, GC.GetTotalMemory(false)); if(_imageInfo.MetadataMediaType != MetadataMediaType.OpticalDisc) return ErrorNumber.NoError; if(_imageInfo.MediaType is MediaType.CD or MediaType.CDDA or MediaType.CDG or MediaType.CDEG or MediaType.CDI or MediaType.CDROM or MediaType.CDROMXA or MediaType.CDPLUS or MediaType.CDMO - or MediaType.CDR - or MediaType.CDRW or MediaType.CDMRW or MediaType.VCD or MediaType.SVCD or MediaType.PCD - or MediaType.DTSCD - or MediaType.CDMIDI or MediaType.CDV or MediaType.CDIREADY or MediaType.FMTOWNS - or MediaType.PS1CD - or MediaType.PS2CD or MediaType.MEGACD or MediaType.SATURNCD or MediaType.GDROM - or MediaType.GDR + or MediaType.CDR or MediaType.CDRW or MediaType.CDMRW or MediaType.VCD or MediaType.SVCD + or MediaType.PCD or MediaType.DTSCD or MediaType.CDMIDI or MediaType.CDV + or MediaType.CDIREADY or MediaType.FMTOWNS or MediaType.PS1CD or MediaType.PS2CD + or MediaType.MEGACD or MediaType.SATURNCD or MediaType.GDROM or MediaType.GDR or MediaType.MilCD or MediaType.SuperCDROM2 or MediaType.JaguarCD or MediaType.ThreeDO - or MediaType.PCFX - or MediaType.NeoGeoCD or MediaType.CDTV or MediaType.CD32 or MediaType.Playdia - or MediaType.Pippin - or MediaType.VideoNow or MediaType.VideoNowColor or MediaType.VideoNowXp - or MediaType.CVD) + or MediaType.PCFX or MediaType.NeoGeoCD or MediaType.CDTV or MediaType.CD32 + or MediaType.Playdia or MediaType.Pippin or MediaType.VideoNow + or MediaType.VideoNowColor or MediaType.VideoNowXp or MediaType.CVD) return ErrorNumber.NoError; { @@ -1658,8 +1624,7 @@ public sealed partial class AaruFormat blockHeader = Marshal.SpanToStructureLittleEndian(_structureBytes); // Decompress block - AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Memory_snapshot_0_bytes, - GC.GetTotalMemory(false)); + AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Memory_snapshot_0_bytes, GC.GetTotalMemory(false)); ulong decompressedLength; @@ -1669,8 +1634,7 @@ public sealed partial class AaruFormat block = new byte[blockHeader.length]; _imageStream.EnsureRead(block, 0, (int)blockHeader.length); - AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Memory_snapshot_0_bytes, - GC.GetTotalMemory(false)); + AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Memory_snapshot_0_bytes, GC.GetTotalMemory(false)); break; case CompressionType.Lzma: @@ -1690,8 +1654,7 @@ public sealed partial class AaruFormat return ErrorNumber.InOutError; } - AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Memory_snapshot_0_bytes, - GC.GetTotalMemory(false)); + AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Memory_snapshot_0_bytes, GC.GetTotalMemory(false)); break; case CompressionType.Flac: @@ -1709,8 +1672,7 @@ public sealed partial class AaruFormat return ErrorNumber.InOutError; } - AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Memory_snapshot_0_bytes, - GC.GetTotalMemory(false)); + AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Memory_snapshot_0_bytes, GC.GetTotalMemory(false)); break; default: @@ -1733,8 +1695,7 @@ public sealed partial class AaruFormat buffer = new byte[blockHeader.sectorSize]; Array.Copy(block, (long)(offset * blockHeader.sectorSize), buffer, 0, blockHeader.sectorSize); - AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Memory_snapshot_0_bytes, - GC.GetTotalMemory(false)); + AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Memory_snapshot_0_bytes, GC.GetTotalMemory(false)); return ErrorNumber.NoError; } @@ -1817,9 +1778,7 @@ public sealed partial class AaruFormat if(trk is null) return ErrorNumber.SectorNotFound; - if(trk.Sequence == 0 && - trk.StartSector == 0 && - trk.EndSector == 0) + if(trk.Sequence == 0 && trk.StartSector == 0 && trk.EndSector == 0) return ErrorNumber.SectorNotFound; switch(tag) @@ -1844,7 +1803,10 @@ public sealed partial class AaruFormat if(!_trackFlags.TryGetValue((byte)sectorAddress, out byte flags)) return ErrorNumber.NoData; - buffer = new[] { flags }; + buffer = new[] + { + flags + }; return ErrorNumber.NoError; case SectorTagType.CdTrackIsrc: @@ -2111,8 +2073,7 @@ public sealed partial class AaruFormat buffer = new byte[sectorSize * length]; - if(sectorOffset == 0 && - sectorSkip == 0) + if(sectorOffset == 0 && sectorSkip == 0) { Array.Copy(dataSource, (long)(sectorAddress * sectorSize), buffer, 0, length * sectorSize); @@ -2159,8 +2120,10 @@ public sealed partial class AaruFormat return trk?.Sequence != track ? ErrorNumber.SectorNotFound - : trk.StartSector + sectorAddress + length > trk.EndSector + 1 - ? ErrorNumber.OutOfRange + : + trk.StartSector + sectorAddress + length > trk.EndSector + 1 + ? + ErrorNumber.OutOfRange : ReadSectorsTag(trk.StartSector + sectorAddress, length, tag, out buffer); } @@ -2177,9 +2140,7 @@ public sealed partial class AaruFormat if(trk is null) return ErrorNumber.SectorNotFound; - if(trk.Sequence == 0 && - trk.StartSector == 0 && - trk.EndSector == 0) + if(trk.Sequence == 0 && trk.StartSector == 0 && trk.EndSector == 0) return ErrorNumber.SectorNotFound; if((_sectorSuffix == null || _sectorPrefix == null) && @@ -2284,8 +2245,7 @@ public sealed partial class AaruFormat else return ErrorNumber.InvalidArgument; - if(_mode2Subheaders != null && - _sectorSuffixDdt != null) + if(_mode2Subheaders != null && _sectorSuffixDdt != null) { Array.Copy(_mode2Subheaders, (int)sectorAddress * 8, buffer, 16, 8); @@ -2400,9 +2360,7 @@ public sealed partial class AaruFormat if(trk is null) return ErrorNumber.SectorNotFound; - if(trk.Sequence == 0 && - trk.StartSector == 0 && - trk.EndSector == 0) + if(trk.Sequence == 0 && trk.StartSector == 0 && trk.EndSector == 0) return ErrorNumber.SectorNotFound; if(sectorAddress + length > trk.EndSector + 1) @@ -2417,8 +2375,7 @@ public sealed partial class AaruFormat // Join prefix (sync, header) with user data with suffix (edc, ecc p, ecc q) case TrackType.CdMode1: - if(_sectorPrefix != null && - _sectorSuffix != null) + if(_sectorPrefix != null && _sectorSuffix != null) { buffer = new byte[2352 * length]; errno = ReadSectors(sectorAddress, length, out data); @@ -2439,8 +2396,7 @@ public sealed partial class AaruFormat return ErrorNumber.NoError; } - if(_sectorPrefixDdt == null || - _sectorSuffixDdt == null) + if(_sectorPrefixDdt == null || _sectorSuffixDdt == null) return ReadSectors(sectorAddress, length, out buffer); buffer = new byte[2352 * length]; @@ -2461,8 +2417,7 @@ public sealed partial class AaruFormat case TrackType.CdMode2Formless: case TrackType.CdMode2Form1: case TrackType.CdMode2Form2: - if(_sectorPrefix != null && - _sectorSuffix != null) + if(_sectorPrefix != null && _sectorSuffix != null) { buffer = new byte[2352 * length]; errno = ReadSectors(sectorAddress, length, out data); @@ -2480,8 +2435,7 @@ public sealed partial class AaruFormat return ErrorNumber.NoError; } - if(_sectorPrefixDdt == null || - _sectorSuffixDdt == null) + if(_sectorPrefixDdt == null || _sectorSuffixDdt == null) return ReadSectors(sectorAddress, length, out buffer); buffer = new byte[2352 * length]; @@ -2571,8 +2525,10 @@ public sealed partial class AaruFormat return trk?.Sequence != track ? ErrorNumber.SectorNotFound - : trk.StartSector + sectorAddress + length > trk.EndSector + 1 - ? ErrorNumber.OutOfRange + : + trk.StartSector + sectorAddress + length > trk.EndSector + 1 + ? + ErrorNumber.OutOfRange : ReadSectorsLong(trk.StartSector + sectorAddress, length, out buffer); } diff --git a/Aaru.Images/AaruFormat/Verify.cs b/Aaru.Images/AaruFormat/Verify.cs index 901ccb494..fc710c78d 100644 --- a/Aaru.Images/AaruFormat/Verify.cs +++ b/Aaru.Images/AaruFormat/Verify.cs @@ -47,8 +47,7 @@ public sealed partial class AaruFormat public bool? VerifyMediaImage() { // This will traverse all blocks and check their CRC64 without uncompressing them - AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Checking_index_integrity_at_0, - _header.indexOffset); + AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Checking_index_integrity_at_0, _header.indexOffset); _imageStream.Position = (long)_header.indexOffset; @@ -63,8 +62,8 @@ public sealed partial class AaruFormat return false; } - AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Index_at_0_contains_1_entries, - _header.indexOffset, idxHeader.entries); + AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Index_at_0_contains_1_entries, _header.indexOffset, + idxHeader.entries); _structureBytes = new byte[Marshal.SizeOf() * idxHeader.entries]; _imageStream.EnsureRead(_structureBytes, 0, _structureBytes.Length); @@ -88,8 +87,7 @@ public sealed partial class AaruFormat _imageStream.EnsureRead(_structureBytes, 0, _structureBytes.Length); IndexEntry entry = Marshal.SpanToStructureLittleEndian(_structureBytes); - AaruConsole.DebugWriteLine(MODULE_NAME, - Localization.Block_type_0_with_data_type_1_is_indexed_to_be_at_2, + AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Block_type_0_with_data_type_1_is_indexed_to_be_at_2, entry.blockType, entry.dataType, entry.offset); vrIndex.Add(entry); @@ -115,9 +113,8 @@ public sealed partial class AaruFormat crcVerify = new Crc64Context(); readBytes = 0; - AaruConsole.DebugWriteLine(MODULE_NAME, - Localization.Verifying_data_block_type_0_at_position_1, entry.dataType, - entry.offset); + AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Verifying_data_block_type_0_at_position_1, + entry.dataType, entry.offset); while(readBytes + verifySize < blockHeader.cmpLength) { @@ -135,8 +132,7 @@ public sealed partial class AaruFormat if(BitConverter.ToUInt64(verifyCrc, 0) != blockHeader.cmpCrc64) { - AaruConsole.DebugWriteLine(MODULE_NAME, - Localization.Expected_block_CRC_0_X16_but_got_1_X16, + AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Expected_block_CRC_0_X16_but_got_1_X16, blockHeader.cmpCrc64, BitConverter.ToUInt64(verifyCrc, 0)); return false; @@ -192,17 +188,15 @@ public sealed partial class AaruFormat if(BitConverter.ToUInt64(verifyCrc, 0) != trkHeader.crc64) { - AaruConsole.DebugWriteLine(MODULE_NAME, - Localization.Expected_index_CRC_0_X16_but_got_1_X16, trkHeader.crc64, - BitConverter.ToUInt64(verifyCrc, 0)); + AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Expected_index_CRC_0_X16_but_got_1_X16, + trkHeader.crc64, BitConverter.ToUInt64(verifyCrc, 0)); return false; } break; default: - AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Ignored_field_type_0, - entry.blockType); + AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Ignored_field_type_0, entry.blockType); break; } diff --git a/Aaru.Images/AaruFormat/Write.cs b/Aaru.Images/AaruFormat/Write.cs index 4dff02758..3f7686257 100644 --- a/Aaru.Images/AaruFormat/Write.cs +++ b/Aaru.Images/AaruFormat/Write.cs @@ -250,8 +250,7 @@ public sealed partial class AaruFormat _imageStream.EnsureRead(_structureBytes, 0, _structureBytes.Length); _header = Marshal.ByteArrayToStructureLittleEndian(_structureBytes); - if(_header.identifier != DIC_MAGIC && - _header.identifier != AARU_MAGIC) + if(_header.identifier != DIC_MAGIC && _header.identifier != AARU_MAGIC) { ErrorMessage = Localization.Cannot_append_to_a_non_Aaru_Format_image; @@ -329,8 +328,8 @@ public sealed partial class AaruFormat return false; } - AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Index_at_0_contains_1_entries, - _header.indexOffset, idxHeader.entries); + AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Index_at_0_contains_1_entries, _header.indexOffset, + idxHeader.entries); for(ushort i = 0; i < idxHeader.entries; i++) { @@ -393,9 +392,8 @@ public sealed partial class AaruFormat byte[] data; - AaruConsole.DebugWriteLine(MODULE_NAME, - Localization.Found_data_block_type_0_at_position_1, entry.dataType, - entry.offset); + AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Found_data_block_type_0_at_position_1, + entry.dataType, entry.offset); AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Memory_snapshot_0_bytes, GC.GetTotalMemory(false)); @@ -439,8 +437,7 @@ public sealed partial class AaruFormat decompressStopwatch.Stop(); - AaruConsole.DebugWriteLine(MODULE_NAME, - Localization.Took_0_seconds_to_decompress_block, + AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Took_0_seconds_to_decompress_block, decompressStopwatch.Elapsed.TotalSeconds); AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Memory_snapshot_0_bytes, @@ -466,8 +463,7 @@ public sealed partial class AaruFormat // Check CRC, if not correct, skip it Crc64Context.Data(data, out byte[] blockCrc); - if(BitConverter.ToUInt64(blockCrc, 0) != blockHeader.crc64 && - blockHeader.crc64 != 0) + if(BitConverter.ToUInt64(blockCrc, 0) != blockHeader.crc64 && blockHeader.crc64 != 0) { AaruConsole.DebugWriteLine(MODULE_NAME, Localization. @@ -615,15 +611,12 @@ public sealed partial class AaruFormat if(ddtHeader.identifier != BlockType.DeDuplicationTable) break; - if(ddtHeader.entries != _imageInfo.Sectors && - !IsTape) + if(ddtHeader.entries != _imageInfo.Sectors && !IsTape) { ErrorMessage = string. - Format( - Localization. - Trying_to_write_a_media_with_0_sectors_to_an_image_with_1_sectors_not_continuing, - _imageInfo.Sectors, ddtHeader.entries); + Format(Localization.Trying_to_write_a_media_with_0_sectors_to_an_image_with_1_sectors_not_continuing, + _imageInfo.Sectors, ddtHeader.entries); return false; } @@ -652,10 +645,8 @@ public sealed partial class AaruFormat { ErrorMessage = string. - Format( - Localization. - Error_decompressing_DDT_should_be_0_bytes_but_got_1_bytes, - ddtHeader.length, decompressedLength); + Format(Localization.Error_decompressing_DDT_should_be_0_bytes_but_got_1_bytes, + ddtHeader.length, decompressedLength); return false; } @@ -707,10 +698,8 @@ public sealed partial class AaruFormat { ErrorMessage = string. - Format( - Localization. - Trying_to_write_a_media_with_0_sectors_to_an_image_with_1_sectors_not_continuing, - _imageInfo.Sectors, ddtHeader.entries); + Format(Localization.Trying_to_write_a_media_with_0_sectors_to_an_image_with_1_sectors_not_continuing, + _imageInfo.Sectors, ddtHeader.entries); return false; } @@ -738,10 +727,8 @@ public sealed partial class AaruFormat { ErrorMessage = string. - Format( - Localization. - Error_decompressing_DDT_should_be_0_bytes_but_got_1_bytes, - ddtHeader.length, decompressedLength); + Format(Localization.Error_decompressing_DDT_should_be_0_bytes_but_got_1_bytes, + ddtHeader.length, decompressedLength); return false; } @@ -822,8 +809,8 @@ public sealed partial class AaruFormat break; } - AaruConsole.DebugWriteLine(MODULE_NAME, - Localization.Found_metadata_block_at_position_0, entry.offset); + AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Found_metadata_block_at_position_0, + entry.offset); var metadata = new byte[metadataBlock.blockSize]; _imageStream.Position = (long)entry.offset; @@ -834,8 +821,7 @@ public sealed partial class AaruFormat _imageInfo.MediaSequence = metadataBlock.mediaSequence; _imageInfo.LastMediaSequence = metadataBlock.lastMediaSequence; - AaruConsole.DebugWriteLine(MODULE_NAME, - Localization.Setting_media_sequence_as_0_of_1, + AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Setting_media_sequence_as_0_of_1, _imageInfo.MediaSequence, _imageInfo.LastMediaSequence); } @@ -846,8 +832,7 @@ public sealed partial class AaruFormat Encoding.Unicode.GetString(metadata, (int)metadataBlock.creatorOffset, (int)(metadataBlock.creatorLength - 2)); - AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Setting_creator_0, - _imageInfo.Creator); + AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Setting_creator_0, _imageInfo.Creator); } if(metadataBlock.commentsOffset > 0 && @@ -972,8 +957,7 @@ public sealed partial class AaruFormat Encoding.Unicode.GetString(metadata, (int)metadataBlock.driveFirmwareRevisionOffset, (int)(metadataBlock.driveFirmwareRevisionLength - 2)); - AaruConsole.DebugWriteLine(MODULE_NAME, - Localization.Setting_drive_firmware_revision_0, + AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Setting_drive_firmware_revision_0, _imageInfo.DriveFirmwareRevision); } @@ -1049,12 +1033,10 @@ public sealed partial class AaruFormat _trackIsrcs.Add(trackEntry.sequence, trackEntry.isrc); } - if(_trackFlags.Count > 0 && - !_imageInfo.ReadableSectorTags.Contains(SectorTagType.CdTrackFlags)) + if(_trackFlags.Count > 0 && !_imageInfo.ReadableSectorTags.Contains(SectorTagType.CdTrackFlags)) _imageInfo.ReadableSectorTags.Add(SectorTagType.CdTrackFlags); - if(_trackIsrcs.Count > 0 && - !_imageInfo.ReadableSectorTags.Contains(SectorTagType.CdTrackIsrc)) + if(_trackIsrcs.Count > 0 && !_imageInfo.ReadableSectorTags.Contains(SectorTagType.CdTrackIsrc)) _imageInfo.ReadableSectorTags.Add(SectorTagType.CdTrackIsrc); _imageInfo.HasPartitions = true; @@ -1121,8 +1103,8 @@ public sealed partial class AaruFormat if(aaruMetadataBlock.identifier != BlockType.AaruMetadataJsonBlock) break; - AaruConsole.DebugWriteLine(MODULE_NAME, - Localization.Found_Aaru_Metadata_block_at_position_0, entry.offset); + AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Found_Aaru_Metadata_block_at_position_0, + entry.offset); AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Memory_snapshot_0_bytes, GC.GetTotalMemory(false)); @@ -1161,8 +1143,8 @@ public sealed partial class AaruFormat if(dumpBlock.identifier != BlockType.DumpHardwareBlock) break; - AaruConsole.DebugWriteLine(MODULE_NAME, - Localization.Found_dump_hardware_block_at_position_0, entry.offset); + AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Found_dump_hardware_block_at_position_0, + entry.offset); _structureBytes = new byte[dumpBlock.length]; _imageStream.EnsureRead(_structureBytes, 0, _structureBytes.Length); @@ -1297,8 +1279,8 @@ public sealed partial class AaruFormat if(partitionHeader.identifier != BlockType.TapePartitionBlock) break; - AaruConsole.DebugWriteLine(MODULE_NAME, - Localization.Found_tape_partition_block_at_position_0, entry.offset); + AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Found_tape_partition_block_at_position_0, + entry.offset); var tapePartitionBytes = new byte[partitionHeader.length]; _imageStream.EnsureRead(tapePartitionBytes, 0, tapePartitionBytes.Length); @@ -1333,8 +1315,8 @@ public sealed partial class AaruFormat if(fileHeader.identifier != BlockType.TapeFileBlock) break; - AaruConsole.DebugWriteLine(MODULE_NAME, - Localization.Found_tape_file_block_at_position_0, entry.offset); + AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Found_tape_file_block_at_position_0, + entry.offset); var tapeFileBytes = new byte[fileHeader.length]; _imageStream.EnsureRead(tapeFileBytes, 0, tapeFileBytes.Length); @@ -1392,8 +1374,7 @@ public sealed partial class AaruFormat compactDiscIndexes = new List(); - AaruConsole.DebugWriteLine(MODULE_NAME, - Localization.Found_0_compact_disc_indexes_at_position_1, + AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Found_0_compact_disc_indexes_at_position_1, indexesHeader.entries, entry.offset); for(ushort i = 0; i < indexesHeader.entries; i++) @@ -1437,8 +1418,7 @@ public sealed partial class AaruFormat // Initialize tracks, sessions and partitions if(_imageInfo.MetadataMediaType == MetadataMediaType.OpticalDisc) { - if(Tracks != null && - _mediaTags.TryGetValue(MediaTagType.CD_FullTOC, out byte[] fullToc)) + if(Tracks != null && _mediaTags.TryGetValue(MediaTagType.CD_FullTOC, out byte[] fullToc)) { var tmp = new byte[fullToc.Length + 2]; Array.Copy(fullToc, 0, tmp, 2, fullToc.Length); @@ -1452,8 +1432,7 @@ public sealed partial class AaruFormat Dictionary leadOutStarts = new(); // Lead-out starts foreach(FullTOC.TrackDataDescriptor trk in - decodedFullToc.Value.TrackDescriptors.Where(trk => trk.ADR is 1 or 4 && - trk.POINT == 0xA2)) + decodedFullToc.Value.TrackDescriptors.Where(trk => trk.ADR is 1 or 4 && trk.POINT == 0xA2)) { int phour, pmin, psec, pframe; @@ -1512,11 +1491,9 @@ public sealed partial class AaruFormat } } - AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Memory_snapshot_0_bytes, - GC.GetTotalMemory(false)); + AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Memory_snapshot_0_bytes, GC.GetTotalMemory(false)); - if(Tracks == null || - Tracks.Count == 0) + if(Tracks == null || Tracks.Count == 0) { Tracks = new List { @@ -1534,14 +1511,15 @@ public sealed partial class AaruFormat _trackFlags = new Dictionary { - { 1, (byte)CdFlags.DataTrack } + { + 1, (byte)CdFlags.DataTrack + } }; _trackIsrcs = new Dictionary(); } - AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Memory_snapshot_0_bytes, - GC.GetTotalMemory(false)); + AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Memory_snapshot_0_bytes, GC.GetTotalMemory(false)); Sessions = new List(); @@ -1557,8 +1535,7 @@ public sealed partial class AaruFormat }); } - AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Memory_snapshot_0_bytes, - GC.GetTotalMemory(false)); + AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Memory_snapshot_0_bytes, GC.GetTotalMemory(false)); foreach(Track track in Tracks.OrderBy(t => t.StartSector)) { @@ -1600,8 +1577,7 @@ public sealed partial class AaruFormat currentTrackOffset += (track.EndSector - track.StartSector + 1) * (ulong)track.BytesPerSector; } - AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Memory_snapshot_0_bytes, - GC.GetTotalMemory(false)); + AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Memory_snapshot_0_bytes, GC.GetTotalMemory(false)); Track[] tracks = Tracks.ToArray(); @@ -1628,18 +1604,16 @@ public sealed partial class AaruFormat trk.SubchannelType = TrackSubchannelType.Raw; } - AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Memory_snapshot_0_bytes, - GC.GetTotalMemory(false)); + AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Memory_snapshot_0_bytes, GC.GetTotalMemory(false)); Tracks = tracks.ToList(); - AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Memory_snapshot_0_bytes, - GC.GetTotalMemory(false)); + AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Memory_snapshot_0_bytes, GC.GetTotalMemory(false)); if(compactDiscIndexes != null) { foreach(CompactDiscIndexEntry compactDiscIndex in compactDiscIndexes.OrderBy(i => i.Track). - ThenBy(i => i.Index)) + ThenBy(i => i.Index)) { Track track = Tracks.FirstOrDefault(t => t.Sequence == compactDiscIndex.Track); @@ -1759,16 +1733,14 @@ public sealed partial class AaruFormat return false; } - if(sectorAddress >= Info.Sectors && - !IsTape) + if(sectorAddress >= Info.Sectors && !IsTape) { ErrorMessage = Localization.Tried_to_write_past_image_size; return false; } - if((_imageInfo.MetadataMediaType != MetadataMediaType.OpticalDisc || !_writingLong) && - !_rewinded) + if((_imageInfo.MetadataMediaType != MetadataMediaType.OpticalDisc || !_writingLong) && !_rewinded) { if(sectorAddress <= _lastWrittenBlock && _alreadyWrittenZero) { @@ -1824,9 +1796,7 @@ public sealed partial class AaruFormat trk = Tracks.FirstOrDefault(t => sectorAddress >= t.StartSector && sectorAddress <= t.EndSector) ?? new Track(); - if(trk.Sequence == 0 && - trk.StartSector == 0 && - trk.EndSector == 0) + if(trk.Sequence == 0 && trk.StartSector == 0 && trk.EndSector == 0) trk.Type = TrackType.Data; // TODO: Check intersession data type } @@ -1965,8 +1935,7 @@ public sealed partial class AaruFormat int maxBufferSize = (1 << _shift) * data.Length + MAX_FLAKE_BLOCK * 4; - if(_writingBuffer == null || - _writingBuffer.Length < maxBufferSize) + if(_writingBuffer == null || _writingBuffer.Length < maxBufferSize) { _writingBuffer = new byte[maxBufferSize]; _compressedBuffer = new byte[maxBufferSize * 2]; @@ -2051,13 +2020,10 @@ public sealed partial class AaruFormat return false; } - if(track.Sequence == 0 && - track.StartSector == 0 && - track.EndSector == 0) + if(track.Sequence == 0 && track.StartSector == 0 && track.EndSector == 0) track.Type = TrackType.Data; - if(data.Length == 2064 && - _imageInfo.MediaType == MediaType.DVDROM) + if(data.Length == 2064 && _imageInfo.MediaType == MediaType.DVDROM) { sector = new byte[2048]; _sectorId ??= new byte[_imageInfo.Sectors * 4]; @@ -2114,8 +2080,7 @@ public sealed partial class AaruFormat case TrackType.Data: return WriteSector(data, sectorAddress); case TrackType.CdMode1: - if(_sectorPrefix != null && - _sectorSuffix != null) + if(_sectorPrefix != null && _sectorSuffix != null) { sector = new byte[2048]; Array.Copy(data, 0, _sectorPrefix, (int)sectorAddress * 16, 16); @@ -2208,8 +2173,7 @@ public sealed partial class AaruFormat case TrackType.CdMode2Formless: case TrackType.CdMode2Form1: case TrackType.CdMode2Form2: - if(_sectorPrefix != null && - _sectorSuffix != null) + if(_sectorPrefix != null && _sectorSuffix != null) { sector = new byte[2336]; Array.Copy(data, 0, _sectorPrefix, (int)sectorAddress * 16, 16); @@ -2702,9 +2666,8 @@ public sealed partial class AaruFormat if(_deduplicate) { - AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Of_0_sectors_written_1_are_unique_2, - _writtenSectors, _deduplicationTable.Count, - (double)_deduplicationTable.Count / _writtenSectors); + AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Of_0_sectors_written_1_are_unique_2, _writtenSectors, + _deduplicationTable.Count, (double)_deduplicationTable.Count / _writtenSectors); } IndexEntry idxEntry; @@ -2731,8 +2694,8 @@ public sealed partial class AaruFormat offset = (ulong)_imageStream.Position }; - AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Writing_tag_type_0_to_position_1, - mediaTag.Key, idxEntry.offset); + AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Writing_tag_type_0_to_position_1, mediaTag.Key, + idxEntry.offset); Crc64Context.Data(mediaTag.Value, out byte[] tagCrc); @@ -2819,8 +2782,7 @@ public sealed partial class AaruFormat offset = (ulong)_imageStream.Position }; - AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Writing_geometry_block_to_position_0, - idxEntry.offset); + AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Writing_geometry_block_to_position_0, idxEntry.offset); _structureBytes = new byte[Marshal.SizeOf()]; MemoryMarshal.Write(_structureBytes, in _geometryBlock); @@ -3012,10 +2974,7 @@ public sealed partial class AaruFormat } // If we have checksums, write it to disk - if(_md5Provider != null || - _sha1Provider != null || - _sha256Provider != null || - _spamsumProvider != null) + if(_md5Provider != null || _sha1Provider != null || _sha256Provider != null || _spamsumProvider != null) { var chkMs = new MemoryStream(); @@ -3181,8 +3140,7 @@ public sealed partial class AaruFormat offset = (ulong)_imageStream.Position }; - AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Writing_tape_files_to_position_0, - idxEntry.offset); + AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Writing_tape_files_to_position_0, idxEntry.offset); var tapeFileEntries = new TapeFileEntry[Files.Count]; @@ -3229,8 +3187,7 @@ public sealed partial class AaruFormat offset = (ulong)_imageStream.Position }; - AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Writing_user_data_DDT_to_position_0, - idxEntry.offset); + AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Writing_user_data_DDT_to_position_0, idxEntry.offset); var ddtHeader = new DdtHeader { @@ -3272,14 +3229,12 @@ public sealed partial class AaruFormat ddtHeader.cmpLength = (uint)blockStream.Length; - if(_compressionAlgorithm == CompressionType.Lzma && - cmpBuffer != ddtEntries) + if(_compressionAlgorithm == CompressionType.Lzma && cmpBuffer != ddtEntries) ddtHeader.cmpLength += LZMA_PROPERTIES_LENGTH; var cmpCrc64Context = new Crc64Context(); - if(_compressionAlgorithm == CompressionType.Lzma && - cmpBuffer != ddtEntries) + if(_compressionAlgorithm == CompressionType.Lzma && cmpBuffer != ddtEntries) cmpCrc64Context.Update(lzmaProperties); cmpCrc64Context.Update(blockStream.ToArray()); @@ -3308,8 +3263,7 @@ public sealed partial class AaruFormat var compressStopwatch = new Stopwatch(); // Old format - if(_sectorPrefix != null && - _sectorSuffix != null) + if(_sectorPrefix != null && _sectorSuffix != null) { idxEntry = new IndexEntry { @@ -3318,8 +3272,7 @@ public sealed partial class AaruFormat offset = (ulong)_imageStream.Position }; - AaruConsole.DebugWriteLine(MODULE_NAME, - Localization.Writing_CD_sector_prefix_block_to_position_0, + AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Writing_CD_sector_prefix_block_to_position_0, idxEntry.offset); Crc64Context.Data(_sectorPrefix, out byte[] blockCrc); @@ -3410,8 +3363,7 @@ public sealed partial class AaruFormat offset = (ulong)_imageStream.Position }; - AaruConsole.DebugWriteLine(MODULE_NAME, - Localization.Writing_CD_sector_suffix_block_to_position_0, + AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Writing_CD_sector_suffix_block_to_position_0, idxEntry.offset); Crc64Context.Data(_sectorSuffix, out blockCrc); @@ -4042,8 +3994,8 @@ public sealed partial class AaruFormat offset = (ulong)_imageStream.Position }; - AaruConsole.DebugWriteLine(MODULE_NAME, - Localization.Writing_CD_subchannel_block_to_position_0, idxEntry.offset); + AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Writing_CD_subchannel_block_to_position_0, + idxEntry.offset); Crc64Context.Data(_sectorSubchannel, out byte[] blockCrc); @@ -4112,8 +4064,7 @@ public sealed partial class AaruFormat compressStopwatch.Stop(); - AaruConsole.DebugWriteLine(MODULE_NAME, - Localization.Took_0_seconds_to_compress_subchannel, + AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Took_0_seconds_to_compress_subchannel, compressStopwatch.Elapsed.TotalSeconds); } @@ -4127,8 +4078,10 @@ public sealed partial class AaruFormat _imageStream.Write(blockStream.ToArray(), 0, (int)blockStream.Length); - _index.RemoveAll( - t => t is { blockType: BlockType.DataBlock, dataType: DataType.CdSectorSubchannel }); + _index.RemoveAll(t => t is + { + blockType: BlockType.DataBlock, dataType: DataType.CdSectorSubchannel + }); _index.Add(idxEntry); blockStream.Close(); @@ -4143,8 +4096,8 @@ public sealed partial class AaruFormat offset = (ulong)_imageStream.Position }; - AaruConsole.DebugWriteLine(MODULE_NAME, - Localization.Writing_DVD_CPR_MAI_block_to_position_0, idxEntry.offset); + AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Writing_DVD_CPR_MAI_block_to_position_0, + idxEntry.offset); Crc64Context.Data(_sectorCprMai, out byte[] blockCrc); @@ -4209,8 +4162,7 @@ public sealed partial class AaruFormat compressStopwatch.Stop(); - AaruConsole.DebugWriteLine(MODULE_NAME, - Localization.Took_0_seconds_to_compress_CPR_MAI, + AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Took_0_seconds_to_compress_CPR_MAI, compressStopwatch.Elapsed.TotalSeconds); } @@ -4239,8 +4191,8 @@ public sealed partial class AaruFormat offset = (ulong)_imageStream.Position }; - AaruConsole.DebugWriteLine(MODULE_NAME, - Localization.Writing_DVD_ID_block_to_position_0, idxEntry.offset); + AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Writing_DVD_ID_block_to_position_0, + idxEntry.offset); Crc64Context.Data(_sectorId, out byte[] blockCrc); @@ -4273,8 +4225,8 @@ public sealed partial class AaruFormat switch(_compressionAlgorithm) { case CompressionType.Lzma: - cmpLen = LZMA.EncodeBuffer(_sectorId, cmpBuffer, out lzmaProperties, 9, - _dictionarySize, 4, 0, 2, 273); + cmpLen = LZMA.EncodeBuffer(_sectorId, cmpBuffer, out lzmaProperties, 9, _dictionarySize, + 4, 0, 2, 273); break; case CompressionType.None: @@ -4305,8 +4257,7 @@ public sealed partial class AaruFormat compressStopwatch.Stop(); - AaruConsole.DebugWriteLine(MODULE_NAME, - Localization.Took_0_seconds_to_compress_ID, + AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Took_0_seconds_to_compress_ID, compressStopwatch.Elapsed.TotalSeconds); } @@ -4314,8 +4265,7 @@ public sealed partial class AaruFormat MemoryMarshal.Write(_structureBytes, in idBlock); _imageStream.Write(_structureBytes, 0, _structureBytes.Length); - if(idBlock.compression is CompressionType.Lzma - or CompressionType.LzmaClauniaSubchannelTransform) + if(idBlock.compression is CompressionType.Lzma or CompressionType.LzmaClauniaSubchannelTransform) _imageStream.Write(lzmaProperties, 0, lzmaProperties.Length); _imageStream.Write(blockStream.ToArray(), 0, (int)blockStream.Length); @@ -4335,8 +4285,8 @@ public sealed partial class AaruFormat offset = (ulong)_imageStream.Position }; - AaruConsole.DebugWriteLine(MODULE_NAME, - Localization.Writing_DVD_IED_block_to_position_0, idxEntry.offset); + AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Writing_DVD_IED_block_to_position_0, + idxEntry.offset); Crc64Context.Data(_sectorIed, out byte[] blockCrc); @@ -4401,8 +4351,7 @@ public sealed partial class AaruFormat compressStopwatch.Stop(); - AaruConsole.DebugWriteLine(MODULE_NAME, - Localization.Took_0_seconds_to_compress_IED, + AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Took_0_seconds_to_compress_IED, compressStopwatch.Elapsed.TotalSeconds); } @@ -4410,8 +4359,7 @@ public sealed partial class AaruFormat MemoryMarshal.Write(_structureBytes, in iedBlock); _imageStream.Write(_structureBytes, 0, _structureBytes.Length); - if(iedBlock.compression is CompressionType.Lzma - or CompressionType.LzmaClauniaSubchannelTransform) + if(iedBlock.compression is CompressionType.Lzma or CompressionType.LzmaClauniaSubchannelTransform) _imageStream.Write(lzmaProperties, 0, lzmaProperties.Length); _imageStream.Write(blockStream.ToArray(), 0, (int)blockStream.Length); @@ -4431,8 +4379,8 @@ public sealed partial class AaruFormat offset = (ulong)_imageStream.Position }; - AaruConsole.DebugWriteLine(MODULE_NAME, - Localization.Writing_DVD_EDC_block_to_position_0, idxEntry.offset); + AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Writing_DVD_EDC_block_to_position_0, + idxEntry.offset); Crc64Context.Data(_sectorEdc, out byte[] blockCrc); @@ -4497,8 +4445,7 @@ public sealed partial class AaruFormat compressStopwatch.Stop(); - AaruConsole.DebugWriteLine(MODULE_NAME, - Localization.Took_0_seconds_to_compress_EDC, + AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Took_0_seconds_to_compress_EDC, compressStopwatch.Elapsed.TotalSeconds); } @@ -4506,8 +4453,7 @@ public sealed partial class AaruFormat MemoryMarshal.Write(_structureBytes, in edcBlock); _imageStream.Write(_structureBytes, 0, _structureBytes.Length); - if(edcBlock.compression is CompressionType.Lzma - or CompressionType.LzmaClauniaSubchannelTransform) + if(edcBlock.compression is CompressionType.Lzma or CompressionType.LzmaClauniaSubchannelTransform) _imageStream.Write(lzmaProperties, 0, lzmaProperties.Length); _imageStream.Write(blockStream.ToArray(), 0, (int)blockStream.Length); @@ -4627,8 +4573,7 @@ public sealed partial class AaruFormat _trackFlags.TryGetValue((byte)track.Sequence, out byte flags); _trackIsrcs.TryGetValue((byte)track.Sequence, out string isrc); - if((flags & (int)CdFlags.DataTrack) == 0 && - track.Type != TrackType.Audio) + if((flags & (int)CdFlags.DataTrack) == 0 && track.Type != TrackType.Audio) flags += (byte)CdFlags.DataTrack; trackEntries.Add(new TrackEntry @@ -4742,8 +4687,7 @@ public sealed partial class AaruFormat crc64 = BitConverter.ToUInt64(cdixCrc, 0) }; - AaruConsole.DebugWriteLine(MODULE_NAME, - Localization.Writing_compact_disc_indexes_to_position_0, + AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Writing_compact_disc_indexes_to_position_0, _imageStream.Position); _index.RemoveAll(t => t is @@ -4800,8 +4744,7 @@ public sealed partial class AaruFormat offset = (ulong)_imageStream.Position }; - AaruConsole.DebugWriteLine(MODULE_NAME, - Localization.Writing_apple_sector_tag_block_to_position_0, + AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Writing_apple_sector_tag_block_to_position_0, idxEntry.offset); Crc64Context.Data(_sectorSubchannel, out byte[] blockCrc); @@ -4848,9 +4791,8 @@ public sealed partial class AaruFormat int cmpLen = _compressionAlgorithm switch { - CompressionType.Lzma => LZMA.EncodeBuffer( - _sectorSubchannel, cmpBuffer, out lzmaProperties, - 9, _dictionarySize, 4, 0, 2, 273), + CompressionType.Lzma => LZMA.EncodeBuffer(_sectorSubchannel, cmpBuffer, + out lzmaProperties, 9, _dictionarySize, 4, 0, 2, 273), _ => throw new ArgumentOutOfRangeException() }; @@ -4912,7 +4854,10 @@ public sealed partial class AaruFormat metadataBlock.creatorLength = (uint)(tmpUtf16Le.Length + 2); blockStream.Write(tmpUtf16Le, 0, tmpUtf16Le.Length); - blockStream.Write(new byte[] { 0, 0 }, 0, 2); + blockStream.Write(new byte[] + { + 0, 0 + }, 0, 2); } if(!string.IsNullOrWhiteSpace(_imageInfo.Comments)) @@ -4923,7 +4868,10 @@ public sealed partial class AaruFormat metadataBlock.commentsLength = (uint)(tmpUtf16Le.Length + 2); blockStream.Write(tmpUtf16Le, 0, tmpUtf16Le.Length); - blockStream.Write(new byte[] { 0, 0 }, 0, 2); + blockStream.Write(new byte[] + { + 0, 0 + }, 0, 2); } if(!string.IsNullOrWhiteSpace(_imageInfo.MediaTitle)) @@ -4934,7 +4882,10 @@ public sealed partial class AaruFormat metadataBlock.mediaTitleLength = (uint)(tmpUtf16Le.Length + 2); blockStream.Write(tmpUtf16Le, 0, tmpUtf16Le.Length); - blockStream.Write(new byte[] { 0, 0 }, 0, 2); + blockStream.Write(new byte[] + { + 0, 0 + }, 0, 2); } if(!string.IsNullOrWhiteSpace(_imageInfo.MediaManufacturer)) @@ -4945,7 +4896,10 @@ public sealed partial class AaruFormat metadataBlock.mediaManufacturerLength = (uint)(tmpUtf16Le.Length + 2); blockStream.Write(tmpUtf16Le, 0, tmpUtf16Le.Length); - blockStream.Write(new byte[] { 0, 0 }, 0, 2); + blockStream.Write(new byte[] + { + 0, 0 + }, 0, 2); } if(!string.IsNullOrWhiteSpace(_imageInfo.MediaModel)) @@ -4956,7 +4910,10 @@ public sealed partial class AaruFormat metadataBlock.mediaModelLength = (uint)(tmpUtf16Le.Length + 2); blockStream.Write(tmpUtf16Le, 0, tmpUtf16Le.Length); - blockStream.Write(new byte[] { 0, 0 }, 0, 2); + blockStream.Write(new byte[] + { + 0, 0 + }, 0, 2); } if(!string.IsNullOrWhiteSpace(_imageInfo.MediaSerialNumber)) @@ -4967,7 +4924,10 @@ public sealed partial class AaruFormat metadataBlock.mediaSerialNumberLength = (uint)(tmpUtf16Le.Length + 2); blockStream.Write(tmpUtf16Le, 0, tmpUtf16Le.Length); - blockStream.Write(new byte[] { 0, 0 }, 0, 2); + blockStream.Write(new byte[] + { + 0, 0 + }, 0, 2); } if(!string.IsNullOrWhiteSpace(_imageInfo.MediaBarcode)) @@ -4978,7 +4938,10 @@ public sealed partial class AaruFormat metadataBlock.mediaBarcodeLength = (uint)(tmpUtf16Le.Length + 2); blockStream.Write(tmpUtf16Le, 0, tmpUtf16Le.Length); - blockStream.Write(new byte[] { 0, 0 }, 0, 2); + blockStream.Write(new byte[] + { + 0, 0 + }, 0, 2); } if(!string.IsNullOrWhiteSpace(_imageInfo.MediaPartNumber)) @@ -4989,7 +4952,10 @@ public sealed partial class AaruFormat metadataBlock.mediaPartNumberLength = (uint)(tmpUtf16Le.Length + 2); blockStream.Write(tmpUtf16Le, 0, tmpUtf16Le.Length); - blockStream.Write(new byte[] { 0, 0 }, 0, 2); + blockStream.Write(new byte[] + { + 0, 0 + }, 0, 2); } if(!string.IsNullOrWhiteSpace(_imageInfo.DriveManufacturer)) @@ -5000,7 +4966,10 @@ public sealed partial class AaruFormat metadataBlock.driveManufacturerLength = (uint)(tmpUtf16Le.Length + 2); blockStream.Write(tmpUtf16Le, 0, tmpUtf16Le.Length); - blockStream.Write(new byte[] { 0, 0 }, 0, 2); + blockStream.Write(new byte[] + { + 0, 0 + }, 0, 2); } if(!string.IsNullOrWhiteSpace(_imageInfo.DriveModel)) @@ -5011,7 +4980,10 @@ public sealed partial class AaruFormat metadataBlock.driveModelLength = (uint)(tmpUtf16Le.Length + 2); blockStream.Write(tmpUtf16Le, 0, tmpUtf16Le.Length); - blockStream.Write(new byte[] { 0, 0 }, 0, 2); + blockStream.Write(new byte[] + { + 0, 0 + }, 0, 2); } if(!string.IsNullOrWhiteSpace(_imageInfo.DriveSerialNumber)) @@ -5022,7 +4994,10 @@ public sealed partial class AaruFormat metadataBlock.driveSerialNumberLength = (uint)(tmpUtf16Le.Length + 2); blockStream.Write(tmpUtf16Le, 0, tmpUtf16Le.Length); - blockStream.Write(new byte[] { 0, 0 }, 0, 2); + blockStream.Write(new byte[] + { + 0, 0 + }, 0, 2); } if(!string.IsNullOrWhiteSpace(_imageInfo.DriveFirmwareRevision)) @@ -5033,14 +5008,16 @@ public sealed partial class AaruFormat metadataBlock.driveFirmwareRevisionLength = (uint)(tmpUtf16Le.Length + 2); blockStream.Write(tmpUtf16Le, 0, tmpUtf16Le.Length); - blockStream.Write(new byte[] { 0, 0 }, 0, 2); + blockStream.Write(new byte[] + { + 0, 0 + }, 0, 2); } // Check if we set up any metadata earlier, then write its block if(metadataBlock.identifier == BlockType.MetadataBlock) { - AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Writing_metadata_to_position_0, - _imageStream.Position); + AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Writing_metadata_to_position_0, _imageStream.Position); metadataBlock.blockSize = (uint)blockStream.Length; _structureBytes = new byte[Marshal.SizeOf()]; @@ -5215,8 +5192,7 @@ public sealed partial class AaruFormat track = Tracks.FirstOrDefault(trk => sectorAddress == trk.Sequence); - if(track is null || - track.Sequence == 0 && track.StartSector == 0 && track.EndSector == 0) + if(track is null || track.Sequence == 0 && track.StartSector == 0 && track.EndSector == 0) { ErrorMessage = string.Format(Localization.Cant_find_track_0, sectorAddress); diff --git a/Aaru.Images/Alcohol120/Properties.cs b/Aaru.Images/Alcohol120/Properties.cs index b2c40857f..ae29b88ad 100644 --- a/Aaru.Images/Alcohol120/Properties.cs +++ b/Aaru.Images/Alcohol120/Properties.cs @@ -83,8 +83,7 @@ public sealed partial class Alcohol120 { get { - if(_writingTracks != null && - _alcTracks == null) + if(_writingTracks != null && _alcTracks == null) return _writingTracks; List tracks = new(); @@ -121,8 +120,7 @@ public sealed partial class Alcohol120 aaruTrack.Indexes.Add(1, (int)alcTrack.startLba); - if(aaruTrack.Indexes.ContainsKey(0) && - aaruTrack.Indexes[0] >= 0) + if(aaruTrack.Indexes.ContainsKey(0) && aaruTrack.Indexes[0] >= 0) aaruTrack.StartSector = (ulong)aaruTrack.Indexes[0]; switch(alcTrack.subMode) @@ -140,9 +138,7 @@ public sealed partial class Alcohol120 break; } - if(_header.type != MediumType.CD && - _header.type != MediumType.CDR && - _header.type != MediumType.CDRW) + if(_header.type != MediumType.CD && _header.type != MediumType.CDR && _header.type != MediumType.CDRW) { aaruTrack.Pregap = 0; aaruTrack.Indexes?.Clear(); @@ -173,28 +169,27 @@ public sealed partial class Alcohol120 /// public IEnumerable SupportedSectorTags => new[] { - SectorTagType.CdSectorEcc, SectorTagType.CdSectorEccP, SectorTagType.CdSectorEccQ, - SectorTagType.CdSectorEdc, SectorTagType.CdSectorHeader, SectorTagType.CdSectorSubHeader, - SectorTagType.CdSectorSync, SectorTagType.CdTrackFlags, SectorTagType.CdSectorSubchannel + SectorTagType.CdSectorEcc, SectorTagType.CdSectorEccP, SectorTagType.CdSectorEccQ, SectorTagType.CdSectorEdc, + SectorTagType.CdSectorHeader, SectorTagType.CdSectorSubHeader, SectorTagType.CdSectorSync, + SectorTagType.CdTrackFlags, SectorTagType.CdSectorSubchannel }; /// public IEnumerable SupportedMediaTypes => new[] { MediaType.BDR, MediaType.BDRE, MediaType.BDREXL, MediaType.BDROM, MediaType.UHDBD, MediaType.BDRXL, - MediaType.CBHD, MediaType.CD, MediaType.CDDA, MediaType.CDEG, MediaType.CDG, MediaType.CDI, - MediaType.CDMIDI, MediaType.CDMRW, MediaType.CDPLUS, MediaType.CDR, MediaType.CDROM, MediaType.CDROMXA, - MediaType.CDRW, MediaType.CDV, MediaType.DVDDownload, MediaType.DVDPR, MediaType.DVDPRDL, MediaType.DVDPRW, - MediaType.DVDPRWDL, MediaType.DVDR, MediaType.DVDRAM, MediaType.DVDRDL, MediaType.DVDROM, MediaType.DVDRW, - MediaType.DVDRWDL, MediaType.EVD, MediaType.FDDVD, MediaType.DTSCD, MediaType.FVD, MediaType.HDDVDR, - MediaType.HDDVDRAM, MediaType.HDDVDRDL, MediaType.HDDVDROM, MediaType.HDDVDRW, MediaType.HDDVDRWDL, - MediaType.HDVMD, MediaType.HVD, MediaType.JaguarCD, MediaType.MEGACD, MediaType.PS1CD, MediaType.PS2CD, - MediaType.PS2DVD, MediaType.PS3BD, MediaType.PS3DVD, MediaType.PS4BD, MediaType.PS5BD, - MediaType.SuperCDROM2, MediaType.SVCD, MediaType.SVOD, MediaType.SATURNCD, MediaType.ThreeDO, MediaType.UDO, - MediaType.UDO2, MediaType.UDO2_WORM, MediaType.UMD, MediaType.VCD, MediaType.VCDHD, MediaType.NeoGeoCD, - MediaType.PCFX, MediaType.CDTV, MediaType.CD32, MediaType.Nuon, MediaType.Playdia, MediaType.Pippin, - MediaType.FMTOWNS, MediaType.MilCD, MediaType.VideoNow, MediaType.VideoNowColor, MediaType.VideoNowXp, - MediaType.CVD, MediaType.PCD + MediaType.CBHD, MediaType.CD, MediaType.CDDA, MediaType.CDEG, MediaType.CDG, MediaType.CDI, MediaType.CDMIDI, + MediaType.CDMRW, MediaType.CDPLUS, MediaType.CDR, MediaType.CDROM, MediaType.CDROMXA, MediaType.CDRW, + MediaType.CDV, MediaType.DVDDownload, MediaType.DVDPR, MediaType.DVDPRDL, MediaType.DVDPRW, MediaType.DVDPRWDL, + MediaType.DVDR, MediaType.DVDRAM, MediaType.DVDRDL, MediaType.DVDROM, MediaType.DVDRW, MediaType.DVDRWDL, + MediaType.EVD, MediaType.FDDVD, MediaType.DTSCD, MediaType.FVD, MediaType.HDDVDR, MediaType.HDDVDRAM, + MediaType.HDDVDRDL, MediaType.HDDVDROM, MediaType.HDDVDRW, MediaType.HDDVDRWDL, MediaType.HDVMD, MediaType.HVD, + MediaType.JaguarCD, MediaType.MEGACD, MediaType.PS1CD, MediaType.PS2CD, MediaType.PS2DVD, MediaType.PS3BD, + MediaType.PS3DVD, MediaType.PS4BD, MediaType.PS5BD, MediaType.SuperCDROM2, MediaType.SVCD, MediaType.SVOD, + MediaType.SATURNCD, MediaType.ThreeDO, MediaType.UDO, MediaType.UDO2, MediaType.UDO2_WORM, MediaType.UMD, + MediaType.VCD, MediaType.VCDHD, MediaType.NeoGeoCD, MediaType.PCFX, MediaType.CDTV, MediaType.CD32, + MediaType.Nuon, MediaType.Playdia, MediaType.Pippin, MediaType.FMTOWNS, MediaType.MilCD, MediaType.VideoNow, + MediaType.VideoNowColor, MediaType.VideoNowXp, MediaType.CVD, MediaType.PCD }; /// @@ -202,7 +197,10 @@ public sealed partial class Alcohol120 Array.Empty<(string name, Type type, string description, object @default)>(); /// - public IEnumerable KnownExtensions => new[] { ".mds" }; + public IEnumerable KnownExtensions => new[] + { + ".mds" + }; /// public bool IsWriting { get; private set; } diff --git a/Aaru.Images/Alcohol120/Read.cs b/Aaru.Images/Alcohol120/Read.cs index a17e9ff2c..3419356f5 100644 --- a/Aaru.Images/Alcohol120/Read.cs +++ b/Aaru.Images/Alcohol120/Read.cs @@ -64,43 +64,37 @@ public sealed partial class Alcohol120 stream.EnsureRead(hdr, 0, 88); _header = Marshal.ByteArrayToStructureLittleEndian
(hdr); - AaruConsole.DebugWriteLine(MODULE_NAME, "header.signature = {0}", - Encoding.ASCII.GetString(_header.signature)); + AaruConsole.DebugWriteLine(MODULE_NAME, "header.signature = {0}", Encoding.ASCII.GetString(_header.signature)); - AaruConsole.DebugWriteLine(MODULE_NAME, "header.version = {0}.{1}", _header.version[0], - _header.version[1]); + AaruConsole.DebugWriteLine(MODULE_NAME, "header.version = {0}.{1}", _header.version[0], _header.version[1]); AaruConsole.DebugWriteLine(MODULE_NAME, "header.type = {0}", _header.type); AaruConsole.DebugWriteLine(MODULE_NAME, "header.sessions = {0}", _header.sessions); for(var i = 0; i < _header.unknown1.Length; i++) { - AaruConsole.DebugWriteLine(MODULE_NAME, "header.unknown1[{1}] = 0x{0:X4}", _header.unknown1[i], - i); + AaruConsole.DebugWriteLine(MODULE_NAME, "header.unknown1[{1}] = 0x{0:X4}", _header.unknown1[i], i); } AaruConsole.DebugWriteLine(MODULE_NAME, "header.bcaLength = {0}", _header.bcaLength); for(var i = 0; i < _header.unknown2.Length; i++) { - AaruConsole.DebugWriteLine(MODULE_NAME, "header.unknown2[{1}] = 0x{0:X8}", _header.unknown2[i], - i); + AaruConsole.DebugWriteLine(MODULE_NAME, "header.unknown2[{1}] = 0x{0:X8}", _header.unknown2[i], i); } AaruConsole.DebugWriteLine(MODULE_NAME, "header.bcaOffset = {0}", _header.bcaOffset); for(var i = 0; i < _header.unknown3.Length; i++) { - AaruConsole.DebugWriteLine(MODULE_NAME, "header.unknown3[{1}] = 0x{0:X8}", _header.unknown3[i], - i); + AaruConsole.DebugWriteLine(MODULE_NAME, "header.unknown3[{1}] = 0x{0:X8}", _header.unknown3[i], i); } AaruConsole.DebugWriteLine(MODULE_NAME, "header.structuresOffset = {0}", _header.structuresOffset); for(var i = 0; i < _header.unknown4.Length; i++) { - AaruConsole.DebugWriteLine(MODULE_NAME, "header.unknown4[{1}] = 0x{0:X8}", _header.unknown4[i], - i); + AaruConsole.DebugWriteLine(MODULE_NAME, "header.unknown4[{1}] = 0x{0:X8}", _header.unknown4[i], i); } AaruConsole.DebugWriteLine(MODULE_NAME, "header.sessionOffset = {0}", _header.sessionOffset); @@ -118,18 +112,15 @@ public sealed partial class Alcohol120 stream.EnsureRead(sesHdr, 0, 24); Session session = Marshal.SpanToStructureLittleEndian(sesHdr); - AaruConsole.DebugWriteLine(MODULE_NAME, "session[{1}].sessionStart = {0}", session.sessionStart, - i); + AaruConsole.DebugWriteLine(MODULE_NAME, "session[{1}].sessionStart = {0}", session.sessionStart, i); AaruConsole.DebugWriteLine(MODULE_NAME, "session[{1}].sessionEnd = {0}", session.sessionEnd, i); - AaruConsole.DebugWriteLine(MODULE_NAME, "session[{1}].sessionSequence = {0}", - session.sessionSequence, i); + AaruConsole.DebugWriteLine(MODULE_NAME, "session[{1}].sessionSequence = {0}", session.sessionSequence, i); AaruConsole.DebugWriteLine(MODULE_NAME, "session[{1}].allBlocks = {0}", session.allBlocks, i); - AaruConsole.DebugWriteLine(MODULE_NAME, "session[{1}].nonTrackBlocks = {0}", - session.nonTrackBlocks, i); + AaruConsole.DebugWriteLine(MODULE_NAME, "session[{1}].nonTrackBlocks = {0}", session.nonTrackBlocks, i); AaruConsole.DebugWriteLine(MODULE_NAME, "session[{1}].firstTrack = {0}", session.firstTrack, i); @@ -171,59 +162,59 @@ public sealed partial class Alcohol120 oldIncorrectImage = true; } - AaruConsole.DebugWriteLine(MODULE_NAME, "session[{2}].track[{1}].mode = {0}", track.mode, - track.point, session.sessionSequence); + AaruConsole.DebugWriteLine(MODULE_NAME, "session[{2}].track[{1}].mode = {0}", track.mode, track.point, + session.sessionSequence); - AaruConsole.DebugWriteLine(MODULE_NAME, "session[{2}].track[{1}].subMode = {0}", - track.subMode, track.point, session.sessionSequence); + AaruConsole.DebugWriteLine(MODULE_NAME, "session[{2}].track[{1}].subMode = {0}", track.subMode, + track.point, session.sessionSequence); AaruConsole.DebugWriteLine(MODULE_NAME, "session[{2}].track[{1}].adrCtl = {0}", track.adrCtl, track.point, session.sessionSequence); - AaruConsole.DebugWriteLine(MODULE_NAME, "session[{2}].track[{1}].tno = {0}", track.tno, - track.point, session.sessionSequence); + AaruConsole.DebugWriteLine(MODULE_NAME, "session[{2}].track[{1}].tno = {0}", track.tno, track.point, + session.sessionSequence); AaruConsole.DebugWriteLine(MODULE_NAME, "session[{2}].track[{1}].point = {0:X2}", track.point, track.point, session.sessionSequence); - AaruConsole.DebugWriteLine(MODULE_NAME, "session[{2}].track[{1}].min = {0}", track.min, - track.point, session.sessionSequence); + AaruConsole.DebugWriteLine(MODULE_NAME, "session[{2}].track[{1}].min = {0}", track.min, track.point, + session.sessionSequence); - AaruConsole.DebugWriteLine(MODULE_NAME, "session[{2}].track[{1}].sec = {0}", track.sec, - track.point, session.sessionSequence); + AaruConsole.DebugWriteLine(MODULE_NAME, "session[{2}].track[{1}].sec = {0}", track.sec, track.point, + session.sessionSequence); - AaruConsole.DebugWriteLine(MODULE_NAME, "session[{2}].track[{1}].frame = {0}", track.frame, - track.point, session.sessionSequence); + AaruConsole.DebugWriteLine(MODULE_NAME, "session[{2}].track[{1}].frame = {0}", track.frame, track.point, + session.sessionSequence); - AaruConsole.DebugWriteLine(MODULE_NAME, "session[{2}].track[{1}].zero = {0}", track.zero, - track.point, session.sessionSequence); + AaruConsole.DebugWriteLine(MODULE_NAME, "session[{2}].track[{1}].zero = {0}", track.zero, track.point, + session.sessionSequence); - AaruConsole.DebugWriteLine(MODULE_NAME, "session[{2}].track[{1}].pmin = {0}", track.pmin, - track.point, session.sessionSequence); + AaruConsole.DebugWriteLine(MODULE_NAME, "session[{2}].track[{1}].pmin = {0}", track.pmin, track.point, + session.sessionSequence); - AaruConsole.DebugWriteLine(MODULE_NAME, "session[{2}].track[{1}].psec = {0}", track.psec, - track.point, session.sessionSequence); + AaruConsole.DebugWriteLine(MODULE_NAME, "session[{2}].track[{1}].psec = {0}", track.psec, track.point, + session.sessionSequence); AaruConsole.DebugWriteLine(MODULE_NAME, "session[{2}].track[{1}].pframe = {0}", track.pframe, track.point, session.sessionSequence); - AaruConsole.DebugWriteLine(MODULE_NAME, "session[{2}].track[{1}].extraOffset = {0}", - track.extraOffset, track.point, session.sessionSequence); + AaruConsole.DebugWriteLine(MODULE_NAME, "session[{2}].track[{1}].extraOffset = {0}", track.extraOffset, + track.point, session.sessionSequence); - AaruConsole.DebugWriteLine(MODULE_NAME, "session[{2}].track[{1}].sectorSize = {0}", - track.sectorSize, track.point, session.sessionSequence); + AaruConsole.DebugWriteLine(MODULE_NAME, "session[{2}].track[{1}].sectorSize = {0}", track.sectorSize, + track.point, session.sessionSequence); //for(int j = 0; j < track.unknown.Length; j++) // AaruConsole.DebugWriteLine(MODULE_NAME, "session[{2}].track[{1}].unknown[{2}] = {0}", track.unknown[j], i, j, session.sessionSequence); - AaruConsole.DebugWriteLine(MODULE_NAME, "session[{2}].track[{1}].startLba = {0}", - track.startLba, track.point, session.sessionSequence); - - AaruConsole.DebugWriteLine(MODULE_NAME, "session[{2}].track[{1}].startOffset = {0}", - track.startOffset, track.point, session.sessionSequence); - - AaruConsole.DebugWriteLine(MODULE_NAME, "session[{2}].track[{1}].files = {0}", track.files, + AaruConsole.DebugWriteLine(MODULE_NAME, "session[{2}].track[{1}].startLba = {0}", track.startLba, track.point, session.sessionSequence); + AaruConsole.DebugWriteLine(MODULE_NAME, "session[{2}].track[{1}].startOffset = {0}", track.startOffset, + track.point, session.sessionSequence); + + AaruConsole.DebugWriteLine(MODULE_NAME, "session[{2}].track[{1}].files = {0}", track.files, track.point, + session.sessionSequence); + AaruConsole.DebugWriteLine(MODULE_NAME, "session[{2}].track[{1}].footerOffset = {0}", track.footerOffset, track.point, session.sessionSequence); @@ -260,19 +251,16 @@ public sealed partial class Alcohol120 foreach(Track track in _alcTracks.Values) { - if(track.extraOffset > 0 && - !_isDvd) + if(track.extraOffset > 0 && !_isDvd) { var extHdr = new byte[8]; stream.Seek(track.extraOffset, SeekOrigin.Begin); stream.EnsureRead(extHdr, 0, 8); TrackExtra extra = Marshal.SpanToStructureLittleEndian(extHdr); - AaruConsole.DebugWriteLine(MODULE_NAME, "track[{1}].extra.pregap = {0}", extra.pregap, - track.point); + AaruConsole.DebugWriteLine(MODULE_NAME, "track[{1}].extra.pregap = {0}", extra.pregap, track.point); - AaruConsole.DebugWriteLine(MODULE_NAME, "track[{1}].extra.sectors = {0}", extra.sectors, - track.point); + AaruConsole.DebugWriteLine(MODULE_NAME, "track[{1}].extra.sectors = {0}", extra.sectors, track.point); if(track.point == 1) { @@ -470,11 +458,13 @@ public sealed partial class Alcohol120 firstAudio |= alcoholTrack is { point: 1, mode: TrackMode.Audio or TrackMode.AudioAlt }; // First track is data - firstData |= alcoholTrack.point == 1 && alcoholTrack.mode != TrackMode.Audio && + firstData |= alcoholTrack.point == 1 && + alcoholTrack.mode != TrackMode.Audio && alcoholTrack.mode != TrackMode.AudioAlt; // Any non first track is data - data |= alcoholTrack.point != 1 && alcoholTrack.mode != TrackMode.Audio && + data |= alcoholTrack.point != 1 && + alcoholTrack.mode != TrackMode.Audio && alcoholTrack.mode != TrackMode.AudioAlt; // Any non first track is audio @@ -493,13 +483,9 @@ public sealed partial class Alcohol120 } } - if(!data && - !firstData) + if(!data && !firstData) _imageInfo.MediaType = MediaType.CDDA; - else if(firstAudio && - data && - Sessions.Count > 1 && - mode2) + else if(firstAudio && data && Sessions.Count > 1 && mode2) _imageInfo.MediaType = MediaType.CDPLUS; else if(firstData && audio || mode2) _imageInfo.MediaType = MediaType.CDROMXA; @@ -622,22 +608,17 @@ public sealed partial class Alcohol120 AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Partition_sequence_0, partition.Sequence); AaruConsole.DebugWriteLine(MODULE_NAME, "\t" + Localization.Partition_name_0, partition.Name); - AaruConsole.DebugWriteLine(MODULE_NAME, "\t" + Localization.Partition_description_0, - partition.Description); + AaruConsole.DebugWriteLine(MODULE_NAME, "\t" + Localization.Partition_description_0, partition.Description); AaruConsole.DebugWriteLine(MODULE_NAME, "\t" + Localization.Partition_type_0, partition.Type); - AaruConsole.DebugWriteLine(MODULE_NAME, "\t" + Localization.Partition_starting_sector_0, - partition.Start); + AaruConsole.DebugWriteLine(MODULE_NAME, "\t" + Localization.Partition_starting_sector_0, partition.Start); - AaruConsole.DebugWriteLine(MODULE_NAME, "\t" + Localization.Partition_sectors_0, - partition.Length); + AaruConsole.DebugWriteLine(MODULE_NAME, "\t" + Localization.Partition_sectors_0, partition.Length); - AaruConsole.DebugWriteLine(MODULE_NAME, "\t" + Localization.Partition_starting_offset_0, - partition.Offset); + AaruConsole.DebugWriteLine(MODULE_NAME, "\t" + Localization.Partition_starting_offset_0, partition.Offset); - AaruConsole.DebugWriteLine(MODULE_NAME, "\t" + Localization.Partition_size_in_bytes_0, - partition.Size); + AaruConsole.DebugWriteLine(MODULE_NAME, "\t" + Localization.Partition_size_in_bytes_0, partition.Size); } _imageInfo.Application = "Alcohol 120%"; @@ -667,7 +648,10 @@ public sealed partial class Alcohol120 byte lastSession = 0; var tocMs = new MemoryStream(); - tocMs.Write(new byte[] { 0, 0 }, 0, 2); // Reserved for TOC session numbers + tocMs.Write(new byte[] + { + 0, 0 + }, 0, 2); // Reserved for TOC session numbers foreach(KeyValuePair> sessionToc in _alcToc) { @@ -776,8 +760,7 @@ public sealed partial class Alcohol120 foreach(Track track in _alcTracks.Values) { - if(track.point != kvp.Key || - !_alcTrackExtras.TryGetValue(track.point, out TrackExtra extra)) + if(track.point != kvp.Key || !_alcTrackExtras.TryGetValue(track.point, out TrackExtra extra)) continue; if(sectorAddress - kvp.Value >= extra.sectors + extra.pregap) @@ -802,8 +785,7 @@ public sealed partial class Alcohol120 foreach(Track track in _alcTracks.Values) { - if(track.point != kvp.Key || - !_alcTrackExtras.TryGetValue(track.point, out TrackExtra extra)) + if(track.point != kvp.Key || !_alcTrackExtras.TryGetValue(track.point, out TrackExtra extra)) continue; if(sectorAddress - kvp.Value >= extra.sectors + extra.pregap) @@ -898,8 +880,7 @@ public sealed partial class Alcohol120 buffer = new byte[sectorSize * length]; - if(alcTrack.point == 1 && - alcExtra.pregap > 150) + if(alcTrack.point == 1 && alcExtra.pregap > 150) { if(sectorAddress + 150 < alcExtra.pregap) return ErrorNumber.NoError; @@ -935,8 +916,7 @@ public sealed partial class Alcohol120 buffer = mode2Ms.ToArray(); } - else if(sectorOffset == 0 && - sectorSkip == 0) + else if(sectorOffset == 0 && sectorSkip == 0) buffer = br.ReadBytes((int)(sectorSize * length)); else { @@ -987,7 +967,10 @@ public sealed partial class Alcohol120 case SectorTagType.CdSectorSync: break; case SectorTagType.CdTrackFlags: - buffer = new[] { (byte)(alcTrack.adrCtl & 0x0F) }; + buffer = new[] + { + (byte)(alcTrack.adrCtl & 0x0F) + }; return ErrorNumber.NoError; default: @@ -1336,8 +1319,7 @@ public sealed partial class Alcohol120 buffer = new byte[sectorSize * length]; - if(alcTrack.point == 1 && - alcExtra.pregap > 150) + if(alcTrack.point == 1 && alcExtra.pregap > 150) { if(sectorAddress + 150 < alcExtra.pregap) return ErrorNumber.NoError; @@ -1357,8 +1339,7 @@ public sealed partial class Alcohol120 br.BaseStream.Seek(fileOffset + (long)(sectorAddress * (sectorOffset + sectorSize + sectorSkip)), SeekOrigin.Begin); - if(sectorOffset == 0 && - sectorSkip == 0) + if(sectorOffset == 0 && sectorSkip == 0) buffer = br.ReadBytes((int)(sectorSize * length)); else { @@ -1394,8 +1375,7 @@ public sealed partial class Alcohol120 foreach(Track alcTrack in _alcTracks.Values) { - if(alcTrack.point != kvp.Key || - !_alcTrackExtras.TryGetValue(alcTrack.point, out TrackExtra alcExtra)) + if(alcTrack.point != kvp.Key || !_alcTrackExtras.TryGetValue(alcTrack.point, out TrackExtra alcExtra)) continue; if(sectorAddress - kvp.Value >= alcExtra.sectors + alcExtra.pregap) @@ -1453,8 +1433,7 @@ public sealed partial class Alcohol120 buffer = new byte[sectorSize * length]; - if(alcTrack.point == 1 && - alcExtra.pregap > 150) + if(alcTrack.point == 1 && alcExtra.pregap > 150) { if(sectorAddress + 150 < alcExtra.pregap) return ErrorNumber.NoError; @@ -1506,8 +1485,7 @@ public sealed partial class Alcohol120 where alcTrack.point >= ses.StartTrack || alcTrack.point <= ses.EndTrack select ses.Sequence).FirstOrDefault(); - if(!_alcTrackExtras.TryGetValue(alcTrack.point, out TrackExtra alcExtra) || - session != sessionNo) + if(!_alcTrackExtras.TryGetValue(alcTrack.point, out TrackExtra alcExtra) || session != sessionNo) continue; var aaruTrack = new CommonTypes.Structs.Track diff --git a/Aaru.Images/Alcohol120/Write.cs b/Aaru.Images/Alcohol120/Write.cs index ca9fe91c9..cf2d498e3 100644 --- a/Aaru.Images/Alcohol120/Write.cs +++ b/Aaru.Images/Alcohol120/Write.cs @@ -73,10 +73,8 @@ public sealed partial class Alcohol120 _imageStream = new - FileStream( - Path.Combine(Path.GetDirectoryName(path) ?? "", Path.GetFileNameWithoutExtension(path)) + - ".mdf", - FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.None); + FileStream(Path.Combine(Path.GetDirectoryName(path) ?? "", Path.GetFileNameWithoutExtension(path)) + ".mdf", + FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.None); } catch(IOException e) { @@ -312,9 +310,8 @@ public sealed partial class Alcohol120 { case TrackSubchannelType.None: _imageStream. - Seek( - (long)(track.FileOffset + (sectorAddress - track.StartSector) * (ulong)track.RawBytesPerSector), - SeekOrigin.Begin); + Seek((long)(track.FileOffset + (sectorAddress - track.StartSector) * (ulong)track.RawBytesPerSector), + SeekOrigin.Begin); _imageStream.Write(data, 0, data.Length); @@ -324,10 +321,8 @@ public sealed partial class Alcohol120 case TrackSubchannelType.Raw: case TrackSubchannelType.RawInterleaved: _imageStream. - Seek( - (long)(track.FileOffset + - (sectorAddress - track.StartSector) * (ulong)(track.RawBytesPerSector + 96)), - SeekOrigin.Begin); + Seek((long)(track.FileOffset + (sectorAddress - track.StartSector) * (ulong)(track.RawBytesPerSector + 96)), + SeekOrigin.Begin); for(uint i = 0; i < length; i++) { @@ -375,10 +370,8 @@ public sealed partial class Alcohol120 var subchannelSize = (uint)(track.SubchannelType != TrackSubchannelType.None ? 96 : 0); _imageStream. - Seek( - (long)(track.FileOffset + (sectorAddress - track.StartSector) * - (ulong)(track.RawBytesPerSector + subchannelSize)), - SeekOrigin.Begin); + Seek((long)(track.FileOffset + (sectorAddress - track.StartSector) * (ulong)(track.RawBytesPerSector + subchannelSize)), + SeekOrigin.Begin); _imageStream.Write(data, 0, data.Length); @@ -424,10 +417,8 @@ public sealed partial class Alcohol120 for(uint i = 0; i < length; i++) { _imageStream. - Seek( - (long)(track.FileOffset + (i + sectorAddress - track.StartSector) * - (ulong)(track.RawBytesPerSector + subchannelSize)), - SeekOrigin.Begin); + Seek((long)(track.FileOffset + (i + sectorAddress - track.StartSector) * (ulong)(track.RawBytesPerSector + subchannelSize)), + SeekOrigin.Begin); _imageStream.Write(data, (int)(i * track.RawBytesPerSector), track.RawBytesPerSector); } @@ -519,8 +510,11 @@ public sealed partial class Alcohol120 var header = new Header { - signature = _alcoholSignature, - version = new byte[] { 1, 5 }, + signature = _alcoholSignature, + version = new byte[] + { + 1, 5 + }, type = MediaTypeToMediumType(_imageInfo.MediaType), sessions = sessions, structuresOffset = (uint)(_pfi == null ? 0 : 96), @@ -640,7 +634,8 @@ public sealed partial class Alcohol120 _writingTracks.Count(t => t.Session == i) + 3), nonTrackBlocks = (byte)(decodedToc?.TrackDescriptors.Count(t => t.SessionNumber == i && - t.POINT is >= 0xA0 and <= 0xAF) ?? 3), + t.POINT is >= 0xA0 and <= 0xAF) ?? + 3), firstTrack = (ushort)firstTrack.Sequence, lastTrack = (ushort)lastTrack.Sequence, trackOffset = (uint)currentTrackOffset @@ -650,12 +645,10 @@ public sealed partial class Alcohol120 _trackFlags.TryGetValue((byte)firstTrack.Sequence, out byte firstTrackControl); _trackFlags.TryGetValue((byte)lastTrack.Sequence, out byte lastTrackControl); - if(firstTrackControl == 0 && - firstTrack.Type != TrackType.Audio) + if(firstTrackControl == 0 && firstTrack.Type != TrackType.Audio) firstTrackControl = (byte)CdFlags.DataTrack; - if(lastTrackControl == 0 && - lastTrack.Type != TrackType.Audio) + if(lastTrackControl == 0 && lastTrack.Type != TrackType.Audio) lastTrackControl = (byte)CdFlags.DataTrack; (byte minute, byte second, byte frame) leadinPmsf = LbaToMsf(lastTrack.EndSector + 1); @@ -664,8 +657,8 @@ public sealed partial class Alcohol120 true) { foreach(FullTOC.TrackDataDescriptor tocTrk in - decodedToc.Value.TrackDescriptors.Where(t => t.SessionNumber == i && - t.POINT is >= 0xA0 and <= 0xAF)) + decodedToc.Value.TrackDescriptors.Where(t => t.SessionNumber == i && + t.POINT is >= 0xA0 and <= 0xAF)) { thisSessionTracks.Add(tocTrk.POINT, new Track { @@ -699,13 +692,9 @@ public sealed partial class Alcohol120 point = 0xA0, unknown = new byte[18], unknown2 = new byte[24], - psec = (byte)(_imageInfo.MediaType == MediaType.CDI - ? 0x10 - : _writingTracks.Any(t => t.Type is TrackType.CdMode2Form1 - or TrackType.CdMode2Form2 - or TrackType.CdMode2Formless) - ? 0x20 - : 0), + psec = (byte)(_imageInfo.MediaType == MediaType.CDI ? 0x10 : + _writingTracks.Any(t => t.Type is TrackType.CdMode2Form1 or TrackType.CdMode2Form2 + or TrackType.CdMode2Formless) ? 0x20 : 0), extraOffset = (uint)currentExtraOffset }); @@ -765,8 +754,7 @@ public sealed partial class Alcohol120 (byte minute, byte second, byte frame) msf = LbaToMsf((ulong)track.Indexes[1]); _trackFlags.TryGetValue((byte)track.Sequence, out byte trackControl); - if(trackControl == 0 && - track.Type != TrackType.Audio) + if(trackControl == 0 && track.Type != TrackType.Audio) trackControl = (byte)CdFlags.DataTrack; alcTrk.adrCtl = (byte)((1 << 4) + trackControl); @@ -802,8 +790,8 @@ public sealed partial class Alcohol120 // Daemon Tools expect it to be like this alcTrk.unknown = new byte[] { - 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00 + 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00 }; alcTrk.unknown2 = new byte[24]; @@ -840,7 +828,7 @@ public sealed partial class Alcohol120 if(decodedToc?.TrackDescriptors.Any(t => t.SessionNumber == i && t.POINT >= 0xB0) == true) { foreach(FullTOC.TrackDataDescriptor tocTrk in - decodedToc.Value.TrackDescriptors.Where(t => t.SessionNumber == i && t.POINT >= 0xB0)) + decodedToc.Value.TrackDescriptors.Where(t => t.SessionNumber == i && t.POINT >= 0xB0)) { thisSessionTracks.Add(tocTrk.POINT, new Track { @@ -936,7 +924,10 @@ public sealed partial class Alcohol120 break; case 2048: - _descriptorStream.Write(new byte[] { 0x08, 0x02, 0x00, 0x00 }, 0, 4); + _descriptorStream.Write(new byte[] + { + 0x08, 0x02, 0x00, 0x00 + }, 0, 4); _descriptorStream.Write(_dmi, 0, 2048); @@ -1027,7 +1018,10 @@ public sealed partial class Alcohol120 _descriptorStream.Write(filename, 0, filename.Length); // Write filename null termination - _descriptorStream.Write(new byte[] { 0, 0 }, 0, 2); + _descriptorStream.Write(new byte[] + { + 0, 0 + }, 0, 2); _descriptorStream.Flush(); _descriptorStream.Close(); @@ -1105,11 +1099,8 @@ public sealed partial class Alcohol120 } _imageStream. - Seek( - (long)(track.FileOffset + - (sectorAddress - track.StartSector) * (ulong)(track.RawBytesPerSector + 96)) + - track.RawBytesPerSector, - SeekOrigin.Begin); + Seek((long)(track.FileOffset + (sectorAddress - track.StartSector) * (ulong)(track.RawBytesPerSector + 96)) + track.RawBytesPerSector, + SeekOrigin.Begin); _imageStream.Write(data, 0, data.Length); @@ -1167,10 +1158,8 @@ public sealed partial class Alcohol120 for(uint i = 0; i < length; i++) { _imageStream. - Seek( - (long)(track.FileOffset + (i + sectorAddress - track.StartSector) * - (ulong)(track.RawBytesPerSector + 96)) + track.RawBytesPerSector, - SeekOrigin.Begin); + Seek((long)(track.FileOffset + (i + sectorAddress - track.StartSector) * (ulong)(track.RawBytesPerSector + 96)) + track.RawBytesPerSector, + SeekOrigin.Begin); _imageStream.Write(data, (int)(i * 96), 96); } diff --git a/Aaru.Images/Anex86/Properties.cs b/Aaru.Images/Anex86/Properties.cs index 9c689e668..883cef1fc 100644 --- a/Aaru.Images/Anex86/Properties.cs +++ b/Aaru.Images/Anex86/Properties.cs @@ -84,10 +84,9 @@ public sealed partial class Anex86 MediaType.ACORN_35_DS_DD, MediaType.DOS_35_DS_DD_8, MediaType.DOS_35_DS_DD_9, MediaType.ACORN_35_DS_HD, MediaType.DOS_525_HD, MediaType.ACORN_525_DS_DD, MediaType.DOS_35_HD, MediaType.XDF_525, MediaType.DMF, MediaType.XDF_35, MediaType.DOS_35_ED, MediaType.FDFORMAT_35_DD, MediaType.FDFORMAT_525_HD, - MediaType.FDFORMAT_35_HD, MediaType.NEC_35_TD, MediaType.Unknown, MediaType.GENERIC_HDD, - MediaType.FlashDrive, MediaType.CompactFlash, MediaType.CompactFlashType2, MediaType.PCCardTypeI, - MediaType.PCCardTypeII, MediaType.PCCardTypeIII, MediaType.PCCardTypeIV, MediaType.MetaFloppy_Mod_I, - MediaType.MetaFloppy_Mod_II + MediaType.FDFORMAT_35_HD, MediaType.NEC_35_TD, MediaType.Unknown, MediaType.GENERIC_HDD, MediaType.FlashDrive, + MediaType.CompactFlash, MediaType.CompactFlashType2, MediaType.PCCardTypeI, MediaType.PCCardTypeII, + MediaType.PCCardTypeIII, MediaType.PCCardTypeIV, MediaType.MetaFloppy_Mod_I, MediaType.MetaFloppy_Mod_II }; /// @@ -95,7 +94,10 @@ public sealed partial class Anex86 Array.Empty<(string name, Type type, string description, object @default)>(); /// - public IEnumerable KnownExtensions => new[] { ".fdi", ".hdi" }; + public IEnumerable KnownExtensions => new[] + { + ".fdi", ".hdi" + }; /// public bool IsWriting { get; private set; } diff --git a/Aaru.Images/Anex86/Write.cs b/Aaru.Images/Anex86/Write.cs index 7cc57862f..e8f9a07e5 100644 --- a/Aaru.Images/Anex86/Write.cs +++ b/Aaru.Images/Anex86/Write.cs @@ -57,8 +57,7 @@ public sealed partial class Anex86 return false; } - if(sectors * sectorSize > int.MaxValue || - sectors > (long)int.MaxValue * 8 * 33) + if(sectors * sectorSize > int.MaxValue || sectors > (long)int.MaxValue * 8 * 33) { ErrorMessage = Localization.Too_many_sectors; @@ -222,8 +221,7 @@ public sealed partial class Anex86 _header.cylinders = (int)_imageInfo.Sectors / _header.heads / _header.spt; - if(_header.cylinders == 0 && - _header is { heads: 0, spt: 0 }) + if(_header.cylinders == 0 && _header is { heads: 0, spt: 0 }) break; } } diff --git a/Aaru.Images/Apple2MG/Constants.cs b/Aaru.Images/Apple2MG/Constants.cs index 94734b9d1..57e4e8a77 100644 --- a/Aaru.Images/Apple2MG/Constants.cs +++ b/Aaru.Images/Apple2MG/Constants.cs @@ -58,9 +58,15 @@ public sealed partial class Apple2Mg /// Disk image created by Aaru, "aaru" const uint CREATOR_AARU = 0x75726161; - const uint LOCKED_DISK = 0x80000000; - const uint VALID_VOLUME_NUMBER = 0x00000100; - const uint VOLUME_NUMBER_MASK = 0x000000FF; - readonly int[] _deinterleave = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 }; - readonly int[] _interleave = { 0, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 15 }; + const uint LOCKED_DISK = 0x80000000; + const uint VALID_VOLUME_NUMBER = 0x00000100; + const uint VOLUME_NUMBER_MASK = 0x000000FF; + readonly int[] _deinterleave = + { + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 + }; + readonly int[] _interleave = + { + 0, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 15 + }; } \ No newline at end of file diff --git a/Aaru.Images/Apple2MG/Properties.cs b/Aaru.Images/Apple2MG/Properties.cs index d9c99ca85..b372ad2da 100644 --- a/Aaru.Images/Apple2MG/Properties.cs +++ b/Aaru.Images/Apple2MG/Properties.cs @@ -85,7 +85,10 @@ public sealed partial class Apple2Mg Array.Empty<(string name, Type type, string description, object @default)>(); /// - public IEnumerable KnownExtensions => new[] { ".2mg" }; + public IEnumerable KnownExtensions => new[] + { + ".2mg" + }; /// public bool IsWriting { get; private set; } diff --git a/Aaru.Images/Apple2MG/Read.cs b/Aaru.Images/Apple2MG/Read.cs index a8a6f955c..9f1e6f9da 100644 --- a/Aaru.Images/Apple2MG/Read.cs +++ b/Aaru.Images/Apple2MG/Read.cs @@ -99,8 +99,7 @@ public sealed partial class Apple2Mg AaruConsole.DebugWriteLine(MODULE_NAME, "ImageHeader.reserved3 = 0x{0:X8}", _imageHeader.Reserved3); AaruConsole.DebugWriteLine(MODULE_NAME, "ImageHeader.reserved4 = 0x{0:X8}", _imageHeader.Reserved4); - if(_imageHeader is { DataSize: 0, Blocks: 0 } && - _imageHeader.ImageFormat != SectorOrder.ProDos) + if(_imageHeader is { DataSize: 0, Blocks: 0 } && _imageHeader.ImageFormat != SectorOrder.ProDos) return ErrorNumber.InvalidArgument; byte[] tmp; @@ -131,23 +130,24 @@ public sealed partial class Apple2Mg tmp = new byte[_imageHeader.DataSize]; stream.EnsureRead(tmp, 0, tmp.Length); - bool isDos = tmp[0x11001] == 17 && tmp[0x11002] < 16 && tmp[0x11027] <= 122 && tmp[0x11034] == 35 && - tmp[0x11035] == 16 && tmp[0x11036] == 0 && tmp[0x11037] == 1; + 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(var t = 0; t < 35; t++) { for(var s = 0; s < 16; s++) { - Array.Copy(tmp, t * 16 * 256 + s * 256, _decodedImage, t * 16 * 256 + offsets[s] * 256, - 256); + Array.Copy(tmp, t * 16 * 256 + s * 256, _decodedImage, t * 16 * 256 + offsets[s] * 256, 256); } } @@ -166,8 +166,7 @@ public sealed partial class Apple2Mg { for(var s = 0; s < 16; s++) { - Array.Copy(tmp, t * 16 * 256 + s * 256, _decodedImage, t * 16 * 256 + offsets[s] * 256, - 256); + Array.Copy(tmp, t * 16 * 256 + s * 256, _decodedImage, t * 16 * 256 + offsets[s] * 256, 256); } } @@ -202,8 +201,7 @@ public sealed partial class Apple2Mg _imageInfo.Version = _imageHeader.Version.ToString(); - if(_imageHeader.CommentOffset != 0 && - _imageHeader.CommentSize != 0) + if(_imageHeader.CommentOffset != 0 && _imageHeader.CommentSize != 0) { stream.Seek(_imageHeader.CommentOffset, SeekOrigin.Begin); diff --git a/Aaru.Images/Apple2MG/Write.cs b/Aaru.Images/Apple2MG/Write.cs index 14b0c1c22..5a1661e14 100644 --- a/Aaru.Images/Apple2MG/Write.cs +++ b/Aaru.Images/Apple2MG/Write.cs @@ -52,8 +52,7 @@ public sealed partial class Apple2Mg { if(sectorSize != 512) { - if(sectorSize != 256 || - mediaType != MediaType.Apple32SS && mediaType != MediaType.Apple33SS) + if(sectorSize != 256 || mediaType != MediaType.Apple32SS && mediaType != MediaType.Apple33SS) { ErrorMessage = Localization.Unsupported_sector_size; @@ -201,8 +200,13 @@ public sealed partial class Apple2Mg var tmp = new byte[256]; _writingStream.EnsureRead(tmp, 0, tmp.Length); - bool isDos = tmp[0x01] == 17 && tmp[0x02] < 16 && tmp[0x27] <= 122 && tmp[0x34] == 35 && tmp[0x35] == 16 && - tmp[0x36] == 0 && tmp[0x37] == 1; + bool isDos = tmp[0x01] == 17 && + tmp[0x02] < 16 && + tmp[0x27] <= 122 && + tmp[0x34] == 35 && + tmp[0x35] == 16 && + tmp[0x36] == 0 && + tmp[0x37] == 1; _imageHeader = new Header { diff --git a/Aaru.Images/AppleDOS/Constants.cs b/Aaru.Images/AppleDOS/Constants.cs index 12e152385..c2ef26654 100644 --- a/Aaru.Images/AppleDOS/Constants.cs +++ b/Aaru.Images/AppleDOS/Constants.cs @@ -34,6 +34,12 @@ namespace Aaru.DiscImages; public sealed partial class AppleDos { - readonly int[] _deinterleave = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 }; - readonly int[] _interleave = { 0, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 15 }; + readonly int[] _deinterleave = + { + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 + }; + readonly int[] _interleave = + { + 0, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 15 + }; } \ No newline at end of file diff --git a/Aaru.Images/AppleDOS/Properties.cs b/Aaru.Images/AppleDOS/Properties.cs index 7e55095fd..9fc26f52a 100644 --- a/Aaru.Images/AppleDOS/Properties.cs +++ b/Aaru.Images/AppleDOS/Properties.cs @@ -74,14 +74,20 @@ public sealed partial class AppleDos public IEnumerable SupportedSectorTags => Array.Empty(); /// - public IEnumerable SupportedMediaTypes => new[] { MediaType.Apple33SS }; + public IEnumerable SupportedMediaTypes => new[] + { + MediaType.Apple33SS + }; /// public IEnumerable<(string name, Type type, string description, object @default)> SupportedOptions => Array.Empty<(string name, Type type, string description, object @default)>(); /// - public IEnumerable KnownExtensions => new[] { ".do", ".po" }; + public IEnumerable KnownExtensions => new[] + { + ".do", ".po" + }; /// public bool IsWriting { get; private set; } diff --git a/Aaru.Images/AppleDOS/Read.cs b/Aaru.Images/AppleDOS/Read.cs index 8b52fee4e..fa1a64300 100644 --- a/Aaru.Images/AppleDOS/Read.cs +++ b/Aaru.Images/AppleDOS/Read.cs @@ -54,31 +54,31 @@ public sealed partial class AppleDos _extension = Path.GetExtension(imageFilter.Filename)?.ToLower(); - if(_extension is ".d13" or ".do" && - tmp.Length == 116480) + if(_extension is ".d13" or ".do" && tmp.Length == 116480) { _dos32 = true; _deinterleaved = tmp; } else { - bool isDos = tmp[0x11001] == 17 && tmp[0x11002] < 16 && tmp[0x11027] <= 122 && tmp[0x11034] == 35 && - tmp[0x11035] == 16 && tmp[0x11036] == 0 && tmp[0x11037] == 1; + bool isDos = tmp[0x11001] == 17 && + tmp[0x11002] < 16 && + tmp[0x11027] <= 122 && + tmp[0x11034] == 35 && + tmp[0x11035] == 16 && + tmp[0x11036] == 0 && + tmp[0x11037] == 1; _deinterleaved = new byte[tmp.Length]; - int[] offsets = _extension == ".do" - ? isDos ? _deinterleave : _interleave - : isDos - ? _interleave - : _deinterleave; + int[] offsets = _extension == ".do" ? isDos ? _deinterleave : _interleave : + isDos ? _interleave : _deinterleave; for(var t = 0; t < 35; t++) { for(var s = 0; s < 16; s++) { - Array.Copy(tmp, t * 16 * 256 + s * 256, _deinterleaved, t * 16 * 256 + offsets[s] * 256, - 256); + Array.Copy(tmp, t * 16 * 256 + s * 256, _deinterleaved, t * 16 * 256 + offsets[s] * 256, 256); } } } diff --git a/Aaru.Images/AppleDOS/Write.cs b/Aaru.Images/AppleDOS/Write.cs index 3c6ba5dc2..8a63bebe8 100644 --- a/Aaru.Images/AppleDOS/Write.cs +++ b/Aaru.Images/AppleDOS/Write.cs @@ -55,16 +55,14 @@ public sealed partial class AppleDos return false; } - if(mediaType != MediaType.Apple32SS && - mediaType != MediaType.Apple33SS) + if(mediaType != MediaType.Apple32SS && mediaType != MediaType.Apple33SS) { ErrorMessage = string.Format(Localization.Unsupported_media_format_0, mediaType); return false; } - if(mediaType == MediaType.Apple32SS && sectors != 455 || - mediaType == MediaType.Apple33SS && sectors != 560) + if(mediaType == MediaType.Apple32SS && sectors != 455 || mediaType == MediaType.Apple33SS && sectors != 560) { ErrorMessage = Localization.Incorrect_number_of_sectors_for_media; @@ -179,23 +177,23 @@ public sealed partial class AppleDos tmp = _deinterleaved; else { - bool isDos = _deinterleaved[0x11001] == 17 && _deinterleaved[0x11002] < 16 && - _deinterleaved[0x11027] <= 122 && _deinterleaved[0x11034] == 35 && - _deinterleaved[0x11035] == 16 && _deinterleaved[0x11036] == 0 && _deinterleaved[0x11037] == 1; + bool isDos = _deinterleaved[0x11001] == 17 && + _deinterleaved[0x11002] < 16 && + _deinterleaved[0x11027] <= 122 && + _deinterleaved[0x11034] == 35 && + _deinterleaved[0x11035] == 16 && + _deinterleaved[0x11036] == 0 && + _deinterleaved[0x11037] == 1; tmp = new byte[_deinterleaved.Length]; - int[] offsets = _extension == ".do" - ? isDos ? _deinterleave : _interleave - : isDos - ? _interleave - : _deinterleave; + int[] offsets = _extension == ".do" ? isDos ? _deinterleave : _interleave : + isDos ? _interleave : _deinterleave; for(var t = 0; t < 35; t++) for(var s = 0; s < 16; s++) { - Array.Copy(_deinterleaved, t * 16 * 256 + offsets[s] * 256, tmp, t * 16 * 256 + s * 256, - 256); + Array.Copy(_deinterleaved, t * 16 * 256 + offsets[s] * 256, tmp, t * 16 * 256 + s * 256, 256); } } diff --git a/Aaru.Images/AppleNIB/Constants.cs b/Aaru.Images/AppleNIB/Constants.cs index 19d02e6cb..c30053acb 100644 --- a/Aaru.Images/AppleNIB/Constants.cs +++ b/Aaru.Images/AppleNIB/Constants.cs @@ -37,15 +37,39 @@ namespace Aaru.DiscImages; [SuppressMessage("ReSharper", "UnusedMember.Local")] public sealed partial class AppleNib { - readonly byte[] _apple3Sign = { 0x8D, 0xD0, 0x03, 0x4C, 0xC7, 0xA4 }; - readonly byte[] _cpmSign = { 0xA2, 0x55, 0xA9, 0x00, 0x9D, 0x00, 0x0D, 0xCA }; - readonly byte[] _dosSign = { 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[] _driString = "COPYRIGHT (C) 1979, DIGITAL RESEARCH"u8.ToArray(); - readonly byte[] _pascal2Sign = { 0xFF, 0xA2, 0x00, 0x8E }; - readonly byte[] _pascalSign = { 0x08, 0xA5, 0x0F, 0x29 }; - readonly byte[] _pascalString = "SYSTE.APPLE"u8.ToArray(); - readonly ulong[] _proDosSkewing = { 0, 8, 1, 9, 2, 10, 3, 11, 4, 12, 5, 13, 6, 14, 7, 15 }; - readonly byte[] _prodosString = "PRODOS"u8.ToArray(); - readonly byte[] _sosSign = { 0xC9, 0x20, 0xF0, 0x3E }; + readonly byte[] _apple3Sign = + { + 0x8D, 0xD0, 0x03, 0x4C, 0xC7, 0xA4 + }; + readonly byte[] _cpmSign = + { + 0xA2, 0x55, 0xA9, 0x00, 0x9D, 0x00, 0x0D, 0xCA + }; + readonly byte[] _dosSign = + { + 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[] _driString = "COPYRIGHT (C) 1979, DIGITAL RESEARCH"u8.ToArray(); + readonly byte[] _pascal2Sign = + { + 0xFF, 0xA2, 0x00, 0x8E + }; + readonly byte[] _pascalSign = + { + 0x08, 0xA5, 0x0F, 0x29 + }; + readonly byte[] _pascalString = "SYSTE.APPLE"u8.ToArray(); + readonly ulong[] _proDosSkewing = + { + 0, 8, 1, 9, 2, 10, 3, 11, 4, 12, 5, 13, 6, 14, 7, 15 + }; + readonly byte[] _prodosString = "PRODOS"u8.ToArray(); + readonly byte[] _sosSign = + { + 0xC9, 0x20, 0xF0, 0x3E + }; } \ No newline at end of file diff --git a/Aaru.Images/AppleNIB/Read.cs b/Aaru.Images/AppleNIB/Read.cs index 51fb72936..4df74ea04 100644 --- a/Aaru.Images/AppleNIB/Read.cs +++ b/Aaru.Images/AppleNIB/Read.cs @@ -80,12 +80,19 @@ public sealed partial class AppleNib if(skewed) { foreach(bool isDos in from sector in tracks[17].sectors - where sector.addressField.sector.SequenceEqual(new byte[] { 170, 170 }) + where sector.addressField.sector.SequenceEqual(new byte[] + { + 170, 170 + }) select Apple2.DecodeSector(sector) into sector0 where sector0 != null - select sector0[0x01] == 17 && sector0[0x02] < 16 && sector0[0x27] <= 122 && - sector0[0x34] == 35 && sector0[0x35] == 16 && sector0[0x36] == 0 && + select sector0[0x01] == 17 && + sector0[0x02] < 16 && + sector0[0x27] <= 122 && + sector0[0x34] == 35 && + sector0[0x35] == 16 && + sector0[0x36] == 0 && sector0[0x37] == 1) { if(isDos) @@ -105,7 +112,8 @@ public sealed partial class AppleNib if(skewed && spt != 0) { var sectorNo = (ulong)(((sector.addressField.sector[0] & 0x55) << 1 | - sector.addressField.sector[1] & 0x55) & 0xFF); + sector.addressField.sector[1] & 0x55) & + 0xFF); AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Hardware_sector_0_of_track_1_goes_to_logical_sector_2, diff --git a/Aaru.Images/Apridisk/Properties.cs b/Aaru.Images/Apridisk/Properties.cs index 13fb3bf05..afbab278d 100644 --- a/Aaru.Images/Apridisk/Properties.cs +++ b/Aaru.Images/Apridisk/Properties.cs @@ -77,11 +77,11 @@ public sealed partial class Apridisk { MediaType.ACORN_35_DS_DD, MediaType.ACORN_35_DS_HD, MediaType.Apricot_35, MediaType.ATARI_35_DS_DD, MediaType.ATARI_35_DS_DD_11, MediaType.ATARI_35_SS_DD, MediaType.ATARI_35_SS_DD_11, MediaType.DMF, - MediaType.DMF_82, MediaType.DOS_35_DS_DD_8, MediaType.DOS_35_DS_DD_9, MediaType.DOS_35_ED, - MediaType.DOS_35_HD, MediaType.DOS_35_SS_DD_8, MediaType.DOS_35_SS_DD_9, MediaType.DOS_525_DS_DD_8, - MediaType.DOS_525_DS_DD_9, MediaType.DOS_525_HD, MediaType.DOS_525_SS_DD_8, MediaType.DOS_525_SS_DD_9, - MediaType.FDFORMAT_35_DD, MediaType.FDFORMAT_35_HD, MediaType.FDFORMAT_525_DD, MediaType.FDFORMAT_525_HD, - MediaType.RX50, MediaType.XDF_35, MediaType.XDF_525, MediaType.MetaFloppy_Mod_I, MediaType.MetaFloppy_Mod_II + MediaType.DMF_82, MediaType.DOS_35_DS_DD_8, MediaType.DOS_35_DS_DD_9, MediaType.DOS_35_ED, MediaType.DOS_35_HD, + MediaType.DOS_35_SS_DD_8, MediaType.DOS_35_SS_DD_9, MediaType.DOS_525_DS_DD_8, MediaType.DOS_525_DS_DD_9, + MediaType.DOS_525_HD, MediaType.DOS_525_SS_DD_8, MediaType.DOS_525_SS_DD_9, MediaType.FDFORMAT_35_DD, + MediaType.FDFORMAT_35_HD, MediaType.FDFORMAT_525_DD, MediaType.FDFORMAT_525_HD, MediaType.RX50, + MediaType.XDF_35, MediaType.XDF_525, MediaType.MetaFloppy_Mod_I, MediaType.MetaFloppy_Mod_II }; /// @@ -91,7 +91,10 @@ public sealed partial class Apridisk }; /// - public IEnumerable KnownExtensions => new[] { ".dsk" }; + public IEnumerable KnownExtensions => new[] + { + ".dsk" + }; /// public bool IsWriting { get; private set; } diff --git a/Aaru.Images/Apridisk/Read.cs b/Aaru.Images/Apridisk/Read.cs index 5e70f588e..e9cf392b8 100644 --- a/Aaru.Images/Apridisk/Read.cs +++ b/Aaru.Images/Apridisk/Read.cs @@ -69,15 +69,13 @@ public sealed partial class Apridisk { // Deleted record, just skip it case RecordType.Deleted: - AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Found_deleted_record_at_0, - stream.Position); + AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Found_deleted_record_at_0, stream.Position); stream.Seek(record.headerSize - recordSize + record.dataSize, SeekOrigin.Current); break; case RecordType.Comment: - AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Found_comment_record_at_0, - stream.Position); + AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Found_comment_record_at_0, stream.Position); stream.Seek(record.headerSize - recordSize, SeekOrigin.Current); var commentB = new byte[record.dataSize]; @@ -87,8 +85,7 @@ public sealed partial class Apridisk break; case RecordType.Creator: - AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Found_creator_record_at_0, - stream.Position); + AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Found_creator_record_at_0, stream.Position); stream.Seek(record.headerSize - recordSize, SeekOrigin.Current); var creatorB = new byte[record.dataSize]; @@ -98,8 +95,7 @@ public sealed partial class Apridisk break; case RecordType.Sector: - if(record.compression != CompressType.Compressed && - record.compression != CompressType.Uncompresed) + if(record.compression != CompressType.Compressed && record.compression != CompressType.Uncompresed) return ErrorNumber.NotSupported; AaruConsole.DebugWriteLine(MODULE_NAME, @@ -130,8 +126,7 @@ public sealed partial class Apridisk totalCylinders++; totalHeads++; - if(totalCylinders <= 0 || - totalHeads <= 0) + if(totalCylinders <= 0 || totalHeads <= 0) return ErrorNumber.NotSupported; _sectorsData = new byte[totalCylinders][][][]; diff --git a/Aaru.Images/Apridisk/Write.cs b/Aaru.Images/Apridisk/Write.cs index 7a981d14b..c81c885e0 100644 --- a/Aaru.Images/Apridisk/Write.cs +++ b/Aaru.Images/Apridisk/Write.cs @@ -186,8 +186,7 @@ public sealed partial class Apridisk { for(byte s = 0; s < _imageInfo.SectorsPerTrack; s++) { - if(_sectorsData[c][h][s] == null || - _sectorsData[c][h][s].Length == 0) + if(_sectorsData[c][h][s] == null || _sectorsData[c][h][s].Length == 0) continue; var record = new Record diff --git a/Aaru.Images/BLU/Properties.cs b/Aaru.Images/BLU/Properties.cs index 7e8eab8f2..0048997fb 100644 --- a/Aaru.Images/BLU/Properties.cs +++ b/Aaru.Images/BLU/Properties.cs @@ -69,7 +69,10 @@ public sealed partial class Blu public IEnumerable SupportedMediaTags => Array.Empty(); /// - public IEnumerable SupportedSectorTags => new[] { SectorTagType.AppleSectorTag }; + public IEnumerable SupportedSectorTags => new[] + { + SectorTagType.AppleSectorTag + }; /// public IEnumerable SupportedMediaTypes => new[] @@ -84,7 +87,10 @@ public sealed partial class Blu Array.Empty<(string name, Type type, string description, object @default)>(); /// - public IEnumerable KnownExtensions => new[] { ".blu" }; // Just invented + public IEnumerable KnownExtensions => new[] + { + ".blu" + }; // Just invented /// public bool IsWriting { get; private set; } diff --git a/Aaru.Images/BlindWrite4/Read.cs b/Aaru.Images/BlindWrite4/Read.cs index af376a7e4..8026a402e 100644 --- a/Aaru.Images/BlindWrite4/Read.cs +++ b/Aaru.Images/BlindWrite4/Read.cs @@ -128,8 +128,7 @@ public sealed partial class BlindWrite4 stream.EnsureRead(tmpArray, 0, _header.Unknown3); _header.Unknown4 = tmpArray; - AaruConsole.DebugWriteLine(MODULE_NAME, "header.signature = {0}", - StringHandlers.CToString(_header.Signature)); + AaruConsole.DebugWriteLine(MODULE_NAME, "header.signature = {0}", StringHandlers.CToString(_header.Signature)); AaruConsole.DebugWriteLine(MODULE_NAME, "header.unknown1 = {0}", _header.Unknown1); AaruConsole.DebugWriteLine(MODULE_NAME, "header.timestamp = {0}", _header.Timestamp); @@ -144,8 +143,7 @@ public sealed partial class BlindWrite4 AaruConsole.DebugWriteLine(MODULE_NAME, "header.dataFilter = {0}", _header.DataFilter); AaruConsole.DebugWriteLine(MODULE_NAME, "header.dataFile = {0}", _header.DataFile); - AaruConsole.DebugWriteLine(MODULE_NAME, "header.subchannelFileLength = {0}", - _header.SubchannelFileLength); + AaruConsole.DebugWriteLine(MODULE_NAME, "header.subchannelFileLength = {0}", _header.SubchannelFileLength); AaruConsole.DebugWriteLine(MODULE_NAME, "header.subchannelFilter = {0}", _header.SubchannelFilter); AaruConsole.DebugWriteLine(MODULE_NAME, "header.subchannelFile = {0}", _header.SubchannelFile); @@ -330,8 +328,7 @@ public sealed partial class BlindWrite4 for(var j = 0; j < track.unknown1.Length; j++) { - AaruConsole.DebugWriteLine(MODULE_NAME, "track.unknown1[{1}] = 0x{0:X8}", track.unknown1[j], - j); + AaruConsole.DebugWriteLine(MODULE_NAME, "track.unknown1[{1}] = 0x{0:X8}", track.unknown1[j], j); } AaruConsole.DebugWriteLine(MODULE_NAME, "track.unknown2 = {0}", track.unknown2); @@ -355,8 +352,7 @@ public sealed partial class BlindWrite4 for(var j = 0; j < track.unknown13.Length; j++) { - AaruConsole.DebugWriteLine(MODULE_NAME, "track.unknown13[{1}] = 0x{0:X8}", track.unknown13[j], - j); + AaruConsole.DebugWriteLine(MODULE_NAME, "track.unknown13[{1}] = 0x{0:X8}", track.unknown13[j], j); } AaruConsole.DebugWriteLine(MODULE_NAME, "track.titleLen = {0}", track.titleLen); @@ -416,29 +412,31 @@ public sealed partial class BlindWrite4 if(_dataFilter != null) break; - _dataFilter = filtersList.GetFilter(Path.Combine(imageFilter.ParentFolder, - _header.DataFile. - Split(new[] { '\\' }, - StringSplitOptions.RemoveEmptyEntries). - Last())); + _dataFilter = filtersList.GetFilter(Path.Combine(imageFilter.ParentFolder, _header.DataFile.Split(new[] + { + '\\' + }, StringSplitOptions.RemoveEmptyEntries). + Last())); if(_dataFilter != null) break; - _dataFilter = filtersList.GetFilter(Path.Combine(imageFilter.ParentFolder, - _header.DataFile. - Split(new[] { '\\' }, - StringSplitOptions.RemoveEmptyEntries). - Last().ToLower(CultureInfo.CurrentCulture))); + _dataFilter = filtersList.GetFilter(Path.Combine(imageFilter.ParentFolder, _header.DataFile.Split(new[] + { + '\\' + }, StringSplitOptions.RemoveEmptyEntries). + Last(). + ToLower(CultureInfo.CurrentCulture))); if(_dataFilter != null) break; - _dataFilter = filtersList.GetFilter(Path.Combine(imageFilter.ParentFolder, - _header.DataFile. - Split(new[] { '\\' }, - StringSplitOptions.RemoveEmptyEntries). - Last().ToUpper(CultureInfo.CurrentCulture))); + _dataFilter = filtersList.GetFilter(Path.Combine(imageFilter.ParentFolder, _header.DataFile.Split(new[] + { + '\\' + }, StringSplitOptions.RemoveEmptyEntries). + Last(). + ToUpper(CultureInfo.CurrentCulture))); if(_dataFilter != null) break; @@ -465,19 +463,23 @@ public sealed partial class BlindWrite4 _header.SubchannelFile.ToLower(CultureInfo.CurrentCulture)))) ?? filtersList.GetFilter(Path.Combine(imageFilter.ParentFolder, _header.SubchannelFile.ToUpper(CultureInfo.CurrentCulture)))) ?? - filtersList.GetFilter(Path.Combine(imageFilter.ParentFolder, - _header.SubchannelFile. - Split(new[] { '\\' }, - StringSplitOptions.RemoveEmptyEntries).Last()))) ?? - filtersList.GetFilter(Path.Combine(imageFilter.ParentFolder, - _header.SubchannelFile. - Split(new[] { '\\' }, - StringSplitOptions.RemoveEmptyEntries).Last(). - ToLower(CultureInfo.CurrentCulture)))) ?? - filtersList.GetFilter(Path.Combine(imageFilter.ParentFolder, - _header.SubchannelFile. - Split(new[] { '\\' }, StringSplitOptions.RemoveEmptyEntries). - Last().ToUpper(CultureInfo.CurrentCulture))); + filtersList.GetFilter(Path.Combine(imageFilter.ParentFolder, _header.SubchannelFile.Split(new[] + { + '\\' + }, StringSplitOptions.RemoveEmptyEntries). + Last()))) ?? + filtersList.GetFilter(Path.Combine(imageFilter.ParentFolder, _header.SubchannelFile.Split(new[] + { + '\\' + }, StringSplitOptions.RemoveEmptyEntries). + Last(). + ToLower(CultureInfo.CurrentCulture)))) ?? + filtersList.GetFilter(Path.Combine(imageFilter.ParentFolder, _header.SubchannelFile.Split(new[] + { + '\\' + }, StringSplitOptions.RemoveEmptyEntries). + Last(). + ToUpper(CultureInfo.CurrentCulture))); } Tracks = new List(); @@ -509,43 +511,46 @@ public sealed partial class BlindWrite4 track.Filter = filtersList.GetFilter(Path.Combine(imageFilter.ParentFolder, bwTrack.filename.ToLower(CultureInfo. - CurrentCulture))); + CurrentCulture))); if(track.Filter != null) break; track.Filter = filtersList.GetFilter(Path.Combine(imageFilter.ParentFolder, bwTrack.filename.ToUpper(CultureInfo. - CurrentCulture))); + CurrentCulture))); if(track.Filter != null) break; track.Filter = filtersList.GetFilter(Path.Combine(imageFilter.ParentFolder, bwTrack.filename. - Split(new[] { '\\' }, - StringSplitOptions. - RemoveEmptyEntries). + Split(new[] + { + '\\' + }, StringSplitOptions.RemoveEmptyEntries). Last())); if(track.Filter != null) break; track.Filter = filtersList.GetFilter(Path.Combine(imageFilter.ParentFolder, bwTrack.filename. - Split(new[] { '\\' }, - StringSplitOptions. - RemoveEmptyEntries). - Last().ToLower(CultureInfo. - CurrentCulture))); + Split(new[] + { + '\\' + }, StringSplitOptions.RemoveEmptyEntries). + Last(). + ToLower(CultureInfo.CurrentCulture))); if(track.Filter != null) break; track.Filter = filtersList.GetFilter(Path.Combine(imageFilter.ParentFolder, bwTrack.filename. - Split(new[] { '\\' }, - StringSplitOptions. - RemoveEmptyEntries). - Last().ToUpper(CultureInfo. - CurrentCulture))); + Split(new[] + { + '\\' + }, StringSplitOptions.RemoveEmptyEntries). + Last(). + ToUpper(CultureInfo.CurrentCulture))); track.Filter = _dataFilter; } while(true); @@ -778,13 +783,9 @@ public sealed partial class BlindWrite4 }; } - if(!data && - !firstData) + if(!data && !firstData) _imageInfo.MediaType = MediaType.CDDA; - else if(firstAudio && - data && - Sessions.Count > 1 && - mode2) + else if(firstAudio && data && Sessions.Count > 1 && mode2) _imageInfo.MediaType = MediaType.CDPLUS; else if(firstData && audio || mode2) _imageInfo.MediaType = MediaType.CDROMXA; @@ -954,8 +955,7 @@ public sealed partial class BlindWrite4 buffer = mode2Ms.ToArray(); } - else if(sectorOffset == 0 && - sectorSkip == 0) + else if(sectorOffset == 0 && sectorSkip == 0) buffer = br.ReadBytes((int)(sectorSize * length)); else { @@ -1007,7 +1007,10 @@ public sealed partial class BlindWrite4 if(!_trackFlags.TryGetValue((uint)sectorAddress, out byte flag)) return ErrorNumber.NoData; - buffer = new[] { flag }; + buffer = new[] + { + flag + }; return ErrorNumber.NoError; default: @@ -1149,13 +1152,10 @@ public sealed partial class BlindWrite4 var br = new BinaryReader(_imageStream); br.BaseStream. - Seek( - (long)(tag == SectorTagType.CdSectorSubchannel ? aaruTrack.SubchannelOffset : aaruTrack.FileOffset) + - (long)(sectorAddress * (sectorOffset + sectorSize + sectorSkip)), - SeekOrigin.Begin); + Seek((long)(tag == SectorTagType.CdSectorSubchannel ? aaruTrack.SubchannelOffset : aaruTrack.FileOffset) + (long)(sectorAddress * (sectorOffset + sectorSize + sectorSkip)), + SeekOrigin.Begin); - if(sectorOffset == 0 && - sectorSkip == 0) + if(sectorOffset == 0 && sectorSkip == 0) buffer = br.ReadBytes((int)(sectorSize * length)); else { diff --git a/Aaru.Images/BlindWrite5/Read.cs b/Aaru.Images/BlindWrite5/Read.cs index 2d5142c3b..30e4f5712 100644 --- a/Aaru.Images/BlindWrite5/Read.cs +++ b/Aaru.Images/BlindWrite5/Read.cs @@ -71,8 +71,7 @@ public sealed partial class BlindWrite5 stream.EnsureRead(hdr, 0, 260); _header = Marshal.ByteArrayToStructureLittleEndian
(hdr); - AaruConsole.DebugWriteLine(MODULE_NAME, "header.signature = {0}", - StringHandlers.CToString(_header.signature)); + AaruConsole.DebugWriteLine(MODULE_NAME, "header.signature = {0}", StringHandlers.CToString(_header.signature)); for(var i = 0; i < _header.unknown1.Length; i++) AaruConsole.DebugWriteLine(MODULE_NAME, "header.unknown1[{1}] = 0x{0:X8}", _header.unknown1[i], i); @@ -108,17 +107,13 @@ public sealed partial class BlindWrite5 AaruConsole.DebugWriteLine(MODULE_NAME, "header.manufacturer = {0}", StringHandlers.CToString(_header.manufacturer)); - AaruConsole.DebugWriteLine(MODULE_NAME, "header.product = {0}", - StringHandlers.CToString(_header.product)); + AaruConsole.DebugWriteLine(MODULE_NAME, "header.product = {0}", StringHandlers.CToString(_header.product)); - AaruConsole.DebugWriteLine(MODULE_NAME, "header.revision = {0}", - StringHandlers.CToString(_header.revision)); + AaruConsole.DebugWriteLine(MODULE_NAME, "header.revision = {0}", StringHandlers.CToString(_header.revision)); - AaruConsole.DebugWriteLine(MODULE_NAME, "header.vendor = {0}", - StringHandlers.CToString(_header.vendor)); + AaruConsole.DebugWriteLine(MODULE_NAME, "header.vendor = {0}", StringHandlers.CToString(_header.vendor)); - AaruConsole.DebugWriteLine(MODULE_NAME, "header.volumeId = {0}", - StringHandlers.CToString(_header.volumeId)); + AaruConsole.DebugWriteLine(MODULE_NAME, "header.volumeId = {0}", StringHandlers.CToString(_header.volumeId)); AaruConsole.DebugWriteLine(MODULE_NAME, "header.mode2ALen = {0}", _header.mode2ALen); AaruConsole.DebugWriteLine(MODULE_NAME, "header.unkBlkLen = {0}", _header.unkBlkLen); @@ -301,16 +296,14 @@ public sealed partial class BlindWrite5 for(var i = 0; i < dataFile.Unknown1.Length; i++) { - AaruConsole.DebugWriteLine(MODULE_NAME, "dataFile.unknown1[{1}] = {0}", dataFile.Unknown1[i], - i); + AaruConsole.DebugWriteLine(MODULE_NAME, "dataFile.unknown1[{1}] = {0}", dataFile.Unknown1[i], i); } AaruConsole.DebugWriteLine(MODULE_NAME, "dataFile.offset = {0}", dataFile.Offset); for(var i = 0; i < dataFile.Unknown2.Length; i++) { - AaruConsole.DebugWriteLine(MODULE_NAME, "dataFile.unknown2[{1}] = {0}", dataFile.Unknown2[i], - i); + AaruConsole.DebugWriteLine(MODULE_NAME, "dataFile.unknown2[{1}] = {0}", dataFile.Unknown2[i], i); } AaruConsole.DebugWriteLine(MODULE_NAME, "dataFile.startLba = {0}", dataFile.StartLba); @@ -364,18 +357,18 @@ public sealed partial class BlindWrite5 for(var i = 0; i < session.Tracks[tSeq].unknown1.Length; i++) { - AaruConsole.DebugWriteLine(MODULE_NAME, "session[{0}].track[{1}].unknown1[{2}] = 0x{3:X2}", - ses, tSeq, i, session.Tracks[tSeq].unknown1[i]); + AaruConsole.DebugWriteLine(MODULE_NAME, "session[{0}].track[{1}].unknown1[{2}] = 0x{3:X2}", ses, + tSeq, i, session.Tracks[tSeq].unknown1[i]); } - AaruConsole.DebugWriteLine(MODULE_NAME, "session[{0}].track[{1}].unknown2 = 0x{2:X8}", ses, - tSeq, session.Tracks[tSeq].unknown2); + AaruConsole.DebugWriteLine(MODULE_NAME, "session[{0}].track[{1}].unknown2 = 0x{2:X8}", ses, tSeq, + session.Tracks[tSeq].unknown2); AaruConsole.DebugWriteLine(MODULE_NAME, "session[{0}].track[{1}].subchannel = {2}", ses, tSeq, session.Tracks[tSeq].subchannel); - AaruConsole.DebugWriteLine(MODULE_NAME, "session[{0}].track[{1}].unknown3 = 0x{2:X2}", ses, - tSeq, session.Tracks[tSeq].unknown3); + AaruConsole.DebugWriteLine(MODULE_NAME, "session[{0}].track[{1}].unknown3 = 0x{2:X2}", ses, tSeq, + session.Tracks[tSeq].unknown3); AaruConsole.DebugWriteLine(MODULE_NAME, "session[{0}].track[{1}].ctl = {2}", ses, tSeq, session.Tracks[tSeq].ctl); @@ -386,8 +379,8 @@ public sealed partial class BlindWrite5 AaruConsole.DebugWriteLine(MODULE_NAME, "session[{0}].track[{1}].point = {2}", ses, tSeq, session.Tracks[tSeq].point); - AaruConsole.DebugWriteLine(MODULE_NAME, "session[{0}].track[{1}].unknown4 = 0x{2:X2}", ses, - tSeq, session.Tracks[tSeq].tno); + AaruConsole.DebugWriteLine(MODULE_NAME, "session[{0}].track[{1}].unknown4 = 0x{2:X2}", ses, tSeq, + session.Tracks[tSeq].tno); AaruConsole.DebugWriteLine(MODULE_NAME, "session[{0}].track[{1}].min = {2}", ses, tSeq, session.Tracks[tSeq].min); @@ -410,16 +403,16 @@ public sealed partial class BlindWrite5 AaruConsole.DebugWriteLine(MODULE_NAME, "session[{0}].track[{1}].pframe = {2}", ses, tSeq, session.Tracks[tSeq].pframe); - AaruConsole.DebugWriteLine(MODULE_NAME, "session[{0}].track[{1}].unknown5 = 0x{2:X2}", ses, - tSeq, session.Tracks[tSeq].unknown5); + AaruConsole.DebugWriteLine(MODULE_NAME, "session[{0}].track[{1}].unknown5 = 0x{2:X2}", ses, tSeq, + session.Tracks[tSeq].unknown5); AaruConsole.DebugWriteLine(MODULE_NAME, "session[{0}].track[{1}].pregap = {2}", ses, tSeq, session.Tracks[tSeq].pregap); for(var i = 0; i < session.Tracks[tSeq].unknown6.Length; i++) { - AaruConsole.DebugWriteLine(MODULE_NAME, "session[{0}].track[{1}].unknown6[{2}] = 0x{3:X8}", - ses, tSeq, i, session.Tracks[tSeq].unknown6[i]); + AaruConsole.DebugWriteLine(MODULE_NAME, "session[{0}].track[{1}].unknown6[{2}] = 0x{3:X8}", ses, + tSeq, i, session.Tracks[tSeq].unknown6[i]); } AaruConsole.DebugWriteLine(MODULE_NAME, "session[{0}].track[{1}].startLba = {2}", ses, tSeq, @@ -430,15 +423,15 @@ public sealed partial class BlindWrite5 for(var i = 0; i < session.Tracks[tSeq].unknown7.Length; i++) { - AaruConsole.DebugWriteLine(MODULE_NAME, "session[{0}].track[{1}].unknown7[{2}] = 0x{3:X8}", - ses, tSeq, i, session.Tracks[tSeq].unknown7[i]); + AaruConsole.DebugWriteLine(MODULE_NAME, "session[{0}].track[{1}].unknown7[{2}] = 0x{3:X8}", ses, + tSeq, i, session.Tracks[tSeq].unknown7[i]); } AaruConsole.DebugWriteLine(MODULE_NAME, "session[{0}].track[{1}].session = {2}", ses, tSeq, session.Tracks[tSeq].session); - AaruConsole.DebugWriteLine(MODULE_NAME, "session[{0}].track[{1}].unknown8 = 0x{2:X4}", ses, - tSeq, session.Tracks[tSeq].unknown8); + AaruConsole.DebugWriteLine(MODULE_NAME, "session[{0}].track[{1}].unknown8 = 0x{2:X4}", ses, tSeq, + session.Tracks[tSeq].unknown8); if(session.Tracks[tSeq].type is TrackType.Dvd or TrackType.NotData) continue; @@ -446,9 +439,8 @@ public sealed partial class BlindWrite5 { for(var i = 0; i < session.Tracks[tSeq].unknown9.Length; i++) { - AaruConsole.DebugWriteLine(MODULE_NAME, - "session[{0}].track[{1}].unknown9[{2}] = 0x{3:X8}", ses, tSeq, i, - session.Tracks[tSeq].unknown9[i]); + AaruConsole.DebugWriteLine(MODULE_NAME, "session[{0}].track[{1}].unknown9[{2}] = 0x{3:X8}", ses, + tSeq, i, session.Tracks[tSeq].unknown9[i]); } } } @@ -551,7 +543,8 @@ public sealed partial class BlindWrite5 } else if(filtersList.GetFilter(Path.Combine(imageFilter.ParentFolder, dataFile.Filename.ToLower(CultureInfo. - CurrentCulture))) != null) + CurrentCulture))) != + null) { chars.FilePath = dataFile.Filename.ToLower(CultureInfo.CurrentCulture); @@ -562,7 +555,8 @@ public sealed partial class BlindWrite5 } else if(filtersList.GetFilter(Path.Combine(imageFilter.ParentFolder, dataFile.Filename.ToUpper(CultureInfo. - CurrentCulture))) != null) + CurrentCulture))) != + null) { chars.FilePath = dataFile.Filename.ToUpper(CultureInfo.CurrentCulture); @@ -572,7 +566,8 @@ public sealed partial class BlindWrite5 CurrentCulture))); } else if(filtersList.GetFilter(Path.Combine(imageFilter.ParentFolder, - dataFile.Filename)) != null) + dataFile.Filename)) != + null) { chars.FilePath = dataFile.Filename; @@ -629,7 +624,10 @@ public sealed partial class BlindWrite5 Partitions = new List(); var fullTocStream = new MemoryStream(); - fullTocStream.Write(new byte[] { 0, 0 }, 0, 2); + fullTocStream.Write(new byte[] + { + 0, 0 + }, 0, 2); ulong offsetBytes = 0; _offsetMap = new Dictionary(); @@ -789,7 +787,8 @@ public sealed partial class BlindWrite5 string basePath; bool version5 = string.Compare(Path.GetExtension(imageFilter.Filename), ".B5T", - StringComparison.OrdinalIgnoreCase) == 0; + StringComparison.OrdinalIgnoreCase) == + 0; string firstExtension = version5 ? "B5I" : "B6I"; string firstExtensionLower = version5 ? "b5i" : "b6i"; @@ -831,9 +830,8 @@ public sealed partial class BlindWrite5 basePath = _dataPath; lowerCaseFileName = true; } - else if(File.Exists(Path.Combine(_dataPath, - $"{filename.ToLower(CultureInfo.CurrentCulture)}.{ - firstExtensionLower}"))) + else if(File.Exists(Path.Combine(_dataPath, $"{filename.ToLower(CultureInfo.CurrentCulture)}.{ + firstExtensionLower}"))) { basePath = _dataPath; lowerCaseFileName = true; @@ -940,9 +938,8 @@ public sealed partial class BlindWrite5 basePath = ""; lowerCaseFileName = true; } - else if(File.Exists(Path.Combine("", - $"{filename.ToLower(CultureInfo.CurrentCulture)}.{ - firstExtensionLower}"))) + else if(File.Exists(Path.Combine("", $"{filename.ToLower(CultureInfo.CurrentCulture)}.{ + firstExtensionLower}"))) { basePath = ""; lowerCaseFileName = true; @@ -965,10 +962,7 @@ public sealed partial class BlindWrite5 try { splitStream. - Add( - Path.Combine( - basePath, - $"{filename}.{(lowerCaseExtension ? firstExtensionLower : firstExtension)}"), + Add(Path.Combine(basePath, $"{filename}.{(lowerCaseExtension ? firstExtensionLower : firstExtension)}"), FileMode.Open, FileAccess.Read); splitStream.AddRange(basePath, $"{filename}.{extension}"); @@ -985,8 +979,7 @@ public sealed partial class BlindWrite5 if(trk.startLba >= 0) { - track.FileOffset = - (ulong)(trk.startLba * splitStartChars.SectorSize + splitStartChars.Offset); + track.FileOffset = (ulong)(trk.startLba * splitStartChars.SectorSize + splitStartChars.Offset); } else track.FileOffset = (ulong)(trk.startLba * -1 * splitStartChars.SectorSize); @@ -1053,8 +1046,7 @@ public sealed partial class BlindWrite5 track.Sequence = trk.point; track.Type = BlindWriteTrackTypeToTrackType(trk.type); - if(trk.pregap > 0 && - track.StartSector > 0) + if(trk.pregap > 0 && track.StartSector > 0) { track.Indexes[0] = (int)track.StartSector - (int)trk.pregap; @@ -1102,16 +1094,13 @@ public sealed partial class BlindWrite5 { AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Partition_sequence_0, track.Sequence); - AaruConsole.DebugWriteLine(MODULE_NAME, "\t" + Localization.Track_description_0, - track.Description); + AaruConsole.DebugWriteLine(MODULE_NAME, "\t" + Localization.Track_description_0, track.Description); AaruConsole.DebugWriteLine(MODULE_NAME, "\t" + Localization.Track_type_0, track.Type); - AaruConsole.DebugWriteLine(MODULE_NAME, "\t" + Localization.Track_starting_sector_0, - track.StartSector); + AaruConsole.DebugWriteLine(MODULE_NAME, "\t" + Localization.Track_starting_sector_0, track.StartSector); - AaruConsole.DebugWriteLine(MODULE_NAME, "\t" + Localization.Track_ending_sector_0, - track.EndSector); + AaruConsole.DebugWriteLine(MODULE_NAME, "\t" + Localization.Track_ending_sector_0, track.EndSector); } AaruConsole.DebugWriteLine(MODULE_NAME, Localization.printing_partition_map); @@ -1121,21 +1110,17 @@ public sealed partial class BlindWrite5 AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Partition_sequence_0, partition.Sequence); AaruConsole.DebugWriteLine(MODULE_NAME, "\t" + Localization.Partition_name_0, partition.Name); - AaruConsole.DebugWriteLine(MODULE_NAME, "\t" + Localization.Partition_description_0, - partition.Description); + AaruConsole.DebugWriteLine(MODULE_NAME, "\t" + Localization.Partition_description_0, partition.Description); AaruConsole.DebugWriteLine(MODULE_NAME, "\t" + Localization.Partition_type_0, partition.Type); - AaruConsole.DebugWriteLine(MODULE_NAME, "\t" + Localization.Partition_starting_sector_0, - partition.Start); + AaruConsole.DebugWriteLine(MODULE_NAME, "\t" + Localization.Partition_starting_sector_0, partition.Start); AaruConsole.DebugWriteLine(MODULE_NAME, "\t" + Localization.Partition_sectors_0, partition.Length); - AaruConsole.DebugWriteLine(MODULE_NAME, "\t" + Localization.Partition_starting_offset_0, - partition.Offset); + AaruConsole.DebugWriteLine(MODULE_NAME, "\t" + Localization.Partition_starting_offset_0, partition.Offset); - AaruConsole.DebugWriteLine(MODULE_NAME, "\t" + Localization.Partition_size_in_bytes_0, - partition.Size); + AaruConsole.DebugWriteLine(MODULE_NAME, "\t" + Localization.Partition_size_in_bytes_0, partition.Size); } if(!isDvd) @@ -1153,8 +1138,7 @@ public sealed partial class BlindWrite5 _imageInfo.MediaType = BlindWriteProfileToMediaType(_header.profile); - if(_dmi != null && - _pfi != null) + if(_dmi != null && _pfi != null) { PFI.PhysicalFormatInformation? pfi0 = PFI.Decode(_pfi, _imageInfo.MediaType); @@ -1225,13 +1209,9 @@ public sealed partial class BlindWrite5 } } - if(!data && - !firstData) + if(!data && !firstData) _imageInfo.MediaType = MediaType.CDDA; - else if(firstAudio && - data && - Sessions.Count > 1 && - mode2) + else if(firstAudio && data && Sessions.Count > 1 && mode2) _imageInfo.MediaType = MediaType.CDPLUS; else if(firstData && audio || mode2) _imageInfo.MediaType = MediaType.CDROMXA; @@ -1479,13 +1459,11 @@ public sealed partial class BlindWrite5 DataFileCharacteristics chars = (from characteristics in _filePaths let firstSector = characteristics.StartLba let lastSector = firstSector + characteristics.Sectors - 1 - let wantedSector = - (int)(sectorAddress + aaruTrack.StartSector) + let wantedSector = (int)(sectorAddress + aaruTrack.StartSector) where wantedSector >= firstSector && wantedSector <= lastSector select characteristics).FirstOrDefault(); - if(string.IsNullOrEmpty(chars.FilePath) || - chars.FileFilter == null) + if(string.IsNullOrEmpty(chars.FilePath) || chars.FileFilter == null) return ErrorNumber.SectorNotFound; uint sectorOffset; @@ -1577,8 +1555,7 @@ public sealed partial class BlindWrite5 buffer = mode2Ms.ToArray(); } - else if(sectorOffset == 0 && - sectorSkip == 0) + else if(sectorOffset == 0 && sectorSkip == 0) buffer = br.ReadBytes((int)(sectorSize * length)); else { @@ -1612,13 +1589,11 @@ public sealed partial class BlindWrite5 DataFileCharacteristics chars = (from characteristics in _filePaths let firstSector = characteristics.StartLba let lastSector = firstSector + characteristics.Sectors - 1 - let wantedSector = - (int)(sectorAddress + aaruTrack.StartSector) + let wantedSector = (int)(sectorAddress + aaruTrack.StartSector) where wantedSector >= firstSector && wantedSector <= lastSector select characteristics).FirstOrDefault(); - if(string.IsNullOrEmpty(chars.FilePath) || - chars.FileFilter == null) + if(string.IsNullOrEmpty(chars.FilePath) || chars.FileFilter == null) return ErrorNumber.SectorNotFound; if(aaruTrack.Type == CommonTypes.Enums.TrackType.Data) @@ -1639,7 +1614,10 @@ public sealed partial class BlindWrite5 if(!_trackFlags.TryGetValue((uint)sectorAddress, out byte flag)) return ErrorNumber.NoData; - buffer = new[] { flag }; + buffer = new[] + { + flag + }; return ErrorNumber.NoError; default: @@ -2074,8 +2052,7 @@ public sealed partial class BlindWrite5 Seek((long)aaruTrack.FileOffset + (long)(sectorAddress * (sectorOffset + sectorSize + sectorSkip)), SeekOrigin.Begin); - if(sectorOffset == 0 && - sectorSkip == 0) + if(sectorOffset == 0 && sectorSkip == 0) buffer = br.ReadBytes((int)(sectorSize * length)); else { @@ -2143,13 +2120,11 @@ public sealed partial class BlindWrite5 DataFileCharacteristics chars = (from characteristics in _filePaths let firstSector = characteristics.StartLba let lastSector = firstSector + characteristics.Sectors - 1 - let wantedSector = - (int)(sectorAddress + aaruTrack.StartSector) + let wantedSector = (int)(sectorAddress + aaruTrack.StartSector) where wantedSector >= firstSector && wantedSector <= lastSector select characteristics).FirstOrDefault(); - if(string.IsNullOrEmpty(chars.FilePath) || - chars.FileFilter == null) + if(string.IsNullOrEmpty(chars.FilePath) || chars.FileFilter == null) return ErrorNumber.SectorNotFound; uint sectorOffset; diff --git a/Aaru.Images/ByteAddressable/AtariLynx.cs b/Aaru.Images/ByteAddressable/AtariLynx.cs index b68e4a125..348afbbb4 100644 --- a/Aaru.Images/ByteAddressable/AtariLynx.cs +++ b/Aaru.Images/ByteAddressable/AtariLynx.cs @@ -138,13 +138,19 @@ public class AtariLynx : IByteAddressableImage public bool IsWriting { get; private set; } /// - public IEnumerable KnownExtensions => new[] { ".lnx" }; + public IEnumerable KnownExtensions => new[] + { + ".lnx" + }; /// public IEnumerable SupportedMediaTags => Array.Empty(); /// - public IEnumerable SupportedMediaTypes => new[] { MediaType.AtariLynxCard }; + public IEnumerable SupportedMediaTypes => new[] + { + MediaType.AtariLynxCard + }; /// public IEnumerable<(string name, Type type, string description, object @default)> SupportedOptions => diff --git a/Aaru.Images/ByteAddressable/GameBoy.cs b/Aaru.Images/ByteAddressable/GameBoy.cs index 0bcf9625f..73b6d7ccd 100644 --- a/Aaru.Images/ByteAddressable/GameBoy.cs +++ b/Aaru.Images/ByteAddressable/GameBoy.cs @@ -149,13 +149,19 @@ public class GameBoy : IByteAddressableImage public bool IsWriting { get; private set; } /// - public IEnumerable KnownExtensions => new[] { ".gb", ".gbc", ".sgb" }; + public IEnumerable KnownExtensions => new[] + { + ".gb", ".gbc", ".sgb" + }; /// public IEnumerable SupportedMediaTags => Array.Empty(); /// - public IEnumerable SupportedMediaTypes => new[] { MediaType.GameBoyGamePak }; + public IEnumerable SupportedMediaTypes => new[] + { + MediaType.GameBoyGamePak + }; /// public IEnumerable<(string name, Type type, string description, object @default)> SupportedOptions => diff --git a/Aaru.Images/ByteAddressable/GameBoyAdvance.cs b/Aaru.Images/ByteAddressable/GameBoyAdvance.cs index b9ec93f4f..3fc3f5af1 100644 --- a/Aaru.Images/ByteAddressable/GameBoyAdvance.cs +++ b/Aaru.Images/ByteAddressable/GameBoyAdvance.cs @@ -127,13 +127,19 @@ public class GameBoyAdvance : IByteAddressableImage public bool IsWriting { get; private set; } /// - public IEnumerable KnownExtensions => new[] { ".gba" }; + public IEnumerable KnownExtensions => new[] + { + ".gba" + }; /// public IEnumerable SupportedMediaTags => Array.Empty(); /// - public IEnumerable SupportedMediaTypes => new[] { MediaType.GameBoyAdvanceGamePak }; + public IEnumerable SupportedMediaTypes => new[] + { + MediaType.GameBoyAdvanceGamePak + }; /// public IEnumerable<(string name, Type type, string description, object @default)> SupportedOptions => diff --git a/Aaru.Images/ByteAddressable/MasterSystem.cs b/Aaru.Images/ByteAddressable/MasterSystem.cs index 61a521c65..85a6ec3ec 100644 --- a/Aaru.Images/ByteAddressable/MasterSystem.cs +++ b/Aaru.Images/ByteAddressable/MasterSystem.cs @@ -145,8 +145,10 @@ public class MasterSystem : IByteAddressableImage var sb = new StringBuilder(); - int productCode = (header.ProductCode[0] & 0xF) + (header.ProductCode[0] & 0xF0) * 10 + - (header.ProductCode[1] & 0xF) * 100 + (header.ProductCode[1] & 0xF0) * 1000 + + int productCode = (header.ProductCode[0] & 0xF) + + (header.ProductCode[0] & 0xF0) * 10 + + (header.ProductCode[1] & 0xF) * 100 + + (header.ProductCode[1] & 0xF0) * 1000 + ((header.VersionAndProduct & 0xF0) >> 4) * 10000; sb.AppendFormat(Localization.Product_code_0, productCode).AppendLine(); @@ -229,7 +231,10 @@ public class MasterSystem : IByteAddressableImage public bool IsWriting { get; private set; } /// - public IEnumerable KnownExtensions => new[] { ".sms", ".gg" }; + public IEnumerable KnownExtensions => new[] + { + ".sms", ".gg" + }; /// public IEnumerable SupportedMediaTags => Array.Empty(); diff --git a/Aaru.Images/ByteAddressable/NES.cs b/Aaru.Images/ByteAddressable/NES.cs index 240da91eb..f4d02c39c 100644 --- a/Aaru.Images/ByteAddressable/NES.cs +++ b/Aaru.Images/ByteAddressable/NES.cs @@ -279,13 +279,19 @@ public class Nes : IByteAddressableImage public bool IsWriting { get; private set; } /// - public IEnumerable KnownExtensions => new[] { ".nes" }; + public IEnumerable KnownExtensions => new[] + { + ".nes" + }; /// public IEnumerable SupportedMediaTags => Array.Empty(); /// - public IEnumerable SupportedMediaTypes => new[] { MediaType.NESGamePak, MediaType.FamicomGamePak }; + public IEnumerable SupportedMediaTypes => new[] + { + MediaType.NESGamePak, MediaType.FamicomGamePak + }; /// public IEnumerable<(string name, Type type, string description, object @default)> SupportedOptions => @@ -424,8 +430,7 @@ public class Nes : IByteAddressableImage return ErrorNumber.InvalidArgument; } - if(mediaType != MediaType.FamicomGamePak && - mediaType != MediaType.NESGamePak) + if(mediaType != MediaType.FamicomGamePak && mediaType != MediaType.NESGamePak) { ErrorMessage = string.Format(Localization.Unsupported_media_format_0, mediaType); diff --git a/Aaru.Images/ByteAddressable/Nintendo64.cs b/Aaru.Images/ByteAddressable/Nintendo64.cs index df038f53d..47c139e50 100644 --- a/Aaru.Images/ByteAddressable/Nintendo64.cs +++ b/Aaru.Images/ByteAddressable/Nintendo64.cs @@ -69,11 +69,7 @@ public class Nintendo64 : IByteAddressableImage public List DumpHardware => null; /// - public string Format => !_opened - ? "Nintendo 64 cartridge dump" - : _interleaved - ? "Doctor V64" - : "Mr. Backup Z64"; + public string Format => !_opened ? "Nintendo 64 cartridge dump" : _interleaved ? "Doctor V64" : "Mr. Backup Z64"; /// public Guid Id => new("EF1B4319-48A0-4EEC-B8E8-D0EA36F8CC92"); @@ -806,13 +802,19 @@ public class Nintendo64 : IByteAddressableImage public bool IsWriting { get; private set; } /// - public IEnumerable KnownExtensions => new[] { ".n64", ".v64", ".z64" }; + public IEnumerable KnownExtensions => new[] + { + ".n64", ".v64", ".z64" + }; /// public IEnumerable SupportedMediaTags => Array.Empty(); /// - public IEnumerable SupportedMediaTypes => new[] { MediaType.N64GamePak }; + public IEnumerable SupportedMediaTypes => new[] + { + MediaType.N64GamePak + }; /// public IEnumerable<(string name, Type type, string description, object @default)> SupportedOptions => diff --git a/Aaru.Images/ByteAddressable/SegaMegaDrive.cs b/Aaru.Images/ByteAddressable/SegaMegaDrive.cs index fcd206487..33467dc0d 100644 --- a/Aaru.Images/ByteAddressable/SegaMegaDrive.cs +++ b/Aaru.Images/ByteAddressable/SegaMegaDrive.cs @@ -69,13 +69,9 @@ public class SegaMegaDrive : IByteAddressableImage public List DumpHardware => null; /// - public string Format => !_opened - ? "Mega Drive cartridge dump" - : _smd - ? "Super Magic Drive" - : _interleaved - ? "Multi Game Doctor 2" - : "Magicom"; + public string Format => !_opened ? "Mega Drive cartridge dump" : + _smd ? "Super Magic Drive" : + _interleaved ? "Multi Game Doctor 2" : "Magicom"; /// public Guid Id => new("7B1CE2E7-3BC4-4283-BFA4-F292D646DF15"); @@ -105,22 +101,17 @@ public class SegaMegaDrive : IByteAddressableImage stream.EnsureRead(buffer, 0, 4); // SEGA - if(buffer[0] == 0x53 && - buffer[1] == 0x45 && - buffer[2] == 0x47 && - buffer[3] == 0x41) + if(buffer[0] == 0x53 && buffer[1] == 0x45 && buffer[2] == 0x47 && buffer[3] == 0x41) return true; // EA - if(buffer[0] == 0x45 && - buffer[1] == 0x41) + if(buffer[0] == 0x45 && buffer[1] == 0x41) { stream.Position = stream.Length / 2 + 256; stream.EnsureRead(buffer, 0, 2); // SG - if(buffer[0] == 0x53 && - buffer[1] == 0x47) + if(buffer[0] == 0x53 && buffer[1] == 0x47) return true; } @@ -128,8 +119,7 @@ public class SegaMegaDrive : IByteAddressableImage stream.EnsureRead(buffer, 0, 4); // EA - if(buffer[0] != 0x45 || - buffer[1] != 0x41) + if(buffer[0] != 0x45 || buffer[1] != 0x41) return false; stream.Position = 8832; @@ -160,15 +150,13 @@ public class SegaMegaDrive : IByteAddressableImage bool found = buffer[0] == 0x53 && buffer[1] == 0x45 && buffer[2] == 0x47 && buffer[3] == 0x41; // EA - if(buffer[0] == 0x45 && - buffer[1] == 0x41) + if(buffer[0] == 0x45 && buffer[1] == 0x41) { stream.Position = stream.Length / 2 + 256; stream.EnsureRead(buffer, 0, 2); // SG - if(buffer[0] == 0x53 && - buffer[1] == 0x47) + if(buffer[0] == 0x53 && buffer[1] == 0x47) { _interleaved = true; found = true; @@ -179,15 +167,13 @@ public class SegaMegaDrive : IByteAddressableImage stream.EnsureRead(buffer, 0, 4); // EA - if(buffer[0] == 0x45 && - buffer[1] == 0x41) + if(buffer[0] == 0x45 && buffer[1] == 0x41) { stream.Position = 8832; stream.EnsureRead(buffer, 0, 2); // SG - if(buffer[0] == 0x53 && - buffer[1] == 0x47) + if(buffer[0] == 0x53 && buffer[1] == 0x47) { _smd = true; found = true; @@ -257,30 +243,36 @@ public class SegaMegaDrive : IByteAddressableImage AppendLine(); sb.AppendFormat(Localization.Copyright_string_0, - StringHandlers.SpacePaddedToString(header.Copyright, encoding)).AppendLine(); + StringHandlers.SpacePaddedToString(header.Copyright, encoding)). + AppendLine(); sb.AppendFormat(Localization.Domestic_title_0, - StringHandlers.SpacePaddedToString(header.DomesticTitle, encoding)).AppendLine(); + StringHandlers.SpacePaddedToString(header.DomesticTitle, encoding)). + AppendLine(); sb.AppendFormat(Localization.Overseas_title_0, - StringHandlers.SpacePaddedToString(header.OverseasTitle, encoding)).AppendLine(); + StringHandlers.SpacePaddedToString(header.OverseasTitle, encoding)). + AppendLine(); sb.AppendFormat(Localization.Serial_number_0, - StringHandlers.SpacePaddedToString(header.SerialNumber, encoding)).AppendLine(); + StringHandlers.SpacePaddedToString(header.SerialNumber, encoding)). + AppendLine(); sb.AppendFormat(Localization.Checksum_0_X4, header.Checksum).AppendLine(); sb.AppendFormat(Localization.Devices_supported_0, - StringHandlers.SpacePaddedToString(header.DeviceSupport, encoding)).AppendLine(); + StringHandlers.SpacePaddedToString(header.DeviceSupport, encoding)). + AppendLine(); sb.AppendFormat(Localization.ROM_starts_at_0_and_ends_at_1_2_bytes, header.RomStart, header.RomEnd, - header.RomEnd - header.RomStart + 1).AppendLine(); + header.RomEnd - header.RomStart + 1). + AppendLine(); sb.AppendFormat(Localization.RAM_starts_at_0_and_ends_at_1_2_bytes, header.RamStart, header.RamEnd, - header.RamEnd - header.RamStart + 1).AppendLine(); + header.RamEnd - header.RamStart + 1). + AppendLine(); - if(header.ExtraRamPresent[0] == 0x52 && - header.ExtraRamPresent[1] == 0x41) + if(header.ExtraRamPresent[0] == 0x52 && header.ExtraRamPresent[1] == 0x41) { sb.AppendLine(Localization.Extra_RAM_present); @@ -321,7 +313,8 @@ public class SegaMegaDrive : IByteAddressableImage header.ExtraRamEnd, (header.ExtraRamType & 0x10) == 0x10 ? (header.ExtraRamEnd - header.ExtraRamStart + 2) / 2 - : header.ExtraRamEnd - header.ExtraRamStart + 1).AppendLine(); + : header.ExtraRamEnd - header.ExtraRamStart + 1). + AppendLine(); } else sb.AppendLine(Localization.Extra_RAM_not_present); @@ -363,7 +356,10 @@ public class SegaMegaDrive : IByteAddressableImage public bool IsWriting { get; private set; } /// - public IEnumerable KnownExtensions => new[] { ".smd", ".md", ".32x" }; + public IEnumerable KnownExtensions => new[] + { + ".smd", ".md", ".32x" + }; /// public IEnumerable SupportedMediaTags => Array.Empty(); diff --git a/Aaru.Images/ByteAddressable/SuperNintendo.cs b/Aaru.Images/ByteAddressable/SuperNintendo.cs index 9573581f8..550231b8c 100644 --- a/Aaru.Images/ByteAddressable/SuperNintendo.cs +++ b/Aaru.Images/ByteAddressable/SuperNintendo.cs @@ -72,8 +72,7 @@ public class SuperNintendo : IByteAddressableImage stream.EnsureRead(headerBytes, 0, 48); header = Marshal.ByteArrayToStructureLittleEndian
(headerBytes); - if((header.Mode & 0xF) == 0x5 || - (header.Mode & 0xF) == 0xA) + if((header.Mode & 0xF) == 0x5 || (header.Mode & 0xF) == 0xA) return true; break; @@ -85,8 +84,7 @@ public class SuperNintendo : IByteAddressableImage stream.EnsureRead(headerBytes, 0, 48); header = Marshal.ByteArrayToStructureLittleEndian
(headerBytes); - if((header.Mode & 0xF) == 0x1 || - (header.Mode & 0xF) == 0xA) + if((header.Mode & 0xF) == 0x1 || (header.Mode & 0xF) == 0xA) return true; break; @@ -127,8 +125,7 @@ public class SuperNintendo : IByteAddressableImage stream.EnsureRead(headerBytes, 0, 48); _header = Marshal.ByteArrayToStructureLittleEndian
(headerBytes); - if((_header.Mode & 0xF) == 0x5 || - (_header.Mode & 0xF) == 0xA) + if((_header.Mode & 0xF) == 0x5 || (_header.Mode & 0xF) == 0xA) found = true; break; @@ -140,8 +137,7 @@ public class SuperNintendo : IByteAddressableImage stream.EnsureRead(headerBytes, 0, 48); _header = Marshal.ByteArrayToStructureLittleEndian
(headerBytes); - if((_header.Mode & 0xF) == 0x1 || - (_header.Mode & 0xF) == 0xA) + if((_header.Mode & 0xF) == 0x1 || (_header.Mode & 0xF) == 0xA) found = true; break; @@ -153,9 +149,7 @@ public class SuperNintendo : IByteAddressableImage stream.EnsureRead(headerBytes, 0, 48); _header = Marshal.ByteArrayToStructureLittleEndian
(headerBytes); - if((_header.Mode & 0xF) == 0x0 || - (_header.Mode & 0xF) == 0x2 || - (_header.Mode & 0xF) == 0x3) + if((_header.Mode & 0xF) == 0x0 || (_header.Mode & 0xF) == 0x2 || (_header.Mode & 0xF) == 0x3) found = true; break; @@ -261,13 +255,19 @@ public class SuperNintendo : IByteAddressableImage public bool IsWriting { get; private set; } /// - public IEnumerable KnownExtensions => new[] { ".sfc" }; + public IEnumerable KnownExtensions => new[] + { + ".sfc" + }; /// public IEnumerable SupportedMediaTags => Array.Empty(); /// - public IEnumerable SupportedMediaTypes => new[] { MediaType.SNESGamePak, MediaType.SNESGamePakUS }; + public IEnumerable SupportedMediaTypes => new[] + { + MediaType.SNESGamePak, MediaType.SNESGamePakUS + }; /// public IEnumerable<(string name, Type type, string description, object @default)> SupportedOptions => @@ -329,8 +329,7 @@ public class SuperNintendo : IByteAddressableImage return ErrorNumber.InvalidArgument; } - if(mediaType != MediaType.SNESGamePak && - mediaType != MediaType.SNESGamePakUS) + if(mediaType != MediaType.SNESGamePak && mediaType != MediaType.SNESGamePakUS) { ErrorMessage = string.Format(Localization.Unsupported_media_format_0, mediaType); diff --git a/Aaru.Images/CDRDAO/Identify.cs b/Aaru.Images/CDRDAO/Identify.cs index 8a2b6242c..f88c963b4 100644 --- a/Aaru.Images/CDRDAO/Identify.cs +++ b/Aaru.Images/CDRDAO/Identify.cs @@ -71,10 +71,7 @@ public sealed partial class Cdrdao else twoConsecutiveNulls = false; - if(testArray[i] < 0x20 && - testArray[i] != 0x0A && - testArray[i] != 0x0D && - testArray[i] != 0x00) + if(testArray[i] < 0x20 && testArray[i] != 0x0A && testArray[i] != 0x0D && testArray[i] != 0x00) return false; } diff --git a/Aaru.Images/CDRDAO/Properties.cs b/Aaru.Images/CDRDAO/Properties.cs index 2f7831311..cfe037bdd 100644 --- a/Aaru.Images/CDRDAO/Properties.cs +++ b/Aaru.Images/CDRDAO/Properties.cs @@ -181,27 +181,29 @@ public sealed partial class Cdrdao // TODO: Decode CD-Text to text /// - public IEnumerable SupportedMediaTags => new[] { MediaTagType.CD_MCN }; + public IEnumerable SupportedMediaTags => new[] + { + MediaTagType.CD_MCN + }; /// public IEnumerable SupportedSectorTags => new[] { - SectorTagType.CdSectorEcc, SectorTagType.CdSectorEccP, SectorTagType.CdSectorEccQ, - SectorTagType.CdSectorEdc, SectorTagType.CdSectorHeader, SectorTagType.CdSectorSubchannel, - SectorTagType.CdSectorSubHeader, SectorTagType.CdSectorSync, SectorTagType.CdTrackFlags, - SectorTagType.CdTrackIsrc + SectorTagType.CdSectorEcc, SectorTagType.CdSectorEccP, SectorTagType.CdSectorEccQ, SectorTagType.CdSectorEdc, + SectorTagType.CdSectorHeader, SectorTagType.CdSectorSubchannel, SectorTagType.CdSectorSubHeader, + SectorTagType.CdSectorSync, SectorTagType.CdTrackFlags, SectorTagType.CdTrackIsrc }; /// public IEnumerable SupportedMediaTypes => new[] { - MediaType.CD, MediaType.CDDA, MediaType.CDEG, MediaType.CDG, MediaType.CDI, MediaType.CDMIDI, - MediaType.CDMRW, MediaType.CDPLUS, MediaType.CDR, MediaType.CDROM, MediaType.CDROMXA, MediaType.CDRW, - MediaType.CDV, MediaType.DDCD, MediaType.DDCDR, MediaType.DDCDRW, MediaType.MEGACD, MediaType.PS1CD, - MediaType.PS2CD, MediaType.SuperCDROM2, MediaType.SVCD, MediaType.SATURNCD, MediaType.ThreeDO, - MediaType.VCD, MediaType.VCDHD, MediaType.NeoGeoCD, MediaType.PCFX, MediaType.CDTV, MediaType.CD32, - MediaType.Nuon, MediaType.Playdia, MediaType.Pippin, MediaType.FMTOWNS, MediaType.MilCD, MediaType.VideoNow, - MediaType.VideoNowColor, MediaType.VideoNowXp, MediaType.CVD, MediaType.PCD + MediaType.CD, MediaType.CDDA, MediaType.CDEG, MediaType.CDG, MediaType.CDI, MediaType.CDMIDI, MediaType.CDMRW, + MediaType.CDPLUS, MediaType.CDR, MediaType.CDROM, MediaType.CDROMXA, MediaType.CDRW, MediaType.CDV, + MediaType.DDCD, MediaType.DDCDR, MediaType.DDCDRW, MediaType.MEGACD, MediaType.PS1CD, MediaType.PS2CD, + MediaType.SuperCDROM2, MediaType.SVCD, MediaType.SATURNCD, MediaType.ThreeDO, MediaType.VCD, MediaType.VCDHD, + MediaType.NeoGeoCD, MediaType.PCFX, MediaType.CDTV, MediaType.CD32, MediaType.Nuon, MediaType.Playdia, + MediaType.Pippin, MediaType.FMTOWNS, MediaType.MilCD, MediaType.VideoNow, MediaType.VideoNowColor, + MediaType.VideoNowXp, MediaType.CVD, MediaType.PCD }; /// @@ -211,7 +213,10 @@ public sealed partial class Cdrdao }; /// - public IEnumerable KnownExtensions => new[] { ".toc" }; + public IEnumerable KnownExtensions => new[] + { + ".toc" + }; /// public bool IsWriting { get; private set; } diff --git a/Aaru.Images/CDRDAO/Read.cs b/Aaru.Images/CDRDAO/Read.cs index 3a69a8987..f80168500 100644 --- a/Aaru.Images/CDRDAO/Read.cs +++ b/Aaru.Images/CDRDAO/Read.cs @@ -223,9 +223,9 @@ public sealed partial class Cdrdao } else { - AaruConsole.DebugWriteLine(MODULE_NAME, - Localization.Found_TRACK_type_1_subchannel_2_at_line_0, lineNumber, - matchTrack.Groups["type"].Value, matchTrack.Groups["subchan"].Value); + AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Found_TRACK_type_1_subchannel_2_at_line_0, + lineNumber, matchTrack.Groups["type"].Value, + matchTrack.Groups["subchan"].Value); } if(inTrack) @@ -322,8 +322,8 @@ public sealed partial class Cdrdao } else if(matchStereo.Success) { - AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Found_1_CHANNEL_AUDIO_at_line_0, - lineNumber, matchStereo.Groups["num"].Value); + AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Found_1_CHANNEL_AUDIO_at_line_0, lineNumber, + matchStereo.Groups["num"].Value); currentTrack.Flag4Ch |= inTrack && matchStereo.Groups["num"].Value == "FOUR"; } @@ -343,7 +343,8 @@ public sealed partial class Cdrdao 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.Parse(lengthString[1]) * 75 + + ulong.Parse(lengthString[2]); currentTrack.Indexes.Add(nextIndex, nextIndexPos + currentTrack.Pregap + currentTrack.StartSector); } @@ -359,7 +360,8 @@ public sealed partial class Cdrdao string[] lengthString = matchPregap.Groups["address"].Value.Split(':'); currentTrack.Pregap = ulong.Parse(lengthString[0]) * 60 * 75 + - ulong.Parse(lengthString[1]) * 75 + ulong.Parse(lengthString[2]); + ulong.Parse(lengthString[1]) * 75 + + ulong.Parse(lengthString[2]); } else currentTrack.Pregap = currentTrack.Sectors; @@ -373,7 +375,8 @@ public sealed partial class Cdrdao string[] lengthString = matchZeroPregap.Groups["length"].Value.Split(':'); currentTrack.Pregap = ulong.Parse(lengthString[0]) * 60 * 75 + - ulong.Parse(lengthString[1]) * 75 + ulong.Parse(lengthString[2]); + ulong.Parse(lengthString[1]) * 75 + + ulong.Parse(lengthString[2]); } else if(matchZeroData.Success) { @@ -391,8 +394,8 @@ public sealed partial class Cdrdao if(matchAudioFile.Success) { - AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Found_AUDIOFILE_1_at_line_0, - lineNumber, matchAudioFile.Groups["filename"].Value); + AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Found_AUDIOFILE_1_at_line_0, lineNumber, + matchAudioFile.Groups["filename"].Value); filtersList = new FiltersList(); @@ -416,7 +419,8 @@ public sealed partial class Cdrdao string[] startString = matchAudioFile.Groups["start"].Value.Split(':'); startSectors = ulong.Parse(startString[0]) * 60 * 75 + - ulong.Parse(startString[1]) * 75 + ulong.Parse(startString[2]); + ulong.Parse(startString[1]) * 75 + + ulong.Parse(startString[2]); } currentTrack.Trackfile.Offset += startSectors * currentTrack.Bps; @@ -426,13 +430,15 @@ public sealed partial class Cdrdao string[] lengthString = matchAudioFile.Groups["length"].Value.Split(':'); currentTrack.Sectors = ulong.Parse(lengthString[0]) * 60 * 75 + - ulong.Parse(lengthString[1]) * 75 + ulong.Parse(lengthString[2]); + ulong.Parse(lengthString[1]) * 75 + + ulong.Parse(lengthString[2]); } else { currentTrack.Sectors = ((ulong)currentTrack.Trackfile.Datafilter.DataForkLength - - currentTrack.Trackfile.Offset) / currentTrack.Bps; + currentTrack.Trackfile.Offset) / + currentTrack.Bps; } } else if(matchFile.Success) @@ -460,13 +466,15 @@ public sealed partial class Cdrdao string[] lengthString = matchFile.Groups["length"].Value.Split(':'); currentTrack.Sectors = ulong.Parse(lengthString[0]) * 60 * 75 + - ulong.Parse(lengthString[1]) * 75 + ulong.Parse(lengthString[2]); + ulong.Parse(lengthString[1]) * 75 + + ulong.Parse(lengthString[2]); } else { currentTrack.Sectors = ((ulong)currentTrack.Trackfile.Datafilter.DataForkLength - - currentTrack.Trackfile.Offset) / currentTrack.Bps; + currentTrack.Trackfile.Offset) / + currentTrack.Bps; } } else if(matchTitle.Success) @@ -481,8 +489,8 @@ public sealed partial class Cdrdao } else if(matchPerformer.Success) { - AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Found_PERFORMER_1_at_line_0, - lineNumber, matchPerformer.Groups["performer"].Value); + AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Found_PERFORMER_1_at_line_0, lineNumber, + matchPerformer.Groups["performer"].Value); if(inTrack) currentTrack.Performer = matchPerformer.Groups["performer"].Value; @@ -491,8 +499,8 @@ public sealed partial class Cdrdao } else if(matchSongwriter.Success) { - AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Found_SONGWRITER_1_at_line_0, - lineNumber, matchSongwriter.Groups["songwriter"].Value); + AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Found_SONGWRITER_1_at_line_0, lineNumber, + matchSongwriter.Groups["songwriter"].Value); if(inTrack) currentTrack.Songwriter = matchSongwriter.Groups["songwriter"].Value; @@ -660,8 +668,8 @@ public sealed partial class Cdrdao AaruConsole.DebugWriteLine(MODULE_NAME, "\t\t" + Localization.Track_has_pre_emphasis_applied); AaruConsole.DebugWriteLine(MODULE_NAME, - "\t\t" + Localization. - Track_resides_in_file_0_type_defined_as_1_starting_at_byte_2, + "\t\t" + + Localization.Track_resides_in_file_0_type_defined_as_1_starting_at_byte_2, _discimage.Tracks[i].Trackfile.Datafilter.Filename, _discimage.Tracks[i].Trackfile.Filetype, _discimage.Tracks[i].Trackfile.Offset); @@ -670,17 +678,14 @@ public sealed partial class Cdrdao foreach(KeyValuePair kvp in _discimage.Tracks[i].Indexes) { - AaruConsole.DebugWriteLine(MODULE_NAME, "\t\t\t" + Localization.Index_0_starts_at_sector_1, - kvp.Key, kvp.Value); + AaruConsole.DebugWriteLine(MODULE_NAME, "\t\t\t" + Localization.Index_0_starts_at_sector_1, kvp.Key, + kvp.Value); } if(_discimage.Tracks[i].Isrc == null) AaruConsole.DebugWriteLine(MODULE_NAME, "\t\t" + Localization.ISRC_is_not_set); else - { - AaruConsole.DebugWriteLine(MODULE_NAME, "\t\t" + Localization.ISRC_0, - _discimage.Tracks[i].Isrc); - } + AaruConsole.DebugWriteLine(MODULE_NAME, "\t\t" + Localization.ISRC_0, _discimage.Tracks[i].Isrc); if(_discimage.Tracks[i].Arranger == null) AaruConsole.DebugWriteLine(MODULE_NAME, "\t\t" + Localization.Arranger_is_not_set); @@ -717,10 +722,7 @@ public sealed partial class Cdrdao if(_discimage.Tracks[i].Title == null) AaruConsole.DebugWriteLine(MODULE_NAME, "\t\t" + Localization.Title_is_not_set); else - { - AaruConsole.DebugWriteLine(MODULE_NAME, "\t\t" + Localization.Title_0, - _discimage.Tracks[i].Title); - } + AaruConsole.DebugWriteLine(MODULE_NAME, "\t\t" + Localization.Title_0, _discimage.Tracks[i].Title); } AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Building_offset_map); @@ -733,8 +735,7 @@ public sealed partial class Cdrdao for(var i = 0; i < _discimage.Tracks.Count; i++) { - if(_discimage.Tracks[i].Sequence == 1 && - i != 0) + if(_discimage.Tracks[i].Sequence == 1 && i != 0) { AaruConsole.ErrorWriteLine(Localization.Unordered_tracks); @@ -794,8 +795,7 @@ public sealed partial class Cdrdao AaruConsole.DebugWriteLine(MODULE_NAME, "\t" + Localization.Partition_starting_offset_0, partition.Offset); - AaruConsole.DebugWriteLine(MODULE_NAME, "\t" + Localization.Partition_size_in_bytes_0, - partition.Size); + AaruConsole.DebugWriteLine(MODULE_NAME, "\t" + Localization.Partition_size_in_bytes_0, partition.Size); } foreach(CdrdaoTrack track in _discimage.Tracks) @@ -1104,8 +1104,7 @@ public sealed partial class Cdrdao buffer = mode2Ms.ToArray(); } - else if(sectorOffset == 0 && - sectorSkip == 0) + else if(sectorOffset == 0 && sectorSkip == 0) buffer = br.ReadBytes((int)(sectorSize * length)); else { @@ -1166,8 +1165,7 @@ public sealed partial class Cdrdao uint sectorSize = 0; uint sectorSkip = 0; - if(!aaruTrack.Subchannel && - tag == SectorTagType.CdSectorSubchannel) + if(!aaruTrack.Subchannel && tag == SectorTagType.CdSectorSubchannel) return ErrorNumber.NoData; switch(tag) @@ -1197,7 +1195,10 @@ public sealed partial class Cdrdao if(aaruTrack.Flag4Ch) flags |= CdFlags.FourChannel; - buffer = new[] { (byte)flags }; + buffer = new[] + { + (byte)flags + }; return ErrorNumber.NoError; } @@ -1326,8 +1327,7 @@ public sealed partial class Cdrdao Seek((long)aaruTrack.Trackfile.Offset + (long)(sectorAddress * (sectorOffset + sectorSize + sectorSkip)), SeekOrigin.Begin); - if(sectorOffset == 0 && - sectorSkip == 0) + if(sectorOffset == 0 && sectorSkip == 0) buffer = br.ReadBytes((int)(sectorSize * length)); else { diff --git a/Aaru.Images/CDRDAO/Write.cs b/Aaru.Images/CDRDAO/Write.cs index d0bc8936b..84453c69c 100644 --- a/Aaru.Images/CDRDAO/Write.cs +++ b/Aaru.Images/CDRDAO/Write.cs @@ -274,9 +274,8 @@ public sealed partial class Cdrdao { case TrackSubchannelType.None: trackStream. - Seek( - (long)(track.FileOffset + (sectorAddress - track.StartSector) * (ulong)track.RawBytesPerSector), - SeekOrigin.Begin); + Seek((long)(track.FileOffset + (sectorAddress - track.StartSector) * (ulong)track.RawBytesPerSector), + SeekOrigin.Begin); trackStream.Write(data, 0, data.Length); @@ -286,10 +285,8 @@ public sealed partial class Cdrdao case TrackSubchannelType.Raw: case TrackSubchannelType.RawInterleaved: trackStream. - Seek( - (long)(track.FileOffset + - (sectorAddress - track.StartSector) * (ulong)(track.RawBytesPerSector + 96)), - SeekOrigin.Begin); + Seek((long)(track.FileOffset + (sectorAddress - track.StartSector) * (ulong)(track.RawBytesPerSector + 96)), + SeekOrigin.Begin); for(uint i = 0; i < length; i++) { @@ -360,10 +357,8 @@ public sealed partial class Cdrdao var subchannelSize = (uint)(track.SubchannelType != TrackSubchannelType.None ? 96 : 0); trackStream. - Seek( - (long)(track.FileOffset + (sectorAddress - track.StartSector) * - (ulong)(track.RawBytesPerSector + subchannelSize)), - SeekOrigin.Begin); + Seek((long)(track.FileOffset + (sectorAddress - track.StartSector) * (ulong)(track.RawBytesPerSector + subchannelSize)), + SeekOrigin.Begin); trackStream.Write(data, 0, data.Length); @@ -432,10 +427,8 @@ public sealed partial class Cdrdao for(uint i = 0; i < length; i++) { trackStream. - Seek( - (long)(track.FileOffset + (i + sectorAddress - track.StartSector) * - (ulong)(track.RawBytesPerSector + subchannelSize)), - SeekOrigin.Begin); + Seek((long)(track.FileOffset + (i + sectorAddress - track.StartSector) * (ulong)(track.RawBytesPerSector + subchannelSize)), + SeekOrigin.Begin); trackStream.Write(data, (int)(i * track.RawBytesPerSector), track.RawBytesPerSector); } @@ -453,16 +446,14 @@ public sealed partial class Cdrdao return false; } - if(tracks == null || - tracks.Count == 0) + if(tracks == null || tracks.Count == 0) { ErrorMessage = Localization.Invalid_tracks_sent; return false; } - if(_writingTracks != null && - _writingStreams != null) + if(_writingTracks != null && _writingStreams != null) { foreach(FileStream oldTrack in _writingStreams.Select(t => t.Value).Distinct()) oldTrack.Close(); @@ -545,7 +536,8 @@ public sealed partial class Cdrdao bool mode2 = _writingTracks.Count(t => t.Type is TrackType.CdMode2Form1 or TrackType.CdMode2Form2 - or TrackType.CdMode2Formless) > 0; + or TrackType.CdMode2Formless) > + 0; if(mode2) _descriptorStream.WriteLine("CD_ROM_XA"); @@ -556,7 +548,10 @@ public sealed partial class Cdrdao if(!string.IsNullOrWhiteSpace(_discimage.Comment)) { - string[] commentLines = _discimage.Comment.Split(new[] { '\n' }, StringSplitOptions.RemoveEmptyEntries); + string[] commentLines = _discimage.Comment.Split(new[] + { + '\n' + }, StringSplitOptions.RemoveEmptyEntries); foreach(string line in commentLines) _descriptorStream.WriteLine("// {0}", line); @@ -607,8 +602,7 @@ public sealed partial class Cdrdao _descriptorStream.WriteLine("{0}_CHANNEL_AUDIO", flags.HasFlag(CdFlags.FourChannel) ? "FOUR" : "TWO"); } - if(_trackIsrcs.TryGetValue((byte)track.Sequence, out string isrc) && - !string.IsNullOrWhiteSpace(isrc)) + if(_trackIsrcs.TryGetValue((byte)track.Sequence, out string isrc) && !string.IsNullOrWhiteSpace(isrc)) _descriptorStream.WriteLine("ISRC {0}", isrc); (byte minute, byte second, byte frame) msf = LbaToMsf(track.EndSector - track.StartSector + 1); @@ -726,11 +720,8 @@ public sealed partial class Cdrdao } trackStream. - Seek( - (long)(track.FileOffset + - (sectorAddress - track.StartSector) * (ulong)(track.RawBytesPerSector + 96)) + - track.RawBytesPerSector, - SeekOrigin.Begin); + Seek((long)(track.FileOffset + (sectorAddress - track.StartSector) * (ulong)(track.RawBytesPerSector + 96)) + track.RawBytesPerSector, + SeekOrigin.Begin); trackStream.Write(data, 0, data.Length); @@ -798,10 +789,8 @@ public sealed partial class Cdrdao for(uint i = 0; i < length; i++) { trackStream. - Seek( - (long)(track.FileOffset + (i + sectorAddress - track.StartSector) * - (ulong)(track.RawBytesPerSector + 96)) + track.RawBytesPerSector, - SeekOrigin.Begin); + Seek((long)(track.FileOffset + (i + sectorAddress - track.StartSector) * (ulong)(track.RawBytesPerSector + 96)) + track.RawBytesPerSector, + SeekOrigin.Begin); trackStream.Write(data, (int)(i * 96), 96); } diff --git a/Aaru.Images/CDRWin/Helpers.cs b/Aaru.Images/CDRWin/Helpers.cs index efe0197cd..521830029 100644 --- a/Aaru.Images/CDRWin/Helpers.cs +++ b/Aaru.Images/CDRWin/Helpers.cs @@ -193,8 +193,7 @@ public sealed partial class CdrWin return CDRWIN_TRACK_TYPE_MODE1; case TrackType.CdMode1 when track.RawBytesPerSector == 2352: return CDRWIN_TRACK_TYPE_MODE1_RAW; - case TrackType.CdMode2Formless - when track.RawBytesPerSector != 2352: + case TrackType.CdMode2Formless when track.RawBytesPerSector != 2352: return CDRWIN_TRACK_TYPE_MODE2_FORMLESS; case TrackType.CdMode2Form1 when track.RawBytesPerSector != 2352: return CDRWIN_TRACK_TYPE_MODE2_FORM1; diff --git a/Aaru.Images/CDRWin/Identify.cs b/Aaru.Images/CDRWin/Identify.cs index 7c5b3808b..d54e4db61 100644 --- a/Aaru.Images/CDRWin/Identify.cs +++ b/Aaru.Images/CDRWin/Identify.cs @@ -74,10 +74,7 @@ public sealed partial class CdrWin else twoConsecutiveNulls = false; - if(testArray[i] < 0x20 && - testArray[i] != 0x0A && - testArray[i] != 0x0D && - testArray[i] != 0x00) + if(testArray[i] < 0x20 && testArray[i] != 0x0A && testArray[i] != 0x0D && testArray[i] != 0x00) return false; } diff --git a/Aaru.Images/CDRWin/Properties.cs b/Aaru.Images/CDRWin/Properties.cs index 435604dba..d1f05a66e 100644 --- a/Aaru.Images/CDRWin/Properties.cs +++ b/Aaru.Images/CDRWin/Properties.cs @@ -114,8 +114,7 @@ public sealed partial class CdrWin aaruTrack.Indexes[0] = -150; } - if(previousTrackFile == aaruTrack.File || - previousTrackFile == "") + if(previousTrackFile == aaruTrack.File || previousTrackFile == "") { if(cdrTrack.Indexes.TryGetValue(0, out int idx0)) { @@ -139,9 +138,7 @@ public sealed partial class CdrWin aaruTrack.EndSector = aaruTrack.StartSector + cdrTrack.Sectors - 1; - if(_discImage.IsRedumpGigadisc && - cdrTrack.Session == 2 && - previousStartSector < gdRomSession2Offset) + if(_discImage.IsRedumpGigadisc && cdrTrack.Session == 2 && previousStartSector < gdRomSession2Offset) { aaruTrack.StartSector = (ulong)cdrTrack.Indexes[0]; aaruTrack.EndSector = gdRomSession2Offset + cdrTrack.Sectors - (uint)cdrTrack.Pregap - 1; @@ -181,33 +178,36 @@ public sealed partial class CdrWin public Metadata AaruMetadata => 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[] { - SectorTagType.CdSectorEcc, SectorTagType.CdSectorEccP, SectorTagType.CdSectorEccQ, - SectorTagType.CdSectorEdc, SectorTagType.CdSectorHeader, SectorTagType.CdSectorSubHeader, - SectorTagType.CdSectorSync, SectorTagType.CdTrackFlags, SectorTagType.CdTrackIsrc + SectorTagType.CdSectorEcc, SectorTagType.CdSectorEccP, SectorTagType.CdSectorEccQ, SectorTagType.CdSectorEdc, + SectorTagType.CdSectorHeader, SectorTagType.CdSectorSubHeader, SectorTagType.CdSectorSync, + SectorTagType.CdTrackFlags, SectorTagType.CdTrackIsrc }; /// public IEnumerable SupportedMediaTypes => new[] { MediaType.BDR, MediaType.BDRE, MediaType.BDREXL, MediaType.BDROM, MediaType.UHDBD, MediaType.BDRXL, - MediaType.CBHD, MediaType.CD, MediaType.CDDA, MediaType.CDEG, MediaType.CDG, MediaType.CDI, - MediaType.CDMIDI, MediaType.CDMRW, MediaType.CDPLUS, MediaType.CDR, MediaType.CDROM, MediaType.CDROMXA, - MediaType.CDRW, MediaType.CDV, MediaType.DDCD, MediaType.DDCDR, MediaType.DDCDRW, MediaType.DVDDownload, - MediaType.DVDPR, MediaType.DVDPRDL, MediaType.DVDPRW, MediaType.DVDPRWDL, MediaType.DVDR, MediaType.DVDRAM, - MediaType.DVDRDL, MediaType.DVDROM, MediaType.DVDRW, MediaType.DVDRWDL, MediaType.EVD, MediaType.FDDVD, - MediaType.DTSCD, MediaType.FVD, MediaType.HDDVDR, MediaType.HDDVDRAM, MediaType.HDDVDRDL, - MediaType.HDDVDROM, MediaType.HDDVDRW, MediaType.HDDVDRWDL, MediaType.HDVMD, MediaType.HVD, - MediaType.JaguarCD, MediaType.MEGACD, MediaType.PS1CD, MediaType.PS2CD, MediaType.PS2DVD, MediaType.PS3BD, - MediaType.PS3DVD, MediaType.PS4BD, MediaType.PS5BD, MediaType.SuperCDROM2, MediaType.SVCD, MediaType.SVOD, - MediaType.SATURNCD, MediaType.ThreeDO, MediaType.UDO, MediaType.UDO2, MediaType.UDO2_WORM, MediaType.UMD, - MediaType.VCD, MediaType.VCDHD, MediaType.NeoGeoCD, MediaType.PCFX, MediaType.CDTV, MediaType.CD32, - MediaType.Nuon, MediaType.Playdia, MediaType.Pippin, MediaType.FMTOWNS, MediaType.MilCD, MediaType.VideoNow, - MediaType.VideoNowColor, MediaType.VideoNowXp, MediaType.CVD, MediaType.PCD + MediaType.CBHD, MediaType.CD, MediaType.CDDA, MediaType.CDEG, MediaType.CDG, MediaType.CDI, MediaType.CDMIDI, + MediaType.CDMRW, MediaType.CDPLUS, MediaType.CDR, MediaType.CDROM, MediaType.CDROMXA, MediaType.CDRW, + MediaType.CDV, MediaType.DDCD, MediaType.DDCDR, MediaType.DDCDRW, MediaType.DVDDownload, MediaType.DVDPR, + MediaType.DVDPRDL, MediaType.DVDPRW, MediaType.DVDPRWDL, MediaType.DVDR, MediaType.DVDRAM, MediaType.DVDRDL, + MediaType.DVDROM, MediaType.DVDRW, MediaType.DVDRWDL, MediaType.EVD, MediaType.FDDVD, MediaType.DTSCD, + MediaType.FVD, MediaType.HDDVDR, MediaType.HDDVDRAM, MediaType.HDDVDRDL, MediaType.HDDVDROM, MediaType.HDDVDRW, + MediaType.HDDVDRWDL, MediaType.HDVMD, MediaType.HVD, MediaType.JaguarCD, MediaType.MEGACD, MediaType.PS1CD, + MediaType.PS2CD, MediaType.PS2DVD, MediaType.PS3BD, MediaType.PS3DVD, MediaType.PS4BD, MediaType.PS5BD, + MediaType.SuperCDROM2, MediaType.SVCD, MediaType.SVOD, MediaType.SATURNCD, MediaType.ThreeDO, MediaType.UDO, + MediaType.UDO2, MediaType.UDO2_WORM, MediaType.UMD, MediaType.VCD, MediaType.VCDHD, MediaType.NeoGeoCD, + MediaType.PCFX, MediaType.CDTV, MediaType.CD32, MediaType.Nuon, MediaType.Playdia, MediaType.Pippin, + MediaType.FMTOWNS, MediaType.MilCD, MediaType.VideoNow, MediaType.VideoNowColor, MediaType.VideoNowXp, + MediaType.CVD, MediaType.PCD }; /// @@ -217,7 +217,10 @@ public sealed partial class CdrWin }; /// - public IEnumerable KnownExtensions => new[] { ".cue" }; + public IEnumerable KnownExtensions => new[] + { + ".cue" + }; /// public bool IsWriting { get; private set; } diff --git a/Aaru.Images/CDRWin/Read.cs b/Aaru.Images/CDRWin/Read.cs index b6d4bdb2e..ea31435ec 100644 --- a/Aaru.Images/CDRWin/Read.cs +++ b/Aaru.Images/CDRWin/Read.cs @@ -238,8 +238,7 @@ public sealed partial class CdrWin if(matchTruripTrackCrc32.Success) { - AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Found_CRC32_for_1_2_at_line_0, - lineNumber, + AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Found_CRC32_for_1_2_at_line_0, lineNumber, matchTruripTrackCrc32.Groups[1].Value == "Trk" ? Localization.track : Localization.gap, matchTruripTrackCrc32.Groups[2].Value); @@ -249,8 +248,7 @@ public sealed partial class CdrWin if(matchTruripTrackMd5.Success) { - AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Found_MD5_for_1_2_at_line_0, - lineNumber, + AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Found_MD5_for_1_2_at_line_0, lineNumber, matchTruripTrackMd5.Groups[1].Value == "Trk" ? Localization.track : Localization.gap, matchTruripTrackMd5.Groups[2].Value); @@ -260,8 +258,7 @@ public sealed partial class CdrWin if(matchTruripTrackSha1.Success) { - AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Found_SHA1_for_1_2_at_line_0, - lineNumber, + AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Found_SHA1_for_1_2_at_line_0, lineNumber, matchTruripTrackSha1.Groups[1].Value == "Trk" ? Localization.track : Localization.gap, matchTruripTrackSha1.Groups[2].Value); @@ -277,8 +274,7 @@ public sealed partial class CdrWin lineNumber, matchTruripTrackUnknownHash.Groups[1].Value == "Trk" ? Localization.track - : Localization.gap, - matchTruripTrackUnknownHash.Groups[2].Value); + : Localization.gap, matchTruripTrackUnknownHash.Groups[2].Value); continue; } @@ -299,15 +295,16 @@ public sealed partial class CdrWin DumpHardware existingDump = DumpHardware.FirstOrDefault(d => - d.Manufacturer == matchDumpExtent.Groups["manufacturer"]. - Value && d.Model == matchDumpExtent.Groups["model"].Value && + d.Manufacturer == + matchDumpExtent.Groups["manufacturer"].Value && + d.Model == matchDumpExtent.Groups["model"].Value && d.Firmware == matchDumpExtent.Groups["firmware"].Value && - d.Serial == matchDumpExtent.Groups["serial"].Value && - d.Software.Name == matchDumpExtent.Groups["application"]. - Value && + d.Serial == matchDumpExtent.Groups["serial"].Value && + d.Software.Name == + matchDumpExtent.Groups["application"].Value && d.Software.Version == matchDumpExtent.Groups["version"].Value && - d.Software.OperatingSystem == matchDumpExtent. - Groups["os"].Value); + d.Software.OperatingSystem == + matchDumpExtent.Groups["os"].Value); if(existingDump is null) { @@ -336,33 +333,31 @@ public sealed partial class CdrWin else { existingDump.Extents = new List(existingDump.Extents) - { - new() { - Start = extentStart, - End = extentEnd - } - }.OrderBy(e => e.Start).ToList(); + new() + { + Start = extentStart, + End = extentEnd + } + }.OrderBy(e => e.Start). + ToList(); } } - else if(matchDicMediaType.Success && - !inTrack) + else if(matchDicMediaType.Success && !inTrack) { - AaruConsole.DebugWriteLine(MODULE_NAME, - Localization.Found_REM_METADATA_DIC_MEDIA_TYPE_at_line_0, lineNumber); + AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Found_REM_METADATA_DIC_MEDIA_TYPE_at_line_0, + lineNumber); _discImage.AaruMediaType = matchDicMediaType.Groups[1].Value; } - else if(matchAaruMediaType.Success && - !inTrack) + else if(matchAaruMediaType.Success && !inTrack) { - AaruConsole.DebugWriteLine(MODULE_NAME, - Localization.Found_REM_METADATA_AARU_MEDIA_TYPE_at_line_0, lineNumber); + AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Found_REM_METADATA_AARU_MEDIA_TYPE_at_line_0, + lineNumber); _discImage.AaruMediaType = matchAaruMediaType.Groups[1].Value; } - else if(matchDiskType.Success && - !inTrack) + else if(matchDiskType.Success && !inTrack) { AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Found_REM_ORIGINAL_MEDIA_TYPE_at_line_0, lineNumber); @@ -401,13 +396,11 @@ public sealed partial class CdrWin } else if(matchApplication.Success) { - AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Found_REM_Ripping_Tool_at_line_0, - lineNumber); + AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Found_REM_Ripping_Tool_at_line_0, lineNumber); _imageInfo.Application = matchApplication.Groups[1].Value; } - else if(matchApplicationVersion.Success && - !inTrack) + else if(matchApplicationVersion.Success && !inTrack) { AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Found_REM_Ripping_Tool_Version_at_line_0, lineNumber); @@ -416,8 +409,7 @@ public sealed partial class CdrWin } else if(matchTruripDisc.Success) { - AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Found_REM_DISC_HASHES_at_line_0, - lineNumber); + AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Found_REM_DISC_HASHES_at_line_0, lineNumber); inTruripDiscHash = true; } @@ -490,8 +482,7 @@ public sealed partial class CdrWin } else if(matchCdText.Success) { - AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Found_CDTEXTFILE_at_line_0, - lineNumber); + AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Found_CDTEXTFILE_at_line_0, lineNumber); if(!inTrack) _discImage.CdTextFile = matchCdText.Groups[1].Value; @@ -499,10 +490,8 @@ public sealed partial class CdrWin { AaruConsole. ErrorWriteLine(string. - Format( - Localization. - Found_CD_Text_file_field_in_incorrect_place_at_line_0, - lineNumber)); + Format(Localization.Found_CD_Text_file_field_in_incorrect_place_at_line_0, + lineNumber)); return ErrorNumber.InvalidArgument; } @@ -557,8 +546,7 @@ public sealed partial class CdrWin currentFile.FileType = matchFile.Groups[2].Value; // Check if file path is quoted - if(datafile[0] == '"' && - datafile[^1] == '"') + if(datafile[0] == '"' && datafile[^1] == '"') datafile = datafile.Substring(1, datafile.Length - 2); // Unquote it currentFile.DataFilter = filtersList.GetFilter(datafile); @@ -566,8 +554,7 @@ public sealed partial class CdrWin // 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 { var unixPath = new Regex("^(.+)/([^/]+)$"); Match unixPathMatch = unixPath.Match(datafile); @@ -578,7 +565,8 @@ public sealed partial class CdrWin if(currentFile.DataFilter == null) { - string path = imageFilter.ParentFolder + Path.PathSeparator + + string path = imageFilter.ParentFolder + + Path.PathSeparator + unixPathMatch.Groups[1].Value; currentFile.DataFilter = filtersList.GetFilter(path); @@ -606,8 +594,7 @@ public sealed partial class CdrWin { var winPath = new - Regex( - "^(?:[a-zA-Z]\\:(\\\\|\\/)|file\\:\\/\\/|\\\\\\\\|\\.(\\/|\\\\))([^\\\\\\/\\:\\*\\?\\<\\>\\\"\\|]+(\\\\|\\/){0,1})+$"); + Regex("^(?:[a-zA-Z]\\:(\\\\|\\/)|file\\:\\/\\/|\\\\\\\\|\\.(\\/|\\\\))([^\\\\\\/\\:\\*\\?\\<\\>\\\"\\|]+(\\\\|\\/){0,1})+$"); Match winPathMatch = winPath.Match(datafile); @@ -617,7 +604,8 @@ public sealed partial class CdrWin if(currentFile.DataFilter == null) { - string path = imageFilter.ParentFolder + Path.PathSeparator + + string path = imageFilter.ParentFolder + + Path.PathSeparator + winPathMatch.Groups[1].Value; currentFile.DataFilter = filtersList.GetFilter(path); @@ -723,9 +711,7 @@ public sealed partial class CdrWin var index = ushort.Parse(matchIndex.Groups[1].Value); int offset = CdrWinMsfToLba(matchIndex.Groups[2].Value) + cumulativeEmptyPregap; - if(index != 0 && - index != 1 && - currentTrack.Indexes.Count == 0) + if(index != 0 && index != 1 && currentTrack.Indexes.Count == 0) { AaruConsole. ErrorWriteLine(string.Format(Localization.Found_INDEX_0_before_INDEX_00_or_INDEX_01, @@ -734,11 +720,9 @@ public sealed partial class CdrWin return ErrorNumber.InvalidArgument; } - 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) + if((int)(currentTrack.Sequence - 2) >= 0 && offset > 1) { cueTracks[currentTrack.Sequence - 2].Sectors = (ulong)(offset - (int)currentFileOffsetSector); @@ -753,8 +737,7 @@ public sealed partial class CdrWin "cueTracks[currentTrack.sequence-2].sectors = {0}", cueTracks[currentTrack.Sequence - 2].Sectors); - AaruConsole.DebugWriteLine(MODULE_NAME, - "cueTracks[currentTrack.sequence-2].bps = {0}", + AaruConsole.DebugWriteLine(MODULE_NAME, "cueTracks[currentTrack.sequence-2].bps = {0}", cueTracks[currentTrack.Sequence - 2].Bps); } } @@ -770,9 +753,7 @@ public sealed partial class CdrWin if(currentTrack.Indexes.Count == 0) { - if(firstTrackInSession && - index != 0 && - offset > 150) + if(firstTrackInSession && index != 0 && offset > 150) { currentTrack.Indexes[0] = offset - 150; firstTrackInSession = false; @@ -783,9 +764,7 @@ public sealed partial class CdrWin currentFileOffsetSector = offset; } - if(index == 1 && - currentEmptyPregap > 0 && - !currentTrack.Indexes.ContainsKey(0)) + if(index == 1 && currentEmptyPregap > 0 && !currentTrack.Indexes.ContainsKey(0)) { currentTrack.Indexes[0] = offset; currentFile.Offset -= (ulong)(currentEmptyPregap * currentTrack.Bps); @@ -867,8 +846,7 @@ public sealed partial class CdrWin } else if(matchSongWriter.Success) { - AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Found_SONGWRITER_at_line_0, - lineNumber); + AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Found_SONGWRITER_at_line_0, lineNumber); if(inTrack) currentTrack.Songwriter = matchSongWriter.Groups[1].Value; @@ -892,18 +870,15 @@ public sealed partial class CdrWin { AaruConsole. ErrorWriteLine(string. - Format( - Localization. - Found_TRACK_field_before_a_file_is_defined_at_line_0, - lineNumber)); + Format(Localization.Found_TRACK_field_before_a_file_is_defined_at_line_0, + lineNumber)); return ErrorNumber.InvalidArgument; } if(inTrack) { - if(currentTrack.Indexes.ContainsKey(0) && - currentTrack.Pregap == 0) + if(currentTrack.Indexes.ContainsKey(0) && currentTrack.Pregap == 0) currentTrack.Indexes.TryGetValue(0, out currentTrack.Pregap); currentFile.Sequence = currentTrack.Sequence; @@ -1082,8 +1057,7 @@ public sealed partial class CdrWin } // MagicISO writes 2048 bytes per data, sets Cuesheet as 2352, and fill the images with empty data. - if(_discImage.Tracks.Count == 1 && - _discImage.Tracks[0].TrackType == "MODE1/2352") + if(_discImage.Tracks.Count == 1 && _discImage.Tracks[0].TrackType == "MODE1/2352") { Stream track1Stream = _discImage.Tracks[0].TrackFile.DataFilter.GetDataForkStream(); @@ -1186,17 +1160,13 @@ public sealed partial class CdrWin } } - if(!data && - !firstData) + if(!data && !firstData) _discImage.MediaType = MediaType.CDDA; else if(cdg) _discImage.MediaType = MediaType.CDG; else if(cdi) _discImage.MediaType = MediaType.CDI; - else if(firstAudio && - data && - sessions.Length > 1 && - mode2) + else if(firstAudio && data && sessions.Length > 1 && mode2) _discImage.MediaType = MediaType.CDPLUS; else if(firstData && audio || mode2) _discImage.MediaType = MediaType.CDROMXA; @@ -1308,16 +1278,16 @@ public sealed partial class CdrWin AaruConsole.DebugWriteLine(MODULE_NAME, "\t\t" + Localization.Track_has_SCMS); AaruConsole.DebugWriteLine(MODULE_NAME, - "\t\t" + Localization. - Track_resides_in_file_0_type_defined_as_1_starting_at_byte_2, + "\t\t" + + Localization.Track_resides_in_file_0_type_defined_as_1_starting_at_byte_2, t.TrackFile.DataFilter.Filename, t.TrackFile.FileType, t.TrackFile.Offset); AaruConsole.DebugWriteLine(MODULE_NAME, "\t\t" + Localization.Indexes); foreach(KeyValuePair kvp in t.Indexes) { - AaruConsole.DebugWriteLine(MODULE_NAME, "\t\t\t" + Localization.Index_0_starts_at_sector_1, - kvp.Key, kvp.Value); + AaruConsole.DebugWriteLine(MODULE_NAME, "\t\t\t" + Localization.Index_0_starts_at_sector_1, kvp.Key, + kvp.Value); } if(t.Isrc == null) @@ -1368,9 +1338,7 @@ public sealed partial class CdrWin { if(track.TrackFile.DataFilter.BasePath != currentFilePath) { - if(_discImage.IsRedumpGigadisc && - track.Session == 2 && - firstTrackInSession) + if(_discImage.IsRedumpGigadisc && track.Session == 2 && firstTrackInSession) { currentSector = (int)gdRomSession2Offset - track.Pregap; track.Indexes.Add(0, 0); @@ -1395,8 +1363,8 @@ public sealed partial class CdrWin for(var s = 0; s < sessions.Length; s++) { - if(!_discImage.Tracks[(int)sessions[s].StartTrack - 1].Indexes. - TryGetValue(0, out int sessionTrackStart)) + if(!_discImage.Tracks[(int)sessions[s].StartTrack - 1]. + Indexes.TryGetValue(0, out int sessionTrackStart)) _discImage.Tracks[(int)sessions[s].StartTrack - 1].Indexes.TryGetValue(1, out sessionTrackStart); sessions[s].StartSector = (ulong)(sessionTrackStart > 0 ? sessionTrackStart : 0); @@ -1445,8 +1413,7 @@ public sealed partial class CdrWin for(var i = 0; i < _discImage.Tracks.Count; i++) { - if(_discImage.Tracks[i].Sequence == 1 && - i != 0) + if(_discImage.Tracks[i].Sequence == 1 && i != 0) { AaruConsole.ErrorWriteLine(Localization.Unordered_tracks); @@ -1475,8 +1442,7 @@ public sealed partial class CdrWin partitionSequence++; - if(_discImage.IsRedumpGigadisc && - _discImage.Tracks[i].Sequence == 3) + if(_discImage.IsRedumpGigadisc && _discImage.Tracks[i].Sequence == 3) { _offsetMap.Add(_discImage.Tracks[i].Sequence, gdRomSession2Offset - (ulong)_discImage.Tracks[i].Pregap); @@ -1515,8 +1481,7 @@ public sealed partial class CdrWin AaruConsole.DebugWriteLine(MODULE_NAME, "\t" + Localization.Partition_starting_offset_0, partition.Offset); - AaruConsole.DebugWriteLine(MODULE_NAME, "\t" + Localization.Partition_size_in_bytes_0, - partition.Size); + AaruConsole.DebugWriteLine(MODULE_NAME, "\t" + Localization.Partition_size_in_bytes_0, partition.Size); } if(_discImage.MediaType != MediaType.CDROMXA && @@ -1655,10 +1620,7 @@ public sealed partial class CdrWin _isCd = mediaTypeAsInt is >= 10 and <= 39 or 112 or 113 or >= 150 and <= 152 or 154 or 155 or >= 171 and <= 179 or >= 740 and <= 749; - if(currentSession > 1 && - leadouts.Count == 0 && - !_discImage.IsRedumpGigadisc && - _isCd) + if(currentSession > 1 && leadouts.Count == 0 && !_discImage.IsRedumpGigadisc && _isCd) { AaruConsole.ErrorWriteLine(Localization. This_image_is_missing_vital_multi_session_data_and_cannot_be_read_correctly); @@ -1691,8 +1653,7 @@ public sealed partial class CdrWin for(var s = 0; s < sessions.Length; s++) { - if(sessions[s].Sequence <= 1 || - track.Sequence != sessions[s].StartTrack) + if(sessions[s].Sequence <= 1 || track.Sequence != sessions[s].StartTrack) continue; track.TrackFile.Offset += 307200; @@ -1877,8 +1838,7 @@ public sealed partial class CdrWin buffer = new byte[sectorSize * length]; // If it's the lost pregap - if(track == 1 && - _lostPregap > 0) + if(track == 1 && _lostPregap > 0) { if(sectorAddress < _lostPregap) { @@ -1950,8 +1910,7 @@ public sealed partial class CdrWin buffer = mode2Ms.ToArray(); } - else if(sectorOffset == 0 && - sectorSkip == 0) + else if(sectorOffset == 0 && sectorSkip == 0) buffer = br.ReadBytes((int)(sectorSize * length)); else { @@ -2003,8 +1962,7 @@ public sealed partial class CdrWin { CdFlags flags = 0; - if(aaruTrack.TrackType != CDRWIN_TRACK_TYPE_AUDIO && - aaruTrack.TrackType != CDRWIN_TRACK_TYPE_CDG) + if(aaruTrack.TrackType != CDRWIN_TRACK_TYPE_AUDIO && aaruTrack.TrackType != CDRWIN_TRACK_TYPE_CDG) flags |= CdFlags.DataTrack; if(aaruTrack.FlagDcp) @@ -2016,7 +1974,10 @@ public sealed partial class CdrWin if(aaruTrack.Flag4Ch) flags |= CdFlags.FourChannel; - buffer = new[] { (byte)flags }; + buffer = new[] + { + (byte)flags + }; return ErrorNumber.NoError; } @@ -2177,8 +2138,7 @@ public sealed partial class CdrWin buffer = new byte[sectorSize * length]; // If it's the lost pregap - if(track == 1 && - _lostPregap > 0) + if(track == 1 && _lostPregap > 0) { if(sectorAddress < _lostPregap) { @@ -2208,8 +2168,7 @@ public sealed partial class CdrWin Seek((long)aaruTrack.TrackFile.Offset + (long)(sectorAddress * (sectorOffset + sectorSize + sectorSkip)), SeekOrigin.Begin); - if(sectorOffset == 0 && - sectorSkip == 0) + if(sectorOffset == 0 && sectorSkip == 0) buffer = br.ReadBytes((int)(sectorSize * length)); else { @@ -2323,8 +2282,7 @@ public sealed partial class CdrWin buffer = new byte[sectorSize * length]; // If it's the lost pregap - if(track == 1 && - _lostPregap > 0) + if(track == 1 && _lostPregap > 0) { if(sectorAddress < _lostPregap) { diff --git a/Aaru.Images/CDRWin/Verify.cs b/Aaru.Images/CDRWin/Verify.cs index f94294740..07587b974 100644 --- a/Aaru.Images/CDRWin/Verify.cs +++ b/Aaru.Images/CDRWin/Verify.cs @@ -57,7 +57,9 @@ public sealed partial class CdrWin long readBytes; byte[] verifyBytes; - IFilter[] filters = _discImage.Tracks.OrderBy(t => t.Sequence).Select(t => t.TrackFile.DataFilter).Distinct(). + IFilter[] filters = _discImage.Tracks.OrderBy(t => t.Sequence). + Select(t => t.TrackFile.DataFilter). + Distinct(). ToArray(); if(_discImage.DiscHashes.TryGetValue("sha1", out string sha1)) diff --git a/Aaru.Images/CDRWin/Write.cs b/Aaru.Images/CDRWin/Write.cs index 820844c40..b3618240c 100644 --- a/Aaru.Images/CDRWin/Write.cs +++ b/Aaru.Images/CDRWin/Write.cs @@ -375,16 +375,14 @@ public sealed partial class CdrWin return false; } - if(tracks == null || - tracks.Count == 0) + if(tracks == null || tracks.Count == 0) { ErrorMessage = Localization.Invalid_tracks_sent; return false; } - if(_writingTracks != null && - _writingStreams != null) + if(_writingTracks != null && _writingStreams != null) { foreach(FileStream oldTrack in _writingStreams.Select(t => t.Value).Distinct()) oldTrack.Close(); @@ -453,7 +451,10 @@ public sealed partial class CdrWin if(!string.IsNullOrWhiteSpace(_discImage.Comment)) { - string[] commentLines = _discImage.Comment.Split(new[] { '\n' }, StringSplitOptions.RemoveEmptyEntries); + string[] commentLines = _discImage.Comment.Split(new[] + { + '\n' + }, StringSplitOptions.RemoveEmptyEntries); foreach(string line in commentLines) _descriptorStream.WriteLine("REM {0}", line); @@ -540,8 +541,7 @@ public sealed partial class CdrWin { if(_trackFlags.TryGetValue((byte)track.Sequence, out byte flagsByte)) { - if(flagsByte != 0 && - flagsByte != (byte)CdFlags.DataTrack) + if(flagsByte != 0 && flagsByte != (byte)CdFlags.DataTrack) { var flags = (CdFlags)flagsByte; @@ -552,8 +552,7 @@ public sealed partial class CdrWin } } - if(_trackIsrcs.TryGetValue((byte)track.Sequence, out string isrc) && - !string.IsNullOrWhiteSpace(isrc)) + if(_trackIsrcs.TryGetValue((byte)track.Sequence, out string isrc) && !string.IsNullOrWhiteSpace(isrc)) _descriptorStream.WriteLine(" ISRC {0}", isrc); } diff --git a/Aaru.Images/CHD/Helpers.cs b/Aaru.Images/CHD/Helpers.cs index a2e86330e..9004dc235 100644 --- a/Aaru.Images/CHD/Helpers.cs +++ b/Aaru.Images/CHD/Helpers.cs @@ -96,10 +96,8 @@ public sealed partial class Chd { AaruConsole. ErrorWriteLine(string. - Format( - Localization. - Unable_to_decompress_hunk_correctly_got_0_bytes_expected_1, - read, _sectorsPerHunk * _imageInfo.SectorSize)); + Format(Localization.Unable_to_decompress_hunk_correctly_got_0_bytes_expected_1, + read, _sectorsPerHunk * _imageInfo.SectorSize)); return ErrorNumber.InOutError; } @@ -142,10 +140,8 @@ public sealed partial class Chd { AaruConsole. ErrorWriteLine(string. - Format( - Localization. - Unable_to_decompress_hunk_correctly_got_0_bytes_expected_1, - read, _bytesPerHunk)); + Format(Localization.Unable_to_decompress_hunk_correctly_got_0_bytes_expected_1, + read, _bytesPerHunk)); return ErrorNumber.InOutError; } diff --git a/Aaru.Images/CPCDSK/Identify.cs b/Aaru.Images/CPCDSK/Identify.cs index 8a348979b..6b5111762 100644 --- a/Aaru.Images/CPCDSK/Identify.cs +++ b/Aaru.Images/CPCDSK/Identify.cs @@ -59,8 +59,7 @@ public sealed partial class Cpcdsk for(pos = 0; pos < 254; pos++) { - if(headerB[pos] == 0x0D && - headerB[pos + 1] == 0x0A) + if(headerB[pos] == 0x0D && headerB[pos + 1] == 0x0A) break; } diff --git a/Aaru.Images/CPCDSK/Read.cs b/Aaru.Images/CPCDSK/Read.cs index 64563debe..90f57e496 100644 --- a/Aaru.Images/CPCDSK/Read.cs +++ b/Aaru.Images/CPCDSK/Read.cs @@ -65,8 +65,7 @@ public sealed partial class Cpcdsk for(pos = 0; pos < 254; pos++) { - if(headerB[pos] == 0x0D && - headerB[pos + 1] == 0x0A) + if(headerB[pos] == 0x0D && headerB[pos + 1] == 0x0A) break; } @@ -92,8 +91,7 @@ public sealed partial class Cpcdsk AaruConsole.DebugWriteLine(MODULE_NAME, "header.magic = \"{0}\"", StringHandlers.CToString(header.magic)); - AaruConsole.DebugWriteLine(MODULE_NAME, "header.creator = \"{0}\"", - StringHandlers.CToString(header.creator)); + AaruConsole.DebugWriteLine(MODULE_NAME, "header.creator = \"{0}\"", StringHandlers.CToString(header.creator)); AaruConsole.DebugWriteLine(MODULE_NAME, "header.tracks = {0}", header.tracks); AaruConsole.DebugWriteLine(MODULE_NAME, "header.sides = {0}", header.sides); @@ -137,7 +135,8 @@ public sealed partial class Cpcdsk TrackInfo trackInfo = Marshal.ByteArrayToStructureLittleEndian(trackB); if(string.Compare(TRACK_ID, Encoding.ASCII.GetString(trackInfo.magic), - StringComparison.InvariantCultureIgnoreCase) != 0) + StringComparison.InvariantCultureIgnoreCase) != + 0) { AaruConsole.ErrorWriteLine(Localization.Not_the_expected_track_info); @@ -147,25 +146,21 @@ public sealed partial class Cpcdsk AaruConsole.DebugWriteLine(MODULE_NAME, "trackInfo[{1}:{2}].magic = \"{0}\"", StringHandlers.CToString(trackInfo.magic), i, j); - AaruConsole.DebugWriteLine(MODULE_NAME, "trackInfo[{1}:{2}].bps = {0}", - SizeCodeToBytes(trackInfo.bps), i, j); + AaruConsole.DebugWriteLine(MODULE_NAME, "trackInfo[{1}:{2}].bps = {0}", SizeCodeToBytes(trackInfo.bps), + i, j); - AaruConsole.DebugWriteLine(MODULE_NAME, "trackInfo[{1}:{2}].dataRate = {0}", trackInfo.dataRate, i, - j); + AaruConsole.DebugWriteLine(MODULE_NAME, "trackInfo[{1}:{2}].dataRate = {0}", trackInfo.dataRate, i, j); - AaruConsole.DebugWriteLine(MODULE_NAME, "trackInfo[{1}:{2}].filler = 0x{0:X2}", trackInfo.filler, i, - j); + AaruConsole.DebugWriteLine(MODULE_NAME, "trackInfo[{1}:{2}].filler = 0x{0:X2}", trackInfo.filler, i, j); AaruConsole.DebugWriteLine(MODULE_NAME, "trackInfo[{1}:{2}].gap3 = 0x{0:X2}", trackInfo.gap3, i, j); - AaruConsole.DebugWriteLine(MODULE_NAME, "trackInfo[{1}:{2}].padding = {0}", trackInfo.padding, i, - j); + AaruConsole.DebugWriteLine(MODULE_NAME, "trackInfo[{1}:{2}].padding = {0}", trackInfo.padding, i, j); AaruConsole.DebugWriteLine(MODULE_NAME, "trackInfo[{1}:{2}].recordingMode = {0}", trackInfo.recordingMode, i, j); - AaruConsole.DebugWriteLine(MODULE_NAME, "trackInfo[{1}:{2}].sectors = {0}", trackInfo.sectors, i, - j); + AaruConsole.DebugWriteLine(MODULE_NAME, "trackInfo[{1}:{2}].sectors = {0}", trackInfo.sectors, i, j); AaruConsole.DebugWriteLine(MODULE_NAME, "trackInfo[{1}:{2}].side = {0}", trackInfo.side, i, j); diff --git a/Aaru.Images/CisCopy/Identify.cs b/Aaru.Images/CisCopy/Identify.cs index 49fc9bcfe..dc02b028c 100644 --- a/Aaru.Images/CisCopy/Identify.cs +++ b/Aaru.Images/CisCopy/Identify.cs @@ -81,9 +81,7 @@ public sealed partial class CisCopy var cmpr = (Compression)stream.ReadByte(); - if(cmpr != Compression.None && - cmpr != Compression.Normal && - cmpr != Compression.High) + if(cmpr != Compression.None && cmpr != Compression.Normal && cmpr != Compression.High) return false; switch(type) diff --git a/Aaru.Images/CisCopy/Properties.cs b/Aaru.Images/CisCopy/Properties.cs index eff206853..7629bd33a 100644 --- a/Aaru.Images/CisCopy/Properties.cs +++ b/Aaru.Images/CisCopy/Properties.cs @@ -84,7 +84,10 @@ public sealed partial class CisCopy Array.Empty<(string name, Type type, string description, object @default)>(); /// - public IEnumerable KnownExtensions => new[] { ".dcf" }; + public IEnumerable KnownExtensions => new[] + { + ".dcf" + }; /// public bool IsWriting { get; private set; } diff --git a/Aaru.Images/CloneCD/Identify.cs b/Aaru.Images/CloneCD/Identify.cs index cf29fcf16..ef55dad82 100644 --- a/Aaru.Images/CloneCD/Identify.cs +++ b/Aaru.Images/CloneCD/Identify.cs @@ -73,10 +73,7 @@ public sealed partial class CloneCd else twoConsecutiveNulls = false; - if(testArray[i] < 0x20 && - testArray[i] != 0x0A && - testArray[i] != 0x0D && - testArray[i] != 0x00) + if(testArray[i] < 0x20 && testArray[i] != 0x0A && testArray[i] != 0x0D && testArray[i] != 0x00) return false; } diff --git a/Aaru.Images/CloneCD/Properties.cs b/Aaru.Images/CloneCD/Properties.cs index 68725fa7e..195519e3e 100644 --- a/Aaru.Images/CloneCD/Properties.cs +++ b/Aaru.Images/CloneCD/Properties.cs @@ -92,26 +92,29 @@ public sealed partial class CloneCd public Metadata AaruMetadata => 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[] { - SectorTagType.CdSectorEcc, SectorTagType.CdSectorEccP, SectorTagType.CdSectorEccQ, - SectorTagType.CdSectorEdc, SectorTagType.CdSectorHeader, SectorTagType.CdSectorSubHeader, - SectorTagType.CdSectorSync, SectorTagType.CdTrackFlags, SectorTagType.CdSectorSubchannel + SectorTagType.CdSectorEcc, SectorTagType.CdSectorEccP, SectorTagType.CdSectorEccQ, SectorTagType.CdSectorEdc, + SectorTagType.CdSectorHeader, SectorTagType.CdSectorSubHeader, SectorTagType.CdSectorSync, + SectorTagType.CdTrackFlags, SectorTagType.CdSectorSubchannel }; /// public IEnumerable SupportedMediaTypes => new[] { - MediaType.CD, MediaType.CDDA, MediaType.CDEG, MediaType.CDG, MediaType.CDI, MediaType.CDMIDI, - MediaType.CDMRW, MediaType.CDPLUS, MediaType.CDR, MediaType.CDROM, MediaType.CDROMXA, MediaType.CDRW, - MediaType.CDV, MediaType.DTSCD, MediaType.JaguarCD, MediaType.MEGACD, MediaType.PS1CD, MediaType.PS2CD, - MediaType.SuperCDROM2, MediaType.SVCD, MediaType.SATURNCD, MediaType.ThreeDO, MediaType.VCD, - MediaType.VCDHD, MediaType.NeoGeoCD, MediaType.PCFX, MediaType.CDTV, MediaType.CD32, MediaType.Nuon, - MediaType.Playdia, MediaType.Pippin, MediaType.FMTOWNS, MediaType.MilCD, MediaType.VideoNow, - MediaType.VideoNowColor, MediaType.VideoNowXp, MediaType.CVD, MediaType.PCD + MediaType.CD, MediaType.CDDA, MediaType.CDEG, MediaType.CDG, MediaType.CDI, MediaType.CDMIDI, MediaType.CDMRW, + MediaType.CDPLUS, MediaType.CDR, MediaType.CDROM, MediaType.CDROMXA, MediaType.CDRW, MediaType.CDV, + MediaType.DTSCD, MediaType.JaguarCD, MediaType.MEGACD, MediaType.PS1CD, MediaType.PS2CD, MediaType.SuperCDROM2, + MediaType.SVCD, MediaType.SATURNCD, MediaType.ThreeDO, MediaType.VCD, MediaType.VCDHD, MediaType.NeoGeoCD, + MediaType.PCFX, MediaType.CDTV, MediaType.CD32, MediaType.Nuon, MediaType.Playdia, MediaType.Pippin, + MediaType.FMTOWNS, MediaType.MilCD, MediaType.VideoNow, MediaType.VideoNowColor, MediaType.VideoNowXp, + MediaType.CVD, MediaType.PCD }; /// @@ -119,7 +122,10 @@ public sealed partial class CloneCd Array.Empty<(string name, Type type, string description, object @default)>(); /// - public IEnumerable KnownExtensions => new[] { ".ccd" }; + public IEnumerable KnownExtensions => new[] + { + ".ccd" + }; /// public bool IsWriting { get; private set; } diff --git a/Aaru.Images/CloneCD/Read.cs b/Aaru.Images/CloneCD/Read.cs index 4c327a655..5003d6af6 100644 --- a/Aaru.Images/CloneCD/Read.cs +++ b/Aaru.Images/CloneCD/Read.cs @@ -129,11 +129,7 @@ public sealed partial class CloneCd // [CloneCD] if(ccdIdMatch.Success) { - if(inDisk || - inSession || - inEntry || - inTrack || - inCdText) + if(inDisk || inSession || inEntry || inTrack || inCdText) { AaruConsole.ErrorWriteLine(string.Format(Localization.Found_CloneCD_out_of_order_in_line_0, lineNumber)); @@ -183,13 +179,11 @@ public sealed partial class CloneCd _imageInfo.Version = ccdVerMatch.Groups["value"].Value; - if(_imageInfo.Version != "2" && - _imageInfo.Version != "3") + if(_imageInfo.Version != "2" && _imageInfo.Version != "3") { AaruConsole. - ErrorWriteLine( - Localization.CloneCD_plugin_Warning_Unknown_CCD_image_version_0_may_not_work, - _imageInfo.Version); + ErrorWriteLine(Localization.CloneCD_plugin_Warning_Unknown_CCD_image_version_0_may_not_work, + _imageInfo.Version); } } else if(inDisk) @@ -206,14 +200,11 @@ public sealed partial class CloneCd lineNumber); } else if(discSessMatch.Success) - { - AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Found_Sessions_at_line_0, - lineNumber); - } + AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Found_Sessions_at_line_0, lineNumber); else if(discScrMatch.Success) { - AaruConsole.DebugWriteLine(MODULE_NAME, - Localization.Found_DataTracksScrambled_at_line_0, lineNumber); + AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Found_DataTracksScrambled_at_line_0, + lineNumber); _scrambled |= discScrMatch.Groups["value"].Value == "1"; } @@ -247,8 +238,11 @@ public sealed partial class CloneCd AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Found_CD_Text_Entry_at_line_0, lineNumber); - string[] bytes = cdtEntMatch.Groups["value"].Value. - Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries); + string[] bytes = cdtEntMatch.Groups["value"]. + Value.Split(new[] + { + ' ' + }, StringSplitOptions.RemoveEmptyEntries); foreach(string byt in bytes) cdtMs.WriteByte(Convert.ToByte(byt, 16)); @@ -291,8 +285,7 @@ public sealed partial class CloneCd if(entSessMatch.Success) { - AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Found_Session_at_line_0, - lineNumber); + AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Found_Session_at_line_0, lineNumber); currentEntry.SessionNumber = Convert.ToByte(entSessMatch.Groups["value"].Value, 10); @@ -304,8 +297,7 @@ public sealed partial class CloneCd } else if(entPointMatch.Success) { - AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Found_Point_at_line_0, - lineNumber); + AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Found_Point_at_line_0, lineNumber); currentEntry.POINT = Convert.ToByte(entPointMatch.Groups["value"].Value, 16); } @@ -316,15 +308,13 @@ public sealed partial class CloneCd } else if(entCtrlMatch.Success) { - AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Found_Control_at_line_0, - lineNumber); + AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Found_Control_at_line_0, lineNumber); currentEntry.CONTROL = Convert.ToByte(entCtrlMatch.Groups["value"].Value, 16); } else if(entTnoMatch.Success) { - AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Found_TrackNo_at_line_0, - lineNumber); + AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Found_TrackNo_at_line_0, lineNumber); currentEntry.TNO = Convert.ToByte(entTnoMatch.Groups["value"].Value, 10); } @@ -340,8 +330,7 @@ public sealed partial class CloneCd } else if(entAFrameMatch.Success) { - AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Found_AFrame_at_line_0, - lineNumber); + AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Found_AFrame_at_line_0, lineNumber); currentEntry.Frame = Convert.ToByte(entAFrameMatch.Groups["value"].Value, 10); } @@ -366,8 +355,7 @@ public sealed partial class CloneCd } else if(entPFrameMatch.Success) { - AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Found_PFrame_at_line_0, - lineNumber); + AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Found_PFrame_at_line_0, lineNumber); currentEntry.PFRAME = Convert.ToByte(entPFrameMatch.Groups["value"].Value, 10); } @@ -379,11 +367,9 @@ public sealed partial class CloneCd Match trkModeMatch = trkModeRegex.Match(line); Match trkIndexMatch = trkIndexRegex.Match(line); - if(trkModeMatch.Success && - currentTrackEntry > 0) + if(trkModeMatch.Success && currentTrackEntry > 0) trackModes[currentTrackEntry] = Convert.ToByte(trkModeMatch.Groups["value"].Value, 10); - else if(trkIndexMatch.Success && - currentTrackEntry > 0) + else if(trkIndexMatch.Success && currentTrackEntry > 0) { var indexNo = Convert.ToByte(trkIndexMatch.Groups["index"].Value, 10); var indexLba = Convert.ToInt32(trkIndexMatch.Groups["lba"].Value, 10); @@ -582,8 +568,7 @@ public sealed partial class CloneCd if(_imageInfo.MediaManufacturer != "") { - AaruConsole.DebugWriteLine(MODULE_NAME, - Localization.Disc_manufactured_by_0, + AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Disc_manufactured_by_0, _imageInfo.MediaManufacturer); } } @@ -673,8 +658,7 @@ public sealed partial class CloneCd long pos = (long)tmpTrack.FileOffset + s * 2352; - if(pos >= _dataStream.Length + 2352 || - s >= (int)(tmpTrack.EndSector - tmpTrack.StartSector)) + if(pos >= _dataStream.Length + 2352 || s >= (int)(tmpTrack.EndSector - tmpTrack.StartSector)) break; _dataStream.Seek(pos, SeekOrigin.Begin); @@ -726,8 +710,7 @@ public sealed partial class CloneCd Array.Copy(sectTest, 16, subHdr1, 0, 4); Array.Copy(sectTest, 20, subHdr2, 0, 4); - if(subHdr1.SequenceEqual(subHdr2) && - !empHdr.SequenceEqual(subHdr1)) + if(subHdr1.SequenceEqual(subHdr2) && !empHdr.SequenceEqual(subHdr1)) { if((subHdr1[2] & 0x20) == 0x20) { @@ -806,8 +789,7 @@ public sealed partial class CloneCd Tracks = tmpTracks.ToList(); - if(_subFilter != null && - !_imageInfo.ReadableSectorTags.Contains(SectorTagType.CdSectorSubchannel)) + if(_subFilter != null && !_imageInfo.ReadableSectorTags.Contains(SectorTagType.CdSectorSubchannel)) _imageInfo.ReadableSectorTags.Add(SectorTagType.CdSectorSubchannel); _imageInfo.ReadableSectorTags.Add(SectorTagType.CdTrackFlags); @@ -908,13 +890,9 @@ public sealed partial class CloneCd // TODO: Check format _cdtext = cdtMs.ToArray(); - if(!data && - !firstData) + if(!data && !firstData) _imageInfo.MediaType = MediaType.CDDA; - else if(firstAudio && - data && - Sessions.Count > 1 && - mode2) + else if(firstAudio && data && Sessions.Count > 1 && mode2) _imageInfo.MediaType = MediaType.CDPLUS; else if(firstData && audio || mode2) _imageInfo.MediaType = MediaType.CDROMXA; @@ -1005,7 +983,8 @@ public sealed partial class CloneCd { kvp, track - }).Where(t => t.track.Sequence == t.kvp.Key). + }). + Where(t => t.track.Sequence == t.kvp.Key). Where(t => sectorAddress - t.kvp.Value < t.track.EndSector - t.track.StartSector + 1). Select(t => t.kvp)) @@ -1084,8 +1063,7 @@ public sealed partial class CloneCd buffer = mode2Ms.ToArray(); } - else if(sectorOffset == 0 && - sectorSkip == 0) + else if(sectorOffset == 0 && sectorSkip == 0) _dataStream.EnsureRead(buffer, 0, buffer.Length); else { @@ -1136,7 +1114,10 @@ public sealed partial class CloneCd if(!_trackFlags.TryGetValue((byte)aaruTrack.Sequence, out byte flags)) return ErrorNumber.NoData; - buffer = new[] { flags }; + buffer = new[] + { + flags + }; return ErrorNumber.NoError; case SectorTagType.CdSectorSubchannel: @@ -1357,8 +1338,7 @@ public sealed partial class CloneCd _dataStream.Seek((long)(aaruTrack.FileOffset + sectorAddress * 2352), SeekOrigin.Begin); - if(sectorOffset == 0 && - sectorSkip == 0) + if(sectorOffset == 0 && sectorSkip == 0) _dataStream.EnsureRead(buffer, 0, buffer.Length); else { diff --git a/Aaru.Images/CloneCD/Write.cs b/Aaru.Images/CloneCD/Write.cs index a82538083..fcb3cee88 100644 --- a/Aaru.Images/CloneCD/Write.cs +++ b/Aaru.Images/CloneCD/Write.cs @@ -246,8 +246,7 @@ public sealed partial class CloneCd { Track firstSessionTrack = tracks.FirstOrDefault(t => t.Session == newTrack.Session); - if(firstSessionTrack?.Sequence == newTrack.Sequence && - newTrack.Pregap >= 150) + if(firstSessionTrack?.Sequence == newTrack.Sequence && newTrack.Pregap >= 150) { newTrack.Pregap -= 150; newTrack.StartSector += 150; diff --git a/Aaru.Images/CopyQM/Read.cs b/Aaru.Images/CopyQM/Read.cs index 2255dee4c..01409fcac 100644 --- a/Aaru.Images/CopyQM/Read.cs +++ b/Aaru.Images/CopyQM/Read.cs @@ -126,10 +126,7 @@ public sealed partial class CopyQm _decodedImage.Write(nonRepeated, 0, runLength); foreach(byte c in nonRepeated) - { - _calculatedDataCrc = - _copyQmCrcTable[(c ^ _calculatedDataCrc) & 0x3F] ^ _calculatedDataCrc >> 8; - } + _calculatedDataCrc = _copyQmCrcTable[(c ^ _calculatedDataCrc) & 0x3F] ^ _calculatedDataCrc >> 8; break; } @@ -155,8 +152,8 @@ public sealed partial class CopyQm _headerChecksumOk = (-1 * sum & 0xFF) == _header.headerChecksum; - AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Calculated_header_checksum_equals_0_X2_1, - -1 * sum & 0xFF, _headerChecksumOk); + AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Calculated_header_checksum_equals_0_X2_1, -1 * sum & 0xFF, + _headerChecksumOk); AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Calculated_data_CRC_equals_0_X8_1, _calculatedDataCrc, _calculatedDataCrc == _header.crc); diff --git a/Aaru.Images/CopyTape/Identify.cs b/Aaru.Images/CopyTape/Identify.cs index ccf58f604..94f0e5533 100644 --- a/Aaru.Images/CopyTape/Identify.cs +++ b/Aaru.Images/CopyTape/Identify.cs @@ -70,8 +70,7 @@ public sealed partial class CopyTape if(!uint.TryParse(blkSize, out uint blockSize)) return false; - if(blockSize == 0 || - blockSize + 17 >= imageFilter.DataForkLength) + if(blockSize == 0 || blockSize + 17 >= imageFilter.DataForkLength) return false; strm.Position += blockSize; diff --git a/Aaru.Images/CopyTape/Properties.cs b/Aaru.Images/CopyTape/Properties.cs index 424e9152a..f8f0230ba 100644 --- a/Aaru.Images/CopyTape/Properties.cs +++ b/Aaru.Images/CopyTape/Properties.cs @@ -85,31 +85,30 @@ public sealed partial class CopyTape /// public IEnumerable SupportedMediaTypes => new[] { - MediaType.UnknownTape, MediaType.ADR2120, MediaType.ADR260, MediaType.ADR30, MediaType.ADR50, - MediaType.AIT1, MediaType.AIT1Turbo, MediaType.AIT2, MediaType.AIT2Turbo, MediaType.AIT3, MediaType.AIT3Ex, - MediaType.AIT3Turbo, MediaType.AIT4, MediaType.AIT5, MediaType.AITETurbo, MediaType.SAIT1, MediaType.SAIT2, - MediaType.Ditto, MediaType.DittoMax, MediaType.DigitalAudioTape, MediaType.DAT160, MediaType.DAT320, - MediaType.DAT72, MediaType.DDS1, MediaType.DDS2, MediaType.DDS3, MediaType.DDS4, MediaType.CompactTapeI, - MediaType.CompactTapeII, MediaType.DECtapeII, MediaType.DLTtapeIII, MediaType.DLTtapeIIIxt, - MediaType.DLTtapeIV, MediaType.DLTtapeS4, MediaType.SDLT1, MediaType.SDLT2, MediaType.VStapeI, - MediaType.Exatape15m, MediaType.Exatape22m, MediaType.Exatape22mAME, MediaType.Exatape28m, - MediaType.Exatape40m, MediaType.Exatape45m, MediaType.Exatape54m, MediaType.Exatape75m, - MediaType.Exatape76m, MediaType.Exatape80m, MediaType.Exatape106m, MediaType.Exatape160mXL, - MediaType.Exatape112m, MediaType.Exatape125m, MediaType.Exatape150m, MediaType.Exatape170m, - MediaType.Exatape225m, MediaType.IBM3470, MediaType.IBM3480, MediaType.IBM3490, MediaType.IBM3490E, - MediaType.IBM3592, MediaType.LTO, MediaType.LTO2, MediaType.LTO3, MediaType.LTO3WORM, MediaType.LTO4, - MediaType.LTO4WORM, MediaType.LTO5, MediaType.LTO5WORM, MediaType.LTO6, MediaType.LTO6WORM, MediaType.LTO7, - MediaType.LTO7WORM, MediaType.MLR1, MediaType.MLR1SL, MediaType.MLR3, MediaType.SLR1, MediaType.SLR2, - MediaType.SLR3, MediaType.SLR32, MediaType.SLR32SL, MediaType.SLR4, MediaType.SLR5, MediaType.SLR5SL, - MediaType.SLR6, MediaType.SLRtape7, MediaType.SLRtape7SL, MediaType.SLRtape24, MediaType.SLRtape24SL, - MediaType.SLRtape40, MediaType.SLRtape50, MediaType.SLRtape60, MediaType.SLRtape75, MediaType.SLRtape100, - MediaType.SLRtape140, MediaType.QIC11, MediaType.QIC120, MediaType.QIC1350, MediaType.QIC150, - MediaType.QIC24, MediaType.QIC3010, MediaType.QIC3020, MediaType.QIC3080, MediaType.QIC3095, + MediaType.UnknownTape, MediaType.ADR2120, MediaType.ADR260, MediaType.ADR30, MediaType.ADR50, MediaType.AIT1, + MediaType.AIT1Turbo, MediaType.AIT2, MediaType.AIT2Turbo, MediaType.AIT3, MediaType.AIT3Ex, MediaType.AIT3Turbo, + MediaType.AIT4, MediaType.AIT5, MediaType.AITETurbo, MediaType.SAIT1, MediaType.SAIT2, MediaType.Ditto, + MediaType.DittoMax, MediaType.DigitalAudioTape, MediaType.DAT160, MediaType.DAT320, MediaType.DAT72, + MediaType.DDS1, MediaType.DDS2, MediaType.DDS3, MediaType.DDS4, MediaType.CompactTapeI, MediaType.CompactTapeII, + MediaType.DECtapeII, MediaType.DLTtapeIII, MediaType.DLTtapeIIIxt, MediaType.DLTtapeIV, MediaType.DLTtapeS4, + MediaType.SDLT1, MediaType.SDLT2, MediaType.VStapeI, MediaType.Exatape15m, MediaType.Exatape22m, + MediaType.Exatape22mAME, MediaType.Exatape28m, MediaType.Exatape40m, MediaType.Exatape45m, MediaType.Exatape54m, + MediaType.Exatape75m, MediaType.Exatape76m, MediaType.Exatape80m, MediaType.Exatape106m, + MediaType.Exatape160mXL, MediaType.Exatape112m, MediaType.Exatape125m, MediaType.Exatape150m, + MediaType.Exatape170m, MediaType.Exatape225m, MediaType.IBM3470, MediaType.IBM3480, MediaType.IBM3490, + MediaType.IBM3490E, MediaType.IBM3592, MediaType.LTO, MediaType.LTO2, MediaType.LTO3, MediaType.LTO3WORM, + MediaType.LTO4, MediaType.LTO4WORM, MediaType.LTO5, MediaType.LTO5WORM, MediaType.LTO6, MediaType.LTO6WORM, + MediaType.LTO7, MediaType.LTO7WORM, MediaType.MLR1, MediaType.MLR1SL, MediaType.MLR3, MediaType.SLR1, + MediaType.SLR2, MediaType.SLR3, MediaType.SLR32, MediaType.SLR32SL, MediaType.SLR4, MediaType.SLR5, + MediaType.SLR5SL, MediaType.SLR6, MediaType.SLRtape7, MediaType.SLRtape7SL, MediaType.SLRtape24, + MediaType.SLRtape24SL, MediaType.SLRtape40, MediaType.SLRtape50, MediaType.SLRtape60, MediaType.SLRtape75, + MediaType.SLRtape100, MediaType.SLRtape140, MediaType.QIC11, MediaType.QIC120, MediaType.QIC1350, + MediaType.QIC150, MediaType.QIC24, MediaType.QIC3010, MediaType.QIC3020, MediaType.QIC3080, MediaType.QIC3095, MediaType.QIC320, MediaType.QIC40, MediaType.QIC525, MediaType.QIC80, MediaType.STK4480, MediaType.STK4490, MediaType.STK9490, MediaType.T9840A, MediaType.T9840B, MediaType.T9840C, MediaType.T9840D, MediaType.T9940A, - MediaType.T9940B, MediaType.T10000A, MediaType.T10000B, MediaType.T10000C, MediaType.T10000D, - MediaType.Travan, MediaType.Travan1Ex, MediaType.Travan3, MediaType.Travan3Ex, MediaType.Travan4, - MediaType.Travan5, MediaType.Travan7, MediaType.VXA1, MediaType.VXA2, MediaType.VXA3 + MediaType.T9940B, MediaType.T10000A, MediaType.T10000B, MediaType.T10000C, MediaType.T10000D, MediaType.Travan, + MediaType.Travan1Ex, MediaType.Travan3, MediaType.Travan3Ex, MediaType.Travan4, MediaType.Travan5, + MediaType.Travan7, MediaType.VXA1, MediaType.VXA2, MediaType.VXA3 }; /// @@ -117,7 +116,10 @@ public sealed partial class CopyTape Array.Empty<(string name, Type type, string description, object @default)>(); /// - public IEnumerable KnownExtensions => new[] { ".cptp" }; + public IEnumerable KnownExtensions => new[] + { + ".cptp" + }; /// public bool IsWriting { get; private set; } diff --git a/Aaru.Images/CopyTape/Read.cs b/Aaru.Images/CopyTape/Read.cs index 5dfb1e0ef..12d12f9c7 100644 --- a/Aaru.Images/CopyTape/Read.cs +++ b/Aaru.Images/CopyTape/Read.cs @@ -141,8 +141,7 @@ public sealed partial class CopyTape return ErrorNumber.InvalidArgument; } - if(blockSize == 0 || - blockSize + 17 > imageFilter.DataForkLength) + if(blockSize == 0 || blockSize + 17 > imageFilter.DataForkLength) { AaruConsole.ErrorWriteLine(Localization.Cannot_decode_block_header_cannot_open); @@ -219,8 +218,7 @@ public sealed partial class CopyTape if(!uint.TryParse(blkSize, out uint blockSize)) return ErrorNumber.InvalidArgument; - if(blockSize == 0 || - blockSize + 17 > _imageStream.Length) + if(blockSize == 0 || blockSize + 17 > _imageStream.Length) return ErrorNumber.InvalidArgument; buffer = new byte[blockSize]; diff --git a/Aaru.Images/CopyTape/Write.cs b/Aaru.Images/CopyTape/Write.cs index eaf92a61b..0a9c5c9aa 100644 --- a/Aaru.Images/CopyTape/Write.cs +++ b/Aaru.Images/CopyTape/Write.cs @@ -104,17 +104,14 @@ public sealed partial class CopyTape { if(!_writtenBlockPositions.TryGetValue(sectorAddress, out ulong position)) { - if(_dataStream.Length != 0 && - _lastWrittenBlock >= sectorAddress) + if(_dataStream.Length != 0 && _lastWrittenBlock >= sectorAddress) { ErrorMessage = Localization.Cannot_write_unwritten_blocks; return false; } - if(_lastWrittenBlock + 1 != sectorAddress && - sectorAddress != 0 && - _lastWrittenBlock != 0) + if(_lastWrittenBlock + 1 != sectorAddress && sectorAddress != 0 && _lastWrittenBlock != 0) { ErrorMessage = Localization.Cannot_skip_blocks; diff --git a/Aaru.Images/D88/Constants.cs b/Aaru.Images/D88/Constants.cs index 3811ce025..e9beaa518 100644 --- a/Aaru.Images/D88/Constants.cs +++ b/Aaru.Images/D88/Constants.cs @@ -37,6 +37,9 @@ namespace Aaru.DiscImages; [SuppressMessage("ReSharper", "UnusedMember.Local")] public sealed partial class D88 { - const byte READ_ONLY = 0x10; - readonly byte[] _reservedEmpty = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; + const byte READ_ONLY = 0x10; + readonly byte[] _reservedEmpty = + { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + }; } \ No newline at end of file diff --git a/Aaru.Images/D88/Identify.cs b/Aaru.Images/D88/Identify.cs index 5f3366e5e..162d70aef 100644 --- a/Aaru.Images/D88/Identify.cs +++ b/Aaru.Images/D88/Identify.cs @@ -74,9 +74,7 @@ public sealed partial class D88 if(hdr.disk_size != stream.Length) return false; - if(hdr.disk_type != DiskType.D2 && - hdr.disk_type != DiskType.Dd2 && - hdr.disk_type != DiskType.Hd2) + if(hdr.disk_type != DiskType.D2 && hdr.disk_type != DiskType.Dd2 && hdr.disk_type != DiskType.Hd2) return false; if(!hdr.reserved.SequenceEqual(_reservedEmpty)) @@ -89,8 +87,7 @@ public sealed partial class D88 if(t > 0) counter++; - if(t < 0 || - t > stream.Length) + if(t < 0 || t > stream.Length) return false; } diff --git a/Aaru.Images/D88/Read.cs b/Aaru.Images/D88/Read.cs index e2e8603b2..a767e4c80 100644 --- a/Aaru.Images/D88/Read.cs +++ b/Aaru.Images/D88/Read.cs @@ -77,9 +77,7 @@ public sealed partial class D88 if(hdr.disk_size != stream.Length) return ErrorNumber.InvalidArgument; - if(hdr.disk_type != DiskType.D2 && - hdr.disk_type != DiskType.Dd2 && - hdr.disk_type != DiskType.Hd2) + if(hdr.disk_type != DiskType.D2 && hdr.disk_type != DiskType.Dd2 && hdr.disk_type != DiskType.Hd2) return ErrorNumber.InvalidArgument; if(!hdr.reserved.SequenceEqual(_reservedEmpty)) @@ -92,8 +90,7 @@ public sealed partial class D88 if(t > 0) trkCounter++; - if(t < 0 || - t > stream.Length) + if(t < 0 || t > stream.Length) return ErrorNumber.InvalidArgument; } @@ -131,8 +128,7 @@ public sealed partial class D88 sechdr = Marshal.ByteArrayToStructureLittleEndian(hdrB); - if(sechdr.spt != spt || - sechdr.n != bps) + if(sechdr.spt != spt || sechdr.n != bps) { AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Disk_tracks_are_not_same_size, sechdr.spt, spt, sechdr.n, bps, i, 0); @@ -152,8 +148,7 @@ public sealed partial class D88 sechdr = Marshal.ByteArrayToStructureLittleEndian(hdrB); - if(sechdr.spt == spt && - sechdr.n == bps) + if(sechdr.spt == spt && sechdr.n == bps) continue; AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Disk_tracks_are_not_same_size, sechdr.spt, spt, @@ -176,9 +171,7 @@ public sealed partial class D88 if(allEqual) { - if(trkCounter == 154 && - spt == 26 && - bps == IBMSectorSizeCode.EighthKilo) + if(trkCounter == 154 && spt == 26 && bps == IBMSectorSizeCode.EighthKilo) _imageInfo.MediaType = MediaType.NEC_8_SD; else if(bps == IBMSectorSizeCode.QuarterKilo) { @@ -192,9 +185,7 @@ public sealed partial class D88 _ => _imageInfo.MediaType }; } - else if(trkCounter == 154 && - spt == 8 && - bps == IBMSectorSizeCode.Kilo) + else if(trkCounter == 154 && spt == 8 && bps == IBMSectorSizeCode.Kilo) _imageInfo.MediaType = MediaType.NEC_525_HD; else if(bps == IBMSectorSizeCode.HalfKilo) { diff --git a/Aaru.Images/DART/Identify.cs b/Aaru.Images/DART/Identify.cs index 7b712018a..cc9d58433 100644 --- a/Aaru.Images/DART/Identify.cs +++ b/Aaru.Images/DART/Identify.cs @@ -62,8 +62,7 @@ public sealed partial class Dart switch(header.srcType) { case DISK_MAC: - if(header.srcSize != SIZE_MAC_SS && - header.srcSize != SIZE_MAC) + if(header.srcSize != SIZE_MAC_SS && header.srcSize != SIZE_MAC) return false; break; diff --git a/Aaru.Images/DART/Read.cs b/Aaru.Images/DART/Read.cs index a24ff7578..1940d2abe 100644 --- a/Aaru.Images/DART/Read.cs +++ b/Aaru.Images/DART/Read.cs @@ -71,8 +71,7 @@ public sealed partial class Dart switch(header.srcType) { case DISK_MAC: - if(header.srcSize != SIZE_MAC_SS && - header.srcSize != SIZE_MAC) + if(header.srcSize != SIZE_MAC_SS && header.srcSize != SIZE_MAC) return ErrorNumber.InvalidArgument; break; @@ -207,8 +206,7 @@ public sealed partial class Dart _ => null }; - if(dev == null && - version.PreReleaseVersion > 0) + if(dev == null && version.PreReleaseVersion > 0) dev = "f"; if(dev != null) @@ -344,8 +342,7 @@ public sealed partial class Dart if(tag != SectorTagType.AppleSectorTag) return ErrorNumber.NotSupported; - if(_tagCache == null || - _tagCache.Length == 0) + if(_tagCache == null || _tagCache.Length == 0) return ErrorNumber.NoData; if(sectorAddress > _imageInfo.Sectors - 1) diff --git a/Aaru.Images/DiscFerret/Read.cs b/Aaru.Images/DiscFerret/Read.cs index 1659be9c1..1ac4f6940 100644 --- a/Aaru.Images/DiscFerret/Read.cs +++ b/Aaru.Images/DiscFerret/Read.cs @@ -52,8 +52,7 @@ public sealed partial class DiscFerret stream.EnsureRead(magicB, 0, 4); var magic = BitConverter.ToUInt32(magicB, 0); - if(magic != DFI_MAGIC && - magic != DFI_MAGIC2) + if(magic != DFI_MAGIC && magic != DFI_MAGIC2) return ErrorNumber.InvalidArgument; TrackOffsets = new SortedDictionary(); @@ -70,8 +69,7 @@ public sealed partial class DiscFerret stream.EnsureRead(blk, 0, Marshal.SizeOf()); BlockHeader blockHeader = Marshal.ByteArrayToStructureBigEndian(blk); - AaruConsole.DebugWriteLine(MODULE_NAME, "block@{0}.cylinder = {1}", thisOffset, - blockHeader.cylinder); + AaruConsole.DebugWriteLine(MODULE_NAME, "block@{0}.cylinder = {1}", thisOffset, blockHeader.cylinder); AaruConsole.DebugWriteLine(MODULE_NAME, "block@{0}.head = {1}", thisOffset, blockHeader.head); @@ -81,16 +79,14 @@ public sealed partial class DiscFerret if(stream.Position + blockHeader.length > stream.Length) { - AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Invalid_track_block_found_at_0, - thisOffset); + AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Invalid_track_block_found_at_0, thisOffset); break; } stream.Position += blockHeader.length; - if(blockHeader.cylinder > 0 && - blockHeader.cylinder > lastCylinder) + if(blockHeader.cylinder > 0 && blockHeader.cylinder > lastCylinder) { lastCylinder = blockHeader.cylinder; lastHead = 0; @@ -99,8 +95,7 @@ public sealed partial class DiscFerret offset = thisOffset; t++; } - else if(blockHeader.head > 0 && - blockHeader.head > lastHead) + else if(blockHeader.head > 0 && blockHeader.head > lastHead) { lastHead = blockHeader.head; TrackOffsets.Add(t, offset); diff --git a/Aaru.Images/DiscJuggler/Identify.cs b/Aaru.Images/DiscJuggler/Identify.cs index b0401f189..830612885 100644 --- a/Aaru.Images/DiscJuggler/Identify.cs +++ b/Aaru.Images/DiscJuggler/Identify.cs @@ -62,9 +62,7 @@ public sealed partial class DiscJuggler _imageStream.EnsureRead(descriptor, 0, dscLen); // Sessions - if(descriptor.Length < 1 || - descriptor[0] > 99 || - descriptor[0] == 0) + if(descriptor.Length < 1 || descriptor[0] > 99 || descriptor[0] == 0) return false; // Seems all sessions start with this data diff --git a/Aaru.Images/DiscJuggler/Read.cs b/Aaru.Images/DiscJuggler/Read.cs index 101bc0f05..272fb08ba 100644 --- a/Aaru.Images/DiscJuggler/Read.cs +++ b/Aaru.Images/DiscJuggler/Read.cs @@ -69,8 +69,7 @@ public sealed partial class DiscJuggler _imageStream.EnsureRead(descriptor, 0, dscLen); // Sessions - if(descriptor[0] > 99 || - descriptor[0] == 0) + if(descriptor[0] > 99 || descriptor[0] == 0) return ErrorNumber.InvalidArgument; var position = 1; @@ -230,8 +229,7 @@ public sealed partial class DiscJuggler track.Description = Encoding.Default.GetString(textBlk, 0, bLen); - AaruConsole.DebugWriteLine(MODULE_NAME, "\t" + Localization.Track_title_0, - track.Description); + AaruConsole.DebugWriteLine(MODULE_NAME, "\t" + Localization.Track_title_0, track.Description); } } @@ -280,8 +278,7 @@ public sealed partial class DiscJuggler { leftLen -= idx.Value; - if(idx.Key == 0 && - track.Sequence == 1) + if(idx.Key == 0 && track.Sequence == 1) continue; track.Indexes[idx.Key] = (int)track.StartSector + leftLen; @@ -633,8 +630,7 @@ public sealed partial class DiscJuggler Type = track.Type.ToString() }; - if(track.Sequence > 1 && - track.Pregap > 0) + if(track.Sequence > 1 && track.Pregap > 0) { partition.Start += track.Pregap; partition.Length -= track.Pregap; @@ -757,13 +753,9 @@ public sealed partial class DiscJuggler } } - if(!data && - !firstdata) + if(!data && !firstdata) _imageInfo.MediaType = MediaType.CDDA; - else if(firstaudio && - data && - Sessions.Count > 1 && - mode2) + else if(firstaudio && data && Sessions.Count > 1 && mode2) _imageInfo.MediaType = MediaType.CDPLUS; else if(firstdata && audio || mode2) _imageInfo.MediaType = MediaType.CDROMXA; @@ -773,8 +765,7 @@ public sealed partial class DiscJuggler _imageInfo.MediaType = MediaType.CD; } - if(_trackFlags.Count > 0 && - !_imageInfo.ReadableSectorTags.Contains(SectorTagType.CdTrackFlags)) + if(_trackFlags.Count > 0 && !_imageInfo.ReadableSectorTags.Contains(SectorTagType.CdTrackFlags)) _imageInfo.ReadableSectorTags.Add(SectorTagType.CdTrackFlags); _imageInfo.Application = "DiscJuggler"; @@ -976,8 +967,7 @@ public sealed partial class DiscJuggler buffer = mode2Ms.ToArray(); } - else if(sectorOffset == 0 && - sectorSkip == 0) + else if(sectorOffset == 0 && sectorSkip == 0) _imageStream.EnsureRead(buffer, 0, buffer.Length); else { @@ -1029,7 +1019,10 @@ public sealed partial class DiscJuggler if(!_trackFlags.TryGetValue(track, out byte flag)) return ErrorNumber.NoData; - buffer = new[] { flag }; + buffer = new[] + { + flag + }; return ErrorNumber.NoError; default: @@ -1233,8 +1226,7 @@ public sealed partial class DiscJuggler _imageStream.Seek((long)(aaruTrack.FileOffset + sectorAddress * (sectorOffset + sectorSize + sectorSkip)), SeekOrigin.Begin); - if(sectorOffset == 0 && - sectorSkip == 0) + if(sectorOffset == 0 && sectorSkip == 0) _imageStream.EnsureRead(buffer, 0, buffer.Length); else { @@ -1248,8 +1240,7 @@ public sealed partial class DiscJuggler } } - if(aaruTrack.SubchannelType == TrackSubchannelType.Q16Interleaved && - tag == SectorTagType.CdSectorSubchannel) + if(aaruTrack.SubchannelType == TrackSubchannelType.Q16Interleaved && tag == SectorTagType.CdSectorSubchannel) buffer = Subchannel.ConvertQToRaw(buffer); return ErrorNumber.NoError; diff --git a/Aaru.Images/DiskCopy42/Identify.cs b/Aaru.Images/DiskCopy42/Identify.cs index edd6956cc..4f44b2f35 100644 --- a/Aaru.Images/DiskCopy42/Identify.cs +++ b/Aaru.Images/DiskCopy42/Identify.cs @@ -80,8 +80,7 @@ public sealed partial class DiskCopy42 AaruConsole.DebugWriteLine(MODULE_NAME, "tmp_header.valid = {0}", tmpHeader.Valid); AaruConsole.DebugWriteLine(MODULE_NAME, "tmp_header.reserved = {0}", tmpHeader.Reserved); - if(tmpHeader.Valid != 1 || - tmpHeader.Reserved != 0) + if(tmpHeader.Valid != 1 || tmpHeader.Reserved != 0) return false; // Some versions seem to incorrectly create little endian fields diff --git a/Aaru.Images/DiskCopy42/Properties.cs b/Aaru.Images/DiskCopy42/Properties.cs index 657b6c615..c233140bf 100644 --- a/Aaru.Images/DiskCopy42/Properties.cs +++ b/Aaru.Images/DiskCopy42/Properties.cs @@ -68,7 +68,10 @@ public sealed partial class DiskCopy42 public IEnumerable SupportedMediaTags => Array.Empty(); /// - public IEnumerable SupportedSectorTags => new[] { SectorTagType.AppleSectorTag }; + public IEnumerable SupportedSectorTags => new[] + { + SectorTagType.AppleSectorTag + }; /// public IEnumerable SupportedMediaTypes => new[] @@ -84,7 +87,10 @@ public sealed partial class DiskCopy42 }; /// - public IEnumerable KnownExtensions => new[] { ".dc42", ".diskcopy42", ".image" }; + public IEnumerable KnownExtensions => new[] + { + ".dc42", ".diskcopy42", ".image" + }; /// public bool IsWriting { get; private set; } diff --git a/Aaru.Images/DiskCopy42/Read.cs b/Aaru.Images/DiskCopy42/Read.cs index f40b4795b..4c97c957d 100644 --- a/Aaru.Images/DiskCopy42/Read.cs +++ b/Aaru.Images/DiskCopy42/Read.cs @@ -85,13 +85,11 @@ public sealed partial class DiskCopy42 AaruConsole.DebugWriteLine(MODULE_NAME, "header.valid = {0}", header.Valid); AaruConsole.DebugWriteLine(MODULE_NAME, "header.reserved = {0}", header.Reserved); - if(header.Valid != 1 || - header.Reserved != 0) + if(header.Valid != 1 || header.Reserved != 0) return ErrorNumber.InvalidArgument; // Some versions seem to incorrectly create little endian fields - if(header.DataSize + header.TagSize + 0x54 != imageFilter.DataForkLength && - header.Format != kSigmaFormatTwiggy) + if(header.DataSize + header.TagSize + 0x54 != imageFilter.DataForkLength && header.Format != kSigmaFormatTwiggy) { header.DataSize = BitConverter.ToUInt32(buffer, 0x40); header.TagSize = BitConverter.ToUInt32(buffer, 0x44); @@ -151,9 +149,7 @@ public sealed partial class DiskCopy42 bptag = (uint)(header.TagSize / imageInfo.Sectors); AaruConsole.DebugWriteLine(MODULE_NAME, "bptag = {0} bytes", bptag); - if(bptag != 12 && - bptag != 20 && - bptag != 24) + if(bptag != 12 && bptag != 20 && bptag != 24) { AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Unknown_tag_size); @@ -210,8 +206,7 @@ public sealed partial class DiskCopy42 var mfsAllBlocks = BigEndianBitConverter.ToUInt16(data, data.Length / 2 + 0x412); // Detect a Macintosh Twiggy - if(mfsMagic == 0xD2D7 && - mfsAllBlocks == 422) + if(mfsMagic == 0xD2D7 && mfsAllBlocks == 422) { AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Macintosh_Twiggy_detected_reversing_disk_sides); Array.Copy(data, header.DataSize / 2, twiggyCache, 0, header.DataSize / 2); @@ -290,8 +285,7 @@ public sealed partial class DiskCopy42 _ => null }; - if(dev == null && - version.PreReleaseVersion > 0) + if(dev == null && version.PreReleaseVersion > 0) dev = "f"; if(dev != null) diff --git a/Aaru.Images/DiskCopy42/Write.cs b/Aaru.Images/DiskCopy42/Write.cs index 89fdb9b2c..9dc9caba1 100644 --- a/Aaru.Images/DiskCopy42/Write.cs +++ b/Aaru.Images/DiskCopy42/Write.cs @@ -53,8 +53,7 @@ public sealed partial class DiskCopy42 var tags = false; var macosx = false; - if(options != null && - options.TryGetValue("macosx", out string tmpOption)) + if(options != null && options.TryGetValue("macosx", out string tmpOption)) bool.TryParse(tmpOption, out macosx); if(sectorSize != 512) @@ -89,8 +88,7 @@ public sealed partial class DiskCopy42 break; case MediaType.AppleProfile: - if(sectors != 9728 && - sectors != 19456) + if(sectors != 9728 && sectors != 19456) { ErrorMessage = Localization.Incorrect_number_of_sectors_for_Apple_Profile_image; diff --git a/Aaru.Images/DiskDupe/Constants.cs b/Aaru.Images/DiskDupe/Constants.cs index c523ec1b2..ea44b3185 100644 --- a/Aaru.Images/DiskDupe/Constants.cs +++ b/Aaru.Images/DiskDupe/Constants.cs @@ -39,5 +39,8 @@ public sealed partial class DiskDupe const uint TRACKMAP_OFFSET = 100; /// The header identification string - readonly byte[] _headerMagic = { 0x49, 0x4d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; + readonly byte[] _headerMagic = + { + 0x49, 0x4d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + }; } \ No newline at end of file diff --git a/Aaru.Images/DriDiskCopy/Identify.cs b/Aaru.Images/DriDiskCopy/Identify.cs index dfa5bcff2..a1a5820ad 100644 --- a/Aaru.Images/DriDiskCopy/Identify.cs +++ b/Aaru.Images/DriDiskCopy/Identify.cs @@ -86,8 +86,7 @@ public sealed partial class DriDiskCopy AaruConsole.DebugWriteLine(MODULE_NAME, "tmp_footer.bpb.unknown4 = {0}", tmpFooter.bpb.unknown4); AaruConsole.DebugWriteLine(MODULE_NAME, "tmp_footer.bpb.sptrack2 = {0}", tmpFooter.bpb.sptrack2); - AaruConsole.DebugWriteLine(MODULE_NAME, - "ArrayHelpers.ArrayIsNullOrEmpty(tmp_footer.bpb.unknown5) = {0}", + AaruConsole.DebugWriteLine(MODULE_NAME, "ArrayHelpers.ArrayIsNullOrEmpty(tmp_footer.bpb.unknown5) = {0}", ArrayHelpers.ArrayIsNullOrEmpty(tmpFooter.bpb.unknown5)); var regexSignature = new Regex(REGEX_DRI); diff --git a/Aaru.Images/DriDiskCopy/Properties.cs b/Aaru.Images/DriDiskCopy/Properties.cs index f2437002c..9bd8fe3eb 100644 --- a/Aaru.Images/DriDiskCopy/Properties.cs +++ b/Aaru.Images/DriDiskCopy/Properties.cs @@ -77,11 +77,11 @@ public sealed partial class DriDiskCopy { MediaType.ACORN_35_DS_DD, MediaType.ACORN_35_DS_HD, MediaType.Apricot_35, MediaType.ATARI_35_DS_DD, MediaType.ATARI_35_DS_DD_11, MediaType.ATARI_35_SS_DD, MediaType.ATARI_35_SS_DD_11, MediaType.DMF, - MediaType.DMF_82, MediaType.DOS_35_DS_DD_8, MediaType.DOS_35_DS_DD_9, MediaType.DOS_35_ED, - MediaType.DOS_35_HD, MediaType.DOS_35_SS_DD_8, MediaType.DOS_35_SS_DD_9, MediaType.DOS_525_DS_DD_8, - MediaType.DOS_525_DS_DD_9, MediaType.DOS_525_HD, MediaType.DOS_525_SS_DD_8, MediaType.DOS_525_SS_DD_9, - MediaType.FDFORMAT_35_DD, MediaType.FDFORMAT_35_HD, MediaType.FDFORMAT_525_DD, MediaType.FDFORMAT_525_HD, - MediaType.RX50, MediaType.XDF_35, MediaType.XDF_525, MediaType.MetaFloppy_Mod_I, MediaType.MetaFloppy_Mod_II + MediaType.DMF_82, MediaType.DOS_35_DS_DD_8, MediaType.DOS_35_DS_DD_9, MediaType.DOS_35_ED, MediaType.DOS_35_HD, + MediaType.DOS_35_SS_DD_8, MediaType.DOS_35_SS_DD_9, MediaType.DOS_525_DS_DD_8, MediaType.DOS_525_DS_DD_9, + MediaType.DOS_525_HD, MediaType.DOS_525_SS_DD_8, MediaType.DOS_525_SS_DD_9, MediaType.FDFORMAT_35_DD, + MediaType.FDFORMAT_35_HD, MediaType.FDFORMAT_525_DD, MediaType.FDFORMAT_525_HD, MediaType.RX50, + MediaType.XDF_35, MediaType.XDF_525, MediaType.MetaFloppy_Mod_I, MediaType.MetaFloppy_Mod_II }; /// @@ -89,7 +89,10 @@ public sealed partial class DriDiskCopy Array.Empty<(string name, Type type, string description, object @default)>(); /// - public IEnumerable KnownExtensions => new[] { ".dsk" }; + public IEnumerable KnownExtensions => new[] + { + ".dsk" + }; /// public bool IsWriting { get; private set; } diff --git a/Aaru.Images/DriDiskCopy/Read.cs b/Aaru.Images/DriDiskCopy/Read.cs index b047a35bd..8445a9b0a 100644 --- a/Aaru.Images/DriDiskCopy/Read.cs +++ b/Aaru.Images/DriDiskCopy/Read.cs @@ -85,8 +85,8 @@ public sealed partial class DriDiskCopy _imageInfo.CreationTime = imageFilter.CreationTime; _imageInfo.LastModificationTime = imageFilter.LastWriteTime; - AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Image_application_0_version_1, - _imageInfo.Application, _imageInfo.ApplicationVersion); + AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Image_application_0_version_1, _imageInfo.Application, + _imageInfo.ApplicationVersion); // Correct some incorrect data in images of NEC 2HD disks if(_imageInfo is { Cylinders: 77, Heads: 2 } and { SectorsPerTrack: 16, SectorSize: 512 } && diff --git a/Aaru.Images/DriDiskCopy/Write.cs b/Aaru.Images/DriDiskCopy/Write.cs index edf3625f9..c8c6e8310 100644 --- a/Aaru.Images/DriDiskCopy/Write.cs +++ b/Aaru.Images/DriDiskCopy/Write.cs @@ -110,8 +110,7 @@ public sealed partial class DriDiskCopy } }; - Array.Copy("DiskImage 2.01 (C) 1990,1991 Digital Research Inc"u8.ToArray(), 0, _footer.signature, - 0, 49); + Array.Copy("DiskImage 2.01 (C) 1990,1991 Digital Research Inc"u8.ToArray(), 0, _footer.signature, 0, 49); _footer.bpbcopy = _footer.bpb; diff --git a/Aaru.Images/GDI/Identify.cs b/Aaru.Images/GDI/Identify.cs index f61bb7adf..b815dab13 100644 --- a/Aaru.Images/GDI/Identify.cs +++ b/Aaru.Images/GDI/Identify.cs @@ -72,10 +72,7 @@ public sealed partial class Gdi else twoConsecutiveNulls = false; - if(testArray[i] < 0x20 && - testArray[i] != 0x0A && - testArray[i] != 0x0D && - testArray[i] != 0x00) + if(testArray[i] < 0x20 && testArray[i] != 0x0A && testArray[i] != 0x0D && testArray[i] != 0x00) return false; } diff --git a/Aaru.Images/GDI/Read.cs b/Aaru.Images/GDI/Read.cs index a9a48f5c0..b15bc7a78 100644 --- a/Aaru.Images/GDI/Read.cs +++ b/Aaru.Images/GDI/Read.cs @@ -120,8 +120,9 @@ public sealed partial class Gdi Sequence = uint.Parse(trackMatch.Groups["track"].Value), StartSector = ulong.Parse(trackMatch.Groups["start"].Value), TrackFilter = filtersList.GetFilter(Path.Combine(imageFilter.ParentFolder, - trackMatch.Groups["filename"].Value. - Replace("\\\"", "\"").Trim('"'))) + trackMatch.Groups["filename"]. + Value.Replace("\\\"", "\""). + Trim('"'))) }; currentTrack.TrackFile = currentTrack.TrackFilter.Filename; @@ -268,8 +269,8 @@ public sealed partial class Gdi AaruConsole.DebugWriteLine(MODULE_NAME, "\t\t" + Localization.Track_has_pre_emphasis_applied); AaruConsole.DebugWriteLine(MODULE_NAME, - "\t\t" + Localization. - Track_resides_in_file_0_type_defined_as_1_starting_at_byte_2, + "\t\t" + + Localization.Track_resides_in_file_0_type_defined_as_1_starting_at_byte_2, _discImage.Tracks[i].TrackFilter, _discImage.Tracks[i].TrackType, _discImage.Tracks[i].Offset); } @@ -281,8 +282,7 @@ public sealed partial class Gdi for(var i = 0; i < _discImage.Tracks.Count; i++) { - if(_discImage.Tracks[i].Sequence == 1 && - i != 0) + if(_discImage.Tracks[i].Sequence == 1 && i != 0) { AaruConsole.ErrorWriteLine(Localization.Unordered_tracks); @@ -318,7 +318,7 @@ public sealed partial class Gdi _imageInfo.SectorSize = 2352; // All others foreach(GdiTrack unused in - _discImage.Tracks.Where(track => (track.Flags & 0x4) == 0x4 && track.Bps == 2352)) + _discImage.Tracks.Where(track => (track.Flags & 0x4) == 0x4 && track.Bps == 2352)) { _imageInfo.ReadableSectorTags.Add(SectorTagType.CdSectorSync); _imageInfo.ReadableSectorTags.Add(SectorTagType.CdSectorHeader); @@ -383,8 +383,7 @@ public sealed partial class Gdi _offsetMap.TryGetValue(0, out ulong transitionStart); - if(sectorAddress < transitionStart || - sectorAddress >= _densitySeparationSectors + transitionStart) + if(sectorAddress < transitionStart || sectorAddress >= _densitySeparationSectors + transitionStart) return ErrorNumber.SectorNotFound; return ReadSectors(sectorAddress - transitionStart, length, 0, out buffer); @@ -405,8 +404,7 @@ public sealed partial class Gdi _offsetMap.TryGetValue(0, out ulong transitionStart); - if(sectorAddress < transitionStart || - sectorAddress >= _densitySeparationSectors + transitionStart) + if(sectorAddress < transitionStart || sectorAddress >= _densitySeparationSectors + transitionStart) return ErrorNumber.SectorNotFound; return ReadSectorsTag(sectorAddress - transitionStart, length, 0, tag, out buffer); @@ -484,8 +482,7 @@ public sealed partial class Gdi ulong remainingSectors = length; - if(aaruTrack.Pregap > 0 && - sectorAddress < aaruTrack.Pregap) + if(aaruTrack.Pregap > 0 && sectorAddress < aaruTrack.Pregap) { ulong remainingPregap = aaruTrack.Pregap - sectorAddress; @@ -498,8 +495,8 @@ public sealed partial class Gdi _imageStream = aaruTrack.TrackFilter.GetDataForkStream(); var br = new BinaryReader(_imageStream); - long pos = aaruTrack.Offset + (long)(sectorAddress * (sectorOffset + sectorSize + sectorSkip) - - aaruTrack.Pregap * aaruTrack.Bps); + long pos = aaruTrack.Offset + + (long)(sectorAddress * (sectorOffset + sectorSize + sectorSkip) - aaruTrack.Pregap * aaruTrack.Bps); if(pos < 0) pos = 0; @@ -556,7 +553,10 @@ public sealed partial class Gdi if(tag != SectorTagType.CdTrackFlags) return ErrorNumber.NotSupported; - buffer = new byte[] { 0x00 }; + buffer = new byte[] + { + 0x00 + }; return ErrorNumber.NoError; } @@ -676,8 +676,7 @@ public sealed partial class Gdi ulong remainingSectors = length; - if(aaruTrack.Pregap > 0 && - sectorAddress < aaruTrack.Pregap) + if(aaruTrack.Pregap > 0 && sectorAddress < aaruTrack.Pregap) { ulong remainingPregap = aaruTrack.Pregap - sectorAddress; @@ -690,8 +689,8 @@ public sealed partial class Gdi _imageStream = aaruTrack.TrackFilter.GetDataForkStream(); var br = new BinaryReader(_imageStream); - long pos = aaruTrack.Offset + (long)(sectorAddress * (sectorOffset + sectorSize + sectorSkip) - - aaruTrack.Pregap * aaruTrack.Bps); + long pos = aaruTrack.Offset + + (long)(sectorAddress * (sectorOffset + sectorSize + sectorSkip) - aaruTrack.Pregap * aaruTrack.Bps); if(pos < 0) pos = 0; @@ -827,8 +826,7 @@ public sealed partial class Gdi ulong remainingSectors = length; - if(aaruTrack.Pregap > 0 && - sectorAddress < aaruTrack.Pregap) + if(aaruTrack.Pregap > 0 && sectorAddress < aaruTrack.Pregap) { ulong remainingPregap = aaruTrack.Pregap - sectorAddress; @@ -841,8 +839,8 @@ public sealed partial class Gdi _imageStream = aaruTrack.TrackFilter.GetDataForkStream(); var br = new BinaryReader(_imageStream); - long pos = aaruTrack.Offset + (long)(sectorAddress * (sectorOffset + sectorSize + sectorSkip) - - aaruTrack.Pregap * aaruTrack.Bps); + long pos = aaruTrack.Offset + + (long)(sectorAddress * (sectorOffset + sectorSize + sectorSkip) - aaruTrack.Pregap * aaruTrack.Bps); if(pos < 0) pos = 0; diff --git a/Aaru.Images/HDCopy/Helpers.cs b/Aaru.Images/HDCopy/Helpers.cs index b87361b73..a3bcf55a5 100644 --- a/Aaru.Images/HDCopy/Helpers.cs +++ b/Aaru.Images/HDCopy/Helpers.cs @@ -81,8 +81,7 @@ public sealed partial class HdCopy return false; // Validate the trackmap. First two tracks need to be present - if(fheader.trackMap[0] != 1 || - fheader.trackMap[1] != 1) + if(fheader.trackMap[0] != 1 || fheader.trackMap[1] != 1) return false; // all other tracks must be either present (=1) or absent (=0) diff --git a/Aaru.Images/KryoFlux/Identify.cs b/Aaru.Images/KryoFlux/Identify.cs index 031415d44..c1df77e21 100644 --- a/Aaru.Images/KryoFlux/Identify.cs +++ b/Aaru.Images/KryoFlux/Identify.cs @@ -61,8 +61,9 @@ public sealed partial class KryoFlux OobBlock footer = Marshal.ByteArrayToStructureLittleEndian(hdr); - return header is { blockId : BlockIds.Oob, blockType: OobTypes.KFInfo } && footer.blockId == BlockIds.Oob && - footer is { blockType: OobTypes.EOF, length : 0x0D0D }; + return header is { blockId: BlockIds.Oob, blockType: OobTypes.KFInfo } && + footer.blockId == BlockIds.Oob && + footer is { blockType: OobTypes.EOF, length: 0x0D0D }; } #endregion diff --git a/Aaru.Images/KryoFlux/Read.cs b/Aaru.Images/KryoFlux/Read.cs index 950bdd69b..7da128015 100644 --- a/Aaru.Images/KryoFlux/Read.cs +++ b/Aaru.Images/KryoFlux/Read.cs @@ -119,16 +119,14 @@ public sealed partial class KryoFlux if(cylinder == 1) { - AaruConsole.DebugWriteLine(MODULE_NAME, - Localization.Cannot_find_cyl_1_supposing_double_stepping); + AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Cannot_find_cyl_1_supposing_double_stepping); step = 2; continue; } - AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Arrived_end_of_disk_at_cylinder_0, - cylinder); + AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Arrived_end_of_disk_at_cylinder_0, cylinder); break; } @@ -177,7 +175,10 @@ public sealed partial class KryoFlux trackStream.EnsureRead(kfinfo, 0, oobBlk.length); string kfinfoStr = StringHandlers.CToString(kfinfo); - string[] lines = kfinfoStr.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries); + string[] lines = kfinfoStr.Split(new[] + { + ',' + }, StringSplitOptions.RemoveEmptyEntries); DateTime blockDate = DateTime.Now; DateTime blockTime = DateTime.Now; @@ -218,8 +219,7 @@ public sealed partial class KryoFlux var blockTimestamp = new DateTime(blockDate.Year, blockDate.Month, blockDate.Day, blockTime.Hour, blockTime.Minute, blockTime.Second); - AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Found_timestamp_0, - blockTimestamp); + AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Found_timestamp_0, blockTimestamp); if(blockTimestamp < Info.CreationTime) _imageInfo.CreationTime = blockTimestamp; diff --git a/Aaru.Images/MaxiDisk/Identify.cs b/Aaru.Images/MaxiDisk/Identify.cs index 26bb0aeb5..5b400f76d 100644 --- a/Aaru.Images/MaxiDisk/Identify.cs +++ b/Aaru.Images/MaxiDisk/Identify.cs @@ -83,8 +83,11 @@ public sealed partial class MaxiDisk if(tmpHeader.bytesPerSector > 7) return false; - int expectedFileSize = tmpHeader.heads * tmpHeader.cylinders * tmpHeader.sectorsPerTrack * - (128 << tmpHeader.bytesPerSector) + 8; + int expectedFileSize = tmpHeader.heads * + tmpHeader.cylinders * + tmpHeader.sectorsPerTrack * + (128 << tmpHeader.bytesPerSector) + + 8; return expectedFileSize == stream.Length; } diff --git a/Aaru.Images/MaxiDisk/Properties.cs b/Aaru.Images/MaxiDisk/Properties.cs index cf054a7f0..d97c72e75 100644 --- a/Aaru.Images/MaxiDisk/Properties.cs +++ b/Aaru.Images/MaxiDisk/Properties.cs @@ -89,7 +89,10 @@ public sealed partial class MaxiDisk Array.Empty<(string name, Type type, string description, object @default)>(); /// - public IEnumerable KnownExtensions => new[] { ".hdk" }; + public IEnumerable KnownExtensions => new[] + { + ".hdk" + }; /// public bool IsWriting { get; private set; } diff --git a/Aaru.Images/MaxiDisk/Read.cs b/Aaru.Images/MaxiDisk/Read.cs index 07f8de5cc..12d69c4c1 100644 --- a/Aaru.Images/MaxiDisk/Read.cs +++ b/Aaru.Images/MaxiDisk/Read.cs @@ -73,8 +73,11 @@ public sealed partial class MaxiDisk if(tmpHeader.bytesPerSector > 7) return ErrorNumber.InvalidArgument; - int expectedFileSize = tmpHeader.heads * tmpHeader.cylinders * tmpHeader.sectorsPerTrack * - (128 << tmpHeader.bytesPerSector) + 8; + int expectedFileSize = tmpHeader.heads * + tmpHeader.cylinders * + tmpHeader.sectorsPerTrack * + (128 << tmpHeader.bytesPerSector) + + 8; if(expectedFileSize != stream.Length) return ErrorNumber.InvalidArgument; diff --git a/Aaru.Images/MaxiDisk/Write.cs b/Aaru.Images/MaxiDisk/Write.cs index aaa1c94e0..6cb252bb8 100644 --- a/Aaru.Images/MaxiDisk/Write.cs +++ b/Aaru.Images/MaxiDisk/Write.cs @@ -49,8 +49,7 @@ public sealed partial class MaxiDisk public bool Create(string path, MediaType mediaType, Dictionary options, ulong sectors, uint sectorSize) { - if(CountBits.Count(sectorSize) != 1 || - sectorSize > 16384) + if(CountBits.Count(sectorSize) != 1 || sectorSize > 16384) { ErrorMessage = Localization.Unsupported_sector_size; diff --git a/Aaru.Images/NDIF/Identify.cs b/Aaru.Images/NDIF/Identify.cs index 5413248df..8f725ad6d 100644 --- a/Aaru.Images/NDIF/Identify.cs +++ b/Aaru.Images/NDIF/Identify.cs @@ -45,8 +45,7 @@ public sealed partial class Ndif /// public bool Identify(IFilter imageFilter) { - if(!imageFilter.HasResourceFork || - imageFilter.ResourceForkLength == 0) + if(!imageFilter.HasResourceFork || imageFilter.ResourceForkLength == 0) return false; try diff --git a/Aaru.Images/NDIF/Read.cs b/Aaru.Images/NDIF/Read.cs index 718c0bba9..00dba53df 100644 --- a/Aaru.Images/NDIF/Read.cs +++ b/Aaru.Images/NDIF/Read.cs @@ -53,8 +53,7 @@ public sealed partial class Ndif /// public ErrorNumber Open(IFilter imageFilter) { - if(!imageFilter.HasResourceFork || - imageFilter.ResourceForkLength == 0) + if(!imageFilter.HasResourceFork || imageFilter.ResourceForkLength == 0) return ErrorNumber.InvalidArgument; ResourceFork rsrcFork; @@ -72,8 +71,7 @@ public sealed partial class Ndif bcems = rsrc.GetIds(); - if(bcems == null || - bcems.Length == 0) + if(bcems == null || bcems.Length == 0) return ErrorNumber.InvalidArgument; } catch(InvalidCastException ex) @@ -226,8 +224,7 @@ public sealed partial class Ndif _ => null }; - if(dev == null && - version.PreReleaseVersion > 0) + if(dev == null && version.PreReleaseVersion > 0) dev = "f"; if(dev != null) diff --git a/Aaru.Images/NHDr0/Properties.cs b/Aaru.Images/NHDr0/Properties.cs index 1cce49596..7c140fb2c 100644 --- a/Aaru.Images/NHDr0/Properties.cs +++ b/Aaru.Images/NHDr0/Properties.cs @@ -72,7 +72,10 @@ public sealed partial class Nhdr0 public IEnumerable SupportedSectorTags => Array.Empty(); /// - public IEnumerable SupportedMediaTypes => new[] { MediaType.GENERIC_HDD, MediaType.Unknown }; + public IEnumerable SupportedMediaTypes => new[] + { + MediaType.GENERIC_HDD, MediaType.Unknown + }; // TODO: Support dynamic images /// @@ -80,7 +83,10 @@ public sealed partial class Nhdr0 Array.Empty<(string name, Type type, string description, object @default)>(); /// - public IEnumerable KnownExtensions => new[] { ".nhd" }; + public IEnumerable KnownExtensions => new[] + { + ".nhd" + }; /// public bool IsWriting { get; private set; } diff --git a/Aaru.Images/NHDr0/Write.cs b/Aaru.Images/NHDr0/Write.cs index 7dd6aad61..ba1e78b7b 100644 --- a/Aaru.Images/NHDr0/Write.cs +++ b/Aaru.Images/NHDr0/Write.cs @@ -209,8 +209,7 @@ public sealed partial class Nhdr0 _imageInfo.Cylinders = (uint)(_imageInfo.Sectors / _imageInfo.Heads / _imageInfo.SectorsPerTrack); - if(_imageInfo.Cylinders == 0 && - _imageInfo is { Heads: 0, SectorsPerTrack: 0 }) + if(_imageInfo.Cylinders == 0 && _imageInfo is { Heads: 0, SectorsPerTrack: 0 }) break; } } diff --git a/Aaru.Images/Nero/Identify.cs b/Aaru.Images/Nero/Identify.cs index 33d355eac..cd3a0e5f8 100644 --- a/Aaru.Images/Nero/Identify.cs +++ b/Aaru.Images/Nero/Identify.cs @@ -66,8 +66,7 @@ public sealed partial class Nero AaruConsole.DebugWriteLine(MODULE_NAME, "footerV2.ChunkID = 0x{0:X8}", footerV2.ChunkId); AaruConsole.DebugWriteLine(MODULE_NAME, "footerV2.FirstChunkOffset = {0}", footerV2.FirstChunkOffset); - if(footerV2.ChunkId == NERO_FOOTER_V2 && - footerV2.FirstChunkOffset < (ulong)_imageStream.Length) + if(footerV2.ChunkId == NERO_FOOTER_V2 && footerV2.FirstChunkOffset < (ulong)_imageStream.Length) return true; return footerV1.ChunkId == NERO_FOOTER_V1 && footerV1.FirstChunkOffset < (ulong)_imageStream.Length; diff --git a/Aaru.Images/Nero/Read.cs b/Aaru.Images/Nero/Read.cs index 96778b903..0d6a6cfb8 100644 --- a/Aaru.Images/Nero/Read.cs +++ b/Aaru.Images/Nero/Read.cs @@ -84,11 +84,9 @@ public sealed partial class Nero AaruConsole.DebugWriteLine(MODULE_NAME, "footerV2.FirstChunkOffset = {0}", footerV2.FirstChunkOffset); // Check footer version - if(footerV1.ChunkId == NERO_FOOTER_V1 && - footerV1.FirstChunkOffset < (ulong)_imageStream.Length) + if(footerV1.ChunkId == NERO_FOOTER_V1 && footerV1.FirstChunkOffset < (ulong)_imageStream.Length) _imageNewFormat = false; - else if(footerV2.ChunkId == NERO_FOOTER_V2 && - footerV2.FirstChunkOffset < (ulong)_imageStream.Length) + else if(footerV2.ChunkId == NERO_FOOTER_V2 && footerV2.FirstChunkOffset < (ulong)_imageStream.Length) _imageNewFormat = true; else { @@ -165,11 +163,11 @@ public sealed partial class Nero AaruConsole.DebugWriteLine(MODULE_NAME, "\t _entry[{0}].Mode = {1:X2}", i / 8 + 1, entry.Mode); - AaruConsole.DebugWriteLine(MODULE_NAME, "\t _entry[{0}].TrackNumber = {1:X2}", - i / 8 + 1, entry.TrackNumber); + AaruConsole.DebugWriteLine(MODULE_NAME, "\t _entry[{0}].TrackNumber = {1:X2}", i / 8 + 1, + entry.TrackNumber); - AaruConsole.DebugWriteLine(MODULE_NAME, "\t _entry[{0}].IndexNumber = {1:X2}", - i / 8 + 1, entry.IndexNumber); + AaruConsole.DebugWriteLine(MODULE_NAME, "\t _entry[{0}].IndexNumber = {1:X2}", i / 8 + 1, + entry.IndexNumber); AaruConsole.DebugWriteLine(MODULE_NAME, "\t _entry[{0}].Dummy = {1:X4}", i / 8 + 1, entry.Dummy); @@ -223,11 +221,11 @@ public sealed partial class Nero AaruConsole.DebugWriteLine(MODULE_NAME, "\t _entry[{0}].Mode = 0x{1:X2}", i / 8 + 1, entry.Mode); - AaruConsole.DebugWriteLine(MODULE_NAME, "\t _entry[{0}].TrackNumber = {1:X2}", - i / 8 + 1, entry.TrackNumber); + AaruConsole.DebugWriteLine(MODULE_NAME, "\t _entry[{0}].TrackNumber = {1:X2}", i / 8 + 1, + entry.TrackNumber); - AaruConsole.DebugWriteLine(MODULE_NAME, "\t _entry[{0}].IndexNumber = {1:X2}", - i / 8 + 1, entry.IndexNumber); + AaruConsole.DebugWriteLine(MODULE_NAME, "\t _entry[{0}].IndexNumber = {1:X2}", i / 8 + 1, + entry.IndexNumber); AaruConsole.DebugWriteLine(MODULE_NAME, "\t _entry[{0}].Dummy = {1:X2}", i / 8 + 1, entry.Dummy); @@ -322,8 +320,8 @@ public sealed partial class Nero AaruConsole.DebugWriteLine(MODULE_NAME, "\t _entry[{0}].SectorSize = {1}", i / 32 + 1, entry.SectorSize); - AaruConsole.DebugWriteLine(MODULE_NAME, "\t _entry[{0}].Mode = {1} (0x{2:X4})", - i / 32 + 1, (DaoMode)entry.Mode, entry.Mode); + AaruConsole.DebugWriteLine(MODULE_NAME, "\t _entry[{0}].Mode = {1} (0x{2:X4})", i / 32 + 1, + (DaoMode)entry.Mode, entry.Mode); AaruConsole.DebugWriteLine(MODULE_NAME, "\t _entry[{0}].Unknown = 0x{1:X4}", i / 32 + 1, entry.Unknown); @@ -440,8 +438,8 @@ public sealed partial class Nero AaruConsole.DebugWriteLine(MODULE_NAME, "\t _entry[{0}].SectorSize = {1}", i / 32 + 1, entry.SectorSize); - AaruConsole.DebugWriteLine(MODULE_NAME, "\t _entry[{0}].Mode = {1} (0x{2:X4})", - i / 32 + 1, (DaoMode)entry.Mode, entry.Mode); + AaruConsole.DebugWriteLine(MODULE_NAME, "\t _entry[{0}].Mode = {1} (0x{2:X4})", i / 32 + 1, + (DaoMode)entry.Mode, entry.Mode); AaruConsole.DebugWriteLine(MODULE_NAME, "\t _entry[{0}].Unknown = {1:X2}", i / 32 + 1, entry.Unknown); @@ -512,17 +510,17 @@ public sealed partial class Nero AaruConsole.DebugWriteLine(MODULE_NAME, Localization.CD_TEXT_entry_0, i / 18 + 1); - AaruConsole.DebugWriteLine(MODULE_NAME, "\t _entry[{0}].PackType = 0x{1:X2}", - i / 18 + 1, entry.PackType); + AaruConsole.DebugWriteLine(MODULE_NAME, "\t _entry[{0}].PackType = 0x{1:X2}", i / 18 + 1, + entry.PackType); - AaruConsole.DebugWriteLine(MODULE_NAME, "\t _entry[{0}].TrackNumber = 0x{1:X2}", - i / 18 + 1, entry.TrackNumber); + AaruConsole.DebugWriteLine(MODULE_NAME, "\t _entry[{0}].TrackNumber = 0x{1:X2}", i / 18 + 1, + entry.TrackNumber); - AaruConsole.DebugWriteLine(MODULE_NAME, "\t _entry[{0}].PackNumber = 0x{1:X2}", - i / 18 + 1, entry.PackNumber); + AaruConsole.DebugWriteLine(MODULE_NAME, "\t _entry[{0}].PackNumber = 0x{1:X2}", i / 18 + 1, + entry.PackNumber); - AaruConsole.DebugWriteLine(MODULE_NAME, "\t _entry[{0}].BlockNumber = 0x{1:X2}", - i / 18 + 1, entry.BlockNumber); + AaruConsole.DebugWriteLine(MODULE_NAME, "\t _entry[{0}].BlockNumber = 0x{1:X2}", i / 18 + 1, + entry.BlockNumber); AaruConsole.DebugWriteLine(MODULE_NAME, "\t _entry[{0}].Text = \"{1}\"", i / 18 + 1, StringHandlers.CToString(entry.Text)); @@ -569,8 +567,8 @@ public sealed partial class Nero AaruConsole.DebugWriteLine(MODULE_NAME, "\t _entry[{0}].Length = {1} bytes", i / 20 + 1, entry.Length); - AaruConsole.DebugWriteLine(MODULE_NAME, "\t _entry[{0}].Mode = {1} (0x{2:X4})", - i / 20 + 1, (DaoMode)entry.Mode, entry.Mode); + AaruConsole.DebugWriteLine(MODULE_NAME, "\t _entry[{0}].Mode = {1} (0x{2:X4})", i / 20 + 1, + (DaoMode)entry.Mode, entry.Mode); _taoV0.Tracks.Add(entry); @@ -634,8 +632,8 @@ public sealed partial class Nero AaruConsole.DebugWriteLine(MODULE_NAME, "\t _entry[{0}].Length = {1} bytes", i / 20 + 1, entry.Length); - AaruConsole.DebugWriteLine(MODULE_NAME, "\t _entry[{0}].Mode = {1} (0x{2:X4})", - i / 20 + 1, (DaoMode)entry.Mode, entry.Mode); + AaruConsole.DebugWriteLine(MODULE_NAME, "\t _entry[{0}].Mode = {1} (0x{2:X4})", i / 20 + 1, + (DaoMode)entry.Mode, entry.Mode); AaruConsole.DebugWriteLine(MODULE_NAME, "\t _entry[{0}].StartLBA = {1}", i / 20 + 1, entry.StartLba); @@ -705,8 +703,8 @@ public sealed partial class Nero AaruConsole.DebugWriteLine(MODULE_NAME, "\t _entry[{0}].Length = {1} bytes", i / 32 + 1, entry.Length); - AaruConsole.DebugWriteLine(MODULE_NAME, "\t _entry[{0}].Mode = {1} (0x{2:X4})", - i / 32 + 1, (DaoMode)entry.Mode, entry.Mode); + AaruConsole.DebugWriteLine(MODULE_NAME, "\t _entry[{0}].Mode = {1} (0x{2:X4})", i / 32 + 1, + (DaoMode)entry.Mode, entry.Mode); AaruConsole.DebugWriteLine(MODULE_NAME, "\t _entry[{0}].StartLBA = {1}", i / 32 + 1, entry.StartLba); @@ -1014,8 +1012,7 @@ public sealed partial class Nero } // Prevent duplicate index 0 - if(track.Indexes.ContainsKey(0) && - track.Indexes[0] == track.Indexes[1]) + if(track.Indexes.ContainsKey(0) && track.Indexes[0] == track.Indexes[1]) track.Indexes.Remove(0); // There's a pregap @@ -1037,8 +1034,7 @@ public sealed partial class Nero track.StartSector = (ulong)track.Indexes[1]; // Handle hidden tracks - if(neroTrack.Sequence == 1 && - track.StartSector > 0) + if(neroTrack.Sequence == 1 && track.StartSector > 0) { neroTrack.Length += track.StartSector * neroTrack.SectorSize; neroTrack.Offset -= track.StartSector * neroTrack.SectorSize; @@ -1246,7 +1242,8 @@ public sealed partial class Nero if(_neroTracks.Count != 1 || !_neroTracks.ContainsKey(1) || (_imageNewFormat ? footerV2.FirstChunkOffset : footerV1.FirstChunkOffset) % - _neroTracks[1].SectorSize != 0) + _neroTracks[1].SectorSize != + 0) { AaruConsole.ErrorWriteLine(Localization.Image_corrupted_beyond_recovery_cannot_open); @@ -1258,7 +1255,8 @@ public sealed partial class Nero // Common track data Description = StringHandlers.CToString(_neroTracks[1].Isrc), EndSector = (_imageNewFormat ? footerV2.FirstChunkOffset : footerV1.FirstChunkOffset) / - _neroTracks[1].SectorSize - 150, + _neroTracks[1].SectorSize - + 150, Sequence = _neroTracks[1].Sequence, Session = currentSession, Type = NeroTrackModeToTrackType((DaoMode)_neroTracks[1].Mode), @@ -1428,8 +1426,7 @@ public sealed partial class Nero }); } - if(_trackFlags.Count > 0 && - !_imageInfo.ReadableSectorTags.Contains(SectorTagType.CdTrackFlags)) + if(_trackFlags.Count > 0 && !_imageInfo.ReadableSectorTags.Contains(SectorTagType.CdTrackFlags)) _imageInfo.ReadableSectorTags.Add(SectorTagType.CdTrackFlags); _neroFilter = imageFilter; @@ -1445,24 +1442,28 @@ public sealed partial class Nero for(var 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.AudioAlt || - (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.AudioAlt || + (DaoMode)_neroTracks.ElementAt(i).Value.Mode == DaoMode.AudioSub); // First track is data - firstData |= i == 0 && (DaoMode)_neroTracks.ElementAt(i).Value.Mode != DaoMode.Audio && + firstData |= i == 0 && + (DaoMode)_neroTracks.ElementAt(i).Value.Mode != DaoMode.Audio && (DaoMode)_neroTracks.ElementAt(i).Value.Mode != DaoMode.AudioAlt && (DaoMode)_neroTracks.ElementAt(i).Value.Mode != DaoMode.AudioSub; // Any non first track is data - data |= i != 0 && (DaoMode)_neroTracks.ElementAt(i).Value.Mode != DaoMode.Audio && + data |= i != 0 && + (DaoMode)_neroTracks.ElementAt(i).Value.Mode != DaoMode.Audio && (DaoMode)_neroTracks.ElementAt(i).Value.Mode != DaoMode.AudioAlt && (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.AudioAlt || - (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.AudioAlt || + (DaoMode)_neroTracks.ElementAt(i).Value.Mode == DaoMode.AudioSub); switch((DaoMode)_neroTracks.ElementAt(i).Value.Mode) { @@ -1476,13 +1477,9 @@ public sealed partial class Nero } } - if(!data && - !firstData) + if(!data && !firstData) _imageInfo.MediaType = CommonTypes.MediaType.CDDA; - else if(firstAudio && - data && - Sessions.Count > 1 && - mode2) + else if(firstAudio && data && Sessions.Count > 1 && mode2) _imageInfo.MediaType = CommonTypes.MediaType.CDPLUS; else if(firstData && audio || mode2) _imageInfo.MediaType = CommonTypes.MediaType.CDROMXA; @@ -1749,8 +1746,7 @@ public sealed partial class Nero buffer = mode2Ms.ToArray(); } - else if(sectorOffset == 0 && - sectorSkip == 0) + else if(sectorOffset == 0 && sectorSkip == 0) buffer = br.ReadBytes((int)(sectorSize * length)); else { @@ -1800,7 +1796,10 @@ public sealed partial class Nero if(!_trackFlags.TryGetValue(track, out byte flag)) return ErrorNumber.NoData; - buffer = new[] { flag }; + buffer = new[] + { + flag + }; return ErrorNumber.NoError; case SectorTagType.CdTrackIsrc: @@ -2069,8 +2068,7 @@ public sealed partial class Nero br.BaseStream.Seek((long)aaruTrack.Offset + (long)(sectorAddress * (sectorOffset + sectorSize + sectorSkip)), SeekOrigin.Begin); - if(sectorOffset == 0 && - sectorSkip == 0) + if(sectorOffset == 0 && sectorSkip == 0) buffer = br.ReadBytes((int)(sectorSize * length)); else { diff --git a/Aaru.Images/Parallels/Properties.cs b/Aaru.Images/Parallels/Properties.cs index f66388f39..9283a5128 100644 --- a/Aaru.Images/Parallels/Properties.cs +++ b/Aaru.Images/Parallels/Properties.cs @@ -85,7 +85,10 @@ public sealed partial class Parallels Array.Empty<(string name, Type type, string description, object @default)>(); /// - public IEnumerable KnownExtensions => new[] { ".hdd" }; + public IEnumerable KnownExtensions => new[] + { + ".hdd" + }; /// public bool IsWriting { get; private set; } diff --git a/Aaru.Images/Parallels/Write.cs b/Aaru.Images/Parallels/Write.cs index 0884e9ea6..2188fb1fe 100644 --- a/Aaru.Images/Parallels/Write.cs +++ b/Aaru.Images/Parallels/Write.cs @@ -266,8 +266,7 @@ public sealed partial class Parallels _pHdr.cylinders = (uint)(_imageInfo.Sectors / _pHdr.heads / _imageInfo.SectorsPerTrack); - if(_pHdr is { cylinders: 0, heads: 0 } && - _imageInfo.SectorsPerTrack == 0) + if(_pHdr is { cylinders: 0, heads: 0 } && _imageInfo.SectorsPerTrack == 0) break; } } diff --git a/Aaru.Images/PartClone/Read.cs b/Aaru.Images/PartClone/Read.cs index b558dc690..25bd6b0b3 100644 --- a/Aaru.Images/PartClone/Read.cs +++ b/Aaru.Images/PartClone/Read.cs @@ -62,8 +62,7 @@ public sealed partial class PartClone AaruConsole.DebugWriteLine(MODULE_NAME, "pHdr.magic = {0}", StringHandlers.CToString(_pHdr.magic)); - AaruConsole.DebugWriteLine(MODULE_NAME, "pHdr.filesystem = {0}", - StringHandlers.CToString(_pHdr.filesystem)); + AaruConsole.DebugWriteLine(MODULE_NAME, "pHdr.filesystem = {0}", StringHandlers.CToString(_pHdr.filesystem)); AaruConsole.DebugWriteLine(MODULE_NAME, "pHdr.version = {0}", StringHandlers.CToString(_pHdr.version)); diff --git a/Aaru.Images/Partimage/Read.cs b/Aaru.Images/Partimage/Read.cs index b37618918..a2c33aa33 100644 --- a/Aaru.Images/Partimage/Read.cs +++ b/Aaru.Images/Partimage/Read.cs @@ -68,8 +68,7 @@ public sealed partial class Partimage AaruConsole.DebugWriteLine(MODULE_NAME, "CVolumeHeader.volumeNumber = {0}", _cVolumeHeader.volumeNumber); - AaruConsole.DebugWriteLine(MODULE_NAME, "CVolumeHeader.identificator = {0:X16}", - _cVolumeHeader.identificator); + AaruConsole.DebugWriteLine(MODULE_NAME, "CVolumeHeader.identificator = {0:X16}", _cVolumeHeader.identificator); // TODO: Support multifile volumes if(_cVolumeHeader.volumeNumber > 0) @@ -110,28 +109,23 @@ public sealed partial class Partimage AaruConsole.DebugWriteLine(MODULE_NAME, "CMainHeader.szUnameMachine = {0}", StringHandlers.CToString(_cMainHeader.szUnameMachine)); - AaruConsole.DebugWriteLine(MODULE_NAME, "CMainHeader.dwCompression = {0} ({1})", - _cMainHeader.dwCompression, (uint)_cMainHeader.dwCompression); + AaruConsole.DebugWriteLine(MODULE_NAME, "CMainHeader.dwCompression = {0} ({1})", _cMainHeader.dwCompression, + (uint)_cMainHeader.dwCompression); AaruConsole.DebugWriteLine(MODULE_NAME, "CMainHeader.dwMainFlags = {0}", _cMainHeader.dwMainFlags); - AaruConsole.DebugWriteLine(MODULE_NAME, "CMainHeader.dateCreate.tm_sec = {0}", - _cMainHeader.dateCreate.Second); + AaruConsole.DebugWriteLine(MODULE_NAME, "CMainHeader.dateCreate.tm_sec = {0}", _cMainHeader.dateCreate.Second); - AaruConsole.DebugWriteLine(MODULE_NAME, "CMainHeader.dateCreate.tm_min = {0}", - _cMainHeader.dateCreate.Minute); + AaruConsole.DebugWriteLine(MODULE_NAME, "CMainHeader.dateCreate.tm_min = {0}", _cMainHeader.dateCreate.Minute); - AaruConsole.DebugWriteLine(MODULE_NAME, "CMainHeader.dateCreate.tm_hour = {0}", - _cMainHeader.dateCreate.Hour); + AaruConsole.DebugWriteLine(MODULE_NAME, "CMainHeader.dateCreate.tm_hour = {0}", _cMainHeader.dateCreate.Hour); AaruConsole.DebugWriteLine(MODULE_NAME, "CMainHeader.dateCreate.tm_mday = {0}", _cMainHeader.dateCreate.DayOfMonth); - AaruConsole.DebugWriteLine(MODULE_NAME, "CMainHeader.dateCreate.tm_mon = {0}", - _cMainHeader.dateCreate.Month); + AaruConsole.DebugWriteLine(MODULE_NAME, "CMainHeader.dateCreate.tm_mon = {0}", _cMainHeader.dateCreate.Month); - AaruConsole.DebugWriteLine(MODULE_NAME, "CMainHeader.dateCreate.tm_year = {0}", - _cMainHeader.dateCreate.Year); + AaruConsole.DebugWriteLine(MODULE_NAME, "CMainHeader.dateCreate.tm_year = {0}", _cMainHeader.dateCreate.Year); AaruConsole.DebugWriteLine(MODULE_NAME, "CMainHeader.dateCreate.tm_wday = {0}", _cMainHeader.dateCreate.DayOfWeek); @@ -139,8 +133,7 @@ public sealed partial class Partimage AaruConsole.DebugWriteLine(MODULE_NAME, "CMainHeader.dateCreate.tm_yday = {0}", _cMainHeader.dateCreate.DayOfYear); - AaruConsole.DebugWriteLine(MODULE_NAME, "CMainHeader.dateCreate.tm_isdst = {0}", - _cMainHeader.dateCreate.IsDst); + AaruConsole.DebugWriteLine(MODULE_NAME, "CMainHeader.dateCreate.tm_isdst = {0}", _cMainHeader.dateCreate.IsDst); AaruConsole.DebugWriteLine(MODULE_NAME, "CMainHeader.dateCreate.tm_gmtoffsec = {0}", _cMainHeader.dateCreate.GmtOff); @@ -165,8 +158,8 @@ public sealed partial class Partimage AaruConsole.DebugWriteLine(MODULE_NAME, "CMainHeader.dwMbrCount = {0}", _cMainHeader.dwMbrCount); AaruConsole.DebugWriteLine(MODULE_NAME, "CMainHeader.dwMbrSize = {0}", _cMainHeader.dwMbrSize); - AaruConsole.DebugWriteLine(MODULE_NAME, "CMainHeader.dwEncryptAlgo = {0} ({1})", - _cMainHeader.dwEncryptAlgo, (uint)_cMainHeader.dwEncryptAlgo); + AaruConsole.DebugWriteLine(MODULE_NAME, "CMainHeader.dwEncryptAlgo = {0} ({1})", _cMainHeader.dwEncryptAlgo, + (uint)_cMainHeader.dwEncryptAlgo); AaruConsole.DebugWriteLine(MODULE_NAME, "ArrayIsNullOrEmpty(CMainHeader.cHashTestKey) = {0}", ArrayHelpers.ArrayIsNullOrEmpty(_cMainHeader.cHashTestKey)); @@ -258,8 +251,7 @@ public sealed partial class Partimage AaruConsole.DebugWriteLine(MODULE_NAME, "CLocalHeader.qwBitmapSize = {0}", localHeader.qwBitmapSize); - AaruConsole.DebugWriteLine(MODULE_NAME, "CLocalHeader.qwBadBlocksCount = {0}", - localHeader.qwBadBlocksCount); + AaruConsole.DebugWriteLine(MODULE_NAME, "CLocalHeader.qwBadBlocksCount = {0}", localHeader.qwBadBlocksCount); AaruConsole.DebugWriteLine(MODULE_NAME, "CLocalHeader.szLabel = {0}", StringHandlers.CToString(localHeader.szLabel)); diff --git a/Aaru.Images/QCOW/Properties.cs b/Aaru.Images/QCOW/Properties.cs index a0a2b30d8..9ea02a939 100644 --- a/Aaru.Images/QCOW/Properties.cs +++ b/Aaru.Images/QCOW/Properties.cs @@ -84,7 +84,10 @@ public sealed partial class Qcow Array.Empty<(string name, Type type, string description, object @default)>(); /// - public IEnumerable KnownExtensions => new[] { ".qcow", ".qc" }; + public IEnumerable KnownExtensions => new[] + { + ".qcow", ".qc" + }; /// public bool IsWriting { get; private set; } diff --git a/Aaru.Images/QCOW2/Properties.cs b/Aaru.Images/QCOW2/Properties.cs index 557fdf3af..62849327f 100644 --- a/Aaru.Images/QCOW2/Properties.cs +++ b/Aaru.Images/QCOW2/Properties.cs @@ -84,7 +84,10 @@ public sealed partial class Qcow2 Array.Empty<(string name, Type type, string description, object @default)>(); /// - public IEnumerable KnownExtensions => new[] { ".qcow2", ".qc2", ".qcow3", ".qc3" }; + public IEnumerable KnownExtensions => new[] + { + ".qcow2", ".qc2", ".qcow3", ".qc3" + }; /// public bool IsWriting { get; private set; } diff --git a/Aaru.Images/QCOW2/Write.cs b/Aaru.Images/QCOW2/Write.cs index c7c5b1640..c1bf3003a 100644 --- a/Aaru.Images/QCOW2/Write.cs +++ b/Aaru.Images/QCOW2/Write.cs @@ -272,7 +272,10 @@ public sealed partial class Qcow2 _writingStream.Seek((long)(refBlockOffset + refCountBlockIndex), SeekOrigin.Begin); - _writingStream.Write(new byte[] { 0, 1 }, 0, 2); + _writingStream.Write(new byte[] + { + 0, 1 + }, 0, 2); ErrorMessage = ""; diff --git a/Aaru.Images/QED/Helpers.cs b/Aaru.Images/QED/Helpers.cs index c6995539d..256412e3d 100644 --- a/Aaru.Images/QED/Helpers.cs +++ b/Aaru.Images/QED/Helpers.cs @@ -36,8 +36,7 @@ public sealed partial class Qed { static bool IsPowerOfTwo(uint x) { - while((x & 1) == 0 && - x > 1) + while((x & 1) == 0 && x > 1) x >>= 1; return x == 1; diff --git a/Aaru.Images/QED/Properties.cs b/Aaru.Images/QED/Properties.cs index 352922c4a..6d2679852 100644 --- a/Aaru.Images/QED/Properties.cs +++ b/Aaru.Images/QED/Properties.cs @@ -85,7 +85,10 @@ public sealed partial class Qed Array.Empty<(string name, Type type, string description, object @default)>(); /// - public IEnumerable KnownExtensions => new[] { ".qed" }; + public IEnumerable KnownExtensions => new[] + { + ".qed" + }; /// public bool IsWriting { get; private set; } diff --git a/Aaru.Images/QED/Read.cs b/Aaru.Images/QED/Read.cs index 7605f8f6c..9fae4afc7 100644 --- a/Aaru.Images/QED/Read.cs +++ b/Aaru.Images/QED/Read.cs @@ -240,8 +240,7 @@ public sealed partial class Qed buffer = new byte[512]; - if(offset != 0 && - offset != 1) + if(offset != 0 && offset != 1) { if(!_clusterCache.TryGetValue(offset, out byte[] cluster)) { diff --git a/Aaru.Images/RayDIM/Identify.cs b/Aaru.Images/RayDIM/Identify.cs index 0b648e63a..d29801deb 100644 --- a/Aaru.Images/RayDIM/Identify.cs +++ b/Aaru.Images/RayDIM/Identify.cs @@ -64,8 +64,7 @@ public sealed partial class RayDim AaruConsole.DebugWriteLine(MODULE_NAME, "header.cylinders = {0}", header.cylinders); - AaruConsole.DebugWriteLine(MODULE_NAME, "header.sectorsPerTrack = {0}", - header.sectorsPerTrack); + AaruConsole.DebugWriteLine(MODULE_NAME, "header.sectorsPerTrack = {0}", header.sectorsPerTrack); var sx = new Regex(REGEX_SIGNATURE); Match sm = sx.Match(signature); diff --git a/Aaru.Images/RayDIM/Properties.cs b/Aaru.Images/RayDIM/Properties.cs index 89bdf06e4..5b441e420 100644 --- a/Aaru.Images/RayDIM/Properties.cs +++ b/Aaru.Images/RayDIM/Properties.cs @@ -89,7 +89,10 @@ public sealed partial class RayDim Array.Empty<(string name, Type type, string description, object @default)>(); /// - public IEnumerable KnownExtensions => new[] { ".dim" }; + public IEnumerable KnownExtensions => new[] + { + ".dim" + }; /// public bool IsWriting { get; private set; } diff --git a/Aaru.Images/RsIde/Constants.cs b/Aaru.Images/RsIde/Constants.cs index 8a949fe3e..1b7e3a5e5 100644 --- a/Aaru.Images/RsIde/Constants.cs +++ b/Aaru.Images/RsIde/Constants.cs @@ -34,5 +34,8 @@ namespace Aaru.DiscImages; public sealed partial class RsIde { - readonly byte[] _signature = { 0x52, 0x53, 0x2D, 0x49, 0x44, 0x45, 0x1A }; + readonly byte[] _signature = + { + 0x52, 0x53, 0x2D, 0x49, 0x44, 0x45, 0x1A + }; } \ No newline at end of file diff --git a/Aaru.Images/RsIde/Properties.cs b/Aaru.Images/RsIde/Properties.cs index cc6249f5d..90d05a942 100644 --- a/Aaru.Images/RsIde/Properties.cs +++ b/Aaru.Images/RsIde/Properties.cs @@ -66,7 +66,10 @@ public sealed partial class RsIde public Metadata AaruMetadata => null; /// - public IEnumerable SupportedMediaTags => new[] { MediaTagType.ATA_IDENTIFY }; + public IEnumerable SupportedMediaTags => new[] + { + MediaTagType.ATA_IDENTIFY + }; /// public IEnumerable SupportedSectorTags => Array.Empty(); @@ -84,7 +87,10 @@ public sealed partial class RsIde Array.Empty<(string name, Type type, string description, object @default)>(); /// - public IEnumerable KnownExtensions => new[] { ".ide" }; + public IEnumerable KnownExtensions => new[] + { + ".ide" + }; /// public bool IsWriting { get; private set; } diff --git a/Aaru.Images/RsIde/Read.cs b/Aaru.Images/RsIde/Read.cs index 9219f55b6..555f1fff3 100644 --- a/Aaru.Images/RsIde/Read.cs +++ b/Aaru.Images/RsIde/Read.cs @@ -91,9 +91,7 @@ public sealed partial class RsIde } } - if(_imageInfo.Cylinders == 0 || - _imageInfo.Heads == 0 || - _imageInfo.SectorsPerTrack == 0) + if(_imageInfo.Cylinders == 0 || _imageInfo.Heads == 0 || _imageInfo.SectorsPerTrack == 0) { _imageInfo.Cylinders = (uint)(_imageInfo.Sectors / 16 / 63); _imageInfo.Heads = 16; @@ -135,8 +133,7 @@ public sealed partial class RsIde { buffer = null; - if(!_imageInfo.ReadableMediaTags.Contains(tag) || - tag != MediaTagType.ATA_IDENTIFY) + if(!_imageInfo.ReadableMediaTags.Contains(tag) || tag != MediaTagType.ATA_IDENTIFY) return ErrorNumber.NotSupported; buffer = _identify?.Clone() as byte[]; diff --git a/Aaru.Images/RsIde/Write.cs b/Aaru.Images/RsIde/Write.cs index c01a28ba4..552d35fca 100644 --- a/Aaru.Images/RsIde/Write.cs +++ b/Aaru.Images/RsIde/Write.cs @@ -52,8 +52,7 @@ public sealed partial class RsIde public bool Create(string path, MediaType mediaType, Dictionary options, ulong sectors, uint sectorSize) { - if(sectorSize != 256 && - sectorSize != 512) + if(sectorSize != 256 && sectorSize != 512) { ErrorMessage = Localization.Unsupported_sector_size; @@ -233,8 +232,7 @@ public sealed partial class RsIde _imageInfo.Cylinders = (uint)(_imageInfo.Sectors / _imageInfo.Heads / _imageInfo.SectorsPerTrack); - if(_imageInfo.Cylinders == 0 && - _imageInfo is { Heads: 0, SectorsPerTrack: 0 }) + if(_imageInfo.Cylinders == 0 && _imageInfo is { Heads: 0, SectorsPerTrack: 0 }) break; } } diff --git a/Aaru.Images/SaveDskF/Identify.cs b/Aaru.Images/SaveDskF/Identify.cs index cebe33a38..c2c5a5715 100644 --- a/Aaru.Images/SaveDskF/Identify.cs +++ b/Aaru.Images/SaveDskF/Identify.cs @@ -55,8 +55,9 @@ public sealed partial class SaveDskF _header = Marshal.ByteArrayToStructureLittleEndian
(hdr); return _header.magic is SDF_MAGIC or SDF_MAGIC_COMPRESSED or SDF_MAGIC_OLD && - _header is { fatCopies: <= 2, padding: 0 } && _header.commentOffset < stream.Length && - _header.dataOffset < stream.Length; + _header is { fatCopies: <= 2, padding: 0 } && + _header.commentOffset < stream.Length && + _header.dataOffset < stream.Length; } #endregion diff --git a/Aaru.Images/SaveDskF/Properties.cs b/Aaru.Images/SaveDskF/Properties.cs index 8d760e3be..2c2ae1605 100644 --- a/Aaru.Images/SaveDskF/Properties.cs +++ b/Aaru.Images/SaveDskF/Properties.cs @@ -77,11 +77,11 @@ public sealed partial class SaveDskF { MediaType.ACORN_35_DS_DD, MediaType.ACORN_35_DS_HD, MediaType.Apricot_35, MediaType.ATARI_35_DS_DD, MediaType.ATARI_35_DS_DD_11, MediaType.ATARI_35_SS_DD, MediaType.ATARI_35_SS_DD_11, MediaType.DMF, - MediaType.DMF_82, MediaType.DOS_35_DS_DD_8, MediaType.DOS_35_DS_DD_9, MediaType.DOS_35_ED, - MediaType.DOS_35_HD, MediaType.DOS_35_SS_DD_8, MediaType.DOS_35_SS_DD_9, MediaType.DOS_525_DS_DD_8, - MediaType.DOS_525_DS_DD_9, MediaType.DOS_525_HD, MediaType.DOS_525_SS_DD_8, MediaType.DOS_525_SS_DD_9, - MediaType.FDFORMAT_35_DD, MediaType.FDFORMAT_35_HD, MediaType.FDFORMAT_525_DD, MediaType.FDFORMAT_525_HD, - MediaType.RX50, MediaType.XDF_35, MediaType.XDF_525, MediaType.MetaFloppy_Mod_I, MediaType.MetaFloppy_Mod_II + MediaType.DMF_82, MediaType.DOS_35_DS_DD_8, MediaType.DOS_35_DS_DD_9, MediaType.DOS_35_ED, MediaType.DOS_35_HD, + MediaType.DOS_35_SS_DD_8, MediaType.DOS_35_SS_DD_9, MediaType.DOS_525_DS_DD_8, MediaType.DOS_525_DS_DD_9, + MediaType.DOS_525_HD, MediaType.DOS_525_SS_DD_8, MediaType.DOS_525_SS_DD_9, MediaType.FDFORMAT_35_DD, + MediaType.FDFORMAT_35_HD, MediaType.FDFORMAT_525_DD, MediaType.FDFORMAT_525_HD, MediaType.RX50, + MediaType.XDF_35, MediaType.XDF_525, MediaType.MetaFloppy_Mod_I, MediaType.MetaFloppy_Mod_II }; /// @@ -89,7 +89,10 @@ public sealed partial class SaveDskF Array.Empty<(string name, Type type, string description, object @default)>(); /// - public IEnumerable KnownExtensions => new[] { ".dsk" }; + public IEnumerable KnownExtensions => new[] + { + ".dsk" + }; /// public bool IsWriting { get; private set; } diff --git a/Aaru.Images/SuperCardPro/Helpers.cs b/Aaru.Images/SuperCardPro/Helpers.cs index 0d42fed4d..87ad22fc2 100644 --- a/Aaru.Images/SuperCardPro/Helpers.cs +++ b/Aaru.Images/SuperCardPro/Helpers.cs @@ -50,8 +50,7 @@ public sealed partial class SuperCardPro stream.EnsureRead(lenB, 0, 2); var len = BitConverter.ToUInt16(lenB, 0); - if(len == 0 || - len + stream.Position >= stream.Length) + if(len == 0 || len + stream.Position >= stream.Length) return null; var str = new byte[len]; @@ -77,9 +76,10 @@ public sealed partial class SuperCardPro uint over = ticks / 255; if(over == 0) - { - return new[] { (byte)ticks }; - } + return new[] + { + (byte)ticks + }; var expanded = new byte[over + 1]; diff --git a/Aaru.Images/SuperCardPro/Properties.cs b/Aaru.Images/SuperCardPro/Properties.cs index 35b097021..933ee8492 100644 --- a/Aaru.Images/SuperCardPro/Properties.cs +++ b/Aaru.Images/SuperCardPro/Properties.cs @@ -100,7 +100,10 @@ public sealed partial class SuperCardPro Array.Empty<(string name, Type type, string description, object @default)>(); /// - public IEnumerable KnownExtensions => new[] { ".scp" }; + public IEnumerable KnownExtensions => new[] + { + ".scp" + }; /// public bool IsWriting { get; private set; } diff --git a/Aaru.Images/SuperCardPro/Read.cs b/Aaru.Images/SuperCardPro/Read.cs index 798323612..7d53789e8 100644 --- a/Aaru.Images/SuperCardPro/Read.cs +++ b/Aaru.Images/SuperCardPro/Read.cs @@ -87,17 +87,13 @@ public sealed partial class SuperCardPro AaruConsole.DebugWriteLine(MODULE_NAME, "header.flags.Rpm = {0}", Header.flags == ScpFlags.Rpm ? "360rpm" : "300rpm"); - AaruConsole.DebugWriteLine(MODULE_NAME, "header.flags.Normalized = {0}", - Header.flags == ScpFlags.Normalized); + AaruConsole.DebugWriteLine(MODULE_NAME, "header.flags.Normalized = {0}", Header.flags == ScpFlags.Normalized); - AaruConsole.DebugWriteLine(MODULE_NAME, "header.flags.Writable = {0}", - Header.flags == ScpFlags.Writable); + AaruConsole.DebugWriteLine(MODULE_NAME, "header.flags.Writable = {0}", Header.flags == ScpFlags.Writable); - AaruConsole.DebugWriteLine(MODULE_NAME, "header.flags.HasFooter = {0}", - Header.flags == ScpFlags.HasFooter); + AaruConsole.DebugWriteLine(MODULE_NAME, "header.flags.HasFooter = {0}", Header.flags == ScpFlags.HasFooter); - AaruConsole.DebugWriteLine(MODULE_NAME, "header.flags.NotFloppy = {0}", - Header.flags == ScpFlags.NotFloppy); + AaruConsole.DebugWriteLine(MODULE_NAME, "header.flags.NotFloppy = {0}", Header.flags == ScpFlags.NotFloppy); AaruConsole.DebugWriteLine(MODULE_NAME, "header.flags.CreatedByOtherDevice = {0}", Header.flags == ScpFlags.CreatedByOtherDevice); @@ -125,8 +121,7 @@ public sealed partial class SuperCardPro if(!trk.Signature.SequenceEqual(_trkSignature)) { - AaruConsole.DebugWriteLine(MODULE_NAME, - Localization.Track_header_at_0_contains_incorrect_signature, + AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Track_header_at_0_contains_incorrect_signature, Header.offsets[t]); continue; @@ -333,8 +328,7 @@ public sealed partial class SuperCardPro { _scpStream.Seek(-Marshal.SizeOf