Colorize archive list.

This commit is contained in:
2025-08-20 05:24:49 +01:00
parent 9af2410ef7
commit 5277cf5398
3 changed files with 54 additions and 43 deletions

View File

@@ -2625,8 +2625,8 @@ Probadores:
<value>Etiqueta:</value>
</data>
<data name="Title_Time" xml:space="preserve">
<value>Hora</value>
</data>
<value>[bold][dodgerblue1]Hora[/][/]</value>
</data>
<data name="Title_Times_used" xml:space="preserve">
<value>[bold][teal]Veces usado[/][/]</value>
</data>
@@ -2979,16 +2979,16 @@ Probadores:
<value>Abriendo archivo...</value>
</data>
<data name="Title_Attributes_ABBREVIATED" xml:space="preserve">
<value>Atrib</value>
<value>[bold][gold3]Atrib[/][/]</value>
</data>
<data name="Title_Compressed" xml:space="preserve">
<value>Comprimido</value>
<value>[bold][teal]Comprimido[/][/]</value>
</data>
<data name="Title_Date" xml:space="preserve">
<value>Fecha</value>
<value>[bold][blue]Fecha[/][/]</value>
</data>
<data name="Title_Size" xml:space="preserve">
<value>Tamaño</value>
<value>[bold][lime]Tamaño[/][/]</value>
</data>
<data name="Unable_to_get_information_about_archive" xml:space="preserve">
<value>[red]No se pudo obtener información sobre el archivo...[/]</value>
@@ -2997,10 +2997,10 @@ Probadores:
<value>[red]No se pudo abrir el archivo[/]</value>
</data>
<data name="_0_files" xml:space="preserve">
<value>{0} ficheros</value>
<value>[slateblue1][italic][teal]{0}[/] ficheros[/][/]</value>
</data>
<data name="_0_files_1_folders" xml:space="preserve">
<value>{0} ficheros, {1} carpetas</value>
<value>[slateblue1][italic][teal]{0}[/] ficheros, [teal]{1}[/] carpetas[/][/]</value>
</data>
<data name="LogEntry_Type_Debug" xml:space="preserve">
<value>Depuración</value>

View File

@@ -1721,8 +1721,8 @@ Testers:
<value>Clear</value>
</data>
<data name="Title_Time" xml:space="preserve">
<value>Time</value>
</data>
<value>[bold][dodgerblue1]Time[/][/]</value>
</data>
<data name="Title_Module" xml:space="preserve">
<value>Module</value>
</data>
@@ -3057,26 +3057,26 @@ Do you want to continue?</value>
<value>[red]Error [orange3]{0}[/] reading extended attribute [green]{1}[/] for archive entry [teal]#{2}[/].[/]</value>
</data>
<data name="Title_Date" xml:space="preserve">
<value>Date</value>
<value>[bold][blue]Date[/][/]</value>
</data>
<data name="Title_Attributes_ABBREVIATED" xml:space="preserve">
<value>Attr</value>
<value>[bold][gold3]Attr[/][/]</value>
<comment>"Attributes" abbreviated to the smallest possible size, if allowed by language rules.</comment>
</data>
<data name="Title_Size" xml:space="preserve">
<value>Size</value>
<value>[bold][lime]Size[/][/]</value>
</data>
<data name="Title_Compressed" xml:space="preserve">
<value>Compressed</value>
<value>[bold][teal]Compressed[/][/]</value>
</data>
<data name="Error_0_getting_compressed_size_for_archive_entry_1" xml:space="preserve">
<value>Error {0} getting compressed size for archive entry #{1}.</value>
</data>
<data name="_0_files_1_folders" xml:space="preserve">
<value>{0} files, {1} folders</value>
<value>[slateblue1][italic][teal]{0}[/] files, [teal]{1}[/] folders[/][/]</value>
</data>
<data name="_0_files" xml:space="preserve">
<value>{0} files</value>
<value>[slateblue1][italic][teal]{0}[/] files[/][/]</value>
</data>
<data name="LogEntry_Type_Exception" xml:space="preserve">
<value>Exception</value>

View File

