From 02ec8a05d8c29f61bdef7ac11515d1cd720ef494 Mon Sep 17 00:00:00 2001 From: Natalia Portillo Date: Sun, 17 Aug 2025 05:50:25 +0100 Subject: [PATCH] Rename Aaru.Console project to Aaru.Logging. --- Aaru.Archives/Aaru.Archives.csproj | 2 +- Aaru.Archives/Symbian/Info.cs | 24 +- Aaru.Archives/Symbian/Open.cs | 8 +- Aaru.Archives/Symbian/Parser.cs | 18 +- Aaru.Checksums/Aaru.Checksums.csproj | 2 +- Aaru.Checksums/CDChecksums.cs | 102 +-- Aaru.Checksums/ReedSolomon.cs | 75 +- Aaru.CommonTypes/Aaru.CommonTypes.csproj | 2 +- .../MediaTypeFromDevice/FromAta.cs | 2 +- .../MediaTypeFromDevice/FromMmc.cs | 2 +- .../MediaTypeFromDevice/FromOdc.cs | 2 +- .../MediaTypeFromDevice/FromSbc.cs | 2 +- .../MediaTypeFromDevice/FromScsi.cs | 2 +- .../MediaTypeFromDevice/FromSsc.cs | 2 +- .../Structs/Devices/ATA/Identify.cs | 18 +- .../Structs/Devices/SCSI/Inquiry.cs | 12 +- Aaru.Core/Aaru.Core.csproj | 2 +- Aaru.Core/ArchiveFormat.cs | 2 +- Aaru.Core/ArchiveInfo.cs | 2 +- Aaru.Core/DataFile.cs | 2 +- Aaru.Core/Devices/Dumping/CompactDisc/Data.cs | 60 +- Aaru.Core/Devices/Dumping/CompactDisc/Dump.cs | 190 +++-- .../Devices/Dumping/CompactDisc/Error.cs | 39 +- .../Devices/Dumping/CompactDisc/Pregap.cs | 40 +- Aaru.Core/Devices/Dumping/MiniDisc.cs | 12 +- .../PlayStationPortable/MemoryStick.cs | 12 +- .../Dumping/PlayStationPortable/UMD.cs | 22 +- Aaru.Core/Devices/Dumping/Sbc/Dump.cs | 15 +- Aaru.Core/Devices/Dumping/Sbc/Error.cs | 17 +- Aaru.Core/Devices/Dumping/Sbc/Optical.cs | 9 +- Aaru.Core/Devices/Dumping/XGD.cs | 21 +- Aaru.Core/Devices/Info/DeviceInfo.cs | 6 +- Aaru.Core/Devices/ReaderATA.cs | 10 +- Aaru.Core/Devices/ReaderSCSI.cs | 12 +- Aaru.Core/Devices/Report/ATA.cs | 10 +- Aaru.Core/Devices/Report/GdRomSwapTrick.cs | 64 +- Aaru.Core/Devices/Report/MMC.cs | 34 +- Aaru.Core/Devices/Report/Scsi.cs | 26 +- Aaru.Core/Devices/Report/SecureDigital.cs | 4 +- Aaru.Core/Devices/Scanning/SCSI.cs | 18 +- Aaru.Core/Entropy.cs | 12 +- Aaru.Core/Filesystems.cs | 2 +- Aaru.Core/ImageFormat.cs | 2 +- Aaru.Core/ImageInfo.cs | 10 +- Aaru.Core/Media/Detection/MMC.cs | 168 ++--- Aaru.Core/Media/Info/ScsiInfo.cs | 16 +- Aaru.Core/Partitions.cs | 2 +- Aaru.Core/PrintScsiModePages.cs | 2 +- Aaru.Core/Remote.cs | 2 +- Aaru.Core/Sidecar/BlockMedia.cs | 10 +- Aaru.Core/Sidecar/Files.cs | 2 +- Aaru.Core/Sidecar/Sidecar.cs | 2 +- Aaru.Core/Statistics.cs | 6 +- Aaru.Decoders/Aaru.Decoders.csproj | 2 +- Aaru.Decoders/Bluray/BCA.cs | 2 +- Aaru.Decoders/Bluray/Cartridge.cs | 2 +- Aaru.Decoders/Bluray/DDS.cs | 2 +- Aaru.Decoders/Bluray/DI.cs | 6 +- Aaru.Decoders/Bluray/Spare.cs | 2 +- Aaru.Decoders/CD/ATIP.cs | 2 +- Aaru.Decoders/CD/CDTextOnLeadIn.cs | 4 +- Aaru.Decoders/CD/FullTOC.cs | 8 +- Aaru.Decoders/CD/PMA.cs | 6 +- Aaru.Decoders/CD/Session.cs | 4 +- Aaru.Decoders/CD/TOC.cs | 4 +- Aaru.Decoders/Floppy/Apple2.cs | 38 +- Aaru.Decoders/Sega/CD.cs | 2 +- Aaru.Decoders/Sega/Dreamcast.cs | 4 +- Aaru.Decoders/Sega/Saturn.cs | 2 +- Aaru.Decryption/DVD/Dump.cs | 30 +- Aaru.Devices/Aaru.Devices.csproj | 2 +- Aaru.Devices/Device/AtaCommands/Ata28.cs | 2 +- Aaru.Devices/Device/AtaCommands/Ata48.cs | 2 +- Aaru.Devices/Device/AtaCommands/AtaCHS.cs | 2 +- Aaru.Devices/Device/AtaCommands/Atapi.cs | 2 +- Aaru.Devices/Device/AtaCommands/Cfa.cs | 2 +- Aaru.Devices/Device/AtaCommands/MCPT.cs | 2 +- Aaru.Devices/Device/AtaCommands/Smart.cs | 2 +- Aaru.Devices/Device/List.cs | 2 +- Aaru.Devices/Device/MmcCommands/MMC.cs | 8 +- .../Device/MmcCommands/SecureDigital.cs | 2 +- Aaru.Devices/Device/ScsiCommands/Adaptec.cs | 16 +- .../Device/ScsiCommands/ArchiveCorp.cs | 6 +- Aaru.Devices/Device/ScsiCommands/Certance.cs | 4 +- Aaru.Devices/Device/ScsiCommands/Fujitsu.cs | 14 +- Aaru.Devices/Device/ScsiCommands/HL-DT-ST.cs | 10 +- Aaru.Devices/Device/ScsiCommands/HP.cs | 4 +- Aaru.Devices/Device/ScsiCommands/Kreon.cs | 16 +- Aaru.Devices/Device/ScsiCommands/LiteOn.cs | 20 +- Aaru.Devices/Device/ScsiCommands/MMC.cs | 38 +- Aaru.Devices/Device/ScsiCommands/MediaTek.cs | 4 +- Aaru.Devices/Device/ScsiCommands/MiniDisc.cs | 14 +- Aaru.Devices/Device/ScsiCommands/NEC.cs | 4 +- Aaru.Devices/Device/ScsiCommands/Optical.cs | 4 +- Aaru.Devices/Device/ScsiCommands/Pioneer.cs | 10 +- Aaru.Devices/Device/ScsiCommands/Plasmon.cs | 4 +- Aaru.Devices/Device/ScsiCommands/Plextor.cs | 36 +- Aaru.Devices/Device/ScsiCommands/SBC.cs | 18 +- Aaru.Devices/Device/ScsiCommands/SMC.cs | 6 +- Aaru.Devices/Device/ScsiCommands/SPC.cs | 30 +- Aaru.Devices/Device/ScsiCommands/SSC.cs | 32 +- Aaru.Devices/Device/ScsiCommands/SyQuest.cs | 10 +- Aaru.Devices/Remote/Remote.cs | 54 +- Aaru.Filesystems/Aaru.Filesystems.csproj | 2 +- Aaru.Filesystems/Acorn/Info.cs | 28 +- Aaru.Filesystems/AmigaDOS/Info.cs | 8 +- Aaru.Filesystems/AppleDOS/Super.cs | 2 +- Aaru.Filesystems/AppleMFS/Dir.cs | 4 +- Aaru.Filesystems/AppleMFS/File.cs | 2 +- Aaru.Filesystems/BTRFS/Info.cs | 2 +- Aaru.Filesystems/CBM/Super.cs | 13 +- Aaru.Filesystems/CPM/Info.cs | 81 ++- Aaru.Filesystems/CPM/Super.cs | 63 +- Aaru.Filesystems/EFS/Info.cs | 14 +- Aaru.Filesystems/FAT/BPB.cs | 26 +- Aaru.Filesystems/FAT/Dir.cs | 16 +- Aaru.Filesystems/FAT/Info.cs | 72 +- Aaru.Filesystems/FAT/Super.cs | 48 +- Aaru.Filesystems/FATX/Super.cs | 12 +- Aaru.Filesystems/FFS/Info.cs | 18 +- Aaru.Filesystems/Fossil/Info.cs | 2 +- Aaru.Filesystems/HPOFS/Info.cs | 2 +- Aaru.Filesystems/ISO9660/File.cs | 10 +- Aaru.Filesystems/ISO9660/Info.cs | 64 +- Aaru.Filesystems/ISO9660/Mode2.cs | 6 +- Aaru.Filesystems/ISO9660/Super.cs | 2 +- Aaru.Filesystems/LIF/Info.cs | 2 +- Aaru.Filesystems/LisaFS/Extent.cs | 14 +- Aaru.Filesystems/LisaFS/File.cs | 12 +- Aaru.Filesystems/LisaFS/Info.cs | 12 +- Aaru.Filesystems/LisaFS/Super.cs | 2 +- Aaru.Filesystems/Locus/Info.cs | 6 +- Aaru.Filesystems/Nintendo/Info.cs | 38 +- Aaru.Filesystems/ODS/Info.cs | 4 +- Aaru.Filesystems/ProDOS/Info.cs | 38 +- Aaru.Filesystems/RBF/Info.cs | 10 +- Aaru.Filesystems/ReFS/Info.cs | 6 +- Aaru.Filesystems/SolarFS/Info.cs | 6 +- Aaru.Filesystems/UCSDPascal/Info.cs | 2 +- Aaru.Filesystems/UDF/Info.cs | 12 +- Aaru.Filesystems/UNICOS/Info.cs | 6 +- Aaru.Filesystems/UNIXBFS/Info.cs | 6 +- Aaru.Filesystems/XFS/Info.cs | 18 +- Aaru.Filesystems/dump/Info.cs | 10 +- Aaru.Filters/Aaru.Filters.csproj | 2 +- Aaru.Gui/ConsoleHandler.cs | 2 +- .../ViewModels/Dialogs/ConsoleViewModel.cs | 9 +- .../Panels/SubdirectoryViewModel.cs | 6 +- .../ViewModels/Tabs/PcmciaInfoViewModel.cs | 2 +- Aaru.Gui/ViewModels/Tabs/ScsiInfoViewModel.cs | 6 +- .../Windows/ImageChecksumViewModel.cs | 8 +- .../Windows/ImageConvertViewModel.cs | 6 +- .../Windows/ImageEntropyViewModel.cs | 6 +- .../Windows/ImageSidecarViewModel.cs | 2 +- .../Windows/ImageVerifyViewModel.cs | 2 +- .../ViewModels/Windows/MainWindowViewModel.cs | 9 +- .../Windows/SplashWindowViewModel.cs | 2 +- Aaru.Helpers/Aaru.Helpers.csproj | 2 +- Aaru.Helpers/DateHandlers.cs | 22 +- Aaru.Helpers/PrintHex.cs | 16 +- Aaru.Images/A2R/Read.cs | 38 +- Aaru.Images/A2R/Write.cs | 6 +- Aaru.Images/Aaru.Images.csproj | 2 +- .../AaruFormat/ClauniaSubchannelTransform.cs | 46 +- Aaru.Images/AaruFormat/Read.cs | 52 +- Aaru.Images/AaruFormat/Verify.cs | 14 +- Aaru.Images/AaruFormat/Write.cs | 96 +-- Aaru.Images/Alcohol120/Read.cs | 60 +- Aaru.Images/Alcohol120/Write.cs | 18 +- Aaru.Images/Anex86/Identify.cs | 4 +- Aaru.Images/Anex86/Read.cs | 4 +- Aaru.Images/Anex86/Write.cs | 4 +- Aaru.Images/Apple2MG/Read.cs | 18 +- Aaru.Images/Apple2MG/Write.cs | 8 +- Aaru.Images/AppleDOS/Write.cs | 6 +- Aaru.Images/AppleNIB/Read.cs | 18 +- Aaru.Images/Apridisk/Read.cs | 23 +- Aaru.Images/Apridisk/Write.cs | 4 +- Aaru.Images/BLU/Read.cs | 21 +- Aaru.Images/BLU/Write.cs | 4 +- Aaru.Images/BlindWrite4/Read.cs | 43 +- Aaru.Images/BlindWrite5/Read.cs | 80 +- Aaru.Images/ByteAddressable/AtariLynx.cs | 14 +- Aaru.Images/ByteAddressable/GameBoy.cs | 24 +- Aaru.Images/ByteAddressable/GameBoyAdvance.cs | 14 +- Aaru.Images/ByteAddressable/MasterSystem.cs | 12 +- Aaru.Images/ByteAddressable/NES.cs | 34 +- Aaru.Images/ByteAddressable/Nintendo64.cs | 26 +- Aaru.Images/ByteAddressable/SegaMegaDrive.cs | 42 +- Aaru.Images/ByteAddressable/SuperNintendo.cs | 22 +- Aaru.Images/CDRDAO/Identify.cs | 8 +- Aaru.Images/CDRDAO/Read.cs | 44 +- Aaru.Images/CDRDAO/Write.cs | 19 +- Aaru.Images/CDRWin/Identify.cs | 8 +- Aaru.Images/CDRWin/Read.cs | 104 +-- Aaru.Images/CDRWin/Verify.cs | 14 +- Aaru.Images/CDRWin/Write.cs | 11 +- Aaru.Images/CHD/Helpers.cs | 10 +- Aaru.Images/CHD/Read.cs | 76 +- Aaru.Images/CPCDSK/Identify.cs | 9 +- Aaru.Images/CPCDSK/Read.cs | 33 +- Aaru.Images/CisCopy/Read.cs | 10 +- Aaru.Images/CisCopy/Write.cs | 6 +- Aaru.Images/CloneCD/Identify.cs | 8 +- Aaru.Images/CloneCD/Read.cs | 66 +- Aaru.Images/CloneCD/Write.cs | 8 +- Aaru.Images/CopyQM/Read.cs | 24 +- Aaru.Images/CopyTape/Read.cs | 18 +- Aaru.Images/CopyTape/Write.cs | 2 +- Aaru.Images/D88/Identify.cs | 6 +- Aaru.Images/D88/Read.cs | 12 +- Aaru.Images/DART/Read.cs | 16 +- Aaru.Images/DIM/Read.cs | 2 +- Aaru.Images/DiscFerret/Read.cs | 8 +- Aaru.Images/DiscJuggler/Identify.cs | 8 +- Aaru.Images/DiscJuggler/Read.cs | 94 +-- Aaru.Images/DiskCopy42/Identify.cs | 6 +- Aaru.Images/DiskCopy42/Read.cs | 24 +- Aaru.Images/DiskCopy42/Verify.cs | 8 +- Aaru.Images/DiskCopy42/Write.cs | 8 +- Aaru.Images/DiskDupe/Helpers.cs | 14 +- Aaru.Images/DiskDupe/Read.cs | 6 +- Aaru.Images/DriDiskCopy/Identify.cs | 4 +- Aaru.Images/DriDiskCopy/Read.cs | 4 +- Aaru.Images/DriDiskCopy/Write.cs | 6 +- Aaru.Images/GDI/Identify.cs | 14 +- Aaru.Images/GDI/Read.cs | 24 +- Aaru.Images/HDCopy/Helpers.cs | 27 +- Aaru.Images/HDCopy/Read.cs | 12 +- Aaru.Images/IMD/Read.cs | 39 +- Aaru.Images/KryoFlux/Read.cs | 14 +- Aaru.Images/MaxiDisk/Identify.cs | 4 +- Aaru.Images/MaxiDisk/Write.cs | 6 +- Aaru.Images/NDIF/Read.cs | 20 +- Aaru.Images/NHDr0/Identify.cs | 4 +- Aaru.Images/NHDr0/Write.cs | 6 +- Aaru.Images/Nero/Identify.cs | 4 +- Aaru.Images/Nero/Read.cs | 2 +- Aaru.Images/Parallels/Read.cs | 10 +- Aaru.Images/Parallels/Write.cs | 10 +- Aaru.Images/PartClone/Read.cs | 8 +- Aaru.Images/Partimage/Read.cs | 6 +- Aaru.Images/QCOW/Read.cs | 18 +- Aaru.Images/QCOW/Write.cs | 22 +- Aaru.Images/QCOW2/Identify.cs | 4 +- Aaru.Images/QCOW2/Read.cs | 20 +- Aaru.Images/QCOW2/Write.cs | 24 +- Aaru.Images/QED/Read.cs | 14 +- Aaru.Images/QED/Write.cs | 22 +- Aaru.Images/RayDIM/Identify.cs | 4 +- Aaru.Images/RayDIM/Write.cs | 8 +- Aaru.Images/RsIde/Write.cs | 10 +- Aaru.Images/SaveDskF/Read.cs | 6 +- Aaru.Images/SaveDskF/Write.cs | 6 +- Aaru.Images/SuperCardPro/Read.cs | 22 +- Aaru.Images/SuperCardPro/Write.cs | 12 +- Aaru.Images/T98/Identify.cs | 13 +- Aaru.Images/T98/Write.cs | 4 +- Aaru.Images/TeleDisk/Helpers.cs | 32 +- Aaru.Images/TeleDisk/Identify.cs | 6 +- Aaru.Images/TeleDisk/Read.cs | 69 +- Aaru.Images/UDIF/Read.cs | 26 +- Aaru.Images/UDIF/Write.cs | 4 +- Aaru.Images/UkvFdi/Read.cs | 34 +- Aaru.Images/VDI/Read.cs | 8 +- Aaru.Images/VDI/Write.cs | 10 +- Aaru.Images/VHD/Read.cs | 48 +- Aaru.Images/VHD/Write.cs | 35 +- Aaru.Images/VHDX/Read.cs | 36 +- Aaru.Images/VMware/Read.cs | 32 +- Aaru.Images/VMware/Write.cs | 2 +- Aaru.Images/Virtual98/Identify.cs | 4 +- Aaru.Images/Virtual98/Write.cs | 6 +- Aaru.Images/WCDiskImage/Read.cs | 28 +- Aaru.Images/ZZZRawImage/Read.cs | 26 +- Aaru.Images/ZZZRawImage/Write.cs | 2 +- .../Aaru.Logging.csproj | 3 +- Aaru.Logging/AaruConsole.cs | 2 +- Aaru.Partitions/Aaru.Partitions.csproj | 2 +- Aaru.Partitions/AppleMap.cs | 20 +- Aaru.Partitions/Apricot.cs | 6 +- Aaru.Partitions/Atari.cs | 26 +- Aaru.Partitions/BSD.cs | 18 +- Aaru.Partitions/GPT.cs | 14 +- Aaru.Partitions/Human68k.cs | 4 +- Aaru.Partitions/MBR.cs | 44 +- Aaru.Partitions/NeXT.cs | 14 +- Aaru.Partitions/PC98.cs | 2 +- Aaru.Partitions/RDB.cs | 24 +- Aaru.Partitions/SGI.cs | 8 +- Aaru.Partitions/Sun.cs | 38 +- Aaru.Partitions/VTOC.cs | 24 +- Aaru.Partitions/XENIX.cs | 4 +- Aaru.Tests.Devices/ATA.cs | 11 +- Aaru.Tests.Devices/ATA/Ata28.cs | 257 +++---- Aaru.Tests.Devices/ATA/Ata48.cs | 245 +++---- Aaru.Tests.Devices/ATA/AtaCHS.cs | 305 ++++---- Aaru.Tests.Devices/ATA/Atapi.cs | 41 +- Aaru.Tests.Devices/ATA/Cfa.cs | 105 +-- Aaru.Tests.Devices/ATA/MCPT.cs | 33 +- Aaru.Tests.Devices/ATA/Smart.cs | 151 ++-- Aaru.Tests.Devices/Aaru.Tests.Devices.csproj | 2 +- Aaru.Tests.Devices/Command.cs | 11 +- Aaru.Tests.Devices/Device.cs | 23 +- Aaru.Tests.Devices/Main.cs | 25 +- Aaru.Tests.Devices/NVMe.cs | 5 +- Aaru.Tests.Devices/SCSI.cs | 11 +- Aaru.Tests.Devices/SCSI/Adaptec.cs | 163 ++--- Aaru.Tests.Devices/SCSI/ArchiveCorp.cs | 85 +-- Aaru.Tests.Devices/SCSI/Certance.cs | 47 +- Aaru.Tests.Devices/SCSI/Fujitsu.cs | 52 +- Aaru.Tests.Devices/SCSI/HL-DT-ST.cs | 55 +- Aaru.Tests.Devices/SCSI/HP.cs | 77 +- Aaru.Tests.Devices/SCSI/Kreon.cs | 108 +-- Aaru.Tests.Devices/SCSI/MMC.cs | 518 ++++++------- Aaru.Tests.Devices/SCSI/NEC.cs | 55 +- Aaru.Tests.Devices/SCSI/Pioneer.cs | 182 ++--- Aaru.Tests.Devices/SCSI/Plasmon.cs | 123 ++-- Aaru.Tests.Devices/SCSI/Plextor.cs | 488 ++++++------- Aaru.Tests.Devices/SCSI/SBC.cs | 467 ++++++------ Aaru.Tests.Devices/SCSI/SMC.cs | 76 +- Aaru.Tests.Devices/SCSI/SPC.cs | 410 +++++------ Aaru.Tests.Devices/SCSI/SSC.cs | 684 +++++++++--------- Aaru.Tests.Devices/SCSI/SyQuest.cs | 149 ++-- Aaru.Tests.Devices/SCSI_MMC/GdRom.cs | 137 ++-- Aaru.Tests.Devices/SCSI_MMC/LeadOutTrap.cs | 97 +-- Aaru.Tests.Devices/SCSI_MMC/MediaTek.cs | 43 +- Aaru.Tests.Devices/SCSI_MMC/SCSI_MMC.cs | 11 +- Aaru.Tests.Devices/SecureDigital.cs | 11 +- .../SecureDigital/MultiMediaCard.cs | 225 +++--- .../SecureDigital/SecureDigital.cs | 225 +++--- .../Issues/OpticalImageConvertIssueTest.cs | 8 +- Aaru.sln | 2 +- Aaru/Aaru.csproj | 2 +- Aaru/Commands/Archive/Extract.cs | 2 +- Aaru/Commands/Archive/Info.cs | 2 +- Aaru/Commands/Archive/List.cs | 2 +- Aaru/Commands/Configure.cs | 2 +- Aaru/Commands/Database/Statistics.cs | 2 +- Aaru/Commands/Database/Update.cs | 2 +- Aaru/Commands/Device/DeviceReport.cs | 16 +- Aaru/Commands/Device/Info.cs | 2 +- Aaru/Commands/Device/List.cs | 2 +- Aaru/Commands/Filesystem/ExtractFiles.cs | 2 +- Aaru/Commands/Filesystem/Info.cs | 2 +- Aaru/Commands/Filesystem/Ls.cs | 2 +- Aaru/Commands/Filesystem/Options.cs | 2 +- Aaru/Commands/Formats.cs | 2 +- Aaru/Commands/Image/Checksum.cs | 2 +- Aaru/Commands/Image/Compare.cs | 2 +- Aaru/Commands/Image/Convert.cs | 2 +- Aaru/Commands/Image/CreateSidecar.cs | 6 +- Aaru/Commands/Image/Decode.cs | 2 +- Aaru/Commands/Image/Entropy.cs | 2 +- Aaru/Commands/Image/Info.cs | 2 +- Aaru/Commands/Image/Options.cs | 2 +- Aaru/Commands/Image/Print.cs | 2 +- Aaru/Commands/Image/Verify.cs | 12 +- Aaru/Commands/ListEncodings.cs | 2 +- Aaru/Commands/ListNamespaces.cs | 2 +- Aaru/Commands/Media/Dump.cs | 6 +- Aaru/Commands/Media/Info.cs | 2 +- Aaru/Commands/Media/Scan.cs | 5 +- Aaru/Commands/Remote.cs | 2 +- Aaru/Main.cs | 6 +- 365 files changed, 5465 insertions(+), 5347 deletions(-) rename Aaru.Console/Aaru.Console.csproj => Aaru.Logging/Aaru.Logging.csproj (94%) diff --git a/Aaru.Archives/Aaru.Archives.csproj b/Aaru.Archives/Aaru.Archives.csproj index e03c031f7..a88c0518c 100644 --- a/Aaru.Archives/Aaru.Archives.csproj +++ b/Aaru.Archives/Aaru.Archives.csproj @@ -45,7 +45,7 @@ - + diff --git a/Aaru.Archives/Symbian/Info.cs b/Aaru.Archives/Symbian/Info.cs index c6c5e8484..08ec85679 100644 --- a/Aaru.Archives/Symbian/Info.cs +++ b/Aaru.Archives/Symbian/Info.cs @@ -37,8 +37,8 @@ using System.Linq; using System.Runtime.InteropServices; using System.Text; using Aaru.CommonTypes.Interfaces; -using Aaru.Console; using Aaru.Helpers; +using Aaru.Logging; using Marshal = Aaru.Helpers.Marshal; namespace Aaru.Archives; @@ -54,7 +54,7 @@ public sealed partial class Symbian Stream stream = filter.GetDataForkStream(); - var hdr = new byte[Marshal.SizeOf()]; + byte[] hdr = new byte[Marshal.SizeOf()]; stream.EnsureRead(hdr, 0, hdr.Length); @@ -77,7 +77,7 @@ public sealed partial class Symbian if(stream.Length < Marshal.SizeOf()) return; - var buffer = new byte[Marshal.SizeOf()]; + byte[] buffer = new byte[Marshal.SizeOf()]; stream.Seek(0, SeekOrigin.Begin); stream.EnsureRead(buffer, 0, buffer.Length); @@ -163,7 +163,7 @@ public sealed partial class Symbian // Go to enumerate languages br.BaseStream.Seek(sh.lang_ptr, SeekOrigin.Begin); - for(var i = 0; i < sh.languages; i++) languages.Add(((LanguageCodes)br.ReadUInt16()).ToString("G")); + for(int i = 0; i < sh.languages; i++) languages.Add(((LanguageCodes)br.ReadUInt16()).ToString("G")); // Go to component record br.BaseStream.Seek(sh.comp_ptr, SeekOrigin.Begin); @@ -185,7 +185,7 @@ public sealed partial class Symbian span = buffer; componentRecord.namesPointers = MemoryMarshal.Cast(span)[..languages.Count].ToArray(); - for(var i = 0; i < sh.languages; i++) + for(int i = 0; i < sh.languages; i++) { AaruConsole.DebugWriteLine(MODULE_NAME, "Found component name for language {0} at {1} with a length of {2} bytes", @@ -201,7 +201,7 @@ public sealed partial class Symbian // Go to capabilities (???) br.BaseStream.Seek(sh.caps_ptr, SeekOrigin.Begin); - for(var i = 0; i < sh.capabilities; i++) + for(int i = 0; i < sh.capabilities; i++) { uint cap_Key = br.ReadUInt32(); uint cap_Value = br.ReadUInt32(); @@ -227,7 +227,7 @@ public sealed partial class Symbian description.AppendFormat(Localization.File_contains_0_languages, sh.languages).AppendLine(); - for(var i = 0; i < languages.Count; i++) + for(int i = 0; i < languages.Count; i++) { if(i > 0) description.Append(", "); description.Append($"{languages[i]}"); @@ -236,7 +236,7 @@ public sealed partial class Symbian description.AppendLine(); description.AppendLine(); - for(var i = 0; i < languages.Count; i++) + for(int i = 0; i < languages.Count; i++) { description.AppendFormat(Localization.Component_name_for_language_with_code_0_1, languages[i], @@ -253,7 +253,7 @@ public sealed partial class Symbian if(sh.requisites > 0) { - for(var r = 0; r < sh.requisites; r++) + for(int r = 0; r < sh.requisites; r++) { br.BaseStream.Seek(offset, SeekOrigin.Begin); @@ -285,7 +285,7 @@ public sealed partial class Symbian offset = (uint)br.BaseStream.Position; - for(var i = 0; i < languages.Count; i++) + for(int i = 0; i < languages.Count; i++) { br.BaseStream.Seek(requisiteRecord.namesPointers[i], SeekOrigin.Begin); buffer = br.ReadBytes((int)requisiteRecord.namesLengths[i]); @@ -310,7 +310,7 @@ public sealed partial class Symbian uint currentFile = 0; offset = sh.files_ptr; - var conditionLevel = 0; + int conditionLevel = 0; _options = []; // Get only the options records @@ -361,7 +361,7 @@ public sealed partial class Symbian if(_options.Count > 0) { - for(var i = 0; i < _options.Count; i++) + for(int i = 0; i < _options.Count; i++) { OptionRecord option = _options[i]; diff --git a/Aaru.Archives/Symbian/Open.cs b/Aaru.Archives/Symbian/Open.cs index bd134ac5c..7b70f429b 100644 --- a/Aaru.Archives/Symbian/Open.cs +++ b/Aaru.Archives/Symbian/Open.cs @@ -36,8 +36,8 @@ using System.Linq; using System.Text; using Aaru.CommonTypes.Enums; using Aaru.CommonTypes.Interfaces; -using Aaru.Console; using Aaru.Helpers; +using Aaru.Logging; namespace Aaru.Archives; @@ -56,7 +56,7 @@ public sealed partial class Symbian if(_stream.Length < Marshal.SizeOf()) return ErrorNumber.InvalidArgument; - var buffer = new byte[Marshal.SizeOf()]; + byte[] buffer = new byte[Marshal.SizeOf()]; _stream.Seek(0, SeekOrigin.Begin); _stream.EnsureRead(buffer, 0, buffer.Length); @@ -123,7 +123,7 @@ public sealed partial class Symbian // Go to enumerate languages br.BaseStream.Seek(sh.lang_ptr, SeekOrigin.Begin); - for(var i = 0; i < sh.languages; i++) languages.Add(((LanguageCodes)br.ReadUInt16()).ToString("G")); + for(int i = 0; i < sh.languages; i++) languages.Add(((LanguageCodes)br.ReadUInt16()).ToString("G")); _files = []; _conditions = []; @@ -131,7 +131,7 @@ public sealed partial class Symbian uint currentFile = 0; uint offset = sh.files_ptr; - var conditionLevel = 0; + int conditionLevel = 0; // Get only the options records do diff --git a/Aaru.Archives/Symbian/Parser.cs b/Aaru.Archives/Symbian/Parser.cs index b7050a883..e35e3d5a0 100644 --- a/Aaru.Archives/Symbian/Parser.cs +++ b/Aaru.Archives/Symbian/Parser.cs @@ -36,7 +36,7 @@ using System.Diagnostics.CodeAnalysis; using System.IO; using System.Runtime.InteropServices; using System.Text; -using Aaru.Console; +using Aaru.Logging; using Marshal = Aaru.Helpers.Marshal; namespace Aaru.Archives; @@ -51,8 +51,8 @@ public sealed partial class Symbian if(currentFile > maxFiles) return; - var tabulationChars = new char[conditionLevel]; - for(var i = 0; i < conditionLevel; i++) tabulationChars[i] = '\t'; + char[] tabulationChars = new char[conditionLevel]; + for(int i = 0; i < conditionLevel; i++) tabulationChars[i] = '\t'; string tabulation = new(tabulationChars); AaruConsole.DebugWriteLine(MODULE_NAME, @@ -323,7 +323,7 @@ public sealed partial class Symbian var decodedFileRecords = new DecodedFileRecord[languages.Count]; - for(var i = 0; i < languages.Count; i++) + for(int i = 0; i < languages.Count; i++) { decodedFileRecords[i].type = multipleFileRecord.record.type; decodedFileRecords[i].details = multipleFileRecord.record.details; @@ -488,7 +488,7 @@ public sealed partial class Symbian optionsLineRecord.options = new OptionRecord[(int)optionsLineRecord.numberOfOptions]; - for(var i = 0; i < optionsLineRecord.numberOfOptions; i++) + for(int i = 0; i < optionsLineRecord.numberOfOptions; i++) { optionsLineRecord.options[i] = new OptionRecord(); @@ -508,7 +508,7 @@ public sealed partial class Symbian offset = (uint)br.BaseStream.Position; - for(var j = 0; j < languages.Count; j++) + for(int j = 0; j < languages.Count; j++) { br.BaseStream.Seek(optionsLineRecord.options[i].pointers[j], SeekOrigin.Begin); buffer = br.ReadBytes((int)optionsLineRecord.options[i].lengths[j]); @@ -527,7 +527,7 @@ public sealed partial class Symbian conditionLevel--; tabulationChars = new char[conditionLevel]; - for(var i = 0; i < conditionLevel; i++) tabulationChars[i] = '\t'; + for(int i = 0; i < conditionLevel; i++) tabulationChars[i] = '\t'; tabulation = new string(tabulationChars); conditionalRecord = new ConditionalRecord @@ -552,7 +552,7 @@ public sealed partial class Symbian break; case FileRecordType.ElseIf: tabulationChars = new char[conditionLevel - 1]; - for(var i = 0; i < conditionLevel - 1; i++) tabulationChars[i] = '\t'; + for(int i = 0; i < conditionLevel - 1; i++) tabulationChars[i] = '\t'; tabulation = new string(tabulationChars); conditionalRecord = new ConditionalRecord @@ -577,7 +577,7 @@ public sealed partial class Symbian break; case FileRecordType.Else: tabulationChars = new char[conditionLevel - 1]; - for(var i = 0; i < conditionLevel - 1; i++) tabulationChars[i] = '\t'; + for(int i = 0; i < conditionLevel - 1; i++) tabulationChars[i] = '\t'; tabulation = new string(tabulationChars); offset = (uint)(br.BaseStream.Position + Marshal.SizeOf()); diff --git a/Aaru.Checksums/Aaru.Checksums.csproj b/Aaru.Checksums/Aaru.Checksums.csproj index d0438dce9..2a8057075 100644 --- a/Aaru.Checksums/Aaru.Checksums.csproj +++ b/Aaru.Checksums/Aaru.Checksums.csproj @@ -33,7 +33,7 @@ - + diff --git a/Aaru.Checksums/CDChecksums.cs b/Aaru.Checksums/CDChecksums.cs index 7dedad410..64761a2df 100644 --- a/Aaru.Checksums/CDChecksums.cs +++ b/Aaru.Checksums/CDChecksums.cs @@ -33,8 +33,8 @@ using System; using System.Collections.Generic; -using Aaru.Console; using Aaru.Helpers; +using Aaru.Logging; namespace Aaru.Checksums; @@ -82,8 +82,8 @@ public static class CdChecksums { case 2448: { - var subchannel = new byte[96]; - var channel = new byte[2352]; + byte[] subchannel = new byte[96]; + byte[] channel = new byte[2352]; Array.Copy(buffer, 0, channel, 0, 2352); Array.Copy(buffer, 2352, subchannel, 0, 96); @@ -121,7 +121,7 @@ public static class CdChecksums for(uint i = 0; i < 256; i++) { uint edc = i; - var j = (uint)(i << 1 ^ ((i & 0x80) == 0x80 ? 0x11D : 0)); + uint j = (uint)(i << 1 ^ ((i & 0x80) == 0x80 ? 0x11D : 0)); _eccFTable[i] = (byte)j; _eccBTable[i ^ j] = (byte)i; @@ -197,7 +197,7 @@ public static class CdChecksums { //AaruConsole.DebugWriteLine(MODULE_NAME, "Mode 0 sector at address {0:X2}:{1:X2}:{2:X2}", // channel[0x00C], channel[0x00D], channel[0x00E]); - for(var i = 0x010; i < 0x930; i++) + for(int i = 0x010; i < 0x930; i++) { if(channel[i] == 0x00) continue; @@ -233,11 +233,11 @@ public static class CdChecksums return false; case 0x01: { - var address = new byte[4]; - var data = new byte[2060]; - var data2 = new byte[2232]; - var eccP = new byte[172]; - var eccQ = new byte[104]; + byte[] address = new byte[4]; + byte[] data = new byte[2060]; + byte[] data2 = new byte[2232]; + byte[] eccP = new byte[172]; + byte[] eccQ = new byte[104]; Array.Copy(channel, 0x0C, address, 0, 4); Array.Copy(channel, 0x10, data, 0, 2060); @@ -269,7 +269,7 @@ public static class CdChecksums channel[0x00E]); } - var storedEdc = BitConverter.ToUInt32(channel, 0x810); + uint storedEdc = BitConverter.ToUInt32(channel, 0x810); uint calculatedEdc = ComputeEdc(0, channel, 0x810); correctEdc = calculatedEdc == storedEdc; @@ -292,7 +292,7 @@ public static class CdChecksums { //AaruConsole.DebugWriteLine(MODULE_NAME, "Mode 2 sector at address {0:X2}:{1:X2}:{2:X2}", // channel[0x00C], channel[0x00D], channel[0x00E]); - var mode2Sector = new byte[channel.Length - 0x10]; + byte[] mode2Sector = new byte[channel.Length - 0x10]; Array.Copy(channel, 0x10, mode2Sector, 0, mode2Sector.Length); if((channel[0x012] & 0x20) == 0x20) // mode 2 form 2 @@ -309,7 +309,7 @@ public static class CdChecksums channel[0x00E]); } - var storedEdc = BitConverter.ToUInt32(mode2Sector, 0x91C); + uint storedEdc = BitConverter.ToUInt32(mode2Sector, 0x91C); // No CRC stored! if(storedEdc == 0x00000000) return true; @@ -344,9 +344,9 @@ public static class CdChecksums channel[0x00E]); } - var address = new byte[4]; - var eccP = new byte[172]; - var eccQ = new byte[104]; + byte[] address = new byte[4]; + byte[] eccP = new byte[172]; + byte[] eccQ = new byte[104]; Array.Copy(mode2Sector, 0x80C, eccP, 0, 172); Array.Copy(mode2Sector, 0x8B8, eccQ, 0, 104); @@ -375,7 +375,7 @@ public static class CdChecksums channel[0x00E]); } - var storedEdc = BitConverter.ToUInt32(mode2Sector, 0x808); + uint storedEdc = BitConverter.ToUInt32(mode2Sector, 0x808); uint calculatedEdc = ComputeEdc(0, mode2Sector, 0x808); correctEdc = calculatedEdc == storedEdc; @@ -407,7 +407,7 @@ public static class CdChecksums static uint ComputeEdc(uint edc, IReadOnlyList src, int size) { - var pos = 0; + int pos = 0; for(; size > 0; size--) edc = edc >> 8 ^ _edcTable[(edc ^ src[pos++]) & 0xFF]; @@ -416,22 +416,22 @@ public static class CdChecksums static bool? CheckCdSectorSubChannel(IReadOnlyList subchannel) { - bool? status = true; - var qSubChannel = new byte[12]; - var cdTextPack1 = new byte[18]; - var cdTextPack2 = new byte[18]; - var cdTextPack3 = new byte[18]; - var cdTextPack4 = new byte[18]; - var cdSubRwPack1 = new byte[24]; - var cdSubRwPack2 = new byte[24]; - var cdSubRwPack3 = new byte[24]; - var cdSubRwPack4 = new byte[24]; + bool? status = true; + byte[] qSubChannel = new byte[12]; + byte[] cdTextPack1 = new byte[18]; + byte[] cdTextPack2 = new byte[18]; + byte[] cdTextPack3 = new byte[18]; + byte[] cdTextPack4 = new byte[18]; + byte[] cdSubRwPack1 = new byte[24]; + byte[] cdSubRwPack2 = new byte[24]; + byte[] cdSubRwPack3 = new byte[24]; + byte[] cdSubRwPack4 = new byte[24]; - var i = 0; + int i = 0; - for(var j = 0; j < 12; j++) qSubChannel[j] = 0; + for(int j = 0; j < 12; j++) qSubChannel[j] = 0; - for(var j = 0; j < 18; j++) + for(int j = 0; j < 18; j++) { cdTextPack1[j] = 0; cdTextPack2[j] = 0; @@ -439,7 +439,7 @@ public static class CdChecksums cdTextPack4[j] = 0; } - for(var j = 0; j < 24; j++) + for(int j = 0; j < 24; j++) { cdSubRwPack1[j] = 0; cdSubRwPack2[j] = 0; @@ -447,7 +447,7 @@ public static class CdChecksums cdSubRwPack4[j] = 0; } - for(var j = 0; j < 12; j++) + for(int j = 0; j < 12; j++) { qSubChannel[j] = (byte)(qSubChannel[j] | (subchannel[i++] & 0x40) << 1); qSubChannel[j] = (byte)(qSubChannel[j] | subchannel[i++] & 0x40); @@ -461,7 +461,7 @@ public static class CdChecksums i = 0; - for(var j = 0; j < 18; j++) + for(int j = 0; j < 18; j++) { cdTextPack1[j] = (byte)(cdTextPack1[j] | (subchannel[i++] & 0x3F) << 2); @@ -476,7 +476,7 @@ public static class CdChecksums cdTextPack1[j] = (byte)(cdTextPack1[j] | subchannel[i++] & 0x3F); } - for(var j = 0; j < 18; j++) + for(int j = 0; j < 18; j++) { cdTextPack2[j] = (byte)(cdTextPack2[j] | (subchannel[i++] & 0x3F) << 2); @@ -491,7 +491,7 @@ public static class CdChecksums cdTextPack2[j] = (byte)(cdTextPack2[j] | subchannel[i++] & 0x3F); } - for(var j = 0; j < 18; j++) + for(int j = 0; j < 18; j++) { cdTextPack3[j] = (byte)(cdTextPack3[j] | (subchannel[i++] & 0x3F) << 2); @@ -506,7 +506,7 @@ public static class CdChecksums cdTextPack3[j] = (byte)(cdTextPack3[j] | subchannel[i++] & 0x3F); } - for(var j = 0; j < 18; j++) + for(int j = 0; j < 18; j++) { cdTextPack4[j] = (byte)(cdTextPack4[j] | (subchannel[i++] & 0x3F) << 2); @@ -523,13 +523,13 @@ public static class CdChecksums i = 0; - for(var j = 0; j < 24; j++) cdSubRwPack1[j] = (byte)(subchannel[i++] & 0x3F); + for(int j = 0; j < 24; j++) cdSubRwPack1[j] = (byte)(subchannel[i++] & 0x3F); - for(var j = 0; j < 24; j++) cdSubRwPack2[j] = (byte)(subchannel[i++] & 0x3F); + for(int j = 0; j < 24; j++) cdSubRwPack2[j] = (byte)(subchannel[i++] & 0x3F); - for(var j = 0; j < 24; j++) cdSubRwPack3[j] = (byte)(subchannel[i++] & 0x3F); + for(int j = 0; j < 24; j++) cdSubRwPack3[j] = (byte)(subchannel[i++] & 0x3F); - for(var j = 0; j < 24; j++) cdSubRwPack4[j] = (byte)(subchannel[i++] & 0x3F); + for(int j = 0; j < 24; j++) cdSubRwPack4[j] = (byte)(subchannel[i++] & 0x3F); switch(cdSubRwPack1[0]) { @@ -570,8 +570,8 @@ public static class CdChecksums break; } - var qSubChannelCrc = BigEndianBitConverter.ToUInt16(qSubChannel, 10); - var qSubChannelForCrc = new byte[10]; + ushort qSubChannelCrc = BigEndianBitConverter.ToUInt16(qSubChannel, 10); + byte[] qSubChannelForCrc = new byte[10]; Array.Copy(qSubChannel, 0, qSubChannelForCrc, 0, 10); ushort calculatedQcrc = CRC16CcittContext.Calculate(qSubChannelForCrc); @@ -587,8 +587,8 @@ public static class CdChecksums if((cdTextPack1[0] & 0x80) == 0x80) { - var cdTextPack1Crc = BigEndianBitConverter.ToUInt16(cdTextPack1, 16); - var cdTextPack1ForCrc = new byte[16]; + ushort cdTextPack1Crc = BigEndianBitConverter.ToUInt16(cdTextPack1, 16); + byte[] cdTextPack1ForCrc = new byte[16]; Array.Copy(cdTextPack1, 0, cdTextPack1ForCrc, 0, 16); ushort calculatedCdtp1Crc = CRC16CcittContext.Calculate(cdTextPack1ForCrc); @@ -605,8 +605,8 @@ public static class CdChecksums if((cdTextPack2[0] & 0x80) == 0x80) { - var cdTextPack2Crc = BigEndianBitConverter.ToUInt16(cdTextPack2, 16); - var cdTextPack2ForCrc = new byte[16]; + ushort cdTextPack2Crc = BigEndianBitConverter.ToUInt16(cdTextPack2, 16); + byte[] cdTextPack2ForCrc = new byte[16]; Array.Copy(cdTextPack2, 0, cdTextPack2ForCrc, 0, 16); ushort calculatedCdtp2Crc = CRC16CcittContext.Calculate(cdTextPack2ForCrc); @@ -628,8 +628,8 @@ public static class CdChecksums if((cdTextPack3[0] & 0x80) == 0x80) { - var cdTextPack3Crc = BigEndianBitConverter.ToUInt16(cdTextPack3, 16); - var cdTextPack3ForCrc = new byte[16]; + ushort cdTextPack3Crc = BigEndianBitConverter.ToUInt16(cdTextPack3, 16); + byte[] cdTextPack3ForCrc = new byte[16]; Array.Copy(cdTextPack3, 0, cdTextPack3ForCrc, 0, 16); ushort calculatedCdtp3Crc = CRC16CcittContext.Calculate(cdTextPack3ForCrc); @@ -651,8 +651,8 @@ public static class CdChecksums if((cdTextPack4[0] & 0x80) != 0x80) return status; - var cdTextPack4Crc = BigEndianBitConverter.ToUInt16(cdTextPack4, 16); - var cdTextPack4ForCrc = new byte[16]; + ushort cdTextPack4Crc = BigEndianBitConverter.ToUInt16(cdTextPack4, 16); + byte[] cdTextPack4ForCrc = new byte[16]; Array.Copy(cdTextPack4, 0, cdTextPack4ForCrc, 0, 16); ushort calculatedCdtp4Crc = CRC16CcittContext.Calculate(cdTextPack4ForCrc); diff --git a/Aaru.Checksums/ReedSolomon.cs b/Aaru.Checksums/ReedSolomon.cs index 6e5ae507a..305976905 100644 --- a/Aaru.Checksums/ReedSolomon.cs +++ b/Aaru.Checksums/ReedSolomon.cs @@ -59,7 +59,7 @@ using System; using System.Diagnostics.CodeAnalysis; -using Aaru.Console; +using Aaru.Logging; namespace Aaru.Checksums; @@ -194,7 +194,7 @@ public class ReedSolomon { int i; - var mask = 1; + int mask = 1; _alphaTo[_mm] = 0; for(i = 0; i < _mm; i++) @@ -299,8 +299,9 @@ public class ReedSolomon for(i = _kk - 1; i >= 0; i--) { if(_mm != 8) - if(data[i] > _nn) - return -1; /* Illegal symbol */ + { + if(data[i] > _nn) return -1; /* Illegal symbol */ + } int feedback = _indexOf[data[i] ^ bb[_nn - _kk - 1]]; @@ -354,25 +355,26 @@ public class ReedSolomon throw new UnauthorizedAccessException(Localization.Trying_to_calculate_RS_without_initializing); erasPos = new int[_nn - _kk]; - int i, j; - int q, tmp; - var recd = new int[_nn]; - var lambda = new int[_nn - _kk + 1]; /* Err+Eras Locator poly */ - var s = new int[_nn - _kk + 1]; /* syndrome poly */ - var b = new int[_nn - _kk + 1]; - var t = new int[_nn - _kk + 1]; - var omega = new int[_nn - _kk + 1]; - var root = new int[_nn - _kk]; - var reg = new int[_nn - _kk + 1]; - var loc = new int[_nn - _kk]; - int count; + int i, j; + int q, tmp; + int[] recd = new int[_nn]; + int[] lambda = new int[_nn - _kk + 1]; /* Err+Eras Locator poly */ + int[] s = new int[_nn - _kk + 1]; /* syndrome poly */ + int[] b = new int[_nn - _kk + 1]; + int[] t = new int[_nn - _kk + 1]; + int[] omega = new int[_nn - _kk + 1]; + int[] root = new int[_nn - _kk]; + int[] reg = new int[_nn - _kk + 1]; + int[] loc = new int[_nn - _kk]; + int count; /* data[] is in polynomial form, copy and convert to index form */ for(i = _nn - 1; i >= 0; i--) { if(_mm != 8) - if(data[i] > _nn) - return -1; /* Illegal symbol */ + { + if(data[i] > _nn) return -1; /* Illegal symbol */ + } recd[i] = _indexOf[data[i]]; } @@ -380,15 +382,16 @@ public class ReedSolomon /* first form the syndromes; i.e., evaluate recd(x) at roots of g(x) * namely @**(B0+i), i = 0, ... ,(NN-KK-1) */ - var synError = 0; + int synError = 0; for(i = 1; i <= _nn - _kk; i++) { tmp = 0; for(j = 0; j < _nn; j++) - if(recd[j] != _a0) /* recd[j] in index form */ - tmp ^= _alphaTo[Modnn(recd[j] + (B0 + i - 1) * j)]; + { + if(recd[j] != _a0) /* recd[j] in index form */ tmp ^= _alphaTo[Modnn(recd[j] + (B0 + i - 1) * j)]; + } synError |= tmp; /* set flag if non-zero syndrome => * error */ @@ -476,11 +479,12 @@ public class ReedSolomon { /* r is the step number */ /* Compute discrepancy at the r-th step in poly-form */ - var discrR = 0; + int discrR = 0; for(i = 0; i < r; i++) - if(lambda[i] != 0 && s[r - i] != _a0) - discrR ^= _alphaTo[Modnn(_indexOf[lambda[i]] + s[r - i])]; + { + if(lambda[i] != 0 && s[r - i] != _a0) discrR ^= _alphaTo[Modnn(_indexOf[lambda[i]] + s[r - i])]; + } discrR = _indexOf[discrR]; /* Index form */ @@ -526,7 +530,7 @@ public class ReedSolomon } /* Convert lambda to index form and compute deg(lambda(x)) */ - var degLambda = 0; + int degLambda = 0; for(i = 0; i < _nn - _kk + 1; i++) { @@ -578,7 +582,7 @@ public class ReedSolomon * Compute err+eras evaluator poly omega(x) = s(x)*lambda(x) (modulo * x**(NN-KK)). in index form. Also find deg(omega). */ - var degOmega = 0; + int degOmega = 0; for(i = 0; i < _nn - _kk; i++) { @@ -586,8 +590,9 @@ public class ReedSolomon j = degLambda < i ? degLambda : i; for(; j >= 0; j--) - if(s[i + 1 - j] != _a0 && lambda[j] != _a0) - tmp ^= _alphaTo[Modnn(s[i + 1 - j] + lambda[j])]; + { + if(s[i + 1 - j] != _a0 && lambda[j] != _a0) tmp ^= _alphaTo[Modnn(s[i + 1 - j] + lambda[j])]; + } if(tmp != 0) degOmega = i; @@ -602,19 +607,21 @@ public class ReedSolomon */ for(j = count - 1; j >= 0; j--) { - var num1 = 0; + int num1 = 0; for(i = degOmega; i >= 0; i--) - if(omega[i] != _a0) - num1 ^= _alphaTo[Modnn(omega[i] + i * root[j])]; + { + if(omega[i] != _a0) num1 ^= _alphaTo[Modnn(omega[i] + i * root[j])]; + } int num2 = _alphaTo[Modnn(root[j] * (B0 - 1) + _nn)]; - var den = 0; + int den = 0; /* lambda[i+1] for i even is the formal derivative lambda_pr of lambda[i] */ for(i = Min(degLambda, _nn - _kk - 1) & ~1; i >= 0; i -= 2) - if(lambda[i + 1] != _a0) - den ^= _alphaTo[Modnn(lambda[i + 1] + i * root[j])]; + { + if(lambda[i + 1] != _a0) den ^= _alphaTo[Modnn(lambda[i + 1] + i * root[j])]; + } if(den == 0) { diff --git a/Aaru.CommonTypes/Aaru.CommonTypes.csproj b/Aaru.CommonTypes/Aaru.CommonTypes.csproj index 2033d8cf9..446adcc89 100644 --- a/Aaru.CommonTypes/Aaru.CommonTypes.csproj +++ b/Aaru.CommonTypes/Aaru.CommonTypes.csproj @@ -45,7 +45,7 @@ - + diff --git a/Aaru.CommonTypes/MediaTypeFromDevice/FromAta.cs b/Aaru.CommonTypes/MediaTypeFromDevice/FromAta.cs index 005737ecf..d74c17aa0 100644 --- a/Aaru.CommonTypes/MediaTypeFromDevice/FromAta.cs +++ b/Aaru.CommonTypes/MediaTypeFromDevice/FromAta.cs @@ -33,7 +33,7 @@ // ****************************************************************************/ using System; -using Aaru.Console; +using Aaru.Logging; namespace Aaru.CommonTypes; diff --git a/Aaru.CommonTypes/MediaTypeFromDevice/FromMmc.cs b/Aaru.CommonTypes/MediaTypeFromDevice/FromMmc.cs index 0b0c335c0..e2f40ef5e 100644 --- a/Aaru.CommonTypes/MediaTypeFromDevice/FromMmc.cs +++ b/Aaru.CommonTypes/MediaTypeFromDevice/FromMmc.cs @@ -33,7 +33,7 @@ // ****************************************************************************/ using System; -using Aaru.Console; +using Aaru.Logging; namespace Aaru.CommonTypes; diff --git a/Aaru.CommonTypes/MediaTypeFromDevice/FromOdc.cs b/Aaru.CommonTypes/MediaTypeFromDevice/FromOdc.cs index d79faf140..47a253af4 100644 --- a/Aaru.CommonTypes/MediaTypeFromDevice/FromOdc.cs +++ b/Aaru.CommonTypes/MediaTypeFromDevice/FromOdc.cs @@ -32,7 +32,7 @@ // Copyright © 2011-2025 Natalia Portillo // ****************************************************************************/ -using Aaru.Console; +using Aaru.Logging; namespace Aaru.CommonTypes; diff --git a/Aaru.CommonTypes/MediaTypeFromDevice/FromSbc.cs b/Aaru.CommonTypes/MediaTypeFromDevice/FromSbc.cs index 2b062ea7f..173463491 100644 --- a/Aaru.CommonTypes/MediaTypeFromDevice/FromSbc.cs +++ b/Aaru.CommonTypes/MediaTypeFromDevice/FromSbc.cs @@ -33,7 +33,7 @@ // ****************************************************************************/ using System; -using Aaru.Console; +using Aaru.Logging; namespace Aaru.CommonTypes; diff --git a/Aaru.CommonTypes/MediaTypeFromDevice/FromScsi.cs b/Aaru.CommonTypes/MediaTypeFromDevice/FromScsi.cs index 3c0f2ac53..10bd5e1f6 100644 --- a/Aaru.CommonTypes/MediaTypeFromDevice/FromScsi.cs +++ b/Aaru.CommonTypes/MediaTypeFromDevice/FromScsi.cs @@ -33,7 +33,7 @@ // ****************************************************************************/ using System; -using Aaru.Console; +using Aaru.Logging; namespace Aaru.CommonTypes; diff --git a/Aaru.CommonTypes/MediaTypeFromDevice/FromSsc.cs b/Aaru.CommonTypes/MediaTypeFromDevice/FromSsc.cs index cc124d1ac..cca29635d 100644 --- a/Aaru.CommonTypes/MediaTypeFromDevice/FromSsc.cs +++ b/Aaru.CommonTypes/MediaTypeFromDevice/FromSsc.cs @@ -33,7 +33,7 @@ // ****************************************************************************/ using System; -using Aaru.Console; +using Aaru.Logging; namespace Aaru.CommonTypes; diff --git a/Aaru.CommonTypes/Structs/Devices/ATA/Identify.cs b/Aaru.CommonTypes/Structs/Devices/ATA/Identify.cs index f49b8565a..4f1692393 100644 --- a/Aaru.CommonTypes/Structs/Devices/ATA/Identify.cs +++ b/Aaru.CommonTypes/Structs/Devices/ATA/Identify.cs @@ -43,8 +43,8 @@ using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; using System.Runtime.InteropServices; using System.Text; -using Aaru.Console; using Aaru.Helpers; +using Aaru.Logging; using Marshal = Aaru.Helpers.Marshal; namespace Aaru.CommonTypes.Structs.Devices.ATA; @@ -833,8 +833,8 @@ public static class Identify ataId.WWN = DescrambleWWN(ataId.WWN); ataId.WWNExtension = DescrambleWWN(ataId.WWNExtension); - var buf = new byte[512]; - nint ptr = System.Runtime.InteropServices.Marshal.AllocHGlobal(512); + byte[] buf = new byte[512]; + nint ptr = System.Runtime.InteropServices.Marshal.AllocHGlobal(512); System.Runtime.InteropServices.Marshal.StructureToPtr(ataId, ptr, false); System.Runtime.InteropServices.Marshal.Copy(ptr, buf, 0, 512); System.Runtime.InteropServices.Marshal.FreeHGlobal(ptr); @@ -858,7 +858,7 @@ public static class Identify static ulong DescrambleWWN(ulong WWN) { byte[] qwb = BitConverter.GetBytes(WWN); - var qword = new byte[8]; + byte[] qword = new byte[8]; qword[7] = qwb[1]; qword[6] = qwb[0]; @@ -876,7 +876,7 @@ public static class Identify { byte[] outbuf = buffer[offset + length - 1] != 0x00 ? new byte[length + 1] : new byte[length]; - for(var i = 0; i < length; i += 2) + for(int i = 0; i < length; i += 2) { outbuf[i] = buffer[offset + i + 1]; outbuf[i + 1] = buffer[offset + i]; @@ -889,9 +889,9 @@ public static class Identify static byte[] ScrambleATAString(string str, int length) { - var buf = new byte[length]; + byte[] buf = new byte[length]; - for(var i = 0; i < length; i++) buf[i] = 0x20; + for(int i = 0; i < length; i++) buf[i] = 0x20; if(str is null) return buf; @@ -899,13 +899,13 @@ public static class Identify if(bytes.Length % 2 != 0) { - var tmp = new byte[bytes.Length + 1]; + byte[] tmp = new byte[bytes.Length + 1]; tmp[^1] = 0x20; Array.Copy(bytes, 0, tmp, 0, bytes.Length); bytes = tmp; } - for(var i = 0; i < bytes.Length; i += 2) + for(int i = 0; i < bytes.Length; i += 2) { buf[i] = bytes[i + 1]; buf[i + 1] = bytes[i]; diff --git a/Aaru.CommonTypes/Structs/Devices/SCSI/Inquiry.cs b/Aaru.CommonTypes/Structs/Devices/SCSI/Inquiry.cs index 0dcb92cb3..ccced5b11 100644 --- a/Aaru.CommonTypes/Structs/Devices/SCSI/Inquiry.cs +++ b/Aaru.CommonTypes/Structs/Devices/SCSI/Inquiry.cs @@ -39,7 +39,7 @@ using System; using System.Diagnostics.CodeAnalysis; using System.Linq; -using Aaru.Console; +using Aaru.Logging; namespace Aaru.CommonTypes.Structs.Devices.SCSI; @@ -477,7 +477,7 @@ public struct Inquiry decoded.VersionDescriptors = new ushort[descriptorsNo]; - for(var i = 0; i < descriptorsNo; i++) + for(int i = 0; i < descriptorsNo; i++) decoded.VersionDescriptors[i] = BitConverter.ToUInt16(SCSIInquiryResponse, 58 + i * 2); } @@ -528,8 +528,8 @@ public struct Inquiry Inquiry decoded = inq.Value; - var buffer = new byte[512]; - byte length = 0; + byte[] buffer = new byte[512]; + byte length = 0; buffer[0] = (byte)(decoded.PeripheralQualifier << 5); buffer[0] += decoded.PeripheralDeviceType; @@ -729,7 +729,7 @@ public struct Inquiry { length = (byte)(58 + decoded.VersionDescriptors.Length * 2); - for(var i = 0; i < decoded.VersionDescriptors.Length; i++) + for(int i = 0; i < decoded.VersionDescriptors.Length; i++) Array.Copy(BitConverter.GetBytes(decoded.VersionDescriptors[i]), 0, buffer, 56 + i * 2, 2); } @@ -758,7 +758,7 @@ public struct Inquiry } buffer[4] = length; - var dest = new byte[length]; + byte[] dest = new byte[length]; Array.Copy(buffer, 0, dest, 0, length); return dest; diff --git a/Aaru.Core/Aaru.Core.csproj b/Aaru.Core/Aaru.Core.csproj index 301bbd7c2..f7bd856f2 100644 --- a/Aaru.Core/Aaru.Core.csproj +++ b/Aaru.Core/Aaru.Core.csproj @@ -32,7 +32,7 @@ - + diff --git a/Aaru.Core/ArchiveFormat.cs b/Aaru.Core/ArchiveFormat.cs index b9c032ab3..f6d1f5836 100644 --- a/Aaru.Core/ArchiveFormat.cs +++ b/Aaru.Core/ArchiveFormat.cs @@ -32,7 +32,7 @@ using Aaru.CommonTypes; using Aaru.CommonTypes.Interfaces; -using Aaru.Console; +using Aaru.Logging; namespace Aaru.Core; diff --git a/Aaru.Core/ArchiveInfo.cs b/Aaru.Core/ArchiveInfo.cs index cf1fd9911..e6aba7a44 100644 --- a/Aaru.Core/ArchiveInfo.cs +++ b/Aaru.Core/ArchiveInfo.cs @@ -32,7 +32,7 @@ using System.Text; using Aaru.CommonTypes.Interfaces; -using Aaru.Console; +using Aaru.Logging; using Spectre.Console; namespace Aaru.Core; diff --git a/Aaru.Core/DataFile.cs b/Aaru.Core/DataFile.cs index b4e58fc4a..bccbd087d 100644 --- a/Aaru.Core/DataFile.cs +++ b/Aaru.Core/DataFile.cs @@ -32,8 +32,8 @@ using System.Diagnostics.CodeAnalysis; using System.IO; -using Aaru.Console; using Aaru.Helpers; +using Aaru.Logging; namespace Aaru.Core; diff --git a/Aaru.Core/Devices/Dumping/CompactDisc/Data.cs b/Aaru.Core/Devices/Dumping/CompactDisc/Data.cs index 3c4a39236..7878a24de 100644 --- a/Aaru.Core/Devices/Dumping/CompactDisc/Data.cs +++ b/Aaru.Core/Devices/Dumping/CompactDisc/Data.cs @@ -43,11 +43,11 @@ using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Enums; using Aaru.CommonTypes.Extents; using Aaru.CommonTypes.Interfaces; -using Aaru.Console; using Aaru.Core.Logging; using Aaru.Decoders.CD; using Aaru.Decoders.SCSI; using Aaru.Devices; +using Aaru.Logging; using Humanizer; using Humanizer.Bytes; using Track = Aaru.CommonTypes.Structs.Track; @@ -103,7 +103,7 @@ partial class Dump { ulong sectorSpeedStart = 0; // Used to calculate correct speed uint blocksToRead; // How many sectors to read at once - var sense = true; // Sense indicator + bool sense = true; // Sense indicator byte[] cmdBuf = null; // Data buffer byte[] senseBuf = null; // Sense buffer double cmdDuration = 0; // Command execution time @@ -122,10 +122,10 @@ partial class Dump InitProgress?.Invoke(); - int currentReadSpeed = _speed; - var crossingLeadOut = false; - var failedCrossingLeadOut = false; - var skippingLead = false; + int currentReadSpeed = _speed; + bool crossingLeadOut = false; + bool failedCrossingLeadOut = false; + bool skippingLead = false; for(ulong i = _resume.NextBlock; (long)i <= lastSector; i += blocksToRead) { @@ -146,7 +146,7 @@ partial class Dump if((long)i > lastSector) break; - var firstSectorToRead = (uint)i; + uint firstSectorToRead = (uint)i; Track track = tracks.OrderBy(t => t.StartSector).LastOrDefault(t => i >= t.StartSector); @@ -317,10 +317,10 @@ partial class Dump // Try to workaround firmware if(decSense?.ASC == 0x64) { - var goBackTrackTypeChange = false; + bool goBackTrackTypeChange = false; // Go one for one as the drive does not tell us which one failed - for(var bi = 0; bi < blocksToRead; bi++) + for(int bi = 0; bi < blocksToRead; bi++) { _speedStopwatch.Start(); @@ -591,7 +591,7 @@ partial class Dump if(_supportsPlextorD8) { - var adjustment = 0; + int adjustment = 0; if(offsetBytes < 0) adjustment = -sectorsForOffset; @@ -611,7 +611,7 @@ partial class Dump if(!sense) { - var sectorsForFix = (uint)(1 + sectorsForOffset); + uint sectorsForFix = (uint)(1 + sectorsForOffset); FixOffsetData(offsetBytes, sectorSize, @@ -637,7 +637,7 @@ partial class Dump { case 0: - for(var c = 16; c < 2352; c++) + for(int c = 16; c < 2352; c++) { if(cmdBuf[c] == 0x00) continue; @@ -775,8 +775,8 @@ partial class Dump if(supportedSubchannel != MmcSubchannel.None) { - var data = new byte[sectorSize]; - var sub = new byte[subSize]; + byte[] data = new byte[sectorSize]; + byte[] sub = new byte[subSize]; Array.Copy(cmdBuf, 0, data, 0, sectorSize); @@ -786,10 +786,10 @@ partial class Dump outputFormat.WriteSectorsLong(data, i + r, 1); else { - var cooked = new MemoryStream(); - var sector = new byte[sectorSize]; + var cooked = new MemoryStream(); + byte[] sector = new byte[sectorSize]; - for(var b = 0; b < blocksToRead; b++) + for(int b = 0; b < blocksToRead; b++) { Array.Copy(cmdBuf, (int)(0 + b * blockSize), sector, 0, sectorSize); byte[] cookedSector = Sector.GetUserData(sector); @@ -847,10 +847,10 @@ partial class Dump outputFormat.WriteSectorsLong(cmdBuf, i + r, 1); else { - var cooked = new MemoryStream(); - var sector = new byte[sectorSize]; + var cooked = new MemoryStream(); + byte[] sector = new byte[sectorSize]; - for(var b = 0; b < blocksToRead; b++) + for(int b = 0; b < blocksToRead; b++) { Array.Copy(cmdBuf, (int)(b * sectorSize), sector, 0, sectorSize); byte[] cookedSector = Sector.GetUserData(sector); @@ -936,7 +936,7 @@ partial class Dump { if(crossingLeadOut && failedCrossingLeadOut) { - var tmp = new byte[cmdBuf.Length + blockSize]; + byte[] tmp = new byte[cmdBuf.Length + blockSize]; Array.Copy(cmdBuf, 0, tmp, 0, cmdBuf.Length); } @@ -961,10 +961,10 @@ partial class Dump if(supportedSubchannel != MmcSubchannel.None) { - var data = new byte[sectorSize * blocksToRead]; - var sub = new byte[subSize * blocksToRead]; + byte[] data = new byte[sectorSize * blocksToRead]; + byte[] sub = new byte[subSize * blocksToRead]; - for(var b = 0; b < blocksToRead; b++) + for(int b = 0; b < blocksToRead; b++) { Array.Copy(cmdBuf, (int)(0 + b * blockSize), data, sectorSize * b, sectorSize); @@ -975,10 +975,10 @@ partial class Dump outputFormat.WriteSectorsLong(data, i, blocksToRead); else { - var cooked = new MemoryStream(); - var sector = new byte[sectorSize]; + var cooked = new MemoryStream(); + byte[] sector = new byte[sectorSize]; - for(var b = 0; b < blocksToRead; b++) + for(int b = 0; b < blocksToRead; b++) { Array.Copy(cmdBuf, (int)(0 + b * blockSize), sector, 0, sectorSize); byte[] cookedSector = Sector.GetUserData(sector); @@ -1035,10 +1035,10 @@ partial class Dump outputFormat.WriteSectorsLong(cmdBuf, i, blocksToRead); else { - var cooked = new MemoryStream(); - var sector = new byte[sectorSize]; + var cooked = new MemoryStream(); + byte[] sector = new byte[sectorSize]; - for(var b = 0; b < blocksToRead; b++) + for(int b = 0; b < blocksToRead; b++) { Array.Copy(cmdBuf, (int)(b * sectorSize), sector, 0, sectorSize); byte[] cookedSector = Sector.GetUserData(sector); diff --git a/Aaru.Core/Devices/Dumping/CompactDisc/Dump.cs b/Aaru.Core/Devices/Dumping/CompactDisc/Dump.cs index 33f2701d9..5f6a815e8 100644 --- a/Aaru.Core/Devices/Dumping/CompactDisc/Dump.cs +++ b/Aaru.Core/Devices/Dumping/CompactDisc/Dump.cs @@ -43,13 +43,13 @@ using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Enums; using Aaru.CommonTypes.Extents; using Aaru.CommonTypes.Interfaces; -using Aaru.Console; using Aaru.Core.Graphics; using Aaru.Core.Logging; using Aaru.Core.Media.Detection; using Aaru.Database.Models; using Aaru.Decoders.CD; using Aaru.Devices; +using Aaru.Logging; using Humanizer; using Humanizer.Bytes; using Humanizer.Localisation; @@ -86,21 +86,21 @@ sealed partial class Dump MhddLog mhddLog; // MHDD log double minSpeed = double.MaxValue; // Minimum speed bool newTrim; // Is trim a new one? - var offsetBytes = 0; // Read offset - var read6 = false; // Device supports READ(6) - var read10 = false; // Device supports READ(10) - var read12 = false; // Device supports READ(12) - var read16 = false; // Device supports READ(16) - var readcd = true; // Device supports READ CD + int offsetBytes = 0; // Read offset + bool read6 = false; // Device supports READ(6) + bool read10 = false; // Device supports READ(10) + bool read12 = false; // Device supports READ(12) + bool read16 = false; // Device supports READ(16) + bool readcd = true; // Device supports READ CD bool ret; // Image writing return status const uint sectorSize = 2352; // Full sector size - var sectorsForOffset = 0; // Sectors needed to fix offset - var sense = true; // Sense indicator + int sectorsForOffset = 0; // Sectors needed to fix offset + bool sense = true; // Sense indicator int sessions; // Number of sessions in disc SubchannelLog subLog = null; // Subchannel log uint subSize = 0; // Subchannel size in bytes TrackSubchannelType subType; // Track subchannel type - var supportsLongSectors = true; // Supports reading EDC and ECC + bool supportsLongSectors = true; // Supports reading EDC and ECC bool supportsPqSubchannel; // Supports reading PQ subchannel bool supportsRwSubchannel; // Supports reading RW subchannel byte[] tmpBuf; // Temporary buffer @@ -112,11 +112,11 @@ sealed partial class Dump bool hiddenTrack; // Disc has a hidden track before track 1 MmcSubchannel supportedSubchannel; // Drive's maximum supported subchannel MmcSubchannel desiredSubchannel; // User requested subchannel - var bcdSubchannel = false; // Subchannel positioning is in BCD + bool bcdSubchannel = false; // Subchannel positioning is in BCD Dictionary isrcs = new(); string mcn = null; HashSet subchannelExtents = []; - var cdiReadyReadAsAudio = false; + bool cdiReadyReadAsAudio = false; uint firstLba; var outputOptical = _outputPlugin as IWritableOpticalImage; @@ -152,11 +152,12 @@ sealed partial class Dump return; } - firstLba = (uint) tracks.Min(t => t.StartSector); + firstLba = (uint)tracks.Min(t => t.StartSector); // Check subchannels support supportsPqSubchannel = SupportsPqSubchannel(_dev, _dumpLog, UpdateStatus, firstLba) || SupportsPqSubchannel(_dev, _dumpLog, UpdateStatus, firstLba + 5); + supportsRwSubchannel = SupportsRwSubchannel(_dev, _dumpLog, UpdateStatus, firstLba) || SupportsRwSubchannel(_dev, _dumpLog, UpdateStatus, firstLba + 5); @@ -279,9 +280,22 @@ sealed partial class Dump supportedSubchannel, _dev.Timeout, out _) || - !_dev.ReadCd(out cmdBuf, out _, firstLba + 5, sectorSize, 1, MmcSectorTypes.AllTypes, false, - false, true, MmcHeaderCodes.AllHeaders, true, true, MmcErrorField.None, - supportedSubchannel, _dev.Timeout, out _); + !_dev.ReadCd(out cmdBuf, + out _, + firstLba + 5, + sectorSize, + 1, + MmcSectorTypes.AllTypes, + false, + false, + true, + MmcHeaderCodes.AllHeaders, + true, + true, + MmcErrorField.None, + supportedSubchannel, + _dev.Timeout, + out _); if(!readcd) { @@ -291,32 +305,103 @@ sealed partial class Dump _dumpLog.WriteLine(Localization.Core.Checking_if_drive_supports_READ_6); UpdateStatus?.Invoke(Localization.Core.Checking_if_drive_supports_READ_6); - read6 = !_dev.Read6(out cmdBuf, out _, firstLba, 2048, 1, _dev.Timeout, out _) || + read6 = !_dev.Read6(out cmdBuf, out _, firstLba, 2048, 1, _dev.Timeout, out _) || !_dev.Read6(out cmdBuf, out _, firstLba + 5, 2048, 1, _dev.Timeout, out _); _dumpLog.WriteLine(Localization.Core.Checking_if_drive_supports_READ_10); UpdateStatus?.Invoke(Localization.Core.Checking_if_drive_supports_READ_10); - read10 = !_dev.Read10(out cmdBuf, out _, 0, false, true, false, false, firstLba, 2048, 0, 1, - _dev.Timeout, out _) || - !_dev.Read10(out cmdBuf, out _, 0, false, true, false, false, firstLba + 5, 2048, 0, 1, - _dev.Timeout, out _); + read10 = + !_dev.Read10(out cmdBuf, + out _, + 0, + false, + true, + false, + false, + firstLba, + 2048, + 0, + 1, + _dev.Timeout, + out _) || + !_dev.Read10(out cmdBuf, + out _, + 0, + false, + true, + false, + false, + firstLba + 5, + 2048, + 0, + 1, + _dev.Timeout, + out _); _dumpLog.WriteLine(Localization.Core.Checking_if_drive_supports_READ_12); UpdateStatus?.Invoke(Localization.Core.Checking_if_drive_supports_READ_12); - read12 = !_dev.Read12(out cmdBuf, out _, 0, false, true, false, false, firstLba, 2048, 0, 1, false, - _dev.Timeout, out _) || - !_dev.Read12(out cmdBuf, out _, 0, false, true, false, false, firstLba + 5, 2048, 0, 1, - false, _dev.Timeout, out _); + read12 = + !_dev.Read12(out cmdBuf, + out _, + 0, + false, + true, + false, + false, + firstLba, + 2048, + 0, + 1, + false, + _dev.Timeout, + out _) || + !_dev.Read12(out cmdBuf, + out _, + 0, + false, + true, + false, + false, + firstLba + 5, + 2048, + 0, + 1, + false, + _dev.Timeout, + out _); _dumpLog.WriteLine(Localization.Core.Checking_if_drive_supports_READ_16); UpdateStatus?.Invoke(Localization.Core.Checking_if_drive_supports_READ_16); - read16 = !_dev.Read16(out cmdBuf, out _, 0, false, true, false, firstLba, 2048, 0, 1, false, - _dev.Timeout, out _) || - !_dev.Read16(out cmdBuf, out _, 0, false, true, false, firstLba + 5, 2048, 0, 1, false, - _dev.Timeout, out _); + read16 = + !_dev.Read16(out cmdBuf, + out _, + 0, + false, + true, + false, + firstLba, + 2048, + 0, + 1, + false, + _dev.Timeout, + out _) || + !_dev.Read16(out cmdBuf, + out _, + 0, + false, + true, + false, + firstLba + 5, + 2048, + 0, + 1, + false, + _dev.Timeout, + out _); switch(read6) { @@ -498,10 +583,10 @@ sealed partial class Dump ErrorMessage?.Invoke(Localization.Core.Output_format_does_not_support_pregaps_continuing); } - for(var t = 1; t < tracks.Length; t++) tracks[t - 1].EndSector = tracks[t].StartSector - 1; + for(int t = 1; t < tracks.Length; t++) tracks[t - 1].EndSector = tracks[t].StartSector - 1; - tracks[^1].EndSector = (ulong) lastSector; - blocks = (ulong) (lastSector + 1); + tracks[^1].EndSector = (ulong)lastSector; + blocks = (ulong)(lastSector + 1); if(blocks == 0) { @@ -589,7 +674,7 @@ sealed partial class Dump Tuple[] dataExtentsArray = dataExtents.ToArray(); - for(var i = 0; i < dataExtentsArray.Length - 1; i++) + for(int i = 0; i < dataExtentsArray.Length - 1; i++) leadOutExtents.Add(dataExtentsArray[i].Item2 + 1, dataExtentsArray[i + 1].Item1 - 1); } @@ -624,14 +709,14 @@ sealed partial class Dump List trkList = [ - new Track + new() { - Sequence = (uint) (tracks.Any(t => t.Sequence == 1) ? 0 : 1), + Sequence = (uint)(tracks.Any(t => t.Sequence == 1) ? 0 : 1), Session = 1, Type = hiddenData ? TrackType.Data : TrackType.Audio, StartSector = 0, - BytesPerSector = (int) sectorSize, - RawBytesPerSector = (int) sectorSize, + BytesPerSector = (int)sectorSize, + RawBytesPerSector = (int)sectorSize, SubchannelType = subType, EndSector = tracks.First(t => t.Sequence >= 1).StartSector - 1 } @@ -688,7 +773,7 @@ sealed partial class Dump continue; } - var bufOffset = 0; + int bufOffset = 0; while(cmdBuf[0 + bufOffset] != 0x00 || cmdBuf[1 + bufOffset] != 0xFF || @@ -900,8 +985,7 @@ sealed partial class Dump } else if(read6) { - sense = _dev.Read6(out cmdBuf, out _, firstLba, blockSize, (byte) _maximumReadable, _dev.Timeout, - out _); + sense = _dev.Read6(out cmdBuf, out _, firstLba, blockSize, (byte)_maximumReadable, _dev.Timeout, out _); if(_dev.Error || sense) _maximumReadable /= 2; } @@ -918,7 +1002,7 @@ sealed partial class Dump _dev.LastError)); } - var cdiWithHiddenTrack1 = false; + bool cdiWithHiddenTrack1 = false; if(dskType is MediaType.CDIREADY && tracks.Min(t => t.Sequence) == 1) { @@ -1066,11 +1150,11 @@ sealed partial class Dump { foreach(Track trk in tracks) { - sense = _dev.ReadIsrc((byte) trk.Sequence, out string isrc, out _, out _, _dev.Timeout, out _); + sense = _dev.ReadIsrc((byte)trk.Sequence, out string isrc, out _, out _, _dev.Timeout, out _); if(sense || isrc is null or "000000000000") continue; - isrcs[(byte) trk.Sequence] = isrc; + isrcs[(byte)trk.Sequence] = isrc; UpdateStatus?.Invoke(string.Format(Localization.Core.Found_ISRC_for_track_0_1, trk.Sequence, isrc)); _dumpLog.WriteLine(string.Format(Localization.Core.Found_ISRC_for_track_0_1, trk.Sequence, isrc)); @@ -1086,8 +1170,9 @@ sealed partial class Dump foreach(int sub in _resume.BadSubchannels) subchannelExtents.Add(sub); if(_resume.NextBlock < blocks) - for(ulong i = _resume.NextBlock; i < blocks; i++) - subchannelExtents.Add((int) i); + { + for(ulong i = _resume.NextBlock; i < blocks; i++) subchannelExtents.Add((int)i); + } } if(_resume.NextBlock > 0) @@ -1191,7 +1276,7 @@ sealed partial class Dump offsetBytes = driveOffset.Value; - sectorsForOffset = offsetBytes / (int) sectorSize; + sectorsForOffset = offsetBytes / (int)sectorSize; if(sectorsForOffset < 0) sectorsForOffset *= -1; @@ -1201,7 +1286,7 @@ sealed partial class Dump else { offsetBytes = combinedOffset.Value; - sectorsForOffset = offsetBytes / (int) sectorSize; + sectorsForOffset = offsetBytes / (int)sectorSize; if(sectorsForOffset < 0) sectorsForOffset *= -1; @@ -1291,7 +1376,7 @@ sealed partial class Dump if(_speed is 0 or > 0xFFFF) _speed = 0xFFFF; - _dev.SetCdSpeed(out _, RotationalControl.ClvAndImpureCav, (ushort) _speed, 0, _dev.Timeout, out _); + _dev.SetCdSpeed(out _, RotationalControl.ClvAndImpureCav, (ushort)_speed, 0, _dev.Timeout, out _); } // Start reading @@ -1351,7 +1436,7 @@ sealed partial class Dump if(cdiReadyReadAsAudio) { offsetBytes = combinedOffset.Value; - sectorsForOffset = offsetBytes / (int) sectorSize; + sectorsForOffset = offsetBytes / (int)sectorSize; if(sectorsForOffset < 0) sectorsForOffset *= -1; @@ -1576,8 +1661,9 @@ sealed partial class Dump supportsLongSectors); foreach(Tuple leadoutExtent in leadOutExtents.ToArray()) - for(ulong e = leadoutExtent.Item1; e <= leadoutExtent.Item2; e++) - subchannelExtents.Remove((int) e); + { + for(ulong e = leadoutExtent.Item1; e <= leadoutExtent.Item2; e++) subchannelExtents.Remove((int)e); + } if(subchannelExtents.Count > 0 && _retryPasses > 0 && _retrySubchannel) { @@ -1686,7 +1772,7 @@ sealed partial class Dump if(trk.Sequence == 1) continue; trk.StartSector -= trk.Pregap; - trk.Indexes[0] = (int) trk.StartSector; + trk.Indexes[0] = (int)trk.StartSector; continue; } diff --git a/Aaru.Core/Devices/Dumping/CompactDisc/Error.cs b/Aaru.Core/Devices/Dumping/CompactDisc/Error.cs index 61a1e917e..90632a2e5 100644 --- a/Aaru.Core/Devices/Dumping/CompactDisc/Error.cs +++ b/Aaru.Core/Devices/Dumping/CompactDisc/Error.cs @@ -42,11 +42,11 @@ using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Extents; using Aaru.CommonTypes.Interfaces; using Aaru.CommonTypes.Structs.Devices.SCSI; -using Aaru.Console; using Aaru.Core.Logging; using Aaru.Decoders.CD; using Aaru.Decoders.SCSI; using Aaru.Devices; +using Aaru.Logging; using Track = Aaru.CommonTypes.Structs.Track; using TrackType = Aaru.CommonTypes.Enums.TrackType; @@ -80,7 +80,7 @@ partial class Dump ref string mcn, HashSet subchannelExtents, Dictionary smallestPregapLbaPerTrack, bool supportsLongSectors) { - var sense = true; // Sense indicator + bool sense = true; // Sense indicator byte[] cmdBuf = null; // Data buffer double cmdDuration; // Command execution time const uint sectorSize = 2352; // Full sector size @@ -98,9 +98,9 @@ partial class Dump if(_resume.BadBlocks.Count <= 0 || _aborted || _retryPasses <= 0) return; - var pass = 1; - var forward = true; - var runningPersistent = false; + int pass = 1; + bool forward = true; + bool runningPersistent = false; Modes.ModePage? currentModePage = null; byte[] md6; @@ -221,7 +221,7 @@ partial class Dump ulong[] tmpArray = _resume.BadBlocks.ToArray(); List sectorsNotEvenPartial = []; - for(var i = 0; i < tmpArray.Length; i++) + for(int i = 0; i < tmpArray.Length; i++) { ulong badSector = tmpArray[i]; @@ -259,7 +259,7 @@ partial class Dump Track track = tracks.OrderBy(t => t.StartSector).LastOrDefault(t => badSector >= t.StartSector); byte sectorsToReRead = 1; - var badSectorToReRead = (uint)badSector; + uint badSectorToReRead = (uint)badSector; if(_fixOffset && audioExtents.Contains(badSector) && offsetBytes != 0) { @@ -425,7 +425,7 @@ partial class Dump { case 0: - for(var c = 16; c < 2352; c++) + for(int c = 16; c < 2352; c++) { if(cmdBuf[c] == 0x00) continue; @@ -469,9 +469,8 @@ partial class Dump // MEDIUM ERROR, retry with ignore error below if(decSense is { ASC: 0x11 }) - { - if(!sectorsNotEvenPartial.Contains(badSector)) sectorsNotEvenPartial.Add(badSector); - } + if(!sectorsNotEvenPartial.Contains(badSector)) + sectorsNotEvenPartial.Add(badSector); } // Because one block has been partially used to fix the offset @@ -508,8 +507,8 @@ partial class Dump if(supportedSubchannel != MmcSubchannel.None) { - var data = new byte[sectorSize]; - var sub = new byte[subSize]; + byte[] data = new byte[sectorSize]; + byte[] sub = new byte[subSize]; Array.Copy(cmdBuf, 0, data, 0, sectorSize); Array.Copy(cmdBuf, sectorSize, sub, 0, subSize); @@ -612,7 +611,7 @@ partial class Dump InitProgress?.Invoke(); - for(var i = 0; i < sectorsNotEvenPartial.Count; i++) + for(int i = 0; i < sectorsNotEvenPartial.Count; i++) { ulong badSector = sectorsNotEvenPartial[i]; @@ -662,8 +661,8 @@ partial class Dump if(supportedSubchannel != MmcSubchannel.None) { - var data = new byte[sectorSize]; - var sub = new byte[subSize]; + byte[] data = new byte[sectorSize]; + byte[] sub = new byte[subSize]; Array.Copy(cmdBuf, 0, data, 0, sectorSize); Array.Copy(cmdBuf, sectorSize, sub, 0, subSize); @@ -749,7 +748,7 @@ partial class Dump Dictionary isrcs, ref string mcn, HashSet subchannelExtents, Dictionary smallestPregapLbaPerTrack) { - var sense = true; // Sense indicator + bool sense = true; // Sense indicator byte[] cmdBuf = null; // Data buffer double cmdDuration; // Command execution time byte[] senseBuf = null; // Sense buffer @@ -768,8 +767,8 @@ partial class Dump if(_aborted) return; - var pass = 1; - var forward = true; + int pass = 1; + bool forward = true; InitProgress?.Invoke(); @@ -785,7 +784,7 @@ partial class Dump foreach(int bs in tmpArray) { - var badSector = (uint)bs; + uint badSector = (uint)bs; Track track = tracks.OrderBy(t => t.StartSector).LastOrDefault(t => badSector >= t.StartSector); diff --git a/Aaru.Core/Devices/Dumping/CompactDisc/Pregap.cs b/Aaru.Core/Devices/Dumping/CompactDisc/Pregap.cs index 2dce0682a..ebb404fbd 100644 --- a/Aaru.Core/Devices/Dumping/CompactDisc/Pregap.cs +++ b/Aaru.Core/Devices/Dumping/CompactDisc/Pregap.cs @@ -42,9 +42,9 @@ using Aaru.Checksums; using Aaru.CommonTypes; using Aaru.CommonTypes.Enums; using Aaru.CommonTypes.Structs; -using Aaru.Console; using Aaru.Core.Logging; using Aaru.Devices; +using Aaru.Logging; using Humanizer; using Humanizer.Bytes; @@ -66,8 +66,8 @@ partial class Dump byte[] cmdBuf; // Data buffer double cmdDuration; // Command execution time ulong sectorSpeedStart = 0; // Used to calculate correct speed - var gotFirstTrackPregap = false; - var firstTrackPregapSectorsGood = 0; + bool gotFirstTrackPregap = false; + int firstTrackPregapSectorsGood = 0; var firstTrackPregapMs = new MemoryStream(); _dumpLog.WriteLine(Localization.Core.Reading_first_track_pregap); @@ -164,7 +164,7 @@ partial class Dump bool supportsPqSubchannel, bool supportsRwSubchannel, Database.Models.Device dbDev, out bool inexactPositioning, bool dumping) { - var sense = true; // Sense indicator + bool sense = true; // Sense indicator byte[] subBuf = null; int posQ; uint retries; @@ -211,10 +211,10 @@ partial class Dump // Initialize the dictionary foreach(Track t in tracks) pregaps[t.Sequence] = 0; - for(var t = 0; t < tracks.Length; t++) + for(int t = 0; t < tracks.Length; t++) { Track track = tracks[t]; - var trackRetries = 0; + int trackRetries = 0; // First track of each session has at least 150 sectors of pregap and is not always readable if(tracks.Where(trk => trk.Session == track.Session).MinBy(trk => trk.Sequence).Sequence == track.Sequence) @@ -245,14 +245,14 @@ partial class Dump AaruConsole.DebugWriteLine(PREGAP_MODULE_NAME, Localization.Core.Track_0, track.Sequence); int lba = (int)track.StartSector - 1; - var pregapFound = false; + bool pregapFound = false; Track previousTrack = tracks.FirstOrDefault(trk => trk.Sequence == track.Sequence - 1); - var goneBack = false; - var goFront = false; - var forward = false; - var crcOk = false; - var previousPregapIsPreviousTrack = false; + bool goneBack = false; + bool goFront = false; + bool forward = false; + bool crcOk = false; + bool previousPregapIsPreviousTrack = false; // Check if pregap is 0 for(retries = 0; retries < 10 && !pregapFound; retries++) @@ -315,7 +315,7 @@ partial class Dump subBuf[6] = 0; // Fix BCD numbering - for(var i = 1; i < 10; i++) + for(int i = 1; i < 10; i++) { if((subBuf[i] & 0xF0) > 0xA0) subBuf[i] &= 0x7F; @@ -442,7 +442,7 @@ partial class Dump subBuf[6] = 0; // Fix BCD numbering - for(var i = 1; i < 10; i++) + for(int i = 1; i < 10; i++) { if((subBuf[i] & 0xF0) > 0xA0) subBuf[i] &= 0x7F; @@ -668,7 +668,7 @@ partial class Dump if(dumping) { // Minus five, to ensure dumping will fix if there is a pregap LBA 0 - var red = 5; + int red = 5; while(trk.Pregap > 0 && red > 0) { @@ -784,7 +784,7 @@ partial class Dump if(!sense) { - var tmpBuf = new byte[96]; + byte[] tmpBuf = new byte[96]; Array.Copy(cmdBuf, 2352, tmpBuf, 0, 96); subBuf = DeinterleaveQ(tmpBuf); } @@ -988,10 +988,10 @@ partial class Dump /// De-interleaved Q subchannel static byte[] DeinterleaveQ(byte[] subchannel) { - var q = new int[subchannel.Length / 8]; + int[] q = new int[subchannel.Length / 8]; // De-interlace Q subchannel - for(var iq = 0; iq < subchannel.Length; iq += 8) + for(int iq = 0; iq < subchannel.Length; iq += 8) { q[iq / 8] = (subchannel[iq] & 0x40) << 1; q[iq / 8] += subchannel[iq + 1] & 0x40; @@ -1003,9 +1003,9 @@ partial class Dump q[iq / 8] += (subchannel[iq + 7] & 0x40) >> 6; } - var deQ = new byte[q.Length]; + byte[] deQ = new byte[q.Length]; - for(var iq = 0; iq < q.Length; iq++) deQ[iq] = (byte)q[iq]; + for(int iq = 0; iq < q.Length; iq++) deQ[iq] = (byte)q[iq]; return deQ; } diff --git a/Aaru.Core/Devices/Dumping/MiniDisc.cs b/Aaru.Core/Devices/Dumping/MiniDisc.cs index 14b7aeb96..da4622b4f 100644 --- a/Aaru.Core/Devices/Dumping/MiniDisc.cs +++ b/Aaru.Core/Devices/Dumping/MiniDisc.cs @@ -42,11 +42,11 @@ using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Enums; using Aaru.CommonTypes.Extents; using Aaru.CommonTypes.Interfaces; -using Aaru.Console; using Aaru.Core.Graphics; using Aaru.Core.Logging; using Aaru.Decoders.SCSI; using Aaru.Devices; +using Aaru.Logging; using Humanizer; using Humanizer.Bytes; using Humanizer.Localisation; @@ -250,7 +250,7 @@ partial class Dump if(decMode?.Pages != null) { - var setGeometry = false; + bool setGeometry = false; foreach(Modes.ModePage page in decMode.Value.Pages) { @@ -362,7 +362,7 @@ partial class Dump _mediaGraph?.PaintSectorsBad(_resume.BadBlocks); } - var newTrim = false; + bool newTrim = false; _speedStopwatch.Reset(); ulong sectorSpeedStart = 0; InitProgress?.Invoke(); @@ -541,9 +541,9 @@ partial class Dump if(_resume.BadBlocks.Count > 0 && !_aborted && _retryPasses > 0) { - var pass = 1; - var forward = true; - var runningPersistent = false; + int pass = 1; + bool forward = true; + bool runningPersistent = false; Modes.ModePage? currentModePage = null; byte[] md6; diff --git a/Aaru.Core/Devices/Dumping/PlayStationPortable/MemoryStick.cs b/Aaru.Core/Devices/Dumping/PlayStationPortable/MemoryStick.cs index 40d7c0c0a..c29aeb540 100644 --- a/Aaru.Core/Devices/Dumping/PlayStationPortable/MemoryStick.cs +++ b/Aaru.Core/Devices/Dumping/PlayStationPortable/MemoryStick.cs @@ -42,11 +42,11 @@ using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Enums; using Aaru.CommonTypes.Extents; using Aaru.CommonTypes.Interfaces; -using Aaru.Console; using Aaru.Core.Graphics; using Aaru.Core.Logging; using Aaru.Decoders.SCSI; using Aaru.Devices; +using Aaru.Logging; using Humanizer; using Humanizer.Bytes; using Humanizer.Localisation; @@ -87,7 +87,7 @@ public partial class Dump return; } - var blocks = (uint)((readBuffer[0] << 24) + (readBuffer[1] << 16) + (readBuffer[2] << 8) + readBuffer[3]); + uint blocks = (uint)((readBuffer[0] << 24) + (readBuffer[1] << 16) + (readBuffer[2] << 8) + readBuffer[3]); blocks++; @@ -198,7 +198,7 @@ public partial class Dump _mediaGraph?.PaintSectorsBad(_resume.BadBlocks); } - var newTrim = false; + bool newTrim = false; _speedStopwatch.Restart(); ulong sectorSpeedStart = 0; @@ -402,9 +402,9 @@ public partial class Dump if(_resume.BadBlocks.Count > 0 && !_aborted && _retryPasses > 0) { - var pass = 1; - var forward = true; - var runningPersistent = false; + int pass = 1; + bool forward = true; + bool runningPersistent = false; Modes.ModePage? currentModePage = null; byte[] md6; diff --git a/Aaru.Core/Devices/Dumping/PlayStationPortable/UMD.cs b/Aaru.Core/Devices/Dumping/PlayStationPortable/UMD.cs index b9b42651a..ae59a5510 100644 --- a/Aaru.Core/Devices/Dumping/PlayStationPortable/UMD.cs +++ b/Aaru.Core/Devices/Dumping/PlayStationPortable/UMD.cs @@ -39,11 +39,11 @@ using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Enums; using Aaru.CommonTypes.Extents; using Aaru.CommonTypes.Interfaces; -using Aaru.Console; using Aaru.Core.Graphics; using Aaru.Core.Logging; using Aaru.Decoders.SCSI; using Aaru.Devices; +using Aaru.Logging; using Humanizer; using Humanizer.Bytes; using Humanizer.Localisation; @@ -97,11 +97,11 @@ public partial class Dump return; } - var fatStart = (ushort)((readBuffer[0x0F] << 8) + readBuffer[0x0E]); - var sectorsPerFat = (ushort)((readBuffer[0x17] << 8) + readBuffer[0x16]); - var rootStart = (ushort)(sectorsPerFat * 2 + fatStart); - var rootSize = (ushort)(((readBuffer[0x12] << 8) + readBuffer[0x11]) * 32 / 512); - var umdStart = (ushort)(rootStart + rootSize); + ushort fatStart = (ushort)((readBuffer[0x0F] << 8) + readBuffer[0x0E]); + ushort sectorsPerFat = (ushort)((readBuffer[0x17] << 8) + readBuffer[0x16]); + ushort rootStart = (ushort)(sectorsPerFat * 2 + fatStart); + ushort rootSize = (ushort)(((readBuffer[0x12] << 8) + readBuffer[0x11]) * 32 / 512); + ushort umdStart = (ushort)(rootStart + rootSize); UpdateStatus?.Invoke(string.Format(Localization.Core.Reading_root_directory_in_sector_0, rootStart)); _dumpLog.WriteLine(Localization.Core.Reading_root_directory_in_sector_0, rootStart); @@ -129,7 +129,7 @@ public partial class Dump return; } - var umdSizeInBytes = BitConverter.ToUInt32(readBuffer, 0x3C); + uint umdSizeInBytes = BitConverter.ToUInt32(readBuffer, 0x3C); ulong blocks = umdSizeInBytes / blockSize; string mediaPartNumber = Encoding.ASCII.GetString(readBuffer, 0, 11).Trim(); @@ -242,7 +242,7 @@ public partial class Dump _mediaGraph?.PaintSectorsBad(_resume.BadBlocks); } - var newTrim = false; + bool newTrim = false; _speedStopwatch.Reset(); ulong sectorSpeedStart = 0; @@ -443,9 +443,9 @@ public partial class Dump if(_resume.BadBlocks.Count > 0 && !_aborted && _retryPasses > 0) { - var pass = 1; - var forward = true; - var runningPersistent = false; + int pass = 1; + bool forward = true; + bool runningPersistent = false; Modes.ModePage? currentModePage = null; byte[] md6; diff --git a/Aaru.Core/Devices/Dumping/Sbc/Dump.cs b/Aaru.Core/Devices/Dumping/Sbc/Dump.cs index 957466075..153c777fa 100644 --- a/Aaru.Core/Devices/Dumping/Sbc/Dump.cs +++ b/Aaru.Core/Devices/Dumping/Sbc/Dump.cs @@ -42,7 +42,6 @@ using Aaru.CommonTypes.Enums; using Aaru.CommonTypes.Extents; using Aaru.CommonTypes.Interfaces; using Aaru.CommonTypes.Structs.Devices.SCSI; -using Aaru.Console; using Aaru.Core.Devices.Report; using Aaru.Core.Graphics; using Aaru.Core.Logging; @@ -52,6 +51,7 @@ using Aaru.Decoders.DVD; using Aaru.Decoders.SCSI; using Aaru.Decoders.SCSI.MMC; using Aaru.Devices; +using Aaru.Logging; using Humanizer; using Humanizer.Bytes; using Humanizer.Localisation; @@ -59,7 +59,6 @@ using DVDDecryption = Aaru.Decryption.DVD.Dump; using Track = Aaru.CommonTypes.Structs.Track; using TrackType = Aaru.CommonTypes.Enums.TrackType; using Version = Aaru.CommonTypes.Interop.Version; -using Aaru.Decoders.DVD; // ReSharper disable JoinDeclarationAndInitializer @@ -79,7 +78,7 @@ partial class Dump bool sense; byte scsiMediumType = 0; byte scsiDensityCode = 0; - var containsFloppyPage = false; + bool containsFloppyPage = false; const ushort sbcProfile = 0x0001; double totalDuration = 0; double currentSpeed = 0; @@ -388,8 +387,8 @@ partial class Dump _private, _dimensions); - var ibgLog = new IbgLog(_outputPrefix + ".ibg", sbcProfile); - var imageCreated = false; + var ibgLog = new IbgLog(_outputPrefix + ".ibg", sbcProfile); + bool imageCreated = false; if(!opticalDisc) { @@ -413,7 +412,7 @@ partial class Dump _dumpStopwatch.Restart(); double imageWriteDuration = 0; - var writeSingleOpticalTrack = true; + bool writeSingleOpticalTrack = true; if(opticalDisc) { @@ -630,7 +629,7 @@ partial class Dump } else if(decMode?.Pages != null) { - var setGeometry = false; + bool setGeometry = false; foreach(Modes.ModePage page in decMode.Value.Pages) { @@ -810,7 +809,7 @@ partial class Dump if(_resume?.BlankExtents != null) blankExtents = ExtentsConverter.FromMetadata(_resume.BlankExtents); - var newTrim = false; + bool newTrim = false; if(mediaTags.TryGetValue(MediaTagType.DVD_CMI, out byte[] cmi) && Settings.Settings.Current.EnableDecryption && diff --git a/Aaru.Core/Devices/Dumping/Sbc/Error.cs b/Aaru.Core/Devices/Dumping/Sbc/Error.cs index 3a28d9f2b..ae42e49e5 100644 --- a/Aaru.Core/Devices/Dumping/Sbc/Error.cs +++ b/Aaru.Core/Devices/Dumping/Sbc/Error.cs @@ -31,12 +31,12 @@ using Aaru.CommonTypes.Enums; using Aaru.CommonTypes.Extents; using Aaru.CommonTypes.Interfaces; using Aaru.CommonTypes.Structs.Devices.SCSI; -using Aaru.Console; using Aaru.Decoders.DVD; using Aaru.Decoders.SCSI; using Aaru.Decryption; using Aaru.Decryption.DVD; using Aaru.Devices; +using Aaru.Logging; using DVDDecryption = Aaru.Decryption.DVD.Dump; // ReSharper disable JoinDeclarationAndInitializer @@ -56,9 +56,9 @@ partial class Dump void RetrySbcData(Reader scsiReader, DumpHardware currentTry, ExtentsULong extents, ref double totalDuration, ExtentsULong blankExtents, byte[] discKey) { - var pass = 1; - var forward = true; - var runningPersistent = false; + int pass = 1; + bool forward = true; + bool runningPersistent = false; bool sense; byte[] buffer; bool recoveredError; @@ -66,7 +66,7 @@ partial class Dump byte[] md6; byte[] md10; bool blankCheck; - var newBlank = false; + bool newBlank = false; var outputFormat = _outputPlugin as IWritableImage; if(_persistent) @@ -344,7 +344,8 @@ partial class Dump if(errno != ErrorNumber.NoError) { - ErrorMessage?.Invoke(string.Format(Localization.Core.Error_retrieving_title_key_for_sector_0, + ErrorMessage?.Invoke(string.Format(Localization.Core + .Error_retrieving_title_key_for_sector_0, badSector)); } else @@ -404,8 +405,8 @@ partial class Dump void RetryTitleKeys(DVDDecryption dvdDecrypt, byte[] discKey, ref double totalDuration) { - var pass = 1; - var forward = true; + int pass = 1; + bool forward = true; bool sense; byte[] buffer; diff --git a/Aaru.Core/Devices/Dumping/Sbc/Optical.cs b/Aaru.Core/Devices/Dumping/Sbc/Optical.cs index 21fe7dfee..3779b8191 100644 --- a/Aaru.Core/Devices/Dumping/Sbc/Optical.cs +++ b/Aaru.Core/Devices/Dumping/Sbc/Optical.cs @@ -7,10 +7,10 @@ using System.Linq; using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Extents; using Aaru.CommonTypes.Interfaces; -using Aaru.Console; using Aaru.Core.Logging; using Aaru.Decoders.SCSI; using Aaru.Helpers; +using Aaru.Logging; using Humanizer; using Humanizer.Bytes; @@ -53,7 +53,7 @@ partial class Dump bool sense; byte[] buffer; ulong sectorSpeedStart = 0; - var canMediumScan = true; + bool canMediumScan = true; var outputFormat = _outputPlugin as IWritableImage; InitProgress?.Invoke(); @@ -182,8 +182,9 @@ partial class Dump writtenExtents.Add(0, blocks - 1); foreach(Tuple blank in blankExtents.ToArray()) - for(ulong b = blank.Item1; b <= blank.Item2; b++) - writtenExtents.Remove(b); + { + for(ulong b = blank.Item1; b <= blank.Item2; b++) writtenExtents.Remove(b); + } } if(writtenExtents.Count == 0) diff --git a/Aaru.Core/Devices/Dumping/XGD.cs b/Aaru.Core/Devices/Dumping/XGD.cs index 630255210..bb72b728b 100644 --- a/Aaru.Core/Devices/Dumping/XGD.cs +++ b/Aaru.Core/Devices/Dumping/XGD.cs @@ -42,13 +42,13 @@ using Aaru.CommonTypes.Extents; using Aaru.CommonTypes.Interfaces; using Aaru.CommonTypes.Interop; using Aaru.CommonTypes.Structs.Devices.SCSI; -using Aaru.Console; using Aaru.Core.Graphics; using Aaru.Core.Logging; using Aaru.Decoders.DVD; using Aaru.Decoders.SCSI; using Aaru.Decoders.Xbox; using Aaru.Devices; +using Aaru.Logging; using Humanizer; using Humanizer.Bytes; using Humanizer.Localisation; @@ -157,7 +157,7 @@ partial class Dump return; } - var tmpBuf = new byte[ssBuf.Length - 4]; + byte[] tmpBuf = new byte[ssBuf.Length - 4]; Array.Copy(ssBuf, 4, tmpBuf, 0, ssBuf.Length - 4); mediaTags.Add(MediaTagType.Xbox_SecuritySector, tmpBuf); @@ -528,7 +528,7 @@ partial class Dump if(_skip < blocksToRead) _skip = blocksToRead; - var ret = true; + bool ret = true; foreach(MediaTagType tag in mediaTags.Keys.Where(tag => !outputFormat.SupportedMediaTags.Contains(tag))) { @@ -644,7 +644,7 @@ partial class Dump _dumpLog.WriteLine(Localization.Core.Resuming_from_block_0, _resume.NextBlock); } - var newTrim = false; + bool newTrim = false; _dumpLog.WriteLine(Localization.Core.Reading_game_partition); UpdateStatus?.Invoke(Localization.Core.Reading_game_partition); @@ -652,7 +652,7 @@ partial class Dump ulong sectorSpeedStart = 0; InitProgress?.Invoke(); - for(var e = 0; e <= 16; e++) + for(int e = 0; e <= 16; e++) { if(_aborted) { @@ -1146,14 +1146,15 @@ partial class Dump List tmpList = []; foreach(ulong ur in _resume.BadBlocks) - for(ulong i = ur; i < ur + blocksToRead; i++) - tmpList.Add(i); + { + for(ulong i = ur; i < ur + blocksToRead; i++) tmpList.Add(i); + } tmpList.Sort(); - var pass = 1; - var forward = true; - var runningPersistent = false; + int pass = 1; + bool forward = true; + bool runningPersistent = false; _resume.BadBlocks = tmpList; Modes.ModePage? currentModePage = null; diff --git a/Aaru.Core/Devices/Info/DeviceInfo.cs b/Aaru.Core/Devices/Info/DeviceInfo.cs index 3a9fe5e59..a81180ddf 100644 --- a/Aaru.Core/Devices/Info/DeviceInfo.cs +++ b/Aaru.Core/Devices/Info/DeviceInfo.cs @@ -35,13 +35,13 @@ using System; using System.Collections.Generic; using Aaru.CommonTypes.Enums; using Aaru.CommonTypes.Structs.Devices.SCSI; -using Aaru.Console; using Aaru.Decoders.ATA; using Aaru.Decoders.DVD; using Aaru.Decoders.SCSI; using Aaru.Decryption; using Aaru.Devices; using Aaru.Helpers; +using Aaru.Logging; using DVDDecryption = Aaru.Decryption.DVD.Dump; using Inquiry = Aaru.CommonTypes.Structs.Devices.SCSI.Inquiry; @@ -330,8 +330,8 @@ public partial class DeviceInfo if(dev.Manufacturer == "PLEXTOR") { - var plxtSense = true; - var plxtDvd = false; + bool plxtSense = true; + bool plxtDvd = false; byte[] plxtBuf = null; switch(dev.Model) diff --git a/Aaru.Core/Devices/ReaderATA.cs b/Aaru.Core/Devices/ReaderATA.cs index 9019cd15f..33a3dd78b 100644 --- a/Aaru.Core/Devices/ReaderATA.cs +++ b/Aaru.Core/Devices/ReaderATA.cs @@ -32,8 +32,8 @@ using System; using Aaru.CommonTypes.Enums; -using Aaru.Console; using Aaru.Decoders.ATA; +using Aaru.Logging; using Identify = Aaru.CommonTypes.Structs.Devices.ATA.Identify; namespace Aaru.Core.Devices; @@ -106,7 +106,7 @@ sealed partial class Reader if(Blocks == 0) GetDeviceBlocks(); bool sense; - var tries = 0; + int tries = 0; uint lba = 0; ushort cyl = 0; byte head = 0; @@ -264,7 +264,7 @@ sealed partial class Reader return false; } - var error = true; + bool error = true; while(IsLba) { @@ -325,7 +325,7 @@ sealed partial class Reader bool AtaReadBlocks(out byte[] buffer, ulong block, uint count, out double duration, out bool recoveredError) { - var error = true; + bool error = true; bool sense; AtaErrorRegistersLba28 errorLba; AtaErrorRegistersLba48 errorLba48; @@ -403,7 +403,7 @@ sealed partial class Reader bool AtaReadChs(out byte[] buffer, ushort cylinder, byte head, byte sector, out double duration, out bool recoveredError) { - var error = true; + bool error = true; bool sense; AtaErrorRegistersChs errorChs; byte status = 0, errorByte = 0; diff --git a/Aaru.Core/Devices/ReaderSCSI.cs b/Aaru.Core/Devices/ReaderSCSI.cs index 843a97dbb..ee4679a7c 100644 --- a/Aaru.Core/Devices/ReaderSCSI.cs +++ b/Aaru.Core/Devices/ReaderSCSI.cs @@ -32,8 +32,8 @@ using System; using Aaru.CommonTypes.Structs.Devices.SCSI; -using Aaru.Console; using Aaru.Decoders.SCSI; +using Aaru.Logging; namespace Aaru.Core.Devices; @@ -54,8 +54,8 @@ sealed partial class Reader // TODO: Raw reading public bool HldtstReadRaw; - public bool LiteOnReadRaw; public uint layerbreak; + public bool LiteOnReadRaw; public bool otp; ulong ScsiGetBlocks() => ScsiGetBlockSize() ? 0 : Blocks; @@ -67,9 +67,9 @@ sealed partial class Reader if(Blocks == 0) return true; byte[] senseBuf; - var tries = 0; + int tries = 0; uint lba = 0; - var mediumScan = false; + bool mediumScan = false; if(_dev.ScsiType == PeripheralDeviceTypes.OpticalDevice) { @@ -661,7 +661,7 @@ sealed partial class Reader return true; case false: { - var temp = new byte[8]; + byte[] temp = new byte[8]; Array.Copy(cmdBuf, 0, temp, 0, 8); Array.Reverse(temp); @@ -927,7 +927,7 @@ sealed partial class Reader bool ScsiSeek(ulong block, out double duration) { - var sense = true; + bool sense = true; duration = 0; if(_seek6) diff --git a/Aaru.Core/Devices/Report/ATA.cs b/Aaru.Core/Devices/Report/ATA.cs index eb9eeaaaf..dbd91f20a 100644 --- a/Aaru.Core/Devices/Report/ATA.cs +++ b/Aaru.Core/Devices/Report/ATA.cs @@ -32,9 +32,9 @@ using System; using Aaru.CommonTypes.Metadata; -using Aaru.Console; using Aaru.Decoders.ATA; using Aaru.Devices; +using Aaru.Logging; using Spectre.Console; using Identify = Aaru.CommonTypes.Structs.Devices.ATA.Identify; @@ -46,7 +46,7 @@ public sealed partial class DeviceReport /// Media report public TestedMedia ReportAtaMedia() { - var sense = true; + bool sense = true; AtaErrorRegistersChs errorChs = new(); AtaErrorRegistersLba28 errorLba = new(); AtaErrorRegistersLba48 errorLba48 = new(); @@ -181,7 +181,7 @@ public sealed partial class DeviceReport mediaTest.Manufacturer = ataId.MediaManufacturer; } - var checkCorrectRead = BitConverter.ToUInt64(buffer, 0); + ulong checkCorrectRead = BitConverter.ToUInt64(buffer, 0); Spectre.ProgressSingleSpinner(ctx => { @@ -535,7 +535,7 @@ public sealed partial class DeviceReport /// Creates a report of an ATA device public TestedMedia ReportAta(Identify.IdentifyDevice ataId) { - var sense = true; + bool sense = true; byte[] readBuf = []; AtaErrorRegistersChs errorChs = new(); AtaErrorRegistersLba28 errorLba = new(); @@ -998,7 +998,7 @@ public sealed partial class DeviceReport /// IDENTIFY ATA DEVICE response without the private fields public static byte[] ClearIdentify(byte[] buffer) { - var empty = new byte[512]; + byte[] empty = new byte[512]; Array.Copy(empty, 0, buffer, 20, 20); Array.Copy(empty, 0, buffer, 216, 8); diff --git a/Aaru.Core/Devices/Report/GdRomSwapTrick.cs b/Aaru.Core/Devices/Report/GdRomSwapTrick.cs index e7541e12c..7bfbda6f9 100644 --- a/Aaru.Core/Devices/Report/GdRomSwapTrick.cs +++ b/Aaru.Core/Devices/Report/GdRomSwapTrick.cs @@ -36,10 +36,10 @@ using System; using System.Linq; using System.Threading; using Aaru.CommonTypes.Metadata; -using Aaru.Console; using Aaru.Decoders.CD; using Aaru.Decoders.SCSI; using Aaru.Devices; +using Aaru.Logging; namespace Aaru.Core.Devices.Report; @@ -58,7 +58,7 @@ public sealed partial class DeviceReport AaruConsole.Write(Localization.Core .Have_you_previously_tried_with_a_GD_ROM_disc_and_did_the_computer_hang_or_crash_Q); - pressedKey = System.Console.ReadKey(); + pressedKey = Console.ReadKey(); AaruConsole.WriteLine(); } @@ -76,11 +76,11 @@ public sealed partial class DeviceReport AaruConsole.WriteLine(Localization.Core.Please_insert_trap_disc_inside); AaruConsole.WriteLine(Localization.Core.Press_any_key_to_continue); - System.Console.ReadLine(); + Console.ReadLine(); AaruConsole.WriteLine(Localization.Core.Sending_READ_FULL_TOC_to_the_device); - var retries = 0; + int retries = 0; bool sense; byte[] buffer; byte[] senseBuffer; @@ -139,8 +139,8 @@ public sealed partial class DeviceReport return; } - int min = 0, sec, frame; - var tocIsNotBcd = false; + int min = 0, sec, frame; + bool tocIsNotBcd = false; report.GdRomSwapDiscCapabilities.SwapDiscLeadOutPMIN = leadOutTrack.PMIN; report.GdRomSwapDiscCapabilities.SwapDiscLeadOutPSEC = leadOutTrack.PSEC; @@ -194,7 +194,7 @@ public sealed partial class DeviceReport AaruConsole.WriteLine(Localization.Core.Please_MANUALLY_get_the_trap_disc_out_and_put_the_GD_ROM_disc_inside); AaruConsole.WriteLine(Localization.Core.Press_any_key_to_continue); - System.Console.ReadLine(); + Console.ReadLine(); AaruConsole.WriteLine(Localization.Core.Waiting_5_seconds); Thread.Sleep(5000); @@ -1743,16 +1743,16 @@ public sealed partial class DeviceReport ? Localization.Core.Success : Localization.Core.FAIL); - if(report.GdRomSwapDiscCapabilities.Lba45000Readable == false && - report.GdRomSwapDiscCapabilities.Lba50000Readable == false && - report.GdRomSwapDiscCapabilities.Lba100000Readable == false && - report.GdRomSwapDiscCapabilities.Lba400000Readable == false && - report.GdRomSwapDiscCapabilities.Lba450000Readable == false && - report.GdRomSwapDiscCapabilities.Lba45000AudioReadable == false && - report.GdRomSwapDiscCapabilities.Lba50000AudioReadable == false && - report.GdRomSwapDiscCapabilities.Lba100000AudioReadable == false && - report.GdRomSwapDiscCapabilities.Lba400000AudioReadable == false && - report.GdRomSwapDiscCapabilities.Lba450000AudioReadable == false) + if(!report.GdRomSwapDiscCapabilities.Lba45000Readable && + !report.GdRomSwapDiscCapabilities.Lba50000Readable && + !report.GdRomSwapDiscCapabilities.Lba100000Readable && + !report.GdRomSwapDiscCapabilities.Lba400000Readable && + !report.GdRomSwapDiscCapabilities.Lba450000Readable && + !report.GdRomSwapDiscCapabilities.Lba45000AudioReadable && + !report.GdRomSwapDiscCapabilities.Lba50000AudioReadable && + !report.GdRomSwapDiscCapabilities.Lba100000AudioReadable && + !report.GdRomSwapDiscCapabilities.Lba400000AudioReadable && + !report.GdRomSwapDiscCapabilities.Lba450000AudioReadable) return; pressedKey = new ConsoleKeyInfo(); @@ -1761,19 +1761,19 @@ public sealed partial class DeviceReport { AaruConsole.Write(Localization.Core.Test_read_whole_high_density_area_proceed_Q); - pressedKey = System.Console.ReadKey(); + pressedKey = Console.ReadKey(); AaruConsole.WriteLine(); } if(pressedKey.Key == ConsoleKey.N) return; uint startingSector = 45000; - var readAsAudio = false; - var aborted = false; + bool readAsAudio = false; + bool aborted = false; MmcSubchannel subchannel = MmcSubchannel.None; uint blockSize = 2352; - if(report.GdRomSwapDiscCapabilities.Lba45000Readable == false) + if(!report.GdRomSwapDiscCapabilities.Lba45000Readable) { startingSector = 45000; readAsAudio = false; @@ -1783,7 +1783,7 @@ public sealed partial class DeviceReport subchannel = MmcSubchannel.Raw; else if(report.GdRomSwapDiscCapabilities.Lba45000PqReadable) subchannel = MmcSubchannel.Q16; } - else if(report.GdRomSwapDiscCapabilities.Lba50000Readable == false) + else if(!report.GdRomSwapDiscCapabilities.Lba50000Readable) { startingSector = 50000; readAsAudio = false; @@ -1793,7 +1793,7 @@ public sealed partial class DeviceReport subchannel = MmcSubchannel.Raw; else if(report.GdRomSwapDiscCapabilities.Lba50000PqReadable) subchannel = MmcSubchannel.Q16; } - else if(report.GdRomSwapDiscCapabilities.Lba100000Readable == false) + else if(!report.GdRomSwapDiscCapabilities.Lba100000Readable) { startingSector = 100000; readAsAudio = false; @@ -1803,7 +1803,7 @@ public sealed partial class DeviceReport subchannel = MmcSubchannel.Raw; else if(report.GdRomSwapDiscCapabilities.Lba100000PqReadable) subchannel = MmcSubchannel.Q16; } - else if(report.GdRomSwapDiscCapabilities.Lba400000Readable == false) + else if(!report.GdRomSwapDiscCapabilities.Lba400000Readable) { startingSector = 400000; readAsAudio = false; @@ -1813,7 +1813,7 @@ public sealed partial class DeviceReport subchannel = MmcSubchannel.Raw; else if(report.GdRomSwapDiscCapabilities.Lba400000PqReadable) subchannel = MmcSubchannel.Q16; } - else if(report.GdRomSwapDiscCapabilities.Lba450000Readable == false) + else if(!report.GdRomSwapDiscCapabilities.Lba450000Readable) { startingSector = 450000; readAsAudio = false; @@ -1823,7 +1823,7 @@ public sealed partial class DeviceReport subchannel = MmcSubchannel.Raw; else if(report.GdRomSwapDiscCapabilities.Lba450000PqReadable) subchannel = MmcSubchannel.Q16; } - else if(report.GdRomSwapDiscCapabilities.Lba45000AudioReadable == false) + else if(!report.GdRomSwapDiscCapabilities.Lba45000AudioReadable) { startingSector = 45000; readAsAudio = true; @@ -1833,7 +1833,7 @@ public sealed partial class DeviceReport subchannel = MmcSubchannel.Raw; else if(report.GdRomSwapDiscCapabilities.Lba45000AudioPqReadable) subchannel = MmcSubchannel.Q16; } - else if(report.GdRomSwapDiscCapabilities.Lba50000AudioReadable == false) + else if(!report.GdRomSwapDiscCapabilities.Lba50000AudioReadable) { startingSector = 50000; readAsAudio = true; @@ -1843,7 +1843,7 @@ public sealed partial class DeviceReport subchannel = MmcSubchannel.Raw; else if(report.GdRomSwapDiscCapabilities.Lba50000AudioPqReadable) subchannel = MmcSubchannel.Q16; } - else if(report.GdRomSwapDiscCapabilities.Lba100000AudioReadable == false) + else if(!report.GdRomSwapDiscCapabilities.Lba100000AudioReadable) { startingSector = 100000; readAsAudio = true; @@ -1853,7 +1853,7 @@ public sealed partial class DeviceReport subchannel = MmcSubchannel.Raw; else if(report.GdRomSwapDiscCapabilities.Lba100000AudioPqReadable) subchannel = MmcSubchannel.Q16; } - else if(report.GdRomSwapDiscCapabilities.Lba400000AudioReadable == false) + else if(!report.GdRomSwapDiscCapabilities.Lba400000AudioReadable) { startingSector = 400000; readAsAudio = true; @@ -1863,7 +1863,7 @@ public sealed partial class DeviceReport subchannel = MmcSubchannel.Raw; else if(report.GdRomSwapDiscCapabilities.Lba400000AudioPqReadable) subchannel = MmcSubchannel.Q16; } - else if(report.GdRomSwapDiscCapabilities.Lba450000AudioReadable == false) + else if(!report.GdRomSwapDiscCapabilities.Lba450000AudioReadable) { startingSector = 450000; readAsAudio = true; @@ -1874,7 +1874,7 @@ public sealed partial class DeviceReport else if(report.GdRomSwapDiscCapabilities.Lba450000AudioPqReadable) subchannel = MmcSubchannel.Q16; } - System.Console.CancelKeyPress += (_, e) => + Console.CancelKeyPress += (_, e) => { e.Cancel = true; aborted = true; @@ -1896,7 +1896,7 @@ public sealed partial class DeviceReport byte[] lastSuccessfulPq = null; byte[] lastSuccessfulRw = null; - var trackModeChange = false; + bool trackModeChange = false; AaruConsole.WriteLine(); diff --git a/Aaru.Core/Devices/Report/MMC.cs b/Aaru.Core/Devices/Report/MMC.cs index 336749427..6b7a7162d 100644 --- a/Aaru.Core/Devices/Report/MMC.cs +++ b/Aaru.Core/Devices/Report/MMC.cs @@ -34,12 +34,12 @@ using System; using System.Linq; using System.Text; using Aaru.CommonTypes.Metadata; -using Aaru.Console; using Aaru.Decoders.CD; using Aaru.Decoders.SCSI; using Aaru.Decoders.SCSI.MMC; using Aaru.Devices; using Aaru.Helpers; +using Aaru.Logging; using Spectre.Console; namespace Aaru.Core.Devices.Report; @@ -52,8 +52,8 @@ public sealed partial class DeviceReport while(offset + 4 < response.Length) { - var code = (ushort)((response[offset + 0] << 8) + response[offset + 1]); - var data = new byte[response[offset + 3] + 4]; + ushort code = (ushort)((response[offset + 0] << 8) + response[offset + 1]); + byte[] data = new byte[response[offset + 3] + 4]; if(code != 0x0108) { @@ -75,7 +75,7 @@ public sealed partial class DeviceReport /// MMC features report public MmcFeatures ReportMmcFeatures() { - var sense = true; + bool sense = true; byte[] buffer = []; Spectre.ProgressSingleSpinner(ctx => @@ -477,7 +477,7 @@ public sealed partial class DeviceReport if(ftr010C.HasValue) { - var temp = new byte[4]; + byte[] temp = new byte[4]; temp[0] = (byte)((ftr010C.Value.Century & 0xFF00) >> 8); temp[1] = (byte)(ftr010C.Value.Century & 0xFF); temp[2] = (byte)((ftr010C.Value.Year & 0xFF00) >> 8); @@ -579,7 +579,7 @@ public sealed partial class DeviceReport public TestedMedia ReportMmcMedia(string mediaType, bool tryPlextor, bool tryPioneer, bool tryNec, bool tryHldtst, bool tryMediaTekF106, bool tryLiteOn) { - var sense = true; + bool sense = true; byte[] buffer = []; byte[] senseBuffer = []; var mediaTest = new TestedMedia(); @@ -610,7 +610,7 @@ public sealed partial class DeviceReport if(!sense && !_dev.Error) { mediaTest.SupportsReadCapacity16 = true; - var temp = new byte[8]; + byte[] temp = new byte[8]; Array.Copy(buffer, 0, temp, 0, 8); Array.Reverse(temp); mediaTest.Blocks = BitConverter.ToUInt64(temp, 0) + 1; @@ -2779,8 +2779,8 @@ public sealed partial class DeviceReport if(tryMediaTekF106) { - var triedLba0 = false; - var triedLeadOut = false; + bool triedLba0 = false; + bool triedLeadOut = false; Spectre.ProgressSingleSpinner(ctx => { @@ -3099,16 +3099,16 @@ public sealed partial class DeviceReport secondSessionFirstTrack.PFRAME); // Skip Lead-Out pre-gap - var firstSessionLeadOutLba = (uint)(firstSessionLeadOutTrack.PMIN * 60 * 75 + - firstSessionLeadOutTrack.PSEC * 75 + - firstSessionLeadOutTrack.PFRAME + - 150); + uint firstSessionLeadOutLba = (uint)(firstSessionLeadOutTrack.PMIN * 60 * 75 + + firstSessionLeadOutTrack.PSEC * 75 + + firstSessionLeadOutTrack.PFRAME + + 150); // Skip second session track pre-gap - var secondSessionLeadInLba = (uint)(secondSessionFirstTrack.PMIN * 60 * 75 + - secondSessionFirstTrack.PSEC * 75 + - secondSessionFirstTrack.PFRAME - - 300); + uint secondSessionLeadInLba = (uint)(secondSessionFirstTrack.PMIN * 60 * 75 + + secondSessionFirstTrack.PSEC * 75 + + secondSessionFirstTrack.PFRAME - + 300); Spectre.ProgressSingleSpinner(ctx => { diff --git a/Aaru.Core/Devices/Report/Scsi.cs b/Aaru.Core/Devices/Report/Scsi.cs index 8d2933b74..4547be174 100644 --- a/Aaru.Core/Devices/Report/Scsi.cs +++ b/Aaru.Core/Devices/Report/Scsi.cs @@ -35,10 +35,10 @@ using System.Collections.Generic; using System.Linq; using Aaru.CommonTypes.Metadata; using Aaru.CommonTypes.Structs.Devices.SCSI; -using Aaru.Console; using Aaru.Decoders.SCSI; using Aaru.Devices; using Aaru.Helpers; +using Aaru.Logging; using Spectre.Console; using Inquiry = Aaru.CommonTypes.Structs.Devices.SCSI.Inquiry; @@ -50,7 +50,7 @@ public sealed partial class DeviceReport /// SCSI report public Scsi ReportScsiInquiry() { - var sense = true; + bool sense = true; byte[] buffer = []; Spectre.ProgressSingleSpinner(ctx => @@ -85,7 +85,7 @@ public sealed partial class DeviceReport return inquiry; // Clear Seagate serial number - for(var i = 36; i <= 43; i++) inquiry[i] = 0; + for(int i = 36; i <= 43; i++) inquiry[i] = 0; return inquiry; } @@ -95,7 +95,7 @@ public sealed partial class DeviceReport /// List of decoded SCSI EVPD pages public List ReportEvpdPages(string vendor) { - var sense = false; + bool sense = false; byte[] buffer = []; Spectre.ProgressSingleSpinner(ctx => @@ -135,7 +135,7 @@ public sealed partial class DeviceReport break; case 0x80: - var identify = new byte[512]; + byte[] identify = new byte[512]; Array.Copy(buffer, 60, identify, 0, 512); identify = ClearIdentify(identify); Array.Copy(identify, 0, buffer, 60, 512); @@ -184,7 +184,7 @@ public sealed partial class DeviceReport if(pageResponse.Length < 6) return null; - var position = 4; + int position = 4; while(position < pageResponse.Length) { @@ -192,7 +192,7 @@ public sealed partial class DeviceReport if(length + position + 4 >= pageResponse.Length) length = (byte)(pageResponse.Length - position - 4); - var empty = new byte[length]; + byte[] empty = new byte[length]; Array.Copy(empty, 0, pageResponse, position + 4, length); position += 4 + length; @@ -226,7 +226,7 @@ public sealed partial class DeviceReport ScsiModeSensePageControl.Changeable }) { - var saveBuffer = false; + bool saveBuffer = false; sense = _dev.ModeSense10(out byte[] mode10Buffer, out _, @@ -335,7 +335,7 @@ public sealed partial class DeviceReport ScsiModeSensePageControl.Changeable }) { - var saveBuffer = false; + bool saveBuffer = false; sense = _dev.ModeSense6(out byte[] mode6Buffer, out _, @@ -511,7 +511,7 @@ public sealed partial class DeviceReport public TestedMedia ReportScsiMedia() { var mediaTest = new TestedMedia(); - var sense = true; + bool sense = true; byte[] buffer = []; byte[] senseBuffer = []; @@ -541,7 +541,7 @@ public sealed partial class DeviceReport if(!sense && !_dev.Error) { mediaTest.SupportsReadCapacity16 = true; - var temp = new byte[8]; + byte[] temp = new byte[8]; Array.Copy(buffer, 0, temp, 0, 8); Array.Reverse(temp); mediaTest.Blocks = BitConverter.ToUInt64(temp, 0) + 1; @@ -883,7 +883,7 @@ public sealed partial class DeviceReport /// Media report public TestedMedia ReportScsi() { - var sense = true; + bool sense = true; byte[] buffer = []; byte[] senseBuffer = []; @@ -918,7 +918,7 @@ public sealed partial class DeviceReport if(!sense && !_dev.Error) { capabilities.SupportsReadCapacity16 = true; - var temp = new byte[8]; + byte[] temp = new byte[8]; Array.Copy(buffer, 0, temp, 0, 8); Array.Reverse(temp); capabilities.Blocks = BitConverter.ToUInt64(temp, 0) + 1; diff --git a/Aaru.Core/Devices/Report/SecureDigital.cs b/Aaru.Core/Devices/Report/SecureDigital.cs index 0409c6d79..06e1aa6eb 100644 --- a/Aaru.Core/Devices/Report/SecureDigital.cs +++ b/Aaru.Core/Devices/Report/SecureDigital.cs @@ -32,7 +32,7 @@ using Aaru.CommonTypes.Enums; using Aaru.CommonTypes.Metadata; -using Aaru.Console; +using Aaru.Logging; using Spectre.Console; namespace Aaru.Core.Devices.Report; @@ -44,7 +44,7 @@ public sealed partial class DeviceReport public MmcSd MmcSdReport() { var report = new MmcSd(); - var sense = true; + bool sense = true; byte[] cid = []; byte[] csd = []; byte[] ecsd = []; diff --git a/Aaru.Core/Devices/Scanning/SCSI.cs b/Aaru.Core/Devices/Scanning/SCSI.cs index d4c2bae07..c17c8e8a4 100644 --- a/Aaru.Core/Devices/Scanning/SCSI.cs +++ b/Aaru.Core/Devices/Scanning/SCSI.cs @@ -33,12 +33,12 @@ using System; using System.Threading; using Aaru.CommonTypes.Structs.Devices.SCSI; -using Aaru.Console; using Aaru.Core.Logging; using Aaru.Decoders.CD; using Aaru.Decoders.SCSI; using Aaru.Decoders.SCSI.MMC; using Aaru.Devices; +using Aaru.Logging; using Humanizer; using Humanizer.Bytes; @@ -56,8 +56,8 @@ public sealed partial class MediaScan bool sense; uint blockSize = 0; ushort currentProfile = 0x0001; - var foundReadCommand = false; - var readcd = false; + bool foundReadCommand = false; + bool readcd = false; results.Blocks = 0; @@ -76,7 +76,7 @@ public sealed partial class MediaScan { case 0x3A: { - var leftRetries = 5; + int leftRetries = 5; while(leftRetries > 0) { @@ -100,7 +100,7 @@ public sealed partial class MediaScan } case 0x04 when decSense.Value.ASCQ == 0x01: { - var leftRetries = 10; + int leftRetries = 10; while(leftRetries > 0) { @@ -128,7 +128,7 @@ public sealed partial class MediaScan // These should be trapped by the OS but seems in some cases they're not case 0x28: { - var leftRetries = 10; + int leftRetries = 10; while(leftRetries > 0) { @@ -219,7 +219,7 @@ public sealed partial class MediaScan return results; } - var compactDisc = true; + bool compactDisc = true; FullTOC.CDFullTOC? toc = null; if(_dev.ScsiType == PeripheralDeviceTypes.MultiMediaDevice) @@ -646,11 +646,11 @@ public sealed partial class MediaScan InitProgress?.Invoke(); - for(var i = 0; i < seekTimes; i++) + for(int i = 0; i < seekTimes; i++) { if(_aborted || !_seekTest) break; - var seekPos = (uint)rnd.Next((int)results.Blocks); + uint seekPos = (uint)rnd.Next((int)results.Blocks); PulseProgress?.Invoke(string.Format(Localization.Core.Seeking_to_sector_0, seekPos)); diff --git a/Aaru.Core/Entropy.cs b/Aaru.Core/Entropy.cs index e67cca058..ea421817e 100644 --- a/Aaru.Core/Entropy.cs +++ b/Aaru.Core/Entropy.cs @@ -38,7 +38,7 @@ using Aaru.CommonTypes; using Aaru.CommonTypes.Enums; using Aaru.CommonTypes.Interfaces; using Aaru.CommonTypes.Structs; -using Aaru.Console; +using Aaru.Logging; namespace Aaru.Core; @@ -109,7 +109,7 @@ public sealed class Entropy currentTrack.Sequence, inputTracks.Max(t => t.Sequence)); - var entTable = new ulong[256]; + ulong[] entTable = new ulong[256]; ulong trackSize = 0; List uniqueSectorsPerTrack = []; @@ -195,7 +195,7 @@ public sealed class Entropy if(_inputFormat is not IMediaImage mediaImage) return entropy; - var entTable = new ulong[256]; + ulong[] entTable = new ulong[256]; ulong diskSize = 0; List uniqueSectors = []; @@ -254,8 +254,8 @@ public sealed class Entropy if(_inputFormat is not IByteAddressableImage byteAddressableImage) return entropy; - var entTable = new ulong[256]; - var data = new byte[byteAddressableImage.Info.Sectors]; + ulong[] entTable = new ulong[256]; + byte[] data = new byte[byteAddressableImage.Info.Sectors]; entropy.Sectors = _inputFormat.Info.Sectors; AaruConsole.WriteLine(Localization.Core._0_bytes, entropy.Sectors); @@ -273,7 +273,7 @@ public sealed class Entropy if(bytesRead != data.Length) { - var tmp = new byte[bytesRead]; + byte[] tmp = new byte[bytesRead]; Array.Copy(data, 0, tmp, 0, bytesRead); data = tmp; } diff --git a/Aaru.Core/Filesystems.cs b/Aaru.Core/Filesystems.cs index cd3781da1..dd144dcca 100644 --- a/Aaru.Core/Filesystems.cs +++ b/Aaru.Core/Filesystems.cs @@ -35,7 +35,7 @@ using System.Collections.Generic; using System.Linq; using Aaru.CommonTypes; using Aaru.CommonTypes.Interfaces; -using Aaru.Console; +using Aaru.Logging; namespace Aaru.Core; diff --git a/Aaru.Core/ImageFormat.cs b/Aaru.Core/ImageFormat.cs index 3b02212fe..a32eba69c 100644 --- a/Aaru.Core/ImageFormat.cs +++ b/Aaru.Core/ImageFormat.cs @@ -33,7 +33,7 @@ using System; using Aaru.CommonTypes; using Aaru.CommonTypes.Interfaces; -using Aaru.Console; +using Aaru.Logging; namespace Aaru.Core; diff --git a/Aaru.Core/ImageInfo.cs b/Aaru.Core/ImageInfo.cs index e90c7ec6e..cea5a618d 100644 --- a/Aaru.Core/ImageInfo.cs +++ b/Aaru.Core/ImageInfo.cs @@ -41,7 +41,6 @@ using Aaru.CommonTypes.Enums; using Aaru.CommonTypes.Interfaces; using Aaru.CommonTypes.Structs; using Aaru.CommonTypes.Structs.Devices.SCSI; -using Aaru.Console; using Aaru.Decoders.ATA; using Aaru.Decoders.Bluray; using Aaru.Decoders.CD; @@ -50,6 +49,7 @@ using Aaru.Decoders.PCMCIA; using Aaru.Decoders.SCSI; using Aaru.Decoders.Xbox; using Aaru.Helpers; +using Aaru.Logging; using Humanizer; using Humanizer.Bytes; using Spectre.Console; @@ -427,7 +427,7 @@ public static class ImageInfo if(dataLen + 2 != toc.Length) { - var tmp = new byte[toc.Length + 2]; + byte[] tmp = new byte[toc.Length + 2]; Array.Copy(toc, 0, tmp, 2, toc.Length); tmp[0] = (byte)((toc.Length & 0xFF00) >> 8); tmp[1] = (byte)(toc.Length & 0xFF); @@ -450,7 +450,7 @@ public static class ImageInfo if(dataLen + 2 != pma.Length) { - var tmp = new byte[pma.Length + 2]; + byte[] tmp = new byte[pma.Length + 2]; Array.Copy(pma, 0, tmp, 2, pma.Length); tmp[0] = (byte)((pma.Length & 0xFF00) >> 8); tmp[1] = (byte)(pma.Length & 0xFF); @@ -475,7 +475,7 @@ public static class ImageInfo if(dataLen + 4 != atip.Length) { - var tmp = new byte[atip.Length + 4]; + byte[] tmp = new byte[atip.Length + 4]; Array.Copy(atip, 0, tmp, 4, atip.Length); tmp[0] = (byte)((atip.Length & 0xFF000000) >> 24); tmp[1] = (byte)((atip.Length & 0xFF0000) >> 16); @@ -502,7 +502,7 @@ public static class ImageInfo if(dataLen + 4 != cdtext.Length) { - var tmp = new byte[cdtext.Length + 4]; + byte[] tmp = new byte[cdtext.Length + 4]; Array.Copy(cdtext, 0, tmp, 4, cdtext.Length); tmp[0] = (byte)((cdtext.Length & 0xFF000000) >> 24); tmp[1] = (byte)((cdtext.Length & 0xFF0000) >> 16); diff --git a/Aaru.Core/Media/Detection/MMC.cs b/Aaru.Core/Media/Detection/MMC.cs index f834fef76..1e956a294 100644 --- a/Aaru.Core/Media/Detection/MMC.cs +++ b/Aaru.Core/Media/Detection/MMC.cs @@ -39,7 +39,6 @@ using System.Linq; using System.Text; using Aaru.Checksums; using Aaru.CommonTypes; -using Aaru.Console; using Aaru.Decoders.Bluray; using Aaru.Decoders.CD; using Aaru.Decoders.DVD; @@ -47,6 +46,7 @@ using Aaru.Decoders.SCSI.MMC; using Aaru.Decoders.Sega; using Aaru.Devices; using Aaru.Helpers; +using Aaru.Logging; using DMI = Aaru.Decoders.Xbox.DMI; using Sector = Aaru.Decoders.CD.Sector; @@ -126,7 +126,7 @@ public static class MMC byte[] syncMark = [0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00]; - var testMark = new byte[12]; + byte[] testMark = new byte[12]; Array.Copy(sector, 0, testMark, 0, 12); return syncMark.SequenceEqual(testMark) && (sector[0xF] == 0 || sector[0xF] == 1 || sector[0xF] == 2); @@ -140,9 +140,9 @@ public static class MMC byte[] syncMark = [0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00]; - var testMark = new byte[12]; + byte[] testMark = new byte[12]; - for(var i = 0; i <= 2336; i++) + for(int i = 0; i <= 2336; i++) { Array.Copy(sector, i, testMark, 0, 12); @@ -176,7 +176,7 @@ public static class MMC static byte[] DescrambleAndFixOffset(byte[] sector, int offsetBytes, int sectorsForOffset) { - var descrambled = new byte[2352]; + byte[] descrambled = new byte[2352]; int offsetFix = offsetBytes < 0 ? 2352 * sectorsForOffset + offsetBytes : offsetBytes; @@ -199,7 +199,7 @@ public static class MMC if(!isData || sector0[0xF] != 2 && sector0[0xF] != 1) return false; - var testMark = new byte[4]; + byte[] testMark = new byte[4]; Array.Copy(sector16, 24, testMark, 0, 4); return cdiMark.SequenceEqual(testMark); @@ -209,13 +209,13 @@ public static class MMC { if(videoFrame is null || videoFrame.Length < _videoNowColorFrameMarker.Length) return false; - var buffer = new byte[_videoNowColorFrameMarker.Length]; + byte[] buffer = new byte[_videoNowColorFrameMarker.Length]; - for(var framePosition = 0; framePosition + buffer.Length < videoFrame.Length; framePosition++) + for(int framePosition = 0; framePosition + buffer.Length < videoFrame.Length; framePosition++) { Array.Copy(videoFrame, framePosition, buffer, 0, buffer.Length); - for(var ab = 9; ab < buffer.Length; ab += 10) buffer[ab] = 0; + for(int ab = 9; ab < buffer.Length; ab += 10) buffer[ab] = 0; if(!_videoNowColorFrameMarker.SequenceEqual(buffer)) continue; @@ -227,13 +227,13 @@ public static class MMC internal static int GetVideoNowColorOffset(byte[] data) { - var buffer = new byte[_videoNowColorFrameMarker.Length]; + byte[] buffer = new byte[_videoNowColorFrameMarker.Length]; - for(var framePosition = 0; framePosition + buffer.Length < data.Length; framePosition++) + for(int framePosition = 0; framePosition + buffer.Length < data.Length; framePosition++) { Array.Copy(data, framePosition, buffer, 0, buffer.Length); - for(var ab = 9; ab < buffer.Length; ab += 10) buffer[ab] = 0; + for(int ab = 9; ab < buffer.Length; ab += 10) buffer[ab] = 0; if(!_videoNowColorFrameMarker.SequenceEqual(buffer)) continue; @@ -331,10 +331,10 @@ public static class MMC if(mediaType is MediaType.CD or MediaType.CDROMXA) { - var hasDataTrack = false; - var hasAudioTrack = false; - var allFirstSessionTracksAreAudio = true; - var hasVideoTrack = false; + bool hasDataTrack = false; + bool hasAudioTrack = false; + bool allFirstSessionTracksAreAudio = true; + bool hasVideoTrack = false; if(decodedToc.HasValue) { @@ -370,11 +370,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); + uint startAddress = (uint)(track.PHOUR * 3600 * 75 + + track.PMIN * 60 * 75 + + track.PSEC * 75 + + track.PFRAME - + 150); if(startAddress < startOfFirstDataTrack) startOfFirstDataTrack = startAddress; @@ -488,11 +488,11 @@ public static class MMC FullTOC.TrackDataDescriptor secondSessionFirstTrackTrack = decodedToc.Value.TrackDescriptors.First(t => t.POINT == secondSessionFirstTrack); - var firstSectorSecondSessionFirstTrack = (uint)(secondSessionFirstTrackTrack.PHOUR * 3600 * 75 + - secondSessionFirstTrackTrack.PMIN * 60 * 75 + - secondSessionFirstTrackTrack.PSEC * 75 + - secondSessionFirstTrackTrack.PFRAME - - 150); + uint firstSectorSecondSessionFirstTrack = (uint)(secondSessionFirstTrackTrack.PHOUR * 3600 * 75 + + secondSessionFirstTrackTrack.PMIN * 60 * 75 + + secondSessionFirstTrackTrack.PSEC * 75 + + secondSessionFirstTrackTrack.PFRAME - + 150); sense = dev.ReadCd(out cmdBuf, out _, @@ -579,7 +579,7 @@ public static class MMC videoNowColorFrame = new byte[9 * 2352]; - for(var i = 0; i < 9; i++) + for(int i = 0; i < 9; i++) { sense = dev.ReadCd(out cmdBuf, out _, @@ -634,11 +634,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); + uint 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) @@ -707,8 +707,8 @@ public static class MMC if(combinedOffset % 2352 != 0) sectorsForOffset++; - var lba0 = 0; - var lba16 = 16; + int lba0 = 0; + int lba16 = 16; if(combinedOffset < 0) { @@ -1602,8 +1602,8 @@ public static class MMC isoSector[5] != 0x31) return; - var rootStart = BitConverter.ToUInt32(isoSector, 158); - var rootLength = BitConverter.ToUInt32(isoSector, 166); + uint rootStart = BitConverter.ToUInt32(isoSector, 158); + uint rootLength = BitConverter.ToUInt32(isoSector, 166); if(rootStart == 0 || rootLength == 0) return; @@ -1644,7 +1644,7 @@ public static class MMC if(isoSector.Length < 2048) return; - var rootPos = 0; + int rootPos = 0; uint pcdStart = 0; uint pcdLength = 0; @@ -1652,8 +1652,8 @@ public static class MMC rootPos < isoSector.Length && rootPos + isoSector[rootPos] <= isoSector.Length) { - int nameLen = isoSector[rootPos + 32]; - var tmpName = new byte[nameLen]; + int nameLen = isoSector[rootPos + 32]; + byte[] tmpName = new byte[nameLen]; Array.Copy(isoSector, rootPos + 33, tmpName, 0, nameLen); string name = StringHandlers.CToString(tmpName).ToUpperInvariant(); @@ -1705,7 +1705,7 @@ public static class MMC if(isoSector.Length < 2048) return; - for(var pi = 0; pi < pcdLength; pi++) + for(int pi = 0; pi < pcdLength; pi++) { int pcdPos = pi * 2048; uint infoPos = 0; @@ -1714,8 +1714,8 @@ public static class MMC pcdPos < isoSector.Length && pcdPos + isoSector[pcdPos] <= isoSector.Length) { - int nameLen = isoSector[pcdPos + 32]; - var tmpName = new byte[nameLen]; + int nameLen = isoSector[pcdPos + 32]; + byte[] tmpName = new byte[nameLen]; Array.Copy(isoSector, pcdPos + 33, tmpName, 0, nameLen); string name = StringHandlers.CToString(tmpName).ToUpperInvariant(); @@ -1750,7 +1750,7 @@ public static class MMC if(sense) break; - var systemId = new byte[8]; + byte[] systemId = new byte[8]; Array.Copy(isoSector, 0, systemId, 0, 8); string id = StringHandlers.CToString(systemId).TrimEnd(); @@ -1842,7 +1842,7 @@ public static class MMC // The decryption key is applied as XOR. As first byte is originally always NULL, it gives us the key :) byte decryptByte = ps2BootSectors[0]; - for(var i = 0; i < 0x6000; i++) ps2BootSectors[i] ^= decryptByte; + for(int i = 0; i < 0x6000; i++) ps2BootSectors[i] ^= decryptByte; string ps2BootSectorsHash = Sha256Context.Data(ps2BootSectors, out _); @@ -1863,7 +1863,7 @@ public static class MMC if(sector0 != null) { - var syncBytes = new byte[7]; + byte[] syncBytes = new byte[7]; Array.Copy(sector0, 0, syncBytes, 0, 7); if(_operaId.SequenceEqual(syncBytes)) @@ -1887,8 +1887,8 @@ public static class MMC if(playdia1 != null && playdia2 != null) { - var pd1 = new byte[_playdiaCopyright.Length]; - var pd2 = new byte[_playdiaCopyright.Length]; + byte[] pd1 = new byte[_playdiaCopyright.Length]; + byte[] pd2 = new byte[_playdiaCopyright.Length]; Array.Copy(playdia1, 38, pd1, 0, pd1.Length); Array.Copy(playdia2, 0, pd2, 0, pd1.Length); @@ -1905,7 +1905,7 @@ public static class MMC if(secondDataSectorNotZero != null) { - var pce = new byte[_pcEngineSignature.Length]; + byte[] pce = new byte[_pcEngineSignature.Length]; Array.Copy(secondDataSectorNotZero, 32, pce, 0, pce.Length); if(_pcEngineSignature.SequenceEqual(pce)) @@ -1920,7 +1920,7 @@ public static class MMC if(firstDataSectorNotZero != null) { - var pcfx = new byte[_pcFxSignature.Length]; + byte[] pcfx = new byte[_pcFxSignature.Length]; Array.Copy(firstDataSectorNotZero, 0, pcfx, 0, pcfx.Length); if(_pcFxSignature.SequenceEqual(pcfx)) @@ -1935,9 +1935,9 @@ public static class MMC if(firstTrackSecondSessionAudio != null) { - var jaguar = new byte[_atariSignature.Length]; + byte[] jaguar = new byte[_atariSignature.Length]; - for(var i = 0; i + jaguar.Length <= firstTrackSecondSessionAudio.Length; i += 2) + for(int i = 0; i + jaguar.Length <= firstTrackSecondSessionAudio.Length; i += 2) { Array.Copy(firstTrackSecondSessionAudio, i, jaguar, 0, jaguar.Length); @@ -1953,7 +1953,7 @@ public static class MMC if(firstTrackSecondSession?.Length >= 2336) { - var milcd = new byte[2048]; + byte[] milcd = new byte[2048]; Array.Copy(firstTrackSecondSession, 24, milcd, 0, 2048); if(Dreamcast.DecodeIPBin(milcd).HasValue) @@ -2000,13 +2000,13 @@ public static class MMC if(!sense) { - var cdg = false; - var cdeg = false; - var cdmidi = false; + bool cdg = false; + bool cdeg = false; + bool cdmidi = false; - for(var i = 0; i < 8; i++) + for(int i = 0; i < 8; i++) { - var tmpSub = new byte[96]; + byte[] tmpSub = new byte[96]; Array.Copy(subBuf, i * 96, tmpSub, 0, 96); DetectRwPackets(tmpSub, out bool cdgPacket, out bool cdegPacket, out bool cdmidiPacket); @@ -2121,8 +2121,8 @@ public static class MMC isoSector[5] != 0x31) return; - var rootStart = BitConverter.ToUInt32(isoSector, 158); - var rootLength = BitConverter.ToUInt32(isoSector, 166); + uint rootStart = BitConverter.ToUInt32(isoSector, 158); + uint rootLength = BitConverter.ToUInt32(isoSector, 166); if(rootStart == 0 || rootLength == 0) return; @@ -2173,7 +2173,7 @@ public static class MMC uint ps1Start = 0; uint ps1Length = 0; - for(var ri = 0; ri < rootLength; ri++) + for(int ri = 0; ri < rootLength; ri++) { int rootPos = ri * 2048; @@ -2181,8 +2181,8 @@ public static class MMC isoSector[rootPos] > 0 && rootPos + isoSector[rootPos] <= isoSector.Length) { - int nameLen = isoSector[rootPos + 32]; - var tmpName = new byte[nameLen]; + int nameLen = isoSector[rootPos + 32]; + byte[] tmpName = new byte[nameLen]; Array.Copy(isoSector, rootPos + 33, tmpName, 0, nameLen); string name = StringHandlers.CToString(tmpName).ToUpperInvariant(); @@ -2290,8 +2290,8 @@ public static class MMC { using var sr = new StringReader(iplTxt); - var correctNeoGeoCd = true; - var lineNumber = 0; + bool correctNeoGeoCd = true; + int lineNumber = 0; while(sr.Peek() > 0) { @@ -2429,7 +2429,7 @@ public static class MMC uint infoPos = 0; - for(var vi = 0; vi < vcdLength; vi++) + for(int vi = 0; vi < vcdLength; vi++) { int vcdPos = vi * 2048; @@ -2437,8 +2437,8 @@ public static class MMC isoSector[vcdPos] > 0 && vcdPos + isoSector[vcdPos] <= isoSector.Length) { - int nameLen = isoSector[vcdPos + 32]; - var tmpName = new byte[nameLen]; + int nameLen = isoSector[vcdPos + 32]; + byte[] tmpName = new byte[nameLen]; Array.Copy(isoSector, vcdPos + 33, tmpName, 0, nameLen); string name = StringHandlers.CToString(tmpName).ToUpperInvariant(); @@ -2474,7 +2474,7 @@ public static class MMC if(sense) break; - var systemId = new byte[8]; + byte[] systemId = new byte[8]; Array.Copy(isoSector, 0, systemId, 0, 8); string id = StringHandlers.CToString(systemId).TrimEnd(); @@ -2545,7 +2545,7 @@ public static class MMC uint infoPos = 0; - for(var pi = 0; pi < pcdLength; pi++) + for(int pi = 0; pi < pcdLength; pi++) { int pcdPos = pi * 2048; @@ -2553,8 +2553,8 @@ public static class MMC isoSector[pcdPos] > 0 && pcdPos + isoSector[pcdPos] <= isoSector.Length) { - int nameLen = isoSector[pcdPos + 32]; - var tmpName = new byte[nameLen]; + int nameLen = isoSector[pcdPos + 32]; + byte[] tmpName = new byte[nameLen]; Array.Copy(isoSector, pcdPos + 33, tmpName, 0, nameLen); string name = StringHandlers.CToString(tmpName).ToUpperInvariant(); @@ -2590,7 +2590,7 @@ public static class MMC if(sense) break; - var systemId = new byte[8]; + byte[] systemId = new byte[8]; Array.Copy(isoSector, 0, systemId, 0, 8); string id = StringHandlers.CToString(systemId).TrimEnd(); @@ -2728,7 +2728,7 @@ public static class MMC // The decryption key is applied as XOR. As first byte is originally always NULL, it gives us the key :) byte decryptByte = ps2BootSectors[0]; - for(var i = 0; i < 0x6000; i++) ps2BootSectors[i] ^= decryptByte; + for(int i = 0; i < 0x6000; i++) ps2BootSectors[i] ^= decryptByte; string ps2BootSectorsHash = Sha256Context.Data(ps2BootSectors, out _); @@ -2747,7 +2747,7 @@ public static class MMC if(sector1 != null) { - var tmp = new byte[_ps3Id.Length]; + byte[] tmp = new byte[_ps3Id.Length]; Array.Copy(sector1, 0, tmp, 0, tmp.Length); if(tmp.SequenceEqual(_ps3Id)) @@ -2801,7 +2801,7 @@ public static class MMC case "BDU": if(sector1 != null) { - var tmp = new byte[_ps5Id.Length]; + byte[] tmp = new byte[_ps5Id.Length]; Array.Copy(sector1, 1024, tmp, 0, tmp.Length); if(tmp.SequenceEqual(_ps5Id)) @@ -2834,20 +2834,20 @@ public static class MMC cdegPacket = false; cdmidiPacket = false; - var cdSubRwPack1 = new byte[24]; - var cdSubRwPack2 = new byte[24]; - var cdSubRwPack3 = new byte[24]; - var cdSubRwPack4 = new byte[24]; + byte[] cdSubRwPack1 = new byte[24]; + byte[] cdSubRwPack2 = new byte[24]; + byte[] cdSubRwPack3 = new byte[24]; + byte[] cdSubRwPack4 = new byte[24]; - var i = 0; + int i = 0; - for(var j = 0; j < 24; j++) cdSubRwPack1[j] = (byte)(subchannel[i++] & 0x3F); + for(int j = 0; j < 24; j++) cdSubRwPack1[j] = (byte)(subchannel[i++] & 0x3F); - for(var j = 0; j < 24; j++) cdSubRwPack2[j] = (byte)(subchannel[i++] & 0x3F); + for(int j = 0; j < 24; j++) cdSubRwPack2[j] = (byte)(subchannel[i++] & 0x3F); - for(var j = 0; j < 24; j++) cdSubRwPack3[j] = (byte)(subchannel[i++] & 0x3F); + for(int j = 0; j < 24; j++) cdSubRwPack3[j] = (byte)(subchannel[i++] & 0x3F); - for(var j = 0; j < 24; j++) cdSubRwPack4[j] = (byte)(subchannel[i++] & 0x3F); + for(int j = 0; j < 24; j++) cdSubRwPack4[j] = (byte)(subchannel[i++] & 0x3F); switch(cdSubRwPack1[0]) { diff --git a/Aaru.Core/Media/Info/ScsiInfo.cs b/Aaru.Core/Media/Info/ScsiInfo.cs index 72a3e6b0f..3b561c639 100644 --- a/Aaru.Core/Media/Info/ScsiInfo.cs +++ b/Aaru.Core/Media/Info/ScsiInfo.cs @@ -37,7 +37,6 @@ using System.Threading; using Aaru.CommonTypes; using Aaru.CommonTypes.Enums; using Aaru.CommonTypes.Structs.Devices.SCSI; -using Aaru.Console; using Aaru.Core.Media.Detection; using Aaru.Decoders.CD; using Aaru.Decoders.DVD; @@ -46,6 +45,7 @@ using Aaru.Decoders.SCSI.MMC; using Aaru.Decoders.SCSI.SSC; using Aaru.Decoders.Xbox; using Aaru.Devices; +using Aaru.Logging; using DeviceInfo = Aaru.Core.Devices.Info.DeviceInfo; using DMI = Aaru.Decoders.Xbox.DMI; using DVDDecryption = Aaru.Decryption.DVD.Dump; @@ -66,13 +66,13 @@ public sealed class ScsiInfo MediaType = MediaType.Unknown; MediaInserted = false; - var resets = 0; + int resets = 0; bool sense; byte[] cmdBuf; byte[] senseBuf; - var containsFloppyPage = false; - var sessions = 1; - var firstTrackLastSession = 1; + bool containsFloppyPage = false; + int sessions = 1; + int firstTrackLastSession = 1; if(dev.IsRemovable) { @@ -97,7 +97,7 @@ public sealed class ScsiInfo { case 0x3A: { - var leftRetries = 5; + int leftRetries = 5; while(leftRetries > 0) { @@ -121,7 +121,7 @@ public sealed class ScsiInfo } case 0x04 when decSense?.ASCQ == 0x01: { - var leftRetries = 10; + int leftRetries = 10; while(leftRetries > 0) { @@ -217,7 +217,7 @@ public sealed class ScsiInfo if(ReadCapacity16 != null) { - var temp = new byte[8]; + byte[] temp = new byte[8]; Array.Copy(cmdBuf, 0, temp, 0, 8); Array.Reverse(temp); diff --git a/Aaru.Core/Partitions.cs b/Aaru.Core/Partitions.cs index ca53e6e30..4ddc83cf9 100644 --- a/Aaru.Core/Partitions.cs +++ b/Aaru.Core/Partitions.cs @@ -35,7 +35,7 @@ using System.Linq; using Aaru.CommonTypes; using Aaru.CommonTypes.Interfaces; using Aaru.CommonTypes.Structs; -using Aaru.Console; +using Aaru.Logging; namespace Aaru.Core; diff --git a/Aaru.Core/PrintScsiModePages.cs b/Aaru.Core/PrintScsiModePages.cs index 4c1dca087..dab515506 100644 --- a/Aaru.Core/PrintScsiModePages.cs +++ b/Aaru.Core/PrintScsiModePages.cs @@ -31,9 +31,9 @@ // ****************************************************************************/ using Aaru.CommonTypes.Structs.Devices.SCSI; -using Aaru.Console; using Aaru.Decoders.SCSI; using Aaru.Helpers; +using Aaru.Logging; namespace Aaru.Core; diff --git a/Aaru.Core/Remote.cs b/Aaru.Core/Remote.cs index fc07b6ab0..2bbe287ba 100644 --- a/Aaru.Core/Remote.cs +++ b/Aaru.Core/Remote.cs @@ -41,10 +41,10 @@ using System.Text; using System.Text.Json; using System.Threading.Tasks; using Aaru.CommonTypes.Metadata; -using Aaru.Console; using Aaru.Database; using Aaru.Database.Models; using Aaru.Dto; +using Aaru.Logging; using Microsoft.EntityFrameworkCore; using Spectre.Console; using CdOffset = Aaru.Database.Models.CdOffset; diff --git a/Aaru.Core/Sidecar/BlockMedia.cs b/Aaru.Core/Sidecar/BlockMedia.cs index fc6b5d9d1..fcb96c4fd 100644 --- a/Aaru.Core/Sidecar/BlockMedia.cs +++ b/Aaru.Core/Sidecar/BlockMedia.cs @@ -40,11 +40,11 @@ using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Enums; using Aaru.CommonTypes.Interfaces; using Aaru.CommonTypes.Structs.Devices.ATA; -using Aaru.Console; using Aaru.Decoders.PCMCIA; using Aaru.Filters; using Aaru.Helpers; using Aaru.Images; +using Aaru.Logging; using Directory = System.IO.Directory; using File = System.IO.File; using MediaType = Aaru.CommonTypes.Metadata.MediaType; @@ -1026,7 +1026,7 @@ public sealed partial class Sidecar if(scpImage.ScpTracks.TryGetValue(t, out SuperCardPro.TrackHeader scpTrack)) { - var trackContents = + byte[] trackContents = new byte[scpTrack.Entries.Last().dataOffset + scpTrack.Entries.Last().trackLength - scpImage.Header.offsets[t] + @@ -1070,7 +1070,7 @@ public sealed partial class Sidecar string basename = Path.Combine(Path.GetDirectoryName(imagePath), Path.GetFileNameWithoutExtension(imagePath)); - var kfDir = false; + bool kfDir = false; if(_aborted) return; @@ -1143,7 +1143,7 @@ public sealed partial class Sidecar } Stream kfStream = kvp.Value.GetDataForkStream(); - var trackContents = new byte[kfStream.Length]; + byte[] trackContents = new byte[kfStream.Length]; kfStream.Position = 0; kfStream.EnsureRead(trackContents, 0, trackContents.Length); kfBlockTrackType.Size = (ulong)trackContents.Length; @@ -1235,7 +1235,7 @@ public sealed partial class Sidecar dfiImage.TrackLengths.TryGetValue(t, out long length)) { dfiBlockTrackType.Image.Offset = (ulong)offset; - var trackContents = new byte[length]; + byte[] trackContents = new byte[length]; dfiStream.Position = offset; dfiStream.EnsureRead(trackContents, 0, trackContents.Length); dfiBlockTrackType.Size = (ulong)trackContents.Length; diff --git a/Aaru.Core/Sidecar/Files.cs b/Aaru.Core/Sidecar/Files.cs index 2a1047ce5..02e53d5a9 100644 --- a/Aaru.Core/Sidecar/Files.cs +++ b/Aaru.Core/Sidecar/Files.cs @@ -37,7 +37,7 @@ using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Enums; using Aaru.CommonTypes.Interfaces; using Aaru.CommonTypes.Structs; -using Aaru.Console; +using Aaru.Logging; using Directory = Aaru.CommonTypes.AaruMetadata.Directory; using FileAttributes = Aaru.CommonTypes.Structs.FileAttributes; diff --git a/Aaru.Core/Sidecar/Sidecar.cs b/Aaru.Core/Sidecar/Sidecar.cs index 82cb1b80f..f146f0209 100644 --- a/Aaru.Core/Sidecar/Sidecar.cs +++ b/Aaru.Core/Sidecar/Sidecar.cs @@ -38,8 +38,8 @@ using Aaru.CommonTypes; using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Enums; using Aaru.CommonTypes.Interfaces; -using Aaru.Console; using Aaru.Helpers; +using Aaru.Logging; namespace Aaru.Core; diff --git a/Aaru.Core/Statistics.cs b/Aaru.Core/Statistics.cs index cb2e3d7f5..e09be8495 100644 --- a/Aaru.Core/Statistics.cs +++ b/Aaru.Core/Statistics.cs @@ -41,9 +41,9 @@ using System.Text.Json; using System.Threading.Tasks; using Aaru.CommonTypes.Interop; using Aaru.CommonTypes.Metadata; -using Aaru.Console; using Aaru.Database; using Aaru.Database.Models; +using Aaru.Logging; using Microsoft.Data.Sqlite; using Microsoft.EntityFrameworkCore; using Device = Aaru.Devices.Device; @@ -211,9 +211,9 @@ public static class Statistics dto.RemoteOperatingSystems = []; #if DEBUG - System.Console.WriteLine(Localization.Core.Uploading_statistics); + Console.WriteLine(Localization.Core.Uploading_statistics); #else - Aaru.Console.AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Core.Uploading_statistics); + Aaru.Logging.AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Core.Uploading_statistics); #endif using StringContent jsonContent = new(JsonSerializer.Serialize(dto, typeof(StatsDto), StatsDtoContext.Default), diff --git a/Aaru.Decoders/Aaru.Decoders.csproj b/Aaru.Decoders/Aaru.Decoders.csproj index f65942d13..964516ec6 100644 --- a/Aaru.Decoders/Aaru.Decoders.csproj +++ b/Aaru.Decoders/Aaru.Decoders.csproj @@ -34,7 +34,7 @@ - + diff --git a/Aaru.Decoders/Bluray/BCA.cs b/Aaru.Decoders/Bluray/BCA.cs index 0cf306a7c..5b27be904 100644 --- a/Aaru.Decoders/Bluray/BCA.cs +++ b/Aaru.Decoders/Bluray/BCA.cs @@ -33,8 +33,8 @@ using System; using System.Diagnostics.CodeAnalysis; using System.Text; -using Aaru.Console; using Aaru.Helpers; +using Aaru.Logging; namespace Aaru.Decoders.Bluray; diff --git a/Aaru.Decoders/Bluray/Cartridge.cs b/Aaru.Decoders/Bluray/Cartridge.cs index 2581a85b7..9c3d4b26c 100644 --- a/Aaru.Decoders/Bluray/Cartridge.cs +++ b/Aaru.Decoders/Bluray/Cartridge.cs @@ -33,8 +33,8 @@ using System; using System.Diagnostics.CodeAnalysis; using System.Text; -using Aaru.Console; using Aaru.Helpers; +using Aaru.Logging; namespace Aaru.Decoders.Bluray; diff --git a/Aaru.Decoders/Bluray/DDS.cs b/Aaru.Decoders/Bluray/DDS.cs index 0ba08de13..464411e1c 100644 --- a/Aaru.Decoders/Bluray/DDS.cs +++ b/Aaru.Decoders/Bluray/DDS.cs @@ -33,8 +33,8 @@ using System; using System.Diagnostics.CodeAnalysis; using System.Text; -using Aaru.Console; using Aaru.Helpers; +using Aaru.Logging; namespace Aaru.Decoders.Bluray; diff --git a/Aaru.Decoders/Bluray/DI.cs b/Aaru.Decoders/Bluray/DI.cs index 3e1d00072..fa83785e7 100644 --- a/Aaru.Decoders/Bluray/DI.cs +++ b/Aaru.Decoders/Bluray/DI.cs @@ -34,8 +34,8 @@ using System; using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; using System.Text; -using Aaru.Console; using Aaru.Helpers; +using Aaru.Logging; namespace Aaru.Decoders.Bluray; @@ -133,7 +133,7 @@ public static class DI Reserved2 = DIResponse[3] }; - var offset = 4; + int offset = 4; List units = []; while(true) @@ -231,7 +231,7 @@ public static class DI decoded.Units = new DiscInformationUnits[units.Count]; - for(var i = 0; i < units.Count; i++) decoded.Units[i] = units[i]; + for(int i = 0; i < units.Count; i++) decoded.Units[i] = units[i]; return decoded; } diff --git a/Aaru.Decoders/Bluray/Spare.cs b/Aaru.Decoders/Bluray/Spare.cs index 84f3ec736..7d9cd5e48 100644 --- a/Aaru.Decoders/Bluray/Spare.cs +++ b/Aaru.Decoders/Bluray/Spare.cs @@ -32,8 +32,8 @@ using System.Diagnostics.CodeAnalysis; using System.Text; -using Aaru.Console; using Aaru.Helpers; +using Aaru.Logging; namespace Aaru.Decoders.Bluray; diff --git a/Aaru.Decoders/CD/ATIP.cs b/Aaru.Decoders/CD/ATIP.cs index f7e77b579..44aa2c894 100644 --- a/Aaru.Decoders/CD/ATIP.cs +++ b/Aaru.Decoders/CD/ATIP.cs @@ -33,8 +33,8 @@ using System; using System.Diagnostics.CodeAnalysis; using System.Text; -using Aaru.Console; using Aaru.Helpers; +using Aaru.Logging; namespace Aaru.Decoders.CD; diff --git a/Aaru.Decoders/CD/CDTextOnLeadIn.cs b/Aaru.Decoders/CD/CDTextOnLeadIn.cs index aa93f1c0a..8b59ec26d 100644 --- a/Aaru.Decoders/CD/CDTextOnLeadIn.cs +++ b/Aaru.Decoders/CD/CDTextOnLeadIn.cs @@ -33,8 +33,8 @@ using System; using System.Diagnostics.CodeAnalysis; using System.Text; -using Aaru.Console; using Aaru.Helpers; +using Aaru.Logging; namespace Aaru.Decoders.CD; @@ -127,7 +127,7 @@ public static class CDTextOnLeadIn return null; } - for(var i = 0; i < (decoded.DataLength - 2) / 18; i++) + for(int i = 0; i < (decoded.DataLength - 2) / 18; i++) { decoded.DataPacks[i].HeaderID1 = CDTextResponse[0 + i * 18 + 4]; decoded.DataPacks[i].HeaderID2 = CDTextResponse[1 + i * 18 + 4]; diff --git a/Aaru.Decoders/CD/FullTOC.cs b/Aaru.Decoders/CD/FullTOC.cs index 62b3339f8..2cfa59bb2 100644 --- a/Aaru.Decoders/CD/FullTOC.cs +++ b/Aaru.Decoders/CD/FullTOC.cs @@ -36,8 +36,8 @@ using System.Linq; using System.Text; using Aaru.CommonTypes.Enums; using Aaru.CommonTypes.Structs; -using Aaru.Console; using Aaru.Helpers; +using Aaru.Logging; namespace Aaru.Decoders.CD; @@ -87,7 +87,7 @@ public static class FullTOC return null; } - for(var i = 0; i < (decoded.DataLength - 2) / 11; i++) + for(int i = 0; i < (decoded.DataLength - 2) / 11; i++) { decoded.TrackDescriptors[i].SessionNumber = CDFullTOCResponse[0 + i * 11 + 4]; decoded.TrackDescriptors[i].ADR = (byte)((CDFullTOCResponse[1 + i * 11 + 4] & 0xF0) >> 4); @@ -116,7 +116,7 @@ public static class FullTOC var sb = new StringBuilder(); - var lastSession = 0; + int lastSession = 0; sb.AppendFormat(Localization.First_complete_session_number_0, response.FirstCompleteSession).AppendLine(); sb.AppendFormat(Localization.Last_complete_session_number_0, response.LastCompleteSession).AppendLine(); @@ -642,7 +642,7 @@ public static class FullTOC case 6: { - var id = (uint)((descriptor.Min << 16) + (descriptor.Sec << 8) + descriptor.Frame); + uint id = (uint)((descriptor.Min << 16) + (descriptor.Sec << 8) + descriptor.Frame); sb.AppendFormat(Localization.Disc_ID_0_X6, id & 0x00FFFFFF).AppendLine(); break; diff --git a/Aaru.Decoders/CD/PMA.cs b/Aaru.Decoders/CD/PMA.cs index 1d10bbd77..b5757094d 100644 --- a/Aaru.Decoders/CD/PMA.cs +++ b/Aaru.Decoders/CD/PMA.cs @@ -33,8 +33,8 @@ using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; using System.Text; -using Aaru.Console; using Aaru.Helpers; +using Aaru.Logging; namespace Aaru.Decoders.CD; @@ -84,7 +84,7 @@ public static class PMA return null; } - for(var i = 0; i < (decoded.DataLength - 2) / 11; i++) + for(int i = 0; i < (decoded.DataLength - 2) / 11; i++) { decoded.PMADescriptors[i].Reserved = CDPMAResponse[0 + i * 11 + 4]; decoded.PMADescriptors[i].ADR = (byte)((CDPMAResponse[1 + i * 11 + 4] & 0xF0) >> 4); @@ -319,7 +319,7 @@ public static class PMA break; case 2: - var id = (uint)((descriptor.Min << 16) + (descriptor.Sec << 8) + descriptor.Frame); + uint id = (uint)((descriptor.Min << 16) + (descriptor.Sec << 8) + descriptor.Frame); sb.AppendFormat(Localization.Disc_ID_0_X6, id & 0x00FFFFFF).AppendLine(); break; diff --git a/Aaru.Decoders/CD/Session.cs b/Aaru.Decoders/CD/Session.cs index ab693e595..a0b1a416b 100644 --- a/Aaru.Decoders/CD/Session.cs +++ b/Aaru.Decoders/CD/Session.cs @@ -32,8 +32,8 @@ using System.Diagnostics.CodeAnalysis; using System.Text; -using Aaru.Console; using Aaru.Helpers; +using Aaru.Logging; namespace Aaru.Decoders.CD; @@ -80,7 +80,7 @@ public static class Session return null; } - for(var i = 0; i < (decoded.DataLength - 2) / 8; i++) + for(int i = 0; i < (decoded.DataLength - 2) / 8; i++) { decoded.TrackDescriptors[i].Reserved1 = CDSessionInfoResponse[0 + i * 8 + 4]; decoded.TrackDescriptors[i].ADR = (byte)((CDSessionInfoResponse[1 + i * 8 + 4] & 0xF0) >> 4); diff --git a/Aaru.Decoders/CD/TOC.cs b/Aaru.Decoders/CD/TOC.cs index cd4a29992..5f98e7071 100644 --- a/Aaru.Decoders/CD/TOC.cs +++ b/Aaru.Decoders/CD/TOC.cs @@ -32,8 +32,8 @@ using System.Diagnostics.CodeAnalysis; using System.Text; -using Aaru.Console; using Aaru.Helpers; +using Aaru.Logging; namespace Aaru.Decoders.CD; @@ -83,7 +83,7 @@ public static class TOC return null; } - for(var i = 0; i < (decoded.DataLength - 2) / 8; i++) + for(int i = 0; i < (decoded.DataLength - 2) / 8; i++) { decoded.TrackDescriptors[i].Reserved1 = CDTOCResponse[0 + i * 8 + 4]; decoded.TrackDescriptors[i].ADR = (byte)((CDTOCResponse[1 + i * 8 + 4] & 0xF0) >> 4); diff --git a/Aaru.Decoders/Floppy/Apple2.cs b/Aaru.Decoders/Floppy/Apple2.cs index 68df80851..6b02b2f66 100644 --- a/Aaru.Decoders/Floppy/Apple2.cs +++ b/Aaru.Decoders/Floppy/Apple2.cs @@ -36,8 +36,8 @@ using System.Diagnostics.CodeAnalysis; using System.IO; using System.Linq; using System.Runtime.InteropServices; -using Aaru.Console; using Aaru.Localization; +using Aaru.Logging; namespace Aaru.Decoders.Floppy; @@ -158,24 +158,24 @@ public static class Apple2 { if(data is not { Length: 410 }) return null; - var buffer = new byte[data.Length]; - byte carry = 0; + byte[] buffer = new byte[data.Length]; + byte carry = 0; - for(var i = 0; i < data.Length; i++) + for(int i = 0; i < data.Length; i++) { carry ^= ReadTable5and3[data[i]]; buffer[i] = carry; } - var output = new byte[256]; + byte[] output = new byte[256]; - for(var i = 0; i < 51; i++) + for(int i = 0; i < 51; i++) { byte b1 = buffer[51 * 3 - i]; byte b2 = buffer[51 * 2 - i]; byte b3 = buffer[51 - i]; - var b4 = (byte)(((b1 & 2) << 1 | b2 & 2 | (b3 & 2) >> 1) & 0xFF); - var b5 = (byte)(((b1 & 1) << 2 | (b2 & 1) << 1 | b3 & 1) & 0xFF); + byte b4 = (byte)(((b1 & 2) << 1 | b2 & 2 | (b3 & 2) >> 1) & 0xFF); + byte b5 = (byte)(((b1 & 1) << 2 | (b2 & 1) << 1 | b3 & 1) & 0xFF); output[250 - 5 * i] = (byte)((buffer[i + 51 * 3 + 1] << 3 | b1 >> 2 & 0x7) & 0xFF); output[251 - 5 * i] = (byte)((buffer[i + 51 * 4 + 1] << 3 | b2 >> 2 & 0x7) & 0xFF); output[252 - 5 * i] = (byte)((buffer[i + 51 * 5 + 1] << 3 | b3 >> 2 & 0x7) & 0xFF); @@ -194,16 +194,16 @@ public static class Apple2 { if(data is not { Length: 342 }) return null; - var buffer = new byte[data.Length]; - byte carry = 0; + byte[] buffer = new byte[data.Length]; + byte carry = 0; - for(var i = 0; i < data.Length; i++) + for(int i = 0; i < data.Length; i++) { carry ^= ReadTable6and2[data[i]]; buffer[i] = carry; } - var output = new byte[256]; + byte[] output = new byte[256]; for(uint i = 0; i < 256; i++) { @@ -314,9 +314,9 @@ public static class Apple2 sector.addressField.epilogue[2]); position += 14; - var syncCount = 0; - var onSync = false; - var gaps = new MemoryStream(); + int syncCount = 0; + bool onSync = false; + var gaps = new MemoryStream(); while(data[position] == 0xFF) { @@ -454,12 +454,12 @@ public static class Apple2 public static RawTrack MarshalTrack(byte[] data, out int endOffset, int offset = 0) { int position = offset; - var firstSector = true; - var onSync = false; + bool firstSector = true; + bool onSync = false; var gaps = new MemoryStream(); - var count = 0; + int count = 0; List sectors = []; - var trackNumber = new byte[2]; + byte[] trackNumber = new byte[2]; endOffset = offset; while(position < data.Length && data[position] == 0xFF) diff --git a/Aaru.Decoders/Sega/CD.cs b/Aaru.Decoders/Sega/CD.cs index ccbbfc960..ffccd7f3d 100644 --- a/Aaru.Decoders/Sega/CD.cs +++ b/Aaru.Decoders/Sega/CD.cs @@ -35,8 +35,8 @@ using System.Diagnostics.CodeAnalysis; using System.Globalization; using System.Runtime.InteropServices; using System.Text; -using Aaru.Console; using Aaru.Localization; +using Aaru.Logging; using Marshal = Aaru.Helpers.Marshal; namespace Aaru.Decoders.Sega; diff --git a/Aaru.Decoders/Sega/Dreamcast.cs b/Aaru.Decoders/Sega/Dreamcast.cs index 00daca593..1a2de102a 100644 --- a/Aaru.Decoders/Sega/Dreamcast.cs +++ b/Aaru.Decoders/Sega/Dreamcast.cs @@ -35,7 +35,7 @@ using System.Diagnostics.CodeAnalysis; using System.Globalization; using System.Runtime.InteropServices; using System.Text; -using Aaru.Console; +using Aaru.Logging; using Marshal = Aaru.Helpers.Marshal; namespace Aaru.Decoders.Sega; @@ -199,7 +199,7 @@ public static class Dreamcast } } - var iPeripherals = int.Parse(Encoding.ASCII.GetString(ipbin.peripherals), NumberStyles.HexNumber); + int iPeripherals = int.Parse(Encoding.ASCII.GetString(ipbin.peripherals), NumberStyles.HexNumber); if((iPeripherals & 0x00000001) == 0x00000001) IPBinInformation.AppendLine(Localization.Game_uses_Windows_CE); diff --git a/Aaru.Decoders/Sega/Saturn.cs b/Aaru.Decoders/Sega/Saturn.cs index 2f77c08a4..cae70b342 100644 --- a/Aaru.Decoders/Sega/Saturn.cs +++ b/Aaru.Decoders/Sega/Saturn.cs @@ -35,7 +35,7 @@ using System.Diagnostics.CodeAnalysis; using System.Globalization; using System.Runtime.InteropServices; using System.Text; -using Aaru.Console; +using Aaru.Logging; using Marshal = Aaru.Helpers.Marshal; namespace Aaru.Decoders.Sega; diff --git a/Aaru.Decryption/DVD/Dump.cs b/Aaru.Decryption/DVD/Dump.cs index e292cefec..ae488b0cb 100644 --- a/Aaru.Decryption/DVD/Dump.cs +++ b/Aaru.Decryption/DVD/Dump.cs @@ -36,9 +36,9 @@ using System; using System.Linq; -using Aaru.Console; using Aaru.Decoders.DVD; using Aaru.Devices; +using Aaru.Logging; namespace Aaru.Decryption.DVD; @@ -62,7 +62,7 @@ public sealed class Dump(Device dev) out double duration) { senseBuffer = new byte[64]; - var cdb = new byte[12]; + byte[] cdb = new byte[12]; buffer = new byte[8]; cdb[0] = (byte)ScsiCommands.ReportKey; @@ -94,7 +94,7 @@ public sealed class Dump(Device dev) out double duration) { senseBuffer = new byte[64]; - var cdb = new byte[12]; + byte[] cdb = new byte[12]; buffer = new byte[8]; cdb[0] = (byte)ScsiCommands.ReportKey; @@ -126,7 +126,7 @@ public sealed class Dump(Device dev) out double duration) { senseBuffer = new byte[64]; - var cdb = new byte[12]; + byte[] cdb = new byte[12]; buffer = []; cdb[0] = (byte)ScsiCommands.ReportKey; @@ -158,7 +158,7 @@ public sealed class Dump(Device dev) out double duration) { senseBuffer = new byte[64]; - var cdb = new byte[12]; + byte[] cdb = new byte[12]; buffer = new byte[8]; cdb[0] = (byte)ScsiCommands.ReportKey; @@ -190,7 +190,7 @@ public sealed class Dump(Device dev) out double duration) { senseBuffer = new byte[64]; - var cdb = new byte[12]; + byte[] cdb = new byte[12]; buffer = new byte[12]; cdb[0] = (byte)ScsiCommands.ReportKey; @@ -222,7 +222,7 @@ public sealed class Dump(Device dev) out double duration) { senseBuffer = new byte[64]; - var cdb = new byte[12]; + byte[] cdb = new byte[12]; buffer = new byte[16]; cdb[0] = (byte)ScsiCommands.ReportKey; @@ -255,7 +255,7 @@ public sealed class Dump(Device dev) uint timeout, out double duration) { senseBuffer = new byte[64]; - var cdb = new byte[12]; + byte[] cdb = new byte[12]; buffer = new byte[16]; cdb[0] = (byte)ScsiCommands.SendKey; @@ -301,7 +301,7 @@ public sealed class Dump(Device dev) out double duration) { senseBuffer = new byte[64]; - var cdb = new byte[12]; + byte[] cdb = new byte[12]; buffer = new byte[12]; cdb[0] = (byte)ScsiCommands.SendKey; @@ -339,7 +339,7 @@ public sealed class Dump(Device dev) public bool ReadDiscKey(out byte[] buffer, out byte[] senseBuffer, uint timeout, out double duration) { senseBuffer = new byte[64]; - var cdb = new byte[12]; + byte[] cdb = new byte[12]; buffer = new byte[2052]; cdb[0] = (byte)ScsiCommands.ReadDiscStructure; @@ -369,10 +369,10 @@ public sealed class Dump(Device dev) buffer = []; senseBuffer = new byte[64]; - var sense = false; - var challenge = new byte[CHALLENGE_SIZE]; - var key1 = new byte[KEY_SIZE]; - byte variant = 0; + bool sense = false; + byte[] challenge = new byte[CHALLENGE_SIZE]; + byte[] key1 = new byte[KEY_SIZE]; + byte variant = 0; for(byte i = 0; i < 4; i++) { @@ -478,7 +478,7 @@ public sealed class Dump(Device dev) BusKey = buffer; senseBuffer = new byte[64]; - var cdb = new byte[12]; + byte[] cdb = new byte[12]; buffer = new byte[12]; cdb[0] = (byte)ScsiCommands.ReportKey; diff --git a/Aaru.Devices/Aaru.Devices.csproj b/Aaru.Devices/Aaru.Devices.csproj index c72ac3877..5d4ce8e35 100644 --- a/Aaru.Devices/Aaru.Devices.csproj +++ b/Aaru.Devices/Aaru.Devices.csproj @@ -36,7 +36,7 @@ - + diff --git a/Aaru.Devices/Device/AtaCommands/Ata28.cs b/Aaru.Devices/Device/AtaCommands/Ata28.cs index 28f2bb162..7492581c9 100644 --- a/Aaru.Devices/Device/AtaCommands/Ata28.cs +++ b/Aaru.Devices/Device/AtaCommands/Ata28.cs @@ -30,8 +30,8 @@ // Copyright © 2011-2025 Natalia Portillo // ****************************************************************************/ -using Aaru.Console; using Aaru.Decoders.ATA; +using Aaru.Logging; // ReSharper disable UnusedMember.Global diff --git a/Aaru.Devices/Device/AtaCommands/Ata48.cs b/Aaru.Devices/Device/AtaCommands/Ata48.cs index 12fcaf03c..e11a09754 100644 --- a/Aaru.Devices/Device/AtaCommands/Ata48.cs +++ b/Aaru.Devices/Device/AtaCommands/Ata48.cs @@ -30,8 +30,8 @@ // Copyright © 2011-2025 Natalia Portillo // ****************************************************************************/ -using Aaru.Console; using Aaru.Decoders.ATA; +using Aaru.Logging; namespace Aaru.Devices; diff --git a/Aaru.Devices/Device/AtaCommands/AtaCHS.cs b/Aaru.Devices/Device/AtaCommands/AtaCHS.cs index 6cc034afd..7c8d5911f 100644 --- a/Aaru.Devices/Device/AtaCommands/AtaCHS.cs +++ b/Aaru.Devices/Device/AtaCommands/AtaCHS.cs @@ -31,8 +31,8 @@ // ****************************************************************************/ using System.Diagnostics.CodeAnalysis; -using Aaru.Console; using Aaru.Decoders.ATA; +using Aaru.Logging; // ReSharper disable UnusedMember.Global diff --git a/Aaru.Devices/Device/AtaCommands/Atapi.cs b/Aaru.Devices/Device/AtaCommands/Atapi.cs index 70b6498e5..5fb7ad8de 100644 --- a/Aaru.Devices/Device/AtaCommands/Atapi.cs +++ b/Aaru.Devices/Device/AtaCommands/Atapi.cs @@ -30,8 +30,8 @@ // Copyright © 2011-2025 Natalia Portillo // ****************************************************************************/ -using Aaru.Console; using Aaru.Decoders.ATA; +using Aaru.Logging; namespace Aaru.Devices; diff --git a/Aaru.Devices/Device/AtaCommands/Cfa.cs b/Aaru.Devices/Device/AtaCommands/Cfa.cs index b0863b868..35f2e178b 100644 --- a/Aaru.Devices/Device/AtaCommands/Cfa.cs +++ b/Aaru.Devices/Device/AtaCommands/Cfa.cs @@ -30,8 +30,8 @@ // Copyright © 2011-2025 Natalia Portillo // ****************************************************************************/ -using Aaru.Console; using Aaru.Decoders.ATA; +using Aaru.Logging; namespace Aaru.Devices; diff --git a/Aaru.Devices/Device/AtaCommands/MCPT.cs b/Aaru.Devices/Device/AtaCommands/MCPT.cs index 05eb11925..05445ef60 100644 --- a/Aaru.Devices/Device/AtaCommands/MCPT.cs +++ b/Aaru.Devices/Device/AtaCommands/MCPT.cs @@ -31,8 +31,8 @@ // ****************************************************************************/ using System.Diagnostics.CodeAnalysis; -using Aaru.Console; using Aaru.Decoders.ATA; +using Aaru.Logging; // ReSharper disable UnusedMember.Global diff --git a/Aaru.Devices/Device/AtaCommands/Smart.cs b/Aaru.Devices/Device/AtaCommands/Smart.cs index f40583789..5789a2f62 100644 --- a/Aaru.Devices/Device/AtaCommands/Smart.cs +++ b/Aaru.Devices/Device/AtaCommands/Smart.cs @@ -30,8 +30,8 @@ // Copyright © 2011-2025 Natalia Portillo // ****************************************************************************/ -using Aaru.Console; using Aaru.Decoders.ATA; +using Aaru.Logging; namespace Aaru.Devices; diff --git a/Aaru.Devices/Device/List.cs b/Aaru.Devices/Device/List.cs index ffcd23f1c..228a2caad 100644 --- a/Aaru.Devices/Device/List.cs +++ b/Aaru.Devices/Device/List.cs @@ -33,7 +33,7 @@ using System; using System.Runtime.InteropServices; using Aaru.CommonTypes.Interop; -using Aaru.Console; +using Aaru.Logging; namespace Aaru.Devices; diff --git a/Aaru.Devices/Device/MmcCommands/MMC.cs b/Aaru.Devices/Device/MmcCommands/MMC.cs index 7a97efac4..b8cb07a5d 100644 --- a/Aaru.Devices/Device/MmcCommands/MMC.cs +++ b/Aaru.Devices/Device/MmcCommands/MMC.cs @@ -31,7 +31,7 @@ // ****************************************************************************/ using System; -using Aaru.Console; +using Aaru.Logging; // ReSharper disable UnusedMember.Global @@ -206,7 +206,7 @@ public partial class Device public bool Read(out byte[] buffer, out uint[] response, uint lba, uint blockSize, ushort transferLength, bool byteAddressed, uint timeout, out double duration) { - var sense = true; + bool sense = true; buffer = null; response = null; duration = -1; @@ -342,9 +342,9 @@ public partial class Device ushort transferLength, bool byteAddressed, uint timeout, out double duration) { buffer = new byte[transferLength * blockSize]; - var blockBuffer = new byte[blockSize]; + byte[] blockBuffer = new byte[blockSize]; duration = 0; - var sense = true; + bool sense = true; response = null; for(uint i = 0; i < transferLength; i++) diff --git a/Aaru.Devices/Device/MmcCommands/SecureDigital.cs b/Aaru.Devices/Device/MmcCommands/SecureDigital.cs index feb53b969..3102aa71a 100644 --- a/Aaru.Devices/Device/MmcCommands/SecureDigital.cs +++ b/Aaru.Devices/Device/MmcCommands/SecureDigital.cs @@ -30,7 +30,7 @@ // Copyright © 2011-2025 Natalia Portillo // ****************************************************************************/ -using Aaru.Console; +using Aaru.Logging; namespace Aaru.Devices; diff --git a/Aaru.Devices/Device/ScsiCommands/Adaptec.cs b/Aaru.Devices/Device/ScsiCommands/Adaptec.cs index b2c120653..e7a91f986 100644 --- a/Aaru.Devices/Device/ScsiCommands/Adaptec.cs +++ b/Aaru.Devices/Device/ScsiCommands/Adaptec.cs @@ -32,7 +32,7 @@ // ****************************************************************************/ using System; -using Aaru.Console; +using Aaru.Logging; // ReSharper disable UnusedMember.Global @@ -61,7 +61,7 @@ public partial class Device out double duration) { buffer = new byte[8]; - var cdb = new byte[6]; + byte[] cdb = new byte[6]; senseBuffer = new byte[64]; cdb[0] = (byte)ScsiCommands.AdaptecTranslate; @@ -105,9 +105,9 @@ public partial class Device public bool AdaptecSetErrorThreshold(byte threshold, out byte[] senseBuffer, bool drive1, uint timeout, out double duration) { - var buffer = new byte[1]; + byte[] buffer = new byte[1]; buffer[0] = threshold; - var cdb = new byte[6]; + byte[] cdb = new byte[6]; senseBuffer = new byte[64]; cdb[0] = (byte)ScsiCommands.AdaptecSetErrorThreshold; @@ -149,7 +149,7 @@ public partial class Device out double duration) { buffer = new byte[9]; - var cdb = new byte[6]; + byte[] cdb = new byte[6]; senseBuffer = new byte[64]; cdb[0] = (byte)ScsiCommands.AdaptecTranslate; @@ -180,10 +180,10 @@ public partial class Device /// Duration. public bool AdaptecWriteBuffer(byte[] buffer, out byte[] senseBuffer, uint timeout, out double duration) { - var oneKBuffer = new byte[1024]; + byte[] oneKBuffer = new byte[1024]; Array.Copy(buffer, 0, oneKBuffer, 0, buffer.Length < 1024 ? buffer.Length : 1024); - var cdb = new byte[6]; + byte[] cdb = new byte[6]; senseBuffer = new byte[64]; cdb[0] = (byte)ScsiCommands.AdaptecWriteBuffer; @@ -211,7 +211,7 @@ public partial class Device public bool AdaptecReadBuffer(out byte[] buffer, out byte[] senseBuffer, uint timeout, out double duration) { buffer = new byte[1024]; - var cdb = new byte[6]; + byte[] cdb = new byte[6]; senseBuffer = new byte[64]; cdb[0] = (byte)ScsiCommands.AdaptecReadBuffer; diff --git a/Aaru.Devices/Device/ScsiCommands/ArchiveCorp.cs b/Aaru.Devices/Device/ScsiCommands/ArchiveCorp.cs index 8d7aa79ae..df1930583 100644 --- a/Aaru.Devices/Device/ScsiCommands/ArchiveCorp.cs +++ b/Aaru.Devices/Device/ScsiCommands/ArchiveCorp.cs @@ -30,7 +30,7 @@ // Copyright © 2011-2025 Natalia Portillo // ****************************************************************************/ -using Aaru.Console; +using Aaru.Logging; // ReSharper disable UnusedMember.Global @@ -48,7 +48,7 @@ public partial class Device out double duration) { buffer = new byte[3]; - var cdb = new byte[6]; + byte[] cdb = new byte[6]; senseBuffer = new byte[64]; cdb[0] = (byte)ScsiCommands.ArchiveRequestBlockAddress; @@ -92,7 +92,7 @@ public partial class Device out double duration) { byte[] buffer = []; - var cdb = new byte[6]; + byte[] cdb = new byte[6]; senseBuffer = new byte[64]; cdb[0] = (byte)ScsiCommands.ArchiveSeekBlock; diff --git a/Aaru.Devices/Device/ScsiCommands/Certance.cs b/Aaru.Devices/Device/ScsiCommands/Certance.cs index b46f3ab82..82712e135 100644 --- a/Aaru.Devices/Device/ScsiCommands/Certance.cs +++ b/Aaru.Devices/Device/ScsiCommands/Certance.cs @@ -31,7 +31,7 @@ // ****************************************************************************/ using System.Diagnostics.CodeAnalysis; -using Aaru.Console; +using Aaru.Logging; namespace Aaru.Devices; @@ -60,7 +60,7 @@ public partial class Device public bool CertanceParkUnpark(out byte[] senseBuffer, bool park, uint timeout, out double duration) { byte[] buffer = []; - var cdb = new byte[6]; + byte[] cdb = new byte[6]; senseBuffer = new byte[64]; cdb[0] = (byte)ScsiCommands.CertanceParkUnpark; diff --git a/Aaru.Devices/Device/ScsiCommands/Fujitsu.cs b/Aaru.Devices/Device/ScsiCommands/Fujitsu.cs index 8e1f16cfb..eae90c75f 100644 --- a/Aaru.Devices/Device/ScsiCommands/Fujitsu.cs +++ b/Aaru.Devices/Device/ScsiCommands/Fujitsu.cs @@ -32,8 +32,8 @@ using System; using System.Text; -using Aaru.Console; using Aaru.Helpers; +using Aaru.Logging; namespace Aaru.Devices; @@ -52,12 +52,12 @@ public partial class Device string secondHalf, uint timeout, out double duration) { byte[] tmp; - var firstHalfBytes = new byte[8]; - var secondHalfBytes = new byte[8]; - var buffer = new byte[17]; - var displayLen = false; - var halfMsg = false; - var cdb = new byte[10]; + byte[] firstHalfBytes = new byte[8]; + byte[] secondHalfBytes = new byte[8]; + byte[] buffer = new byte[17]; + bool displayLen = false; + bool halfMsg = false; + byte[] cdb = new byte[10]; if(!string.IsNullOrWhiteSpace(firstHalf)) { diff --git a/Aaru.Devices/Device/ScsiCommands/HL-DT-ST.cs b/Aaru.Devices/Device/ScsiCommands/HL-DT-ST.cs index d1b7c5a6e..b80558dfe 100644 --- a/Aaru.Devices/Device/ScsiCommands/HL-DT-ST.cs +++ b/Aaru.Devices/Device/ScsiCommands/HL-DT-ST.cs @@ -32,9 +32,9 @@ using System.Collections.Generic; using Aaru.CommonTypes.Enums; -using Aaru.Console; using Aaru.Decoders.DVD; using Aaru.Helpers; +using Aaru.Logging; namespace Aaru.Devices; @@ -60,7 +60,7 @@ public partial class Device Read12(out _, out _, 0, false, false, false, false, lba, 2048, 0, 16, false, timeout, out duration); senseBuffer = new byte[64]; - var cdb = new byte[12]; + byte[] cdb = new byte[12]; buffer = new byte[2064 * transferLength]; uint cacheDataOffset = 0x80000000 + lba % 96 * 2064; @@ -110,12 +110,12 @@ public partial class Device static bool CheckSectorNumber(IReadOnlyList buffer, uint firstLba, uint transferLength, uint layerbreak, bool otp) { - for(var i = 0; i < transferLength; i++) + for(int i = 0; i < transferLength; i++) { byte layer = (byte)(buffer[0 + 2064 * i] & 0x1); byte[] sectorBuffer = [0x0, buffer[1 + 2064 * i], buffer[2 + 2064 * i], buffer[3 + 2064 * i]]; - var sectorNumber = BigEndianBitConverter.ToUInt32(sectorBuffer, 0); + uint sectorNumber = BigEndianBitConverter.ToUInt32(sectorBuffer, 0); if(otp) @@ -149,7 +149,7 @@ public partial class Device { if(layer != 1) return IsCorrectSlPsn(sectorNumber, lba); - return sectorNumber == (lba - layerbreak) + 0x30000; + return sectorNumber == lba - layerbreak + 0x30000; } /// diff --git a/Aaru.Devices/Device/ScsiCommands/HP.cs b/Aaru.Devices/Device/ScsiCommands/HP.cs index 2dbf7b827..ee8c5b725 100644 --- a/Aaru.Devices/Device/ScsiCommands/HP.cs +++ b/Aaru.Devices/Device/ScsiCommands/HP.cs @@ -30,7 +30,7 @@ // Copyright © 2011-2025 Natalia Portillo // ****************************************************************************/ -using Aaru.Console; +using Aaru.Logging; // ReSharper disable UnusedMember.Global @@ -71,7 +71,7 @@ public partial class Device ushort blockBytes, bool pba, bool sectorCount, uint timeout, out double duration) { senseBuffer = new byte[64]; - var cdb = new byte[10]; + byte[] cdb = new byte[10]; cdb[0] = (byte)ScsiCommands.ReadLong; diff --git a/Aaru.Devices/Device/ScsiCommands/Kreon.cs b/Aaru.Devices/Device/ScsiCommands/Kreon.cs index 88f76b259..63dc944ba 100644 --- a/Aaru.Devices/Device/ScsiCommands/Kreon.cs +++ b/Aaru.Devices/Device/ScsiCommands/Kreon.cs @@ -31,7 +31,7 @@ // ****************************************************************************/ using System; -using Aaru.Console; +using Aaru.Logging; namespace Aaru.Devices; @@ -45,7 +45,7 @@ public partial class Device public bool KreonDeprecatedUnlock(out byte[] senseBuffer, uint timeout, out double duration) { senseBuffer = new byte[64]; - var cdb = new byte[10]; + byte[] cdb = new byte[10]; byte[] buffer = []; cdb[0] = (byte)ScsiCommands.KreonCommand; @@ -101,7 +101,7 @@ public partial class Device public bool KreonSetLockState(out byte[] senseBuffer, KreonLockStates state, uint timeout, out double duration) { senseBuffer = new byte[64]; - var cdb = new byte[10]; + byte[] cdb = new byte[10]; byte[] buffer = []; cdb[0] = (byte)ScsiCommands.KreonCommand; @@ -135,8 +135,8 @@ public partial class Device out double duration) { senseBuffer = new byte[64]; - var cdb = new byte[10]; - var buffer = new byte[26]; + byte[] cdb = new byte[10]; + byte[] buffer = new byte[26]; features = 0; cdb[0] = (byte)ScsiCommands.KreonCommand; @@ -160,9 +160,9 @@ public partial class Device if(buffer[0] != 0xA5 || buffer[1] != 0x5A || buffer[2] != 0x5A || buffer[3] != 0xA5) return true; - for(var i = 4; i < 26; i += 2) + for(int i = 4; i < 26; i += 2) { - var feature = BitConverter.ToUInt16(buffer, i); + ushort feature = BitConverter.ToUInt16(buffer, i); if(feature == 0x0000) break; @@ -225,7 +225,7 @@ public partial class Device byte requestNumber = 0x00) { buffer = new byte[2048]; - var cdb = new byte[12]; + byte[] cdb = new byte[12]; senseBuffer = new byte[64]; cdb[0] = (byte)ScsiCommands.KreonSsCommand; diff --git a/Aaru.Devices/Device/ScsiCommands/LiteOn.cs b/Aaru.Devices/Device/ScsiCommands/LiteOn.cs index 46fba1366..6db3b6eb5 100644 --- a/Aaru.Devices/Device/ScsiCommands/LiteOn.cs +++ b/Aaru.Devices/Device/ScsiCommands/LiteOn.cs @@ -32,13 +32,13 @@ using System; using Aaru.CommonTypes.Enums; -using Aaru.Console; +using Aaru.Logging; namespace Aaru.Devices; public partial class Device { - private uint _bufferOffset = 0; + private uint _bufferOffset; /// Reads a "raw" sector from DVD on Lite-On drives. /// true if the command failed and contains the sense buffer. @@ -115,7 +115,7 @@ public partial class Device Read12(out _, out _, 0, false, false, false, false, lba, 2048, 0, 16, false, timeout, out duration); senseBuffer = new byte[64]; - var cdb = new byte[10]; + byte[] cdb = new byte[10]; buffer = new byte[transferLength]; @@ -268,10 +268,7 @@ public partial class Device { LiteOnReadBuffer(out byte[] buffer, out byte[] _, i * 2384, 2384, timeout, out double _, lba); - if(CheckSectorNumber(buffer, lba, 1, layerbreak, otp)) - { - return (int)i; - } + if(CheckSectorNumber(buffer, lba, 1, layerbreak, otp)) return (int)i; } return -1; @@ -288,14 +285,11 @@ public partial class Device { // TODO: Save ECC instead of just throwing it away - var deinterleaved = new byte[2064 * transferLength]; + byte[] deinterleaved = new byte[2064 * transferLength]; - for(var j = 0; j < transferLength; j++) + for(int j = 0; j < transferLength; j++) { - for(var i = 0; i < 12; i++) - { - Array.Copy(buffer, (j * 2384) + (i * 182), deinterleaved, (j * 2064) + (i * 172), 172); - } + for(int i = 0; i < 12; i++) Array.Copy(buffer, j * 2384 + i * 182, deinterleaved, j * 2064 + i * 172, 172); } return deinterleaved; diff --git a/Aaru.Devices/Device/ScsiCommands/MMC.cs b/Aaru.Devices/Device/ScsiCommands/MMC.cs index 13f6fcd5c..524525ae1 100644 --- a/Aaru.Devices/Device/ScsiCommands/MMC.cs +++ b/Aaru.Devices/Device/ScsiCommands/MMC.cs @@ -33,7 +33,7 @@ using System; using System.Diagnostics.CodeAnalysis; using System.Text; -using Aaru.Console; +using Aaru.Logging; // ReSharper disable UnusedMember.Global @@ -79,7 +79,7 @@ public partial class Device MmcGetConfigurationRt rt, uint timeout, out double duration) { senseBuffer = new byte[64]; - var cdb = new byte[10]; + byte[] cdb = new byte[10]; buffer = new byte[8]; cdb[0] = (byte)ScsiCommands.GetConfiguration; @@ -102,7 +102,7 @@ public partial class Device if(sense) return true; - var confLength = (ushort)((buffer[2] << 8) + buffer[3] + 4); + ushort confLength = (ushort)((buffer[2] << 8) + buffer[3] + 4); buffer = new byte[confLength]; cdb[7] = (byte)((buffer.Length & 0xFF00) >> 8); cdb[8] = (byte)(buffer.Length & 0xFF); @@ -146,7 +146,7 @@ public partial class Device uint timeout, out double duration) { senseBuffer = new byte[64]; - var cdb = new byte[12]; + byte[] cdb = new byte[12]; buffer = new byte[8]; cdb[0] = (byte)ScsiCommands.ReadDiscStructure; @@ -173,7 +173,7 @@ public partial class Device if(sense) return true; - var strctLength = (ushort)((buffer[0] << 8) + buffer[1] + 2); + ushort strctLength = (ushort)((buffer[0] << 8) + buffer[1] + 2); // WORKAROUND: Some drives return incorrect length information. As these structures are fixed length just apply known length. if(mediaType == MmcDiscStructureMediaType.Bd) @@ -313,7 +313,7 @@ public partial class Device byte trackSessionNumber, uint timeout, out double duration) { senseBuffer = new byte[64]; - var cdb = new byte[10]; + byte[] cdb = new byte[10]; byte[] tmpBuffer = (format & 0x0F) == 5 ? new byte[32768] : new byte[1536]; @@ -336,7 +336,7 @@ public partial class Device Error = LastError != 0; - var strctLength = (uint)((tmpBuffer[0] << 8) + tmpBuffer[1] + 2); + uint strctLength = (uint)((tmpBuffer[0] << 8) + tmpBuffer[1] + 2); buffer = new byte[strctLength]; if(buffer.Length <= tmpBuffer.Length) @@ -407,8 +407,8 @@ public partial class Device uint timeout, out double duration) { senseBuffer = new byte[64]; - var cdb = new byte[10]; - var tmpBuffer = new byte[804]; + byte[] cdb = new byte[10]; + byte[] tmpBuffer = new byte[804]; cdb[0] = (byte)ScsiCommands.ReadDiscInformation; cdb[1] = (byte)dataType; @@ -425,7 +425,7 @@ public partial class Device Error = LastError != 0; - var strctLength = (uint)((tmpBuffer[0] << 8) + tmpBuffer[1] + 2); + uint strctLength = (uint)((tmpBuffer[0] << 8) + tmpBuffer[1] + 2); if(strctLength > tmpBuffer.Length) strctLength = (uint)tmpBuffer.Length; @@ -466,7 +466,7 @@ public partial class Device out double duration) { senseBuffer = new byte[64]; - var cdb = new byte[12]; + byte[] cdb = new byte[12]; cdb[0] = (byte)ScsiCommands.ReadCd; cdb[1] = (byte)((byte)expectedSectorType << 2); @@ -550,7 +550,7 @@ public partial class Device out double duration) { senseBuffer = new byte[64]; - var cdb = new byte[12]; + byte[] cdb = new byte[12]; cdb[0] = (byte)ScsiCommands.ReadCdMsf; cdb[1] = (byte)((byte)expectedSectorType << 2); @@ -574,7 +574,7 @@ public partial class Device cdb[10] = (byte)subchannel; - var transferLength = (uint)((cdb[6] - cdb[3]) * 60 * 75 + (cdb[7] - cdb[4]) * 75 + (cdb[8] - cdb[5])); + uint transferLength = (uint)((cdb[6] - cdb[3]) * 60 * 75 + (cdb[7] - cdb[4]) * 75 + (cdb[8] - cdb[5])); buffer = new byte[blockSize * transferLength]; @@ -636,7 +636,7 @@ public partial class Device out double duration) { senseBuffer = new byte[64]; - var cdb = new byte[6]; + byte[] cdb = new byte[6]; byte[] buffer = []; cdb[0] = (byte)ScsiCommands.PreventAllowMediumRemoval; @@ -714,7 +714,7 @@ public partial class Device bool changeFormatLayer, bool loadEject, bool start, uint timeout, out double duration) { senseBuffer = new byte[64]; - var cdb = new byte[6]; + byte[] cdb = new byte[6]; byte[] buffer = []; cdb[0] = (byte)ScsiCommands.StartStopUnit; @@ -772,7 +772,7 @@ public partial class Device public bool ReadMcn(out string mcn, out byte[] buffer, out byte[] senseBuffer, uint timeout, out double duration) { senseBuffer = new byte[64]; - var cdb = new byte[10]; + byte[] cdb = new byte[10]; mcn = null; cdb[0] = (byte)ScsiCommands.ReadSubChannel; @@ -818,7 +818,7 @@ public partial class Device out double duration) { senseBuffer = new byte[64]; - var cdb = new byte[10]; + byte[] cdb = new byte[10]; isrc = null; cdb[0] = (byte)ScsiCommands.ReadSubChannel; @@ -866,7 +866,7 @@ public partial class Device ushort writeSpeed, uint timeout, out double duration) { senseBuffer = new byte[64]; - var cdb = new byte[12]; + byte[] cdb = new byte[12]; byte[] buffer = []; cdb[0] = (byte)ScsiCommands.SetCdRomSpeed; @@ -912,7 +912,7 @@ public partial class Device uint address, uint timeout, out double duration) { senseBuffer = new byte[64]; - var cdb = new byte[10]; + byte[] cdb = new byte[10]; buffer = new byte[48]; cdb[0] = (byte)ScsiCommands.ReadTrackInformation; diff --git a/Aaru.Devices/Device/ScsiCommands/MediaTek.cs b/Aaru.Devices/Device/ScsiCommands/MediaTek.cs index a7010db66..1536ce320 100644 --- a/Aaru.Devices/Device/ScsiCommands/MediaTek.cs +++ b/Aaru.Devices/Device/ScsiCommands/MediaTek.cs @@ -30,7 +30,7 @@ // Copyright © 2011-2025 Natalia Portillo // ****************************************************************************/ -using Aaru.Console; +using Aaru.Logging; namespace Aaru.Devices; @@ -48,7 +48,7 @@ public partial class Device out double duration) { senseBuffer = new byte[64]; - var cdb = new byte[10]; + byte[] cdb = new byte[10]; buffer = new byte[length]; cdb[0] = (byte)ScsiCommands.MediaTekVendorCommand; diff --git a/Aaru.Devices/Device/ScsiCommands/MiniDisc.cs b/Aaru.Devices/Device/ScsiCommands/MiniDisc.cs index 20371fe5c..245df33a4 100644 --- a/Aaru.Devices/Device/ScsiCommands/MiniDisc.cs +++ b/Aaru.Devices/Device/ScsiCommands/MiniDisc.cs @@ -32,7 +32,7 @@ // ReSharper disable InconsistentNaming -using Aaru.Console; +using Aaru.Logging; // ReSharper disable UnusedMember.Global @@ -50,7 +50,7 @@ public partial class Device { const ushort transferLength = 2336; senseBuffer = new byte[64]; - var cdb = new byte[10]; + byte[] cdb = new byte[10]; cdb[0] = (byte)ScsiCommands.MiniDiscReadDTOC; @@ -86,7 +86,7 @@ public partial class Device { const ushort transferLength = 2336; senseBuffer = new byte[64]; - var cdb = new byte[10]; + byte[] cdb = new byte[10]; cdb[0] = (byte)ScsiCommands.MiniDiscReadUTOC; @@ -124,7 +124,7 @@ public partial class Device { const ushort transferLength = 4; senseBuffer = new byte[64]; - var cdb = new byte[10]; + byte[] cdb = new byte[10]; cdb[0] = (byte)ScsiCommands.MiniDiscD5; @@ -157,7 +157,7 @@ public partial class Device public bool MiniDiscStopPlaying(out byte[] buffer, out byte[] senseBuffer, uint timeout, out double duration) { senseBuffer = new byte[64]; - var cdb = new byte[10]; + byte[] cdb = new byte[10]; cdb[0] = (byte)ScsiCommands.MiniDiscStopPlay; @@ -188,7 +188,7 @@ public partial class Device { const ushort transferLength = 4; senseBuffer = new byte[64]; - var cdb = new byte[10]; + byte[] cdb = new byte[10]; cdb[0] = (byte)ScsiCommands.MiniDiscReadPosition; @@ -222,7 +222,7 @@ public partial class Device { const ushort transferLength = 8; senseBuffer = new byte[64]; - var cdb = new byte[10]; + byte[] cdb = new byte[10]; cdb[0] = (byte)ScsiCommands.MiniDiscGetType; diff --git a/Aaru.Devices/Device/ScsiCommands/NEC.cs b/Aaru.Devices/Device/ScsiCommands/NEC.cs index 81daccfa8..45f3f298c 100644 --- a/Aaru.Devices/Device/ScsiCommands/NEC.cs +++ b/Aaru.Devices/Device/ScsiCommands/NEC.cs @@ -30,7 +30,7 @@ // Copyright © 2011-2025 Natalia Portillo // ****************************************************************************/ -using Aaru.Console; +using Aaru.Logging; namespace Aaru.Devices; @@ -48,7 +48,7 @@ public partial class Device out double duration) { senseBuffer = new byte[64]; - var cdb = new byte[10]; + byte[] cdb = new byte[10]; cdb[0] = (byte)ScsiCommands.NecReadCdDa; cdb[2] = (byte)((lba & 0xFF000000) >> 24); diff --git a/Aaru.Devices/Device/ScsiCommands/Optical.cs b/Aaru.Devices/Device/ScsiCommands/Optical.cs index 1182df31e..148edc230 100644 --- a/Aaru.Devices/Device/ScsiCommands/Optical.cs +++ b/Aaru.Devices/Device/ScsiCommands/Optical.cs @@ -30,8 +30,8 @@ // Copyright © 2011-2025 Natalia Portillo // ****************************************************************************/ -using Aaru.Console; using Aaru.Decoders.SCSI; +using Aaru.Logging; namespace Aaru.Devices; @@ -62,7 +62,7 @@ public partial class Device out uint foundBlocks, uint timeout, out double duration) { senseBuffer = new byte[64]; - var cdb = new byte[10]; + byte[] cdb = new byte[10]; byte[] buffer = []; foundLba = 0; foundBlocks = 0; diff --git a/Aaru.Devices/Device/ScsiCommands/Pioneer.cs b/Aaru.Devices/Device/ScsiCommands/Pioneer.cs index bc04d1726..c4f44e1bb 100644 --- a/Aaru.Devices/Device/ScsiCommands/Pioneer.cs +++ b/Aaru.Devices/Device/ScsiCommands/Pioneer.cs @@ -30,7 +30,7 @@ // Copyright © 2011-2025 Natalia Portillo // ****************************************************************************/ -using Aaru.Console; +using Aaru.Logging; namespace Aaru.Devices; @@ -50,7 +50,7 @@ public partial class Device uint transferLength, PioneerSubchannel subchannel, uint timeout, out double duration) { senseBuffer = new byte[64]; - var cdb = new byte[12]; + byte[] cdb = new byte[12]; cdb[0] = (byte)ScsiCommands.ReadCdDa; cdb[2] = (byte)((lba & 0xFF000000) >> 24); @@ -93,7 +93,7 @@ public partial class Device uint blockSize, PioneerSubchannel subchannel, uint timeout, out double duration) { senseBuffer = new byte[64]; - var cdb = new byte[12]; + byte[] cdb = new byte[12]; cdb[0] = (byte)ScsiCommands.ReadCdDaMsf; cdb[3] = (byte)((startMsf & 0xFF0000) >> 16); @@ -104,7 +104,7 @@ public partial class Device cdb[9] = (byte)(endMsf & 0xFF); cdb[10] = (byte)subchannel; - var transferLength = (uint)((cdb[7] - cdb[3]) * 60 * 75 + (cdb[8] - cdb[4]) * 75 + (cdb[9] - cdb[5])); + uint transferLength = (uint)((cdb[7] - cdb[3]) * 60 * 75 + (cdb[8] - cdb[4]) * 75 + (cdb[9] - cdb[5])); buffer = new byte[blockSize * transferLength]; LastError = SendScsiCommand(cdb, @@ -139,7 +139,7 @@ public partial class Device bool errorFlags, bool wholeSector, uint timeout, out double duration) { senseBuffer = new byte[64]; - var cdb = new byte[12]; + byte[] cdb = new byte[12]; cdb[0] = (byte)ScsiCommands.ReadCdXa; cdb[2] = (byte)((lba & 0xFF000000) >> 24); diff --git a/Aaru.Devices/Device/ScsiCommands/Plasmon.cs b/Aaru.Devices/Device/ScsiCommands/Plasmon.cs index 581f611eb..85725bfdd 100644 --- a/Aaru.Devices/Device/ScsiCommands/Plasmon.cs +++ b/Aaru.Devices/Device/ScsiCommands/Plasmon.cs @@ -30,7 +30,7 @@ // Copyright © 2011-2025 Natalia Portillo // ****************************************************************************/ -using Aaru.Console; +using Aaru.Logging; // ReSharper disable UnusedMember.Global @@ -92,7 +92,7 @@ public partial class Device uint timeout, out double duration) { senseBuffer = new byte[64]; - var cdb = new byte[10]; + byte[] cdb = new byte[10]; cdb[0] = (byte)ScsiCommands.PlasmonReadSectorLocation; cdb[2] = (byte)((address & 0xFF000000) >> 24); diff --git a/Aaru.Devices/Device/ScsiCommands/Plextor.cs b/Aaru.Devices/Device/ScsiCommands/Plextor.cs index 80583634f..7fb29044a 100644 --- a/Aaru.Devices/Device/ScsiCommands/Plextor.cs +++ b/Aaru.Devices/Device/ScsiCommands/Plextor.cs @@ -30,8 +30,8 @@ // Copyright © 2011-2025 Natalia Portillo // ****************************************************************************/ -using Aaru.Console; using Aaru.Helpers; +using Aaru.Logging; namespace Aaru.Devices; @@ -51,7 +51,7 @@ public partial class Device uint transferLength, PlextorSubchannel subchannel, uint timeout, out double duration) { senseBuffer = new byte[64]; - var cdb = new byte[12]; + byte[] cdb = new byte[12]; cdb[0] = (byte)ScsiCommands.ReadCdDa; cdb[2] = (byte)((lba & 0xFF000000) >> 24); @@ -102,7 +102,7 @@ public partial class Device uint timeout, out double duration) { senseBuffer = new byte[64]; - var cdb = new byte[10]; + byte[] cdb = new byte[10]; buffer = new byte[2064 * transferLength]; cdb[0] = (byte)ScsiCommands.ReadBuffer; @@ -139,7 +139,7 @@ public partial class Device { buffer = new byte[256]; senseBuffer = new byte[64]; - var cdb = new byte[12]; + byte[] cdb = new byte[12]; cdb[0] = (byte)ScsiCommands.PlextorReadEeprom; cdb[8] = 1; @@ -169,7 +169,7 @@ public partial class Device { buffer = new byte[512]; senseBuffer = new byte[64]; - var cdb = new byte[12]; + byte[] cdb = new byte[12]; cdb[0] = (byte)ScsiCommands.PlextorReadEeprom; cdb[8] = 2; @@ -202,7 +202,7 @@ public partial class Device { buffer = new byte[blockSize]; senseBuffer = new byte[64]; - var cdb = new byte[12]; + byte[] cdb = new byte[12]; cdb[0] = (byte)ScsiCommands.PlextorReadEeprom; cdb[1] = 1; @@ -236,9 +236,9 @@ public partial class Device public bool PlextorGetSpeeds(out byte[] senseBuffer, out ushort selected, out ushort max, out ushort last, uint timeout, out double duration) { - var buf = new byte[10]; + byte[] buf = new byte[10]; senseBuffer = new byte[64]; - var cdb = new byte[12]; + byte[] cdb = new byte[12]; selected = 0; max = 0; @@ -278,9 +278,9 @@ public partial class Device public bool PlextorGetPoweRec(out byte[] senseBuffer, out bool enabled, out ushort speed, uint timeout, out double duration) { - var buf = new byte[8]; + byte[] buf = new byte[8]; senseBuffer = new byte[64]; - var cdb = new byte[12]; + byte[] cdb = new byte[12]; enabled = false; speed = 0; @@ -319,7 +319,7 @@ public partial class Device { buffer = new byte[8]; senseBuffer = new byte[64]; - var cdb = new byte[12]; + byte[] cdb = new byte[12]; cdb[0] = (byte)ScsiCommands.PlextorExtend; cdb[1] = (byte)PlextorSubCommands.GetMode; @@ -352,7 +352,7 @@ public partial class Device { buffer = new byte[8]; senseBuffer = new byte[64]; - var cdb = new byte[12]; + byte[] cdb = new byte[12]; cdb[0] = (byte)ScsiCommands.PlextorExtend; cdb[1] = (byte)PlextorSubCommands.GetMode; @@ -386,7 +386,7 @@ public partial class Device { buffer = new byte[8]; senseBuffer = new byte[64]; - var cdb = new byte[12]; + byte[] cdb = new byte[12]; cdb[0] = (byte)ScsiCommands.PlextorExtend; cdb[1] = (byte)PlextorSubCommands.GetMode; @@ -423,7 +423,7 @@ public partial class Device { buffer = new byte[8]; senseBuffer = new byte[64]; - var cdb = new byte[12]; + byte[] cdb = new byte[12]; cdb[0] = (byte)ScsiCommands.PlextorExtend; cdb[2] = (byte)PlextorSubCommands.SecuRec; @@ -454,7 +454,7 @@ public partial class Device { buffer = new byte[8]; senseBuffer = new byte[64]; - var cdb = new byte[12]; + byte[] cdb = new byte[12]; cdb[0] = (byte)ScsiCommands.PlextorExtend; cdb[1] = (byte)PlextorSubCommands.GetMode; @@ -486,7 +486,7 @@ public partial class Device { buffer = new byte[8]; senseBuffer = new byte[64]; - var cdb = new byte[12]; + byte[] cdb = new byte[12]; cdb[0] = (byte)ScsiCommands.PlextorExtend; cdb[1] = (byte)PlextorSubCommands.GetMode; @@ -522,7 +522,7 @@ public partial class Device { buffer = new byte[8]; senseBuffer = new byte[64]; - var cdb = new byte[12]; + byte[] cdb = new byte[12]; cdb[0] = (byte)ScsiCommands.PlextorExtend; cdb[1] = (byte)PlextorSubCommands.GetMode; @@ -559,7 +559,7 @@ public partial class Device { buffer = new byte[8]; senseBuffer = new byte[64]; - var cdb = new byte[12]; + byte[] cdb = new byte[12]; cdb[0] = (byte)ScsiCommands.PlextorExtend; cdb[1] = (byte)PlextorSubCommands.GetMode; diff --git a/Aaru.Devices/Device/ScsiCommands/SBC.cs b/Aaru.Devices/Device/ScsiCommands/SBC.cs index cf5095d91..42d9cf688 100644 --- a/Aaru.Devices/Device/ScsiCommands/SBC.cs +++ b/Aaru.Devices/Device/ScsiCommands/SBC.cs @@ -31,7 +31,7 @@ // ****************************************************************************/ using System; -using Aaru.Console; +using Aaru.Logging; namespace Aaru.Devices; @@ -62,7 +62,7 @@ public partial class Device uint timeout, out double duration) { senseBuffer = new byte[64]; - var cdb = new byte[6]; + byte[] cdb = new byte[6]; cdb[0] = (byte)ScsiCommands.Read6; cdb[1] = (byte)((lba & 0x1F0000) >> 16); @@ -113,7 +113,7 @@ public partial class Device out double duration) { senseBuffer = new byte[64]; - var cdb = new byte[10]; + byte[] cdb = new byte[10]; cdb[0] = (byte)ScsiCommands.Read10; cdb[1] = (byte)((rdprotect & 0x07) << 5); @@ -178,7 +178,7 @@ public partial class Device uint timeout, out double duration) { senseBuffer = new byte[64]; - var cdb = new byte[12]; + byte[] cdb = new byte[12]; cdb[0] = (byte)ScsiCommands.Read12; cdb[1] = (byte)((rdprotect & 0x07) << 5); @@ -246,7 +246,7 @@ public partial class Device out double duration) { senseBuffer = new byte[64]; - var cdb = new byte[16]; + byte[] cdb = new byte[16]; byte[] lbaBytes = BitConverter.GetBytes(lba); cdb[0] = (byte)ScsiCommands.Read16; @@ -308,7 +308,7 @@ public partial class Device ushort transferBytes, uint timeout, out double duration) { senseBuffer = new byte[64]; - var cdb = new byte[10]; + byte[] cdb = new byte[10]; cdb[0] = (byte)ScsiCommands.ReadLong; @@ -356,7 +356,7 @@ public partial class Device uint timeout, out double duration) { senseBuffer = new byte[64]; - var cdb = new byte[16]; + byte[] cdb = new byte[16]; byte[] lbaBytes = BitConverter.GetBytes(lba); cdb[0] = (byte)ScsiCommands.ServiceActionIn; @@ -399,7 +399,7 @@ public partial class Device public bool Seek6(out byte[] senseBuffer, uint lba, uint timeout, out double duration) { senseBuffer = new byte[64]; - var cdb = new byte[6]; + byte[] cdb = new byte[6]; byte[] buffer = []; cdb[0] = (byte)ScsiCommands.Seek6; @@ -430,7 +430,7 @@ public partial class Device public bool Seek10(out byte[] senseBuffer, uint lba, uint timeout, out double duration) { senseBuffer = new byte[64]; - var cdb = new byte[10]; + byte[] cdb = new byte[10]; byte[] buffer = []; cdb[0] = (byte)ScsiCommands.Seek10; diff --git a/Aaru.Devices/Device/ScsiCommands/SMC.cs b/Aaru.Devices/Device/ScsiCommands/SMC.cs index 45ac4e737..a88d775c3 100644 --- a/Aaru.Devices/Device/ScsiCommands/SMC.cs +++ b/Aaru.Devices/Device/ScsiCommands/SMC.cs @@ -30,7 +30,7 @@ // Copyright © 2011-2025 Natalia Portillo // ****************************************************************************/ -using Aaru.Console; +using Aaru.Logging; namespace Aaru.Devices; @@ -53,7 +53,7 @@ public partial class Device uint timeout, out double duration) { buffer = new byte[256]; - var cdb = new byte[16]; + byte[] cdb = new byte[16]; senseBuffer = new byte[64]; cdb[0] = (byte)ScsiCommands.ReadAttribute; @@ -84,7 +84,7 @@ public partial class Device if(sense) return true; - var attrLen = (uint)((buffer[0] << 24) + (buffer[1] << 16) + (buffer[2] << 8) + buffer[3] + 4); + uint attrLen = (uint)((buffer[0] << 24) + (buffer[1] << 16) + (buffer[2] << 8) + buffer[3] + 4); buffer = new byte[attrLen]; cdb[10] = (byte)((buffer.Length & 0xFF000000) >> 24); cdb[11] = (byte)((buffer.Length & 0xFF0000) >> 16); diff --git a/Aaru.Devices/Device/ScsiCommands/SPC.cs b/Aaru.Devices/Device/ScsiCommands/SPC.cs index 39e7cae78..139dc185d 100644 --- a/Aaru.Devices/Device/ScsiCommands/SPC.cs +++ b/Aaru.Devices/Device/ScsiCommands/SPC.cs @@ -32,7 +32,7 @@ using System; using System.Diagnostics.CodeAnalysis; -using Aaru.Console; +using Aaru.Logging; using PlatformID = Aaru.CommonTypes.Interop.PlatformID; // ReSharper disable UnusedMember.Global @@ -91,7 +91,7 @@ public partial class Device if(sense) return true; - var pagesLength = (byte)(buffer[4] + 5); + byte pagesLength = (byte)(buffer[4] + 5); cdb = [(byte)ScsiCommands.Inquiry, 0, 0, 0, pagesLength, 0]; @@ -174,7 +174,7 @@ public partial class Device // This is because INQ was returned instead of EVPD if(buffer[1] != page) return true; - var pagesLength = (byte)(buffer[3] + 4); + byte pagesLength = (byte)(buffer[3] + 4); cdb = [(byte)ScsiCommands.Inquiry, 1, page, 0, pagesLength, 0]; @@ -260,7 +260,7 @@ public partial class Device byte pageCode, byte subPageCode, uint timeout, out double duration) { senseBuffer = new byte[64]; - var cdb = new byte[6]; + byte[] cdb = new byte[6]; buffer = new byte[254]; cdb[0] = (byte)ScsiCommands.ModeSense; @@ -285,7 +285,7 @@ public partial class Device if(sense) return true; - var modeLength = (byte)(buffer[0] + 1); + byte modeLength = (byte)(buffer[0] + 1); if(modeLength % 2 != 0) modeLength++; buffer = new byte[modeLength]; @@ -350,7 +350,7 @@ public partial class Device out double duration) { senseBuffer = new byte[64]; - var cdb = new byte[10]; + byte[] cdb = new byte[10]; buffer = new byte[4096]; cdb[0] = (byte)ScsiCommands.ModeSense10; @@ -378,7 +378,7 @@ public partial class Device if(sense) return true; - var modeLength = (ushort)((buffer[0] << 8) + buffer[1] + 2); + ushort modeLength = (ushort)((buffer[0] << 8) + buffer[1] + 2); if(modeLength % 2 != 0) modeLength++; buffer = new byte[modeLength]; @@ -438,7 +438,7 @@ public partial class Device out double duration) { senseBuffer = new byte[64]; - var cdb = new byte[6]; + byte[] cdb = new byte[6]; byte[] buffer = []; cdb[0] = (byte)ScsiCommands.PreventAllowMediumRemoval; @@ -481,7 +481,7 @@ public partial class Device uint timeout, out double duration) { senseBuffer = new byte[64]; - var cdb = new byte[10]; + byte[] cdb = new byte[10]; buffer = new byte[8]; cdb[0] = (byte)ScsiCommands.ReadCapacity; @@ -534,7 +534,7 @@ public partial class Device out double duration) { senseBuffer = new byte[64]; - var cdb = new byte[16]; + byte[] cdb = new byte[16]; buffer = new byte[32]; cdb[0] = (byte)ScsiCommands.ServiceActionIn; @@ -583,7 +583,7 @@ public partial class Device public bool ReadMediaSerialNumber(out byte[] buffer, out byte[] senseBuffer, uint timeout, out double duration) { senseBuffer = new byte[64]; - var cdb = new byte[12]; + byte[] cdb = new byte[12]; buffer = new byte[4]; cdb[0] = (byte)ScsiCommands.ReadSerialNumber; @@ -605,7 +605,7 @@ public partial class Device if(sense) return true; - var strctLength = (uint)((buffer[0] << 24) + (buffer[1] << 16) + (buffer[2] << 8) + buffer[3] + 4); + uint strctLength = (uint)((buffer[0] << 24) + (buffer[1] << 16) + (buffer[2] << 8) + buffer[3] + 4); buffer = new byte[strctLength]; cdb[6] = (byte)((buffer.Length & 0xFF000000) >> 24); cdb[7] = (byte)((buffer.Length & 0xFF0000) >> 16); @@ -775,7 +775,7 @@ public partial class Device return true; } - var cdb = new byte[6]; + byte[] cdb = new byte[6]; cdb[0] = (byte)ScsiCommands.ModeSelect; @@ -832,7 +832,7 @@ public partial class Device return true; } - var cdb = new byte[10]; + byte[] cdb = new byte[10]; cdb[0] = (byte)ScsiCommands.ModeSelect10; @@ -874,7 +874,7 @@ public partial class Device /// true if the command failed. public bool RequestSense(bool descriptor, out byte[] buffer, uint timeout, out double duration) { - var cdb = new byte[6]; + byte[] cdb = new byte[6]; buffer = new byte[252]; cdb[0] = (byte)ScsiCommands.RequestSense; diff --git a/Aaru.Devices/Device/ScsiCommands/SSC.cs b/Aaru.Devices/Device/ScsiCommands/SSC.cs index 858f4178c..88c13fc00 100644 --- a/Aaru.Devices/Device/ScsiCommands/SSC.cs +++ b/Aaru.Devices/Device/ScsiCommands/SSC.cs @@ -32,7 +32,7 @@ using System; using System.Diagnostics.CodeAnalysis; -using Aaru.Console; +using Aaru.Logging; // ReSharper disable UnusedMember.Global @@ -74,7 +74,7 @@ public partial class Device uint timeout, out double duration) { senseBuffer = new byte[64]; - var cdb = new byte[6]; + byte[] cdb = new byte[6]; byte[] buffer = []; cdb[0] = (byte)ScsiCommands.LoadUnload; @@ -160,7 +160,7 @@ public partial class Device uint objectId, uint timeout, out double duration) { senseBuffer = new byte[64]; - var cdb = new byte[10]; + byte[] cdb = new byte[10]; byte[] buffer = []; cdb[0] = (byte)ScsiCommands.Locate; @@ -258,7 +258,7 @@ public partial class Device bool bam, byte partition, ulong identifier, uint timeout, out double duration) { senseBuffer = new byte[64]; - var cdb = new byte[16]; + byte[] cdb = new byte[16]; byte[] buffer = []; byte[] idBytes = BitConverter.GetBytes(identifier); @@ -348,7 +348,7 @@ public partial class Device uint blockSize, uint timeout, out double duration) { buffer = fixedLen ? new byte[blockSize * transferLen] : new byte[transferLen]; - var cdb = new byte[6]; + byte[] cdb = new byte[6]; senseBuffer = new byte[64]; cdb[0] = (byte)ScsiCommands.Read6; @@ -457,7 +457,7 @@ public partial class Device ulong objectId, uint transferLen, uint objectSize, uint timeout, out double duration) { buffer = fixedLen ? new byte[objectSize * transferLen] : new byte[transferLen]; - var cdb = new byte[6]; + byte[] cdb = new byte[6]; senseBuffer = new byte[64]; byte[] idBytes = BitConverter.GetBytes(objectId); @@ -503,7 +503,7 @@ public partial class Device public bool ReadBlockLimits(out byte[] buffer, out byte[] senseBuffer, uint timeout, out double duration) { buffer = new byte[6]; - var cdb = new byte[6]; + byte[] cdb = new byte[6]; senseBuffer = new byte[64]; cdb[0] = (byte)ScsiCommands.ReadBlockLimits; @@ -584,7 +584,7 @@ public partial class Device _ => new byte[32] }; - var cdb = new byte[10]; + byte[] cdb = new byte[10]; senseBuffer = new byte[64]; cdb[0] = (byte)ScsiCommands.ReadPosition; @@ -661,7 +661,7 @@ public partial class Device uint transferLen, uint blockSize, uint timeout, out double duration) { buffer = fixedLen ? new byte[blockSize * transferLen] : new byte[transferLen]; - var cdb = new byte[6]; + byte[] cdb = new byte[6]; senseBuffer = new byte[64]; cdb[0] = (byte)ScsiCommands.ReadReverse; @@ -806,7 +806,7 @@ public partial class Device out double duration) { buffer = fixedLen ? new byte[objectSize * transferLen] : new byte[transferLen]; - var cdb = new byte[6]; + byte[] cdb = new byte[6]; senseBuffer = new byte[64]; byte[] idBytes = BitConverter.GetBytes(objectId); @@ -888,7 +888,7 @@ public partial class Device uint transferLen, uint blockSize, uint timeout, out double duration) { buffer = fixedLen ? new byte[blockSize * transferLen] : new byte[transferLen]; - var cdb = new byte[6]; + byte[] cdb = new byte[6]; senseBuffer = new byte[64]; cdb[0] = (byte)ScsiCommands.RecoverBufferedData; @@ -945,7 +945,7 @@ public partial class Device uint timeout, out double duration) { buffer = new byte[256]; - var cdb = new byte[10]; + byte[] cdb = new byte[10]; senseBuffer = new byte[64]; cdb[0] = (byte)ScsiCommands.ReportDensitySupport; @@ -969,7 +969,7 @@ public partial class Device if(sense) return true; - var availableLength = (ushort)((buffer[0] << 8) + buffer[1] + 2); + ushort availableLength = (ushort)((buffer[0] << 8) + buffer[1] + 2); buffer = new byte[availableLength]; cdb[7] = (byte)((buffer.Length & 0xFF00) >> 8); cdb[8] = (byte)(buffer.Length & 0xFF); @@ -1005,7 +1005,7 @@ public partial class Device public bool Rewind(out byte[] senseBuffer, bool immediate, uint timeout, out double duration) { senseBuffer = new byte[64]; - var cdb = new byte[6]; + byte[] cdb = new byte[6]; byte[] buffer = []; cdb[0] = (byte)ScsiCommands.Rewind; @@ -1036,7 +1036,7 @@ public partial class Device public bool TrackSelect(out byte[] senseBuffer, byte track, uint timeout, out double duration) { senseBuffer = new byte[64]; - var cdb = new byte[6]; + byte[] cdb = new byte[6]; byte[] buffer = []; cdb[0] = (byte)ScsiCommands.TrackSelect; @@ -1067,7 +1067,7 @@ public partial class Device public bool Space(out byte[] senseBuffer, SscSpaceCodes code, int count, uint timeout, out double duration) { senseBuffer = new byte[64]; - var cdb = new byte[6]; + byte[] cdb = new byte[6]; byte[] buffer = []; byte[] countB = BitConverter.GetBytes(count); diff --git a/Aaru.Devices/Device/ScsiCommands/SyQuest.cs b/Aaru.Devices/Device/ScsiCommands/SyQuest.cs index f2589e293..81c3a7b7a 100644 --- a/Aaru.Devices/Device/ScsiCommands/SyQuest.cs +++ b/Aaru.Devices/Device/ScsiCommands/SyQuest.cs @@ -30,7 +30,7 @@ // Copyright © 2011-2025 Natalia Portillo // ****************************************************************************/ -using Aaru.Console; +using Aaru.Logging; // ReSharper disable UnusedMember.Global @@ -84,8 +84,8 @@ public partial class Device bool inhibitDma, bool readLong, uint timeout, out double duration) { senseBuffer = new byte[64]; - var cdb = new byte[6]; - bool sense; + byte[] cdb = new byte[6]; + bool sense; cdb[0] = (byte)ScsiCommands.Read6; cdb[1] = (byte)((lba & 0x1F0000) >> 16); @@ -170,8 +170,8 @@ public partial class Device ushort transferLength, bool inhibitDma, bool readLong, uint timeout, out double duration) { senseBuffer = new byte[64]; - var cdb = new byte[10]; - bool sense; + byte[] cdb = new byte[10]; + bool sense; cdb[0] = (byte)ScsiCommands.Read10; cdb[2] = (byte)((lba & 0xFF000000) >> 24); diff --git a/Aaru.Devices/Remote/Remote.cs b/Aaru.Devices/Remote/Remote.cs index 412e534b2..58b3199f8 100644 --- a/Aaru.Devices/Remote/Remote.cs +++ b/Aaru.Devices/Remote/Remote.cs @@ -41,8 +41,8 @@ using System.Net.Sockets; using System.Runtime.InteropServices; using Aaru.CommonTypes.Enums; using Aaru.CommonTypes.Interop; -using Aaru.Console; using Aaru.Decoders.ATA; +using Aaru.Logging; using Marshal = Aaru.Helpers.Marshal; using Version = Aaru.CommonTypes.Interop.Version; @@ -88,7 +88,7 @@ public class Remote : IDisposable AaruConsole.WriteLine(Localization.Connected_to_0, uri.Host); - var hdrBuf = new byte[Marshal.SizeOf()]; + byte[] hdrBuf = new byte[Marshal.SizeOf()]; int len = Receive(_socket, hdrBuf, hdrBuf.Length, SocketFlags.Peek); @@ -237,7 +237,7 @@ public class Remote : IDisposable return false; } - var hdrBuf = new byte[Marshal.SizeOf()]; + byte[] hdrBuf = new byte[Marshal.SizeOf()]; len = Receive(_socket, hdrBuf, hdrBuf.Length, SocketFlags.Peek); @@ -330,7 +330,7 @@ public class Remote : IDisposable return []; } - var hdrBuf = new byte[Marshal.SizeOf()]; + byte[] hdrBuf = new byte[Marshal.SizeOf()]; len = Receive(_socket, hdrBuf, hdrBuf.Length, SocketFlags.Peek); @@ -450,7 +450,7 @@ public class Remote : IDisposable return false; } - var hdrBuf = new byte[Marshal.SizeOf()]; + byte[] hdrBuf = new byte[Marshal.SizeOf()]; len = Receive(_socket, hdrBuf, hdrBuf.Length, SocketFlags.Peek); @@ -549,7 +549,7 @@ public class Remote : IDisposable cmdPkt.hdr.len = (uint)(Marshal.SizeOf() + cmdPkt.cdb_len + cmdPkt.buf_len); byte[] pktBuf = Marshal.StructureToByteArrayLittleEndian(cmdPkt); - var buf = new byte[cmdPkt.hdr.len]; + byte[] buf = new byte[cmdPkt.hdr.len]; Array.Copy(pktBuf, 0, buf, 0, Marshal.SizeOf()); @@ -567,7 +567,7 @@ public class Remote : IDisposable return -1; } - var hdrBuf = new byte[Marshal.SizeOf()]; + byte[] hdrBuf = new byte[Marshal.SizeOf()]; len = Receive(_socket, hdrBuf, hdrBuf.Length, SocketFlags.Peek); @@ -659,7 +659,7 @@ public class Remote : IDisposable cmdPkt.hdr.len = (uint)(Marshal.SizeOf() + cmdPkt.buf_len); byte[] pktBuf = Marshal.StructureToByteArrayLittleEndian(cmdPkt); - var buf = new byte[cmdPkt.hdr.len]; + byte[] buf = new byte[cmdPkt.hdr.len]; Array.Copy(pktBuf, 0, buf, 0, Marshal.SizeOf()); @@ -674,7 +674,7 @@ public class Remote : IDisposable return -1; } - var hdrBuf = new byte[Marshal.SizeOf()]; + byte[] hdrBuf = new byte[Marshal.SizeOf()]; len = Receive(_socket, hdrBuf, hdrBuf.Length, SocketFlags.Peek); @@ -765,7 +765,7 @@ public class Remote : IDisposable cmdPkt.hdr.len = (uint)(Marshal.SizeOf() + cmdPkt.buf_len); byte[] pktBuf = Marshal.StructureToByteArrayLittleEndian(cmdPkt); - var buf = new byte[cmdPkt.hdr.len]; + byte[] buf = new byte[cmdPkt.hdr.len]; Array.Copy(pktBuf, 0, buf, 0, Marshal.SizeOf()); @@ -780,7 +780,7 @@ public class Remote : IDisposable return -1; } - var hdrBuf = new byte[Marshal.SizeOf()]; + byte[] hdrBuf = new byte[Marshal.SizeOf()]; len = Receive(_socket, hdrBuf, hdrBuf.Length, SocketFlags.Peek); @@ -872,7 +872,7 @@ public class Remote : IDisposable cmdPkt.hdr.len = (uint)(Marshal.SizeOf() + cmdPkt.buf_len); byte[] pktBuf = Marshal.StructureToByteArrayLittleEndian(cmdPkt); - var buf = new byte[cmdPkt.hdr.len]; + byte[] buf = new byte[cmdPkt.hdr.len]; Array.Copy(pktBuf, 0, buf, 0, Marshal.SizeOf()); @@ -887,7 +887,7 @@ public class Remote : IDisposable return -1; } - var hdrBuf = new byte[Marshal.SizeOf()]; + byte[] hdrBuf = new byte[Marshal.SizeOf()]; len = Receive(_socket, hdrBuf, hdrBuf.Length, SocketFlags.Peek); @@ -985,7 +985,7 @@ public class Remote : IDisposable cmdPkt.hdr.len = (uint)(Marshal.SizeOf() + cmdPkt.command.buf_len); byte[] pktBuf = Marshal.StructureToByteArrayLittleEndian(cmdPkt); - var buf = new byte[cmdPkt.hdr.len]; + byte[] buf = new byte[cmdPkt.hdr.len]; Array.Copy(pktBuf, 0, buf, 0, Marshal.SizeOf()); @@ -1000,7 +1000,7 @@ public class Remote : IDisposable return -1; } - var hdrBuf = new byte[Marshal.SizeOf()]; + byte[] hdrBuf = new byte[Marshal.SizeOf()]; len = Receive(_socket, hdrBuf, hdrBuf.Length, SocketFlags.Peek); @@ -1081,7 +1081,7 @@ public class Remote : IDisposable return DeviceType.Unknown; } - var hdrBuf = new byte[Marshal.SizeOf()]; + byte[] hdrBuf = new byte[Marshal.SizeOf()]; len = Receive(_socket, hdrBuf, hdrBuf.Length, SocketFlags.Peek); @@ -1160,7 +1160,7 @@ public class Remote : IDisposable return false; } - var hdrBuf = new byte[Marshal.SizeOf()]; + byte[] hdrBuf = new byte[Marshal.SizeOf()]; len = Receive(_socket, hdrBuf, hdrBuf.Length, SocketFlags.Peek); @@ -1286,7 +1286,7 @@ public class Remote : IDisposable return false; } - var hdrBuf = new byte[Marshal.SizeOf()]; + byte[] hdrBuf = new byte[Marshal.SizeOf()]; len = Receive(_socket, hdrBuf, hdrBuf.Length, SocketFlags.Peek); @@ -1378,7 +1378,7 @@ public class Remote : IDisposable return false; } - var hdrBuf = new byte[Marshal.SizeOf()]; + byte[] hdrBuf = new byte[Marshal.SizeOf()]; len = Receive(_socket, hdrBuf, hdrBuf.Length, SocketFlags.Peek); @@ -1459,7 +1459,7 @@ public class Remote : IDisposable return false; } - var hdrBuf = new byte[Marshal.SizeOf()]; + byte[] hdrBuf = new byte[Marshal.SizeOf()]; len = Receive(_socket, hdrBuf, hdrBuf.Length, SocketFlags.Peek); @@ -1514,7 +1514,7 @@ public class Remote : IDisposable /// Retrieved number of bytes static int Receive(Socket socket, byte[] buffer, int size, SocketFlags socketFlags) { - var offset = 0; + int offset = 0; while(size > 0) { @@ -1591,7 +1591,7 @@ public class Remote : IDisposable } }; - var buf = new byte[packetSize]; + byte[] buf = new byte[packetSize]; byte[] tmp = Marshal.StructureToByteArrayLittleEndian(packet); Array.Copy(tmp, 0, buf, 0, tmp.Length); @@ -1634,7 +1634,7 @@ public class Remote : IDisposable return -1; } - var hdrBuf = new byte[Marshal.SizeOf()]; + byte[] hdrBuf = new byte[Marshal.SizeOf()]; len = Receive(_socket, hdrBuf, hdrBuf.Length, SocketFlags.Peek); @@ -1685,7 +1685,7 @@ public class Remote : IDisposable off = Marshal.SizeOf(); - var error = 0; + int error = 0; foreach(Devices.Device.MmcSingleCommand command in commands) { @@ -1727,7 +1727,7 @@ public class Remote : IDisposable { sense = false; duration = 0; - var error = 0; + int error = 0; foreach(Devices.Device.MmcSingleCommand command in commands) { @@ -1781,7 +1781,7 @@ public class Remote : IDisposable return false; } - var hdrBuf = new byte[Marshal.SizeOf()]; + byte[] hdrBuf = new byte[Marshal.SizeOf()]; len = Receive(_socket, hdrBuf, hdrBuf.Length, SocketFlags.Peek); @@ -1883,7 +1883,7 @@ public class Remote : IDisposable return false; } - var hdrBuf = new byte[Marshal.SizeOf()]; + byte[] hdrBuf = new byte[Marshal.SizeOf()]; len = Receive(_socket, hdrBuf, hdrBuf.Length, SocketFlags.Peek); diff --git a/Aaru.Filesystems/Aaru.Filesystems.csproj b/Aaru.Filesystems/Aaru.Filesystems.csproj index f2e5101ed..66b23743c 100644 --- a/Aaru.Filesystems/Aaru.Filesystems.csproj +++ b/Aaru.Filesystems/Aaru.Filesystems.csproj @@ -42,7 +42,7 @@ - + diff --git a/Aaru.Filesystems/Acorn/Info.cs b/Aaru.Filesystems/Acorn/Info.cs index 3ce31e81d..5d2891034 100644 --- a/Aaru.Filesystems/Acorn/Info.cs +++ b/Aaru.Filesystems/Acorn/Info.cs @@ -31,8 +31,8 @@ using System.Text; using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Enums; using Aaru.CommonTypes.Interfaces; -using Aaru.Console; using Aaru.Helpers; +using Aaru.Logging; using Partition = Aaru.CommonTypes.Partition; namespace Aaru.Filesystems; @@ -84,7 +84,7 @@ public sealed partial class AcornADFS if(errno != ErrorNumber.NoError) return false; - var tmp = new byte[256]; + byte[] tmp = new byte[256]; Array.Copy(sector, 256, tmp, 0, 256); oldChk1 = AcornMapChecksum(tmp, 255); oldMap1 = Marshal.ByteArrayToStructureLittleEndian(tmp); @@ -109,7 +109,7 @@ public sealed partial class AcornADFS if(sector.Length > OLD_DIRECTORY_SIZE) { - var tmp = new byte[OLD_DIRECTORY_SIZE]; + byte[] tmp = new byte[OLD_DIRECTORY_SIZE]; Array.Copy(sector, 0, tmp, 0, OLD_DIRECTORY_SIZE - 53); Array.Copy(sector, sector.Length - 54, tmp, OLD_DIRECTORY_SIZE - 54, 53); sector = tmp; @@ -144,7 +144,7 @@ public sealed partial class AcornADFS if(sector.Length > OLD_DIRECTORY_SIZE) { - var tmp = new byte[OLD_DIRECTORY_SIZE]; + byte[] tmp = new byte[OLD_DIRECTORY_SIZE]; Array.Copy(sector, 0, tmp, 0, OLD_DIRECTORY_SIZE - 53); Array.Copy(sector, sector.Length - 54, tmp, OLD_DIRECTORY_SIZE - 54, 53); sector = tmp; @@ -191,11 +191,11 @@ public sealed partial class AcornADFS if(errno != ErrorNumber.NoError) return false; - var bootChk = 0; + int bootChk = 0; if(bootSector.Length < 512) return false; - for(var i = 0; i < 0x1FF; i++) bootChk = (bootChk & 0xFF) + (bootChk >> 8) + bootSector[i]; + for(int i = 0; i < 0x1FF; i++) bootChk = (bootChk & 0xFF) + (bootChk >> 8) + bootSector[i]; AaruConsole.DebugWriteLine(MODULE_NAME, "bootChk = {0}", bootChk); AaruConsole.DebugWriteLine(MODULE_NAME, "bBlock.checksum = {0}", bootSector[0x1FF]); @@ -279,7 +279,7 @@ public sealed partial class AcornADFS if(errno != ErrorNumber.NoError) return; - var tmp = new byte[256]; + byte[] tmp = new byte[256]; Array.Copy(sector, 256, tmp, 0, 256); oldChk1 = AcornMapChecksum(tmp, 255); oldMap1 = Marshal.ByteArrayToStructureLittleEndian(tmp); @@ -291,9 +291,9 @@ public sealed partial class AcornADFS oldMap1.checksum != 0) { bytes = (ulong)((oldMap0.size[2] << 16) + (oldMap0.size[1] << 8) + oldMap0.size[0]) * 256; - var namebytes = new byte[10]; + byte[] namebytes = new byte[10]; - for(var i = 0; i < 5; i++) + for(int i = 0; i < 5; i++) { namebytes[i * 2] = oldMap0.name[i]; namebytes[i * 2 + 1] = oldMap1.name[i]; @@ -320,7 +320,7 @@ public sealed partial class AcornADFS if(sector.Length > OLD_DIRECTORY_SIZE) { - var tmp = new byte[OLD_DIRECTORY_SIZE]; + byte[] tmp = new byte[OLD_DIRECTORY_SIZE]; Array.Copy(sector, 0, tmp, 0, OLD_DIRECTORY_SIZE - 53); Array.Copy(sector, sector.Length - 54, tmp, OLD_DIRECTORY_SIZE - 54, 53); sector = tmp; @@ -344,7 +344,7 @@ public sealed partial class AcornADFS if(sector.Length > OLD_DIRECTORY_SIZE) { - var tmp = new byte[OLD_DIRECTORY_SIZE]; + byte[] tmp = new byte[OLD_DIRECTORY_SIZE]; Array.Copy(sector, 0, tmp, 0, OLD_DIRECTORY_SIZE - 53); Array.Copy(sector, sector.Length - 54, tmp, OLD_DIRECTORY_SIZE - 54, 53); @@ -364,7 +364,7 @@ public sealed partial class AcornADFS if(sector.Length > NEW_DIRECTORY_SIZE) { - var tmp = new byte[NEW_DIRECTORY_SIZE]; + byte[] tmp = new byte[NEW_DIRECTORY_SIZE]; Array.Copy(sector, 0, tmp, 0, NEW_DIRECTORY_SIZE - 41); Array.Copy(sector, sector.Length - 42, tmp, NEW_DIRECTORY_SIZE - 42, 41); @@ -423,9 +423,9 @@ public sealed partial class AcornADFS if(errno != ErrorNumber.NoError) return; - var bootChk = 0; + int bootChk = 0; - for(var i = 0; i < 0x1FF; i++) bootChk = (bootChk & 0xFF) + (bootChk >> 8) + bootSector[i]; + for(int i = 0; i < 0x1FF; i++) bootChk = (bootChk & 0xFF) + (bootChk >> 8) + bootSector[i]; AaruConsole.DebugWriteLine(MODULE_NAME, "bootChk = {0}", bootChk); AaruConsole.DebugWriteLine(MODULE_NAME, "bBlock.checksum = {0}", bootSector[0x1FF]); diff --git a/Aaru.Filesystems/AmigaDOS/Info.cs b/Aaru.Filesystems/AmigaDOS/Info.cs index 74d3f996a..b41cc86ea 100644 --- a/Aaru.Filesystems/AmigaDOS/Info.cs +++ b/Aaru.Filesystems/AmigaDOS/Info.cs @@ -33,8 +33,8 @@ using Aaru.Checksums; using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Enums; using Aaru.CommonTypes.Interfaces; -using Aaru.Console; using Aaru.Helpers; +using Aaru.Logging; using Partition = Aaru.CommonTypes.Partition; namespace Aaru.Filesystems; @@ -124,7 +124,7 @@ public sealed partial class AmigaDOSPlugin AaruConsole.DebugWriteLine(MODULE_NAME, "rblk.hashTableSize = {0}", rblk.hashTableSize); uint blockSize = (rblk.hashTableSize + 56) * 4; - var sectorsPerBlock = (uint)(blockSize / sector.Length); + uint sectorsPerBlock = (uint)(blockSize / sector.Length); AaruConsole.DebugWriteLine(MODULE_NAME, "blockSize = {0}", blockSize); AaruConsole.DebugWriteLine(MODULE_NAME, "sectorsPerBlock = {0}", sectorsPerBlock); @@ -192,7 +192,7 @@ public sealed partial class AmigaDOSPlugin var rootBlk = new RootBlock(); byte[] rootBlockSector = null; - var rootFound = false; + bool rootFound = false; uint blockSize = 0; // So to handle even number of sectors @@ -214,7 +214,7 @@ public sealed partial class AmigaDOSPlugin AaruConsole.DebugWriteLine(MODULE_NAME, "rootBlk.hashTableSize = {0}", rootBlk.hashTableSize); blockSize = (rootBlk.hashTableSize + 56) * 4; - var sectorsPerBlock = (uint)(blockSize / rootBlockSector.Length); + uint sectorsPerBlock = (uint)(blockSize / rootBlockSector.Length); AaruConsole.DebugWriteLine(MODULE_NAME, "blockSize = {0}", blockSize); AaruConsole.DebugWriteLine(MODULE_NAME, "sectorsPerBlock = {0}", sectorsPerBlock); diff --git a/Aaru.Filesystems/AppleDOS/Super.cs b/Aaru.Filesystems/AppleDOS/Super.cs index f6007670a..a4be175cc 100644 --- a/Aaru.Filesystems/AppleDOS/Super.cs +++ b/Aaru.Filesystems/AppleDOS/Super.cs @@ -30,8 +30,8 @@ using System.Collections.Generic; using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Enums; using Aaru.CommonTypes.Interfaces; -using Aaru.Console; using Aaru.Helpers; +using Aaru.Logging; using Claunia.Encoding; using Encoding = System.Text.Encoding; using FileSystemInfo = Aaru.CommonTypes.Structs.FileSystemInfo; diff --git a/Aaru.Filesystems/AppleMFS/Dir.cs b/Aaru.Filesystems/AppleMFS/Dir.cs index 302b8d20c..1dc122ca1 100644 --- a/Aaru.Filesystems/AppleMFS/Dir.cs +++ b/Aaru.Filesystems/AppleMFS/Dir.cs @@ -31,8 +31,8 @@ using System.Collections.Generic; using System.Linq; using Aaru.CommonTypes.Enums; using Aaru.CommonTypes.Interfaces; -using Aaru.Console; using Aaru.Helpers; +using Aaru.Logging; namespace Aaru.Filesystems; @@ -111,7 +111,7 @@ public sealed partial class AppleMFS _idToEntry = new Dictionary(); _filenameToId = new Dictionary(); - var offset = 0; + int offset = 0; while(offset + 51 < _directoryBlocks.Length) { diff --git a/Aaru.Filesystems/AppleMFS/File.cs b/Aaru.Filesystems/AppleMFS/File.cs index 595dd8c02..332edfa34 100644 --- a/Aaru.Filesystems/AppleMFS/File.cs +++ b/Aaru.Filesystems/AppleMFS/File.cs @@ -31,8 +31,8 @@ using System.IO; using Aaru.CommonTypes.Enums; using Aaru.CommonTypes.Interfaces; using Aaru.CommonTypes.Structs; -using Aaru.Console; using Aaru.Helpers; +using Aaru.Logging; using FileAttributes = Aaru.CommonTypes.Structs.FileAttributes; namespace Aaru.Filesystems; diff --git a/Aaru.Filesystems/BTRFS/Info.cs b/Aaru.Filesystems/BTRFS/Info.cs index a4954075a..6b608d429 100644 --- a/Aaru.Filesystems/BTRFS/Info.cs +++ b/Aaru.Filesystems/BTRFS/Info.cs @@ -34,8 +34,8 @@ using System.Text; using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Enums; using Aaru.CommonTypes.Interfaces; -using Aaru.Console; using Aaru.Helpers; +using Aaru.Logging; using Partition = Aaru.CommonTypes.Partition; namespace Aaru.Filesystems; diff --git a/Aaru.Filesystems/CBM/Super.cs b/Aaru.Filesystems/CBM/Super.cs index 3972ffa23..f93b9acac 100644 --- a/Aaru.Filesystems/CBM/Super.cs +++ b/Aaru.Filesystems/CBM/Super.cs @@ -33,8 +33,8 @@ using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Enums; using Aaru.CommonTypes.Interfaces; using Aaru.CommonTypes.Structs; -using Aaru.Console; using Aaru.Helpers; +using Aaru.Logging; using Claunia.Encoding; using Encoding = System.Text.Encoding; using FileAttributes = Aaru.CommonTypes.Structs.FileAttributes; @@ -143,7 +143,7 @@ public sealed partial class CBM ulong nextLba = rootLba; var rootMs = new MemoryStream(); - var relativeFileWarningShown = false; + bool relativeFileWarningShown = false; do { @@ -180,7 +180,7 @@ public sealed partial class CBM // As this filesystem comes in (by nowadays standards) very small sizes, we can cache all files _cache = new Dictionary(); - var offset = 0; + int offset = 0; ulong fileId = 0; if(_debug) @@ -240,9 +240,10 @@ public sealed partial class CBM _statfs.Files++; _statfs.FreeFiles--; - for(var i = 0; i < dirEntry.name.Length; i++) - if(dirEntry.name[i] == 0xA0) - dirEntry.name[i] = 0; + for(int i = 0; i < dirEntry.name.Length; i++) + { + if(dirEntry.name[i] == 0xA0) dirEntry.name[i] = 0; + } string name = StringHandlers.CToString(dirEntry.name, encoding); diff --git a/Aaru.Filesystems/CPM/Info.cs b/Aaru.Filesystems/CPM/Info.cs index eed9e5a45..495490737 100644 --- a/Aaru.Filesystems/CPM/Info.cs +++ b/Aaru.Filesystems/CPM/Info.cs @@ -38,8 +38,8 @@ using Aaru.CommonTypes; using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Enums; using Aaru.CommonTypes.Interfaces; -using Aaru.Console; using Aaru.Helpers; +using Aaru.Logging; using Partition = Aaru.CommonTypes.Partition; namespace Aaru.Filesystems; @@ -184,11 +184,11 @@ public sealed partial class CPM if(errno == ErrorNumber.NoError) { - var amsSbOffset = 0; + int amsSbOffset = 0; - var sig1 = BitConverter.ToUInt32(sector, 0x2B); + uint sig1 = BitConverter.ToUInt32(sector, 0x2B); uint sig2 = BitConverter.ToUInt32(sector, 0x33) & 0x00FFFFFF; - var sig3 = BitConverter.ToUInt32(sector, 0x7C); + uint sig3 = BitConverter.ToUInt32(sector, 0x7C); // PCW16 extended boot record if(sig1 == 0x4D2F5043 && sig2 == 0x004B5344 && sig3 == sig1) amsSbOffset = 0x80; @@ -203,8 +203,8 @@ public sealed partial class CPM amsSb.format == 2 && (amsSb.sidedness & 0x02) == 2) { // Calculate device limits - var sides = (ulong)(amsSb.format == 0 ? 1 : 2); - var sectorCount = (ulong)(amsSb.tps * amsSb.spt * (byte)sides); + ulong sides = (ulong)(amsSb.format == 0 ? 1 : 2); + ulong sectorCount = (ulong)(amsSb.tps * amsSb.spt * (byte)sides); sectorSize = (ulong)(128 << amsSb.psh); // Compare device limits from superblock to real limits @@ -221,7 +221,7 @@ public sealed partial class CPM bsh = amsSb.bsh }; - for(var i = 0; i < _dpb.bsh; i++) _dpb.blm += (byte)Math.Pow(2, i); + for(int i = 0; i < _dpb.bsh; i++) _dpb.blm += (byte)Math.Pow(2, i); if(sectorCount >= 1440) { @@ -239,10 +239,10 @@ public sealed partial class CPM _dpb.off = amsSb.off; _dpb.psh = amsSb.psh; - for(var i = 0; i < _dpb.psh; i++) _dpb.phm += (byte)Math.Pow(2, i); + for(int i = 0; i < _dpb.psh; i++) _dpb.phm += (byte)Math.Pow(2, i); - _dpb.spt = (ushort)(amsSb.spt * (sectorSize / 128)); - var directoryLength = (uint)(((ulong)_dpb.drm + 1) * 32 / sectorSize); + _dpb.spt = (ushort)(amsSb.spt * (sectorSize / 128)); + uint directoryLength = (uint)(((ulong)_dpb.drm + 1) * 32 / sectorSize); imagePlugin.ReadSectors(firstDirectorySector + partition.Start, directoryLength, @@ -274,7 +274,7 @@ public sealed partial class CPM } }; - for(var si = 0; si < amsSb.spt; si++) _workingDefinition.side1.sectorIds[si] = si + 1; + for(int si = 0; si < amsSb.spt; si++) _workingDefinition.side1.sectorIds[si] = si + 1; if(amsSb.format == 2) { @@ -291,7 +291,7 @@ public sealed partial class CPM sectorIds = new int[amsSb.spt] }; - for(var si = 0; si < amsSb.spt; si++) _workingDefinition.side2.sectorIds[si] = si + 1; + for(int si = 0; si < amsSb.spt; si++) _workingDefinition.side2.sectorIds[si] = si + 1; } else _workingDefinition.order = null; @@ -316,7 +316,7 @@ public sealed partial class CPM ushort sum = 0; // Sum of all 16-bit words that make this sector must be 0 - for(var i = 0; i < sector.Length; i += 2) sum += BitConverter.ToUInt16(sector, i); + for(int i = 0; i < sector.Length; i += 2) sum += BitConverter.ToUInt16(sector, i); // It may happen that there is a corrupted superblock // Better to ignore corrupted than to false positive the rest @@ -327,9 +327,9 @@ public sealed partial class CPM // Calculate volume size sectorSize = (ulong)(hddSb.recordsPerSector * 128); - var sectorsInPartition = (ulong)(hddSb.cylinders * hddSb.heads * hddSb.sectorsPerTrack); + ulong sectorsInPartition = (ulong)(hddSb.cylinders * hddSb.heads * hddSb.sectorsPerTrack); - var startingSector = + ulong startingSector = (ulong)((hddSb.firstCylinder * hddSb.heads + hddSb.heads) * hddSb.sectorsPerTrack); // If volume size corresponds with working partition (this variant will be inside MBR partitioning) @@ -361,7 +361,7 @@ public sealed partial class CPM spt = hddSb.spt }; - var directoryLength = (uint)(((ulong)_dpb.drm + 1) * 32 / sectorSize); + uint directoryLength = (uint)(((ulong)_dpb.drm + 1) * 32 / sectorSize); imagePlugin.ReadSectors(firstDirectorySector + partition.Start, directoryLength, @@ -403,10 +403,10 @@ public sealed partial class CPM sofs = 0 }; - for(var si = 0; si < hddSb.sectorsPerTrack; si++) + for(int si = 0; si < hddSb.sectorsPerTrack; si++) _workingDefinition.side1.sectorIds[si] = si + 1; - for(var si = 0; si < hddSb.spt; si++) _workingDefinition.side2.sectorIds[si] = si + 1; + for(int si = 0; si < hddSb.spt; si++) _workingDefinition.side2.sectorIds[si] = si + 1; } } } @@ -491,7 +491,7 @@ public sealed partial class CPM sofs = 0 }; - for(var si = 0; si < 8; si++) _workingDefinition.side1.sectorIds[si] = si + 1; + for(int si = 0; si < 8; si++) _workingDefinition.side1.sectorIds[si] = si + 1; } break; @@ -550,9 +550,9 @@ public sealed partial class CPM sofs = 0 }; - for(var si = 0; si < 8; si++) _workingDefinition.side1.sectorIds[si] = si + 1; + for(int si = 0; si < 8; si++) _workingDefinition.side1.sectorIds[si] = si + 1; - for(var si = 0; si < 8; si++) _workingDefinition.side2.sectorIds[si] = si + 1; + for(int si = 0; si < 8; si++) _workingDefinition.side2.sectorIds[si] = si + 1; } break; @@ -613,9 +613,9 @@ public sealed partial class CPM sofs = 0 }; - for(var si = 0; si < 9; si++) _workingDefinition.side1.sectorIds[si] = si + 1; + for(int si = 0; si < 9; si++) _workingDefinition.side1.sectorIds[si] = si + 1; - for(var si = 0; si < 9; si++) _workingDefinition.side2.sectorIds[si] = si + 1; + for(int si = 0; si < 9; si++) _workingDefinition.side2.sectorIds[si] = si + 1; } break; @@ -675,9 +675,9 @@ public sealed partial class CPM sofs = 0 }; - for(var si = 0; si < 9; si++) _workingDefinition.side1.sectorIds[si] = si + 1; + for(int si = 0; si < 9; si++) _workingDefinition.side1.sectorIds[si] = si + 1; - for(var si = 0; si < 9; si++) _workingDefinition.side2.sectorIds[si] = si + 1; + for(int si = 0; si < 9; si++) _workingDefinition.side2.sectorIds[si] = si + 1; } break; @@ -736,9 +736,9 @@ public sealed partial class CPM sofs = 0 }; - for(var si = 0; si < 9; si++) _workingDefinition.side1.sectorIds[si] = si + 1; + for(int si = 0; si < 9; si++) _workingDefinition.side1.sectorIds[si] = si + 1; - for(var si = 0; si < 9; si++) _workingDefinition.side2.sectorIds[si] = si + 1; + for(int si = 0; si < 9; si++) _workingDefinition.side2.sectorIds[si] = si + 1; } break; @@ -797,9 +797,9 @@ public sealed partial class CPM sofs = 0 }; - for(var si = 0; si < 15; si++) _workingDefinition.side1.sectorIds[si] = si + 1; + for(int si = 0; si < 15; si++) _workingDefinition.side1.sectorIds[si] = si + 1; - for(var si = 0; si < 15; si++) _workingDefinition.side2.sectorIds[si] = si + 1; + for(int si = 0; si < 15; si++) _workingDefinition.side2.sectorIds[si] = si + 1; } break; @@ -858,9 +858,9 @@ public sealed partial class CPM sofs = 0 }; - for(var si = 0; si < 18; si++) _workingDefinition.side1.sectorIds[si] = si + 1; + for(int si = 0; si < 18; si++) _workingDefinition.side1.sectorIds[si] = si + 1; - for(var si = 0; si < 18; si++) _workingDefinition.side2.sectorIds[si] = si + 1; + for(int si = 0; si < 18; si++) _workingDefinition.side2.sectorIds[si] = si + 1; } break; @@ -868,7 +868,7 @@ public sealed partial class CPM if(_cpmFound) { - var directoryLength = (uint)(((ulong)_dpb.drm + 1) * 32 / imagePlugin.Info.SectorSize); + uint directoryLength = (uint)(((ulong)_dpb.drm + 1) * 32 / imagePlugin.Info.SectorSize); imagePlugin.ReadSectors(firstDirectorySector86 + partition.Start, directoryLength, @@ -923,7 +923,7 @@ public sealed partial class CPM { _sectorMask = new int[def.side1.sectorIds.Length]; - for(var m = 0; m < _sectorMask.Length; m++) + for(int m = 0; m < _sectorMask.Length; m++) _sectorMask[m] = def.side1.sectorIds[m] - def.side1.sectorIds[0]; } else @@ -933,11 +933,11 @@ public sealed partial class CPM { _sectorMask = new int[def.side1.sectorIds.Length + def.side2.sectorIds.Length]; - for(var m = 0; m < def.side1.sectorIds.Length; m++) + for(int m = 0; m < def.side1.sectorIds.Length; m++) _sectorMask[m] = def.side1.sectorIds[m] - def.side1.sectorIds[0]; // Skip first track (first side) - for(var m = 0; m < def.side2.sectorIds.Length; m++) + for(int m = 0; m < def.side2.sectorIds.Length; m++) { _sectorMask[m + def.side1.sectorIds.Length] = def.side2.sectorIds[m] - def.side2.sectorIds[0] + def.side1.sectorIds.Length; @@ -950,11 +950,11 @@ public sealed partial class CPM StringComparison.InvariantCultureIgnoreCase) == 0) { - for(var m = 0; m < def.side1.sectorIds.Length; m++) + for(int m = 0; m < def.side1.sectorIds.Length; m++) _sectorMask[m] = def.side1.sectorIds[m] - def.side1.sectorIds[0]; // Skip first track (first side) and first track (second side) - for(var m = 0; m < def.side1.sectorIds.Length; m++) + for(int m = 0; m < def.side1.sectorIds.Length; m++) { _sectorMask[m + def.side1.sectorIds.Length] = def.side1.sectorIds[m] - @@ -1001,7 +1001,7 @@ public sealed partial class CPM // Read the directory marked by this definition var ms = new MemoryStream(); - for(var p = 0; p < dirLen; p++) + for(int p = 0; p < dirLen; p++) { errno = imagePlugin.ReadSector((ulong)((int)offset + (int)partition.Start + @@ -1025,8 +1025,9 @@ public sealed partial class CPM // Complement of the directory bytes if needed if(def.complement) - for(var b = 0; b < directory.Length; b++) - directory[b] = (byte)(~directory[b] & 0xFF); + { + for(int b = 0; b < directory.Length; b++) directory[b] = (byte)(~directory[b] & 0xFF); + } // Check the directory if(CheckDir(directory)) diff --git a/Aaru.Filesystems/CPM/Super.cs b/Aaru.Filesystems/CPM/Super.cs index 6afa38fac..6eb0e06fe 100644 --- a/Aaru.Filesystems/CPM/Super.cs +++ b/Aaru.Filesystems/CPM/Super.cs @@ -41,8 +41,8 @@ using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Enums; using Aaru.CommonTypes.Interfaces; using Aaru.CommonTypes.Structs; -using Aaru.Console; using Aaru.Helpers; +using Aaru.Logging; using FileAttributes = Aaru.CommonTypes.Structs.FileAttributes; using FileSystemInfo = Aaru.CommonTypes.Structs.FileSystemInfo; using Partition = Aaru.CommonTypes.Partition; @@ -69,7 +69,7 @@ public sealed partial class CPM { _sectorMask = new int[_workingDefinition.side1.sectorIds.Length]; - for(var m = 0; m < _sectorMask.Length; m++) + for(int m = 0; m < _sectorMask.Length; m++) _sectorMask[m] = _workingDefinition.side1.sectorIds[m] - _workingDefinition.side1.sectorIds[0]; } else @@ -80,11 +80,11 @@ public sealed partial class CPM _sectorMask = new int[_workingDefinition.side1.sectorIds.Length + _workingDefinition.side2.sectorIds.Length]; - for(var m = 0; m < _workingDefinition.side1.sectorIds.Length; m++) + for(int m = 0; m < _workingDefinition.side1.sectorIds.Length; m++) _sectorMask[m] = _workingDefinition.side1.sectorIds[m] - _workingDefinition.side1.sectorIds[0]; // Skip first track (first side) - for(var m = 0; m < _workingDefinition.side2.sectorIds.Length; m++) + for(int m = 0; m < _workingDefinition.side2.sectorIds.Length; m++) { _sectorMask[m + _workingDefinition.side1.sectorIds.Length] = _workingDefinition.side2.sectorIds[m] - @@ -99,11 +99,11 @@ public sealed partial class CPM StringComparison.InvariantCultureIgnoreCase) == 0) { - for(var m = 0; m < _workingDefinition.side1.sectorIds.Length; m++) + for(int m = 0; m < _workingDefinition.side1.sectorIds.Length; m++) _sectorMask[m] = _workingDefinition.side1.sectorIds[m] - _workingDefinition.side1.sectorIds[0]; // Skip first track (first side) and first track (second side) - for(var m = 0; m < _workingDefinition.side1.sectorIds.Length; m++) + for(int m = 0; m < _workingDefinition.side1.sectorIds.Length; m++) { _sectorMask[m + _workingDefinition.side1.sectorIds.Length] = _workingDefinition.side1.sectorIds[m] - @@ -156,7 +156,7 @@ public sealed partial class CPM { AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Deinterleaving_whole_volume); - for(var p = 0; p <= (int)(partition.End - partition.Start); p++) + for(int p = 0; p <= (int)(partition.End - partition.Start); p++) { ErrorNumber errno = _device.ReadSector((ulong)((int)partition.Start + @@ -167,9 +167,8 @@ public sealed partial class CPM if(errno != ErrorNumber.NoError) return errno; if(_workingDefinition.complement) - { - for(var b = 0; b < readSector.Length; b++) readSector[b] = (byte)(~readSector[b] & 0xFF); - } + for(int b = 0; b < readSector.Length; b++) + readSector[b] = (byte)(~readSector[b] & 0xFF); deinterleavedSectors.Add((ulong)p, readSector); } @@ -178,7 +177,7 @@ public sealed partial class CPM int blockSize = 128 << _dpb.bsh; var blockMs = new MemoryStream(); ulong blockNo = 0; - var sectorsPerBlock = 0; + int sectorsPerBlock = 0; Dictionary allocationBlocks = new(); AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Creating_allocation_blocks); @@ -191,9 +190,9 @@ public sealed partial class CPM // May it happen? Just in case, CP/M blocks are smaller than physical sectors if(sector.Length > blockSize) { - for(var i = 0; i < sector.Length / blockSize; i++) + for(int i = 0; i < sector.Length / blockSize; i++) { - var tmp = new byte[blockSize]; + byte[] tmp = new byte[blockSize]; Array.Copy(sector, blockSize * i, tmp, 0, blockSize); allocationBlocks.Add(blockNo++, tmp); } @@ -230,7 +229,7 @@ public sealed partial class CPM // Read the whole directory blocks var dirMs = new MemoryStream(); - for(var d = 0; d < dirSectors; d++) + for(int d = 0; d < dirSectors; d++) { deinterleavedSectors.TryGetValue((ulong)(d + dirOff), out byte[] sector); dirMs.Write(sector, 0, sector.Length); @@ -240,7 +239,7 @@ public sealed partial class CPM if(directory == null) return ErrorNumber.InvalidArgument; - var dirCnt = 0; + int dirCnt = 0; string file1 = null; string file2 = null; string file3 = null; @@ -249,7 +248,7 @@ public sealed partial class CPM _statCache = new Dictionary(); _cpmStat = new FileSystemInfo(); - var atime = false; + bool atime = false; _dirList = []; _labelCreationDate = null; _labelUpdateDate = null; @@ -258,7 +257,7 @@ public sealed partial class CPM AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Traversing_directory); // For each directory entry - for(var dOff = 0; dOff < directory.Length; dOff += 32) + for(int dOff = 0; dOff < directory.Length; dOff += 32) { switch(directory[dOff] & 0x7F) @@ -276,15 +275,15 @@ public sealed partial class CPM //bool backed = (entry.filename[3] & 0x80) == 0x80 || (entry.extension[3] & 0x80) == 0x80; int user = entry.statusUser & 0x0F; - var validEntry = true; + bool validEntry = true; - for(var i = 0; i < 8; i++) + for(int i = 0; i < 8; i++) { entry.filename[i] &= 0x7F; validEntry &= entry.filename[i] >= 0x20; } - for(var i = 0; i < 3; i++) + for(int i = 0; i < 3; i++) { entry.extension[i] &= 0x7F; validEntry &= entry.extension[i] >= 0x20; @@ -384,15 +383,15 @@ public sealed partial class CPM //bool backed = (entry.filename[3] & 0x80) == 0x80 || (entry.extension[3] & 0x80) == 0x80; int user = entry.statusUser & 0x0F; - var validEntry = true; + bool validEntry = true; - for(var i = 0; i < 8; i++) + for(int i = 0; i < 8; i++) { entry.filename[i] &= 0x7F; validEntry &= entry.filename[i] >= 0x20; } - for(var i = 0; i < 3; i++) + for(int i = 0; i < 3; i++) { entry.extension[i] &= 0x7F; validEntry &= entry.extension[i] >= 0x20; @@ -488,9 +487,9 @@ public sealed partial class CPM int user = entry.userNumber & 0x0F; - for(var i = 0; i < 8; i++) entry.filename[i] &= 0x7F; + for(int i = 0; i < 8; i++) entry.filename[i] &= 0x7F; - for(var i = 0; i < 3; i++) entry.extension[i] &= 0x7F; + for(int i = 0; i < 3; i++) entry.extension[i] &= 0x7F; string filename = Encoding.ASCII.GetString(entry.filename).Trim(); string extension = Encoding.ASCII.GetString(entry.extension).Trim(); @@ -506,7 +505,7 @@ public sealed partial class CPM if(_passwordCache.ContainsKey(filename)) _passwordCache.Remove(filename); // Copy whole password entry - var tmp = new byte[32]; + byte[] tmp = new byte[32]; Array.Copy(directory, dOff, tmp, 0, 32); _passwordCache.Add(filename, tmp); @@ -655,7 +654,7 @@ public sealed partial class CPM else fInfo = new FileEntryInfo(); - var ctime = new byte[4]; + byte[] ctime = new byte[4]; ctime[0] = trdPartyDateEntry.create1[0]; ctime[1] = trdPartyDateEntry.create1[1]; @@ -673,7 +672,7 @@ public sealed partial class CPM else fInfo = new FileEntryInfo(); - var ctime = new byte[4]; + byte[] ctime = new byte[4]; ctime[0] = trdPartyDateEntry.create2[0]; ctime[1] = trdPartyDateEntry.create2[1]; @@ -691,7 +690,7 @@ public sealed partial class CPM else fInfo = new FileEntryInfo(); - var ctime = new byte[4]; + byte[] ctime = new byte[4]; ctime[0] = trdPartyDateEntry.create3[0]; ctime[1] = trdPartyDateEntry.create3[1]; @@ -731,7 +730,7 @@ public sealed partial class CPM if(fileExtents.TryGetValue(filename, out Dictionary> extents)) { - for(var ex = 0; ex < extents.Count; ex++) + for(int ex = 0; ex < extents.Count; ex++) { if(!extents.TryGetValue(ex, out List alBlks)) continue; @@ -760,10 +759,10 @@ public sealed partial class CPM // For each stored password, store a decoded version of it foreach(KeyValuePair kvp in _passwordCache) { - var tmp = new byte[8]; + byte[] tmp = new byte[8]; Array.Copy(kvp.Value, 16, tmp, 0, 8); - for(var t = 0; t < 8; t++) tmp[t] ^= kvp.Value[13]; + for(int t = 0; t < 8; t++) tmp[t] ^= kvp.Value[13]; _decodedPasswordCache.Add(kvp.Key, tmp); } diff --git a/Aaru.Filesystems/EFS/Info.cs b/Aaru.Filesystems/EFS/Info.cs index 8d8add95f..96bb876e5 100644 --- a/Aaru.Filesystems/EFS/Info.cs +++ b/Aaru.Filesystems/EFS/Info.cs @@ -31,8 +31,8 @@ using System.Text; using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Enums; using Aaru.CommonTypes.Interfaces; -using Aaru.Console; using Aaru.Helpers; +using Aaru.Logging; using Partition = Aaru.CommonTypes.Partition; namespace Aaru.Filesystems; @@ -51,7 +51,7 @@ public sealed partial class EFS // Misaligned if(imagePlugin.Info.MetadataMediaType == MetadataMediaType.OpticalDisc) { - var sbSize = (uint)((Marshal.SizeOf() + 0x200) / imagePlugin.Info.SectorSize); + uint sbSize = (uint)((Marshal.SizeOf() + 0x200) / imagePlugin.Info.SectorSize); if((Marshal.SizeOf() + 0x200) % imagePlugin.Info.SectorSize != 0) sbSize++; @@ -61,7 +61,7 @@ public sealed partial class EFS if(sector.Length < Marshal.SizeOf()) return false; - var sbpiece = new byte[Marshal.SizeOf()]; + byte[] sbpiece = new byte[Marshal.SizeOf()]; Array.Copy(sector, 0x200, sbpiece, 0, Marshal.SizeOf()); @@ -78,7 +78,7 @@ public sealed partial class EFS } else { - var sbSize = (uint)(Marshal.SizeOf() / imagePlugin.Info.SectorSize); + uint sbSize = (uint)(Marshal.SizeOf() / imagePlugin.Info.SectorSize); if(Marshal.SizeOf() % imagePlugin.Info.SectorSize != 0) sbSize++; @@ -118,7 +118,7 @@ public sealed partial class EFS // Misaligned if(imagePlugin.Info.MetadataMediaType == MetadataMediaType.OpticalDisc) { - var sbSize = (uint)((Marshal.SizeOf() + 0x400) / imagePlugin.Info.SectorSize); + uint sbSize = (uint)((Marshal.SizeOf() + 0x400) / imagePlugin.Info.SectorSize); if((Marshal.SizeOf() + 0x400) % imagePlugin.Info.SectorSize != 0) sbSize++; @@ -128,7 +128,7 @@ public sealed partial class EFS if(sector.Length < Marshal.SizeOf()) return; - var sbpiece = new byte[Marshal.SizeOf()]; + byte[] sbpiece = new byte[Marshal.SizeOf()]; Array.Copy(sector, 0x200, sbpiece, 0, Marshal.SizeOf()); @@ -143,7 +143,7 @@ public sealed partial class EFS } else { - var sbSize = (uint)(Marshal.SizeOf() / imagePlugin.Info.SectorSize); + uint sbSize = (uint)(Marshal.SizeOf() / imagePlugin.Info.SectorSize); if(Marshal.SizeOf() % imagePlugin.Info.SectorSize != 0) sbSize++; diff --git a/Aaru.Filesystems/FAT/BPB.cs b/Aaru.Filesystems/FAT/BPB.cs index 2fbf64546..1703ea797 100644 --- a/Aaru.Filesystems/FAT/BPB.cs +++ b/Aaru.Filesystems/FAT/BPB.cs @@ -32,8 +32,8 @@ using System.Text; using Aaru.CommonTypes; using Aaru.CommonTypes.Enums; using Aaru.CommonTypes.Interfaces; -using Aaru.Console; using Aaru.Helpers; +using Aaru.Logging; namespace Aaru.Filesystems; @@ -116,15 +116,15 @@ public sealed partial class FAT var ebpb = new BiosParameterBlockEbpb(); var apricotBpb = new ApricotLabel(); - var useAtariBpb = false; - var useMsxBpb = false; - var useDos2Bpb = false; - var useDos3Bpb = false; - var useDos32Bpb = false; - var useDos33Bpb = false; - var userShortExtendedBpb = false; - var useExtendedBpb = false; - var useApricotBpb = false; + bool useAtariBpb = false; + bool useMsxBpb = false; + bool useDos2Bpb = false; + bool useDos3Bpb = false; + bool useDos32Bpb = false; + bool useDos33Bpb = false; + bool userShortExtendedBpb = false; + bool useExtendedBpb = false; + bool useApricotBpb = false; if(imagePlugin.Info.SectorSize >= 256) { @@ -393,12 +393,12 @@ public sealed partial class FAT } byte[] rootDir = rootMs.ToArray(); - var validRootDir = true; + bool validRootDir = true; // Iterate all root directory - for(var e = 0; e < 96 * 32; e += 32) + for(int e = 0; e < 96 * 32; e += 32) { - for(var c = 0; c < 11; c++) + for(int c = 0; c < 11; c++) { if((rootDir[c + e] >= 0x20 || rootDir[c + e] == 0x00 || rootDir[c + e] == 0x05) && rootDir[c + e] != 0xFF && diff --git a/Aaru.Filesystems/FAT/Dir.cs b/Aaru.Filesystems/FAT/Dir.cs index fbf6f7ab8..7a350608a 100644 --- a/Aaru.Filesystems/FAT/Dir.cs +++ b/Aaru.Filesystems/FAT/Dir.cs @@ -33,8 +33,8 @@ using System.Linq; using System.Text; using Aaru.CommonTypes.Enums; using Aaru.CommonTypes.Interfaces; -using Aaru.Console; using Aaru.Helpers; +using Aaru.Logging; namespace Aaru.Filesystems; @@ -105,7 +105,7 @@ public sealed partial class FAT currentDirectory = _rootDirectoryCache; - for(var p = 0; p < pieces.Length; p++) + for(int p = 0; p < pieces.Length; p++) { entry = currentDirectory.FirstOrDefault(t => t.Key.ToLower(_cultureInfo) == pieces[p]); @@ -139,9 +139,9 @@ public sealed partial class FAT if(clusters is null) return ErrorNumber.InvalidArgument; - var directoryBuffer = new byte[_bytesPerCluster * clusters.Length]; + byte[] directoryBuffer = new byte[_bytesPerCluster * clusters.Length]; - for(var i = 0; i < clusters.Length; i++) + for(int i = 0; i < clusters.Length; i++) { ErrorNumber errno = _image.ReadSectors(_firstClusterSector + clusters[i] * _sectorsPerCluster, _sectorsPerCluster, @@ -156,7 +156,7 @@ public sealed partial class FAT byte[] lastLfnName = null; byte lastLfnChecksum = 0; - for(var pos = 0; pos < directoryBuffer.Length; pos += Marshal.SizeOf()) + for(int pos = 0; pos < directoryBuffer.Length; pos += Marshal.SizeOf()) { DirectoryEntry dirent = Marshal.ByteArrayToStructureLittleEndian(directoryBuffer, @@ -247,7 +247,7 @@ public sealed partial class FAT name = ":{EMPTYNAME}:"; // Try to create a unique filename with an extension from 000 to 999 - for(var uniq = 0; uniq < 1000; uniq++) + for(int uniq = 0; uniq < 1000; uniq++) { extension = $"{uniq:D03}"; @@ -318,11 +318,11 @@ public sealed partial class FAT if(BitConverter.ToUInt16(longnameEa, 0) != EAT_ASCII) continue; - var longnameSize = BitConverter.ToUInt16(longnameEa, 2); + ushort longnameSize = BitConverter.ToUInt16(longnameEa, 2); if(longnameSize + 4 > longnameEa.Length) continue; - var longnameBytes = new byte[longnameSize]; + byte[] longnameBytes = new byte[longnameSize]; Array.Copy(longnameEa, 4, longnameBytes, 0, longnameSize); diff --git a/Aaru.Filesystems/FAT/Info.cs b/Aaru.Filesystems/FAT/Info.cs index 8ad8e8b56..f8635f69d 100644 --- a/Aaru.Filesystems/FAT/Info.cs +++ b/Aaru.Filesystems/FAT/Info.cs @@ -36,8 +36,8 @@ using Aaru.Checksums; using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Enums; using Aaru.CommonTypes.Interfaces; -using Aaru.Console; using Aaru.Helpers; +using Aaru.Logging; using Marshal = Aaru.Helpers.Marshal; using Partition = Aaru.CommonTypes.Partition; @@ -65,11 +65,11 @@ public sealed partial class FAT byte bpbSignature; byte fat32Signature; ulong hugeSectors; - var fat32Id = new byte[8]; - var msxId = new byte[6]; + byte[] fat32Id = new byte[8]; + byte[] msxId = new byte[6]; byte fatId; - var dosOem = new byte[8]; - var atariOem = new byte[6]; + byte[] dosOem = new byte[8]; + byte[] atariOem = new byte[6]; ushort bootable = 0; uint sectorsPerBpb = imagePlugin.Info.SectorSize < 512 ? 512 / imagePlugin.Info.SectorSize : 1; @@ -187,14 +187,14 @@ public sealed partial class FAT AaruConsole.DebugWriteLine(MODULE_NAME, "huge_sectors = {0}", hugeSectors); AaruConsole.DebugWriteLine(MODULE_NAME, "fat_id = 0x{0:X2}", fatId); - var apricotBps = BitConverter.ToUInt16(bpbSector, 0x50); - byte apricotSpc = bpbSector[0x52]; - var apricotReservedSecs = BitConverter.ToUInt16(bpbSector, 0x53); - byte apricotFatsNo = bpbSector[0x55]; - var apricotRootEntries = BitConverter.ToUInt16(bpbSector, 0x56); - var apricotSectors = BitConverter.ToUInt16(bpbSector, 0x58); - byte apricotMediaDescriptor = bpbSector[0x5A]; - var apricotFatSectors = BitConverter.ToUInt16(bpbSector, 0x5B); + ushort apricotBps = BitConverter.ToUInt16(bpbSector, 0x50); + byte apricotSpc = bpbSector[0x52]; + ushort apricotReservedSecs = BitConverter.ToUInt16(bpbSector, 0x53); + byte apricotFatsNo = bpbSector[0x55]; + ushort apricotRootEntries = BitConverter.ToUInt16(bpbSector, 0x56); + ushort apricotSectors = BitConverter.ToUInt16(bpbSector, 0x58); + byte apricotMediaDescriptor = bpbSector[0x5A]; + ushort apricotFatSectors = BitConverter.ToUInt16(bpbSector, 0x5B); bool apricotCorrectSpc = apricotSpc is 1 or 2 or 4 or 8 or 16 or 32 or 64; @@ -242,8 +242,8 @@ public sealed partial class FAT if(errno != ErrorNumber.NoError) return false; - var hpfsMagic1 = BitConverter.ToUInt32(hpfsSbSector, 0x000); - var hpfsMagic2 = BitConverter.ToUInt32(hpfsSbSector, 0x004); + uint hpfsMagic1 = BitConverter.ToUInt32(hpfsSbSector, 0x000); + uint hpfsMagic2 = BitConverter.ToUInt32(hpfsSbSector, 0x004); if(hpfsMagic1 == 0xF995E849 && hpfsMagic2 == 0xFA53E9C5) return false; } @@ -344,12 +344,12 @@ public sealed partial class FAT } byte[] rootDir = rootMs.ToArray(); - var validRootDir = true; + bool validRootDir = true; // Iterate all root directory - for(var e = 0; e < 96 * 32; e += 32) + for(int e = 0; e < 96 * 32; e += 32) { - for(var c = 0; c < 11; c++) + for(int c = 0; c < 11; c++) { if((rootDir[c + e] >= 0x20 || rootDir[c + e] == 0x00 || rootDir[c + e] == 0x05) && rootDir[c + e] != 0xFF && @@ -372,9 +372,9 @@ public sealed partial class FAT return true; } - byte fat2 = fatSector[1]; - byte fat3 = fatSector[2]; - var fatCluster2 = (ushort)((fat2 << 8) + fat3 & 0xFFF); + byte fat2 = fatSector[1]; + byte fat3 = fatSector[2]; + ushort fatCluster2 = (ushort)((fat2 << 8) + fat3 & 0xFFF); AaruConsole.DebugWriteLine(MODULE_NAME, "1st fat cluster 1 = {0:X3}", fatCluster2); @@ -467,9 +467,9 @@ public sealed partial class FAT out bool andosOemCorrect, out bool bootable); - var isFat12 = false; - var isFat16 = false; - var isFat32 = false; + bool isFat12 = false; + bool isFat16 = false; + bool isFat32 = false; ulong rootDirectorySector = 0; string extraInfo = null; string bootChk = null; @@ -669,7 +669,7 @@ public sealed partial class FAT { ushort sum = 0; - for(var i = 0; i < bpbSector.Length; i += 2) sum += BigEndianBitConverter.ToUInt16(bpbSector, i); + for(int i = 0; i < bpbSector.Length; i += 2) sum += BigEndianBitConverter.ToUInt16(bpbSector, i); // TODO: Check this if(sum == 0x1234) @@ -689,7 +689,7 @@ public sealed partial class FAT if(atariBpb.ldmode == 0) { - var tmp = new byte[8]; + byte[] tmp = new byte[8]; Array.Copy(atariBpb.fname, 0, tmp, 0, 8); string fname = Encoding.ASCII.GetString(tmp).Trim(); tmp = new byte[3]; @@ -772,7 +772,7 @@ public sealed partial class FAT if(clusters < 4089) { // The first 2 FAT entries do not count as allocation clusters in FAT12 and FAT16 - var fat12 = new ushort[clusters + 2]; + ushort[] fat12 = new ushort[clusters + 2]; _reservedSectors = fakeBpb.rsectors; sectorsPerRealSector = fakeBpb.bps / imagePlugin.Info.SectorSize; @@ -782,9 +782,9 @@ public sealed partial class FAT if(errno != ErrorNumber.NoError) return; - var pos = 0; + int pos = 0; - for(var i = 0; i + 3 < fatBytes.Length && pos < fat12.Length; i += 3) + for(int i = 0; i + 3 < fatBytes.Length && pos < fat12.Length; i += 3) { fat12[pos++] = (ushort)(((fatBytes[i + 1] & 0xF) << 8) + fatBytes[i + 0]); @@ -1006,7 +1006,7 @@ 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 && fakeBpb.jump != null) { metadata.Bootable |= fakeBpb.jump[0] == 0xEB && fakeBpb.jump[1] >= minBootNearJump && fakeBpb.jump[1] < 0x80 || @@ -1054,7 +1054,7 @@ public sealed partial class FAT rootDirectory = rootMs.ToArray(); } - for(var i = 0; i < rootDirectory.Length; i += 32) + for(int i = 0; i < rootDirectory.Length; i += 32) { // Not a correct entry if(rootDirectory[i] < DIRENT_MIN && rootDirectory[i] != DIRENT_E5) continue; @@ -1067,7 +1067,7 @@ public sealed partial class FAT DirectoryEntry entry = Marshal.ByteArrayToStructureLittleEndian(rootDirectory, i, 32); - var fullname = new byte[11]; + byte[] fullname = new byte[11]; Array.Copy(entry.filename, 0, fullname, 0, 8); Array.Copy(entry.extension, 0, fullname, 8, 3); string volname = encoding.GetString(fullname).Trim(); @@ -1112,8 +1112,8 @@ public sealed partial class FAT // Intel short jump case 0xEB when bpbSector[1] < 0x80: { - int sigSize = bpbSector[510] == 0x55 && bpbSector[511] == 0xAA ? 2 : 0; - var bootCode = new byte[512 - sigSize - bpbSector[1] - 2]; + int sigSize = bpbSector[510] == 0x55 && bpbSector[511] == 0xAA ? 2 : 0; + byte[] bootCode = new byte[512 - sigSize - bpbSector[1] - 2]; Array.Copy(bpbSector, bpbSector[1] + 2, bootCode, 0, bootCode.Length); Sha1Context.Data(bootCode, out _); @@ -1123,8 +1123,8 @@ public sealed partial class FAT // Intel big jump case 0xE9 when BitConverter.ToUInt16(bpbSector, 1) < 0x1FC: { - int sigSize = bpbSector[510] == 0x55 && bpbSector[511] == 0xAA ? 2 : 0; - var bootCode = new byte[512 - sigSize - BitConverter.ToUInt16(bpbSector, 1) - 3]; + int sigSize = bpbSector[510] == 0x55 && bpbSector[511] == 0xAA ? 2 : 0; + byte[] bootCode = new byte[512 - sigSize - BitConverter.ToUInt16(bpbSector, 1) - 3]; Array.Copy(bpbSector, BitConverter.ToUInt16(bpbSector, 1) + 3, bootCode, 0, bootCode.Length); Sha1Context.Data(bootCode, out _); diff --git a/Aaru.Filesystems/FAT/Super.cs b/Aaru.Filesystems/FAT/Super.cs index c5f7e641a..625ee9b35 100644 --- a/Aaru.Filesystems/FAT/Super.cs +++ b/Aaru.Filesystems/FAT/Super.cs @@ -37,8 +37,8 @@ using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Enums; using Aaru.CommonTypes.Interfaces; using Aaru.CommonTypes.Structs; -using Aaru.Console; using Aaru.Helpers; +using Aaru.Logging; using FileSystemInfo = Aaru.CommonTypes.Structs.FileSystemInfo; using Marshal = Aaru.Helpers.Marshal; using Partition = Aaru.CommonTypes.Partition; @@ -193,8 +193,9 @@ public sealed partial class FAT }; if((fat32Bpb.flags & 0xF8) == 0x00) - if((fat32Bpb.flags & 0x01) == 0x01) - Metadata.Dirty = true; + { + if((fat32Bpb.flags & 0x01) == 0x01) Metadata.Dirty = true; + } if((fat32Bpb.mirror_flags & 0x80) == 0x80) _useFirstFat = (fat32Bpb.mirror_flags & 0xF) != 1; @@ -242,7 +243,7 @@ public sealed partial class FAT { ushort sum = 0; - for(var i = 0; i < bpbSector.Length; i += 2) sum += BigEndianBitConverter.ToUInt16(bpbSector, i); + for(int i = 0; i < bpbSector.Length; i += 2) sum += BigEndianBitConverter.ToUInt16(bpbSector, i); // TODO: Check this if(sum == 0x1234) Metadata.Bootable = true; @@ -317,7 +318,7 @@ public sealed partial class FAT { if(clusters < 4089) { - var fat12 = new ushort[clusters + 1]; + ushort[] fat12 = new ushort[clusters + 1]; _reservedSectors = fakeBpb.rsectors; sectorsPerRealSector = fakeBpb.bps / imagePlugin.Info.SectorSize; @@ -327,9 +328,9 @@ public sealed partial class FAT if(errno != ErrorNumber.NoError) return errno; - var pos = 0; + int pos = 0; - for(var i = 0; i + 3 < fatBytes.Length && pos < fat12.Length; i += 3) + for(int i = 0; i + 3 < fatBytes.Length && pos < fat12.Length; i += 3) { fat12[pos++] = (ushort)(((fatBytes[i + 1] & 0xF) << 8) + fatBytes[i + 0]); @@ -456,8 +457,9 @@ public sealed partial class FAT if(fakeBpb.signature is 0x28 or 0x29 || andosOemCorrect) { if((fakeBpb.flags & 0xF8) == 0x00) - if((fakeBpb.flags & 0x01) == 0x01) - Metadata.Dirty = true; + { + if((fakeBpb.flags & 0x01) == 0x01) Metadata.Dirty = true; + } if(fakeBpb.signature == 0x29 || andosOemCorrect) { @@ -471,7 +473,7 @@ 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 && fakeBpb.jump != null) { Metadata.Bootable |= fakeBpb.jump[0] == 0xEB && fakeBpb.jump[1] >= minBootNearJump && fakeBpb.jump[1] < 0x80 || @@ -562,7 +564,7 @@ public sealed partial class FAT byte[] lastLfnName = null; byte lastLfnChecksum = 0; - for(var i = 0; i < rootDirectory.Length; i += Marshal.SizeOf()) + for(int i = 0; i < rootDirectory.Length; i += Marshal.SizeOf()) { DirectoryEntry entry = Marshal.ByteArrayToStructureLittleEndian(rootDirectory, @@ -617,7 +619,7 @@ public sealed partial class FAT if(entry.attributes.HasFlag(FatAttributes.VolumeLabel)) { - var fullname = new byte[11]; + byte[] fullname = new byte[11]; Array.Copy(entry.filename, 0, fullname, 0, 8); Array.Copy(entry.extension, 0, fullname, 8, 3); string volname = _encoding.GetString(fullname).Trim(); @@ -692,7 +694,7 @@ public sealed partial class FAT name = ":{EMPTYNAME}:"; // Try to create a unique filename with an extension from 000 to 999 - for(var uniq = 0; uniq < 1000; uniq++) + for(int uniq = 0; uniq < 1000; uniq++) { extension = $"{uniq:D03}"; @@ -759,10 +761,10 @@ public sealed partial class FAT _bytesPerCluster = _sectorsPerCluster * imagePlugin.Info.SectorSize; // The first 2 FAT entries do not count as allocation clusters in FAT12 and FAT16 - var firstFatEntries = new ushort[_statfs.Blocks + 2]; - var secondFatEntries = new ushort[_statfs.Blocks + 2]; - var firstFatValid = true; - var secondFatValid = true; + ushort[] firstFatEntries = new ushort[_statfs.Blocks + 2]; + ushort[] secondFatEntries = new ushort[_statfs.Blocks + 2]; + bool firstFatValid = true; + bool secondFatValid = true; if(_fat12) { @@ -772,9 +774,9 @@ public sealed partial class FAT if(errno != ErrorNumber.NoError) return errno; - var pos = 0; + int pos = 0; - for(var i = 0; i + 3 < fatBytes.Length && pos < firstFatEntries.Length; i += 3) + for(int i = 0; i + 3 < fatBytes.Length && pos < firstFatEntries.Length; i += 3) { firstFatEntries[pos++] = (ushort)(((fatBytes[i + 1] & 0xF) << 8) + fatBytes[i + 0]); @@ -791,7 +793,7 @@ public sealed partial class FAT pos = 0; - for(var i = 0; i + 3 < fatBytes.Length && pos < secondFatEntries.Length; i += 3) + for(int i = 0; i + 3 < fatBytes.Length && pos < secondFatEntries.Length; i += 3) { secondFatEntries[pos++] = (ushort)(((fatBytes[i + 1] & 0xF) << 8) + fatBytes[i + 0]); @@ -853,7 +855,7 @@ public sealed partial class FAT if(_eaDirEntry.start_cluster != 0) { CacheEaData(); - var eamagic = BitConverter.ToUInt16(_cachedEaData, 0); + ushort eamagic = BitConverter.ToUInt16(_cachedEaData, 0); if(eamagic != EADATA_MAGIC) { @@ -880,11 +882,11 @@ public sealed partial class FAT if(BitConverter.ToUInt16(longnameEa, 0) != EAT_ASCII) continue; - var longnameSize = BitConverter.ToUInt16(longnameEa, 2); + ushort longnameSize = BitConverter.ToUInt16(longnameEa, 2); if(longnameSize + 4 > longnameEa.Length) continue; - var longnameBytes = new byte[longnameSize]; + byte[] longnameBytes = new byte[longnameSize]; Array.Copy(longnameEa, 4, longnameBytes, 0, longnameSize); diff --git a/Aaru.Filesystems/FATX/Super.cs b/Aaru.Filesystems/FATX/Super.cs index 9594239ae..f18109e14 100644 --- a/Aaru.Filesystems/FATX/Super.cs +++ b/Aaru.Filesystems/FATX/Super.cs @@ -34,8 +34,8 @@ using System.Text; using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Enums; using Aaru.CommonTypes.Interfaces; -using Aaru.Console; using Aaru.Helpers; +using Aaru.Logging; using FileSystemInfo = Aaru.CommonTypes.Structs.FileSystemInfo; using Marshal = Aaru.Helpers.Marshal; using Partition = Aaru.CommonTypes.Partition; @@ -156,9 +156,8 @@ public sealed partial class XboxFatPlugin _fat32 = MemoryMarshal.Cast(buffer).ToArray(); if(!_littleEndian) - { - for(int i = 0; i < _fat32.Length; i++) _fat32[i] = Swapping.Swap(_fat32[i]); - } + for(int i = 0; i < _fat32.Length; i++) + _fat32[i] = Swapping.Swap(_fat32[i]); AaruConsole.DebugWriteLine(MODULE_NAME, "fat32[0] == FATX32_ID = {0}", _fat32[0] == FATX32_ID); @@ -188,9 +187,8 @@ public sealed partial class XboxFatPlugin _fat16 = MemoryMarshal.Cast(buffer).ToArray(); if(!_littleEndian) - { - for(int i = 0; i < _fat16.Length; i++) _fat16[i] = Swapping.Swap(_fat16[i]); - } + for(int i = 0; i < _fat16.Length; i++) + _fat16[i] = Swapping.Swap(_fat16[i]); AaruConsole.DebugWriteLine(MODULE_NAME, "fat16[0] == FATX16_ID = {0}", _fat16[0] == FATX16_ID); diff --git a/Aaru.Filesystems/FFS/Info.cs b/Aaru.Filesystems/FFS/Info.cs index 4ed1192ce..8d7a8a7da 100644 --- a/Aaru.Filesystems/FFS/Info.cs +++ b/Aaru.Filesystems/FFS/Info.cs @@ -33,8 +33,8 @@ using System.Text; using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Enums; using Aaru.CommonTypes.Interfaces; -using Aaru.Console; using Aaru.Helpers; +using Aaru.Logging; using Partition = Aaru.CommonTypes.Partition; namespace Aaru.Filesystems; @@ -75,7 +75,7 @@ public sealed partial class FFSPlugin if(errno != ErrorNumber.NoError) continue; - var magic = BitConverter.ToUInt32(ufsSbSectors, 0x055C); + uint magic = BitConverter.ToUInt32(ufsSbSectors, 0x055C); if(magic is UFS_MAGIC or UFS_CIGAM @@ -108,13 +108,13 @@ public sealed partial class FFSPlugin uint sb_size_in_sectors; byte[] ufs_sb_sectors; ulong sb_offset = partition.Start; - var fs_type_42bsd = false; - var fs_type_43bsd = false; - var fs_type_44bsd = false; - var fs_type_ufs = false; - var fs_type_ufs2 = false; - var fs_type_sun = false; - var fs_type_sun86 = false; + bool fs_type_42bsd = false; + bool fs_type_43bsd = false; + bool fs_type_44bsd = false; + bool fs_type_ufs = false; + bool fs_type_ufs2 = false; + bool fs_type_sun = false; + bool fs_type_sun86 = false; if(imagePlugin.Info.SectorSize is 2336 or 2352 or 2448) sb_size_in_sectors = block_size / 2048; diff --git a/Aaru.Filesystems/Fossil/Info.cs b/Aaru.Filesystems/Fossil/Info.cs index 30df69ce5..5a544e557 100644 --- a/Aaru.Filesystems/Fossil/Info.cs +++ b/Aaru.Filesystems/Fossil/Info.cs @@ -30,8 +30,8 @@ using System.Text; using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Enums; using Aaru.CommonTypes.Interfaces; -using Aaru.Console; using Aaru.Helpers; +using Aaru.Logging; using Partition = Aaru.CommonTypes.Partition; namespace Aaru.Filesystems; diff --git a/Aaru.Filesystems/HPOFS/Info.cs b/Aaru.Filesystems/HPOFS/Info.cs index d6b76aeb6..b3b0ed9b9 100644 --- a/Aaru.Filesystems/HPOFS/Info.cs +++ b/Aaru.Filesystems/HPOFS/Info.cs @@ -36,8 +36,8 @@ using System.Text; using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Enums; using Aaru.CommonTypes.Interfaces; -using Aaru.Console; using Aaru.Helpers; +using Aaru.Logging; using Partition = Aaru.CommonTypes.Partition; namespace Aaru.Filesystems; diff --git a/Aaru.Filesystems/ISO9660/File.cs b/Aaru.Filesystems/ISO9660/File.cs index aec7a66af..ebfaf4854 100644 --- a/Aaru.Filesystems/ISO9660/File.cs +++ b/Aaru.Filesystems/ISO9660/File.cs @@ -36,8 +36,8 @@ using System.Runtime.CompilerServices; using Aaru.CommonTypes.Enums; using Aaru.CommonTypes.Interfaces; using Aaru.CommonTypes.Structs; -using Aaru.Console; using Aaru.Helpers; +using Aaru.Logging; using FileAttributes = Aaru.CommonTypes.Structs.FileAttributes; namespace Aaru.Filesystems; @@ -424,7 +424,7 @@ public sealed partial class ISO9660 if(pieces.Length == 0) return ErrorNumber.InvalidArgument; - var parentPath = string.Join("/", pieces, 0, pieces.Length - 1); + string parentPath = string.Join("/", pieces, 0, pieces.Length - 1); if(!_directoryCache.TryGetValue(parentPath, out _)) { @@ -487,7 +487,7 @@ public sealed partial class ISO9660 var ms = new MemoryStream(); long currentFilePos = offset; - for(var i = 0; i < extents.Count; i++) + for(int i = 0; i < extents.Count; i++) { if(offset - currentFilePos >= extents[i].size) { @@ -496,7 +496,7 @@ public sealed partial class ISO9660 continue; } - var currentExtentSector = (uint)(offset / 2048); + uint currentExtentSector = (uint)(offset / 2048); long leftExtentSize = extents[i].size - currentFilePos; while(leftExtentSize > 0) @@ -557,7 +557,7 @@ public sealed partial class ISO9660 { var ms = new MemoryStream(); - for(var i = 0; i < extents.Count; i++) + for(int i = 0; i < extents.Count; i++) { long leftExtentSize = extents[i].size; uint currentExtentSector = 0; diff --git a/Aaru.Filesystems/ISO9660/Info.cs b/Aaru.Filesystems/ISO9660/Info.cs index c86c1a4d2..cba8ddc3d 100644 --- a/Aaru.Filesystems/ISO9660/Info.cs +++ b/Aaru.Filesystems/ISO9660/Info.cs @@ -34,9 +34,9 @@ using Aaru.Checksums; using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Enums; using Aaru.CommonTypes.Interfaces; -using Aaru.Console; using Aaru.Decoders.Sega; using Aaru.Helpers; +using Aaru.Logging; using Partition = Aaru.CommonTypes.Partition; namespace Aaru.Filesystems; @@ -59,13 +59,13 @@ public sealed partial class ISO9660 if(errno != ErrorNumber.NoError) return false; - var xaOff = 0; + int xaOff = 0; if(vdSector.Length == 2336) xaOff = 8; - byte vdType = vdSector[0 + xaOff]; - var vdMagic = new byte[5]; - var hsMagic = new byte[5]; + byte vdType = vdSector[0 + xaOff]; + byte[] vdMagic = new byte[5]; + byte[] hsMagic = new byte[5]; // This indicates the end of a volume descriptor. HighSierra here would have 16 so no problem if(vdType == 255) return false; @@ -88,11 +88,11 @@ public sealed partial class ISO9660 encoding ??= Encoding.ASCII; information = ""; metadata = new FileSystem(); - var isoMetadata = new StringBuilder(); - var vdMagic = new byte[5]; // Volume Descriptor magic "CD001" - var hsMagic = new byte[5]; // Volume Descriptor magic "CDROM" + var isoMetadata = new StringBuilder(); + byte[] vdMagic = new byte[5]; // Volume Descriptor magic "CD001" + byte[] hsMagic = new byte[5]; // Volume Descriptor magic "CDROM" - var bootSpec = ""; + string bootSpec = ""; PrimaryVolumeDescriptor? pvd = null; PrimaryVolumeDescriptor? jolietvd = null; @@ -116,13 +116,13 @@ public sealed partial class ISO9660 int xaOff = vdSector.Length == 2336 ? 8 : 0; Array.Copy(vdSector, 0x009 + xaOff, hsMagic, 0, 5); bool highSierraInfo = encoding.GetString(hsMagic) == HIGH_SIERRA_MAGIC; - var hsOff = 0; + int hsOff = 0; if(highSierraInfo) hsOff = 8; - var cdiInfo = false; - var evd = false; - var vpd = false; + bool cdiInfo = false; + bool evd = false; + bool vpd = false; while(true) { @@ -276,14 +276,14 @@ public sealed partial class ISO9660 } byte[] rootDir = []; - var rootOff = 0; - var xaExtensions = false; - var apple = false; - var susp = false; - var rrip = false; - var ziso = false; - var amiga = false; - var aaip = false; + int rootOff = 0; + bool xaExtensions = false; + bool apple = false; + bool susp = false; + bool rrip = false; + bool ziso = false; + bool amiga = false; + bool aaip = false; List contareas = []; List refareas = []; var suspInformation = new StringBuilder(); @@ -309,13 +309,13 @@ public sealed partial class ISO9660 if(saLen > 0 && rootOff + saOff + saLen <= rootDir.Length) { - var sa = new byte[saLen]; + byte[] sa = new byte[saLen]; Array.Copy(rootDir, rootOff + saOff, sa, 0, saLen); saOff = 0; while(saOff < saLen) { - var noneFound = true; + bool noneFound = true; if(Marshal.SizeOf() + saOff <= saLen) { @@ -331,7 +331,7 @@ public sealed partial class ISO9660 if(saOff + 2 >= saLen) break; - var nextSignature = BigEndianBitConverter.ToUInt16(sa, saOff); + ushort nextSignature = BigEndianBitConverter.ToUInt16(sa, saOff); switch(nextSignature) { @@ -393,7 +393,7 @@ public sealed partial class ISO9660 break; case SUSP_CONTINUATION when saOff + sa[saOff + 2] <= saLen: - var ce = new byte[sa[saOff + 2]]; + byte[] ce = new byte[sa[saOff + 2]]; Array.Copy(sa, saOff, ce, 0, ce.Length); ContinuationArea ca = @@ -403,7 +403,7 @@ public sealed partial class ISO9660 break; case SUSP_REFERENCE when saOff + sa[saOff + 2] <= saLen: - var er = new byte[sa[saOff + 2]]; + byte[] er = new byte[sa[saOff + 2]]; Array.Copy(sa, saOff, er, 0, er.Length); refareas.Add(er); @@ -458,13 +458,13 @@ public sealed partial class ISO9660 if(errno != ErrorNumber.NoError) return; - var caData = new byte[ca.ca_length_be]; + byte[] caData = new byte[ca.ca_length_be]; Array.Copy(caSectors, ca.offset_be, caData, 0, ca.ca_length_be); - var caOff = 0; + int caOff = 0; while(caOff < ca.ca_length_be) { - var nextSignature = BigEndianBitConverter.ToUInt16(caData, caOff); + ushort nextSignature = BigEndianBitConverter.ToUInt16(caData, caOff); switch(nextSignature) { @@ -477,7 +477,7 @@ public sealed partial class ISO9660 break; case SUSP_REFERENCE when caOff + caData[caOff + 2] <= ca.ca_length_be: - var er = new byte[caData[caOff + 2]]; + byte[] er = new byte[caData[caOff + 2]]; Array.Copy(caData, caOff, er, 0, er.Length); refareas.Add(er); @@ -684,7 +684,7 @@ public sealed partial class ISO9660 if(errno != ErrorNumber.NoError) return; - var toritoOff = 0; + int toritoOff = 0; if(vdSector[toritoOff] != 1) goto exit_torito; @@ -806,7 +806,7 @@ public sealed partial class ISO9660 isoMetadata.AppendFormat("\t" + Localization.Section_ID_0, encoding.GetString(sectionHeader.identifier)) .AppendLine(); - for(var entryCounter = 1; + for(int entryCounter = 1; entryCounter <= sectionHeader.entries && toritoOff < vdSector.Length; entryCounter++) { diff --git a/Aaru.Filesystems/ISO9660/Mode2.cs b/Aaru.Filesystems/ISO9660/Mode2.cs index b507b3d8b..782dcfa9b 100644 --- a/Aaru.Filesystems/ISO9660/Mode2.cs +++ b/Aaru.Filesystems/ISO9660/Mode2.cs @@ -34,8 +34,8 @@ using System; using System.IO; using Aaru.CommonTypes.Enums; -using Aaru.Console; using Aaru.Decoders.CD; +using Aaru.Logging; namespace Aaru.Filesystems; @@ -142,7 +142,7 @@ public sealed partial class ISO9660 return ErrorNumber.NoError; } - var tmp = new byte[_blockSize]; + byte[] tmp = new byte[_blockSize]; Array.Copy(Sector.GetUserData(data, interleaved, fileNumber), (int)offset, tmp, 0, _blockSize); buffer = tmp; @@ -239,7 +239,7 @@ public sealed partial class ISO9660 ms.Write(sectorData, 0, sectorData.Length); } - var tmp = new byte[_blockSize]; + byte[] tmp = new byte[_blockSize]; Array.Copy(Sector.GetUserData(ms.ToArray(), interleaved, fileNumber), 0, tmp, 0, _blockSize); buffer = tmp; diff --git a/Aaru.Filesystems/ISO9660/Super.cs b/Aaru.Filesystems/ISO9660/Super.cs index 27c0992ae..121348130 100644 --- a/Aaru.Filesystems/ISO9660/Super.cs +++ b/Aaru.Filesystems/ISO9660/Super.cs @@ -37,9 +37,9 @@ using System.Text; using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Enums; using Aaru.CommonTypes.Interfaces; -using Aaru.Console; using Aaru.Decoders.Sega; using Aaru.Helpers; +using Aaru.Logging; using FileSystemInfo = Aaru.CommonTypes.Structs.FileSystemInfo; using Partition = Aaru.CommonTypes.Partition; diff --git a/Aaru.Filesystems/LIF/Info.cs b/Aaru.Filesystems/LIF/Info.cs index 042338a04..42120cbe7 100644 --- a/Aaru.Filesystems/LIF/Info.cs +++ b/Aaru.Filesystems/LIF/Info.cs @@ -30,8 +30,8 @@ using System.Text; using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Enums; using Aaru.CommonTypes.Interfaces; -using Aaru.Console; using Aaru.Helpers; +using Aaru.Logging; using Partition = Aaru.CommonTypes.Partition; namespace Aaru.Filesystems; diff --git a/Aaru.Filesystems/LisaFS/Extent.cs b/Aaru.Filesystems/LisaFS/Extent.cs index 68c7d937a..bd3c6db94 100644 --- a/Aaru.Filesystems/LisaFS/Extent.cs +++ b/Aaru.Filesystems/LisaFS/Extent.cs @@ -28,9 +28,9 @@ using System; using Aaru.CommonTypes.Enums; -using Aaru.Console; using Aaru.Decoders; using Aaru.Helpers; +using Aaru.Logging; namespace Aaru.Filesystems; @@ -71,7 +71,7 @@ public sealed partial class LisaFS // This code just allow to ignore that corruption by searching the Extents File using sector tags if(ptr >= _device.Info.Sectors) { - var found = false; + bool found = false; for(ulong i = 0; i < _device.Info.Sectors; i++) { @@ -150,7 +150,7 @@ public sealed partial class LisaFS file.LisaInfo = new byte[128]; Array.Copy(sector, 0x180, file.LisaInfo, 0, 128); - var extentsCount = 0; + int extentsCount = 0; int extentsOffset; if(_mddf.fsversion == LISA_V1) @@ -166,7 +166,7 @@ public sealed partial class LisaFS extentsOffset = 0x88; } - for(var j = 0; j < 41; j++) + for(int j = 0; j < 41; j++) { if(BigEndianBitConverter.ToInt16(sector, extentsOffset + j * 6 + 4) == 0) break; @@ -175,7 +175,7 @@ public sealed partial class LisaFS file.extents = new Extent[extentsCount]; - for(var j = 0; j < extentsCount; j++) + for(int j = 0; j < extentsCount; j++) { file.extents[j] = new Extent { @@ -284,7 +284,7 @@ public sealed partial class LisaFS AaruConsole.DebugWriteLine(MODULE_NAME, "ExtentFile[{0}].length = {1}", fileId, file.length); AaruConsole.DebugWriteLine(MODULE_NAME, "ExtentFile[{0}].unknown9 = 0x{1:X8}", fileId, file.unknown9); - for(var ext = 0; ext < file.extents.Length; ext++) + for(int ext = 0; ext < file.extents.Length; ext++) { AaruConsole.DebugWriteLine(MODULE_NAME, "ExtentFile[{0}].extents[{1}].start = {2}", @@ -321,7 +321,7 @@ public sealed partial class LisaFS // Each entry takes 14 bytes _srecords = new SRecord[sectors.Length / 14]; - for(var s = 0; s < _srecords.Length; s++) + for(int s = 0; s < _srecords.Length; s++) { _srecords[s] = new SRecord { diff --git a/Aaru.Filesystems/LisaFS/File.cs b/Aaru.Filesystems/LisaFS/File.cs index d12c942fc..fe00f0a60 100644 --- a/Aaru.Filesystems/LisaFS/File.cs +++ b/Aaru.Filesystems/LisaFS/File.cs @@ -30,9 +30,9 @@ using System; using Aaru.CommonTypes.Enums; using Aaru.CommonTypes.Interfaces; using Aaru.CommonTypes.Structs; -using Aaru.Console; using Aaru.Decoders; using Aaru.Helpers; +using Aaru.Logging; using FileAttributes = Aaru.CommonTypes.Structs.FileAttributes; namespace Aaru.Filesystems; @@ -220,9 +220,8 @@ public sealed partial class LisaFS if(!_mounted || !_debug) return ErrorNumber.AccessDenied; if(fileId is > 4 or <= 0) - { - if(fileId != FILEID_BOOT_SIGNED && fileId != FILEID_LOADER_SIGNED) return ErrorNumber.InvalidArgument; - } + if(fileId != FILEID_BOOT_SIGNED && fileId != FILEID_LOADER_SIGNED) + return ErrorNumber.InvalidArgument; if(_systemFileCache.TryGetValue(fileId, out buf) && !tags) return ErrorNumber.NoError; @@ -437,9 +436,8 @@ public sealed partial class LisaFS if(!tags) { if(_fileSizeCache.TryGetValue(fileId, out int realSize)) - { - if(realSize > temp.Length) AaruConsole.ErrorWriteLine(Localization.File_0_gets_truncated, fileId); - } + if(realSize > temp.Length) + AaruConsole.ErrorWriteLine(Localization.File_0_gets_truncated, fileId); buf = temp; diff --git a/Aaru.Filesystems/LisaFS/Info.cs b/Aaru.Filesystems/LisaFS/Info.cs index ff775539b..fd7de6452 100644 --- a/Aaru.Filesystems/LisaFS/Info.cs +++ b/Aaru.Filesystems/LisaFS/Info.cs @@ -31,9 +31,9 @@ using System.Text; using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Enums; using Aaru.CommonTypes.Interfaces; -using Aaru.Console; using Aaru.Decoders; using Aaru.Helpers; +using Aaru.Logging; using Claunia.Encoding; using Encoding = System.Text.Encoding; using Partition = Aaru.CommonTypes.Partition; @@ -55,7 +55,7 @@ public sealed partial class LisaFS int beforeMddf = -1; // LisaOS searches sectors until tag tells MDDF resides there, so we'll search 100 sectors - for(var i = 0; i < 100; i++) + for(int i = 0; i < 100; i++) { ErrorNumber errno = imagePlugin.ReadSectorTag((ulong)i, SectorTagType.AppleSectorTag, out byte[] tag); @@ -132,7 +132,7 @@ public sealed partial class LisaFS int beforeMddf = -1; // LisaOS searches sectors until tag tells MDDF resides there, so we'll search 100 sectors - for(var i = 0; i < 100; i++) + for(int i = 0; i < 100; i++) { ErrorNumber errno = imagePlugin.ReadSectorTag((ulong)i, SectorTagType.AppleSectorTag, out byte[] tag); @@ -150,8 +150,8 @@ public sealed partial class LisaFS if(errno != ErrorNumber.NoError) continue; - var infoMddf = new MDDF(); - var pString = new byte[33]; + var infoMddf = new MDDF(); + byte[] pString = new byte[33]; infoMddf.fsversion = BigEndianBitConverter.ToUInt16(sector, 0x00); infoMddf.volid = BigEndianBitConverter.ToUInt64(sector, 0x02); @@ -166,7 +166,7 @@ public sealed partial class LisaFS infoMddf.unknown2 = sector[0x4F]; infoMddf.machine_id = BigEndianBitConverter.ToUInt32(sector, 0x50); infoMddf.master_copy_id = BigEndianBitConverter.ToUInt32(sector, 0x54); - var lisaTime = BigEndianBitConverter.ToUInt32(sector, 0x58); + uint lisaTime = BigEndianBitConverter.ToUInt32(sector, 0x58); infoMddf.dtvc = DateHandlers.LisaToDateTime(lisaTime); lisaTime = BigEndianBitConverter.ToUInt32(sector, 0x5C); infoMddf.dtcc = DateHandlers.LisaToDateTime(lisaTime); diff --git a/Aaru.Filesystems/LisaFS/Super.cs b/Aaru.Filesystems/LisaFS/Super.cs index 589027142..741cbc15d 100644 --- a/Aaru.Filesystems/LisaFS/Super.cs +++ b/Aaru.Filesystems/LisaFS/Super.cs @@ -31,9 +31,9 @@ using System.Collections.Generic; using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Enums; using Aaru.CommonTypes.Interfaces; -using Aaru.Console; using Aaru.Decoders; using Aaru.Helpers; +using Aaru.Logging; using Claunia.Encoding; using Encoding = System.Text.Encoding; using FileSystemInfo = Aaru.CommonTypes.Structs.FileSystemInfo; diff --git a/Aaru.Filesystems/Locus/Info.cs b/Aaru.Filesystems/Locus/Info.cs index 793b129f1..61152e3f6 100644 --- a/Aaru.Filesystems/Locus/Info.cs +++ b/Aaru.Filesystems/Locus/Info.cs @@ -32,8 +32,8 @@ using System.Text; using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Enums; using Aaru.CommonTypes.Interfaces; -using Aaru.Console; using Aaru.Helpers; +using Aaru.Logging; // Disk address @@ -66,7 +66,7 @@ public sealed partial class Locus for(ulong location = 0; location <= 8; location++) { - var sbSize = (uint)(Marshal.SizeOf() / imagePlugin.Info.SectorSize); + uint sbSize = (uint)(Marshal.SizeOf() / imagePlugin.Info.SectorSize); if(Marshal.SizeOf() % imagePlugin.Info.SectorSize != 0) sbSize++; @@ -103,7 +103,7 @@ public sealed partial class Locus for(ulong location = 0; location <= 8; location++) { - var sbSize = (uint)(Marshal.SizeOf() / imagePlugin.Info.SectorSize); + uint sbSize = (uint)(Marshal.SizeOf() / imagePlugin.Info.SectorSize); if(Marshal.SizeOf() % imagePlugin.Info.SectorSize != 0) sbSize++; diff --git a/Aaru.Filesystems/Nintendo/Info.cs b/Aaru.Filesystems/Nintendo/Info.cs index 3af94bd77..cf51cb5d4 100644 --- a/Aaru.Filesystems/Nintendo/Info.cs +++ b/Aaru.Filesystems/Nintendo/Info.cs @@ -31,8 +31,8 @@ using System.Text; using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Enums; using Aaru.CommonTypes.Interfaces; -using Aaru.Console; using Aaru.Helpers; +using Aaru.Logging; using Partition = Aaru.CommonTypes.Partition; namespace Aaru.Filesystems; @@ -54,8 +54,8 @@ public sealed partial class NintendoPlugin if(errno != ErrorNumber.NoError) return false; - var magicGc = BigEndianBitConverter.ToUInt32(header, 0x1C); - var magicWii = BigEndianBitConverter.ToUInt32(header, 0x18); + uint magicGc = BigEndianBitConverter.ToUInt32(header, 0x1C); + uint magicWii = BigEndianBitConverter.ToUInt32(header, 0x18); return magicGc == 0xC2339F3D || magicWii == 0x5D1C9EA3; } @@ -75,10 +75,10 @@ public sealed partial class NintendoPlugin if(errno != ErrorNumber.NoError) return; - var wii = false; + bool wii = false; - var magicGc = BigEndianBitConverter.ToUInt32(header, 0x1C); - var magicWii = BigEndianBitConverter.ToUInt32(header, 0x18); + uint magicGc = BigEndianBitConverter.ToUInt32(header, 0x1C); + uint magicWii = BigEndianBitConverter.ToUInt32(header, 0x18); if(magicWii == 0x5D1C9EA3) wii = true; @@ -93,7 +93,7 @@ public sealed partial class NintendoPlugin fields.DiscVersion = header[7]; fields.Streaming |= header[8] > 0; fields.StreamBufferSize = header[9]; - var temp = new byte[64]; + byte[] temp = new byte[64]; Array.Copy(header, 0x20, temp, 0, 64); fields.Title = StringHandlers.CToString(temp, encoding); @@ -119,7 +119,7 @@ public sealed partial class NintendoPlugin fields.ThirdPartitions = new NintendoPartition[BigEndianBitConverter.ToUInt32(header, 0x40010)]; fields.FourthPartitions = new NintendoPartition[BigEndianBitConverter.ToUInt32(header, 0x40018)]; - for(var i = 0; i < fields.FirstPartitions.Length; i++) + for(int i = 0; i < fields.FirstPartitions.Length; i++) { if(offset1 + i * 8 + 8 >= 0x50000) continue; @@ -129,7 +129,7 @@ public sealed partial class NintendoPlugin fields.FirstPartitions[i].Type = BigEndianBitConverter.ToUInt32(header, (int)(offset1 + i * 8 + 4)); } - for(var i = 0; i < fields.SecondPartitions.Length; i++) + for(int i = 0; i < fields.SecondPartitions.Length; i++) { if(offset1 + i * 8 + 8 >= 0x50000) continue; @@ -139,7 +139,7 @@ public sealed partial class NintendoPlugin fields.FirstPartitions[i].Type = BigEndianBitConverter.ToUInt32(header, (int)(offset2 + i * 8 + 4)); } - for(var i = 0; i < fields.ThirdPartitions.Length; i++) + for(int i = 0; i < fields.ThirdPartitions.Length; i++) { if(offset1 + i * 8 + 8 >= 0x50000) continue; @@ -149,7 +149,7 @@ public sealed partial class NintendoPlugin fields.FirstPartitions[i].Type = BigEndianBitConverter.ToUInt32(header, (int)(offset3 + i * 8 + 4)); } - for(var i = 0; i < fields.FourthPartitions.Length; i++) + for(int i = 0; i < fields.FourthPartitions.Length; i++) { if(offset1 + i * 8 + 8 >= 0x50000) continue; @@ -195,7 +195,7 @@ public sealed partial class NintendoPlugin AaruConsole.DebugWriteLine(MODULE_NAME, "fstSize = {0}", fields.FstSize); AaruConsole.DebugWriteLine(MODULE_NAME, "fstMax = {0}", fields.FstMax); - for(var i = 0; i < fields.FirstPartitions.Length; i++) + for(int i = 0; i < fields.FirstPartitions.Length; i++) { AaruConsole.DebugWriteLine(MODULE_NAME, "firstPartitions[{1}].offset = {0}", @@ -208,7 +208,7 @@ public sealed partial class NintendoPlugin i); } - for(var i = 0; i < fields.SecondPartitions.Length; i++) + for(int i = 0; i < fields.SecondPartitions.Length; i++) { AaruConsole.DebugWriteLine(MODULE_NAME, "secondPartitions[{1}].offset = {0}", @@ -221,7 +221,7 @@ public sealed partial class NintendoPlugin i); } - for(var i = 0; i < fields.ThirdPartitions.Length; i++) + for(int i = 0; i < fields.ThirdPartitions.Length; i++) { AaruConsole.DebugWriteLine(MODULE_NAME, "thirdPartitions[{1}].offset = {0}", @@ -234,7 +234,7 @@ public sealed partial class NintendoPlugin i); } - for(var i = 0; i < fields.FourthPartitions.Length; i++) + for(int i = 0; i < fields.FourthPartitions.Length; i++) { AaruConsole.DebugWriteLine(MODULE_NAME, "fourthPartitions[{1}].offset = {0}", @@ -289,7 +289,7 @@ public sealed partial class NintendoPlugin if(wii) { - for(var i = 0; i < fields.FirstPartitions.Length; i++) + for(int i = 0; i < fields.FirstPartitions.Length; i++) { sbInformation.AppendFormat(Localization.First_0_partition_starts_at_sector_1, PartitionTypeToString(fields.FirstPartitions[i].Type), @@ -297,7 +297,7 @@ public sealed partial class NintendoPlugin .AppendLine(); } - for(var i = 0; i < fields.SecondPartitions.Length; i++) + for(int i = 0; i < fields.SecondPartitions.Length; i++) { sbInformation.AppendFormat(Localization.Second_0_partition_starts_at_sector_1, PartitionTypeToString(fields.SecondPartitions[i].Type), @@ -305,7 +305,7 @@ public sealed partial class NintendoPlugin .AppendLine(); } - for(var i = 0; i < fields.ThirdPartitions.Length; i++) + for(int i = 0; i < fields.ThirdPartitions.Length; i++) { sbInformation.AppendFormat(Localization.Third_0_partition_starts_at_sector_1, PartitionTypeToString(fields.ThirdPartitions[i].Type), @@ -313,7 +313,7 @@ public sealed partial class NintendoPlugin .AppendLine(); } - for(var i = 0; i < fields.FourthPartitions.Length; i++) + for(int i = 0; i < fields.FourthPartitions.Length; i++) { sbInformation.AppendFormat(Localization.Fourth_0_partition_starts_at_sector_1, PartitionTypeToString(fields.FourthPartitions[i].Type), diff --git a/Aaru.Filesystems/ODS/Info.cs b/Aaru.Filesystems/ODS/Info.cs index 507ad6040..9c28886fb 100644 --- a/Aaru.Filesystems/ODS/Info.cs +++ b/Aaru.Filesystems/ODS/Info.cs @@ -35,8 +35,8 @@ using System.Text; using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Enums; using Aaru.CommonTypes.Interfaces; -using Aaru.Console; using Aaru.Helpers; +using Aaru.Logging; using Partition = Aaru.CommonTypes.Partition; namespace Aaru.Filesystems; @@ -63,7 +63,7 @@ public sealed partial class ODS if(imagePlugin.Info.SectorSize < 512) return false; - var magicB = new byte[12]; + byte[] magicB = new byte[12]; ErrorNumber errno = imagePlugin.ReadSector(1 + partition.Start, out byte[] hbSector); if(errno != ErrorNumber.NoError) return false; diff --git a/Aaru.Filesystems/ProDOS/Info.cs b/Aaru.Filesystems/ProDOS/Info.cs index b5af5b707..2def0a99c 100644 --- a/Aaru.Filesystems/ProDOS/Info.cs +++ b/Aaru.Filesystems/ProDOS/Info.cs @@ -35,7 +35,7 @@ using System.Text; using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Enums; using Aaru.CommonTypes.Interfaces; -using Aaru.Console; +using Aaru.Logging; using Claunia.Encoding; using Encoding = System.Text.Encoding; using Partition = Aaru.CommonTypes.Partition; @@ -56,7 +56,7 @@ public sealed partial class ProDOSPlugin { if(partition.Length < 3) return false; - var multiplier = (uint)(imagePlugin.Info.SectorSize == 256 ? 2 : 1); + uint multiplier = (uint)(imagePlugin.Info.SectorSize == 256 ? 2 : 1); // Blocks 0 and 1 are boot code ErrorNumber errno = @@ -64,7 +64,7 @@ public sealed partial class ProDOSPlugin if(errno != ErrorNumber.NoError) return false; - var apmFromHddOnCd = false; + bool apmFromHddOnCd = false; if(imagePlugin.Info.SectorSize is 2352 or 2448 or 2048) { @@ -88,12 +88,12 @@ public sealed partial class ProDOSPlugin } } - var prePointer = BitConverter.ToUInt16(rootDirectoryKeyBlock, 0); + ushort prePointer = BitConverter.ToUInt16(rootDirectoryKeyBlock, 0); AaruConsole.DebugWriteLine(MODULE_NAME, "prePointer = {0}", prePointer); if(prePointer != 0) return false; - var storageType = (byte)((rootDirectoryKeyBlock[0x04] & STORAGE_TYPE_MASK) >> 4); + byte storageType = (byte)((rootDirectoryKeyBlock[0x04] & STORAGE_TYPE_MASK) >> 4); AaruConsole.DebugWriteLine(MODULE_NAME, "storage_type = {0}", storageType); if(storageType != ROOT_DIRECTORY_TYPE) return false; @@ -108,12 +108,12 @@ public sealed partial class ProDOSPlugin if(entriesPerBlock != ENTRIES_PER_BLOCK) return false; - var bitMapPointer = BitConverter.ToUInt16(rootDirectoryKeyBlock, 0x27); + ushort bitMapPointer = BitConverter.ToUInt16(rootDirectoryKeyBlock, 0x27); AaruConsole.DebugWriteLine(MODULE_NAME, "bit_map_pointer = {0}", bitMapPointer); if(bitMapPointer > partition.End) return false; - var totalBlocks = BitConverter.ToUInt16(rootDirectoryKeyBlock, 0x29); + ushort totalBlocks = BitConverter.ToUInt16(rootDirectoryKeyBlock, 0x29); if(apmFromHddOnCd) totalBlocks /= 4; @@ -134,8 +134,8 @@ public sealed partial class ProDOSPlugin encoding ??= new Apple2c(); information = ""; metadata = new FileSystem(); - var sbInformation = new StringBuilder(); - var multiplier = (uint)(imagePlugin.Info.SectorSize == 256 ? 2 : 1); + var sbInformation = new StringBuilder(); + uint multiplier = (uint)(imagePlugin.Info.SectorSize == 256 ? 2 : 1); // Blocks 0 and 1 are boot code ErrorNumber errno = imagePlugin.ReadSectors(2 * multiplier + partition.Start, @@ -144,7 +144,7 @@ public sealed partial class ProDOSPlugin if(errno != ErrorNumber.NoError) return; - var apmFromHddOnCd = false; + bool apmFromHddOnCd = false; if(imagePlugin.Info.SectorSize is 2352 or 2448 or 2048) { @@ -177,24 +177,24 @@ public sealed partial class ProDOSPlugin rootDirectoryKeyBlock.header.storage_type = (byte)((rootDirectoryKeyBlockBytes[0x04] & STORAGE_TYPE_MASK) >> 4); rootDirectoryKeyBlock.header.name_length = (byte)(rootDirectoryKeyBlockBytes[0x04] & NAME_LENGTH_MASK); - var temporal = new byte[rootDirectoryKeyBlock.header.name_length]; + byte[] temporal = new byte[rootDirectoryKeyBlock.header.name_length]; Array.Copy(rootDirectoryKeyBlockBytes, 0x05, temporal, 0, rootDirectoryKeyBlock.header.name_length); rootDirectoryKeyBlock.header.volume_name = encoding.GetString(temporal); rootDirectoryKeyBlock.header.reserved = BitConverter.ToUInt64(rootDirectoryKeyBlockBytes, 0x14); - var tempTimestampLeft = BitConverter.ToUInt16(rootDirectoryKeyBlockBytes, 0x1C); - var tempTimestampRight = BitConverter.ToUInt16(rootDirectoryKeyBlockBytes, 0x1E); + ushort tempTimestampLeft = BitConverter.ToUInt16(rootDirectoryKeyBlockBytes, 0x1C); + ushort tempTimestampRight = BitConverter.ToUInt16(rootDirectoryKeyBlockBytes, 0x1E); bool dateCorrect; try { - var tempTimestamp = (uint)((tempTimestampLeft << 16) + tempTimestampRight); - var year = (int)((tempTimestamp & YEAR_MASK) >> 25); - var month = (int)((tempTimestamp & MONTH_MASK) >> 21); - var day = (int)((tempTimestamp & DAY_MASK) >> 16); - var hour = (int)((tempTimestamp & HOUR_MASK) >> 8); - var minute = (int)(tempTimestamp & MINUTE_MASK); + uint tempTimestamp = (uint)((tempTimestampLeft << 16) + tempTimestampRight); + int year = (int)((tempTimestamp & YEAR_MASK) >> 25); + int month = (int)((tempTimestamp & MONTH_MASK) >> 21); + int day = (int)((tempTimestamp & DAY_MASK) >> 16); + int hour = (int)((tempTimestamp & HOUR_MASK) >> 8); + int minute = (int)(tempTimestamp & MINUTE_MASK); year += 1900; if(year < 1940) year += 100; diff --git a/Aaru.Filesystems/RBF/Info.cs b/Aaru.Filesystems/RBF/Info.cs index 6427a0abc..b3296a946 100644 --- a/Aaru.Filesystems/RBF/Info.cs +++ b/Aaru.Filesystems/RBF/Info.cs @@ -30,8 +30,8 @@ using System.Text; using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Enums; using Aaru.CommonTypes.Interfaces; -using Aaru.Console; using Aaru.Helpers; +using Aaru.Logging; using Partition = Aaru.CommonTypes.Partition; namespace Aaru.Filesystems; @@ -55,9 +55,9 @@ public sealed partial class RBF 0, 4, 15 }) { - var location = (ulong)i; + ulong location = (ulong)i; - var sbSize = (uint)(Marshal.SizeOf() / imagePlugin.Info.SectorSize); + uint sbSize = (uint)(Marshal.SizeOf() / imagePlugin.Info.SectorSize); if(Marshal.SizeOf() % imagePlugin.Info.SectorSize != 0) sbSize++; @@ -104,8 +104,8 @@ public sealed partial class RBF 0, 4, 15 }) { - var location = (ulong)i; - var sbSize = (uint)(Marshal.SizeOf() / imagePlugin.Info.SectorSize); + ulong location = (ulong)i; + uint sbSize = (uint)(Marshal.SizeOf() / imagePlugin.Info.SectorSize); if(Marshal.SizeOf() % imagePlugin.Info.SectorSize != 0) sbSize++; diff --git a/Aaru.Filesystems/ReFS/Info.cs b/Aaru.Filesystems/ReFS/Info.cs index dd55526f8..3638b0c14 100644 --- a/Aaru.Filesystems/ReFS/Info.cs +++ b/Aaru.Filesystems/ReFS/Info.cs @@ -32,8 +32,8 @@ using System.Text; using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Enums; using Aaru.CommonTypes.Interfaces; -using Aaru.Console; using Aaru.Helpers; +using Aaru.Logging; using Partition = Aaru.CommonTypes.Partition; namespace Aaru.Filesystems; @@ -47,7 +47,7 @@ public sealed partial class ReFS /// public bool Identify(IMediaImage imagePlugin, Partition partition) { - var sbSize = (uint)(Marshal.SizeOf() / imagePlugin.Info.SectorSize); + uint sbSize = (uint)(Marshal.SizeOf() / imagePlugin.Info.SectorSize); if(Marshal.SizeOf() % imagePlugin.Info.SectorSize != 0) sbSize++; @@ -73,7 +73,7 @@ public sealed partial class ReFS information = ""; metadata = new FileSystem(); - var sbSize = (uint)(Marshal.SizeOf() / imagePlugin.Info.SectorSize); + uint sbSize = (uint)(Marshal.SizeOf() / imagePlugin.Info.SectorSize); if(Marshal.SizeOf() % imagePlugin.Info.SectorSize != 0) sbSize++; diff --git a/Aaru.Filesystems/SolarFS/Info.cs b/Aaru.Filesystems/SolarFS/Info.cs index 117b96e18..0c826491b 100644 --- a/Aaru.Filesystems/SolarFS/Info.cs +++ b/Aaru.Filesystems/SolarFS/Info.cs @@ -31,8 +31,8 @@ using System.Text; using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Enums; using Aaru.CommonTypes.Interfaces; -using Aaru.Console; using Aaru.Helpers; +using Aaru.Logging; using Partition = Aaru.CommonTypes.Partition; namespace Aaru.Filesystems; @@ -53,7 +53,7 @@ public sealed partial class SolarFS if(errno != ErrorNumber.NoError) return false; - var fsTypeB = new byte[8]; + byte[] fsTypeB = new byte[8]; byte signature = bpb[0x25]; Array.Copy(bpb, 0x35, fsTypeB, 0, 8); @@ -87,7 +87,7 @@ public sealed partial class SolarFS signature = bpbSector[0x25] }; - var bpbStrings = new byte[8]; + byte[] bpbStrings = new byte[8]; Array.Copy(bpbSector, 0x03, bpbStrings, 0, 8); bpb.OEMName = StringHandlers.CToString(bpbStrings); bpbStrings = new byte[8]; diff --git a/Aaru.Filesystems/UCSDPascal/Info.cs b/Aaru.Filesystems/UCSDPascal/Info.cs index f3d27b1de..b73195197 100644 --- a/Aaru.Filesystems/UCSDPascal/Info.cs +++ b/Aaru.Filesystems/UCSDPascal/Info.cs @@ -35,8 +35,8 @@ using System.Text; using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Enums; using Aaru.CommonTypes.Interfaces; -using Aaru.Console; using Aaru.Helpers; +using Aaru.Logging; using Claunia.Encoding; using Encoding = System.Text.Encoding; using Partition = Aaru.CommonTypes.Partition; diff --git a/Aaru.Filesystems/UDF/Info.cs b/Aaru.Filesystems/UDF/Info.cs index 9824e3348..cadcd4f6d 100644 --- a/Aaru.Filesystems/UDF/Info.cs +++ b/Aaru.Filesystems/UDF/Info.cs @@ -33,8 +33,8 @@ using System.Text; using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Enums; using Aaru.CommonTypes.Interfaces; -using Aaru.Console; using Aaru.Helpers; +using Aaru.Logging; using Partition = Aaru.CommonTypes.Partition; namespace Aaru.Filesystems; @@ -65,7 +65,7 @@ public sealed partial class UDF [partition.End - 1024, 4], [partition.End - 4, 4] ]; - var anchorFound = false; + bool anchorFound = false; uint ratio = 1; byte[] sector = null; @@ -144,8 +144,8 @@ public sealed partial class UDF continue; } - var tagId = (TagIdentifier)BitConverter.ToUInt16(sector, 0); - var location = BitConverter.ToUInt32(sector, 0x0C); + var tagId = (TagIdentifier)BitConverter.ToUInt16(sector, 0); + uint location = BitConverter.ToUInt32(sector, 0x0C); if(location == partition.Start / ratio + anchor.mainVolumeDescriptorSequenceExtent.location + count) { @@ -229,8 +229,8 @@ public sealed partial class UDF if(errno != ErrorNumber.NoError) continue; - var tagId = (TagIdentifier)BitConverter.ToUInt16(sector, 0); - var location = BitConverter.ToUInt32(sector, 0x0C); + var tagId = (TagIdentifier)BitConverter.ToUInt16(sector, 0); + uint location = BitConverter.ToUInt32(sector, 0x0C); if(location == partition.Start / ratio + anchor.mainVolumeDescriptorSequenceExtent.location + count) { diff --git a/Aaru.Filesystems/UNICOS/Info.cs b/Aaru.Filesystems/UNICOS/Info.cs index 261f4ff78..e2811f6a1 100644 --- a/Aaru.Filesystems/UNICOS/Info.cs +++ b/Aaru.Filesystems/UNICOS/Info.cs @@ -32,8 +32,8 @@ using System.Text; using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Enums; using Aaru.CommonTypes.Interfaces; -using Aaru.Console; using Aaru.Helpers; +using Aaru.Logging; using Partition = Aaru.CommonTypes.Partition; namespace Aaru.Filesystems; @@ -49,7 +49,7 @@ public sealed partial class UNICOS { if(imagePlugin.Info.SectorSize < 512) return false; - var sbSize = (uint)(Marshal.SizeOf() / imagePlugin.Info.SectorSize); + uint sbSize = (uint)(Marshal.SizeOf() / imagePlugin.Info.SectorSize); if(Marshal.SizeOf() % imagePlugin.Info.SectorSize != 0) sbSize++; @@ -78,7 +78,7 @@ public sealed partial class UNICOS if(imagePlugin.Info.SectorSize < 512) return; - var sbSize = (uint)(Marshal.SizeOf() / imagePlugin.Info.SectorSize); + uint sbSize = (uint)(Marshal.SizeOf() / imagePlugin.Info.SectorSize); if(Marshal.SizeOf() % imagePlugin.Info.SectorSize != 0) sbSize++; diff --git a/Aaru.Filesystems/UNIXBFS/Info.cs b/Aaru.Filesystems/UNIXBFS/Info.cs index 3e5ffeaea..be525ba9e 100644 --- a/Aaru.Filesystems/UNIXBFS/Info.cs +++ b/Aaru.Filesystems/UNIXBFS/Info.cs @@ -31,8 +31,8 @@ using System.Text; using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Enums; using Aaru.CommonTypes.Interfaces; -using Aaru.Console; using Aaru.Helpers; +using Aaru.Logging; using Partition = Aaru.CommonTypes.Partition; namespace Aaru.Filesystems; @@ -53,7 +53,7 @@ public sealed partial class BFS if(errno != ErrorNumber.NoError) return false; - var magic = BitConverter.ToUInt32(tmp, 0); + uint magic = BitConverter.ToUInt32(tmp, 0); return magic == BFS_MAGIC; } @@ -71,7 +71,7 @@ public sealed partial class BFS if(errno != ErrorNumber.NoError) return; - var sbStrings = new byte[6]; + byte[] sbStrings = new byte[6]; var bfsSb = new SuperBlock { diff --git a/Aaru.Filesystems/XFS/Info.cs b/Aaru.Filesystems/XFS/Info.cs index cee71a506..9a92aca7d 100644 --- a/Aaru.Filesystems/XFS/Info.cs +++ b/Aaru.Filesystems/XFS/Info.cs @@ -31,8 +31,8 @@ using System.Text; using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Enums; using Aaru.CommonTypes.Interfaces; -using Aaru.Console; using Aaru.Helpers; +using Aaru.Logging; using Partition = Aaru.CommonTypes.Partition; namespace Aaru.Filesystems; @@ -51,7 +51,7 @@ public sealed partial class XFS // Misaligned if(imagePlugin.Info.MetadataMediaType == MetadataMediaType.OpticalDisc) { - var sbSize = (uint)((Marshal.SizeOf() + 0x400) / imagePlugin.Info.SectorSize); + uint sbSize = (uint)((Marshal.SizeOf() + 0x400) / imagePlugin.Info.SectorSize); if((Marshal.SizeOf() + 0x400) % imagePlugin.Info.SectorSize != 0) sbSize++; @@ -61,7 +61,7 @@ public sealed partial class XFS if(sector.Length < Marshal.SizeOf()) return false; - var sbpiece = new byte[Marshal.SizeOf()]; + byte[] sbpiece = new byte[Marshal.SizeOf()]; foreach(int location in new[] { @@ -88,9 +88,9 @@ public sealed partial class XFS 0, 1, 2 }) { - var location = (ulong)i; + ulong location = (ulong)i; - var sbSize = (uint)(Marshal.SizeOf() / imagePlugin.Info.SectorSize); + uint sbSize = (uint)(Marshal.SizeOf() / imagePlugin.Info.SectorSize); if(Marshal.SizeOf() % imagePlugin.Info.SectorSize != 0) sbSize++; @@ -130,7 +130,7 @@ public sealed partial class XFS // Misaligned if(imagePlugin.Info.MetadataMediaType == MetadataMediaType.OpticalDisc) { - var sbSize = (uint)((Marshal.SizeOf() + 0x400) / imagePlugin.Info.SectorSize); + uint sbSize = (uint)((Marshal.SizeOf() + 0x400) / imagePlugin.Info.SectorSize); if((Marshal.SizeOf() + 0x400) % imagePlugin.Info.SectorSize != 0) sbSize++; @@ -138,7 +138,7 @@ public sealed partial class XFS if(errno != ErrorNumber.NoError || sector.Length < Marshal.SizeOf()) return; - var sbpiece = new byte[Marshal.SizeOf()]; + byte[] sbpiece = new byte[Marshal.SizeOf()]; foreach(int location in new[] { @@ -165,8 +165,8 @@ public sealed partial class XFS 0, 1, 2 }) { - var location = (ulong)i; - var sbSize = (uint)(Marshal.SizeOf() / imagePlugin.Info.SectorSize); + ulong location = (ulong)i; + uint sbSize = (uint)(Marshal.SizeOf() / imagePlugin.Info.SectorSize); if(Marshal.SizeOf() % imagePlugin.Info.SectorSize != 0) sbSize++; diff --git a/Aaru.Filesystems/dump/Info.cs b/Aaru.Filesystems/dump/Info.cs index 39a39c19d..c8d8d84f3 100644 --- a/Aaru.Filesystems/dump/Info.cs +++ b/Aaru.Filesystems/dump/Info.cs @@ -35,8 +35,8 @@ using System.Text; using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Enums; using Aaru.CommonTypes.Interfaces; -using Aaru.Console; using Aaru.Helpers; +using Aaru.Logging; using Partition = Aaru.CommonTypes.Partition; namespace Aaru.Filesystems; @@ -57,7 +57,7 @@ public sealed partial class Dump // It should be start of a tape or floppy or file if(partition.Start != 0) return false; - var sbSize = (uint)(Marshal.SizeOf() / imagePlugin.Info.SectorSize); + uint sbSize = (uint)(Marshal.SizeOf() / imagePlugin.Info.SectorSize); if(Marshal.SizeOf() % imagePlugin.Info.SectorSize != 0) sbSize++; @@ -96,7 +96,7 @@ public sealed partial class Dump if(partition.Start != 0) return; - var sbSize = (uint)(Marshal.SizeOf() / imagePlugin.Info.SectorSize); + uint sbSize = (uint)(Marshal.SizeOf() / imagePlugin.Info.SectorSize); if(Marshal.SizeOf() % imagePlugin.Info.SectorSize != 0) sbSize++; @@ -110,8 +110,8 @@ public sealed partial class Dump spcl_aix aixHdr = Marshal.ByteArrayToStructureLittleEndian(sector); s_spcl newHdr = Marshal.ByteArrayToStructureLittleEndian(sector); - var useOld = false; - var useAix = false; + bool useOld = false; + bool useAix = false; if(newHdr.c_magic == OFS_MAGIC || newHdr.c_magic == NFS_MAGIC || diff --git a/Aaru.Filters/Aaru.Filters.csproj b/Aaru.Filters/Aaru.Filters.csproj index fcc6e50d5..80f31217b 100644 --- a/Aaru.Filters/Aaru.Filters.csproj +++ b/Aaru.Filters/Aaru.Filters.csproj @@ -41,7 +41,7 @@ - + diff --git a/Aaru.Gui/ConsoleHandler.cs b/Aaru.Gui/ConsoleHandler.cs index 906ff4149..3ba1a4d6d 100644 --- a/Aaru.Gui/ConsoleHandler.cs +++ b/Aaru.Gui/ConsoleHandler.cs @@ -33,8 +33,8 @@ using System; using System.Collections.ObjectModel; -using Aaru.Console; using Aaru.Localization; +using Aaru.Logging; using JetBrains.Annotations; namespace Aaru.Gui; diff --git a/Aaru.Gui/ViewModels/Dialogs/ConsoleViewModel.cs b/Aaru.Gui/ViewModels/Dialogs/ConsoleViewModel.cs index e404cc027..f13af639f 100644 --- a/Aaru.Gui/ViewModels/Dialogs/ConsoleViewModel.cs +++ b/Aaru.Gui/ViewModels/Dialogs/ConsoleViewModel.cs @@ -38,13 +38,14 @@ using System.Reactive; using System.Reflection; using System.Threading.Tasks; using Aaru.CommonTypes.Interop; -using Aaru.Console; using Aaru.Localization; +using Aaru.Logging; using Avalonia.Platform.Storage; using JetBrains.Annotations; using MsBox.Avalonia; using MsBox.Avalonia.Enums; using ReactiveUI; +using Console = Aaru.Gui.Views.Dialogs.Console; using PlatformID = Aaru.CommonTypes.Interop.PlatformID; using Version = Aaru.CommonTypes.Interop.Version; @@ -52,10 +53,10 @@ namespace Aaru.Gui.ViewModels.Dialogs; public sealed class ConsoleViewModel : ViewModelBase { - readonly Views.Dialogs.Console _view; - bool _debugChecked; + readonly Console _view; + bool _debugChecked; - public ConsoleViewModel(Views.Dialogs.Console view) + public ConsoleViewModel(Console view) { _view = view; SaveCommand = ReactiveCommand.Create(ExecuteSaveCommand); diff --git a/Aaru.Gui/ViewModels/Panels/SubdirectoryViewModel.cs b/Aaru.Gui/ViewModels/Panels/SubdirectoryViewModel.cs index f58be7794..2d34315ff 100644 --- a/Aaru.Gui/ViewModels/Panels/SubdirectoryViewModel.cs +++ b/Aaru.Gui/ViewModels/Panels/SubdirectoryViewModel.cs @@ -41,10 +41,10 @@ using Aaru.CommonTypes.Enums; using Aaru.CommonTypes.Interfaces; using Aaru.CommonTypes.Interop; using Aaru.CommonTypes.Structs; -using Aaru.Console; using Aaru.Core; using Aaru.Gui.Models; using Aaru.Localization; +using Aaru.Logging; using Avalonia.Controls; using Avalonia.Platform.Storage; using JetBrains.Annotations; @@ -203,7 +203,7 @@ public sealed class SubdirectoryViewModel else chars = new char[filename.Length]; - for(var ci = 0; ci < chars.Length; ci++) + for(int ci = 0; ci < chars.Length; ci++) { chars[ci] = filename[ci] switch { @@ -328,7 +328,7 @@ public sealed class SubdirectoryViewModel try { - var outBuf = new byte[file.Stat.Length]; + byte[] outBuf = new byte[file.Stat.Length]; ErrorNumber error = _model.Plugin.OpenFile(_model.Path + "/" + file.Name, out IFileNode fileNode); diff --git a/Aaru.Gui/ViewModels/Tabs/PcmciaInfoViewModel.cs b/Aaru.Gui/ViewModels/Tabs/PcmciaInfoViewModel.cs index 1306dc76e..9c622ccc4 100644 --- a/Aaru.Gui/ViewModels/Tabs/PcmciaInfoViewModel.cs +++ b/Aaru.Gui/ViewModels/Tabs/PcmciaInfoViewModel.cs @@ -35,10 +35,10 @@ using System.Collections.ObjectModel; using System.IO; using System.Reactive; using System.Threading.Tasks; -using Aaru.Console; using Aaru.Decoders.PCMCIA; using Aaru.Gui.Models; using Aaru.Localization; +using Aaru.Logging; using Avalonia.Controls; using Avalonia.Platform.Storage; using JetBrains.Annotations; diff --git a/Aaru.Gui/ViewModels/Tabs/ScsiInfoViewModel.cs b/Aaru.Gui/ViewModels/Tabs/ScsiInfoViewModel.cs index bfbe9613a..926174d33 100644 --- a/Aaru.Gui/ViewModels/Tabs/ScsiInfoViewModel.cs +++ b/Aaru.Gui/ViewModels/Tabs/ScsiInfoViewModel.cs @@ -37,12 +37,12 @@ using System.Linq; using System.Reactive; using System.Threading.Tasks; using Aaru.CommonTypes.Structs.Devices.SCSI; -using Aaru.Console; using Aaru.Decoders.SCSI; using Aaru.Decoders.SCSI.MMC; using Aaru.Gui.Models; using Aaru.Helpers; using Aaru.Localization; +using Aaru.Logging; using Avalonia.Controls; using Avalonia.Platform.Storage; using ReactiveUI; @@ -438,7 +438,7 @@ public sealed class ScsiInfoViewModel : ViewModelBase { foreach(KeyValuePair page in scsiEvpdPages.OrderBy(t => t.Key)) { - var evpdPageTitle = ""; + string evpdPageTitle = ""; string evpdDecodedPage; switch(page.Key) @@ -637,7 +637,7 @@ public sealed class ScsiInfoViewModel : ViewModelBase { foreach(Features.FeatureDescriptor desc in ftr.Descriptors) { - var featureNumber = string.Format(Localization.Core.Feature_0, desc.Code); + string featureNumber = string.Format(Localization.Core.Feature_0, desc.Code); AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Core.Feature_0, desc.Code); string featureDescription = desc.Code switch diff --git a/Aaru.Gui/ViewModels/Windows/ImageChecksumViewModel.cs b/Aaru.Gui/ViewModels/Windows/ImageChecksumViewModel.cs index d37b8856c..31dd4ebf3 100644 --- a/Aaru.Gui/ViewModels/Windows/ImageChecksumViewModel.cs +++ b/Aaru.Gui/ViewModels/Windows/ImageChecksumViewModel.cs @@ -38,10 +38,10 @@ using System.Threading; using Aaru.CommonTypes.Enums; using Aaru.CommonTypes.Interfaces; using Aaru.CommonTypes.Structs; -using Aaru.Console; using Aaru.Core; using Aaru.Gui.Models; using Aaru.Localization; +using Aaru.Logging; using Avalonia.Controls; using Avalonia.Threading; using ReactiveUI; @@ -395,8 +395,8 @@ public sealed class ImageChecksumViewModel : ViewModelBase [SuppressMessage("ReSharper", "AsyncVoidMethod")] async void DoWork() { - var opticalMediaImage = _inputFormat as IOpticalMediaImage; - var formatHasTracks = false; + var opticalMediaImage = _inputFormat as IOpticalMediaImage; + bool formatHasTracks = false; if(opticalMediaImage != null) { @@ -603,7 +603,7 @@ public sealed class ImageChecksumViewModel : ViewModelBase await Dispatcher.UIThread.InvokeAsync(() => { - if(ChecksumTracksChecked != true) return; + if(!ChecksumTracksChecked) return; if(trackChecksum == null) return; diff --git a/Aaru.Gui/ViewModels/Windows/ImageConvertViewModel.cs b/Aaru.Gui/ViewModels/Windows/ImageConvertViewModel.cs index c4290d9f5..66368668b 100644 --- a/Aaru.Gui/ViewModels/Windows/ImageConvertViewModel.cs +++ b/Aaru.Gui/ViewModels/Windows/ImageConvertViewModel.cs @@ -46,12 +46,12 @@ using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Enums; using Aaru.CommonTypes.Interfaces; using Aaru.CommonTypes.Metadata; -using Aaru.Console; using Aaru.Core; using Aaru.Core.Media; using Aaru.Devices; using Aaru.Gui.Models; using Aaru.Localization; +using Aaru.Logging; using Avalonia.Controls; using Avalonia.Platform.Storage; using Avalonia.Threading; @@ -610,7 +610,7 @@ public sealed class ImageConvertViewModel : ViewModelBase [SuppressMessage("ReSharper", "AsyncVoidMethod")] async void DoWork(object plugin) { - var warning = false; + bool warning = false; if(plugin is not IWritableImage outputFormat) { @@ -845,7 +845,7 @@ public sealed class ImageConvertViewModel : ViewModelBase { if(!outputFormat.SetImageInfo(metadata)) { - if(ForceChecked != true) + if(!ForceChecked) { await Dispatcher.UIThread.InvokeAsync(async () => await MessageBoxManager .GetMessageBoxStandard(UI.Title_Error, diff --git a/Aaru.Gui/ViewModels/Windows/ImageEntropyViewModel.cs b/Aaru.Gui/ViewModels/Windows/ImageEntropyViewModel.cs index d26118a3a..99c5c95a3 100644 --- a/Aaru.Gui/ViewModels/Windows/ImageEntropyViewModel.cs +++ b/Aaru.Gui/ViewModels/Windows/ImageEntropyViewModel.cs @@ -37,10 +37,10 @@ using System.Globalization; using System.Reactive; using System.Threading; using Aaru.CommonTypes.Interfaces; -using Aaru.Console; using Aaru.Core; using Aaru.Gui.Models; using Aaru.Localization; +using Aaru.Logging; using Avalonia.Controls; using Avalonia.Threading; using ReactiveUI; @@ -341,7 +341,7 @@ public sealed class ImageEntropyViewModel : ViewModelBase } } - if(WholeDiscChecked != true) return; + if(!WholeDiscChecked) return; _entropy = entropyCalculator.CalculateMediaEntropy(DuplicatedSectorsChecked); @@ -374,7 +374,7 @@ public sealed class ImageEntropyViewModel : ViewModelBase } } - if(WholeDiscChecked != true) return; + if(!WholeDiscChecked) return; MediaEntropyText = string.Format(UI.Entropy_for_disk_is_0, _entropy.Entropy); MediaEntropyVisible = true; diff --git a/Aaru.Gui/ViewModels/Windows/ImageSidecarViewModel.cs b/Aaru.Gui/ViewModels/Windows/ImageSidecarViewModel.cs index a4977feba..84c25b879 100644 --- a/Aaru.Gui/ViewModels/Windows/ImageSidecarViewModel.cs +++ b/Aaru.Gui/ViewModels/Windows/ImageSidecarViewModel.cs @@ -41,9 +41,9 @@ using System.Threading; using System.Threading.Tasks; using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Interfaces; -using Aaru.Console; using Aaru.Core; using Aaru.Localization; +using Aaru.Logging; using Avalonia.Controls; using Avalonia.Platform.Storage; using Avalonia.Threading; diff --git a/Aaru.Gui/ViewModels/Windows/ImageVerifyViewModel.cs b/Aaru.Gui/ViewModels/Windows/ImageVerifyViewModel.cs index 9c6fdc6e9..2d1826a66 100644 --- a/Aaru.Gui/ViewModels/Windows/ImageVerifyViewModel.cs +++ b/Aaru.Gui/ViewModels/Windows/ImageVerifyViewModel.cs @@ -38,10 +38,10 @@ using System.Reactive; using System.Threading; using Aaru.CommonTypes.Interfaces; using Aaru.CommonTypes.Structs; -using Aaru.Console; using Aaru.Core; using Aaru.Gui.Models; using Aaru.Localization; +using Aaru.Logging; using Avalonia.Controls; using Avalonia.Threading; using Humanizer; diff --git a/Aaru.Gui/ViewModels/Windows/MainWindowViewModel.cs b/Aaru.Gui/ViewModels/Windows/MainWindowViewModel.cs index 1e280f7b3..e45cbb854 100644 --- a/Aaru.Gui/ViewModels/Windows/MainWindowViewModel.cs +++ b/Aaru.Gui/ViewModels/Windows/MainWindowViewModel.cs @@ -42,7 +42,6 @@ using Aaru.CommonTypes.Enums; using Aaru.CommonTypes.Interfaces; using Aaru.CommonTypes.Interop; using Aaru.CommonTypes.Structs.Devices.SCSI; -using Aaru.Console; using Aaru.Core; using Aaru.Core.Media.Info; using Aaru.Database; @@ -54,6 +53,7 @@ using Aaru.Gui.Views.Dialogs; using Aaru.Gui.Views.Panels; using Aaru.Gui.Views.Windows; using Aaru.Localization; +using Aaru.Logging; using Avalonia; using Avalonia.Controls; using Avalonia.Controls.ApplicationLifetimes; @@ -64,6 +64,7 @@ using JetBrains.Annotations; using MsBox.Avalonia; using MsBox.Avalonia.Enums; using ReactiveUI; +using Console = Aaru.Gui.Views.Dialogs.Console; using DeviceInfo = Aaru.Core.Devices.Info.DeviceInfo; using ImageInfo = Aaru.Gui.Views.Panels.ImageInfo; using Partition = Aaru.Gui.Views.Panels.Partition; @@ -85,7 +86,7 @@ public sealed class MainWindowViewModel : ViewModelBase readonly Bitmap _sdIcon; readonly Bitmap _usbIcon; readonly MainWindow _view; - Views.Dialogs.Console _console; + Console _console; object _contentPanel; bool _devicesSupported; object _treeViewSelectedItem; @@ -521,7 +522,7 @@ public sealed class MainWindowViewModel : ViewModelBase { if(_console is null) { - _console = new Views.Dialogs.Console(); + _console = new Console(); _console.DataContext = new ConsoleViewModel(_console); } @@ -607,7 +608,7 @@ public sealed class MainWindowViewModel : ViewModelBase List partitions = Core.Partitions.GetAll(imageFormat); Core.Partitions.AddSchemesToStats(partitions); - var checkRaw = false; + bool checkRaw = false; List idPlugins; PluginRegister plugins = PluginRegister.Singleton; diff --git a/Aaru.Gui/ViewModels/Windows/SplashWindowViewModel.cs b/Aaru.Gui/ViewModels/Windows/SplashWindowViewModel.cs index c40acfc3e..7ed68eb98 100644 --- a/Aaru.Gui/ViewModels/Windows/SplashWindowViewModel.cs +++ b/Aaru.Gui/ViewModels/Windows/SplashWindowViewModel.cs @@ -36,13 +36,13 @@ using System.IO; using System.Linq; using System.Text; using System.Threading.Tasks; -using Aaru.Console; using Aaru.Core; using Aaru.Database; using Aaru.Gui.ViewModels.Dialogs; using Aaru.Gui.Views.Dialogs; using Aaru.Gui.Views.Windows; using Aaru.Localization; +using Aaru.Logging; using Aaru.Settings; using Avalonia.Threading; using Microsoft.EntityFrameworkCore; diff --git a/Aaru.Helpers/Aaru.Helpers.csproj b/Aaru.Helpers/Aaru.Helpers.csproj index 5db862793..0568a7d69 100644 --- a/Aaru.Helpers/Aaru.Helpers.csproj +++ b/Aaru.Helpers/Aaru.Helpers.csproj @@ -31,7 +31,7 @@ true - + diff --git a/Aaru.Helpers/DateHandlers.cs b/Aaru.Helpers/DateHandlers.cs index 02bb7f3ad..a6ef87569 100644 --- a/Aaru.Helpers/DateHandlers.cs +++ b/Aaru.Helpers/DateHandlers.cs @@ -32,7 +32,7 @@ using System; using System.Text; -using Aaru.Console; +using Aaru.Logging; namespace Aaru.Helpers; @@ -91,7 +91,7 @@ public static class DateHandlers /// .NET DateTime public static DateTime HighSierraToDateTime(byte[] vdDateTime) { - var isoTime = new byte[17]; + byte[] isoTime = new byte[17]; Array.Copy(vdDateTime, 0, isoTime, 0, 16); return Iso9660ToDateTime(isoTime); @@ -103,8 +103,8 @@ public static class DateHandlers /// .NET DateTime public static DateTime Iso9660ToDateTime(byte[] vdDateTime) { - var twoCharValue = new byte[2]; - var fourCharValue = new byte[4]; + byte[] twoCharValue = new byte[2]; + byte[] fourCharValue = new byte[4]; fourCharValue[0] = vdDateTime[0]; fourCharValue[1] = vdDateTime[1]; @@ -181,7 +181,7 @@ public static class DateHandlers second, hundredths * 10); - var difference = (sbyte)vdDateTime[16]; + sbyte difference = (sbyte)vdDateTime[16]; var decodedDt = new DateTime(year, month, day, hour, minute, second, hundredths * 10, DateTimeKind.Utc); @@ -277,9 +277,9 @@ public static class DateHandlers /// .NET DateTime public static DateTime CpmToDateTime(byte[] timestamp) { - var days = BitConverter.ToUInt16(timestamp, 0); - int hours = timestamp[2]; - int minutes = timestamp[3]; + ushort days = BitConverter.ToUInt16(timestamp, 0); + int hours = timestamp[2]; + int minutes = timestamp[3]; DateTime temp = _amigaEpoch.AddDays(days); temp = temp.AddHours(hours); @@ -304,15 +304,15 @@ public static class DateHandlers byte minute, byte second, byte centiseconds, byte hundredsOfMicroseconds, byte microseconds) { - var specification = (byte)((typeAndTimeZone & 0xF000) >> 12); + byte specification = (byte)((typeAndTimeZone & 0xF000) >> 12); long ticks = (long)centiseconds * 100000 + (long)hundredsOfMicroseconds * 1000 + (long)microseconds * 10; if(specification == 0) return new DateTime(year, month, day, hour, minute, second, DateTimeKind.Utc).AddTicks(ticks); - var preOffset = (ushort)(typeAndTimeZone & 0xFFF); - short offset; + ushort preOffset = (ushort)(typeAndTimeZone & 0xFFF); + short offset; if((preOffset & 0x800) == 0x800) offset = (short)(preOffset | 0xF000); diff --git a/Aaru.Helpers/PrintHex.cs b/Aaru.Helpers/PrintHex.cs index a23e2674b..71982cde3 100644 --- a/Aaru.Helpers/PrintHex.cs +++ b/Aaru.Helpers/PrintHex.cs @@ -31,7 +31,7 @@ // ****************************************************************************/ using System.Text; -using Aaru.Console; +using Aaru.Logging; namespace Aaru.Helpers; @@ -82,17 +82,17 @@ public static class PrintHex sb.Append(str); sb.Append(" "); - for(var i = 0; i < width; i++) sb.Append($" {i:X2}"); + for(int i = 0; i < width; i++) sb.Append($" {i:X2}"); if(color) sb.Append("\u001b[0m"); sb.AppendLine(); - var b = 0; + int b = 0; - var format = $"{{0:X{offsetLength}}}"; + string format = $"{{0:X{offsetLength}}}"; - for(var i = 0; i < rows; i++) + for(int i = 0; i < rows; i++) { if(color) sb.Append("\u001b[36m"); @@ -104,18 +104,18 @@ public static class PrintHex int lastBytes = i == rows - 1 ? last : width; int lastSpaces = width - lastBytes; - for(var j = 0; j < lastBytes; j++) + for(int j = 0; j < lastBytes; j++) { sb.Append($" {array[b]:X2}"); b++; } - for(var j = 0; j < lastSpaces; j++) sb.Append(" "); + for(int j = 0; j < lastSpaces; j++) sb.Append(" "); b -= lastBytes; sb.Append(" "); - for(var j = 0; j < lastBytes; j++) + for(int j = 0; j < lastBytes; j++) { int v = array[b]; sb.Append(v is > 31 and < 127 or > 159 ? (char)v : '.'); diff --git a/Aaru.Images/A2R/Read.cs b/Aaru.Images/A2R/Read.cs index a057ce379..a0f21f5ee 100644 --- a/Aaru.Images/A2R/Read.cs +++ b/Aaru.Images/A2R/Read.cs @@ -39,15 +39,15 @@ using System.Text; using Aaru.CommonTypes; using Aaru.CommonTypes.Enums; using Aaru.CommonTypes.Interfaces; -using Aaru.Console; using Aaru.Helpers; +using Aaru.Logging; namespace Aaru.Images; [SuppressMessage("ReSharper", "UnusedType.Global")] public sealed partial class A2R { -#region IFluxImage Members +#region IWritableFluxImage Members /// public ErrorNumber Open(IFilter imageFilter) @@ -57,7 +57,7 @@ public sealed partial class A2R _a2RFilter = imageFilter; - var hdr = new byte[Marshal.SizeOf()]; + byte[] hdr = new byte[Marshal.SizeOf()]; _a2RStream.EnsureRead(hdr, 0, Marshal.SizeOf()); _header = Marshal.ByteArrayToStructureLittleEndian(hdr); @@ -75,7 +75,7 @@ public sealed partial class A2R _header.lineTest[1], _header.lineTest[2]); - var infoMagic = new byte[4]; + byte[] infoMagic = new byte[4]; _a2RStream.EnsureRead(infoMagic, 0, 4); // There must be an INFO chunk after the header (at byte 16) @@ -87,7 +87,7 @@ public sealed partial class A2R { case 0x32: { - var infoChnk = new byte[Marshal.SizeOf()]; + byte[] infoChnk = new byte[Marshal.SizeOf()]; _a2RStream.EnsureRead(infoChnk, 0, Marshal.SizeOf()); _infoChunkV2 = Marshal.ByteArrayToStructureLittleEndian(infoChnk); @@ -136,7 +136,7 @@ public sealed partial class A2R } case 0x33: { - var infoChk = new byte[Marshal.SizeOf()]; + byte[] infoChk = new byte[Marshal.SizeOf()]; _a2RStream.EnsureRead(infoChk, 0, Marshal.SizeOf()); _infoChunkV3 = Marshal.ByteArrayToStructureLittleEndian(infoChk); @@ -228,7 +228,7 @@ public sealed partial class A2R while(_a2RStream.Position < _a2RStream.Length) { - var chunkHdr = new byte[Marshal.SizeOf()]; + byte[] chunkHdr = new byte[Marshal.SizeOf()]; _a2RStream.EnsureRead(chunkHdr, 0, Marshal.SizeOf()); ChunkHeader chunkHeader = Marshal.ByteArrayToStructureLittleEndian(chunkHdr); _a2RStream.Seek(-Marshal.SizeOf(), SeekOrigin.Current); @@ -236,7 +236,7 @@ public sealed partial class A2R switch(chunkHeader.chunkId) { case var rwcp when rwcp.SequenceEqual(_rwcpChunkSignature): - var rwcpBuffer = new byte[Marshal.SizeOf()]; + byte[] rwcpBuffer = new byte[Marshal.SizeOf()]; _a2RStream.EnsureRead(rwcpBuffer, 0, Marshal.SizeOf()); RwcpChunkHeader rwcpChunk = Marshal.ByteArrayToStructureLittleEndian(rwcpBuffer); @@ -248,7 +248,7 @@ public sealed partial class A2R captureType = (byte)_a2RStream.ReadByte() }; - var location = new byte[2]; + byte[] location = new byte[2]; _a2RStream.EnsureRead(location, 0, 2); capture.location = BitConverter.ToUInt16(location); @@ -265,14 +265,14 @@ public sealed partial class A2R capture.numberOfIndexSignals = (byte)_a2RStream.ReadByte(); capture.indexSignals = new uint[capture.numberOfIndexSignals]; - for(var i = 0; capture.numberOfIndexSignals > i; i++) + for(int i = 0; capture.numberOfIndexSignals > i; i++) { - var index = new byte[4]; + byte[] index = new byte[4]; _a2RStream.EnsureRead(index, 0, 4); capture.indexSignals[i] = BitConverter.ToUInt32(index); } - var dataSize = new byte[4]; + byte[] dataSize = new byte[4]; _a2RStream.EnsureRead(dataSize, 0, 4); capture.captureDataSize = BitConverter.ToUInt32(dataSize); @@ -291,7 +291,7 @@ public sealed partial class A2R _a2RStream.Seek(Marshal.SizeOf(), SeekOrigin.Current); - var metadataBuffer = new byte[chunkHeader.chunkSize]; + byte[] metadataBuffer = new byte[chunkHeader.chunkSize]; _a2RStream.EnsureRead(metadataBuffer, 0, (int)chunkHeader.chunkSize); string metaData = Encoding.UTF8.GetString(metadataBuffer); @@ -311,7 +311,7 @@ public sealed partial class A2R case var slvd when slvd.SequenceEqual(_slvdChunkSignature): return ErrorNumber.NotImplemented; case var strm when strm.SequenceEqual(_strmChunkSignature): - var strmBuffer = new byte[Marshal.SizeOf()]; + byte[] strmBuffer = new byte[Marshal.SizeOf()]; _a2RStream.EnsureRead(strmBuffer, 0, Marshal.SizeOf()); ChunkHeader strmChunk = Marshal.ByteArrayToStructureLittleEndian(strmBuffer); @@ -338,11 +338,11 @@ public sealed partial class A2R if(capture.track + 1 > _imageInfo.Cylinders) _imageInfo.Cylinders = (uint)(capture.track + 1); - var dataSize = new byte[4]; + byte[] dataSize = new byte[4]; _a2RStream.EnsureRead(dataSize, 0, 4); capture.captureDataSize = BitConverter.ToUInt32(dataSize); - var index = new byte[4]; + byte[] index = new byte[4]; _a2RStream.EnsureRead(index, 0, 4); capture.indexSignals[0] = BitConverter.ToUInt32(index); @@ -432,7 +432,7 @@ public sealed partial class A2R uint previousTicks = 0; - for(var i = 0; i < capture.numberOfIndexSignals; i++) + for(int i = 0; i < capture.numberOfIndexSignals; i++) { uint ticks = capture.indexSignals[i] - previousTicks; tmpBuffer.AddRange(UInt32ToFluxRepresentation(ticks)); @@ -477,10 +477,6 @@ public sealed partial class A2R return ErrorNumber.NoError; } -#endregion - -#region IMediaImage Members - /// public ErrorNumber ReadMediaTag(MediaTagType tag, out byte[] buffer) => throw new NotImplementedException(); diff --git a/Aaru.Images/A2R/Write.cs b/Aaru.Images/A2R/Write.cs index 0cb6fc87e..217fbaae2 100644 --- a/Aaru.Images/A2R/Write.cs +++ b/Aaru.Images/A2R/Write.cs @@ -40,8 +40,8 @@ using Aaru.CommonTypes; using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Enums; using Aaru.CommonTypes.Structs; -using Aaru.Console; using Aaru.Helpers; +using Aaru.Logging; namespace Aaru.Images; @@ -124,10 +124,6 @@ public sealed partial class A2R public ErrorNumber WriteFluxDataCapture(ulong resolution, byte[] data, uint head, ushort track, byte subTrack, uint captureIndex) => ErrorNumber.NoError; -#endregion - -#region IWritableImage Members - /// public bool Create(string path, MediaType mediaType, Dictionary options, ulong sectors, uint sectorSize) diff --git a/Aaru.Images/Aaru.Images.csproj b/Aaru.Images/Aaru.Images.csproj index 413148f09..035936573 100644 --- a/Aaru.Images/Aaru.Images.csproj +++ b/Aaru.Images/Aaru.Images.csproj @@ -46,7 +46,7 @@ - + diff --git a/Aaru.Images/AaruFormat/ClauniaSubchannelTransform.cs b/Aaru.Images/AaruFormat/ClauniaSubchannelTransform.cs index 3ac226e5f..d2e8e1c7a 100644 --- a/Aaru.Images/AaruFormat/ClauniaSubchannelTransform.cs +++ b/Aaru.Images/AaruFormat/ClauniaSubchannelTransform.cs @@ -32,7 +32,7 @@ using System; using System.Diagnostics; -using Aaru.Console; +using Aaru.Logging; namespace Aaru.Images; @@ -42,19 +42,19 @@ public sealed partial class AaruFormat { if(interleaved == null) return null; - var p = new int[interleaved.Length / 8]; - var q = new int[interleaved.Length / 8]; - var r = new int[interleaved.Length / 8]; - var s = new int[interleaved.Length / 8]; - var t = new int[interleaved.Length / 8]; - var u = new int[interleaved.Length / 8]; - var v = new int[interleaved.Length / 8]; - var w = new int[interleaved.Length / 8]; + int[] p = new int[interleaved.Length / 8]; + int[] q = new int[interleaved.Length / 8]; + int[] r = new int[interleaved.Length / 8]; + int[] s = new int[interleaved.Length / 8]; + int[] t = new int[interleaved.Length / 8]; + int[] u = new int[interleaved.Length / 8]; + int[] v = new int[interleaved.Length / 8]; + int[] w = new int[interleaved.Length / 8]; var stopwatch = new Stopwatch(); stopwatch.Start(); - for(var i = 0; i < interleaved.Length; i += 8) + for(int i = 0; i < interleaved.Length; i += 8) { p[i / 8] = interleaved[i] & 0x80; p[i / 8] += (interleaved[i + 1] & 0x80) >> 1; @@ -132,7 +132,7 @@ public sealed partial class AaruFormat stopwatch.Stop(); TimeSpan deinterleave = stopwatch.Elapsed; - var sequential = new byte[interleaved.Length]; + byte[] sequential = new byte[interleaved.Length]; stopwatch.Restart(); int qStart = p.Length * 1; @@ -143,7 +143,7 @@ public sealed partial class AaruFormat int vStart = p.Length * 6; int wStart = p.Length * 7; - for(var i = 0; i < p.Length; i++) + for(int i = 0; i < p.Length; i++) { sequential[i] = (byte)p[i]; sequential[qStart + i] = (byte)q[i]; @@ -177,14 +177,14 @@ public sealed partial class AaruFormat { if(sequential == null) return null; - var p = new int[sequential.Length / 8]; - var q = new int[sequential.Length / 8]; - var r = new int[sequential.Length / 8]; - var s = new int[sequential.Length / 8]; - var t = new int[sequential.Length / 8]; - var u = new int[sequential.Length / 8]; - var v = new int[sequential.Length / 8]; - var w = new int[sequential.Length / 8]; + int[] p = new int[sequential.Length / 8]; + int[] q = new int[sequential.Length / 8]; + int[] r = new int[sequential.Length / 8]; + int[] s = new int[sequential.Length / 8]; + int[] t = new int[sequential.Length / 8]; + int[] u = new int[sequential.Length / 8]; + int[] v = new int[sequential.Length / 8]; + int[] w = new int[sequential.Length / 8]; int qStart = p.Length * 1; int rStart = p.Length * 2; @@ -197,7 +197,7 @@ public sealed partial class AaruFormat var stopwatch = new Stopwatch(); stopwatch.Start(); - for(var i = 0; i < p.Length; i++) + for(int i = 0; i < p.Length; i++) { p[i] = sequential[i]; q[i] = sequential[qStart + i]; @@ -212,10 +212,10 @@ public sealed partial class AaruFormat stopwatch.Stop(); TimeSpan desequentialize = stopwatch.Elapsed; - var interleaved = new byte[sequential.Length]; + byte[] interleaved = new byte[sequential.Length]; stopwatch.Restart(); - for(var i = 0; i < interleaved.Length; i += 8) + for(int i = 0; i < interleaved.Length; i += 8) { interleaved[i] = (byte)((p[i / 8] & 0x80) == 0x80 ? 0x80 : 0); interleaved[i + 1] += (byte)((p[i / 8] & 0x40) == 0x40 ? 0x80 : 0); diff --git a/Aaru.Images/AaruFormat/Read.cs b/Aaru.Images/AaruFormat/Read.cs index 9f7a5be17..b88fe15cb 100644 --- a/Aaru.Images/AaruFormat/Read.cs +++ b/Aaru.Images/AaruFormat/Read.cs @@ -47,9 +47,9 @@ using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Enums; using Aaru.CommonTypes.Interfaces; using Aaru.Compression; -using Aaru.Console; using Aaru.Decoders.CD; using Aaru.Helpers; +using Aaru.Logging; using Schemas; using Marshal = Aaru.Helpers.Marshal; using Partition = Aaru.CommonTypes.Partition; @@ -171,7 +171,7 @@ public sealed partial class AaruFormat _imageInfo.ImageSize = 0; - var foundUserDataDdt = false; + bool foundUserDataDdt = false; _mediaTags = new Dictionary(); List compactDiscIndexes = null; @@ -251,8 +251,8 @@ public sealed partial class AaruFormat var decompressStopwatch = new Stopwatch(); decompressStopwatch.Start(); - var compressedTag = new byte[blockHeader.cmpLength - LZMA_PROPERTIES_LENGTH]; - var lzmaProperties = new byte[LZMA_PROPERTIES_LENGTH]; + byte[] compressedTag = new byte[blockHeader.cmpLength - LZMA_PROPERTIES_LENGTH]; + byte[] lzmaProperties = new byte[LZMA_PROPERTIES_LENGTH]; _imageStream.EnsureRead(lzmaProperties, 0, LZMA_PROPERTIES_LENGTH); _imageStream.EnsureRead(compressedTag, 0, compressedTag.Length); data = new byte[blockHeader.length]; @@ -509,13 +509,13 @@ public sealed partial class AaruFormat AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Decompressing_DDT); var ddtStopwatch = new Stopwatch(); ddtStopwatch.Start(); - var compressedDdt = new byte[ddtHeader.cmpLength - LZMA_PROPERTIES_LENGTH]; - var lzmaProperties = new byte[LZMA_PROPERTIES_LENGTH]; + byte[] compressedDdt = new byte[ddtHeader.cmpLength - LZMA_PROPERTIES_LENGTH]; + byte[] lzmaProperties = new byte[LZMA_PROPERTIES_LENGTH]; _imageStream.EnsureRead(lzmaProperties, 0, LZMA_PROPERTIES_LENGTH); _imageStream.EnsureRead(compressedDdt, 0, compressedDdt.Length); - var decompressedDdt = new byte[ddtHeader.length]; + byte[] decompressedDdt = new byte[ddtHeader.length]; - var decompressedLength = + ulong decompressedLength = (ulong)LZMA.DecodeBuffer(compressedDdt, decompressedDdt, lzmaProperties); if(decompressedLength != ddtHeader.length) @@ -565,7 +565,7 @@ public sealed partial class AaruFormat case DataType.CdSectorPrefixCorrected: case DataType.CdSectorSuffixCorrected: { - var decompressedDdt = new byte[ddtHeader.length]; + byte[] decompressedDdt = new byte[ddtHeader.length]; AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Memory_snapshot_0_bytes, @@ -578,12 +578,12 @@ public sealed partial class AaruFormat AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Decompressing_DDT); var ddtStopwatch = new Stopwatch(); ddtStopwatch.Start(); - var compressedDdt = new byte[ddtHeader.cmpLength - LZMA_PROPERTIES_LENGTH]; - var lzmaProperties = new byte[LZMA_PROPERTIES_LENGTH]; + byte[] compressedDdt = new byte[ddtHeader.cmpLength - LZMA_PROPERTIES_LENGTH]; + byte[] lzmaProperties = new byte[LZMA_PROPERTIES_LENGTH]; _imageStream.EnsureRead(lzmaProperties, 0, LZMA_PROPERTIES_LENGTH); _imageStream.EnsureRead(compressedDdt, 0, compressedDdt.Length); - var decompressedLength = + ulong decompressedLength = (ulong)LZMA.DecodeBuffer(compressedDdt, decompressedDdt, lzmaProperties); ddtStopwatch.Stop(); @@ -695,7 +695,7 @@ public sealed partial class AaruFormat Localization.Found_metadata_block_at_position_0, entry.offset); - var metadata = new byte[metadataBlock.blockSize]; + byte[] metadata = new byte[metadataBlock.blockSize]; _imageStream.Position = (long)entry.offset; _imageStream.EnsureRead(metadata, 0, metadata.Length); @@ -969,7 +969,7 @@ public sealed partial class AaruFormat Localization.Memory_snapshot_0_bytes, GC.GetTotalMemory(false)); - var cicmBytes = new byte[cicmBlock.length]; + byte[] cicmBytes = new byte[cicmBlock.length]; _imageStream.EnsureRead(cicmBytes, 0, cicmBytes.Length); var cicmMs = new MemoryStream(cicmBytes); @@ -1023,7 +1023,7 @@ public sealed partial class AaruFormat Localization.Memory_snapshot_0_bytes, GC.GetTotalMemory(false)); - var jsonBytes = new byte[aaruMetadataBlock.length]; + byte[] jsonBytes = new byte[aaruMetadataBlock.length]; _imageStream.EnsureRead(jsonBytes, 0, jsonBytes.Length); try @@ -1206,7 +1206,7 @@ public sealed partial class AaruFormat Localization.Found_tape_partition_block_at_position_0, entry.offset); - var tapePartitionBytes = new byte[partitionHeader.length]; + byte[] tapePartitionBytes = new byte[partitionHeader.length]; _imageStream.EnsureRead(tapePartitionBytes, 0, tapePartitionBytes.Length); Span tapePartitions = @@ -1241,7 +1241,7 @@ public sealed partial class AaruFormat Localization.Found_tape_file_block_at_position_0, entry.offset); - var tapeFileBytes = new byte[fileHeader.length]; + byte[] tapeFileBytes = new byte[fileHeader.length]; _imageStream.EnsureRead(tapeFileBytes, 0, tapeFileBytes.Length); Span tapeFiles = MemoryMarshal.Cast(tapeFileBytes); Files = []; @@ -1362,12 +1362,12 @@ public sealed partial class AaruFormat { if(Tracks != null) { - var leadOutFixed = false; - var sessionPregapFixed = false; + bool leadOutFixed = false; + bool sessionPregapFixed = false; if(_mediaTags.TryGetValue(MediaTagType.CD_FullTOC, out byte[] fullToc)) { - var tmp = new byte[fullToc.Length + 2]; + byte[] tmp = new byte[fullToc.Length + 2]; Array.Copy(fullToc, 0, tmp, 2, fullToc.Length); tmp[0] = (byte)(fullToc.Length >> 8); tmp[1] = (byte)(fullToc.Length & 0xFF); @@ -1505,7 +1505,7 @@ public sealed partial class AaruFormat Sessions = []; - for(var i = 1; i <= Tracks.Max(t => t.Session); i++) + for(int i = 1; i <= Tracks.Max(t => t.Session); i++) { Sessions.Add(new Session { @@ -1694,7 +1694,7 @@ public sealed partial class AaruFormat if(sectorAddress > _imageInfo.Sectors - 1) return ErrorNumber.OutOfRange; ulong ddtEntry = GetDdtEntry(sectorAddress); - var offsetMask = (uint)((1 << _shift) - 1); + uint offsetMask = (uint)((1 << _shift) - 1); ulong offset = ddtEntry & offsetMask; ulong blockOffset = ddtEntry >> _shift; @@ -1737,8 +1737,8 @@ public sealed partial class AaruFormat break; case CompressionType.Lzma: - var compressedBlock = new byte[blockHeader.cmpLength - LZMA_PROPERTIES_LENGTH]; - var lzmaProperties = new byte[LZMA_PROPERTIES_LENGTH]; + byte[] compressedBlock = new byte[blockHeader.cmpLength - LZMA_PROPERTIES_LENGTH]; + byte[] lzmaProperties = new byte[LZMA_PROPERTIES_LENGTH]; _imageStream.EnsureRead(lzmaProperties, 0, LZMA_PROPERTIES_LENGTH); _imageStream.EnsureRead(compressedBlock, 0, compressedBlock.Length); block = new byte[blockHeader.length]; @@ -1758,7 +1758,7 @@ public sealed partial class AaruFormat break; case CompressionType.Flac: - var flacBlock = new byte[blockHeader.cmpLength]; + byte[] flacBlock = new byte[blockHeader.cmpLength]; _imageStream.EnsureRead(flacBlock, 0, flacBlock.Length); block = new byte[blockHeader.length]; decompressedLength = (ulong)FLAC.DecodeBuffer(flacBlock, block); @@ -2168,7 +2168,7 @@ public sealed partial class AaruFormat return ErrorNumber.NoError; } - for(var i = 0; i < length; i++) + for(int i = 0; i < length; i++) { Array.Copy(dataSource, (long)(sectorAddress * (sectorOffset + sectorSize + sectorSkip) + sectorOffset), diff --git a/Aaru.Images/AaruFormat/Verify.cs b/Aaru.Images/AaruFormat/Verify.cs index 611d0bc91..a4a9432ae 100644 --- a/Aaru.Images/AaruFormat/Verify.cs +++ b/Aaru.Images/AaruFormat/Verify.cs @@ -34,8 +34,8 @@ using System; using System.Collections.Generic; using Aaru.Checksums; using Aaru.CommonTypes.Enums; -using Aaru.Console; using Aaru.Helpers; +using Aaru.Logging; namespace Aaru.Images; @@ -256,12 +256,12 @@ public sealed partial class AaruFormat if(errno != ErrorNumber.NoError) return null; - var bps = (int)(buffer.Length / length); - var sector = new byte[bps]; + int bps = (int)(buffer.Length / length); + byte[] sector = new byte[bps]; failingLbas = []; unknownLbas = []; - for(var i = 0; i < length; i++) + for(int i = 0; i < length; i++) { Array.Copy(buffer, i * bps, sector, 0, bps); bool? sectorStatus = CdChecksums.CheckCdSector(sector); @@ -306,10 +306,10 @@ public sealed partial class AaruFormat if(errno != ErrorNumber.NoError) return null; - var bps = (int)(buffer.Length / length); - var sector = new byte[bps]; + int bps = (int)(buffer.Length / length); + byte[] sector = new byte[bps]; - for(var i = 0; i < length; i++) + for(int i = 0; i < length; i++) { Array.Copy(buffer, i * bps, sector, 0, bps); bool? sectorStatus = CdChecksums.CheckCdSector(sector); diff --git a/Aaru.Images/AaruFormat/Write.cs b/Aaru.Images/AaruFormat/Write.cs index b16ac4c91..8c8e0b46f 100644 --- a/Aaru.Images/AaruFormat/Write.cs +++ b/Aaru.Images/AaruFormat/Write.cs @@ -48,10 +48,10 @@ using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Enums; using Aaru.CommonTypes.Structs; using Aaru.Compression; -using Aaru.Console; using Aaru.Decoders; using Aaru.Decoders.CD; using Aaru.Helpers; +using Aaru.Logging; using Schemas; using Marshal = Aaru.Helpers.Marshal; using Partition = Aaru.CommonTypes.Partition; @@ -355,7 +355,7 @@ public sealed partial class AaruFormat // Invalidate previous checksum block _index.RemoveAll(t => t is { blockType: BlockType.ChecksumBlock, dataType: DataType.NoData }); - var foundUserDataDdt = false; + bool foundUserDataDdt = false; foreach(IndexEntry entry in _index) { @@ -427,8 +427,8 @@ public sealed partial class AaruFormat var decompressStopwatch = new Stopwatch(); decompressStopwatch.Restart(); - var compressedTag = new byte[blockHeader.cmpLength - LZMA_PROPERTIES_LENGTH]; - var lzmaProperties = new byte[LZMA_PROPERTIES_LENGTH]; + byte[] compressedTag = new byte[blockHeader.cmpLength - LZMA_PROPERTIES_LENGTH]; + byte[] lzmaProperties = new byte[LZMA_PROPERTIES_LENGTH]; _imageStream.EnsureRead(lzmaProperties, 0, LZMA_PROPERTIES_LENGTH); _imageStream.EnsureRead(compressedTag, 0, compressedTag.Length); data = new byte[blockHeader.length]; @@ -692,14 +692,14 @@ public sealed partial class AaruFormat var ddtStopwatch = new Stopwatch(); ddtStopwatch.Start(); - var compressedDdt = new byte[ddtHeader.cmpLength - LZMA_PROPERTIES_LENGTH]; + byte[] compressedDdt = new byte[ddtHeader.cmpLength - LZMA_PROPERTIES_LENGTH]; - var lzmaProperties = new byte[LZMA_PROPERTIES_LENGTH]; + byte[] lzmaProperties = new byte[LZMA_PROPERTIES_LENGTH]; _imageStream.EnsureRead(lzmaProperties, 0, LZMA_PROPERTIES_LENGTH); _imageStream.EnsureRead(compressedDdt, 0, compressedDdt.Length); - var decompressedDdt = new byte[ddtHeader.length]; + byte[] decompressedDdt = new byte[ddtHeader.length]; - var decompressedLength = + ulong decompressedLength = (ulong)LZMA.DecodeBuffer(compressedDdt, decompressedDdt, lzmaProperties); if(decompressedLength != ddtHeader.length) @@ -766,7 +766,7 @@ public sealed partial class AaruFormat return false; } - var decompressedDdt = new byte[ddtHeader.length]; + byte[] decompressedDdt = new byte[ddtHeader.length]; switch(ddtHeader.compression) { @@ -776,13 +776,13 @@ public sealed partial class AaruFormat var ddtStopwatch = new Stopwatch(); ddtStopwatch.Start(); - var compressedDdt = new byte[ddtHeader.cmpLength - LZMA_PROPERTIES_LENGTH]; + byte[] compressedDdt = new byte[ddtHeader.cmpLength - LZMA_PROPERTIES_LENGTH]; - var lzmaProperties = new byte[LZMA_PROPERTIES_LENGTH]; + byte[] lzmaProperties = new byte[LZMA_PROPERTIES_LENGTH]; _imageStream.EnsureRead(lzmaProperties, 0, LZMA_PROPERTIES_LENGTH); _imageStream.EnsureRead(compressedDdt, 0, compressedDdt.Length); - var decompressedLength = + ulong decompressedLength = (ulong)LZMA.DecodeBuffer(compressedDdt, decompressedDdt, lzmaProperties); if(decompressedLength != ddtHeader.length) @@ -878,7 +878,7 @@ public sealed partial class AaruFormat Localization.Found_metadata_block_at_position_0, entry.offset); - var metadata = new byte[metadataBlock.blockSize]; + byte[] metadata = new byte[metadataBlock.blockSize]; _imageStream.Position = (long)entry.offset; _imageStream.EnsureRead(metadata, 0, metadata.Length); @@ -1156,7 +1156,7 @@ public sealed partial class AaruFormat Localization.Found_CICM_XML_metadata_block_at_position_0, entry.offset); - var cicmBytes = new byte[cicmBlock.length]; + byte[] cicmBytes = new byte[cicmBlock.length]; _imageStream.EnsureRead(cicmBytes, 0, cicmBytes.Length); var cicmMs = new MemoryStream(cicmBytes); @@ -1206,7 +1206,7 @@ public sealed partial class AaruFormat Localization.Memory_snapshot_0_bytes, GC.GetTotalMemory(false)); - var jsonBytes = new byte[aaruMetadataBlock.length]; + byte[] jsonBytes = new byte[aaruMetadataBlock.length]; _imageStream.EnsureRead(jsonBytes, 0, jsonBytes.Length); try @@ -1380,7 +1380,7 @@ public sealed partial class AaruFormat Localization.Found_tape_partition_block_at_position_0, entry.offset); - var tapePartitionBytes = new byte[partitionHeader.length]; + byte[] tapePartitionBytes = new byte[partitionHeader.length]; _imageStream.EnsureRead(tapePartitionBytes, 0, tapePartitionBytes.Length); Span tapePartitions = @@ -1416,7 +1416,7 @@ public sealed partial class AaruFormat Localization.Found_tape_file_block_at_position_0, entry.offset); - var tapeFileBytes = new byte[fileHeader.length]; + byte[] tapeFileBytes = new byte[fileHeader.length]; _imageStream.EnsureRead(tapeFileBytes, 0, tapeFileBytes.Length); Span tapeFiles = MemoryMarshal.Cast(tapeFileBytes); Files = []; @@ -1521,7 +1521,7 @@ public sealed partial class AaruFormat { if(Tracks != null && _mediaTags.TryGetValue(MediaTagType.CD_FullTOC, out byte[] fullToc)) { - var tmp = new byte[fullToc.Length + 2]; + byte[] tmp = new byte[fullToc.Length + 2]; Array.Copy(fullToc, 0, tmp, 2, fullToc.Length); tmp[0] = (byte)(fullToc.Length >> 8); tmp[1] = (byte)(fullToc.Length & 0xFF); @@ -1625,7 +1625,7 @@ public sealed partial class AaruFormat Sessions = []; - for(var i = 1; i <= Tracks.Max(t => t.Session); i++) + for(int i = 1; i <= Tracks.Max(t => t.Session); i++) { Sessions.Add(new Session { @@ -1909,7 +1909,7 @@ public sealed partial class AaruFormat var cmpCrc64Context = new Crc64Context(); byte[] lzmaProperties = []; - var compressedLength = 0; + int compressedLength = 0; switch(_currentBlockHeader.compression) { @@ -1926,8 +1926,9 @@ public sealed partial class AaruFormat // Fill FLAC block if(remaining != 0) - for(var r = 0; r < remaining * 4; r++) - _writingBuffer[_writingBufferPosition + r] = 0; + { + for(int r = 0; r < remaining * 4; r++) _writingBuffer[_writingBufferPosition + r] = 0; + } compressedLength = FLAC.EncodeBuffer(_writingBuffer, _compressedBuffer, @@ -2050,7 +2051,7 @@ public sealed partial class AaruFormat _crc64 = new Crc64Context(); } - var ddtEntry = (ulong)((_imageStream.Position << _shift) + _currentBlockOffset); + ulong ddtEntry = (ulong)((_imageStream.Position << _shift) + _currentBlockOffset); if(hash != null) _deduplicationTable.Add(hashString, ddtEntry); @@ -2083,11 +2084,11 @@ public sealed partial class AaruFormat return false; } - var sectorSize = (uint)(data.Length / length); + uint sectorSize = (uint)(data.Length / length); for(uint i = 0; i < length; i++) { - var tmp = new byte[sectorSize]; + byte[] tmp = new byte[sectorSize]; Array.Copy(data, i * sectorSize, tmp, 0, sectorSize); if(!WriteSector(tmp, sectorAddress + i)) return false; @@ -2367,7 +2368,7 @@ public sealed partial class AaruFormat if(form2) { uint computedEdc = ComputeEdc(0, data, 0x91C, 0x10); - var edc = BitConverter.ToUInt32(data, 0x92C); + uint edc = BitConverter.ToUInt32(data, 0x92C); bool correctEdc = computedEdc == edc; sector = new byte[2324]; @@ -2400,7 +2401,7 @@ public sealed partial class AaruFormat bool correctEcc = SuffixIsCorrectMode2(data); uint computedEdc = ComputeEdc(0, data, 0x808, 0x10); - var edc = BitConverter.ToUInt32(data, 0x818); + uint edc = BitConverter.ToUInt32(data, 0x818); bool correctEdc = computedEdc == edc; sector = new byte[2048]; @@ -2623,7 +2624,7 @@ public sealed partial class AaruFormat case MediaType.AppleSonySS: case MediaType.AppleWidget: case MediaType.PriamDataTower: - var sectorSize = 0; + int sectorSize = 0; if(data.Length % 524 == 0) sectorSize = 524; @@ -2702,7 +2703,7 @@ public sealed partial class AaruFormat var cmpCrc64Context = new Crc64Context(); byte[] lzmaProperties = []; - var compressedLength = 0; + int compressedLength = 0; switch(_currentBlockHeader.compression) { @@ -2719,8 +2720,9 @@ public sealed partial class AaruFormat // Fill FLAC block if(remaining != 0) - for(var r = 0; r < remaining * 4; r++) - _writingBuffer[_writingBufferPosition + r] = 0; + { + for(int r = 0; r < remaining * 4; r++) _writingBuffer[_writingBufferPosition + r] = 0; + } compressedLength = FLAC.EncodeBuffer(_writingBuffer, _compressedBuffer, @@ -2852,10 +2854,10 @@ public sealed partial class AaruFormat crc64 = BitConverter.ToUInt64(tagCrc, 0) }; - var cmpBuffer = new byte[mediaTag.Value.Length + 262144]; + byte[] cmpBuffer = new byte[mediaTag.Value.Length + 262144]; byte[] lzmaProperties = null; - var doNotCompress = false; + bool doNotCompress = false; switch(_compressionAlgorithm) { @@ -3251,7 +3253,7 @@ public sealed partial class AaruFormat var tapePartitionEntries = new TapePartitionEntry[TapePartitions.Count]; - for(var t = 0; t < TapePartitions.Count; t++) + for(int t = 0; t < TapePartitions.Count; t++) { tapePartitionEntries[t] = new TapePartitionEntry { @@ -3295,7 +3297,7 @@ public sealed partial class AaruFormat var tapeFileEntries = new TapeFileEntry[Files.Count]; - for(var t = 0; t < Files.Count; t++) + for(int t = 0; t < Files.Count; t++) { tapeFileEntries[t] = new TapeFileEntry { @@ -3354,7 +3356,7 @@ public sealed partial class AaruFormat byte[] ddtEntries = MemoryMarshal.Cast(_userDataDdt).ToArray(); _crc64.Update(ddtEntries); - var cmpBuffer = new byte[ddtEntries.Length + 262144]; + byte[] cmpBuffer = new byte[ddtEntries.Length + 262144]; int cmpLen; byte[] lzmaProperties = null; @@ -3457,7 +3459,7 @@ public sealed partial class AaruFormat { compressStopwatch.Restart(); - var cmpBuffer = new byte[_sectorPrefix.Length + 262144]; + byte[] cmpBuffer = new byte[_sectorPrefix.Length + 262144]; int cmpLen; @@ -3554,7 +3556,7 @@ public sealed partial class AaruFormat { compressStopwatch.Restart(); - var cmpBuffer = new byte[_sectorSuffix.Length + 262144]; + byte[] cmpBuffer = new byte[_sectorSuffix.Length + 262144]; int cmpLen; @@ -3743,7 +3745,7 @@ public sealed partial class AaruFormat byte[] ddtEntries = MemoryMarshal.Cast(_sectorPrefixDdt).ToArray(); _crc64.Update(ddtEntries); - var cmpBuffer = new byte[ddtEntries.Length + 262144]; + byte[] cmpBuffer = new byte[ddtEntries.Length + 262144]; int cmpLen; byte[] lzmaProperties = []; @@ -4126,7 +4128,7 @@ public sealed partial class AaruFormat { compressStopwatch.Restart(); - var cmpBuffer = new byte[_mode2Subheaders.Length + 262144]; + byte[] cmpBuffer = new byte[_mode2Subheaders.Length + 262144]; int cmpLen; @@ -4233,7 +4235,7 @@ public sealed partial class AaruFormat compressStopwatch.Restart(); byte[] transformedSubchannel = ClauniaSubchannelTransform(_sectorSubchannel); - var cmpBuffer = new byte[transformedSubchannel.Length + 262144]; + byte[] cmpBuffer = new byte[transformedSubchannel.Length + 262144]; int cmpLen; @@ -4342,7 +4344,7 @@ public sealed partial class AaruFormat { compressStopwatch.Restart(); - var cmpBuffer = new byte[_sectorCprMai.Length + 262144]; + byte[] cmpBuffer = new byte[_sectorCprMai.Length + 262144]; int cmpLen; @@ -4445,7 +4447,7 @@ public sealed partial class AaruFormat { compressStopwatch.Restart(); - var cmpBuffer = new byte[_sectorId.Length + 262144]; + byte[] cmpBuffer = new byte[_sectorId.Length + 262144]; int cmpLen; @@ -4546,7 +4548,7 @@ public sealed partial class AaruFormat { compressStopwatch.Restart(); - var cmpBuffer = new byte[_sectorIed.Length + 262144]; + byte[] cmpBuffer = new byte[_sectorIed.Length + 262144]; int cmpLen; @@ -4647,7 +4649,7 @@ public sealed partial class AaruFormat { compressStopwatch.Restart(); - var cmpBuffer = new byte[_sectorEdc.Length + 262144]; + byte[] cmpBuffer = new byte[_sectorEdc.Length + 262144]; int cmpLen; @@ -4748,7 +4750,7 @@ public sealed partial class AaruFormat { compressStopwatch.Restart(); - var cmpBuffer = new byte[_sectorDecryptedTitleKey.Length + 262144]; + byte[] cmpBuffer = new byte[_sectorDecryptedTitleKey.Length + 262144]; int cmpLen; @@ -5030,7 +5032,7 @@ public sealed partial class AaruFormat } else { - var cmpBuffer = new byte[_sectorSubchannel.Length + 262144]; + byte[] cmpBuffer = new byte[_sectorSubchannel.Length + 262144]; int cmpLen = _compressionAlgorithm switch { diff --git a/Aaru.Images/Alcohol120/Read.cs b/Aaru.Images/Alcohol120/Read.cs index 75fab049f..3dc9bb105 100644 --- a/Aaru.Images/Alcohol120/Read.cs +++ b/Aaru.Images/Alcohol120/Read.cs @@ -38,9 +38,9 @@ using System.Text; using Aaru.CommonTypes; using Aaru.CommonTypes.Enums; using Aaru.CommonTypes.Interfaces; -using Aaru.Console; using Aaru.Decoders.DVD; using Aaru.Helpers; +using Aaru.Logging; using DMI = Aaru.Decoders.Xbox.DMI; using Sector = Aaru.Decoders.CD.Sector; @@ -59,7 +59,7 @@ public sealed partial class Alcohol120 if(stream.Length < 88) return ErrorNumber.InvalidArgument; _isDvd = false; - var hdr = new byte[88]; + byte[] hdr = new byte[88]; stream.EnsureRead(hdr, 0, 88); _header = Marshal.ByteArrayToStructureLittleEndian
(hdr); @@ -70,22 +70,22 @@ public sealed partial class Alcohol120 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++) + for(int 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.bcaLength = {0}", _header.bcaLength); - for(var i = 0; i < _header.unknown2.Length; i++) + for(int 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.bcaOffset = {0}", _header.bcaOffset); - for(var i = 0; i < _header.unknown3.Length; i++) + for(int 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.structuresOffset = {0}", _header.structuresOffset); - for(var i = 0; i < _header.unknown4.Length; i++) + for(int 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.sessionOffset = {0}", _header.sessionOffset); @@ -96,9 +96,9 @@ public sealed partial class Alcohol120 stream.Seek(_header.sessionOffset, SeekOrigin.Begin); _alcSessions = new Dictionary(); - for(var i = 0; i < _header.sessions; i++) + for(int i = 0; i < _header.sessions; i++) { - var sesHdr = new byte[24]; + byte[] sesHdr = new byte[24]; stream.EnsureRead(sesHdr, 0, 24); Session session = Marshal.SpanToStructureLittleEndian(sesHdr); @@ -124,7 +124,7 @@ public sealed partial class Alcohol120 } long footerOff = 0; - var oldIncorrectImage = false; + bool oldIncorrectImage = false; _alcTracks = new Dictionary(); _alcToc = new Dictionary>(); @@ -135,9 +135,9 @@ public sealed partial class Alcohol120 stream.Seek(session.trackOffset, SeekOrigin.Begin); Dictionary sesToc = new(); - for(var i = 0; i < session.allBlocks; i++) + for(int i = 0; i < session.allBlocks; i++) { - var trkHdr = new byte[80]; + byte[] trkHdr = new byte[80]; stream.EnsureRead(trkHdr, 0, 80); Track track = Marshal.ByteArrayToStructureLittleEndian(trkHdr); @@ -293,7 +293,7 @@ public sealed partial class Alcohol120 { if(track.extraOffset > 0 && !_isDvd) { - var extHdr = new byte[8]; + byte[] extHdr = new byte[8]; stream.Seek(track.extraOffset, SeekOrigin.Begin); stream.EnsureRead(extHdr, 0, 8); TrackExtra extra = Marshal.SpanToStructureLittleEndian(extHdr); @@ -323,7 +323,7 @@ public sealed partial class Alcohol120 if(footerOff > 0) { - var footer = new byte[16]; + byte[] footer = new byte[16]; stream.Seek(footerOff, SeekOrigin.Begin); stream.EnsureRead(footer, 0, 16); _alcFooter = Marshal.SpanToStructureLittleEndian