Colorify image verify.

This commit is contained in:
2025-08-18 03:10:05 +01:00
parent 499f1fd7b0
commit 51fe8dc99c
2 changed files with 51 additions and 42 deletions

View File

@@ -378,7 +378,7 @@ In you are unsure, please press N to not continue.</value>
<value>Directory where extracted files will be created. Will abort if it exists</value> <value>Directory where extracted files will be created. Will abort if it exists</value>
</data> </data>
<data name="Identifying_file_filter" xml:space="preserve"> <data name="Identifying_file_filter" xml:space="preserve">
<value>Identifying file filter...</value> <value>[slateblue1]Identifying file filter...[/]</value>
</data> </data>
<data name="Parsed_options" xml:space="preserve"> <data name="Parsed_options" xml:space="preserve">
<value>Parsed options:</value> <value>Parsed options:</value>
@@ -393,7 +393,7 @@ In you are unsure, please press N to not continue.</value>
<value>Specified encoding is not supported.</value> <value>Specified encoding is not supported.</value>
</data> </data>
<data name="Identifying_image_format" xml:space="preserve"> <data name="Identifying_image_format" xml:space="preserve">
<value>Identifying image format...</value> <value>[slateblue1]Identifying image format...[/]</value>
</data> </data>
<data name="Image_format_not_identified_not_proceeding_with_file_extraction" xml:space="preserve"> <data name="Image_format_not_identified_not_proceeding_with_file_extraction" xml:space="preserve">
<value>Image format not identified, not proceeding with file extraction.</value> <value>Image format not identified, not proceeding with file extraction.</value>
@@ -414,7 +414,7 @@ In you are unsure, please press N to not continue.</value>
<value>Destination exists, aborting.</value> <value>Destination exists, aborting.</value>
</data> </data>
<data name="Invoke_Opening_image_file" xml:space="preserve"> <data name="Invoke_Opening_image_file" xml:space="preserve">
<value>Opening image file...</value> <value>[slateblue1]Opening image file...[/]</value>
</data> </data>
<data name="Unable_to_open_image_format" xml:space="preserve"> <data name="Unable_to_open_image_format" xml:space="preserve">
<value>Unable to open image format</value> <value>Unable to open image format</value>
@@ -1349,70 +1349,70 @@ In you are unsure, please press N to not continue.</value>
<value>The specified image does not support any kind of verification</value> <value>The specified image does not support any kind of verification</value>
</data> </data>
<data name="Verifying_image_checksums" xml:space="preserve"> <data name="Verifying_image_checksums" xml:space="preserve">
<value>Verifying image checksums...</value> <value>[slateblue1]Verifying image checksums...[/]</value>
</data> </data>
<data name="Disc_image_checksums_are_correct" xml:space="preserve"> <data name="Disc_image_checksums_are_correct" xml:space="preserve">
<value>Disc image checksums are correct</value> <value>[green]Disc image checksums are correct[/]</value>
</data> </data>
<data name="Disc_image_checksums_are_incorrect" xml:space="preserve"> <data name="Disc_image_checksums_are_incorrect" xml:space="preserve">
<value>Disc image checksums are incorrect</value> <value>[red]Disc image checksums are incorrect[/]</value>
</data> </data>
<data name="Disc_image_does_not_contain_checksums" xml:space="preserve"> <data name="Disc_image_does_not_contain_checksums" xml:space="preserve">
<value>Disc image does not contain checksums</value> <value>[olive]Disc image does not contain checksums[/]</value>
</data> </data>
<data name="Checking_disc_image_checksums_took_0" xml:space="preserve"> <data name="Checking_disc_image_checksums_took_0" xml:space="preserve">
<value>Checking disc image checksums took {0}</value> <value>[slateblue1]Checking disc image checksums took [aqua]{0}[/][/]</value>
</data> </data>
<data name="Checking_tracks" xml:space="preserve"> <data name="Checking_tracks" xml:space="preserve">
<value>Checking tracks...</value> <value>Checking tracks...</value>
</data> </data>
<data name="Checking_track_0_of_1" xml:space="preserve"> <data name="Checking_track_0_of_1" xml:space="preserve">
<value>Checking track {0} of {1}</value> <value>[slateblue1]Checking track [teal]{0}[/] of [teal]{1}[/][/]</value>
</data> </data>
<data name="Checking_sector" xml:space="preserve"> <data name="Checking_sector" xml:space="preserve">
<value>Checking sector</value> <value>Checking sector</value>
</data> </data>
<data name="Checking_sector_0_of_1_on_track_2" xml:space="preserve"> <data name="Checking_sector_0_of_1_on_track_2" xml:space="preserve">
<value>Checking sector {0} of {1}, on track {2}</value> <value>[slateblue1]Checking sector [lime]{0}[/] of [violet]{1}[/], on track [teal]{2}[/][/]</value>
</data> </data>
<data name="Checking_sectors" xml:space="preserve"> <data name="Checking_sectors" xml:space="preserve">
<value>Checking sectors...</value> <value>Checking sectors...</value>
</data> </data>
<data name="Checking_sector_0_of_1" xml:space="preserve"> <data name="Checking_sector_0_of_1" xml:space="preserve">
<value>Checking sector {0} of {1}</value> <value>[slateblue1]Checking sector [lime]{0}[/] of [violet]{1}[/]</value>
</data> </data>
<data name="There_is_at_least_one_sector_that_does_not_contain_a_checksum" xml:space="preserve"> <data name="There_is_at_least_one_sector_that_does_not_contain_a_checksum" xml:space="preserve">
<value>There is at least one sector that does not contain a checksum</value> <value>[olive]There is at least one sector that does not contain a checksum[/]</value>
</data> </data>
<data name="There_is_at_least_one_sector_with_incorrect_checksum_or_errors" xml:space="preserve"> <data name="There_is_at_least_one_sector_with_incorrect_checksum_or_errors" xml:space="preserve">
<value>There is at least one sector with incorrect checksum or errors</value> <value>[red]There is at least one sector with incorrect checksum or errors[/]</value>
</data> </data>
<data name="All_sector_checksums_are_correct" xml:space="preserve"> <data name="All_sector_checksums_are_correct" xml:space="preserve">
<value>All sector checksums are correct</value> <value>[green]All sector checksums are correct[/]</value>
</data> </data>
<data name="Checking_sector_checksums_took_0" xml:space="preserve"> <data name="Checking_sector_checksums_took_0" xml:space="preserve">
<value>Checking sector checksums took {0}</value> <value>[slateblue1]Checking sector checksums took [aqua]{0}[/][/]</value>
</data> </data>
<data name="LBAs_with_error" xml:space="preserve"> <data name="LBAs_with_error" xml:space="preserve">
<value>LBAs with error:</value> <value>[slateblue1]LBAs with error:[/]</value>
</data> </data>
<data name="all_sectors" xml:space="preserve"> <data name="all_sectors" xml:space="preserve">
<value>all sectors.</value> <value>[red]all sectors.[/]</value>
</data> </data>
<data name="LBAs_without_checksum" xml:space="preserve"> <data name="LBAs_without_checksum" xml:space="preserve">
<value>LBAs without checksum:</value> <value>[slateblue1]LBAs without checksum:[/]</value>
</data> </data>
<data name="Total_sectors" xml:space="preserve"> <data name="Total_sectors" xml:space="preserve">
<value>Total sectors...........</value> <value>[bold][italic][slateblue1]Total sectors[/][/][/]</value>
</data> </data>
<data name="Total_errors" xml:space="preserve"> <data name="Total_errors" xml:space="preserve">
<value>Total errors............</value> <value>[bold][italic][slateblue1]Total errors[/][/][/]</value>
</data> </data>
<data name="Total_unknowns" xml:space="preserve"> <data name="Total_unknowns" xml:space="preserve">
<value>Total unknowns..........</value> <value>[bold][italic][slateblue1]Total unknowns[/][/][/]</value>
</data> </data>
<data name="Total_errors_plus_unknowns" xml:space="preserve"> <data name="Total_errors_plus_unknowns" xml:space="preserve">
<value>Total errors+unknowns...</value> <value>[bold][italic][slateblue1]Total errors+unknowns[/][/][/]</value>
</data> </data>
<data name="Try_to_read_first_track_pregap" xml:space="preserve"> <data name="Try_to_read_first_track_pregap" xml:space="preserve">
<value>Try to read first track pregap. Only applicable to CD/DDCD/GD.</value> <value>Try to read first track pregap. Only applicable to CD/DDCD/GD.</value>

