From 5c6c362b2b73bc3d9900426be3e7d8980f87505d Mon Sep 17 00:00:00 2001 From: Natalia Portillo Date: Wed, 20 Aug 2025 00:24:20 +0100 Subject: [PATCH] Pass cart size thru humanizer. --- .../Devices/Dumping/LinearMemory/Retrode.cs | 28 ++----------------- Aaru.Localization/Core.Designer.cs | 6 ++++ Aaru.Localization/Core.es.resx | 15 ++-------- Aaru.Localization/Core.resx | 3 ++ 4 files changed, 14 insertions(+), 38 deletions(-) diff --git a/Aaru.Core/Devices/Dumping/LinearMemory/Retrode.cs b/Aaru.Core/Devices/Dumping/LinearMemory/Retrode.cs index c93188b65..0866620f2 100644 --- a/Aaru.Core/Devices/Dumping/LinearMemory/Retrode.cs +++ b/Aaru.Core/Devices/Dumping/LinearMemory/Retrode.cs @@ -232,32 +232,8 @@ public partial class Dump uint romSectors = romSize / 512; uint romRemaining = romSize % 512; - // TODO: Humanizer - switch(romSize) - { - case > 1073741824: - UpdateStatus?.Invoke(string.Format(Localization.Core.Cartridge_has_0_bytes_1_GiB, - romSize, - romSize / 1073741824d)); - - break; - case > 1048576: - UpdateStatus?.Invoke(string.Format(Localization.Core.Cartridge_has_0_bytes_1_MiB, - romSize, - romSize / 1048576d)); - - break; - case > 1024: - UpdateStatus?.Invoke(string.Format(Localization.Core.Cartridge_has_0_bytes_1_KiB, - romSize, - romSize / 1024d)); - - break; - default: - UpdateStatus?.Invoke(string.Format(Localization.Core.Cartridge_has_0_bytes, romSize)); - - break; - } + UpdateStatus?.Invoke(string.Format(Localization.Core.Cartridge_has_0_bytes_1, romSize, + ByteSize.FromBytes(romSize).ToString("0.000"))); UpdateStatus?.Invoke(string.Format(Localization.Core.Media_identified_as_0, mediaType)); diff --git a/Aaru.Localization/Core.Designer.cs b/Aaru.Localization/Core.Designer.cs index 821e2340e..5cf08ea30 100644 --- a/Aaru.Localization/Core.Designer.cs +++ b/Aaru.Localization/Core.Designer.cs @@ -6874,5 +6874,11 @@ namespace Aaru.Localization { return ResourceManager.GetString("Running_in_0_architecture", resourceCulture); } } + + public static string Cartridge_has_0_bytes_1 { + get { + return ResourceManager.GetString("Cartridge_has_0_bytes_1", resourceCulture); + } + } } } diff --git a/Aaru.Localization/Core.es.resx b/Aaru.Localization/Core.es.resx index c4100eb5e..ddb2bba19 100644 --- a/Aaru.Localization/Core.es.resx +++ b/Aaru.Localization/Core.es.resx @@ -301,18 +301,6 @@ Datos específicos de la tarjeta: 0x{0:X4} - - [slateblue1]El cartucho tiene [lime]{0}[/] bytes[/] - - - [slateblue1]El cartucho tiene [lime]{0}[/] bytes ([lime]{1:F3}[/] GiB)[/] - - - [slateblue1]El cartucho tiene [lime]{0}[/] bytes ([lime]{1:F3}[/] KiB)[/] - - - [slateblue1]El cartucho tiene [lime]{0}[/] bytes ([lime]{1:F3}[/] MiB)[/] - [slateblue1]Velocidad de lectura de CD limitada a [teal]{0}x[/][/] @@ -3484,4 +3472,7 @@ No tiene sentido hacerlo y supondría demasiado esfuerzo para la cinta. Error {0} identificando el sistema de ficheros. Por favor abra un reporte con la siguiente línea en Github. + + [slateblue1]El cartucho tiene [lime]{0} bytes[/] ([lime]{1}[/]).[/] + \ No newline at end of file diff --git a/Aaru.Localization/Core.resx b/Aaru.Localization/Core.resx index 18e915e3f..4eb46eb07 100644 --- a/Aaru.Localization/Core.resx +++ b/Aaru.Localization/Core.resx @@ -3508,4 +3508,7 @@ It has no sense to do it, and it will put too much strain on the tape. Running in {0} architecture + + [slateblue1]Cartridge has [lime]{0} bytes[/] ([lime]{1}[/]).[/] + \ No newline at end of file