diff --git a/Aaru.Core/Devices/Dumping/ATA.cs b/Aaru.Core/Devices/Dumping/ATA.cs
index e6da47290..d90f7faee 100644
--- a/Aaru.Core/Devices/Dumping/ATA.cs
+++ b/Aaru.Core/Devices/Dumping/ATA.cs
@@ -45,6 +45,8 @@ using Aaru.Core.Graphics;
using Aaru.Core.Logging;
using Aaru.Decoders.ATA;
using Aaru.Decoders.PCMCIA;
+using Humanizer;
+using Humanizer.Bytes;
using Identify = Aaru.CommonTypes.Structs.Devices.ATA.Identify;
using Tuple = Aaru.Decoders.PCMCIA.Tuple;
using Version = Aaru.CommonTypes.Interop.Version;
@@ -323,7 +325,7 @@ public partial class Dump
minSpeed = currentSpeed;
UpdateProgress?.
- Invoke(string.Format(Localization.Core.Reading_sector_0_of_1_2_MiB_sec, i, blocks, currentSpeed),
+ Invoke(string.Format(Localization.Core.Reading_sector_0_of_1_2, i, blocks, ByteSize.FromMegabytes(currentSpeed).Per(_oneSecond)),
(long)i, (long)blocks);
bool error = ataReader.ReadBlocks(out cmdBuf, i, blocksToRead, out duration, out _, out _);
@@ -382,20 +384,21 @@ public partial class Dump
UpdateStatus?.Invoke(string.Format(Localization.Core.Dump_finished_in_0_seconds,
(end - start).TotalSeconds));
- UpdateStatus?.Invoke(string.Format(Localization.Core.Average_dump_speed_0_KiB_sec,
- blockSize * (double)(blocks + 1) / 1024 /
- (totalDuration / 1000)));
+ UpdateStatus?.Invoke(string.Format(Localization.Core.Average_dump_speed_0,
+ ByteSize.FromBytes(blockSize * (blocks + 1)).
+ Per(totalDuration.Milliseconds())));
- UpdateStatus?.Invoke(string.Format(Localization.Core.Average_write_speed_0_KiB_sec,
- blockSize * (double)(blocks + 1) / 1024 / imageWriteDuration));
+ UpdateStatus?.Invoke(string.Format(Localization.Core.Average_write_speed_0,
+ ByteSize.FromBytes(blockSize * (blocks + 1)).Per(imageWriteDuration.Seconds())));
_dumpLog.WriteLine(Localization.Core.Dump_finished_in_0_seconds, (end - start).TotalSeconds);
- _dumpLog.WriteLine(Localization.Core.Average_dump_speed_0_KiB_sec,
- blockSize * (double)(blocks + 1) / 1024 / (totalDuration / 1000));
+ _dumpLog.WriteLine(Localization.Core.Average_dump_speed_0,
+ ByteSize.FromBytes(blockSize * (blocks + 1)).Per(totalDuration.Milliseconds()));
- _dumpLog.WriteLine(Localization.Core.Average_write_speed_0_KiB_sec,
- blockSize * (double)(blocks + 1) / 1024 / imageWriteDuration);
+ _dumpLog.WriteLine(string.Format(Localization.Core.Average_write_speed_0,
+ ByteSize.FromBytes(blockSize * (blocks + 1)).
+ Per(imageWriteDuration.Seconds())));
#region Trimming
if(_resume.BadBlocks.Count > 0 &&
@@ -585,8 +588,8 @@ public partial class Dump
minSpeed = currentSpeed;
PulseProgress?.
- Invoke(string.Format(Localization.Core.Reading_cylinder_0_head_1_sector_2_3_MiB_sec,
- cy, hd, sc, currentSpeed));
+ Invoke(string.Format(Localization.Core.Reading_cylinder_0_head_1_sector_2_3, cy, hd,
+ sc, ByteSize.FromMegabytes(currentSpeed).Per(_oneSecond)));
bool error =
ataReader.ReadChs(out cmdBuf, cy, hd, sc, out duration, out recoveredError);
@@ -650,21 +653,21 @@ public partial class Dump
UpdateStatus?.Invoke(string.Format(Localization.Core.Dump_finished_in_0_seconds,
(end - start).TotalSeconds));
- UpdateStatus?.Invoke(string.Format(Localization.Core.Average_dump_speed_0_KiB_sec,
- blockSize * (double)(blocks + 1) / 1024 /
- (totalDuration / 1000)));
+ UpdateStatus?.Invoke(string.Format(Localization.Core.Average_dump_speed_0,
+ ByteSize.FromBytes(blockSize * (blocks + 1)).
+ Per(totalDuration.Milliseconds())));
- UpdateStatus?.Invoke(string.Format(Localization.Core.Average_write_speed_0_KiB_sec,
- blockSize * (double)(blocks + 1) / 1024 /
- (imageWriteDuration / 1000)));
+ UpdateStatus?.Invoke(string.Format(Localization.Core.Average_write_speed_0,
+ ByteSize.FromBytes(blockSize * (blocks + 1)).
+ Per(imageWriteDuration.Seconds())));
_dumpLog.WriteLine(Localization.Core.Dump_finished_in_0_seconds, (end - start).TotalSeconds);
- _dumpLog.WriteLine(Localization.Core.Average_dump_speed_0_KiB_sec,
- blockSize * (double)(blocks + 1) / 1024 / (totalDuration / 1000));
+ _dumpLog.WriteLine(Localization.Core.Average_dump_speed_0,
+ ByteSize.FromBytes(blockSize * (blocks + 1)).Per(totalDuration.Milliseconds()));
- _dumpLog.WriteLine(Localization.Core.Average_write_speed_0_KiB_sec,
- blockSize * (double)(blocks + 1) / 1024 / (imageWriteDuration / 1000));
+ _dumpLog.WriteLine(Localization.Core.Average_write_speed_0,
+ ByteSize.FromBytes(blockSize * (blocks + 1)).Per(imageWriteDuration.Seconds()));
}
foreach(ulong bad in _resume.BadBlocks)
@@ -850,15 +853,15 @@ public partial class Dump
UpdateStatus?.Invoke(string.Format(Localization.Core.Sidecar_created_in_0_seconds,
(chkEnd - chkStart).TotalSeconds));
- UpdateStatus?.Invoke(string.Format(Localization.Core.Average_checksum_speed_0_KiB_sec,
- blockSize * (double)(blocks + 1) / 1024 /
- (totalChkDuration / 1000)));
+ UpdateStatus?.Invoke(string.Format(Localization.Core.Average_checksum_speed_0,
+ ByteSize.FromBytes(blockSize * (blocks + 1)).
+ Per(totalChkDuration.Milliseconds())));
_dumpLog.WriteLine(Localization.Core.Sidecar_created_in_0_seconds,
(chkEnd - chkStart).TotalSeconds);
- _dumpLog.WriteLine(Localization.Core.Average_checksum_speed_0_KiB_sec,
- blockSize * (double)(blocks + 1) / 1024 / (totalChkDuration / 1000));
+ _dumpLog.WriteLine(Localization.Core.Average_checksum_speed_0,
+ ByteSize.FromBytes(blockSize * (blocks + 1)).Per(totalChkDuration.Milliseconds()));
List<(ulong start, string type)> filesystems = new();
@@ -927,15 +930,17 @@ public partial class Dump
(end - start).TotalSeconds, totalDuration / 1000, totalChkDuration / 1000,
imageWriteDuration, (closeEnd - closeStart).TotalSeconds));
- UpdateStatus?.Invoke(string.Format(Localization.Core.Average_speed_0_MiB_sec,
- blockSize * (double)(blocks + 1) / 1048576 /
- (totalDuration / 1000)));
+ UpdateStatus?.Invoke(string.Format(Localization.Core.Average_speed_0,
+ ByteSize.FromBytes(blockSize * (blocks + 1)).
+ Per(totalDuration.Milliseconds())));
if(maxSpeed > 0)
- UpdateStatus?.Invoke(string.Format(Localization.Core.Fastest_speed_burst_0_MiB_sec, maxSpeed));
+ UpdateStatus?.Invoke(string.Format(Localization.Core.Fastest_speed_burst_0,
+ ByteSize.FromMegabytes(maxSpeed).Per(_oneSecond)));
if(minSpeed is > 0 and < double.MaxValue)
- UpdateStatus?.Invoke(string.Format(Localization.Core.Slowest_speed_burst_0_MiB_sec, minSpeed));
+ UpdateStatus?.Invoke(string.Format(Localization.Core.Slowest_speed_burst_0,
+ ByteSize.FromMegabytes(minSpeed).Per(_oneSecond)));
UpdateStatus?.Invoke(string.Format(Localization.Core._0_sectors_could_not_be_read,
_resume.BadBlocks.Count));
diff --git a/Aaru.Core/Devices/Dumping/CompactDisc/CdiReady.cs b/Aaru.Core/Devices/Dumping/CompactDisc/CdiReady.cs
index 7e56ed65d..9f6c75545 100644
--- a/Aaru.Core/Devices/Dumping/CompactDisc/CdiReady.cs
+++ b/Aaru.Core/Devices/Dumping/CompactDisc/CdiReady.cs
@@ -43,6 +43,8 @@ using Aaru.CommonTypes.Interfaces;
using Aaru.Core.Logging;
using Aaru.Decoders.CD;
using Aaru.Devices;
+using Humanizer;
+using Humanizer.Bytes;
using Track = Aaru.CommonTypes.Structs.Track;
namespace Aaru.Core.Devices.Dumping;
@@ -214,7 +216,7 @@ partial class Dump
minSpeed = currentSpeed;
UpdateProgress?.
- Invoke(string.Format(Localization.Core.Reading_sector_0_of_1_2_MiB_sec, i, blocks, currentSpeed),
+ Invoke(string.Format(Localization.Core.Reading_sector_0_of_1_2, i, blocks, ByteSize.FromMegabytes(currentSpeed).Per(_oneSecond)),
(long)i, (long)blocks);
sense = _dev.ReadCd(out cmdBuf, out senseBuf, firstSectorToRead, blockSize, blocksToRead,
@@ -230,7 +232,7 @@ partial class Dump
for(uint r = 0; r < _maximumReadable; r++)
{
UpdateProgress?.
- Invoke(string.Format(Localization.Core.Reading_sector_0_of_1_2_MiB_sec, i + r, blocks, currentSpeed),
+ Invoke(string.Format(Localization.Core.Reading_sector_0_of_1_2, i + r, blocks, ByteSize.FromMegabytes(currentSpeed).Per(_oneSecond)),
(long)i + r, (long)blocks);
sense = _dev.ReadCd(out cmdBuf, out senseBuf, (uint)(i + r), blockSize, (uint)sectorsForOffset + 1,
diff --git a/Aaru.Core/Devices/Dumping/CompactDisc/Data.cs b/Aaru.Core/Devices/Dumping/CompactDisc/Data.cs
index a6da39236..bae65d720 100644
--- a/Aaru.Core/Devices/Dumping/CompactDisc/Data.cs
+++ b/Aaru.Core/Devices/Dumping/CompactDisc/Data.cs
@@ -47,6 +47,8 @@ using Aaru.Core.Logging;
using Aaru.Decoders.CD;
using Aaru.Decoders.SCSI;
using Aaru.Devices;
+using Humanizer;
+using Humanizer.Bytes;
using Track = Aaru.CommonTypes.Structs.Track;
using TrackType = Aaru.CommonTypes.Enums.TrackType;
@@ -271,7 +273,7 @@ partial class Dump
minSpeed = currentSpeed;
UpdateProgress?.
- Invoke(string.Format(Localization.Core.Reading_sector_0_of_1_2_MiB_sec, i, blocks, currentSpeed),
+ Invoke(string.Format(Localization.Core.Reading_sector_0_of_1_2, i, blocks, ByteSize.FromMegabytes(currentSpeed).Per(_oneSecond)),
(long)i, (long)blocks);
if(crossingLeadOut &&
@@ -423,7 +425,7 @@ partial class Dump
for(uint r = 0; r < blocksToRead; r++)
{
UpdateProgress?.
- Invoke(string.Format(Localization.Core.Reading_sector_0_of_1_2_MiB_sec, i + r, blocks, currentSpeed),
+ Invoke(string.Format(Localization.Core.Reading_sector_0_of_1_2, i + r, blocks, ByteSize.FromMegabytes(currentSpeed).Per(_oneSecond)),
(long)i + r, (long)blocks);
if(_supportsPlextorD8)
diff --git a/Aaru.Core/Devices/Dumping/CompactDisc/Dump.cs b/Aaru.Core/Devices/Dumping/CompactDisc/Dump.cs
index 181e3dde4..a23a4e9e5 100644
--- a/Aaru.Core/Devices/Dumping/CompactDisc/Dump.cs
+++ b/Aaru.Core/Devices/Dumping/CompactDisc/Dump.cs
@@ -50,6 +50,8 @@ using Aaru.Core.Media.Detection;
using Aaru.Database.Models;
using Aaru.Decoders.CD;
using Aaru.Devices;
+using Humanizer;
+using Humanizer.Bytes;
using Track = Aaru.CommonTypes.Structs.Track;
using TrackType = Aaru.CommonTypes.Enums.TrackType;
using Version = Aaru.CommonTypes.Interop.Version;
@@ -1294,19 +1296,23 @@ sealed partial class Dump
UpdateStatus?.Invoke(string.Format(Localization.Core.Dump_finished_in_0_seconds, (end - start).TotalSeconds));
- UpdateStatus?.Invoke(string.Format(Localization.Core.Average_dump_speed_0_KiB_sec,
- blockSize * (double)(blocks + 1) / 1024 / (totalDuration / 1000)));
+ UpdateStatus?.Invoke(string.Format(Localization.Core.Average_dump_speed_0,
+ ByteSize.FromBytes(blockSize * (blocks + 1)).
+ Per(totalDuration.Milliseconds())));
- UpdateStatus?.Invoke(string.Format(Localization.Core.Average_write_speed_0_KiB_sec,
- blockSize * (double)(blocks + 1) / 1024 / imageWriteDuration));
+ UpdateStatus?.Invoke(string.Format(Localization.Core.Average_write_speed_0,
+ ByteSize.FromBytes(blockSize * (blocks + 1)).
+ Per(imageWriteDuration.Seconds())));
_dumpLog.WriteLine(Localization.Core.Dump_finished_in_0_seconds, (end - start).TotalSeconds);
- _dumpLog.WriteLine(Localization.Core.Average_dump_speed_0_KiB_sec,
- blockSize * (double)(blocks + 1) / 1024 / (totalDuration / 1000));
+ _dumpLog.WriteLine(string.Format(Localization.Core.Average_dump_speed_0,
+ ByteSize.FromBytes(blockSize * (blocks + 1)).
+ Per(totalDuration.Milliseconds())));
- _dumpLog.WriteLine(Localization.Core.Average_write_speed_0_KiB_sec,
- blockSize * (double)(blocks + 1) / 1024 / imageWriteDuration);
+ _dumpLog.WriteLine(string.Format(Localization.Core.Average_write_speed_0,
+ ByteSize.FromBytes(blockSize * (blocks + 1)).
+ Per(imageWriteDuration.Seconds())));
TrimCdUserData(audioExtents, blockSize, currentTry, extents, newTrim, offsetBytes, read6, read10, read12,
read16, readcd, sectorsForOffset, subSize, supportedSubchannel, supportsLongSectors,
@@ -1460,14 +1466,16 @@ sealed partial class Dump
(end - dumpStart).TotalSeconds, totalDuration / 1000, totalChkDuration / 1000,
imageWriteDuration, (closeEnd - closeStart).TotalSeconds));
- UpdateStatus?.Invoke(string.Format(Localization.Core.Average_speed_0_MiB_sec,
- blockSize * (double)(blocks + 1) / 1048576 / (totalDuration / 1000)));
+ UpdateStatus?.Invoke(string.Format(Localization.Core.Average_speed_0,
+ ByteSize.FromBytes(blockSize * (blocks + 1)).
+ Per(totalDuration.Milliseconds())));
if(maxSpeed > 0)
- UpdateStatus?.Invoke(string.Format(Localization.Core.Fastest_speed_burst_0_MiB_sec, maxSpeed));
+ UpdateStatus?.Invoke(string.Format(Localization.Core.Fastest_speed_burst_0, ByteSize.FromMegabytes(maxSpeed).Per(_oneSecond)));
if(minSpeed is > 0 and < double.MaxValue)
- UpdateStatus?.Invoke(string.Format(Localization.Core.Slowest_speed_burst_0_MiB_sec, minSpeed));
+ UpdateStatus?.Invoke(string.Format(Localization.Core.Slowest_speed_burst_0,
+ ByteSize.FromMegabytes(minSpeed).Per(_oneSecond)));
UpdateStatus?.Invoke(string.Format(Localization.Core._0_sectors_could_not_be_read, _resume.BadBlocks.Count));
diff --git a/Aaru.Core/Devices/Dumping/CompactDisc/LeadOuts.cs b/Aaru.Core/Devices/Dumping/CompactDisc/LeadOuts.cs
index 392c1c8be..b51afc1b3 100644
--- a/Aaru.Core/Devices/Dumping/CompactDisc/LeadOuts.cs
+++ b/Aaru.Core/Devices/Dumping/CompactDisc/LeadOuts.cs
@@ -44,6 +44,8 @@ using Aaru.CommonTypes.Extents;
using Aaru.CommonTypes.Interfaces;
using Aaru.Core.Logging;
using Aaru.Devices;
+using Humanizer;
+using Humanizer.Bytes;
using Track = Aaru.CommonTypes.Structs.Track;
namespace Aaru.Core.Devices.Dumping;
@@ -119,8 +121,8 @@ partial class Dump
currentSpeed > 0)
minSpeed = currentSpeed;
- PulseProgress?.Invoke(string.Format(Localization.Core.Reading_sector_0_at_lead_out_1_MiB_sec, i,
- currentSpeed));
+ PulseProgress?.Invoke(string.Format(Localization.Core.Reading_sector_0_at_lead_out_1, i,
+ ByteSize.FromMegabytes(currentSpeed).Per(_oneSecond)));
if(readcd)
{
@@ -291,8 +293,8 @@ partial class Dump
currentSpeed > 0)
minSpeed = currentSpeed;
- PulseProgress?.Invoke(string.Format(Localization.Core.Reading_sector_0_at_lead_out_1_MiB_sec, i,
- currentSpeed));
+ PulseProgress?.Invoke(string.Format(Localization.Core.Reading_sector_0_at_lead_out_1, i,
+ ByteSize.FromMegabytes(currentSpeed).Per(_oneSecond)));
if(readcd)
{
diff --git a/Aaru.Core/Devices/Dumping/CompactDisc/Pregap.cs b/Aaru.Core/Devices/Dumping/CompactDisc/Pregap.cs
index 37531a491..0c467ac94 100644
--- a/Aaru.Core/Devices/Dumping/CompactDisc/Pregap.cs
+++ b/Aaru.Core/Devices/Dumping/CompactDisc/Pregap.cs
@@ -45,6 +45,8 @@ using Aaru.CommonTypes.Structs;
using Aaru.Console;
using Aaru.Core.Logging;
using Aaru.Devices;
+using Humanizer;
+using Humanizer.Bytes;
namespace Aaru.Core.Devices.Dumping;
@@ -85,8 +87,9 @@ partial class Dump
break;
}
- PulseProgress?.Invoke(string.Format(Localization.Core.Trying_to_read_first_track_pregap_sector_0_1_MiB_sec,
- firstTrackPregapBlock, currentSpeed));
+ PulseProgress?.Invoke(string.Format(Localization.Core.Trying_to_read_first_track_pregap_sector_0_1,
+ firstTrackPregapBlock,
+ ByteSize.FromMegabytes(currentSpeed).Per(_oneSecond)));
// ReSharper disable IntVariableOverflowInUncheckedContext
sense = _dev.ReadCd(out cmdBuf, out _, (uint)firstTrackPregapBlock, blockSize, 1, MmcSectorTypes.AllTypes,
diff --git a/Aaru.Core/Devices/Dumping/Dump.cs b/Aaru.Core/Devices/Dumping/Dump.cs
index 1360b668c..31db41a3f 100644
--- a/Aaru.Core/Devices/Dumping/Dump.cs
+++ b/Aaru.Core/Devices/Dumping/Dump.cs
@@ -33,6 +33,7 @@
using System;
using System.Collections.Generic;
+using System.Configuration;
using System.IO;
using System.Linq;
using System.Text;
@@ -45,6 +46,7 @@ using Aaru.CommonTypes.Metadata;
using Aaru.Core.Logging;
using Aaru.Database;
using Aaru.Devices;
+using Humanizer;
using File = System.IO.File;
namespace Aaru.Core.Devices.Dumping;
@@ -112,6 +114,7 @@ public partial class Dump
int _speedMultiplier;
bool _supportsPlextorD8;
bool _useBufferedReads;
+ static readonly TimeSpan _oneSecond = 1.Seconds();
/// Initializes dumpers
/// Should resume?
diff --git a/Aaru.Core/Devices/Dumping/LinearMemory/Retrode.cs b/Aaru.Core/Devices/Dumping/LinearMemory/Retrode.cs
index 3503f476c..d59c7cc1d 100644
--- a/Aaru.Core/Devices/Dumping/LinearMemory/Retrode.cs
+++ b/Aaru.Core/Devices/Dumping/LinearMemory/Retrode.cs
@@ -36,6 +36,8 @@ using Aaru.CommonTypes;
using Aaru.CommonTypes.Enums;
using Aaru.CommonTypes.Interfaces;
using Aaru.Core.Graphics;
+using Humanizer;
+using Humanizer.Bytes;
using Version = Aaru.CommonTypes.Interop.Version;
namespace Aaru.Core.Devices.Dumping;
@@ -318,7 +320,7 @@ public partial class Dump
minSpeed = currentSpeed;
UpdateProgress?.
- Invoke(string.Format(Localization.Core.Reading_byte_0_of_1_2_MiB_sec_, i * 512, romSize, currentSpeed),
+ Invoke(string.Format(Localization.Core.Reading_byte_0_of_1_2, i * 512, romSize, ByteSize.FromMegabytes(currentSpeed).Per(_oneSecond)),
(long)i * 512, romSize);
sense = _dev.Read10(out readBuffer, out senseBuf, 0, false, true, false, false, (uint)(startSector + i),
@@ -370,7 +372,7 @@ public partial class Dump
minSpeed = currentSpeed;
UpdateProgress?.
- Invoke(string.Format(Localization.Core.Reading_byte_0_of_1_2_MiB_sec_, romSectors * 512, romSize, currentSpeed),
+ Invoke(string.Format(Localization.Core.Reading_byte_0_of_1_2, romSectors * 512, romSize, ByteSize.FromMegabytes(currentSpeed).Per(_oneSecond)),
(long)romSectors * 512, romSize);
sense = _dev.Read10(out readBuffer, out senseBuf, 0, false, true, false, false, romSectors, 512, 0, 1,
@@ -403,19 +405,21 @@ public partial class Dump
UpdateStatus?.Invoke(string.Format(Localization.Core.Dump_finished_in_0_seconds, (end - start).TotalSeconds));
- UpdateStatus?.Invoke(string.Format(Localization.Core.Average_dump_speed_0_KiB_sec,
- 512 * (double)(romSectors + 1) / 1024 / (totalDuration / 1000)));
+ UpdateStatus?.Invoke(string.Format(Localization.Core.Average_dump_speed_0,
+ ByteSize.FromBytes(512 * (romSectors + 1)).
+ Per(totalDuration.Milliseconds())));
- UpdateStatus?.Invoke(string.Format(Localization.Core.Average_write_speed_0_KiB_sec,
- 512 * (double)(romSectors + 1) / 1024 / imageWriteDuration));
+ UpdateStatus?.Invoke(string.Format(Localization.Core.Average_write_speed_0,
+ ByteSize.FromBytes(512 * (romSectors + 1)).
+ Per(imageWriteDuration.Seconds())));
_dumpLog.WriteLine(Localization.Core.Dump_finished_in_0_seconds, (end - start).TotalSeconds);
- _dumpLog.WriteLine(Localization.Core.Average_dump_speed_0_KiB_sec,
- 512 * (double)(romSectors + 1) / 1024 / (totalDuration / 1000));
+ _dumpLog.WriteLine(string.Format(Localization.Core.Average_dump_speed_0,
+ ByteSize.FromBytes(512 * (romSectors + 1)).Per(totalDuration.Milliseconds())));
- _dumpLog.WriteLine(Localization.Core.Average_write_speed_0_KiB_sec,
- 512 * (double)(romSectors + 1) / 1024 / imageWriteDuration);
+ _dumpLog.WriteLine(string.Format(Localization.Core.Average_write_speed_0,
+ ByteSize.FromBytes(512 * (romSectors + 1)).Per(imageWriteDuration.Seconds())));
var metadata = new CommonTypes.Structs.ImageInfo
{
@@ -461,14 +465,16 @@ public partial class Dump
(end - start).TotalSeconds, totalDuration / 1000, totalChkDuration / 1000,
imageWriteDuration, (closeEnd - closeStart).TotalSeconds));
- UpdateStatus?.Invoke(string.Format(Localization.Core.Average_speed_0_MiB_sec,
- 512 * (double)(romSectors + 1) / 1048576 / (totalDuration / 1000)));
+ UpdateStatus?.Invoke(string.Format(Localization.Core.Average_speed_0,
+ ByteSize.FromBytes(512 * (romSectors + 1)).
+ Per(totalDuration.Milliseconds())));
if(maxSpeed > 0)
- UpdateStatus?.Invoke(string.Format(Localization.Core.Fastest_speed_burst_0_MiB_sec, maxSpeed));
+ UpdateStatus?.Invoke(string.Format(Localization.Core.Fastest_speed_burst_0, ByteSize.FromMegabytes(maxSpeed).Per(_oneSecond)));
if(minSpeed is > 0 and < double.MaxValue)
- UpdateStatus?.Invoke(string.Format(Localization.Core.Slowest_speed_burst_0_MiB_sec, minSpeed));
+ UpdateStatus?.Invoke(string.Format(Localization.Core.Slowest_speed_burst_0,
+ ByteSize.FromMegabytes(minSpeed).Per(_oneSecond)));
UpdateStatus?.Invoke("");
diff --git a/Aaru.Core/Devices/Dumping/Metadata.cs b/Aaru.Core/Devices/Dumping/Metadata.cs
index 867cdb19e..b6eeae90f 100644
--- a/Aaru.Core/Devices/Dumping/Metadata.cs
+++ b/Aaru.Core/Devices/Dumping/Metadata.cs
@@ -39,6 +39,8 @@ using Aaru.CommonTypes;
using Aaru.CommonTypes.AaruMetadata;
using Aaru.CommonTypes.Enums;
using Aaru.CommonTypes.Interfaces;
+using Humanizer;
+using Humanizer.Bytes;
namespace Aaru.Core.Devices.Dumping;
@@ -98,8 +100,8 @@ partial class Dump
totalChkDuration = (end - chkStart).TotalMilliseconds;
_dumpLog.WriteLine(Localization.Core.Sidecar_created_in_0_seconds, (end - chkStart).TotalSeconds);
- _dumpLog.WriteLine(Localization.Core.Average_checksum_speed_0_KiB_sec,
- blockSize * (double)(blocks + 1) / 1024 / (totalChkDuration / 1000));
+ _dumpLog.WriteLine(Localization.Core.Average_checksum_speed_0,
+ ByteSize.FromBytes(blockSize * (blocks + 1)).Per(totalChkDuration.Milliseconds()));
if(_preSidecar != null)
{
diff --git a/Aaru.Core/Devices/Dumping/MiniDisc.cs b/Aaru.Core/Devices/Dumping/MiniDisc.cs
index 7dc8d1a93..1b24ce3e6 100644
--- a/Aaru.Core/Devices/Dumping/MiniDisc.cs
+++ b/Aaru.Core/Devices/Dumping/MiniDisc.cs
@@ -47,6 +47,7 @@ using Aaru.Core.Graphics;
using Aaru.Core.Logging;
using Aaru.Decoders.SCSI;
using Aaru.Devices;
+using Humanizer;
using Humanizer.Bytes;
using Version = Aaru.CommonTypes.Interop.Version;
@@ -376,7 +377,7 @@ partial class Dump
minSpeed = currentSpeed;
UpdateProgress?.
- Invoke(string.Format(Localization.Core.Reading_sector_0_of_1_2_MiB_sec, i, blocks, currentSpeed),
+ Invoke(string.Format(Localization.Core.Reading_sector_0_of_1_2, i, blocks, ByteSize.FromMegabytes(currentSpeed).Per(_oneSecond)),
(long)i, (long)blocks);
sense = _dev.Read6(out readBuffer, out _, (uint)i, blockSize, (byte)blocksToRead, _dev.Timeout,
@@ -444,19 +445,23 @@ partial class Dump
UpdateStatus?.Invoke(string.Format(Localization.Core.Dump_finished_in_0_seconds, (end - start).TotalSeconds));
- UpdateStatus?.Invoke(string.Format(Localization.Core.Average_dump_speed_0_KiB_sec,
- blockSize * (double)(blocks + 1) / 1024 / (totalDuration / 1000)));
+ UpdateStatus?.Invoke(string.Format(Localization.Core.Average_dump_speed_0,
+ ByteSize.FromBytes(blockSize * (blocks + 1)).
+ Per(totalDuration.Milliseconds())));
- UpdateStatus?.Invoke(string.Format(Localization.Core.Average_write_speed_0_KiB_sec,
- blockSize * (double)(blocks + 1) / 1024 / imageWriteDuration));
+ UpdateStatus?.Invoke(string.Format(Localization.Core.Average_write_speed_0,
+ ByteSize.FromBytes(blockSize * (blocks + 1)).
+ Per(imageWriteDuration.Seconds())));
_dumpLog.WriteLine(Localization.Core.Dump_finished_in_0_seconds, (end - start).TotalSeconds);
- _dumpLog.WriteLine(Localization.Core.Average_dump_speed_0_KiB_sec,
- blockSize * (double)(blocks + 1) / 1024 / (totalDuration / 1000));
+ _dumpLog.WriteLine(string.Format(Localization.Core.Average_dump_speed_0,
+ ByteSize.FromBytes(blockSize * (blocks + 1)).
+ Per(totalDuration.Milliseconds())));
- _dumpLog.WriteLine(Localization.Core.Average_write_speed_0_KiB_sec,
- blockSize * (double)(blocks + 1) / 1024 / imageWriteDuration);
+ _dumpLog.WriteLine(string.Format(Localization.Core.Average_write_speed_0,
+ ByteSize.FromBytes(blockSize * (blocks + 1)).
+ Per(imageWriteDuration.Seconds())));
#region Trimming
if(_resume.BadBlocks.Count > 0 &&
@@ -772,14 +777,14 @@ partial class Dump
UpdateStatus?.Invoke(string.Format(Localization.Core.Sidecar_created_in_0_seconds,
(end - chkStart).TotalSeconds));
- UpdateStatus?.Invoke(string.Format(Localization.Core.Average_checksum_speed_0_KiB_sec,
- blockSize * (double)(blocks + 1) / 1024 /
- (totalChkDuration / 1000)));
+ UpdateStatus?.Invoke(string.Format(Localization.Core.Average_checksum_speed_0,
+ ByteSize.FromBytes(blockSize * (blocks + 1)).
+ Per(totalChkDuration.Milliseconds())));
_dumpLog.WriteLine(Localization.Core.Sidecar_created_in_0_seconds, (end - chkStart).TotalSeconds);
- _dumpLog.WriteLine(Localization.Core.Average_checksum_speed_0_KiB_sec,
- blockSize * (double)(blocks + 1) / 1024 / (totalChkDuration / 1000));
+ _dumpLog.WriteLine(Localization.Core.Average_checksum_speed_0,
+ ByteSize.FromBytes(blockSize * (blocks + 1)).Per(totalChkDuration.Milliseconds()));
if(_preSidecar != null)
{
@@ -858,14 +863,17 @@ partial class Dump
(end - start).TotalSeconds, totalDuration / 1000, totalChkDuration / 1000,
imageWriteDuration, (closeEnd - closeStart).TotalSeconds));
- UpdateStatus?.Invoke(string.Format(Localization.Core.Average_speed_0_MiB_sec,
- blockSize * (double)(blocks + 1) / 1048576 / (totalDuration / 1000)));
+ UpdateStatus?.Invoke(string.Format(Localization.Core.Average_speed_0,
+ ByteSize.FromBytes(blockSize * (blocks + 1)).
+ Per(totalDuration.Milliseconds())));
if(maxSpeed > 0)
- UpdateStatus?.Invoke(string.Format(Localization.Core.Fastest_speed_burst_0_MiB_sec, maxSpeed));
+ UpdateStatus?.Invoke(string.Format(Localization.Core.Fastest_speed_burst_0, ByteSize.FromMegabytes(maxSpeed).Per(_oneSecond)));
if(minSpeed is > 0 and < double.MaxValue)
- UpdateStatus?.Invoke(string.Format(Localization.Core.Slowest_speed_burst_0_MiB_sec, minSpeed));
+ UpdateStatus?.Invoke(string.Format(Localization.Core.Slowest_speed_burst_0,
+ ByteSize.FromMegabytes(minSpeed).Per(_oneSecond)));
+
UpdateStatus?.Invoke(string.Format(Localization.Core._0_sectors_could_not_be_read, _resume.BadBlocks.Count));
UpdateStatus?.Invoke("");
diff --git a/Aaru.Core/Devices/Dumping/PlayStationPortable/MemoryStick.cs b/Aaru.Core/Devices/Dumping/PlayStationPortable/MemoryStick.cs
index f8e8b14e3..ccbbc6129 100644
--- a/Aaru.Core/Devices/Dumping/PlayStationPortable/MemoryStick.cs
+++ b/Aaru.Core/Devices/Dumping/PlayStationPortable/MemoryStick.cs
@@ -47,6 +47,7 @@ using Aaru.Core.Graphics;
using Aaru.Core.Logging;
using Aaru.Decoders.SCSI;
using Aaru.Devices;
+using Humanizer;
using Humanizer.Bytes;
using Version = Aaru.CommonTypes.Interop.Version;
@@ -209,7 +210,7 @@ public partial class Dump
minSpeed = currentSpeed;
UpdateProgress?.
- Invoke(string.Format(Localization.Core.Reading_sector_0_of_1_2_MiB_sec, i, blocks, currentSpeed),
+ Invoke(string.Format(Localization.Core.Reading_sector_0_of_1_2, i, blocks, ByteSize.FromMegabytes(currentSpeed).Per(_oneSecond)),
(long)i, blocks);
sense = _dev.Read12(out readBuffer, out senseBuf, 0, false, true, false, false, (uint)i, blockSize, 0,
@@ -279,19 +280,23 @@ public partial class Dump
UpdateStatus?.Invoke(string.Format(Localization.Core.Dump_finished_in_0_seconds, (end - start).TotalSeconds));
- UpdateStatus?.Invoke(string.Format(Localization.Core.Average_dump_speed_0_KiB_sec,
- blockSize * (double)(blocks + 1) / 1024 / (totalDuration / 1000)));
+ UpdateStatus?.Invoke(string.Format(Localization.Core.Average_dump_speed_0,
+ ByteSize.FromBytes(blockSize * (blocks + 1)).
+ Per(totalDuration.Milliseconds())));
- UpdateStatus?.Invoke(string.Format(Localization.Core.Average_write_speed_0_KiB_sec,
- blockSize * (double)(blocks + 1) / 1024 / imageWriteDuration));
+ UpdateStatus?.Invoke(string.Format(Localization.Core.Average_write_speed_0,
+ ByteSize.FromBytes(blockSize * (blocks + 1)).
+ Per(imageWriteDuration.Seconds())));
_dumpLog.WriteLine(Localization.Core.Dump_finished_in_0_seconds, (end - start).TotalSeconds);
- _dumpLog.WriteLine(Localization.Core.Average_dump_speed_0_KiB_sec,
- blockSize * (double)(blocks + 1) / 1024 / (totalDuration / 1000));
+ _dumpLog.WriteLine(string.Format(Localization.Core.Average_dump_speed_0,
+ ByteSize.FromBytes(blockSize * (blocks + 1)).
+ Per(totalDuration.Milliseconds())));
- _dumpLog.WriteLine(Localization.Core.Average_write_speed_0_KiB_sec,
- blockSize * (double)(blocks + 1) / 1024 / imageWriteDuration);
+ _dumpLog.WriteLine(string.Format(Localization.Core.Average_write_speed_0,
+ ByteSize.FromBytes(blockSize * (blocks + 1)).
+ Per(imageWriteDuration.Seconds())));
#region Trimming
if(_resume.BadBlocks.Count > 0 &&
@@ -625,14 +630,14 @@ public partial class Dump
UpdateStatus?.Invoke(string.Format(Localization.Core.Sidecar_created_in_0_seconds,
(end - chkStart).TotalSeconds));
- UpdateStatus?.Invoke(string.Format(Localization.Core.Average_checksum_speed_0_KiB_sec,
- blockSize * (double)(blocks + 1) / 1024 /
- (totalChkDuration / 1000)));
+ UpdateStatus?.Invoke(string.Format(Localization.Core.Average_checksum_speed_0,
+ ByteSize.FromBytes(blockSize * (blocks + 1)).
+ Per(totalChkDuration.Milliseconds())));
_dumpLog.WriteLine(Localization.Core.Sidecar_created_in_0_seconds, (end - chkStart).TotalSeconds);
- _dumpLog.WriteLine(Localization.Core.Average_checksum_speed_0_KiB_sec,
- blockSize * (double)(blocks + 1) / 1024 / (totalChkDuration / 1000));
+ _dumpLog.WriteLine(Localization.Core.Average_checksum_speed_0,
+ ByteSize.FromBytes(blockSize * (blocks + 1)).Per(totalChkDuration.Milliseconds()));
if(_preSidecar != null)
{
@@ -700,14 +705,16 @@ public partial class Dump
(end - start).TotalSeconds, totalDuration / 1000, totalChkDuration / 1000,
imageWriteDuration, (closeEnd - closeStart).TotalSeconds));
- UpdateStatus?.Invoke(string.Format(Localization.Core.Average_speed_0_MiB_sec,
- blockSize * (double)(blocks + 1) / 1048576 / (totalDuration / 1000)));
+ UpdateStatus?.Invoke(string.Format(Localization.Core.Average_speed_0,
+ ByteSize.FromBytes(blockSize * (blocks + 1)).
+ Per(totalDuration.Milliseconds())));
if(maxSpeed > 0)
- UpdateStatus?.Invoke(string.Format(Localization.Core.Fastest_speed_burst_0_MiB_sec, maxSpeed));
+ UpdateStatus?.Invoke(string.Format(Localization.Core.Fastest_speed_burst_0, ByteSize.FromMegabytes(maxSpeed).Per(_oneSecond)));
if(minSpeed is > 0 and < double.MaxValue)
- UpdateStatus?.Invoke(string.Format(Localization.Core.Slowest_speed_burst_0_MiB_sec, minSpeed));
+ UpdateStatus?.Invoke(string.Format(Localization.Core.Slowest_speed_burst_0,
+ ByteSize.FromMegabytes(minSpeed).Per(_oneSecond)));
UpdateStatus?.Invoke(string.Format(Localization.Core._0_sectors_could_not_be_read, _resume.BadBlocks.Count));
UpdateStatus?.Invoke("");
diff --git a/Aaru.Core/Devices/Dumping/PlayStationPortable/UMD.cs b/Aaru.Core/Devices/Dumping/PlayStationPortable/UMD.cs
index 6e9b3000d..98a826495 100644
--- a/Aaru.Core/Devices/Dumping/PlayStationPortable/UMD.cs
+++ b/Aaru.Core/Devices/Dumping/PlayStationPortable/UMD.cs
@@ -45,6 +45,7 @@ using Aaru.Core.Graphics;
using Aaru.Core.Logging;
using Aaru.Decoders.SCSI;
using Aaru.Devices;
+using Humanizer;
using Humanizer.Bytes;
using Track = Aaru.CommonTypes.Structs.Track;
using TrackType = Aaru.CommonTypes.Enums.TrackType;
@@ -231,7 +232,7 @@ public partial class Dump
minSpeed = currentSpeed;
UpdateProgress?.
- Invoke(string.Format(Localization.Core.Reading_sector_0_of_1_2_MiB_sec, i, blocks, currentSpeed),
+ Invoke(string.Format(Localization.Core.Reading_sector_0_of_1_2, i, blocks, ByteSize.FromMegabytes(currentSpeed).Per(_oneSecond)),
(long)i, (long)blocks);
sense = _dev.Read12(out readBuffer, out senseBuf, 0, false, true, false, false, (uint)(umdStart + (i * 4)),
@@ -301,19 +302,23 @@ public partial class Dump
UpdateStatus?.Invoke(string.Format(Localization.Core.Dump_finished_in_0_seconds, (end - start).TotalSeconds));
- UpdateStatus?.Invoke(string.Format(Localization.Core.Average_dump_speed_0_KiB_sec,
- blockSize * (double)(blocks + 1) / 1024 / (totalDuration / 1000)));
+ UpdateStatus?.Invoke(string.Format(Localization.Core.Average_dump_speed_0,
+ ByteSize.FromBytes(blockSize * (blocks + 1)).
+ Per(totalDuration.Milliseconds())));
- UpdateStatus?.Invoke(string.Format(Localization.Core.Average_write_speed_0_KiB_sec,
- blockSize * (double)(blocks + 1) / 1024 / imageWriteDuration));
+ UpdateStatus?.Invoke(string.Format(Localization.Core.Average_write_speed_0,
+ ByteSize.FromBytes(blockSize * (blocks + 1)).
+ Per(imageWriteDuration.Seconds())));
_dumpLog.WriteLine(Localization.Core.Dump_finished_in_0_seconds, (end - start).TotalSeconds);
- _dumpLog.WriteLine(Localization.Core.Average_dump_speed_0_KiB_sec,
- blockSize * (double)(blocks + 1) / 1024 / (totalDuration / 1000));
+ _dumpLog.WriteLine(string.Format(Localization.Core.Average_dump_speed_0,
+ ByteSize.FromBytes(blockSize * (blocks + 1)).
+ Per(totalDuration.Milliseconds())));
- _dumpLog.WriteLine(Localization.Core.Average_write_speed_0_KiB_sec,
- blockSize * (double)(blocks + 1) / 1024 / imageWriteDuration);
+ _dumpLog.WriteLine(string.Format(Localization.Core.Average_write_speed_0,
+ ByteSize.FromBytes(blockSize * (blocks + 1)).
+ Per(imageWriteDuration.Seconds())));
#region Trimming
if(_resume.BadBlocks.Count > 0 &&
@@ -602,14 +607,16 @@ public partial class Dump
(end - start).TotalSeconds, totalDuration / 1000, totalChkDuration / 1000,
imageWriteDuration, (closeEnd - closeStart).TotalSeconds));
- UpdateStatus?.Invoke(string.Format(Localization.Core.Average_speed_0_MiB_sec,
- blockSize * (double)(blocks + 1) / 1048576 / (totalDuration / 1000)));
+ UpdateStatus?.Invoke(string.Format(Localization.Core.Average_speed_0,
+ ByteSize.FromBytes(blockSize * (blocks + 1)).
+ Per(totalDuration.Milliseconds())));
if(maxSpeed > 0)
- UpdateStatus?.Invoke(string.Format(Localization.Core.Fastest_speed_burst_0_MiB_sec, maxSpeed));
+ UpdateStatus?.Invoke(string.Format(Localization.Core.Fastest_speed_burst_0, ByteSize.FromMegabytes(maxSpeed).Per(_oneSecond)));
if(minSpeed is > 0 and < double.MaxValue)
- UpdateStatus?.Invoke(string.Format(Localization.Core.Slowest_speed_burst_0_MiB_sec, minSpeed));
+ UpdateStatus?.Invoke(string.Format(Localization.Core.Slowest_speed_burst_0,
+ ByteSize.FromMegabytes(minSpeed).Per(_oneSecond)));
UpdateStatus?.Invoke(string.Format(Localization.Core._0_sectors_could_not_be_read, _resume.BadBlocks.Count));
UpdateStatus?.Invoke("");
diff --git a/Aaru.Core/Devices/Dumping/SSC.cs b/Aaru.Core/Devices/Dumping/SSC.cs
index 04b1aea26..2259e94b3 100644
--- a/Aaru.Core/Devices/Dumping/SSC.cs
+++ b/Aaru.Core/Devices/Dumping/SSC.cs
@@ -48,6 +48,8 @@ using Aaru.Decoders.SCSI;
using Aaru.Decoders.SCSI.SSC;
using Aaru.Devices;
using Aaru.Helpers;
+using Humanizer;
+using Humanizer.Bytes;
using TapeFile = Aaru.CommonTypes.Structs.TapeFile;
using TapePartition = Aaru.CommonTypes.Structs.TapePartition;
using Version = Aaru.CommonTypes.Interop.Version;
@@ -894,8 +896,8 @@ partial class Dump
currentSpeed > 0)
minSpeed = currentSpeed;
- PulseProgress?.Invoke(string.Format(Localization.Core.Reading_block_0_1_MiB_sec, currentBlock,
- currentSpeed));
+ PulseProgress?.Invoke(string.Format(Localization.Core.Reading_block_0_1, currentBlock,
+ ByteSize.FromBytes(currentSpeed).Per(_oneSecond)));
sense = _dev.Read6(out cmdBuf, out senseBuf, false, fixedLen, transferLen, blockSize, _dev.Timeout,
out duration);
@@ -1104,19 +1106,23 @@ partial class Dump
UpdateStatus?.Invoke(string.Format(Localization.Core.Dump_finished_in_0_seconds, (end - start).TotalSeconds));
- UpdateStatus?.Invoke(string.Format(Localization.Core.Average_dump_speed_0_KiB_sec,
- blockSize * (double)(blocks + 1) / 1024 / (totalDuration / 1000)));
+ UpdateStatus?.Invoke(string.Format(Localization.Core.Average_dump_speed_0,
+ ByteSize.FromBytes(blockSize * (blocks + 1)).
+ Per(totalDuration.Milliseconds())));
- UpdateStatus?.Invoke(string.Format(Localization.Core.Average_write_speed_0_KiB_sec,
- blockSize * (double)(blocks + 1) / 1024 / imageWriteDuration));
+ UpdateStatus?.Invoke(string.Format(Localization.Core.Average_write_speed_0,
+ ByteSize.FromBytes(blockSize * (blocks + 1)).
+ Per(imageWriteDuration.Seconds())));
_dumpLog.WriteLine(Localization.Core.Dump_finished_in_0_seconds, (end - start).TotalSeconds);
- _dumpLog.WriteLine(Localization.Core.Average_dump_speed_0_KiB_sec,
- blockSize * (double)(blocks + 1) / 1024 / (totalDuration / 1000));
+ _dumpLog.WriteLine(string.Format(Localization.Core.Average_dump_speed_0,
+ ByteSize.FromBytes(blockSize * (blocks + 1)).
+ Per(totalDuration.Milliseconds())));
- _dumpLog.WriteLine(Localization.Core.Average_write_speed_0_KiB_sec,
- blockSize * (double)(blocks + 1) / 1024 / imageWriteDuration);
+ _dumpLog.WriteLine(string.Format(Localization.Core.Average_write_speed_0,
+ ByteSize.FromBytes(blockSize * (blocks + 1)).
+ Per(imageWriteDuration.Seconds())));
#region Error handling
if(_resume.BadBlocks.Count > 0 &&
@@ -1376,14 +1382,14 @@ partial class Dump
UpdateStatus?.Invoke(string.Format(Localization.Core.Sidecar_created_in_0_seconds,
(end - chkStart).TotalSeconds));
- UpdateStatus?.Invoke(string.Format(Localization.Core.Average_checksum_speed_0_KiB_sec,
- blockSize * (double)(blocks + 1) / 1024 /
- (totalChkDuration / 1000)));
+ UpdateStatus?.Invoke(string.Format(Localization.Core.Average_checksum_speed_0,
+ ByteSize.FromBytes(blockSize * (blocks + 1)).
+ Per(totalChkDuration.Milliseconds())));
_dumpLog.WriteLine(Localization.Core.Sidecar_created_in_0_seconds, (end - chkStart).TotalSeconds);
- _dumpLog.WriteLine(Localization.Core.Average_checksum_speed_0_KiB_sec,
- blockSize * (double)(blocks + 1) / 1024 / (totalChkDuration / 1000));
+ _dumpLog.WriteLine(Localization.Core.Average_checksum_speed_0,
+ ByteSize.FromBytes(blockSize * (blocks + 1)).Per(totalChkDuration.Milliseconds()));
if(_preSidecar != null)
{
@@ -1463,14 +1469,16 @@ partial class Dump
(end - start).TotalSeconds, totalDuration / 1000, totalChkDuration / 1000,
imageWriteDuration, (closeEnd - closeStart).TotalSeconds));
- UpdateStatus?.Invoke(string.Format(Localization.Core.Average_speed_0_MiB_sec,
- blockSize * (double)(blocks + 1) / 1048576 / (totalDuration / 1000)));
+ UpdateStatus?.Invoke(string.Format(Localization.Core.Average_speed_0,
+ ByteSize.FromBytes(blockSize * (blocks + 1)).
+ Per(totalDuration.Milliseconds())));
if(maxSpeed > 0)
- UpdateStatus?.Invoke(string.Format(Localization.Core.Fastest_speed_burst_0_MiB_sec, maxSpeed));
+ UpdateStatus?.Invoke(string.Format(Localization.Core.Fastest_speed_burst_0, ByteSize.FromMegabytes(maxSpeed).Per(_oneSecond)));
if(minSpeed is > 0 and < double.MaxValue)
- UpdateStatus?.Invoke(string.Format(Localization.Core.Slowest_speed_burst_0_MiB_sec, minSpeed));
+ UpdateStatus?.Invoke(string.Format(Localization.Core.Slowest_speed_burst_0,
+ ByteSize.FromMegabytes(minSpeed).Per(_oneSecond)));
UpdateStatus?.Invoke(string.Format(Localization.Core._0_sectors_could_not_be_read, _resume.BadBlocks.Count));
UpdateStatus?.Invoke("");
diff --git a/Aaru.Core/Devices/Dumping/Sbc/Data.cs b/Aaru.Core/Devices/Dumping/Sbc/Data.cs
index a0b5ae166..bb14877f8 100644
--- a/Aaru.Core/Devices/Dumping/Sbc/Data.cs
+++ b/Aaru.Core/Devices/Dumping/Sbc/Data.cs
@@ -35,6 +35,8 @@ using Aaru.Core.Logging;
using Aaru.Decoders.DVD;
using Aaru.Decryption;
using Aaru.Decryption.DVD;
+using Humanizer;
+using Humanizer.Bytes;
using DVDDecryption = Aaru.Decryption.DVD.Dump;
// ReSharper disable JoinDeclarationAndInitializer
@@ -99,7 +101,7 @@ partial class Dump
minSpeed = currentSpeed;
UpdateProgress?.
- Invoke(string.Format(Localization.Core.Reading_sector_0_of_1_2_MiB_sec, i, blocks, currentSpeed),
+ Invoke(string.Format(Localization.Core.Reading_sector_0_of_1_2, i, blocks, ByteSize.FromMegabytes(currentSpeed).Per(_oneSecond)),
(long)i, (long)blocks);
sense = scsiReader.ReadBlocks(out buffer, i, blocksToRead, out double cmdDuration, out _, out _);
diff --git a/Aaru.Core/Devices/Dumping/Sbc/Dump.cs b/Aaru.Core/Devices/Dumping/Sbc/Dump.cs
index ed38a1b60..0fcb55fe2 100644
--- a/Aaru.Core/Devices/Dumping/Sbc/Dump.cs
+++ b/Aaru.Core/Devices/Dumping/Sbc/Dump.cs
@@ -52,6 +52,7 @@ using Aaru.Decoders.DVD;
using Aaru.Decoders.SCSI;
using Aaru.Decoders.SCSI.MMC;
using Aaru.Devices;
+using Humanizer;
using Humanizer.Bytes;
using DVDDecryption = Aaru.Decryption.DVD.Dump;
using Track = Aaru.CommonTypes.Structs.Track;
@@ -765,19 +766,23 @@ partial class Dump
UpdateStatus?.Invoke(string.Format(Localization.Core.Dump_finished_in_0_seconds, (end - start).TotalSeconds));
- UpdateStatus?.Invoke(string.Format(Localization.Core.Average_dump_speed_0_KiB_sec,
- blockSize * (double)(blocks + 1) / 1024 / (totalDuration / 1000)));
+ UpdateStatus?.Invoke(string.Format(Localization.Core.Average_dump_speed_0,
+ ByteSize.FromBytes(blockSize * (blocks + 1)).
+ Per(totalDuration.Milliseconds())));
- UpdateStatus?.Invoke(string.Format(Localization.Core.Average_write_speed_0_KiB_sec,
- blockSize * (double)(blocks + 1) / 1024 / imageWriteDuration));
+ UpdateStatus?.Invoke(string.Format(Localization.Core.Average_write_speed_0,
+ ByteSize.FromBytes(blockSize * (blocks + 1)).
+ Per(imageWriteDuration.Seconds())));
_dumpLog.WriteLine(Localization.Core.Dump_finished_in_0_seconds, (end - start).TotalSeconds);
- _dumpLog.WriteLine(Localization.Core.Average_dump_speed_0_KiB_sec,
- blockSize * (double)(blocks + 1) / 1024 / (totalDuration / 1000));
+ _dumpLog.WriteLine(string.Format(Localization.Core.Average_dump_speed_0,
+ ByteSize.FromBytes(blockSize * (blocks + 1)).
+ Per(totalDuration.Milliseconds())));
- _dumpLog.WriteLine(Localization.Core.Average_write_speed_0_KiB_sec,
- blockSize * (double)(blocks + 1) / 1024 / imageWriteDuration);
+ _dumpLog.WriteLine(string.Format(Localization.Core.Average_write_speed_0,
+ ByteSize.FromBytes(blockSize * (blocks + 1)).
+ Per(imageWriteDuration.Seconds())));
#region Trimming
if(_resume.BadBlocks.Count > 0 &&
@@ -1061,14 +1066,15 @@ partial class Dump
UpdateStatus?.Invoke(string.Format(Localization.Core.Sidecar_created_in_0_seconds,
(end - chkStart).TotalSeconds));
- UpdateStatus?.Invoke(string.Format(Localization.Core.Average_checksum_speed_0_KiB_sec,
- blockSize * (double)(blocks + 1) / 1024 /
- (totalChkDuration / 1000)));
+ UpdateStatus?.Invoke(string.Format(Localization.Core.Average_checksum_speed_0,
+ ByteSize.FromBytes(blockSize * (blocks + 1)).
+ Per(totalChkDuration.Milliseconds())));
_dumpLog.WriteLine(Localization.Core.Sidecar_created_in_0_seconds, (end - chkStart).TotalSeconds);
- _dumpLog.WriteLine(Localization.Core.Average_checksum_speed_0_KiB_sec,
- blockSize * (double)(blocks + 1) / 1024 / (totalChkDuration / 1000));
+ _dumpLog.WriteLine(Localization.Core.Average_checksum_speed_0,
+ ByteSize.FromBytes(blockSize * (blocks + 1)).
+ Per(totalChkDuration.Milliseconds()));
if(_preSidecar != null)
{
@@ -1287,14 +1293,16 @@ partial class Dump
(end - start).TotalSeconds, totalDuration / 1000, totalChkDuration / 1000,
imageWriteDuration, (closeEnd - closeStart).TotalSeconds));
- UpdateStatus?.Invoke(string.Format(Localization.Core.Average_speed_0_MiB_sec,
- blockSize * (double)(blocks + 1) / 1048576 / (totalDuration / 1000)));
+ UpdateStatus?.Invoke(string.Format(Localization.Core.Average_speed_0,
+ ByteSize.FromBytes(blockSize * (blocks + 1)).
+ Per(totalDuration.Milliseconds())));
if(maxSpeed > 0)
- UpdateStatus?.Invoke(string.Format(Localization.Core.Fastest_speed_burst_0_MiB_sec, maxSpeed));
+ UpdateStatus?.Invoke(string.Format(Localization.Core.Fastest_speed_burst_0, ByteSize.FromMegabytes(maxSpeed).Per(_oneSecond)));
if(minSpeed is > 0 and < double.MaxValue)
- UpdateStatus?.Invoke(string.Format(Localization.Core.Slowest_speed_burst_0_MiB_sec, minSpeed));
+ UpdateStatus?.Invoke(string.Format(Localization.Core.Slowest_speed_burst_0,
+ ByteSize.FromMegabytes(minSpeed).Per(_oneSecond)));
UpdateStatus?.Invoke(string.Format(Localization.Core._0_sectors_could_not_be_read, _resume.BadBlocks.Count));
UpdateStatus?.Invoke("");
diff --git a/Aaru.Core/Devices/Dumping/Sbc/Optical.cs b/Aaru.Core/Devices/Dumping/Sbc/Optical.cs
index 0a19a4a20..f02875ce5 100644
--- a/Aaru.Core/Devices/Dumping/Sbc/Optical.cs
+++ b/Aaru.Core/Devices/Dumping/Sbc/Optical.cs
@@ -11,6 +11,8 @@ using Aaru.Console;
using Aaru.Core.Logging;
using Aaru.Decoders.SCSI;
using Aaru.Helpers;
+using Humanizer;
+using Humanizer.Bytes;
namespace Aaru.Core.Devices.Dumping;
@@ -206,7 +208,7 @@ partial class Dump
minSpeed = currentSpeed;
UpdateProgress?.
- Invoke(string.Format(Localization.Core.Reading_sector_0_of_1_2_MiB_sec, i, blocks, currentSpeed),
+ Invoke(string.Format(Localization.Core.Reading_sector_0_of_1_2, i, blocks, ByteSize.FromMegabytes(currentSpeed).Per(_oneSecond)),
(long)i, (long)blocks);
sense = scsiReader.ReadBlocks(out buffer, i, blocksToRead, out double cmdDuration, out _, out _);
diff --git a/Aaru.Core/Devices/Dumping/SecureDigital.cs b/Aaru.Core/Devices/Dumping/SecureDigital.cs
index 9add611d7..c038e89ad 100644
--- a/Aaru.Core/Devices/Dumping/SecureDigital.cs
+++ b/Aaru.Core/Devices/Dumping/SecureDigital.cs
@@ -46,6 +46,8 @@ using Aaru.Core.Graphics;
using Aaru.Core.Logging;
using Aaru.Decoders.MMC;
using Aaru.Decoders.SecureDigital;
+using Humanizer;
+using Humanizer.Bytes;
using CSD = Aaru.Decoders.MMC.CSD;
using DeviceType = Aaru.CommonTypes.Enums.DeviceType;
using Version = Aaru.CommonTypes.Interop.Version;
@@ -648,7 +650,7 @@ public partial class Dump
minSpeed = currentSpeed;
UpdateProgress?.
- Invoke(string.Format(Localization.Core.Reading_sector_0_of_1_2_MiB_sec, i, blocks, currentSpeed),
+ Invoke(string.Format(Localization.Core.Reading_sector_0_of_1_2, i, blocks, ByteSize.FromMegabytes(currentSpeed).Per(_oneSecond)),
(long)i, (long)blocks);
if(blocksToRead == 1)
@@ -718,19 +720,23 @@ public partial class Dump
UpdateStatus?.Invoke(string.Format(Localization.Core.Dump_finished_in_0_seconds, (end - start).TotalSeconds));
- UpdateStatus?.Invoke(string.Format(Localization.Core.Average_dump_speed_0_KiB_sec,
- blockSize * (double)(blocks + 1) / 1024 / (totalDuration / 1000)));
+ UpdateStatus?.Invoke(string.Format(Localization.Core.Average_dump_speed_0,
+ ByteSize.FromBytes(blockSize * (blocks + 1)).
+ Per(totalDuration.Milliseconds())));
- UpdateStatus?.Invoke(string.Format(Localization.Core.Average_write_speed_0_KiB_sec,
- blockSize * (double)(blocks + 1) / 1024 / imageWriteDuration));
+ UpdateStatus?.Invoke(string.Format(Localization.Core.Average_dump_speed_0,
+ ByteSize.FromBytes(blockSize * (blocks + 1)).
+ Per(imageWriteDuration.Seconds())));
_dumpLog.WriteLine(Localization.Core.Dump_finished_in_0_seconds, (end - start).TotalSeconds);
- _dumpLog.WriteLine(Localization.Core.Average_dump_speed_0_KiB_sec,
- blockSize * (double)(blocks + 1) / 1024 / (totalDuration / 1000));
+ _dumpLog.WriteLine(string.Format(Localization.Core.Average_dump_speed_0,
+ ByteSize.FromBytes(blockSize * (blocks + 1)).
+ Per(totalDuration.Milliseconds())));
- _dumpLog.WriteLine(Localization.Core.Average_write_speed_0_KiB_sec,
- blockSize * (double)(blocks + 1) / 1024 / imageWriteDuration);
+ _dumpLog.WriteLine(string.Format(Localization.Core.Average_dump_speed_0,
+ ByteSize.FromBytes(blockSize * (blocks + 1)).
+ Per(imageWriteDuration.Seconds())));
#region Trimming
if(_resume.BadBlocks.Count > 0 &&
@@ -933,14 +939,14 @@ public partial class Dump
UpdateStatus?.Invoke(string.Format(Localization.Core.Sidecar_created_in_0_seconds,
(end - chkStart).TotalSeconds));
- UpdateStatus?.Invoke(string.Format(Localization.Core.Average_checksum_speed_0_KiB_sec,
- blockSize * (double)(blocks + 1) / 1024 /
- (totalChkDuration / 1000)));
+ UpdateStatus?.Invoke(string.Format(Localization.Core.Average_checksum_speed_0,
+ ByteSize.FromBytes(blockSize * (blocks + 1)).
+ Per(totalChkDuration.Milliseconds())));
_dumpLog.WriteLine(Localization.Core.Sidecar_created_in_0_seconds, (end - chkStart).TotalSeconds);
- _dumpLog.WriteLine(Localization.Core.Average_checksum_speed_0_KiB_sec,
- blockSize * (double)(blocks + 1) / 1024 / (totalChkDuration / 1000));
+ _dumpLog.WriteLine(Localization.Core.Average_checksum_speed_0,
+ ByteSize.FromBytes(blockSize * (blocks + 1)).Per(totalChkDuration.Milliseconds()));
(string type, string subType) xmlType = (null, null);
@@ -995,14 +1001,16 @@ public partial class Dump
(end - start).TotalSeconds, totalDuration / 1000, totalChkDuration / 1000,
imageWriteDuration, (closeEnd - closeStart).TotalSeconds));
- UpdateStatus?.Invoke(string.Format(Localization.Core.Average_speed_0_MiB_sec,
- blockSize * (double)(blocks + 1) / 1048576 / (totalDuration / 1000)));
+ UpdateStatus?.Invoke(string.Format(Localization.Core.Average_speed_0,
+ ByteSize.FromBytes(blockSize * (blocks + 1)).
+ Per(totalDuration.Milliseconds())));
if(maxSpeed > 0)
- UpdateStatus?.Invoke(string.Format(Localization.Core.Fastest_speed_burst_0_MiB_sec, maxSpeed));
+ UpdateStatus?.Invoke(string.Format(Localization.Core.Fastest_speed_burst_0, ByteSize.FromMegabytes(maxSpeed).Per(_oneSecond)));
if(minSpeed is > 0 and < double.MaxValue)
- UpdateStatus?.Invoke(string.Format(Localization.Core.Slowest_speed_burst_0_MiB_sec, minSpeed));
+ UpdateStatus?.Invoke(string.Format(Localization.Core.Slowest_speed_burst_0,
+ ByteSize.FromMegabytes(minSpeed).Per(_oneSecond)));
UpdateStatus?.Invoke(string.Format(Localization.Core._0_sectors_could_not_be_read, _resume.BadBlocks.Count));
UpdateStatus?.Invoke("");
diff --git a/Aaru.Core/Devices/Dumping/XGD.cs b/Aaru.Core/Devices/Dumping/XGD.cs
index fce741e4b..efd25fece 100644
--- a/Aaru.Core/Devices/Dumping/XGD.cs
+++ b/Aaru.Core/Devices/Dumping/XGD.cs
@@ -49,6 +49,8 @@ using Aaru.Decoders.DVD;
using Aaru.Decoders.SCSI;
using Aaru.Decoders.Xbox;
using Aaru.Devices;
+using Humanizer;
+using Humanizer.Bytes;
using Device = Aaru.Devices.Remote.Device;
using Layers = Aaru.CommonTypes.AaruMetadata.Layers;
using PlatformID = Aaru.CommonTypes.Interop.PlatformID;
@@ -646,7 +648,7 @@ partial class Dump
minSpeed = currentSpeed;
UpdateProgress?.
- Invoke(string.Format(Localization.Core.Reading_sector_0_of_1_2_MiB_sec, i, totalSize, currentSpeed),
+ Invoke(string.Format(Localization.Core.Reading_sector_0_of_1_2, i, blocks, ByteSize.FromMegabytes(currentSpeed).Per(_oneSecond)),
(long)i, (long)totalSize);
sense = _dev.Read12(out readBuffer, out senseBuf, 0, false, false, false, false, (uint)i, blockSize, 0,
@@ -778,7 +780,7 @@ partial class Dump
blocksToRead = (uint)(middleZone - 1 - middle);
UpdateProgress?.
- Invoke(string.Format(Localization.Core.Reading_sector_0_of_1_2_MiB_sec, middle + currentSector, totalSize, currentSpeed),
+ Invoke(string.Format(Localization.Core.Reading_sector_0_of_1_2, middle + currentSector, totalSize, ByteSize.FromMegabytes(currentSpeed).Per(_oneSecond)),
(long)(middle + currentSector), (long)totalSize);
mhddLog.Write(middle + currentSector, cmdDuration, blocksToRead);
@@ -847,7 +849,7 @@ partial class Dump
minSpeed = currentSpeed;
UpdateProgress?.
- Invoke(string.Format(Localization.Core.Reading_sector_0_of_1_2_MiB_sec, currentSector, totalSize, currentSpeed),
+ Invoke(string.Format(Localization.Core.Reading_sector_0_of_1_2, currentSector, totalSize, ByteSize.FromMegabytes(currentSpeed).Per(_oneSecond)),
(long)currentSector, (long)totalSize);
sense = _dev.Read12(out readBuffer, out senseBuf, 0, false, false, false, false, (uint)l1, blockSize, 0,
@@ -945,19 +947,23 @@ partial class Dump
UpdateStatus?.Invoke(string.Format(Localization.Core.Dump_finished_in_0_seconds, (end - start).TotalSeconds));
- UpdateStatus?.Invoke(string.Format(Localization.Core.Average_dump_speed_0_KiB_sec,
- blockSize * (double)(blocks + 1) / 1024 / (totalDuration / 1000)));
+ UpdateStatus?.Invoke(string.Format(Localization.Core.Average_dump_speed_0,
+ ByteSize.FromBytes(blockSize * (blocks + 1)).
+ Per(totalDuration.Milliseconds())));
- UpdateStatus?.Invoke(string.Format(Localization.Core.Average_write_speed_0_KiB_sec,
- blockSize * (double)(blocks + 1) / 1024 / imageWriteDuration));
+ UpdateStatus?.Invoke(string.Format(Localization.Core.Average_write_speed_0,
+ ByteSize.FromBytes(blockSize * (blocks + 1)).
+ Per(imageWriteDuration.Seconds())));
_dumpLog.WriteLine(Localization.Core.Dump_finished_in_0_seconds, (end - start).TotalSeconds);
- _dumpLog.WriteLine(Localization.Core.Average_dump_speed_0_KiB_sec,
- blockSize * (double)(blocks + 1) / 1024 / (totalDuration / 1000));
+ _dumpLog.WriteLine(string.Format(Localization.Core.Average_dump_speed_0,
+ ByteSize.FromBytes(blockSize * (blocks + 1)).
+ Per(totalDuration.Milliseconds())));
- _dumpLog.WriteLine(Localization.Core.Average_write_speed_0_KiB_sec,
- blockSize * (double)(blocks + 1) / 1024 / imageWriteDuration);
+ _dumpLog.WriteLine(string.Format(Localization.Core.Average_write_speed_0,
+ ByteSize.FromBytes(blockSize * (blocks + 1)).
+ Per(imageWriteDuration.Seconds())));
#region Trimming
if(_resume.BadBlocks.Count > 0 &&
@@ -1063,7 +1069,7 @@ partial class Dump
if(dcMode6.HasValue)
foreach(Modes.ModePage modePage in dcMode6.Value.Pages.Where(modePage =>
- modePage is { Page: 0x01, Subpage: 0x00 }))
+ modePage is { Page: 0x01, Subpage: 0x00 }))
currentModePage = modePage;
}
@@ -1317,14 +1323,17 @@ partial class Dump
(end - start).TotalSeconds, totalDuration / 1000, totalChkDuration / 1000,
imageWriteDuration, (closeEnd - closeStart).TotalSeconds));
- UpdateStatus?.Invoke(string.Format(Localization.Core.Average_speed_0_MiB_sec,
- blockSize * (double)(blocks + 1) / 1048576 / (totalDuration / 1000)));
+ UpdateStatus?.Invoke(string.Format(Localization.Core.Average_speed_0,
+ ByteSize.FromBytes(blockSize * (blocks + 1)).
+ Per(totalDuration.Milliseconds())));
if(maxSpeed > 0)
- UpdateStatus?.Invoke(string.Format(Localization.Core.Fastest_speed_burst_0_MiB_sec, maxSpeed));
+ UpdateStatus?.Invoke(string.Format(Localization.Core.Fastest_speed_burst_0,
+ ByteSize.FromMegabytes(maxSpeed).Per(_oneSecond)));
if(minSpeed is > 0 and < double.MaxValue)
- UpdateStatus?.Invoke(string.Format(Localization.Core.Slowest_speed_burst_0_MiB_sec, minSpeed));
+ UpdateStatus?.Invoke(string.Format(Localization.Core.Slowest_speed_burst_0,
+ ByteSize.FromMegabytes(minSpeed).Per(_oneSecond)));
UpdateStatus?.Invoke(string.Format(Localization.Core._0_sectors_could_not_be_read, _resume.BadBlocks.Count));
UpdateStatus?.Invoke("");
diff --git a/Aaru.Core/Devices/Scanning/ATA.cs b/Aaru.Core/Devices/Scanning/ATA.cs
index 1dc35f8b9..d932a96e4 100644
--- a/Aaru.Core/Devices/Scanning/ATA.cs
+++ b/Aaru.Core/Devices/Scanning/ATA.cs
@@ -34,6 +34,8 @@ using System;
using System.Collections.Generic;
using Aaru.CommonTypes.Structs.Devices.ATA;
using Aaru.Core.Logging;
+using Humanizer;
+using Humanizer.Bytes;
namespace Aaru.Core.Devices.Scanning;
@@ -150,7 +152,7 @@ public sealed partial class MediaScan
results.MinSpeed = currentSpeed;
UpdateProgress?.
- Invoke(string.Format(Localization.Core.Reading_sector_0_of_1_2_MiB_sec, i, results.Blocks, currentSpeed),
+ Invoke(string.Format(Localization.Core.Reading_sector_0_of_1_2, i, results.Blocks, ByteSize.FromMegabytes(currentSpeed).Per(_oneSecond)),
(long)i, (long)results.Blocks);
bool error = ataReader.ReadBlocks(out cmdBuf, i, blocksToRead, out duration, out _, out _);
@@ -281,9 +283,9 @@ public sealed partial class MediaScan
currentSpeed > 0)
results.MinSpeed = currentSpeed;
- PulseProgress?.
- Invoke(string.Format(Localization.Core.Reading_cylinder_0_head_1_sector_2_3_MiB_sec, cy,
- hd, sc, currentSpeed));
+ PulseProgress?.Invoke(string.Format(Localization.Core.Reading_cylinder_0_head_1_sector_2_3,
+ cy, hd, sc,
+ ByteSize.FromMegabytes(currentSpeed).Per(_oneSecond)));
bool error = ataReader.ReadChs(out cmdBuf, cy, hd, sc, out duration, out _);
diff --git a/Aaru.Core/Devices/Scanning/MediaScan.cs b/Aaru.Core/Devices/Scanning/MediaScan.cs
index 039ec22e0..1df654127 100644
--- a/Aaru.Core/Devices/Scanning/MediaScan.cs
+++ b/Aaru.Core/Devices/Scanning/MediaScan.cs
@@ -34,18 +34,20 @@ using System;
using Aaru.CommonTypes;
using Aaru.CommonTypes.Enums;
using Aaru.Devices;
+using Humanizer;
namespace Aaru.Core.Devices.Scanning;
public sealed partial class MediaScan
{
- readonly Device _dev;
- readonly string _devicePath;
- readonly string _ibgLogPath;
- readonly string _mhddLogPath;
- readonly bool _seekTest;
- readonly bool _useBufferedReads;
- bool _aborted;
+ readonly Device _dev;
+ readonly string _devicePath;
+ readonly string _ibgLogPath;
+ readonly string _mhddLogPath;
+ readonly bool _seekTest;
+ readonly bool _useBufferedReads;
+ bool _aborted;
+ static readonly TimeSpan _oneSecond = 1.Seconds();
/// Path to a MHDD log file
/// Path to a IMGBurn log file
diff --git a/Aaru.Core/Devices/Scanning/SCSI.cs b/Aaru.Core/Devices/Scanning/SCSI.cs
index 1c5e86ef8..583636abc 100644
--- a/Aaru.Core/Devices/Scanning/SCSI.cs
+++ b/Aaru.Core/Devices/Scanning/SCSI.cs
@@ -40,6 +40,7 @@ using Aaru.Decoders.CD;
using Aaru.Decoders.SCSI;
using Aaru.Decoders.SCSI.MMC;
using Aaru.Devices;
+using Humanizer;
using Humanizer.Bytes;
namespace Aaru.Core.Devices.Scanning;
@@ -363,7 +364,7 @@ public sealed partial class MediaScan
results.MinSpeed = currentSpeed;
UpdateProgress?.
- Invoke(string.Format(Localization.Core.Reading_sector_0_of_1_2_MiB_sec, i, results.Blocks, currentSpeed),
+ Invoke(string.Format(Localization.Core.Reading_sector_0_of_1_2, i, results.Blocks, ByteSize.FromMegabytes(currentSpeed).Per(_oneSecond)),
(long)i, (long)results.Blocks);
if(readcd)
@@ -520,7 +521,7 @@ public sealed partial class MediaScan
results.MinSpeed = currentSpeed;
UpdateProgress?.
- Invoke(string.Format(Localization.Core.Reading_sector_0_of_1_2_MiB_sec, i, results.Blocks, currentSpeed),
+ Invoke(string.Format(Localization.Core.Reading_sector_0_of_1_2, i, results.Blocks, ByteSize.FromMegabytes(currentSpeed).Per(_oneSecond)),
(long)i, (long)results.Blocks);
sense = scsiReader.ReadBlocks(out _, i, blocksToRead, out double cmdDuration, out _, out _);
diff --git a/Aaru.Core/Devices/Scanning/SecureDigital.cs b/Aaru.Core/Devices/Scanning/SecureDigital.cs
index a50a18107..93d09543a 100644
--- a/Aaru.Core/Devices/Scanning/SecureDigital.cs
+++ b/Aaru.Core/Devices/Scanning/SecureDigital.cs
@@ -37,6 +37,8 @@ using System.Collections.Generic;
using Aaru.Core.Logging;
using Aaru.Decoders.MMC;
using Aaru.Decoders.SecureDigital;
+using Humanizer;
+using Humanizer.Bytes;
using CSD = Aaru.Decoders.MMC.CSD;
using DeviceType = Aaru.CommonTypes.Enums.DeviceType;
@@ -243,7 +245,7 @@ public sealed partial class MediaScan
results.MinSpeed = currentSpeed;
UpdateProgress?.
- Invoke(string.Format(Localization.Core.Reading_sector_0_of_1_2_MiB_sec, i, results.Blocks, currentSpeed),
+ Invoke(string.Format(Localization.Core.Reading_sector_0_of_1_2, i, results.Blocks, ByteSize.FromBytes(currentSpeed).Per(_oneSecond)),
(long)i, (long)results.Blocks);
bool error;
diff --git a/Aaru.Gui/ViewModels/Windows/MediaScanViewModel.cs b/Aaru.Gui/ViewModels/Windows/MediaScanViewModel.cs
index 90452892f..671193e51 100644
--- a/Aaru.Gui/ViewModels/Windows/MediaScanViewModel.cs
+++ b/Aaru.Gui/ViewModels/Windows/MediaScanViewModel.cs
@@ -43,6 +43,8 @@ using Aaru.Localization;
using Avalonia.Controls;
using Avalonia.Media;
using Avalonia.Threading;
+using Humanizer;
+using Humanizer.Bytes;
using MsBox.Avalonia;
using MsBox.Avalonia.Enums;
@@ -399,9 +401,15 @@ public sealed class MediaScanViewModel : ViewModelBase
TotalTime = string.Format(Localization.Core.Took_a_total_of_0_seconds_1_processing_commands,
results.TotalTime, results.ProcessingTime);
- AvgSpeed = string.Format(Localization.Core.Average_speed_0_MiB_sec, results.AvgSpeed);
- MaxSpeed = string.Format(Localization.Core.Fastest_speed_burst_0_MiB_sec, results.MaxSpeed);
- MinSpeed = string.Format(Localization.Core.Slowest_speed_burst_0_MiB_sec, results.MinSpeed);
+ AvgSpeed = string.Format(Localization.Core.Average_speed_0,
+ ByteSize.FromBytes(results.AvgSpeed).Per(1.Seconds()));
+
+ MaxSpeed = string.Format(Localization.Core.Fastest_speed_burst_0,
+ ByteSize.FromBytes(results.MaxSpeed).Per(1.Seconds()));
+
+ MinSpeed = string.Format(Localization.Core.Slowest_speed_burst_0,
+ ByteSize.FromBytes(results.MinSpeed).Per(1.Seconds()));
+
A = string.Format(Localization.Core._0_sectors_took_less_than_3_ms, results.A);
B = string.Format(Localization.Core._0_sectors_took_less_than_10_ms_but_more_than_3_ms, results.B);
C = string.Format(Localization.Core._0_sectors_took_less_than_50_ms_but_more_than_10_ms, results.C);
diff --git a/Aaru.Localization/Core.Designer.cs b/Aaru.Localization/Core.Designer.cs
index e99d59b11..8424d410c 100644
--- a/Aaru.Localization/Core.Designer.cs
+++ b/Aaru.Localization/Core.Designer.cs
@@ -456,38 +456,38 @@ namespace Aaru.Localization {
}
///
- /// Looks up a localized string similar to Average checksum speed {0:F3} KiB/sec..
+ /// Looks up a localized string similar to Average checksum speed {0}..
///
- public static string Average_checksum_speed_0_KiB_sec {
+ public static string Average_checksum_speed_0 {
get {
- return ResourceManager.GetString("Average_checksum_speed_0_KiB_sec", resourceCulture);
+ return ResourceManager.GetString("Average_checksum_speed_0", resourceCulture);
}
}
///
- /// Looks up a localized string similar to Average dump speed {0:F3} KiB/sec..
+ /// Looks up a localized string similar to Average dump speed {0}..
///
- public static string Average_dump_speed_0_KiB_sec {
+ public static string Average_dump_speed_0 {
get {
- return ResourceManager.GetString("Average_dump_speed_0_KiB_sec", resourceCulture);
+ return ResourceManager.GetString("Average_dump_speed_0", resourceCulture);
}
}
///
- /// Looks up a localized string similar to Average speed: {0:F3} MiB/sec..
+ /// Looks up a localized string similar to Average speed: {0}..
///
- public static string Average_speed_0_MiB_sec {
+ public static string Average_speed_0 {
get {
- return ResourceManager.GetString("Average_speed_0_MiB_sec", resourceCulture);
+ return ResourceManager.GetString("Average_speed_0", resourceCulture);
}
}
///
- /// Looks up a localized string similar to Average write speed {0:F3} KiB/sec..
+ /// Looks up a localized string similar to Average write speed {0}..
///
- public static string Average_write_speed_0_KiB_sec {
+ public static string Average_write_speed_0 {
get {
- return ResourceManager.GetString("Average_write_speed_0_KiB_sec", resourceCulture);
+ return ResourceManager.GetString("Average_write_speed_0", resourceCulture);
}
}
@@ -3380,11 +3380,11 @@ namespace Aaru.Localization {
}
///
- /// Looks up a localized string similar to Fastest speed burst: {0:F3} MiB/sec..
+ /// Looks up a localized string similar to Fastest speed burst: {0}..
///
- public static string Fastest_speed_burst_0_MiB_sec {
+ public static string Fastest_speed_burst_0 {
get {
- return ResourceManager.GetString("Fastest_speed_burst_0_MiB_sec", resourceCulture);
+ return ResourceManager.GetString("Fastest_speed_burst_0", resourceCulture);
}
}
@@ -6568,11 +6568,11 @@ namespace Aaru.Localization {
}
///
- /// Looks up a localized string similar to Reading block {0} ({1:F3} MiB/sec.).
+ /// Looks up a localized string similar to Reading block {0} ({1}).
///
- public static string Reading_block_0_1_MiB_sec {
+ public static string Reading_block_0_1 {
get {
- return ResourceManager.GetString("Reading_block_0_1_MiB_sec", resourceCulture);
+ return ResourceManager.GetString("Reading_block_0_1", resourceCulture);
}
}
@@ -6586,11 +6586,11 @@ namespace Aaru.Localization {
}
///
- /// Looks up a localized string similar to Reading byte {0} of {1} ({2:F3} MiB/sec.).
+ /// Looks up a localized string similar to Reading byte {0} of {1} ({2}).
///
- public static string Reading_byte_0_of_1_2_MiB_sec_ {
+ public static string Reading_byte_0_of_1_2 {
get {
- return ResourceManager.GetString("Reading_byte_0_of_1_2_MiB_sec_", resourceCulture);
+ return ResourceManager.GetString("Reading_byte_0_of_1_2", resourceCulture);
}
}
@@ -6622,11 +6622,11 @@ namespace Aaru.Localization {
}
///
- /// Looks up a localized string similar to Reading cylinder {0} head {1} sector {2} ({3:F3} MiB/sec.).
+ /// Looks up a localized string similar to Reading cylinder {0} head {1} sector {2} ({3}).
///
- public static string Reading_cylinder_0_head_1_sector_2_3_MiB_sec {
+ public static string Reading_cylinder_0_head_1_sector_2_3 {
get {
- return ResourceManager.GetString("Reading_cylinder_0_head_1_sector_2_3_MiB_sec", resourceCulture);
+ return ResourceManager.GetString("Reading_cylinder_0_head_1_sector_2_3", resourceCulture);
}
}
@@ -7180,20 +7180,20 @@ namespace Aaru.Localization {
}
///
- /// Looks up a localized string similar to Reading sector {0} at lead-out ({1:F3} MiB/sec.).
+ /// Looks up a localized string similar to Reading sector {0} at lead-out ({1}).
///
- public static string Reading_sector_0_at_lead_out_1_MiB_sec {
+ public static string Reading_sector_0_at_lead_out_1 {
get {
- return ResourceManager.GetString("Reading_sector_0_at_lead_out_1_MiB_sec", resourceCulture);
+ return ResourceManager.GetString("Reading_sector_0_at_lead_out_1", resourceCulture);
}
}
///
- /// Looks up a localized string similar to Reading sector {0} of {1} ({2:F3} MiB/sec.).
+ /// Looks up a localized string similar to Reading sector {0} of {1} ({2}).
///
- public static string Reading_sector_0_of_1_2_MiB_sec {
+ public static string Reading_sector_0_of_1_2 {
get {
- return ResourceManager.GetString("Reading_sector_0_of_1_2_MiB_sec", resourceCulture);
+ return ResourceManager.GetString("Reading_sector_0_of_1_2", resourceCulture);
}
}
@@ -8199,11 +8199,11 @@ namespace Aaru.Localization {
}
///
- /// Looks up a localized string similar to Slowest speed burst: {0:F3} MiB/sec..
+ /// Looks up a localized string similar to Slowest speed burst: {0}..
///
- public static string Slowest_speed_burst_0_MiB_sec {
+ public static string Slowest_speed_burst_0 {
get {
- return ResourceManager.GetString("Slowest_speed_burst_0_MiB_sec", resourceCulture);
+ return ResourceManager.GetString("Slowest_speed_burst_0", resourceCulture);
}
}
@@ -9465,11 +9465,11 @@ namespace Aaru.Localization {
}
///
- /// Looks up a localized string similar to Trying to read first track pregap sector {0} ({1:F3} MiB/sec.).
+ /// Looks up a localized string similar to Trying to read first track pregap sector {0} ({1}).
///
- public static string Trying_to_read_first_track_pregap_sector_0_1_MiB_sec {
+ public static string Trying_to_read_first_track_pregap_sector_0_1 {
get {
- return ResourceManager.GetString("Trying_to_read_first_track_pregap_sector_0_1_MiB_sec", resourceCulture);
+ return ResourceManager.GetString("Trying_to_read_first_track_pregap_sector_0_1", resourceCulture);
}
}
diff --git a/Aaru.Localization/Core.resx b/Aaru.Localization/Core.resx
index e30136d78..2c482f301 100644
--- a/Aaru.Localization/Core.resx
+++ b/Aaru.Localization/Core.resx
@@ -399,14 +399,14 @@
Took a total of {0} seconds ({1} processing commands).
-
- Average speed: {0:F3} MiB/sec.
+
+ Average speed: {0}.
-
- Fastest speed burst: {0:F3} MiB/sec.
+
+ Fastest speed burst: {0}.
-
- Slowest speed burst: {0:F3} MiB/sec.
+
+ Slowest speed burst: {0}.
Summary
@@ -648,8 +648,8 @@
Aborted!
-
- Reading sector {0} of {1} ({2:F3} MiB/sec.)
+
+ Reading sector {0} of {1} ({2})
Adding CD-i Ready hole from LBA {0} to {1} inclusive.
@@ -902,11 +902,11 @@
Dump finished in {0} seconds.
-
- Average dump speed {0:F3} KiB/sec.
+
+ Average dump speed {0}.
-
- Average write speed {0:F3} KiB/sec.
+
+ Average write speed {0}.
Error: Tag type {0} is null, skipping...
@@ -980,14 +980,14 @@
Reading lead-outs
-
- Reading sector {0} at lead-out ({1:F3} MiB/sec.)
+
+ Reading sector {0} at lead-out ({1})
Reading first track pregap
-
- Trying to read first track pregap sector {0} ({1:F3} MiB/sec.)
+
+ Trying to read first track pregap sector {0} ({1})
Got {0} first track pregap sectors.
@@ -1133,8 +1133,8 @@
Error {0} creating output image, not continuing.
-
- Reading byte {0} of {1} ({2:F3} MiB/sec.)
+
+ Reading byte {0} of {1} ({2})
Skipping {0} bytes from errored byte {1}.
@@ -1169,8 +1169,8 @@
Sidecar created in {0} seconds.
-
- Average checksum speed {0:F3} KiB/sec.
+
+ Average checksum speed {0}.
Found filesystem {0} at sector {1}
@@ -1373,8 +1373,8 @@
Output format does not support ATA IDENTIFY.
-
- Reading cylinder {0} head {1} sector {2} ({3:F3} MiB/sec.)
+
+ Reading cylinder {0} head {1} sector {2} ({3})
Error reading cylinder {0} head {1} sector {2}.
@@ -1662,8 +1662,8 @@
Seeking to partition {0}
-
- Reading block {0} ({1:F3} MiB/sec.)
+
+ Reading block {0} ({1})
Cannot dump a blank tape...
diff --git a/Aaru/Commands/Media/Dump.cs b/Aaru/Commands/Media/Dump.cs
index 1ffded31b..274baded9 100644
--- a/Aaru/Commands/Media/Dump.cs
+++ b/Aaru/Commands/Media/Dump.cs
@@ -53,6 +53,7 @@ using Aaru.Core;
using Aaru.Core.Devices.Dumping;
using Aaru.Core.Logging;
using Aaru.Localization;
+using Humanizer;
using Schemas;
using Spectre.Console;
using Dump = Aaru.Core.Devices.Dumping.Dump;
@@ -63,8 +64,9 @@ namespace Aaru.Commands.Media;
// TODO: Add raw dumping
sealed class DumpMediaCommand : Command
{
- static ProgressTask _progressTask1;
- static ProgressTask _progressTask2;
+ static ProgressTask _progressTask1;
+ static ProgressTask _progressTask2;
+ static readonly TimeSpan OneSecond = 1.Seconds();
public DumpMediaCommand() : base("dump", UI.Media_Dump_Command_Description)
{
diff --git a/Aaru/Commands/Media/Scan.cs b/Aaru/Commands/Media/Scan.cs
index e616b341f..4be45aede 100644
--- a/Aaru/Commands/Media/Scan.cs
+++ b/Aaru/Commands/Media/Scan.cs
@@ -37,6 +37,8 @@ using Aaru.Console;
using Aaru.Core;
using Aaru.Core.Devices.Scanning;
using Aaru.Localization;
+using Humanizer;
+using Humanizer.Bytes;
using Spectre.Console;
namespace Aaru.Commands.Media;
@@ -207,9 +209,14 @@ sealed class MediaScanCommand : Command
AaruConsole.WriteLine(Localization.Core.Took_a_total_of_0_seconds_1_processing_commands, results.TotalTime,
results.ProcessingTime);
- AaruConsole.WriteLine(Localization.Core.Average_speed_0_MiB_sec, results.AvgSpeed);
- AaruConsole.WriteLine(Localization.Core.Fastest_speed_burst_0_MiB_sec, results.MaxSpeed);
- AaruConsole.WriteLine(Localization.Core.Slowest_speed_burst_0_MiB_sec, results.MinSpeed);
+ AaruConsole.WriteLine(Localization.Core.Average_speed_0, ByteSize.FromBytes(results.AvgSpeed).Per(1.Seconds()));
+
+ AaruConsole.WriteLine(Localization.Core.Fastest_speed_burst_0,
+ ByteSize.FromBytes(results.MaxSpeed).Per(1.Seconds()));
+
+ AaruConsole.WriteLine(Localization.Core.Slowest_speed_burst_0,
+ ByteSize.FromBytes(results.MinSpeed).Per(1.Seconds()));
+
AaruConsole.WriteLine();
AaruConsole.WriteLine($"[bold]{Localization.Core.Summary}:[/]");
AaruConsole.WriteLine($"[lime]{string.Format(Localization.Core._0_sectors_took_less_than_3_ms, results.A)}[/]");