Move markup to resources in formats command.

This commit is contained in:
2025-08-18 14:53:51 +01:00
parent b004936192
commit d346b32905
2 changed files with 55 additions and 65 deletions

View File

@@ -1629,31 +1629,31 @@ pool with no way of using them to identify you.</value>
<value>Do you want to gather statistics about media image verifications?</value> <value>Do you want to gather statistics about media image verifications?</value>
</data> </data>
<data name="Supported_filters_0" xml:space="preserve"> <data name="Supported_filters_0" xml:space="preserve">
<value>Supported filters ({0}):</value> <value>[bold][blue]Supported filters ([teal]{0}[/]):[/][/]</value>
<comment>{0} is the number of supported filters</comment> <comment>{0} is the number of supported filters</comment>
</data> </data>
<data name="Read_only_media_image_formats_0" xml:space="preserve"> <data name="Read_only_media_image_formats_0" xml:space="preserve">
<value>Read-only media image formats ({0}):</value> <value>[bold][blue]Read-only media image formats ([teal]{0}[/]):[/][/]</value>
<comment>{0} is the number of read only media image formats</comment> <comment>{0} is the number of read only media image formats</comment>
</data> </data>
<data name="Read_write_media_image_formats_0" xml:space="preserve"> <data name="Read_write_media_image_formats_0" xml:space="preserve">
<value> Read/write media image formats ({0}):</value> <value>[bold][blue]Read/write media image formats ([teal]{0}[/]):[/][/]</value>
<comment>{0} is the number of read/write media image formats</comment> <comment>{0} is the number of read/write media image formats</comment>
</data> </data>
<data name="Supported_filesystems_for_identification_and_information_only_0" xml:space="preserve"> <data name="Supported_filesystems_for_identification_and_information_only_0" xml:space="preserve">
<value>Supported filesystems for identification and information only ({0}):</value> <value>[bold][blue]Supported filesystems for identification and information only ([teal]{0}[/]):[/][/]</value>
<comment>{0} is the number of supported filesystems only for identification</comment> <comment>{0} is the number of supported filesystems only for identification</comment>
</data> </data>
<data name="Supported_filesystems_that_can_read_their_contents_0" xml:space="preserve"> <data name="Supported_filesystems_that_can_read_their_contents_0" xml:space="preserve">
<value>Supported filesystems that can read their contents ({0}):</value> <value>[bold][blue]Supported filesystems that can read their contents ([teal]{0}[/]):[/][/]</value>
<comment>{0} is the number of supported filesystem that can read their contents</comment> <comment>{0} is the number of supported filesystem that can read their contents</comment>
</data> </data>
<data name="Supported_partitioning_schemes_0" xml:space="preserve"> <data name="Supported_partitioning_schemes_0" xml:space="preserve">
<value> Supported partitioning schemes ({0}):</value> <value>[bold][blue]Supported partitioning schemes ([teal]{0}[/]):[/][/]</value>
<comment>{0} is the number of supported partitioning schemes</comment> <comment>{0} is the number of supported partitioning schemes</comment>
</data> </data>
<data name="Supported_archive_formats_0" xml:space="preserve"> <data name="Supported_archive_formats_0" xml:space="preserve">
<value>Supported archive formats ({0}):</value> <value>[bold][blue]Supported archive formats ([teal]{0}[/]):[/][/]</value>
<comment>{0} is the number of supported archive formats</comment> <comment>{0} is the number of supported archive formats</comment>
</data> </data>
<data name="Namespaces_for_0" xml:space="preserve"> <data name="Namespaces_for_0" xml:space="preserve">
@@ -3100,7 +3100,7 @@ Do you want to continue?</value>
<value>List the contents of an archive file.</value> <value>List the contents of an archive file.</value>
</data> </data>
<data name="Title_Archive_Format" xml:space="preserve"> <data name="Title_Archive_Format" xml:space="preserve">
<value>Archive format</value> <value>[bold][red3]Archive format[/][/]</value>
</data> </data>
<data name="List_encodings_command" xml:space="preserve"> <data name="List_encodings_command" xml:space="preserve">
<value>List encodings</value> <value>List encodings</value>

View File

