mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
Use Humanizer to print speeds.
This commit is contained in:
@@ -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 _);
|
||||
|
||||
@@ -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("");
|
||||
|
||||
@@ -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 _);
|
||||
|
||||
Reference in New Issue
Block a user