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);
}
}
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">
<value>Verificar sólo pistas de datos.</value>
</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>

View File

@@ -3419,4 +3419,10 @@ Do you want to continue?</value>
<data name="Verify_only_data_help" xml:space="preserve">
<value>Verify only data tracks.</value>
</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>

View File

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