Skip to content

Commit

Permalink
Use Humanizer for media size.
Browse files Browse the repository at this point in the history
  • Loading branch information
claunia committed Sep 26, 2023
1 parent 3d1b058 commit d44b32a
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 8 deletions.
8 changes: 4 additions & 4 deletions .idea/.idea.Aaru/.idea/runConfigurations/Aaru.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion Aaru.Core/ImageInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
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;
Expand Down Expand Up @@ -94,7 +95,7 @@ public static void PrintImageInfo(IBaseImage imageFormat)

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));
Expand Down
3 changes: 2 additions & 1 deletion Aaru.Gui/ViewModels/Panels/ImageInfoViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
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;
Expand Down Expand Up @@ -126,7 +127,7 @@ public ImageInfoViewModel(string imagePath, IFilter filter, IMediaImage imageFor
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);
Expand Down
2 changes: 1 addition & 1 deletion Aaru.Localization/Core.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Aaru.Localization/Core.resx
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down

0 comments on commit d44b32a

Please sign in to comment.