Use Humanizer for media size.

This commit is contained in:
2023-09-26 02:56:10 +01:00
parent 3d1b0581a5
commit d44b32af98
5 changed files with 10 additions and 8 deletions

View File

@@ -1,8 +1,8 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Aaru" type="DotNetProject" factoryName=".NET Project">
<option name="EXE_PATH" value="$PROJECT_DIR$/Aaru/bin/Debug/net7.0/aaru" />
<option name="PROGRAM_PARAMETERS" value="formats" />
<option name="WORKING_DIRECTORY" value="$USER_HOME$/Desktop" />
<option name="EXE_PATH" value="$PROJECT_DIR$/Aaru/bin/Debug/net8.0/aaru.exe" />
<option name="PROGRAM_PARAMETERS" value="i info archlinux-2023.07.01-x86_64.iso" />
<option name="WORKING_DIRECTORY" value="$USER_HOME$/Downloads" />
<option name="PASS_PARENT_ENVS" value="1" />
<option name="USE_EXTERNAL_CONSOLE" value="0" />
<option name="USE_MONO" value="0" />
@@ -12,7 +12,7 @@
<option name="PROJECT_ARGUMENTS_TRACKING" value="1" />
<option name="PROJECT_WORKING_DIRECTORY_TRACKING" value="0" />
<option name="PROJECT_KIND" value="DotNetCore" />
<option name="PROJECT_TFM" value="net7.0" />
<option name="PROJECT_TFM" value="net8.0" />
<method v="2">
<option name="Build" />
</method>

View File

@@ -50,6 +50,7 @@ using Aaru.Decoders.PCMCIA;
using Aaru.Decoders.SCSI;
using Aaru.Decoders.Xbox;
using Aaru.Helpers;
using Humanizer.Bytes;
using Spectre.Console;
using DDS = Aaru.Decoders.DVD.DDS;
using DMI = Aaru.Decoders.Xbox.DMI;
@@ -94,7 +95,7 @@ public static class ImageInfo
AaruConsole.WriteLine(Localization.Core.Contains_a_media_of_0_sectors_with_a_maximum_sector_size_of_1_bytes_etc,
imageFormat.Info.Sectors, imageFormat.Info.SectorSize,
imageFormat.Info.Sectors * imageFormat.Info.SectorSize);
ByteSize.FromBytes(imageFormat.Info.Sectors * imageFormat.Info.SectorSize));
if(!string.IsNullOrWhiteSpace(imageFormat.Info.Creator))
AaruConsole.WriteLine(Localization.Core.Created_by_0_WithMarkup, Markup.Escape(imageFormat.Info.Creator));

View File

@@ -54,6 +54,7 @@ using Avalonia;
using Avalonia.Controls;
using Avalonia.Media.Imaging;
using Avalonia.Platform;
using Humanizer.Bytes;
using ReactiveUI;
using Inquiry = Aaru.CommonTypes.Structs.Devices.SCSI.Inquiry;
using Session = Aaru.CommonTypes.Structs.Session;
@@ -126,7 +127,7 @@ public sealed class ImageInfoViewModel : ViewModelBase
SectorsText =
string.Format(Localization.Core.Contains_a_media_of_0_sectors_with_a_maximum_sector_size_of_1_bytes_etc,
imageFormat.Info.Sectors, imageFormat.Info.SectorSize,
imageFormat.Info.Sectors * imageFormat.Info.SectorSize);
ByteSize.FromBytes(imageFormat.Info.Sectors * imageFormat.Info.SectorSize));
MediaTypeText = string.Format(Localization.Core.Contains_a_media_of_type_0_and_XML_type_1,
imageFormat.Info.MediaType, imageFormat.Info.MetadataMediaType);

View File

@@ -1338,7 +1338,7 @@ namespace Aaru.Localization {
}
/// <summary>
/// Looks up a localized string similar to Contains a media of {0} sectors with a maximum sector size of {1} bytes (if all sectors are of the same size this would be {2} bytes).
/// Looks up a localized string similar to Contains a media of {0} sectors with a maximum sector size of {1} bytes (if all sectors are of the same size this would be {2}).
/// </summary>
public static string Contains_a_media_of_0_sectors_with_a_maximum_sector_size_of_1_bytes_etc {
get {

View File

@@ -517,7 +517,7 @@
<value>Image without headers is {0} bytes long</value>
</data>
<data name="Contains_a_media_of_0_sectors_with_a_maximum_sector_size_of_1_bytes_etc" xml:space="preserve">
<value>Contains a media of {0} sectors with a maximum sector size of {1} bytes (if all sectors are of the same size this would be {2} bytes)</value>
<value>Contains a media of {0} sectors with a maximum sector size of {1} bytes (if all sectors are of the same size this would be {2})</value>
</data>
<data name="Contains_a_media_of_type_0_and_XML_type_1" xml:space="preserve">
<value>Contains a media of type {0} and XML type {1}</value>