When comparing two images be specific about their contents.

This commit is contained in:
2025-12-09 21:06:35 +00:00
parent 1a27321f16
commit f1abe1af0a
4 changed files with 47 additions and 9 deletions

View File

@@ -6687,5 +6687,17 @@ namespace Aaru.Localization {
return ResourceManager.GetString("Verify_only_data_help", resourceCulture); return ResourceManager.GetString("Verify_only_data_help", resourceCulture);
} }
} }
public static string Images_have_different_contents {
get {
return ResourceManager.GetString("Images_have_different_contents", resourceCulture);
}
}
public static string Images_have_identical_contents {
get {
return ResourceManager.GetString("Images_have_identical_contents", resourceCulture);
}
}
} }
} }

View File

@@ -3344,4 +3344,10 @@ Probadores:
<data name="Verify_only_data_help" xml:space="preserve"> <data name="Verify_only_data_help" xml:space="preserve">
<value>Verificar sólo pistas de datos.</value> <value>Verificar sólo pistas de datos.</value>
</data> </data>
<data name="Images_have_different_contents" xml:space="preserve">
<value>[red]Las imágenes tienen diferente contenido.[/]</value>
</data>
<data name="Images_have_identical_contents" xml:space="preserve">
<value>[green]Las imágenes tienen idéntico contenido.[/]</value>
</data>
</root> </root>

View File

@@ -3419,4 +3419,10 @@ Do you want to continue?</value>
<data name="Verify_only_data_help" xml:space="preserve"> <data name="Verify_only_data_help" xml:space="preserve">
<value>Verify only data tracks.</value> <value>Verify only data tracks.</value>
</data> </data>
<data name="Images_have_different_contents" xml:space="preserve">
<value>[red]Images have different contents.[/]</value>
</data>
<data name="Images_have_identical_contents" xml:space="preserve">
<value>[green]Images have identical contents.[/]</value>
</data>
</root> </root>

View File

@@ -420,6 +420,8 @@ sealed class CompareCommand : Command<CompareCommand.Settings>
if(input1MediaImage is not null && input2MediaImage is null) imagesDiffer = true; if(input1MediaImage is not null && input2MediaImage is null) imagesDiffer = true;
bool differentContents = false;
if(input1MediaImage is not null && input2MediaImage is not null) if(input1MediaImage is not null && input2MediaImage is not null)
{ {
AnsiConsole.Progress() AnsiConsole.Progress()
@@ -462,13 +464,22 @@ sealed class CompareCommand : Command<CompareCommand.Settings>
image2Sector); image2Sector);
if(different) if(different)
imagesDiffer = true; {
imagesDiffer = true;
differentContents = true;
AaruLogging.Debug(MODULE_NAME, "Sector {0} is different", sector);
}
else if(!sameSize)
{
imagesDiffer = true;
differentContents = true;
// sb.AppendFormat("Sector {0} is different", sector).AppendLine(); AaruLogging.Debug(MODULE_NAME,
else if(!sameSize) imagesDiffer = true; "Sector {0} has different sizes ({1} bytes in image 1, {2} in image 2) but are otherwise identical",
/* sb. sector,
AppendFormat("Sector {0} has different sizes ({1} bytes in image 1, {2} in image 2) but are otherwise identical", image1Sector.LongLength,
sector, image1Sector.LongLength, image2Sector.LongLength).AppendLine();*/ image2Sector.LongLength);
}
} }
catch(Exception ex) catch(Exception ex)
{ {
@@ -513,9 +524,10 @@ sealed class CompareCommand : Command<CompareCommand.Settings>
ArrayHelpers.CompareBytes(out bool different, out bool sameSize, data1, data2); ArrayHelpers.CompareBytes(out bool different, out bool sameSize, data1, data2);
if(different) if(!different && sameSize) return;
imagesDiffer = true;
else if(!sameSize) imagesDiffer = true; imagesDiffer = true;
differentContents = true;
}); });
} }
@@ -523,6 +535,8 @@ sealed class CompareCommand : Command<CompareCommand.Settings>
sb.AppendLine(imagesDiffer ? UI.Images_differ : UI.Images_do_not_differ); sb.AppendLine(imagesDiffer ? UI.Images_differ : UI.Images_do_not_differ);
sb.AppendLine(differentContents ? UI.Images_have_different_contents : UI.Images_have_identical_contents);
if(settings.Verbose) if(settings.Verbose)
AnsiConsole.Write(table); AnsiConsole.Write(table);
else else