Colorize SCSI medium scan.

This commit is contained in:
2025-08-17 21:27:09 +01:00
parent 20eb6cf83c
commit 28a98bf8f5
4 changed files with 85 additions and 78 deletions

View File

@@ -612,26 +612,27 @@ sealed partial class Reader
if(CanReadRaw)
{
if(_readLong16)
AaruLogging.WriteLine(Localization.Core.Using_SCSI_READ_LONG_16_command);
AaruLogging.WriteLine($"[slateblue1]{Localization.Core.Using_SCSI_READ_LONG_16_command}[/]");
else if(_readLong10 || _readLongDvd)
AaruLogging.WriteLine(Localization.Core.Using_SCSI_READ_LONG_10_command);
AaruLogging.WriteLine($"[slateblue1]{Localization.Core.Using_SCSI_READ_LONG_10_command}[/]");
else if(_syqReadLong10)
AaruLogging.WriteLine(Localization.Core.Using_SyQuest_READ_LONG_10_command);
AaruLogging.WriteLine($"[slateblue1]{Localization.Core.Using_SyQuest_READ_LONG_10_command}[/]");
else if(_syqReadLong6)
AaruLogging.WriteLine(Localization.Core.Using_SyQuest_READ_LONG_6_command);
AaruLogging.WriteLine($"[slateblue1]{Localization.Core.Using_SyQuest_READ_LONG_6_command}[/]");
else if(HldtstReadRaw)
AaruLogging.WriteLine(Localization.Core.Using_HL_DT_ST_raw_DVD_reading);
AaruLogging.WriteLine($"[slateblue1]{Localization.Core.Using_HL_DT_ST_raw_DVD_reading}[/]");
else if(_plextorReadRaw)
AaruLogging.WriteLine(Localization.Core.Using_Plextor_raw_DVD_reading);
else if(LiteOnReadRaw) AaruLogging.WriteLine(Localization.Core.Using_Lite_On_raw_DVD_reading);
AaruLogging.WriteLine($"[slateblue1]{Localization.Core.Using_Plextor_raw_DVD_reading}[/]");
else if(LiteOnReadRaw)
AaruLogging.WriteLine($"[slateblue1]{Localization.Core.Using_Lite_On_raw_DVD_reading}[/]");
}
else if(_read6)
AaruLogging.WriteLine(Localization.Core.Using_SCSI_READ_6_command);
AaruLogging.WriteLine($"[slateblue1]{Localization.Core.Using_SCSI_READ_6_command}[/]");
else if(_read10)
AaruLogging.WriteLine(Localization.Core.Using_SCSI_READ_10_command);
AaruLogging.WriteLine($"[slateblue1]{Localization.Core.Using_SCSI_READ_10_command}[/]");
else if(_read12)
AaruLogging.WriteLine(Localization.Core.Using_SCSI_READ_12_command);
else if(_read16) AaruLogging.WriteLine(Localization.Core.Using_SCSI_READ_16_command);
AaruLogging.WriteLine($"[slateblue1]{Localization.Core.Using_SCSI_READ_12_command}[/]");
else if(_read16) AaruLogging.WriteLine($"[slateblue1]{Localization.Core.Using_SCSI_READ_16_command}[/]");
return false;
}

View File

