From 668fb57524dbfee1d43ab65f1195633771d26564 Mon Sep 17 00:00:00 2001 From: Rebecca Wallander Date: Sat, 28 Feb 2026 08:18:54 +0100 Subject: [PATCH] Address Github code quality issues --- Aaru.Core/Devices/Dumping/Sbc/Dump.cs | 6 +++--- Aaru.Core/Devices/Dumping/Sbc/RawDvd.cs | 10 ++++++++-- Aaru.Localization/Core.Designer.cs | 6 ++++++ Aaru.Localization/Core.resx | 3 +++ 4 files changed, 20 insertions(+), 5 deletions(-) diff --git a/Aaru.Core/Devices/Dumping/Sbc/Dump.cs b/Aaru.Core/Devices/Dumping/Sbc/Dump.cs index 14186b970..abf52941b 100644 --- a/Aaru.Core/Devices/Dumping/Sbc/Dump.cs +++ b/Aaru.Core/Devices/Dumping/Sbc/Dump.cs @@ -403,9 +403,9 @@ partial class Dump if(scsiReader.OmniDriveReadRaw && decodedPfi.HasValue && ((dskType >= MediaType.DVDROM && dskType <= MediaType.DVDDownload) - || dskType != MediaType.PS2DVD - || dskType != MediaType.PS3DVD - || dskType != MediaType.Nuon)) + || dskType == MediaType.PS2DVD + || dskType == MediaType.PS3DVD + || dskType == MediaType.Nuon)) nominalNegativeSectors = Math.Min(nominalNegativeSectors, DvdLeadinSectors); mediaTags.TryGetValue(MediaTagType.BD_DI, out byte[] di); diff --git a/Aaru.Core/Devices/Dumping/Sbc/RawDvd.cs b/Aaru.Core/Devices/Dumping/Sbc/RawDvd.cs index 6a0a48a6a..833fa66f7 100644 --- a/Aaru.Core/Devices/Dumping/Sbc/RawDvd.cs +++ b/Aaru.Core/Devices/Dumping/Sbc/RawDvd.cs @@ -77,6 +77,12 @@ partial class Dump uint blocksToRead = maxBlocksToRead; var outputFormat = _outputPlugin as IWritableImage; + if(outputFormat is null) + { + ErrorMessage?.Invoke(Localization.Core.Output_format_not_initialized); + return; + } + InitProgress?.Invoke(); if(scsiReader.HldtstReadRaw && _resume.NextBlock > 0) @@ -160,7 +166,7 @@ partial class Dump double elapsed = _speedStopwatch.Elapsed.TotalSeconds; if(elapsed > 0) { - currentSpeed = sectorSpeedStart * blockSize / (1048576 * elapsed); + currentSpeed = (double)sectorSpeedStart * blockSize / (1048576d * elapsed); sectorSpeedStart = 0; _speedStopwatch.Restart(); } @@ -361,7 +367,7 @@ partial class Dump double elapsed = _speedStopwatch.Elapsed.TotalSeconds; if(elapsed > 0) { - currentSpeed = sectorSpeedStart * blockSize / (1048576 * elapsed); + currentSpeed = (double)sectorSpeedStart * blockSize / (1048576d * elapsed); sectorSpeedStart = 0; _speedStopwatch.Restart(); } diff --git a/Aaru.Localization/Core.Designer.cs b/Aaru.Localization/Core.Designer.cs index ea0b4cbf2..0d42d4f22 100644 --- a/Aaru.Localization/Core.Designer.cs +++ b/Aaru.Localization/Core.Designer.cs @@ -6946,5 +6946,11 @@ namespace Aaru.Localization { return ResourceManager.GetString("Reading_data_sectors", resourceCulture); } } + + public static string Output_format_not_initialized { + get { + return ResourceManager.GetString("Output_format_not_initialized", resourceCulture); + } + } } } diff --git a/Aaru.Localization/Core.resx b/Aaru.Localization/Core.resx index 7d03fdf40..88999eaeb 100644 --- a/Aaru.Localization/Core.resx +++ b/Aaru.Localization/Core.resx @@ -3544,4 +3544,7 @@ It has no sense to do it, and it will put too much strain on the tape. [slateblue1]Reading data sectors...[/] + + [red]Output format not initialized.[/] + \ No newline at end of file