Colorize remote command.

This commit is contained in:
2025-08-21 06:45:06 +01:00
parent 13ea0d299b
commit da400a36ad
6 changed files with 85 additions and 15 deletions

View File

@@ -421,8 +421,8 @@
<value>URI remota inválida.</value>
</data>
<data name="Error_connecting_to_host" xml:space="preserve">
<value>Error al conectar al servidor.</value>
</data>
<value>[red]Error al conectar al servidor.[/]</value>
</data>
<data name="Invalid_remote_protocol" xml:space="preserve">
<value>Protocolo remoto inválido.</value>
</data>
@@ -430,8 +430,8 @@
<value>Servidor no encontrado</value>
</data>
<data name="Connected_to_0" xml:space="preserve">
<value>Conectado a {0}</value>
</data>
<value>[slateblue1]Conectado a [teal]{0}[/][/]</value>
</data>
<data name="Could_not_read_from_the_network" xml:space="preserve">
<value>No se pudo leer desde la red...</value>
</data>

View File

@@ -428,8 +428,8 @@
<value>Invalid remote URI.</value>
</data>
<data name="Error_connecting_to_host" xml:space="preserve">
<value>Error connecting to host.</value>
</data>
<value>[red]Error connecting to host.[/]</value>
</data>
<data name="Invalid_remote_protocol" xml:space="preserve">
<value>Invalid remote protocol.</value>
</data>
@@ -437,8 +437,8 @@
<value>Host not found</value>
</data>
<data name="Connected_to_0" xml:space="preserve">
<value>Connected to {0}</value>
</data>
<value>[slateblue1]Connected to [teal]{0}[/][/]</value>
</data>
<data name="Could_not_read_from_the_network" xml:space="preserve">
<value>Could not read from the network...</value>
</data>

View File

@@ -6117,5 +6117,35 @@ namespace Aaru.Localization {
return ResourceManager.GetString("Title_Date_modified", resourceCulture);
}
}
public static string Title_Server_information {
get {
return ResourceManager.GetString("Title_Server_information", resourceCulture);
}
}
public static string Server_application {
get {
return ResourceManager.GetString("Server_application", resourceCulture);
}
}
public static string Server_operating_system {
get {
return ResourceManager.GetString("Server_operating_system", resourceCulture);
}
}
public static string Server_maximum_protocol {
get {
return ResourceManager.GetString("Server_maximum_protocol", resourceCulture);
}
}
public static string Error_connecting_to_host {
get {
return ResourceManager.GetString("Error_connecting_to_host", resourceCulture);
}
}
}
}

View File

@@ -3056,4 +3056,19 @@ Probadores:
<data name="Title_Date_modified" xml:space="preserve">
<value>[bold][dodgerblue1]Fecha modificación[/][/]</value>
</data>
<data name="Title_Server_information" xml:space="preserve">
<value>[bold][blue]Información del servidor[/][/]</value>
</data>
<data name="Server_application" xml:space="preserve">
<value>[green]Aplicación del servidor[/]</value>
</data>
<data name="Server_operating_system" xml:space="preserve">
<value>[orange3]Sistema operativo del servidor[/]</value>
</data>
<data name="Server_maximum_protocol" xml:space="preserve">
<value>[slateblue1]Protocolo máximo del servidor[/]</value>
</data>
<data name="Error_connecting_to_host" xml:space="preserve">
<value>[red]Error al conectar al servidor.[/]</value>
</data>
</root>

View File

@@ -3135,4 +3135,19 @@ Do you want to continue?</value>
<data name="Title_Date_modified" xml:space="preserve">
<value>[bold][dodgerblue1]Date modified[/][/]</value>
</data>
<data name="Title_Server_information" xml:space="preserve">
<value>[bold][blue]Server information[/][/]</value>
</data>
<data name="Server_application" xml:space="preserve">
<value>[green]Server application[/]</value>
</data>
<data name="Server_operating_system" xml:space="preserve">
<value>[orange3]Server operating system[/]</value>
</data>
<data name="Server_maximum_protocol" xml:space="preserve">
<value>[slateblue1]Server maximum protocol[/]</value>
</data>
<data name="Error_connecting_to_host" xml:space="preserve">
<value>[red]Error connecting to host.[/]</value>
</data>
</root>

View File

@@ -36,6 +36,7 @@ using System;
using System.ComponentModel;
using Aaru.CommonTypes.Enums;
using Aaru.Core;
using Aaru.Localization;
using Aaru.Logging;
using Sentry;
using Spectre.Console;
@@ -70,20 +71,29 @@ sealed class RemoteCommand : Command<RemoteCommand.Settings>
Table table = new()
{
Title = new TableTitle("Server information")
Title = new TableTitle(UI.Title_Server_information)
};
AaruLogging.Information(UI.Title_Server_information);
table.AddColumn("");
table.AddColumn("");
table.Columns[0].RightAligned();
table.Border(TableBorder.Rounded);
table.BorderColor(Color.Yellow);
table.HideHeaders();
table.AddRow("Server application", $"{remote.ServerApplication} {remote.ServerVersion}");
table.AddRow(UI.Server_application, $"[green]{remote.ServerApplication}[/] [red]{remote.ServerVersion}[/]");
table.AddRow("Server operating system",
$"{remote.ServerOperatingSystem} {remote.ServerOperatingSystemVersion} ({
remote.ServerArchitecture})");
table.AddRow(UI.Server_operating_system,
$"[fuchsia]{remote.ServerOperatingSystem}[/] [lime]{remote.ServerOperatingSystemVersion}[/] [slateblue1]([gold3]{
remote.ServerArchitecture}[/])[/]");
table.AddRow("Server maximum protocol", $"{remote.ServerProtocolVersion}");
table.AddRow(UI.Server_maximum_protocol, $"[teal]{remote.ServerProtocolVersion}[/]");
AaruLogging.Information($"{UI.Server_application}: {remote.ServerApplication} {remote.ServerVersion}");
AaruLogging.Information($"{UI.Server_operating_system}: {remote.ServerOperatingSystem} {remote.ServerOperatingSystemVersion} ({remote.ServerArchitecture})");
AaruLogging.Information($"{UI.Server_maximum_protocol}: {remote.ServerProtocolVersion}");
AnsiConsole.Write(table);
remote.Disconnect();
@@ -91,7 +101,7 @@ sealed class RemoteCommand : Command<RemoteCommand.Settings>
catch(Exception ex)
{
SentrySdk.CaptureException(ex);
AaruLogging.Error("Error connecting to host.");
AaruLogging.Error(UI.Error_connecting_to_host);
return (int)ErrorNumber.CannotOpenDevice;
}