@@ -180,6 +180,8 @@ sealed class ArchiveListCommand : Command<ArchiveListCommand.Settings>
.Start(ctx =>
{
table.HideFooters();
table.Border(TableBorder.Rounded);
table.BorderColor(Color.Yellow);
table.AddColumn(new TableColumn(UI.Title_Date)
{
@@ -237,9 +239,7 @@ sealed class ArchiveListCommand : Command<ArchiveListCommand.Settings>
if(errno != ErrorNumber.NoError)
{
AaruLogging.Error(UI.Error_0_getting_filename_for_archive_entry_1,
errno,
i);
AaruLogging.Error(UI.Error_0_getting_filename_for_archive_entry_1, errno, i);
continue;
}
@@ -248,9 +248,7 @@ sealed class ArchiveListCommand : Command<ArchiveListCommand.Settings>
if(errno != ErrorNumber.NoError)
{
AaruLogging.Error(UI.Error_0_retrieving_stat_for_archive_entry_1,
errno,
i);
AaruLogging.Error(UI.Error_0_retrieving_stat_for_archive_entry_1, errno, i);
continue;
}
@@ -295,9 +293,9 @@ sealed class ArchiveListCommand : Command<ArchiveListCommand.Settings>
if(errno != ErrorNumber.NoError)
{
AaruLogging.Debug(MODULE_NAME,
UI.Error_0_getting_compressed_size_for_archive_entry_1,
errno,
i);
UI.Error_0_getting_compressed_size_for_archive_entry_1,
errno,
i);
continue;
}
@@ -307,29 +305,42 @@ sealed class ArchiveListCommand : Command<ArchiveListCommand.Settings>
if(errno != ErrorNumber.NoError)
{
AaruLogging.Debug(MODULE_NAME,
UI.Error_0_getting_uncompressed_size_for_archive_entry_1,
errno,
i);
UI.Error_0_getting_uncompressed_size_for_archive_entry_1,
errno,
i);
continue;
}
if(archive.ArchiveFeatures.HasFlag(ArchiveSupportedFeature.SupportsCompression))
{
table.AddRow(stat.CreationTime?.ToShortDateString() ?? "",
stat.CreationTime?.ToLongTimeString() ?? "",
new string(attr),
uncompressedSize.ToString(),
compressedSize.ToString(),
fileName);
table.AddRow($"[blue]{stat.CreationTime?.ToShortDateString() ?? ""}[/]",
$"[dodgerblue1]{stat.CreationTime?.ToLongTimeString() ?? ""}[/]",
$"[gold3]{new string(attr)}[/]",
$"[lime]{uncompressedSize}[/]",
$"[teal]{compressedSize}[/]",
$"[green]{Markup.Escape(fileName)}[/]");
AaruLogging.Information($"Date: {stat.CreationTime?.ToShortDateString() ?? ""} " +
$"Time: ({stat.CreationTime?.ToLongTimeString() ?? ""}), " +
$"Attributes: {new string(attr)}, " +
$"Uncompressed Size: {uncompressedSize}, " +
$"Compressed Size: {compressedSize}, " +
$"File Name: {fileName}");
}
else
{
table.AddRow(stat.CreationTime?.ToShortDateString() ?? "",
stat.CreationTime?.ToLongTimeString() ?? "",
new string(attr),
uncompressedSize.ToString(),
fileName);
table.AddRow($"[blue]{stat.CreationTime?.ToShortDateString() ?? ""}[/]",
$"[dodgerblue1]{stat.CreationTime?.ToLongTimeString() ?? ""}[/]",
$"[gold3]{new string(attr)}[/]",
$"[lime]{uncompressedSize}[/]",
$"[green]{Markup.Escape(fileName)}[/]");
AaruLogging.Information($"Date: {stat.CreationTime?.ToShortDateString() ?? ""} " +
$"Time: ({stat.CreationTime?.ToLongTimeString() ?? ""}), " +
$"Attributes: {new string(attr)}, " +
$"Uncompressed Size: {uncompressedSize}, " +
$"File Name: {fileName}");
}
totalSize += compressedSize;
@@ -339,13 +350,13 @@ sealed class ArchiveListCommand : Command<ArchiveListCommand.Settings>
}
table.ShowFooters();
table.Columns[0].Footer(inputFilter.CreationTime.ToShortDateString());
table.Columns[1].Footer(inputFilter.CreationTime.ToLongTimeString());
table.Columns[3].Footer(totalUncompressed.ToString());
table.Columns[0].Footer($"[blue]{inputFilter.CreationTime.ToShortDateString()}[/]");
table.Columns[1].Footer($"[dodgerblue1]{inputFilter.CreationTime.ToLongTimeString()}[/]");
table.Columns[3].Footer($"[lime]{totalUncompressed}[/]");
if(archive.ArchiveFeatures.HasFlag(ArchiveSupportedFeature.SupportsCompression))
{
table.Columns[4].Footer(totalSize.ToString());
table.Columns[4].Footer($"[teal]{totalSize}[/]");
table.Columns[5]
.Footer(archive.ArchiveFeatures.HasFlag(ArchiveSupportedFeature