View File

@@ -164,7 +164,7 @@ sealed class VerifyCommand : Command<VerifyCommand.Settings>
correctImage = discCheckStatus; correctImage = discCheckStatus;
AaruLogging.Verbose(UI.Checking_disc_image_checksums_took_0, AaruLogging.Verbose(UI.Checking_disc_image_checksums_took_0,
chkWatch.Elapsed.Humanize(minUnit: TimeUnit.Second)); chkWatch.Elapsed.Humanize(minUnit: TimeUnit.Second));
} }
if(!settings.VerifySectors) if(!settings.VerifySectors)
@@ -191,16 +191,14 @@ sealed class VerifyCommand : Command<VerifyCommand.Settings>
if(spiralParameters is not null) if(spiralParameters is not null)
{ {
mediaGraph = new Spiral((int)settings.Dimensions, mediaGraph = new Spiral(settings.Dimensions,
(int)settings.Dimensions, settings.Dimensions,
spiralParameters, spiralParameters,
opticalMediaImage.Info.Sectors); opticalMediaImage.Info.Sectors);
} }
else if(settings.CreateGraph) else if(settings.CreateGraph)
{ {
mediaGraph = new BlockMap((int)settings.Dimensions, mediaGraph = new BlockMap(settings.Dimensions, settings.Dimensions, opticalMediaImage.Info.Sectors);
(int)settings.Dimensions,
opticalMediaImage.Info.Sectors);
} }
List<Track> inputTracks = opticalMediaImage.Tracks; List<Track> inputTracks = opticalMediaImage.Tracks;
@@ -390,8 +388,7 @@ sealed class VerifyCommand : Command<VerifyCommand.Settings>
if(unknownLbas.Count == 0 && failingLbas.Count == 0) AaruLogging.WriteLine(UI.All_sector_checksums_are_correct); if(unknownLbas.Count == 0 && failingLbas.Count == 0) AaruLogging.WriteLine(UI.All_sector_checksums_are_correct);
AaruLogging.Verbose(UI.Checking_sector_checksums_took_0, AaruLogging.Verbose(UI.Checking_sector_checksums_took_0, stopwatch.Elapsed.Humanize(minUnit: TimeUnit.Second));
stopwatch.Elapsed.Humanize(minUnit: TimeUnit.Second));
if(settings.Verbose) if(settings.Verbose)
{ {
@@ -400,25 +397,37 @@ sealed class VerifyCommand : Command<VerifyCommand.Settings>
if(failingLbas.Count == (int)inputFormat.Info.Sectors) if(failingLbas.Count == (int)inputFormat.Info.Sectors)
AaruLogging.Verbose($"\t[red]{UI.all_sectors}[/]"); AaruLogging.Verbose($"\t[red]{UI.all_sectors}[/]");
else else
{ foreach(ulong t in failingLbas)
foreach(ulong t in failingLbas) AaruLogging.Verbose("\t{0}", t); AaruLogging.Verbose("\t{0}", t);
}
AaruLogging.WriteLine($"[yellow3_1]{UI.LBAs_without_checksum}[/]"); AaruLogging.WriteLine($"[yellow3_1]{UI.LBAs_without_checksum}[/]");
if(unknownLbas.Count == (int)inputFormat.Info.Sectors) if(unknownLbas.Count == (int)inputFormat.Info.Sectors)
AaruLogging.Verbose($"\t[yellow3_1]{UI.all_sectors}[/]"); AaruLogging.Verbose($"\t[yellow3_1]{UI.all_sectors}[/]");
else else
{ foreach(ulong t in unknownLbas)
foreach(ulong t in unknownLbas) AaruLogging.Verbose("\t{0}", t); AaruLogging.Verbose("\t{0}", t);
}
} }
// TODO: Convert to table var table = new Table();
AaruLogging.WriteLine($"[italic]{UI.Total_sectors}[/] {inputFormat.Info.Sectors}"); table.HideHeaders();
AaruLogging.WriteLine($"[italic]{UI.Total_errors}[/] {failingLbas.Count}"); table.AddColumn(new TableColumn("").RightAligned());
AaruLogging.WriteLine($"[italic]{UI.Total_unknowns}[/] {unknownLbas.Count}"); table.AddColumn(new TableColumn("").RightAligned());
AaruLogging.WriteLine($"[italic]{UI.Total_errors_plus_unknowns}[/] {failingLbas.Count + unknownLbas.Count}"); table.Border(TableBorder.Rounded);
table.BorderColor(Color.Yellow);
table.AddRow(UI.Total_sectors, $"[lime]{inputFormat.Info.Sectors}[/]");
table.AddRow(UI.Total_errors, $"[lime]{failingLbas.Count}[/]");
table.AddRow(UI.Total_unknowns, $"[lime]{unknownLbas.Count}[/]");
table.AddRow(UI.Total_errors_plus_unknowns, $"[lime]{failingLbas.Count + unknownLbas.Count}[/]");
AnsiConsole.Write(table);
AaruLogging.Information($"{UI.Total_sectors}: {inputFormat.Info.Sectors}");
AaruLogging.Information($"{UI.Total_errors}: {failingLbas.Count}");
AaruLogging.Information($"{UI.Total_unknowns}: {unknownLbas.Count}");
AaruLogging.Information($"{UI.Total_errors_plus_unknowns}: {failingLbas.Count + unknownLbas.Count}");
mediaGraph?.WriteTo($"{Path.GetFileNameWithoutExtension(inputFilter.Filename)}.verify.png"); mediaGraph?.WriteTo($"{Path.GetFileNameWithoutExtension(inputFilter.Filename)}.verify.png");
@@ -459,7 +468,7 @@ sealed class VerifyCommand : Command<VerifyCommand.Settings>
[Description("Dimensions, as a square, in pixels, for the graph of verified media.")] [Description("Dimensions, as a square, in pixels, for the graph of verified media.")]
[DefaultValue(1080)] [DefaultValue(1080)]
[CommandOption("-d|--dimensions")] [CommandOption("-d|--dimensions")]
public uint Dimensions { get; init; } public int Dimensions { get; init; }
[Description("Disc image path")] [Description("Disc image path")]
[CommandArgument(0, "<image-path>")] [CommandArgument(0, "<image-path>")]
public string ImagePath { get; init; } public string ImagePath { get; init; }