[UI] Fix speed values humanization.

This commit is contained in:
2024-04-26 03:18:47 +01:00
parent b48545b0b4
commit 4acc1beaf4
12 changed files with 101 additions and 54 deletions

View File

@@ -390,11 +390,13 @@ public partial class Dump
UpdateStatus?.Invoke(string.Format(Localization.Core.Average_dump_speed_0,
ByteSize.FromBytes(blockSize * (blocks + 1)).
Per(totalDuration.Milliseconds())));
Per(totalDuration.Milliseconds()).
Humanize()));
UpdateStatus?.Invoke(string.Format(Localization.Core.Average_write_speed_0,
ByteSize.FromBytes(blockSize * (blocks + 1)).
Per(imageWriteDuration.Seconds())));
Per(imageWriteDuration.Seconds()).
Humanize()));
_dumpLog.WriteLine(string.Format(Localization.Core.Dump_finished_in_0,
_dumpStopwatch.Elapsed.Humanize(minUnit: TimeUnit.Second)));
@@ -671,11 +673,13 @@ public partial class Dump
UpdateStatus?.Invoke(string.Format(Localization.Core.Average_dump_speed_0,
ByteSize.FromBytes(blockSize * (blocks + 1)).
Per(totalDuration.Milliseconds())));
Per(totalDuration.Milliseconds()).
Humanize()));
UpdateStatus?.Invoke(string.Format(Localization.Core.Average_write_speed_0,
ByteSize.FromBytes(blockSize * (blocks + 1)).
Per(imageWriteDuration.Seconds())));
Per(imageWriteDuration.Seconds()).
Humanize()));
_dumpLog.WriteLine(string.Format(Localization.Core.Dump_finished_in_0,
_dumpStopwatch.Elapsed.Humanize(minUnit: TimeUnit.Second)));
@@ -880,7 +884,8 @@ public partial class Dump
UpdateStatus?.Invoke(string.Format(Localization.Core.Average_checksum_speed_0,
ByteSize.FromBytes(blockSize * (blocks + 1)).
Per(totalChkDuration.Milliseconds())));
Per(totalChkDuration.Milliseconds()).
Humanize()));
_dumpLog.WriteLine(Localization.Core.Sidecar_created_in_0,
_sidecarStopwatch.Elapsed.Humanize(minUnit: TimeUnit.Second));

View File

@@ -1307,23 +1307,27 @@ sealed partial class Dump
_dumpStopwatch.Elapsed.Humanize(minUnit: TimeUnit.Second)));
UpdateStatus?.Invoke(string.Format(Localization.Core.Average_dump_speed_0,
ByteSize.FromBytes(blockSize * (blocks + 1)).
Per(totalDuration.Milliseconds())));
ByteSize.FromBytes(blockSize * (blocks + 1))
.Per(totalDuration.Milliseconds())
.Humanize()));
UpdateStatus?.Invoke(string.Format(Localization.Core.Average_write_speed_0,
ByteSize.FromBytes(blockSize * (blocks + 1)).
Per(imageWriteDuration.Seconds())));
ByteSize.FromBytes(blockSize * (blocks + 1))
.Per(imageWriteDuration.Seconds())
.Humanize()));
_dumpLog.WriteLine(string.Format(Localization.Core.Dump_finished_in_0,
_dumpStopwatch.Elapsed.Humanize(minUnit: TimeUnit.Second)));
_dumpLog.WriteLine(string.Format(Localization.Core.Average_dump_speed_0,
ByteSize.FromBytes(blockSize * (blocks + 1)).
Per(totalDuration.Milliseconds())));
ByteSize.FromBytes(blockSize * (blocks + 1))
.Per(totalDuration.Milliseconds())
.Humanize()));
_dumpLog.WriteLine(string.Format(Localization.Core.Average_write_speed_0,
ByteSize.FromBytes(blockSize * (blocks + 1)).
Per(imageWriteDuration.Seconds())));
ByteSize.FromBytes(blockSize * (blocks + 1))
.Per(imageWriteDuration.Seconds())
.Humanize()));
TrimCdUserData(audioExtents, blockSize, currentTry, extents, newTrim, offsetBytes, read6, read10, read12,
read16, readcd, sectorsForOffset, subSize, supportedSubchannel, supportsLongSectors,
@@ -1489,9 +1493,9 @@ sealed partial class Dump
_imageCloseStopwatch.Elapsed.Humanize(minUnit: TimeUnit.Second)));
UpdateStatus?.Invoke(string.Format(Localization.Core.Average_speed_0,
ByteSize.FromBytes(blockSize * (blocks + 1)).
Per(totalDuration.Milliseconds()).
Humanize()));
ByteSize.FromBytes(blockSize * (blocks + 1))
.Per(totalDuration.Milliseconds())
.Humanize()));
if(maxSpeed > 0)
{

View File

@@ -372,11 +372,13 @@ public partial class Dump
UpdateStatus?.Invoke(string.Format(Localization.Core.Average_dump_speed_0,
ByteSize.FromBytes(512 * (romSectors + 1)).
Per(totalDuration.Milliseconds())));
Per(totalDuration.Milliseconds()).
Humanize()));
UpdateStatus?.Invoke(string.Format(Localization.Core.Average_write_speed_0,
ByteSize.FromBytes(512 * (romSectors + 1)).
Per(imageWriteDuration.Seconds())));
Per(imageWriteDuration.Seconds()).
Humanize()));
_dumpLog.WriteLine(string.Format(Localization.Core.Dump_finished_in_0,
_dumpStopwatch.Elapsed.Humanize(minUnit: TimeUnit.Second)));