@@ -37,7 +37,6 @@ using Aaru.CommonTypes.Interfaces;
using Aaru.Core; using Aaru.Core;
using Aaru.Localization; using Aaru.Localization;
using Aaru.Logging; using Aaru.Logging;
using Serilog;
using Spectre.Console; using Spectre.Console;
using Spectre.Console.Cli; using Spectre.Console.Cli;
@@ -61,8 +60,7 @@ sealed class FormatsCommand : Command<FormatsCommand.Settings>
Table table = new() Table table = new()
{ {
Title = new TableTitle(string.Format($"[blue]{UI.Supported_filters_0}[/]", Title = new TableTitle(string.Format(UI.Supported_filters_0, PluginRegister.Singleton.Filters.Count))
$"[green]{PluginRegister.Singleton.Filters.Count}[/]"))
}; };
table.Border(TableBorder.Rounded); table.Border(TableBorder.Rounded);
@@ -70,23 +68,22 @@ sealed class FormatsCommand : Command<FormatsCommand.Settings>
AaruLogging.Information(UI.Supported_filters_0, PluginRegister.Singleton.Filters.Count); AaruLogging.Information(UI.Supported_filters_0, PluginRegister.Singleton.Filters.Count);
if(settings.Verbose) if(settings.Verbose) table.AddColumn(new TableColumn(new Markup(UI.Title_GUID).Centered()));
table.AddColumn(new TableColumn(new Markup($"[bold][red]{UI.Title_GUID}[/][/]").Centered()));
table.AddColumn(new TableColumn(new Markup($"[bold][slateblue1]{UI.Title_Filter}[/][/]").Centered())); table.AddColumn(new TableColumn(new Markup(UI.Title_Filter).Centered()));
foreach(IFilter filter in PluginRegister.Singleton.Filters.Values) foreach(IFilter filter in PluginRegister.Singleton.Filters.Values)
{ {
if(settings.Verbose) if(settings.Verbose)
{ {
table.AddRow($"[italic][red]{filter.Id.ToString()}[/][/]", table.AddRow($"[italic][slateblue1]{filter.Id.ToString()}[/][/]",
$"[italic][slateblue1]{Markup.Escape(filter.Name)}[/][/]"); $"[italic][purple]{Markup.Escape(filter.Name)}[/][/]");
AaruLogging.Information("({Id}) {Name}", filter.Id, filter.Name); AaruLogging.Information("({Id}) {Name}", filter.Id, filter.Name);
} }
else else
{ {
table.AddRow($"[italic][slateblue1]{Markup.Escape(filter.Name)}[/][/]"); table.AddRow($"[italic][purple]{Markup.Escape(filter.Name)}[/][/]");
AaruLogging.Information("{Name}", filter.Name); AaruLogging.Information("{Name}", filter.Name);
} }
} }
@@ -97,29 +94,27 @@ sealed class FormatsCommand : Command<FormatsCommand.Settings>
table = new Table table = new Table
{ {
Title = new TableTitle(string.Format($"[blue]{UI.Read_only_media_image_formats_0}[/]", Title = new TableTitle(string.Format(UI.Read_only_media_image_formats_0,
$"[green]{plugins.MediaImages.Count(t => !plugins.WritableImages plugins.MediaImages.Count(t => !plugins.WritableImages
.ContainsKey(t.Key))}[/]")) .ContainsKey(t.Key))))
}; };
table.Border(TableBorder.Rounded); table.Border(TableBorder.Rounded);
table.BorderColor(Color.Yellow); table.BorderColor(Color.Yellow);
AaruLogging.Information(UI.Read_only_media_image_formats_0, AaruLogging.Information(UI.Read_only_media_image_formats_0,
plugins.MediaImages.Count(t => !plugins.WritableImages.ContainsKey(t.Key))); plugins.MediaImages.Count(t => !plugins.WritableImages.ContainsKey(t.Key)));
if(settings.Verbose) if(settings.Verbose) table.AddColumn(new TableColumn(new Markup(UI.Title_GUID).Centered()));
table.AddColumn(new TableColumn(new Markup($"[bold][red]{UI.Title_GUID}[/][/]").Centered()));
table.AddColumn(new TableColumn(new Markup($"[bold][slateblue1]{UI.Title_Media_image_format}[/][/]") table.AddColumn(new TableColumn(new Markup(UI.Title_Media_image_format).Centered()));
.Centered()));
foreach(IMediaImage imagePlugin in foreach(IMediaImage imagePlugin in
plugins.MediaImages.Values.Where(t => !plugins.WritableImages.ContainsKey(t.Name))) plugins.MediaImages.Values.Where(t => !plugins.WritableImages.ContainsKey(t.Name)))
{ {
if(settings.Verbose) if(settings.Verbose)
{ {
table.AddRow($"[italic][red]{imagePlugin.Id.ToString()}[/][/]", table.AddRow($"[italic][slateblue1]{imagePlugin.Id.ToString()}[/][/]",
$"[italic][slateblue1]{Markup.Escape(imagePlugin.Name)}[/][/]"); $"[italic][slateblue1]{Markup.Escape(imagePlugin.Name)}[/][/]");
AaruLogging.Information("({Id}) {Name}", imagePlugin.Id, imagePlugin.Name); AaruLogging.Information("({Id}) {Name}", imagePlugin.Id, imagePlugin.Name);
@@ -137,8 +132,7 @@ sealed class FormatsCommand : Command<FormatsCommand.Settings>
table = new Table table = new Table
{ {
Title = new TableTitle(string.Format($"[blue]{UI.Supported_filters_0}[/]", Title = new TableTitle(string.Format(UI.Supported_filters_0, plugins.WritableImages.Count))
$"[green]{plugins.WritableImages.Count}[/]"))
}; };
table.Border(TableBorder.Rounded); table.Border(TableBorder.Rounded);
@@ -146,11 +140,9 @@ sealed class FormatsCommand : Command<FormatsCommand.Settings>
AaruLogging.Information(UI.Read_write_media_image_formats_0, plugins.WritableImages.Count); AaruLogging.Information(UI.Read_write_media_image_formats_0, plugins.WritableImages.Count);
if(settings.Verbose) if(settings.Verbose) table.AddColumn(new TableColumn(new Markup(UI.Title_GUID).Centered()));
table.AddColumn(new TableColumn(new Markup($"[bold][red]{UI.Title_GUID}[/][/]").Centered()));
table.AddColumn(new TableColumn(new Markup($"[bold][slateblue1]{UI.Title_Media_image_format}[/][/]") table.AddColumn(new TableColumn(new Markup(UI.Title_Media_image_format).Centered()));
.Centered()));
foreach(IWritableImage plugin in plugins.WritableImages.Values) foreach(IWritableImage plugin in plugins.WritableImages.Values)
{ {
@@ -158,7 +150,7 @@ sealed class FormatsCommand : Command<FormatsCommand.Settings>
if(settings.Verbose) if(settings.Verbose)
{ {
table.AddRow($"[italic][red]{plugin.Id.ToString()}[/][/]", table.AddRow($"[italic][slateblue1]{plugin.Id.ToString()}[/][/]",
$"[italic][slateblue1]{Markup.Escape(plugin.Name)}[/][/]"); $"[italic][slateblue1]{Markup.Escape(plugin.Name)}[/][/]");
AaruLogging.Information("({Id}) {Name}", plugin.Id, plugin.Name); AaruLogging.Information("({Id}) {Name}", plugin.Id, plugin.Name);
@@ -181,32 +173,32 @@ sealed class FormatsCommand : Command<FormatsCommand.Settings>
table = new Table table = new Table
{ {
Title = new TableTitle(string.Format($"[blue]{UI.Supported_filters_0}[/]", Title = new TableTitle(string.Format(UI.Supported_filesystems_for_identification_and_information_only_0,
$"[green]{idOnlyFilesystems.Count}[/]")) idOnlyFilesystems.Count))
}; };
table.Border(TableBorder.Rounded); table.Border(TableBorder.Rounded);
table.BorderColor(Color.Yellow); table.BorderColor(Color.Yellow);
AaruLogging.Information(UI.Supported_filesystems_for_identification_and_information_only_0, idOnlyFilesystems.Count); AaruLogging.Information(UI.Supported_filesystems_for_identification_and_information_only_0,
idOnlyFilesystems.Count);
if(settings.Verbose) if(settings.Verbose) table.AddColumn(new TableColumn(new Markup(UI.Title_GUID).Centered()));
table.AddColumn(new TableColumn(new Markup($"[bold][red]{UI.Title_GUID}[/][/]").Centered()));
table.AddColumn(new TableColumn(new Markup($"[bold][slateblue1]{UI.Title_Filesystem}[/][/]").Centered())); table.AddColumn(new TableColumn(new Markup(UI.Title_Filesystem).Centered()));
foreach(IFilesystem fs in idOnlyFilesystems) foreach(IFilesystem fs in idOnlyFilesystems)
{ {
if(settings.Verbose) if(settings.Verbose)
{ {
table.AddRow($"[italic][red]{fs.Id.ToString()}[/][/]", table.AddRow($"[italic][slateblue1]{fs.Id.ToString()}[/][/]",
$"[italic][slateblue1]{Markup.Escape(fs.Name)}[/][/]"); $"[italic][purple]{Markup.Escape(fs.Name)}[/][/]");
AaruLogging.Information("({Id}) {Name}", fs.Id, fs.Name); AaruLogging.Information("({Id}) {Name}", fs.Id, fs.Name);
} }
else else
{ {
table.AddRow($"[italic][slateblue1]{Markup.Escape(fs.Name)}[/][/]"); table.AddRow($"[italic][purple]{Markup.Escape(fs.Name)}[/][/]");
AaruLogging.Information("{Name}", fs.Name); AaruLogging.Information("{Name}", fs.Name);
} }
} }
@@ -217,19 +209,19 @@ sealed class FormatsCommand : Command<FormatsCommand.Settings>
table = new Table table = new Table
{ {
Title = new TableTitle(string.Format($"[blue]{UI.Supported_filesystems_that_can_read_their_contents_0}[/]", Title = new TableTitle(string.Format(UI.Supported_filesystems_that_can_read_their_contents_0,
$"[green]{plugins.ReadOnlyFilesystems.Count}[/]")) plugins.ReadOnlyFilesystems.Count))
}; };
table.Border(TableBorder.Rounded); table.Border(TableBorder.Rounded);
table.BorderColor(Color.Yellow); table.BorderColor(Color.Yellow);
AaruLogging.Information(UI.Supported_filesystems_that_can_read_their_contents_0, plugins.ReadOnlyFilesystems.Count); AaruLogging.Information(UI.Supported_filesystems_that_can_read_their_contents_0,
plugins.ReadOnlyFilesystems.Count);
if(settings.Verbose) if(settings.Verbose) table.AddColumn(new TableColumn(new Markup(UI.Title_GUID).Centered()));
table.AddColumn(new TableColumn(new Markup($"[bold][red]{UI.Title_GUID}[/][/]").Centered()));
table.AddColumn(new TableColumn(new Markup($"[bold][slateblue1]{UI.Title_Filesystem}[/][/]").Centered())); table.AddColumn(new TableColumn(new Markup(UI.Title_Filesystem).Centered()));
foreach(IReadOnlyFilesystem fs in plugins.ReadOnlyFilesystems.Values) foreach(IReadOnlyFilesystem fs in plugins.ReadOnlyFilesystems.Values)
{ {
@@ -237,14 +229,14 @@ sealed class FormatsCommand : Command<FormatsCommand.Settings>
if(settings.Verbose) if(settings.Verbose)
{ {
table.AddRow($"[italic][red]{fs.Id.ToString()}[/][/]", table.AddRow($"[italic][slateblue1]{fs.Id.ToString()}[/][/]",
$"[italic][slateblue1]{Markup.Escape(fs.Name)}[/][/]"); $"[italic][purple]{Markup.Escape(fs.Name)}[/][/]");
AaruLogging.Information("({Id}) {Name}", fs.Id, fs.Name); AaruLogging.Information("({Id}) {Name}", fs.Id, fs.Name);
} }
else else
{ {
table.AddRow($"[italic][slateblue1]{Markup.Escape(fs.Name)}[/][/]"); table.AddRow($"[italic][purple]{Markup.Escape(fs.Name)}[/][/]");
AaruLogging.Information("{Name}", fs.Name); AaruLogging.Information("{Name}", fs.Name);
} }
} }
@@ -255,8 +247,8 @@ sealed class FormatsCommand : Command<FormatsCommand.Settings>
table = new Table table = new Table
{ {
Title = new TableTitle(string.Format($"[blue]{UI.Supported_partitioning_schemes_0}[/]", Title = new TableTitle(string.Format(UI.Supported_partitioning_schemes_0,
$"[green]{PluginRegister.Singleton.Partitions.Count}[/]")) PluginRegister.Singleton.Partitions.Count))
}; };
table.Border(TableBorder.Rounded); table.Border(TableBorder.Rounded);
@@ -264,10 +256,9 @@ sealed class FormatsCommand : Command<FormatsCommand.Settings>
AaruLogging.Information(UI.Supported_partitioning_schemes_0, plugins.Partitions.Count); AaruLogging.Information(UI.Supported_partitioning_schemes_0, plugins.Partitions.Count);
if(settings.Verbose) if(settings.Verbose) table.AddColumn(new TableColumn(new Markup(UI.Title_GUID).Centered()));
table.AddColumn(new TableColumn(new Markup($"[bold][red]{UI.Title_GUID}[/][/]").Centered()));
table.AddColumn(new TableColumn(new Markup($"[bold][slateblue1]{UI.Title_Scheme}[/][/]").Centered())); table.AddColumn(new TableColumn(new Markup(UI.Title_Scheme).Centered()));
foreach(IPartition plugin in plugins.Partitions.Values) foreach(IPartition plugin in plugins.Partitions.Values)
{ {
@@ -275,14 +266,14 @@ sealed class FormatsCommand : Command<FormatsCommand.Settings>
if(settings.Verbose) if(settings.Verbose)
{ {
table.AddRow($"[italic][red]{plugin.Id.ToString()}[/][/]", table.AddRow($"[italic][slateblue1]{plugin.Id.ToString()}[/][/]",
$"[italic][slateblue1]{Markup.Escape(plugin.Name)}[/][/]"); $"[italic][purple]{Markup.Escape(plugin.Name)}[/][/]");
AaruLogging.Information("({Id}) {Name}", plugin.Id, plugin.Name); AaruLogging.Information("({Id}) {Name}", plugin.Id, plugin.Name);
} }
else else
{ {
table.AddRow($"[italic][slateblue1]{Markup.Escape(plugin.Name)}[/][/]"); table.AddRow($"[italic][purple]{Markup.Escape(plugin.Name)}[/][/]");
AaruLogging.Information("{Name}", plugin.Name); AaruLogging.Information("{Name}", plugin.Name);
} }
} }
@@ -302,10 +293,9 @@ sealed class FormatsCommand : Command<FormatsCommand.Settings>
AaruLogging.Information(UI.Supported_archive_formats_0, PluginRegister.Singleton.Archives.Count); AaruLogging.Information(UI.Supported_archive_formats_0, PluginRegister.Singleton.Archives.Count);
if(settings.Verbose) if(settings.Verbose) table.AddColumn(new TableColumn(new Markup(UI.Title_GUID).Centered()));
table.AddColumn(new TableColumn(new Markup($"[bold][red]{UI.Title_GUID}[/][/]").Centered()));
table.AddColumn(new TableColumn(new Markup($"[bold][slateblue1]{UI.Title_Archive_Format}[/][/]").Centered())); table.AddColumn(new TableColumn(new Markup(UI.Title_Archive_Format).Centered()));
foreach(IArchive archive in plugins.Archives.Values) foreach(IArchive archive in plugins.Archives.Values)
{ {
@@ -313,14 +303,14 @@ sealed class FormatsCommand : Command<FormatsCommand.Settings>
if(settings.Verbose) if(settings.Verbose)
{ {
table.AddRow($"[italic][red]{archive.Id.ToString()}[/][/]", table.AddRow($"[italic][slateblue1]{archive.Id.ToString()}[/][/]",
$"[italic][slateblue1]{Markup.Escape(archive.Name)}[/][/]"); $"[italic][red3]{Markup.Escape(archive.Name)}[/][/]");
AaruLogging.Information("({Id}) {Name}", archive.Id, archive.Name); AaruLogging.Information("({Id}) {Name}", archive.Id, archive.Name);
} }
else else
{ {
table.AddRow($"[italic][slateblue1]{Markup.Escape(archive.Name)}[/][/]"); table.AddRow($"[italic][red3]{Markup.Escape(archive.Name)}[/][/]");
AaruLogging.Information("{Name}", archive.Name); AaruLogging.Information("{Name}", archive.Name);
} }
} }