@@ -80,7 +80,9 @@ public sealed partial class MediaScan
while(leftRetries > 0)
{
PulseProgress?.Invoke(Localization.Core.Waiting_for_drive_to_become_ready);
PulseProgress
?.Invoke($"[olive]{Localization.Core.Waiting_for_drive_to_become_ready}[/]");
Thread.Sleep(2000);
sense = _dev.ScsiTestUnitReady(out senseBuf, _dev.Timeout, out _);
@@ -104,7 +106,9 @@ public sealed partial class MediaScan
while(leftRetries > 0)
{
PulseProgress?.Invoke(Localization.Core.Waiting_for_drive_to_become_ready);
PulseProgress
?.Invoke($"[olive]{Localization.Core.Waiting_for_drive_to_become_ready}[/]");
Thread.Sleep(2000);
sense = _dev.ScsiTestUnitReady(out senseBuf, _dev.Timeout, out _);
@@ -132,7 +136,9 @@ public sealed partial class MediaScan
while(leftRetries > 0)
{
PulseProgress?.Invoke(Localization.Core.Waiting_for_drive_to_become_ready);
PulseProgress
?.Invoke($"[olive]{Localization.Core.Waiting_for_drive_to_become_ready}[/]");
Thread.Sleep(2000);
sense = _dev.ScsiTestUnitReady(out senseBuf, _dev.Timeout, out _);
@@ -197,12 +203,12 @@ public sealed partial class MediaScan
{
results.Blocks++;
UpdateStatus?.Invoke(string.Format(Localization.Core
.Media_has_0_blocks_of_1_bytes_each_for_a_total_of_2,
results.Blocks,
blockSize,
ByteSize.FromBytes(results.Blocks * blockSize)
.ToString("0.000")));
UpdateStatus?.Invoke(string.Format($"[slateblue1]{Localization.Core
.Media_has_0_blocks_of_1_bytes_each_for_a_total_of_2}[/]",
$"[violet]{results.Blocks}[/]",
$"[lime]{blockSize}[/]",
$"[lime]{ByteSize.FromBytes(results.Blocks * blockSize)
.ToString("0.000")}[/]"));
}
break;
@@ -314,7 +320,7 @@ public sealed partial class MediaScan
out _);
if(readcd)
UpdateStatus?.Invoke(Localization.Core.Using_MMC_READ_CD_command);
UpdateStatus?.Invoke($"[slateblue1]{Localization.Core.Using_MMC_READ_CD_command}[/]");
else if(!foundReadCommand)
{
StoppingErrorMessage?.Invoke(Localization.Core.Unable_to_read_medium);
@@ -360,7 +366,8 @@ public sealed partial class MediaScan
return results;
}
UpdateStatus?.Invoke(string.Format(Localization.Core.Reading_0_sectors_at_a_time, blocksToRead));
UpdateStatus?.Invoke(string.Format($"[slateblue1]{Localization.Core.Reading_0_sectors_at_a_time}[/]",
$"[violet]{blocksToRead}[/]"));
InitBlockMap?.Invoke(results.Blocks, blockSize, blocksToRead, currentProfile);
mhddLog = new MhddLog(_mhddLogPath, _dev, results.Blocks, blockSize, blocksToRead, false);
@@ -382,10 +389,10 @@ public sealed partial class MediaScan
if(currentSpeed < results.MinSpeed && currentSpeed > 0) results.MinSpeed = currentSpeed;
UpdateProgress?.Invoke(string.Format(Localization.Core.Reading_sector_0_of_1_2,
i,
results.Blocks,
ByteSize.FromMegabytes(currentSpeed).Per(_oneSecond).Humanize()),
UpdateProgress?.Invoke(string.Format($"[slateblue1]{Localization.Core.Reading_sector_0_of_1_2}[/]",
$"[lima]{i}[/]",
$"[violet]{results.Blocks}[/]",
$"[aqua]{ByteSize.FromMegabytes(currentSpeed).Per(_oneSecond).Humanize()}[/]"),
(long)i,
(long)results.Blocks);
@@ -454,8 +461,8 @@ public sealed partial class MediaScan
if(readcd)
{
AaruLogging.Debug(MODULE_NAME,
Localization.Core.READ_CD_error_0,
Sense.PrettifySense(senseBuf));
Localization.Core.READ_CD_error_0,
Sense.PrettifySense(senseBuf));
senseDecoded = Sense.Decode(senseBuf);
@@ -532,7 +539,8 @@ public sealed partial class MediaScan
{
_scanStopwatch.Restart();
UpdateStatus?.Invoke(string.Format(Localization.Core.Reading_0_sectors_at_a_time, scsiReader.BlocksToRead));
UpdateStatus?.Invoke(string.Format($"[slateblue1]{Localization.Core.Reading_0_sectors_at_a_time}[/]",
$"[violet]{scsiReader.BlocksToRead}[/]"));
InitBlockMap?.Invoke(results.Blocks, blockSize, scsiReader.BlocksToRead, currentProfile);
mhddLog = new MhddLog(_mhddLogPath, _dev, results.Blocks, blockSize, scsiReader.BlocksToRead, false);
@@ -554,10 +562,10 @@ public sealed partial class MediaScan
if(currentSpeed < results.MinSpeed && currentSpeed > 0) results.MinSpeed = currentSpeed;
UpdateProgress?.Invoke(string.Format(Localization.Core.Reading_sector_0_of_1_2,
i,
results.Blocks,
ByteSize.FromMegabytes(currentSpeed).Per(_oneSecond).Humanize()),
UpdateProgress?.Invoke(string.Format($"[slateblue1]{Localization.Core.Reading_sector_0_of_1_2}[/]",
$"[lime]{i}[/]",
$"[violet]{results.Blocks}[/]",
$"[aqua]{ByteSize.FromMegabytes(currentSpeed).Per(_oneSecond).Humanize()}[/]"),
(long)i,
(long)results.Blocks);
@@ -652,7 +660,8 @@ public sealed partial class MediaScan
uint seekPos = (uint)rnd.Next((int)results.Blocks);
PulseProgress?.Invoke(string.Format(Localization.Core.Seeking_to_sector_0, seekPos));
PulseProgress?.Invoke(string.Format($"[slateblue1]{Localization.Core.Seeking_to_sector_0}[/]",
$"[lime]{seekPos}[/]"));
double seekCur;

View File

@@ -2322,7 +2322,7 @@ It has no sense to do it, and it will put too much strain on the tape.</value>
<value>Error trying to decode TOC...</value>
</data>
<data name="Using_MMC_READ_CD_command" xml:space="preserve">
<value>Using MMC READ CD command.</value>
<value>Using [fuchsia]MMC READ CD[/] command.</value>
</data>
<data name="READ_CD_error_0" xml:space="preserve">
<value>READ CD error:
@@ -2350,34 +2350,34 @@ It has no sense to do it, and it will put too much strain on the tape.</value>
<value>Device needs CHS commands but I can't issue them... Aborting.</value>
</data>
<data name="Using_ATA_READ_DMA_EXT_command" xml:space="preserve">
<value>Using ATA READ DMA EXT command.</value>
<value>Using [fuchsia]ATA READ DMA EXT[/] command.</value>
</data>
<data name="Using_ATA_READ_EXT_command" xml:space="preserve">
<value>Using ATA READ EXT command.</value>
<value>Using [fuchsia]ATA READ EXT[/] command.</value>
</data>
<data name="Using_ATA_READ_DMA_command_with_retries_LBA" xml:space="preserve">
<value>Using ATA READ DMA command with retries (LBA).</value>
<value>Using [fuchsia]ATA READ DMA[/] command with retries (LBA).</value>
</data>
<data name="Using_ATA_READ_DMA_command_LBA" xml:space="preserve">
<value>Using ATA READ DMA command (LBA).</value>
<value>Using [fuchsia]ATA READ DMA[/] command (LBA).</value>
</data>
<data name="Using_ATA_READ_command_with_retries_LBA" xml:space="preserve">
<value>Using ATA READ command with retries (LBA).</value>
<value>Using [fuchsia]ATA READ[/] command with retries (LBA).</value>
</data>
<data name="Using_ATA_READ_command_LBA" xml:space="preserve">
<value>Using ATA READ command (LBA).</value>
<value>Using [fuchsia]ATA READ[/] command (LBA).</value>
</data>
<data name="Using_ATA_READ_DMA_command_with_retries_CHS" xml:space="preserve">
<value>Using ATA READ DMA command with retries (CHS).</value>
<value>Using [fuchsia]ATA READ DMA[/] command with retries (CHS).</value>
</data>
<data name="Using_ATA_READ_DMA_command_CHS" xml:space="preserve">
<value>Using ATA READ DMA command (CHS).</value>
<value>Using [fuchsia]ATA READ DMA[/] command (CHS).</value>
</data>
<data name="Using_ATA_READ_command_with_retries_CHS" xml:space="preserve">
<value>Using ATA READ command with retries (CHS).</value>
<value>Using [fuchsia]ATA READ[/] command with retries (CHS).</value>
</data>
<data name="Using_ATA_READ_command_CHS" xml:space="preserve">
<value>Using ATA READ command (CHS).</value>
<value>Using [fuchsia]ATA READ[/] command (CHS).</value>
</data>
<data name="Could_not_get_a_working_read_command" xml:space="preserve">
<value>Could not get a working read command!</value>
@@ -2392,31 +2392,31 @@ It has no sense to do it, and it will put too much strain on the tape.</value>
<value>Device only supports SCSI READ (10) but has more than {0} blocks ({1} blocks total)</value>
</data>
<data name="Using_SCSI_READ_LONG_16_command" xml:space="preserve">
<value>Using SCSI READ LONG (16) command.</value>
<value>Using [fuchsia]SCSI READ LONG (16)[/] command.</value>
</data>
<data name="Using_SCSI_READ_LONG_10_command" xml:space="preserve">
<value>Using SCSI READ LONG (10) command.</value>
<value>Using [fuchsia]SCSI READ LONG (10)[/] command.</value>
</data>
<data name="Using_SyQuest_READ_LONG_10_command" xml:space="preserve">
<value>Using SyQuest READ LONG (10) command.</value>
<value>Using [fuchsia]SyQuest READ LONG (10)[/] command.</value>
</data>
<data name="Using_SyQuest_READ_LONG_6_command" xml:space="preserve">
<value>Using SyQuest READ LONG (6) command.</value>
<value>Using [fuchsia]SyQuest READ LONG (6)[/] command.</value>
</data>
<data name="Using_HL_DT_ST_raw_DVD_reading" xml:space="preserve">
<value>Using HL-DT-ST raw DVD reading.</value>
<value>Using [fuchsia]HL-DT-ST raw DVD[/] reading.</value>
</data>
<data name="Using_Plextor_raw_DVD_reading" xml:space="preserve">
<value>Using Plextor raw DVD reading.</value>
<value>Using [fuchsia]Plextor raw DVD[/] reading.</value>
</data>
<data name="Using_SCSI_READ_6_command" xml:space="preserve">
<value>Using SCSI READ (6) command.</value>
<value>Using [fuchsia]SCSI READ (6)[/] command.</value>
</data>
<data name="Using_SCSI_READ_10_command" xml:space="preserve">
<value>Using SCSI READ (10) command.</value>
<value>Using [fuchsia]SCSI READ (10)[/] command.</value>
</data>
<data name="Using_SCSI_READ_16_command" xml:space="preserve">
<value>Using SCSI READ (16) command.</value>
<value>Using [fuchsia]SCSI READ (16)[/] command.</value>
</data>
<data name="Unable_to_get_media_capacity" xml:space="preserve">
<value>Unable to get media capacity

View File

@@ -111,17 +111,14 @@ sealed class MediaScanCommand : Command<MediaScanCommand.Settings>
.Columns(new TaskDescriptionColumn(), new ProgressBarColumn(), new PercentageColumn())
.Start(ctx =>
{
scanner.UpdateStatus += text => { AaruLogging.WriteLine(Markup.Escape(text)); };
scanner.UpdateStatus += text => { AaruLogging.WriteLine(text); };
scanner.StoppingErrorMessage += text =>
{
AaruLogging.Error($"[red]{Markup.Escape(text)}[/]");
};
scanner.StoppingErrorMessage += text => { AaruLogging.Error(text); };
scanner.UpdateProgress += (text, current, maximum) =>
{
_progressTask1 ??= ctx.AddTask("Progress");
_progressTask1.Description = Markup.Escape(text);
_progressTask1.Description = text;
_progressTask1.Value = current;
_progressTask1.MaxValue = maximum;
};
@@ -129,10 +126,10 @@ sealed class MediaScanCommand : Command<MediaScanCommand.Settings>
scanner.PulseProgress += text =>
{
if(_progressTask1 is null)
ctx.AddTask(Markup.Escape(text)).IsIndeterminate();
ctx.AddTask(text).IsIndeterminate();
else
{
_progressTask1.Description = Markup.Escape(text);
_progressTask1.Description = text;
_progressTask1.IsIndeterminate = true;
}
};
@@ -154,18 +151,18 @@ sealed class MediaScanCommand : Command<MediaScanCommand.Settings>
results = scanner.Scan();
});
AaruLogging.WriteLine(Localization.Core.Took_a_total_of_0_1_processing_commands,
results.TotalTime.Seconds().Humanize(minUnit: TimeUnit.Second),
results.ProcessingTime.Seconds().Humanize(minUnit: TimeUnit.Second));
AaruLogging.WriteLine($"[slateblue1]{Localization.Core.Took_a_total_of_0_1_processing_commands}[/]",
$"[teal]{results.TotalTime.Seconds().Humanize(minUnit: TimeUnit.Second)}[/]",
$"[teal]{results.ProcessingTime.Seconds().Humanize(minUnit: TimeUnit.Second)}[/]");
AaruLogging.WriteLine(Localization.Core.Average_speed_0,
ByteSize.FromBytes(results.AvgSpeed).Per(1.Seconds()).Humanize());
AaruLogging.WriteLine($"[slateblue1]{Localization.Core.Average_speed_0}[/]",
$"[aqua]{ByteSize.FromBytes(results.AvgSpeed).Per(1.Seconds()).Humanize()}[/]");
AaruLogging.WriteLine(Localization.Core.Fastest_speed_burst_0,
ByteSize.FromBytes(results.MaxSpeed).Per(1.Seconds()).Humanize());
AaruLogging.WriteLine($"[slateblue1]{Localization.Core.Fastest_speed_burst_0}[/]",
$"[aqua]{ByteSize.FromBytes(results.MaxSpeed).Per(1.Seconds()).Humanize()}[/]");
AaruLogging.WriteLine(Localization.Core.Slowest_speed_burst_0,
ByteSize.FromBytes(results.MinSpeed).Per(1.Seconds()).Humanize());
AaruLogging.WriteLine($"[slateblue1]{Localization.Core.Slowest_speed_burst_0}[/]",
$"[aqua]{ByteSize.FromBytes(results.MinSpeed).Per(1.Seconds()).Humanize()}[/]");
AaruLogging.WriteLine();
AaruLogging.WriteLine($"[bold]{Localization.Core.Summary}:[/]");
@@ -185,19 +182,19 @@ sealed class MediaScanCommand : Command<MediaScanCommand.Settings>
results.UnreadableSectors.Count)}[/]");
foreach(ulong bad in results.UnreadableSectors)
AaruLogging.WriteLine(Localization.Core.Sector_0_could_not_be_read, bad);
AaruLogging.WriteLine($"[red]{Localization.Core.Sector_0_could_not_be_read}[/]", $"[teal]{bad}[/]");
AaruLogging.WriteLine();
if(results.SeekTotal > 0 || results.SeekMin < double.MaxValue || results.SeekMax > double.MinValue)
{
AaruLogging.WriteLine(Localization.Core
.Testing_0_seeks_longest_seek_took_1_ms_fastest_one_took_2_ms_3_ms_average,
results.SeekTimes,
results.SeekMax,
results.SeekMin,
results.SeekTotal / 1000);
AaruLogging.WriteLine($"[slateblue1]{Localization.Core
.Testing_0_seeks_longest_seek_took_1_ms_fastest_one_took_2_ms_3_ms_average}[/]",
$"[aqua]{results.SeekTimes}[/]",
$"[aqua]{results.SeekMax}[/]",
$"[aqua]{results.SeekMin}[/]",
$"[aqua]{results.SeekTotal / 1000}[/]");
}
dev.Close();