View File

@@ -447,22 +447,26 @@ partial class Dump
UpdateStatus?.Invoke(string.Format(Localization.Core.Average_dump_speed_0,
ByteSize.FromBytes(blockSize * (blocks + 1)).
Per(totalDuration.Milliseconds())));
Per(totalDuration.Milliseconds()).
Humanize()));
UpdateStatus?.Invoke(string.Format(Localization.Core.Average_write_speed_0,
ByteSize.FromBytes(blockSize * (blocks + 1)).
Per(imageWriteDuration.Seconds())));
Per(imageWriteDuration.Seconds()).
Humanize()));
_dumpLog.WriteLine(string.Format(Localization.Core.Dump_finished_in_0,
_dumpStopwatch.Elapsed.Humanize(minUnit: TimeUnit.Second)));
_dumpLog.WriteLine(string.Format(Localization.Core.Average_dump_speed_0,
ByteSize.FromBytes(blockSize * (blocks + 1)).
Per(totalDuration.Milliseconds())));
Per(totalDuration.Milliseconds()).
Humanize()));
_dumpLog.WriteLine(string.Format(Localization.Core.Average_write_speed_0,
ByteSize.FromBytes(blockSize * (blocks + 1)).
Per(imageWriteDuration.Seconds())));
Per(imageWriteDuration.Seconds()).
Humanize()));
#region Trimming
@@ -786,7 +790,8 @@ partial class Dump
UpdateStatus?.Invoke(string.Format(Localization.Core.Average_checksum_speed_0,
ByteSize.FromBytes(blockSize * (blocks + 1)).
Per(totalChkDuration.Milliseconds())));
Per(totalChkDuration.Milliseconds()).
Humanize()));
_dumpLog.WriteLine(Localization.Core.Sidecar_created_in_0,
_sidecarStopwatch.Elapsed.Humanize(minUnit: TimeUnit.Second));

View File

@@ -285,22 +285,26 @@ public partial class Dump
UpdateStatus?.Invoke(string.Format(Localization.Core.Average_dump_speed_0,
ByteSize.FromBytes(blockSize * (blocks + 1)).
Per(totalDuration.Milliseconds())));
Per(totalDuration.Milliseconds()).
Humanize()));
UpdateStatus?.Invoke(string.Format(Localization.Core.Average_write_speed_0,
ByteSize.FromBytes(blockSize * (blocks + 1)).
Per(imageWriteDuration.Seconds())));
Per(imageWriteDuration.Seconds()).
Humanize()));
_dumpLog.WriteLine(string.Format(Localization.Core.Dump_finished_in_0,
_dumpStopwatch.Elapsed.Humanize(minUnit: TimeUnit.Second)));
_dumpLog.WriteLine(string.Format(Localization.Core.Average_dump_speed_0,
ByteSize.FromBytes(blockSize * (blocks + 1)).
Per(totalDuration.Milliseconds())));
Per(totalDuration.Milliseconds()).
Humanize()));
_dumpLog.WriteLine(string.Format(Localization.Core.Average_write_speed_0,
ByteSize.FromBytes(blockSize * (blocks + 1)).
Per(imageWriteDuration.Seconds())));
Per(imageWriteDuration.Seconds()).
Humanize()));
#region Trimming
@@ -645,7 +649,8 @@ public partial class Dump
UpdateStatus?.Invoke(string.Format(Localization.Core.Average_checksum_speed_0,
ByteSize.FromBytes(blockSize * (blocks + 1)).
Per(totalChkDuration.Milliseconds())));
Per(totalChkDuration.Milliseconds()).
Humanize()));
_dumpLog.WriteLine(Localization.Core.Sidecar_created_in_0,
_sidecarStopwatch.Elapsed.Humanize(minUnit: TimeUnit.Second));

View File

@@ -306,22 +306,26 @@ public partial class Dump
UpdateStatus?.Invoke(string.Format(Localization.Core.Average_dump_speed_0,
ByteSize.FromBytes(blockSize * (blocks + 1)).
Per(totalDuration.Milliseconds())));
Per(totalDuration.Milliseconds()).
Humanize()));
UpdateStatus?.Invoke(string.Format(Localization.Core.Average_write_speed_0,
ByteSize.FromBytes(blockSize * (blocks + 1)).
Per(imageWriteDuration.Seconds())));
Per(imageWriteDuration.Seconds()).
Humanize()));
_dumpLog.WriteLine(string.Format(Localization.Core.Dump_finished_in_0,
_dumpStopwatch.Elapsed.Humanize(minUnit: TimeUnit.Second)));
_dumpLog.WriteLine(string.Format(Localization.Core.Average_dump_speed_0,
ByteSize.FromBytes(blockSize * (blocks + 1)).
Per(totalDuration.Milliseconds())));
Per(totalDuration.Milliseconds()).
Humanize()));
_dumpLog.WriteLine(string.Format(Localization.Core.Average_write_speed_0,
ByteSize.FromBytes(blockSize * (blocks + 1)).
Per(imageWriteDuration.Seconds())));
Per(imageWriteDuration.Seconds()).
Humanize()));
#region Trimming

View File

@@ -1128,22 +1128,26 @@ partial class Dump
UpdateStatus?.Invoke(string.Format(Localization.Core.Average_dump_speed_0,
ByteSize.FromBytes(blockSize * (blocks + 1)).
Per(totalDuration.Milliseconds())));
Per(totalDuration.Milliseconds()).
Humanize()));
UpdateStatus?.Invoke(string.Format(Localization.Core.Average_write_speed_0,
ByteSize.FromBytes(blockSize * (blocks + 1)).
Per(imageWriteDuration.Seconds())));
Per(imageWriteDuration.Seconds()).
Humanize()));
_dumpLog.WriteLine(string.Format(Localization.Core.Dump_finished_in_0,
_dumpStopwatch.Elapsed.Humanize(minUnit: TimeUnit.Second)));
_dumpLog.WriteLine(string.Format(Localization.Core.Average_dump_speed_0,
ByteSize.FromBytes(blockSize * (blocks + 1)).
Per(totalDuration.Milliseconds())));
Per(totalDuration.Milliseconds()).
Humanize()));
_dumpLog.WriteLine(string.Format(Localization.Core.Average_write_speed_0,
ByteSize.FromBytes(blockSize * (blocks + 1)).
Per(imageWriteDuration.Seconds())));
Per(imageWriteDuration.Seconds()).
Humanize()));
#region Error handling
@@ -1408,7 +1412,8 @@ partial class Dump
UpdateStatus?.Invoke(string.Format(Localization.Core.Average_checksum_speed_0,
ByteSize.FromBytes(blockSize * (blocks + 1)).
Per(totalChkDuration.Milliseconds())));
Per(totalChkDuration.Milliseconds()).
Humanize()));
_dumpLog.WriteLine(Localization.Core.Sidecar_created_in_0,
_sidecarStopwatch.Elapsed.Humanize(minUnit: TimeUnit.Second));

View File

@@ -802,22 +802,26 @@ partial class Dump
UpdateStatus?.Invoke(string.Format(Localization.Core.Average_dump_speed_0,
ByteSize.FromBytes(blockSize * (blocks + 1)).
Per(totalDuration.Milliseconds())));
Per(totalDuration.Milliseconds()).
Humanize()));
UpdateStatus?.Invoke(string.Format(Localization.Core.Average_write_speed_0,
ByteSize.FromBytes(blockSize * (blocks + 1)).
Per(imageWriteDuration.Seconds())));
Per(imageWriteDuration.Seconds()).
Humanize()));
_dumpLog.WriteLine(string.Format(Localization.Core.Dump_finished_in_0,
_dumpStopwatch.Elapsed.Humanize(minUnit: TimeUnit.Second)));
_dumpLog.WriteLine(string.Format(Localization.Core.Average_dump_speed_0,
ByteSize.FromBytes(blockSize * (blocks + 1)).
Per(totalDuration.Milliseconds())));
Per(totalDuration.Milliseconds()).
Humanize()));
_dumpLog.WriteLine(string.Format(Localization.Core.Average_write_speed_0,
ByteSize.FromBytes(blockSize * (blocks + 1)).
Per(imageWriteDuration.Seconds())));
Per(imageWriteDuration.Seconds()).
Humanize()));
#region Trimming
@@ -1114,14 +1118,16 @@ partial class Dump
UpdateStatus?.Invoke(string.Format(Localization.Core.Average_checksum_speed_0,
ByteSize.FromBytes(blockSize * (blocks + 1)).
Per(totalChkDuration.Milliseconds())));
Per(totalChkDuration.Milliseconds()).
Humanize()));
_dumpLog.WriteLine(Localization.Core.Sidecar_created_in_0,
_sidecarStopwatch.Elapsed.Humanize(minUnit: TimeUnit.Second));
_dumpLog.WriteLine(Localization.Core.Average_checksum_speed_0,
ByteSize.FromBytes(blockSize * (blocks + 1)).
Per(totalChkDuration.Milliseconds()));
Per(totalChkDuration.Milliseconds()).
Humanize());
if(_preSidecar != null)
{

View File

@@ -731,22 +731,26 @@ public partial class Dump
UpdateStatus?.Invoke(string.Format(Localization.Core.Average_dump_speed_0,
ByteSize.FromBytes(blockSize * (blocks + 1)).
Per(totalDuration.Milliseconds())));
Per(totalDuration.Milliseconds()).
Humanize()));
UpdateStatus?.Invoke(string.Format(Localization.Core.Average_dump_speed_0,
ByteSize.FromBytes(blockSize * (blocks + 1)).
Per(imageWriteDuration.Seconds())));
Per(imageWriteDuration.Seconds()).
Humanize()));
_dumpLog.WriteLine(string.Format(Localization.Core.Dump_finished_in_0,
_dumpStopwatch.Elapsed.Humanize(minUnit: TimeUnit.Second)));
_dumpLog.WriteLine(string.Format(Localization.Core.Average_dump_speed_0,
ByteSize.FromBytes(blockSize * (blocks + 1)).
Per(totalDuration.Milliseconds())));
Per(totalDuration.Milliseconds()).
Humanize()));
_dumpLog.WriteLine(string.Format(Localization.Core.Average_dump_speed_0,
ByteSize.FromBytes(blockSize * (blocks + 1)).
Per(imageWriteDuration.Seconds())));
Per(imageWriteDuration.Seconds()).
Humanize()));
#region Trimming
@@ -951,7 +955,8 @@ public partial class Dump
UpdateStatus?.Invoke(string.Format(Localization.Core.Average_checksum_speed_0,
ByteSize.FromBytes(blockSize * (blocks + 1)).
Per(totalChkDuration.Milliseconds())));
Per(totalChkDuration.Milliseconds()).
Humanize()));
_dumpLog.WriteLine(Localization.Core.Sidecar_created_in_0,
_sidecarStopwatch.Elapsed.Humanize(minUnit: TimeUnit.Second));

View File

@@ -967,22 +967,26 @@ partial class Dump
UpdateStatus?.Invoke(string.Format(Localization.Core.Average_dump_speed_0,
ByteSize.FromBytes(blockSize * (blocks + 1)).
Per(totalDuration.Milliseconds())));
Per(totalDuration.Milliseconds()).
Humanize()));
UpdateStatus?.Invoke(string.Format(Localization.Core.Average_write_speed_0,
ByteSize.FromBytes(blockSize * (blocks + 1)).
Per(imageWriteDuration.Seconds())));
Per(imageWriteDuration.Seconds()).
Humanize()));
_dumpLog.WriteLine(string.Format(Localization.Core.Dump_finished_in_0,
_dumpStopwatch.Elapsed.Humanize(minUnit: TimeUnit.Second)));
_dumpLog.WriteLine(string.Format(Localization.Core.Average_dump_speed_0,
ByteSize.FromBytes(blockSize * (blocks + 1)).
Per(totalDuration.Milliseconds())));
Per(totalDuration.Milliseconds()).
Humanize()));
_dumpLog.WriteLine(string.Format(Localization.Core.Average_write_speed_0,
ByteSize.FromBytes(blockSize * (blocks + 1)).
Per(imageWriteDuration.Seconds())));
Per(imageWriteDuration.Seconds()).
Humanize()));
#region Trimming

View File

@@ -50,6 +50,7 @@ using Aaru.Decoders.PCMCIA;
using Aaru.Decoders.SCSI;
using Aaru.Decoders.Xbox;
using Aaru.Helpers;
using Humanizer;
using Humanizer.Bytes;
using Spectre.Console;
using DDS = Aaru.Decoders.DVD.DDS;
@@ -99,7 +100,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,
ByteSize.FromBytes(imageFormat.Info.Sectors * imageFormat.Info.SectorSize));
ByteSize.FromBytes(imageFormat.Info.Sectors * imageFormat.Info.SectorSize).Humanize());
if(!string.IsNullOrWhiteSpace(imageFormat.Info.Creator))
AaruConsole.WriteLine(Localization.Core.Created_by_0_WithMarkup, Markup.Escape(imageFormat.Info.Creator));