Humanize settings.

This commit is contained in:
2025-08-23 00:13:52 +01:00
parent 8eaed3c27b
commit ac71520e69
21 changed files with 962 additions and 765 deletions

View File

@@ -40,6 +40,7 @@
// ReSharper disable UnusedMember.Global // ReSharper disable UnusedMember.Global
using System; using System;
using System.ComponentModel;
using System.Diagnostics.CodeAnalysis; using System.Diagnostics.CodeAnalysis;
namespace Aaru.CommonTypes.Enums; namespace Aaru.CommonTypes.Enums;
@@ -52,12 +53,16 @@ public enum TrackType : byte
/// <summary>Data track (not any of the below defined ones)</summary> /// <summary>Data track (not any of the below defined ones)</summary>
Data = 1, Data = 1,
/// <summary>Data track, compact disc mode 1</summary> /// <summary>Data track, compact disc mode 1</summary>
[Description("MODE 1")]
CdMode1 = 2, CdMode1 = 2,
/// <summary>Data track, compact disc mode 2, formless</summary> /// <summary>Data track, compact disc mode 2, formless</summary>
[Description("MODE 2 (Formless)")]
CdMode2Formless = 3, CdMode2Formless = 3,
/// <summary>Data track, compact disc mode 2, form 1</summary> /// <summary>Data track, compact disc mode 2, form 1</summary>
[Description("MODE 2 FORM 1")]
CdMode2Form1 = 4, CdMode2Form1 = 4,
/// <summary>Data track, compact disc mode 2, form 2</summary> /// <summary>Data track, compact disc mode 2, form 2</summary>
[Description("MODE 2 FORM 2")]
CdMode2Form2 = 5 CdMode2Form2 = 5
} }

File diff suppressed because it is too large Load Diff

View File

@@ -949,7 +949,7 @@ sealed partial class Dump
UpdateStatus?.Invoke(string.Format(Localization.Core.Device_can_read_0_blocks_at_a_time, _maximumReadable)); UpdateStatus?.Invoke(string.Format(Localization.Core.Device_can_read_0_blocks_at_a_time, _maximumReadable));
UpdateStatus?.Invoke(string.Format(Localization.Core.Device_reports_0_bytes_per_logical_block, blockSize)); UpdateStatus?.Invoke(string.Format(Localization.Core.Device_reports_0_bytes_per_logical_block, blockSize));
UpdateStatus?.Invoke(string.Format(Localization.Core.SCSI_device_type_0, _dev.ScsiType)); UpdateStatus?.Invoke(string.Format(Localization.Core.SCSI_device_type_0, _dev.ScsiType));
UpdateStatus?.Invoke(string.Format(Localization.Core.Media_identified_as_0, dskType)); UpdateStatus?.Invoke(string.Format(Localization.Core.Media_identified_as_0, dskType.Humanize()));
ret = outputOptical.Create(_outputPath, ret = outputOptical.Create(_outputPath,
dskType, dskType,
@@ -1079,8 +1079,9 @@ sealed partial class Dump
foreach(int sub in _resume.BadSubchannels) subchannelExtents.Add(sub); foreach(int sub in _resume.BadSubchannels) subchannelExtents.Add(sub);
if(_resume.NextBlock < blocks) if(_resume.NextBlock < blocks)
for(ulong i = _resume.NextBlock; i < blocks; i++) {
subchannelExtents.Add((int)i); for(ulong i = _resume.NextBlock; i < blocks; i++) subchannelExtents.Add((int)i);
}
} }
if(_resume.NextBlock > 0) if(_resume.NextBlock > 0)
@@ -1495,8 +1496,9 @@ sealed partial class Dump
supportsLongSectors); supportsLongSectors);
foreach(Tuple<ulong, ulong> leadoutExtent in leadOutExtents.ToArray()) foreach(Tuple<ulong, ulong> leadoutExtent in leadOutExtents.ToArray())
for(ulong e = leadoutExtent.Item1; e <= leadoutExtent.Item2; e++) {
subchannelExtents.Remove((int)e); for(ulong e = leadoutExtent.Item1; e <= leadoutExtent.Item2; e++) subchannelExtents.Remove((int)e);
}
if(subchannelExtents.Count > 0 && _retryPasses > 0 && _retrySubchannel) if(subchannelExtents.Count > 0 && _retryPasses > 0 && _retrySubchannel)
{ {

View File

@@ -236,7 +236,7 @@ public partial class Dump
romSize, romSize,
ByteSize.FromBytes(romSize).ToString("0.000"))); ByteSize.FromBytes(romSize).ToString("0.000")));
UpdateStatus?.Invoke(string.Format(Localization.Core.Media_identified_as_0, mediaType)); UpdateStatus?.Invoke(string.Format(Localization.Core.Media_identified_as_0, mediaType.Humanize()));
ErrorNumber ret = outputBai.Create(_outputPath, mediaType, _formatOptions, romSize); ErrorNumber ret = outputBai.Create(_outputPath, mediaType, _formatOptions, romSize);

View File

@@ -154,7 +154,7 @@ partial class Dump
UpdateStatus?.Invoke(string.Format(Localization.Core.SCSI_device_type_0, _dev.ScsiType)); UpdateStatus?.Invoke(string.Format(Localization.Core.SCSI_device_type_0, _dev.ScsiType));
UpdateStatus?.Invoke(string.Format(Localization.Core.SCSI_medium_type_0, scsiMediumType)); UpdateStatus?.Invoke(string.Format(Localization.Core.SCSI_medium_type_0, scsiMediumType));
UpdateStatus?.Invoke(string.Format(Localization.Core.Media_identified_as_0, dskType)); UpdateStatus?.Invoke(string.Format(Localization.Core.Media_identified_as_0, dskType.Humanize()));
sense = _dev.MiniDiscGetType(out cmdBuf, out _, _dev.Timeout, out _); sense = _dev.MiniDiscGetType(out cmdBuf, out _, _dev.Timeout, out _);

View File

@@ -143,7 +143,7 @@ public partial class Dump
UpdateStatus?.Invoke(string.Format(Localization.Core.Device_reports_0_bytes_per_logical_block, blockSize)); UpdateStatus?.Invoke(string.Format(Localization.Core.Device_reports_0_bytes_per_logical_block, blockSize));
UpdateStatus?.Invoke(string.Format(Localization.Core.Device_reports_0_bytes_per_physical_block, blockSize)); UpdateStatus?.Invoke(string.Format(Localization.Core.Device_reports_0_bytes_per_physical_block, blockSize));
UpdateStatus?.Invoke(string.Format(Localization.Core.SCSI_device_type_0, _dev.ScsiType)); UpdateStatus?.Invoke(string.Format(Localization.Core.SCSI_device_type_0, _dev.ScsiType));
UpdateStatus?.Invoke(string.Format(Localization.Core.Media_identified_as_0, dskType)); UpdateStatus?.Invoke(string.Format(Localization.Core.Media_identified_as_0, dskType.Humanize()));
UpdateStatus?.Invoke(string.Format(Localization.Core.Media_part_number_is_0, mediaPartNumber)); UpdateStatus?.Invoke(string.Format(Localization.Core.Media_part_number_is_0, mediaPartNumber));
bool ret; bool ret;

View File

@@ -285,9 +285,8 @@ partial class Dump
Modes.DecodedMode? decMode = null; Modes.DecodedMode? decMode = null;
if(!sense && !_dev.Error) if(!sense && !_dev.Error)
{ if(Modes.DecodeMode10(cmdBuf, _dev.ScsiType).HasValue)
if(Modes.DecodeMode10(cmdBuf, _dev.ScsiType).HasValue) decMode = Modes.DecodeMode10(cmdBuf, _dev.ScsiType); decMode = Modes.DecodeMode10(cmdBuf, _dev.ScsiType);
}
UpdateStatus?.Invoke(Localization.Core.Requesting_MODE_SENSE_6); UpdateStatus?.Invoke(Localization.Core.Requesting_MODE_SENSE_6);
@@ -315,9 +314,8 @@ partial class Dump
if(sense || _dev.Error) sense = _dev.ModeSense(out cmdBuf, out senseBuf, 5, out duration); if(sense || _dev.Error) sense = _dev.ModeSense(out cmdBuf, out senseBuf, 5, out duration);
if(!sense && !_dev.Error) if(!sense && !_dev.Error)
{ if(Modes.DecodeMode6(cmdBuf, _dev.ScsiType).HasValue)
if(Modes.DecodeMode6(cmdBuf, _dev.ScsiType).HasValue) decMode = Modes.DecodeMode6(cmdBuf, _dev.ScsiType); decMode = Modes.DecodeMode6(cmdBuf, _dev.ScsiType);
}
// TODO: Check partitions page // TODO: Check partitions page
if(decMode.HasValue) if(decMode.HasValue)
@@ -358,7 +356,7 @@ partial class Dump
UpdateStatus?.Invoke(string.Format(Localization.Core.SCSI_device_type_0, _dev.ScsiType)); UpdateStatus?.Invoke(string.Format(Localization.Core.SCSI_device_type_0, _dev.ScsiType));
UpdateStatus?.Invoke(string.Format(Localization.Core.SCSI_medium_type_0, scsiMediumTypeTape)); UpdateStatus?.Invoke(string.Format(Localization.Core.SCSI_medium_type_0, scsiMediumTypeTape));
UpdateStatus?.Invoke(string.Format(Localization.Core.SCSI_density_type_0, scsiDensityCodeTape)); UpdateStatus?.Invoke(string.Format(Localization.Core.SCSI_density_type_0, scsiDensityCodeTape));
UpdateStatus?.Invoke(string.Format(Localization.Core.Media_identified_as_0, dskType)); UpdateStatus?.Invoke(string.Format(Localization.Core.Media_identified_as_0, dskType.Humanize()));
bool endOfMedia = false; bool endOfMedia = false;

View File

@@ -290,7 +290,7 @@ partial class Dump
UpdateStatus?.Invoke(string.Format(Localization.Core.SCSI_medium_type_0, scsiMediumType)); UpdateStatus?.Invoke(string.Format(Localization.Core.SCSI_medium_type_0, scsiMediumType));
UpdateStatus?.Invoke(string.Format(Localization.Core.SCSI_density_type_0, scsiDensityCode)); UpdateStatus?.Invoke(string.Format(Localization.Core.SCSI_density_type_0, scsiDensityCode));
UpdateStatus?.Invoke(string.Format(Localization.Core.SCSI_floppy_mode_page_present_0, containsFloppyPage)); UpdateStatus?.Invoke(string.Format(Localization.Core.SCSI_floppy_mode_page_present_0, containsFloppyPage));
UpdateStatus?.Invoke(string.Format(Localization.Core.Media_identified_as_0, dskType)); UpdateStatus?.Invoke(string.Format(Localization.Core.Media_identified_as_0, dskType.Humanize()));
uint longBlockSize = scsiReader.LongBlockSize; uint longBlockSize = scsiReader.LongBlockSize;

View File

@@ -941,7 +941,7 @@ public static class ImageInfo
foreach(Track track in opticalImage.Tracks) foreach(Track track in opticalImage.Tracks)
{ {
table.AddRow($"[teal]{track.Sequence}[/]", table.AddRow($"[teal]{track.Sequence}[/]",
$"[orange3]{track.Type}[/]", $"[orange3]{track.Type.Humanize()}[/]",
$"[aqua]{track.BytesPerSector}[/]", $"[aqua]{track.BytesPerSector}[/]",
$"[aqua]{track.RawBytesPerSector}[/]", $"[aqua]{track.RawBytesPerSector}[/]",
$"[fuchsia]{track.SubchannelType}[/]", $"[fuchsia]{track.SubchannelType}[/]",
@@ -951,7 +951,7 @@ public static class ImageInfo
// Write all the track information to AaruLogging.Information in a single line // Write all the track information to AaruLogging.Information in a single line
AaruLogging AaruLogging
.Information($"Track {track.Sequence}: type {track.Type}, bytes per sector {track.BytesPerSector}, raw bytes per sector {track.RawBytesPerSector}, subchannel type {track.SubchannelType}, pregap {track.Pregap}, start sector {track.StartSector}, end sector {track.EndSector}"); .Information($"Track {track.Sequence}: type {track.Type.Humanize()}, bytes per sector {track.BytesPerSector}, raw bytes per sector {track.RawBytesPerSector}, subchannel type {track.SubchannelType}, pregap {track.Pregap}, start sector {track.StartSector}, end sector {track.EndSector}");
} }
AnsiConsole.Write(table); AnsiConsole.Write(table);

View File

@@ -35,6 +35,7 @@
<PackageReference Include="Claunia.Encoding"/> <PackageReference Include="Claunia.Encoding"/>
<PackageReference Include="Claunia.RsrcFork"/> <PackageReference Include="Claunia.RsrcFork"/>
<PackageReference Include="DotNetZip"/> <PackageReference Include="DotNetZip"/>
<PackageReference Include="Humanizer"/>
<PackageReference Include="plist-cil"/> <PackageReference Include="plist-cil"/>
<PackageReference Include="SharpCompress"/> <PackageReference Include="SharpCompress"/>
<PackageReference Include="System.Text.Json"/> <PackageReference Include="System.Text.Json"/>

View File

@@ -50,6 +50,7 @@ using Aaru.Compression;
using Aaru.Decoders.CD; using Aaru.Decoders.CD;
using Aaru.Helpers; using Aaru.Helpers;
using Aaru.Logging; using Aaru.Logging;
using Humanizer;
using Schemas; using Schemas;
using Marshal = Aaru.Helpers.Marshal; using Marshal = Aaru.Helpers.Marshal;
using Partition = Aaru.CommonTypes.Partition; using Partition = Aaru.CommonTypes.Partition;
@@ -81,8 +82,7 @@ public sealed partial class AaruFormat
if(_header.imageMajorVersion > AARUFMT_VERSION) if(_header.imageMajorVersion > AARUFMT_VERSION)
{ {
AaruLogging.Error(string.Format(Localization.Image_version_0_not_recognized, AaruLogging.Error(string.Format(Localization.Image_version_0_not_recognized, _header.imageMajorVersion));
_header.imageMajorVersion));
return ErrorNumber.NotSupported; return ErrorNumber.NotSupported;
} }
@@ -229,9 +229,7 @@ public sealed partial class AaruFormat
entry.dataType, entry.dataType,
entry.offset); entry.offset);
AaruLogging.Debug(MODULE_NAME, AaruLogging.Debug(MODULE_NAME, Localization.Memory_snapshot_0_bytes, GC.GetTotalMemory(false));
Localization.Memory_snapshot_0_bytes,
GC.GetTotalMemory(false));
// Decompress media tag // Decompress media tag
if(blockHeader.compression is CompressionType.Lzma if(blockHeader.compression is CompressionType.Lzma
@@ -261,8 +259,7 @@ public sealed partial class AaruFormat
if(decompressedLength != blockHeader.length) if(decompressedLength != blockHeader.length)
{ {
AaruLogging.Debug(MODULE_NAME, AaruLogging.Debug(MODULE_NAME,
Localization Localization.Error_decompressing_block_should_be_0_bytes_but_got_1_bytes,
.Error_decompressing_block_should_be_0_bytes_but_got_1_bytes,
blockHeader.length, blockHeader.length,
decompressedLength); decompressedLength);
@@ -278,18 +275,14 @@ public sealed partial class AaruFormat
Localization.Took_0_seconds_to_decompress_block, Localization.Took_0_seconds_to_decompress_block,
decompressStopwatch.Elapsed.TotalSeconds); decompressStopwatch.Elapsed.TotalSeconds);
AaruLogging.Debug(MODULE_NAME, AaruLogging.Debug(MODULE_NAME, Localization.Memory_snapshot_0_bytes, GC.GetTotalMemory(false));
Localization.Memory_snapshot_0_bytes,
GC.GetTotalMemory(false));
} }
else if(blockHeader.compression == CompressionType.None) else if(blockHeader.compression == CompressionType.None)
{ {
data = new byte[blockHeader.length]; data = new byte[blockHeader.length];
_imageStream.EnsureRead(data, 0, (int)blockHeader.length); _imageStream.EnsureRead(data, 0, (int)blockHeader.length);
AaruLogging.Debug(MODULE_NAME, AaruLogging.Debug(MODULE_NAME, Localization.Memory_snapshot_0_bytes, GC.GetTotalMemory(false));
Localization.Memory_snapshot_0_bytes,
GC.GetTotalMemory(false));
} }
else else
{ {
@@ -306,8 +299,7 @@ public sealed partial class AaruFormat
if(BitConverter.ToUInt64(blockCrc, 0) != blockHeader.crc64 && blockHeader.crc64 != 0) if(BitConverter.ToUInt64(blockCrc, 0) != blockHeader.crc64 && blockHeader.crc64 != 0)
{ {
AaruLogging.Debug(MODULE_NAME, AaruLogging.Debug(MODULE_NAME,
Localization Localization.Incorrect_CRC_found_0_X16_found_expected_1_X16_continuing,
.Incorrect_CRC_found_0_X16_found_expected_1_X16_continuing,
BitConverter.ToUInt64(blockCrc, 0), BitConverter.ToUInt64(blockCrc, 0),
blockHeader.crc64); blockHeader.crc64);
@@ -467,8 +459,7 @@ public sealed partial class AaruFormat
if(_mediaTags.ContainsKey(mediaTagType)) if(_mediaTags.ContainsKey(mediaTagType))
{ {
AaruLogging.Debug(MODULE_NAME, AaruLogging.Debug(MODULE_NAME,
Localization Localization.Media_tag_type_0_duplicated_removing_previous_entry,
.Media_tag_type_0_duplicated_removing_previous_entry,
mediaTagType); mediaTagType);
_mediaTags.Remove(mediaTagType); _mediaTags.Remove(mediaTagType);
@@ -668,9 +659,7 @@ public sealed partial class AaruFormat
_imageInfo.Heads = _geometryBlock.heads; _imageInfo.Heads = _geometryBlock.heads;
_imageInfo.SectorsPerTrack = _geometryBlock.sectorsPerTrack; _imageInfo.SectorsPerTrack = _geometryBlock.sectorsPerTrack;
AaruLogging.Debug(MODULE_NAME, AaruLogging.Debug(MODULE_NAME, Localization.Memory_snapshot_0_bytes, GC.GetTotalMemory(false));
Localization.Memory_snapshot_0_bytes,
GC.GetTotalMemory(false));
} }
break; break;
@@ -691,9 +680,7 @@ public sealed partial class AaruFormat
break; break;
} }
AaruLogging.Debug(MODULE_NAME, AaruLogging.Debug(MODULE_NAME, Localization.Found_metadata_block_at_position_0, entry.offset);
Localization.Found_metadata_block_at_position_0,
entry.offset);
byte[] metadata = new byte[metadataBlock.blockSize]; byte[] metadata = new byte[metadataBlock.blockSize];
_imageStream.Position = (long)entry.offset; _imageStream.Position = (long)entry.offset;
@@ -738,9 +725,7 @@ public sealed partial class AaruFormat
(int)metadataBlock.mediaTitleOffset, (int)metadataBlock.mediaTitleOffset,
(int)(metadataBlock.mediaTitleLength - 2)); (int)(metadataBlock.mediaTitleLength - 2));
AaruLogging.Debug(MODULE_NAME, AaruLogging.Debug(MODULE_NAME, Localization.Setting_media_title_0, _imageInfo.MediaTitle);
Localization.Setting_media_title_0,
_imageInfo.MediaTitle);
} }
if(metadataBlock.mediaManufacturerOffset > 0 && if(metadataBlock.mediaManufacturerOffset > 0 &&
@@ -764,9 +749,7 @@ public sealed partial class AaruFormat
(int)metadataBlock.mediaModelOffset, (int)metadataBlock.mediaModelOffset,
(int)(metadataBlock.mediaModelLength - 2)); (int)(metadataBlock.mediaModelLength - 2));
AaruLogging.Debug(MODULE_NAME, AaruLogging.Debug(MODULE_NAME, Localization.Setting_media_model_0, _imageInfo.MediaModel);
Localization.Setting_media_model_0,
_imageInfo.MediaModel);
} }
if(metadataBlock.mediaSerialNumberOffset > 0 && if(metadataBlock.mediaSerialNumberOffset > 0 &&
@@ -790,9 +773,7 @@ public sealed partial class AaruFormat
(int)metadataBlock.mediaBarcodeOffset, (int)metadataBlock.mediaBarcodeOffset,
(int)(metadataBlock.mediaBarcodeLength - 2)); (int)(metadataBlock.mediaBarcodeLength - 2));
AaruLogging.Debug(MODULE_NAME, AaruLogging.Debug(MODULE_NAME, Localization.Setting_media_barcode_0, _imageInfo.MediaBarcode);
Localization.Setting_media_barcode_0,
_imageInfo.MediaBarcode);
} }
if(metadataBlock.mediaPartNumberOffset > 0 && if(metadataBlock.mediaPartNumberOffset > 0 &&
@@ -829,9 +810,7 @@ public sealed partial class AaruFormat
(int)metadataBlock.driveModelOffset, (int)metadataBlock.driveModelOffset,
(int)(metadataBlock.driveModelLength - 2)); (int)(metadataBlock.driveModelLength - 2));
AaruLogging.Debug(MODULE_NAME, AaruLogging.Debug(MODULE_NAME, Localization.Setting_drive_model_0, _imageInfo.DriveModel);
Localization.Setting_drive_model_0,
_imageInfo.DriveModel);
} }
if(metadataBlock.driveSerialNumberOffset > 0 && if(metadataBlock.driveSerialNumberOffset > 0 &&
@@ -861,9 +840,7 @@ public sealed partial class AaruFormat
_imageInfo.DriveFirmwareRevision); _imageInfo.DriveFirmwareRevision);
} }
AaruLogging.Debug(MODULE_NAME, AaruLogging.Debug(MODULE_NAME, Localization.Memory_snapshot_0_bytes, GC.GetTotalMemory(false));
Localization.Memory_snapshot_0_bytes,
GC.GetTotalMemory(false));
break; break;
@@ -889,8 +866,7 @@ public sealed partial class AaruFormat
if(BitConverter.ToUInt64(trksCrc, 0) != tracksHeader.crc64) if(BitConverter.ToUInt64(trksCrc, 0) != tracksHeader.crc64)
{ {
AaruLogging.Debug(MODULE_NAME, AaruLogging.Debug(MODULE_NAME,
Localization Localization.Incorrect_CRC_found_0_X16_found_expected_1_X16_continuing,
.Incorrect_CRC_found_0_X16_found_expected_1_X16_continuing,
BitConverter.ToUInt64(trksCrc, 0), BitConverter.ToUInt64(trksCrc, 0),
tracksHeader.crc64); tracksHeader.crc64);
@@ -945,9 +921,7 @@ public sealed partial class AaruFormat
_imageInfo.HasPartitions = true; _imageInfo.HasPartitions = true;
_imageInfo.HasSessions = true; _imageInfo.HasSessions = true;
AaruLogging.Debug(MODULE_NAME, AaruLogging.Debug(MODULE_NAME, Localization.Memory_snapshot_0_bytes, GC.GetTotalMemory(false));
Localization.Memory_snapshot_0_bytes,
GC.GetTotalMemory(false));
break; break;
@@ -965,9 +939,7 @@ public sealed partial class AaruFormat
Localization.Found_CICM_XML_metadata_block_at_position_0, Localization.Found_CICM_XML_metadata_block_at_position_0,
entry.offset); entry.offset);
AaruLogging.Debug(MODULE_NAME, AaruLogging.Debug(MODULE_NAME, Localization.Memory_snapshot_0_bytes, GC.GetTotalMemory(false));
Localization.Memory_snapshot_0_bytes,
GC.GetTotalMemory(false));
byte[] cicmBytes = new byte[cicmBlock.length]; byte[] cicmBytes = new byte[cicmBlock.length];
_imageStream.EnsureRead(cicmBytes, 0, cicmBytes.Length); _imageStream.EnsureRead(cicmBytes, 0, cicmBytes.Length);
@@ -1001,9 +973,7 @@ public sealed partial class AaruFormat
AaruMetadata = null; AaruMetadata = null;
} }
AaruLogging.Debug(MODULE_NAME, AaruLogging.Debug(MODULE_NAME, Localization.Memory_snapshot_0_bytes, GC.GetTotalMemory(false));
Localization.Memory_snapshot_0_bytes,
GC.GetTotalMemory(false));
break; break;
@@ -1017,13 +987,9 @@ public sealed partial class AaruFormat
if(aaruMetadataBlock.identifier != BlockType.AaruMetadataJsonBlock) break; if(aaruMetadataBlock.identifier != BlockType.AaruMetadataJsonBlock) break;
AaruLogging.Debug(MODULE_NAME, AaruLogging.Debug(MODULE_NAME, Localization.Found_Aaru_Metadata_block_at_position_0, entry.offset);
Localization.Found_Aaru_Metadata_block_at_position_0,
entry.offset);
AaruLogging.Debug(MODULE_NAME, AaruLogging.Debug(MODULE_NAME, Localization.Memory_snapshot_0_bytes, GC.GetTotalMemory(false));
Localization.Memory_snapshot_0_bytes,
GC.GetTotalMemory(false));
byte[] jsonBytes = new byte[aaruMetadataBlock.length]; byte[] jsonBytes = new byte[aaruMetadataBlock.length];
_imageStream.EnsureRead(jsonBytes, 0, jsonBytes.Length); _imageStream.EnsureRead(jsonBytes, 0, jsonBytes.Length);
@@ -1040,16 +1006,12 @@ public sealed partial class AaruFormat
Localization.Exception_0_processing_Aaru_Metadata_block, Localization.Exception_0_processing_Aaru_Metadata_block,
ex.Message); ex.Message);
AaruLogging.Exception(ex, AaruLogging.Exception(ex, Localization.Exception_0_processing_Aaru_Metadata_block, ex.Message);
Localization.Exception_0_processing_Aaru_Metadata_block,
ex.Message);
AaruMetadata = null; AaruMetadata = null;
} }
AaruLogging.Debug(MODULE_NAME, AaruLogging.Debug(MODULE_NAME, Localization.Memory_snapshot_0_bytes, GC.GetTotalMemory(false));
Localization.Memory_snapshot_0_bytes,
GC.GetTotalMemory(false));
break; break;
@@ -1063,13 +1025,9 @@ public sealed partial class AaruFormat
if(dumpBlock.identifier != BlockType.DumpHardwareBlock) break; if(dumpBlock.identifier != BlockType.DumpHardwareBlock) break;
AaruLogging.Debug(MODULE_NAME, AaruLogging.Debug(MODULE_NAME, Localization.Found_dump_hardware_block_at_position_0, entry.offset);
Localization.Found_dump_hardware_block_at_position_0,
entry.offset);
AaruLogging.Debug(MODULE_NAME, AaruLogging.Debug(MODULE_NAME, Localization.Memory_snapshot_0_bytes, GC.GetTotalMemory(false));
Localization.Memory_snapshot_0_bytes,
GC.GetTotalMemory(false));
_structureBytes = new byte[dumpBlock.length]; _structureBytes = new byte[dumpBlock.length];
_imageStream.EnsureRead(_structureBytes, 0, _structureBytes.Length); _imageStream.EnsureRead(_structureBytes, 0, _structureBytes.Length);
@@ -1078,8 +1036,7 @@ public sealed partial class AaruFormat
if(BitConverter.ToUInt64(dumpCrc, 0) != dumpBlock.crc64) if(BitConverter.ToUInt64(dumpCrc, 0) != dumpBlock.crc64)
{ {
AaruLogging.Debug(MODULE_NAME, AaruLogging.Debug(MODULE_NAME,
Localization Localization.Incorrect_CRC_found_0_X16_found_expected_1_X16_continuing,
.Incorrect_CRC_found_0_X16_found_expected_1_X16_continuing,
BitConverter.ToUInt64(dumpCrc, 0), BitConverter.ToUInt64(dumpCrc, 0),
dumpBlock.crc64); dumpBlock.crc64);
@@ -1190,9 +1147,7 @@ public sealed partial class AaruFormat
if(DumpHardware.Count == 0) DumpHardware = null; if(DumpHardware.Count == 0) DumpHardware = null;
AaruLogging.Debug(MODULE_NAME, AaruLogging.Debug(MODULE_NAME, Localization.Memory_snapshot_0_bytes, GC.GetTotalMemory(false));
Localization.Memory_snapshot_0_bytes,
GC.GetTotalMemory(false));
break; break;
@@ -1206,9 +1161,7 @@ public sealed partial class AaruFormat
if(partitionHeader.identifier != BlockType.TapePartitionBlock) break; if(partitionHeader.identifier != BlockType.TapePartitionBlock) break;
AaruLogging.Debug(MODULE_NAME, AaruLogging.Debug(MODULE_NAME, Localization.Found_tape_partition_block_at_position_0, entry.offset);
Localization.Found_tape_partition_block_at_position_0,
entry.offset);
byte[] tapePartitionBytes = new byte[partitionHeader.length]; byte[] tapePartitionBytes = new byte[partitionHeader.length];
_imageStream.EnsureRead(tapePartitionBytes, 0, tapePartitionBytes.Length); _imageStream.EnsureRead(tapePartitionBytes, 0, tapePartitionBytes.Length);
@@ -1241,9 +1194,7 @@ public sealed partial class AaruFormat
if(fileHeader.identifier != BlockType.TapeFileBlock) break; if(fileHeader.identifier != BlockType.TapeFileBlock) break;
AaruLogging.Debug(MODULE_NAME, AaruLogging.Debug(MODULE_NAME, Localization.Found_tape_file_block_at_position_0, entry.offset);
Localization.Found_tape_file_block_at_position_0,
entry.offset);
byte[] tapeFileBytes = new byte[fileHeader.length]; byte[] tapeFileBytes = new byte[fileHeader.length];
_imageStream.EnsureRead(tapeFileBytes, 0, tapeFileBytes.Length); _imageStream.EnsureRead(tapeFileBytes, 0, tapeFileBytes.Length);
@@ -1290,8 +1241,7 @@ public sealed partial class AaruFormat
if(BitConverter.ToUInt64(idsxCrc, 0) != indexesHeader.crc64) if(BitConverter.ToUInt64(idsxCrc, 0) != indexesHeader.crc64)
{ {
AaruLogging.Debug(MODULE_NAME, AaruLogging.Debug(MODULE_NAME,
Localization Localization.Incorrect_CRC_found_0_X16_found_expected_1_X16_continuing,
.Incorrect_CRC_found_0_X16_found_expected_1_X16_continuing,
BitConverter.ToUInt64(idsxCrc, 0), BitConverter.ToUInt64(idsxCrc, 0),
indexesHeader.crc64); indexesHeader.crc64);
@@ -1317,9 +1267,7 @@ public sealed partial class AaruFormat
CompactDiscIndexEntry>(_structureBytes)); CompactDiscIndexEntry>(_structureBytes));
} }
AaruLogging.Debug(MODULE_NAME, AaruLogging.Debug(MODULE_NAME, Localization.Memory_snapshot_0_bytes, GC.GetTotalMemory(false));
Localization.Memory_snapshot_0_bytes,
GC.GetTotalMemory(false));
break; break;
} }
@@ -1558,7 +1506,7 @@ public sealed partial class AaruFormat
Partitions.Add(new Partition Partitions.Add(new Partition
{ {
Sequence = track.Sequence, Sequence = track.Sequence,
Type = track.Type.ToString(), Type = track.Type.Humanize(),
Name = string.Format(Localization.Track_0, track.Sequence), Name = string.Format(Localization.Track_0, track.Sequence),
Offset = currentTrackOffset, Offset = currentTrackOffset,
Start = (ulong)track.Indexes[1], Start = (ulong)track.Indexes[1],

View File

@@ -52,6 +52,7 @@ using Aaru.Decoders;
using Aaru.Decoders.CD; using Aaru.Decoders.CD;
using Aaru.Helpers; using Aaru.Helpers;
using Aaru.Logging; using Aaru.Logging;
using Humanizer;
using Schemas; using Schemas;
using Marshal = Aaru.Helpers.Marshal; using Marshal = Aaru.Helpers.Marshal;
using Partition = Aaru.CommonTypes.Partition; using Partition = Aaru.CommonTypes.Partition;
@@ -405,9 +406,7 @@ public sealed partial class AaruFormat
entry.dataType, entry.dataType,
entry.offset); entry.offset);
AaruLogging.Debug(MODULE_NAME, AaruLogging.Debug(MODULE_NAME, Localization.Memory_snapshot_0_bytes, GC.GetTotalMemory(false));
Localization.Memory_snapshot_0_bytes,
GC.GetTotalMemory(false));
// Decompress media tag // Decompress media tag
if(blockHeader.compression is CompressionType.Lzma if(blockHeader.compression is CompressionType.Lzma
@@ -482,8 +481,7 @@ public sealed partial class AaruFormat
if(BitConverter.ToUInt64(blockCrc, 0) != blockHeader.crc64 && blockHeader.crc64 != 0) if(BitConverter.ToUInt64(blockCrc, 0) != blockHeader.crc64 && blockHeader.crc64 != 0)
{ {
AaruLogging.Debug(MODULE_NAME, AaruLogging.Debug(MODULE_NAME,
Localization Localization.Incorrect_CRC_found_0_X16_found_expected_1_X16_continuing,
.Incorrect_CRC_found_0_X16_found_expected_1_X16_continuing,
BitConverter.ToUInt64(blockCrc, 0), BitConverter.ToUInt64(blockCrc, 0),
blockHeader.crc64); blockHeader.crc64);
@@ -643,8 +641,7 @@ public sealed partial class AaruFormat
if(_mediaTags.ContainsKey(mediaTagType)) if(_mediaTags.ContainsKey(mediaTagType))
{ {
AaruLogging.Debug(MODULE_NAME, AaruLogging.Debug(MODULE_NAME,
Localization Localization.Media_tag_type_0_duplicated_removing_previous_entry,
.Media_tag_type_0_duplicated_removing_previous_entry,
mediaTagType); mediaTagType);
_mediaTags.Remove(mediaTagType); _mediaTags.Remove(mediaTagType);
@@ -840,8 +837,7 @@ public sealed partial class AaruFormat
if(_geometryBlock.identifier == BlockType.GeometryBlock) if(_geometryBlock.identifier == BlockType.GeometryBlock)
{ {
AaruLogging.Debug(MODULE_NAME, AaruLogging.Debug(MODULE_NAME,
Localization Localization.Geometry_set_to_0_cylinders_1_heads_2_sectors_per_track,
.Geometry_set_to_0_cylinders_1_heads_2_sectors_per_track,
_geometryBlock.cylinders, _geometryBlock.cylinders,
_geometryBlock.heads, _geometryBlock.heads,
_geometryBlock.sectorsPerTrack); _geometryBlock.sectorsPerTrack);
@@ -874,9 +870,7 @@ public sealed partial class AaruFormat
break; break;
} }
AaruLogging.Debug(MODULE_NAME, AaruLogging.Debug(MODULE_NAME, Localization.Found_metadata_block_at_position_0, entry.offset);
Localization.Found_metadata_block_at_position_0,
entry.offset);
byte[] metadata = new byte[metadataBlock.blockSize]; byte[] metadata = new byte[metadataBlock.blockSize];
_imageStream.Position = (long)entry.offset; _imageStream.Position = (long)entry.offset;
@@ -912,9 +906,7 @@ public sealed partial class AaruFormat
(int)metadataBlock.commentsOffset, (int)metadataBlock.commentsOffset,
(int)(metadataBlock.commentsLength - 2)); (int)(metadataBlock.commentsLength - 2));
AaruLogging.Debug(MODULE_NAME, AaruLogging.Debug(MODULE_NAME, Localization.Setting_comments_0, _imageInfo.Comments);
Localization.Setting_comments_0,
_imageInfo.Comments);
} }
if(metadataBlock.mediaTitleOffset > 0 && if(metadataBlock.mediaTitleOffset > 0 &&
@@ -925,9 +917,7 @@ public sealed partial class AaruFormat
(int)metadataBlock.mediaTitleOffset, (int)metadataBlock.mediaTitleOffset,
(int)(metadataBlock.mediaTitleLength - 2)); (int)(metadataBlock.mediaTitleLength - 2));
AaruLogging.Debug(MODULE_NAME, AaruLogging.Debug(MODULE_NAME, Localization.Setting_media_title_0, _imageInfo.MediaTitle);
Localization.Setting_media_title_0,
_imageInfo.MediaTitle);
} }
if(metadataBlock.mediaManufacturerOffset > 0 && if(metadataBlock.mediaManufacturerOffset > 0 &&
@@ -952,9 +942,7 @@ public sealed partial class AaruFormat
(int)metadataBlock.mediaModelOffset, (int)metadataBlock.mediaModelOffset,
(int)(metadataBlock.mediaModelLength - 2)); (int)(metadataBlock.mediaModelLength - 2));
AaruLogging.Debug(MODULE_NAME, AaruLogging.Debug(MODULE_NAME, Localization.Setting_media_model_0, _imageInfo.MediaModel);
Localization.Setting_media_model_0,
_imageInfo.MediaModel);
} }
if(metadataBlock.mediaSerialNumberOffset > 0 && if(metadataBlock.mediaSerialNumberOffset > 0 &&
@@ -1019,9 +1007,7 @@ public sealed partial class AaruFormat
(int)metadataBlock.driveModelOffset, (int)metadataBlock.driveModelOffset,
(int)(metadataBlock.driveModelLength - 2)); (int)(metadataBlock.driveModelLength - 2));
AaruLogging.Debug(MODULE_NAME, AaruLogging.Debug(MODULE_NAME, Localization.Setting_drive_model_0, _imageInfo.DriveModel);
Localization.Setting_drive_model_0,
_imageInfo.DriveModel);
} }
if(metadataBlock.driveSerialNumberOffset > 0 && if(metadataBlock.driveSerialNumberOffset > 0 &&
@@ -1052,9 +1038,7 @@ public sealed partial class AaruFormat
_imageInfo.DriveFirmwareRevision); _imageInfo.DriveFirmwareRevision);
} }
AaruLogging.Debug(MODULE_NAME, AaruLogging.Debug(MODULE_NAME, Localization.Memory_snapshot_0_bytes, GC.GetTotalMemory(false));
Localization.Memory_snapshot_0_bytes,
GC.GetTotalMemory(false));
break; break;
@@ -1081,8 +1065,7 @@ public sealed partial class AaruFormat
if(BitConverter.ToUInt64(trksCrc, 0) != tracksHeader.crc64) if(BitConverter.ToUInt64(trksCrc, 0) != tracksHeader.crc64)
{ {
AaruLogging.Debug(MODULE_NAME, AaruLogging.Debug(MODULE_NAME,
Localization Localization.Incorrect_CRC_found_0_X16_found_expected_1_X16_continuing,
.Incorrect_CRC_found_0_X16_found_expected_1_X16_continuing,
BitConverter.ToUInt64(trksCrc, 0), BitConverter.ToUInt64(trksCrc, 0),
tracksHeader.crc64); tracksHeader.crc64);
@@ -1136,9 +1119,7 @@ public sealed partial class AaruFormat
_imageInfo.HasPartitions = true; _imageInfo.HasPartitions = true;
_imageInfo.HasSessions = true; _imageInfo.HasSessions = true;
AaruLogging.Debug(MODULE_NAME, AaruLogging.Debug(MODULE_NAME, Localization.Memory_snapshot_0_bytes, GC.GetTotalMemory(false));
Localization.Memory_snapshot_0_bytes,
GC.GetTotalMemory(false));
break; break;
@@ -1204,9 +1185,7 @@ public sealed partial class AaruFormat
Localization.Found_Aaru_Metadata_block_at_position_0, Localization.Found_Aaru_Metadata_block_at_position_0,
entry.offset); entry.offset);
AaruLogging.Debug(MODULE_NAME, AaruLogging.Debug(MODULE_NAME, Localization.Memory_snapshot_0_bytes, GC.GetTotalMemory(false));
Localization.Memory_snapshot_0_bytes,
GC.GetTotalMemory(false));
byte[] jsonBytes = new byte[aaruMetadataBlock.length]; byte[] jsonBytes = new byte[aaruMetadataBlock.length];
_imageStream.EnsureRead(jsonBytes, 0, jsonBytes.Length); _imageStream.EnsureRead(jsonBytes, 0, jsonBytes.Length);
@@ -1227,9 +1206,7 @@ public sealed partial class AaruFormat
AaruMetadata = null; AaruMetadata = null;
} }
AaruLogging.Debug(MODULE_NAME, AaruLogging.Debug(MODULE_NAME, Localization.Memory_snapshot_0_bytes, GC.GetTotalMemory(false));
Localization.Memory_snapshot_0_bytes,
GC.GetTotalMemory(false));
break; break;
@@ -1254,8 +1231,7 @@ public sealed partial class AaruFormat
if(BitConverter.ToUInt64(dumpCrc, 0) != dumpBlock.crc64) if(BitConverter.ToUInt64(dumpCrc, 0) != dumpBlock.crc64)
{ {
AaruLogging.Debug(MODULE_NAME, AaruLogging.Debug(MODULE_NAME,
Localization Localization.Incorrect_CRC_found_0_X16_found_expected_1_X16_continuing,
.Incorrect_CRC_found_0_X16_found_expected_1_X16_continuing,
BitConverter.ToUInt64(dumpCrc, 0), BitConverter.ToUInt64(dumpCrc, 0),
dumpBlock.crc64); dumpBlock.crc64);
@@ -1414,9 +1390,7 @@ public sealed partial class AaruFormat
if(fileHeader.identifier != BlockType.TapeFileBlock) break; if(fileHeader.identifier != BlockType.TapeFileBlock) break;
AaruLogging.Debug(MODULE_NAME, AaruLogging.Debug(MODULE_NAME, Localization.Found_tape_file_block_at_position_0, entry.offset);
Localization.Found_tape_file_block_at_position_0,
entry.offset);
byte[] tapeFileBytes = new byte[fileHeader.length]; byte[] tapeFileBytes = new byte[fileHeader.length];
_imageStream.EnsureRead(tapeFileBytes, 0, tapeFileBytes.Length); _imageStream.EnsureRead(tapeFileBytes, 0, tapeFileBytes.Length);
@@ -1463,8 +1437,7 @@ public sealed partial class AaruFormat
if(BitConverter.ToUInt64(idsxCrc, 0) != indexesHeader.crc64) if(BitConverter.ToUInt64(idsxCrc, 0) != indexesHeader.crc64)
{ {
AaruLogging.Debug(MODULE_NAME, AaruLogging.Debug(MODULE_NAME,
Localization Localization.Incorrect_CRC_found_0_X16_found_expected_1_X16_continuing,
.Incorrect_CRC_found_0_X16_found_expected_1_X16_continuing,
BitConverter.ToUInt64(idsxCrc, 0), BitConverter.ToUInt64(idsxCrc, 0),
indexesHeader.crc64); indexesHeader.crc64);
@@ -1490,9 +1463,7 @@ public sealed partial class AaruFormat
CompactDiscIndexEntry>(_structureBytes)); CompactDiscIndexEntry>(_structureBytes));
} }
AaruLogging.Debug(MODULE_NAME, AaruLogging.Debug(MODULE_NAME, Localization.Memory_snapshot_0_bytes, GC.GetTotalMemory(false));
Localization.Memory_snapshot_0_bytes,
GC.GetTotalMemory(false));
break; break;
} }
@@ -1669,7 +1640,7 @@ public sealed partial class AaruFormat
Partitions.Add(new Partition Partitions.Add(new Partition
{ {
Sequence = track.Sequence, Sequence = track.Sequence,
Type = track.Type.ToString(), Type = track.Type.Humanize(),
Name = string.Format(Localization.Track_0, track.Sequence), Name = string.Format(Localization.Track_0, track.Sequence),
Offset = currentTrackOffset, Offset = currentTrackOffset,
Start = (ulong)track.Indexes[1], Start = (ulong)track.Indexes[1],
@@ -1928,9 +1899,8 @@ public sealed partial class AaruFormat
// Fill FLAC block // Fill FLAC block
if(remaining != 0) if(remaining != 0)
{ for(int r = 0; r < remaining * 4; r++)
for(int r = 0; r < remaining * 4; r++) _writingBuffer[_writingBufferPosition + r] = 0; _writingBuffer[_writingBufferPosition + r] = 0;
}
compressedLength = FLAC.EncodeBuffer(_writingBuffer, compressedLength = FLAC.EncodeBuffer(_writingBuffer,
_compressedBuffer, _compressedBuffer,
@@ -2722,9 +2692,8 @@ public sealed partial class AaruFormat
// Fill FLAC block // Fill FLAC block
if(remaining != 0) if(remaining != 0)
{ for(int r = 0; r < remaining * 4; r++)
for(int r = 0; r < remaining * 4; r++) _writingBuffer[_writingBufferPosition + r] = 0; _writingBuffer[_writingBufferPosition + r] = 0;
}
compressedLength = FLAC.EncodeBuffer(_writingBuffer, compressedLength = FLAC.EncodeBuffer(_writingBuffer,
_compressedBuffer, _compressedBuffer,
@@ -3061,9 +3030,7 @@ public sealed partial class AaruFormat
offset = (ulong)_imageStream.Position offset = (ulong)_imageStream.Position
}; };
AaruLogging.Debug(MODULE_NAME, AaruLogging.Debug(MODULE_NAME, Localization.Writing_dump_hardware_block_to_position_0, idxEntry.offset);
Localization.Writing_dump_hardware_block_to_position_0,
idxEntry.offset);
Crc64Context.Data(dumpMs.ToArray(), out byte[] dumpCrc); Crc64Context.Data(dumpMs.ToArray(), out byte[] dumpCrc);
@@ -3105,9 +3072,7 @@ public sealed partial class AaruFormat
offset = (ulong)_imageStream.Position offset = (ulong)_imageStream.Position
}; };
AaruLogging.Debug(MODULE_NAME, AaruLogging.Debug(MODULE_NAME, Localization.Writing_Aaru_Metadata_block_to_position_0, idxEntry.offset);
Localization.Writing_Aaru_Metadata_block_to_position_0,
idxEntry.offset);
var jsonBlock = new AaruMetadataJsonBlock var jsonBlock = new AaruMetadataJsonBlock
{ {
@@ -3216,9 +3181,7 @@ public sealed partial class AaruFormat
offset = (ulong)_imageStream.Position offset = (ulong)_imageStream.Position
}; };
AaruLogging.Debug(MODULE_NAME, AaruLogging.Debug(MODULE_NAME, Localization.Writing_checksum_block_to_position_0, idxEntry.offset);
Localization.Writing_checksum_block_to_position_0,
idxEntry.offset);
_structureBytes = new byte[Marshal.SizeOf<ChecksumHeader>()]; _structureBytes = new byte[Marshal.SizeOf<ChecksumHeader>()];
MemoryMarshal.Write(_structureBytes, in chkHeader); MemoryMarshal.Write(_structureBytes, in chkHeader);
@@ -3249,9 +3212,7 @@ public sealed partial class AaruFormat
offset = (ulong)_imageStream.Position offset = (ulong)_imageStream.Position
}; };
AaruLogging.Debug(MODULE_NAME, AaruLogging.Debug(MODULE_NAME, Localization.Writing_tape_partitions_to_position_0, idxEntry.offset);
Localization.Writing_tape_partitions_to_position_0,
idxEntry.offset);
var tapePartitionEntries = new TapePartitionEntry[TapePartitions.Count]; var tapePartitionEntries = new TapePartitionEntry[TapePartitions.Count];
@@ -4421,9 +4382,7 @@ public sealed partial class AaruFormat
offset = (ulong)_imageStream.Position offset = (ulong)_imageStream.Position
}; };
AaruLogging.Debug(MODULE_NAME, AaruLogging.Debug(MODULE_NAME, Localization.Writing_DVD_ID_block_to_position_0, idxEntry.offset);
Localization.Writing_DVD_ID_block_to_position_0,
idxEntry.offset);
Crc64Context.Data(_sectorId, out byte[] blockCrc); Crc64Context.Data(_sectorId, out byte[] blockCrc);
@@ -4522,9 +4481,7 @@ public sealed partial class AaruFormat
offset = (ulong)_imageStream.Position offset = (ulong)_imageStream.Position
}; };
AaruLogging.Debug(MODULE_NAME, AaruLogging.Debug(MODULE_NAME, Localization.Writing_DVD_IED_block_to_position_0, idxEntry.offset);
Localization.Writing_DVD_IED_block_to_position_0,
idxEntry.offset);
Crc64Context.Data(_sectorIed, out byte[] blockCrc); Crc64Context.Data(_sectorIed, out byte[] blockCrc);
@@ -4623,9 +4580,7 @@ public sealed partial class AaruFormat
offset = (ulong)_imageStream.Position offset = (ulong)_imageStream.Position
}; };
AaruLogging.Debug(MODULE_NAME, AaruLogging.Debug(MODULE_NAME, Localization.Writing_DVD_EDC_block_to_position_0, idxEntry.offset);
Localization.Writing_DVD_EDC_block_to_position_0,
idxEntry.offset);
Crc64Context.Data(_sectorEdc, out byte[] blockCrc); Crc64Context.Data(_sectorEdc, out byte[] blockCrc);
@@ -4897,9 +4852,7 @@ public sealed partial class AaruFormat
crc64 = BitConverter.ToUInt64(trksCrc, 0) crc64 = BitConverter.ToUInt64(trksCrc, 0)
}; };
AaruLogging.Debug(MODULE_NAME, AaruLogging.Debug(MODULE_NAME, Localization.Writing_tracks_to_position_0, _imageStream.Position);
Localization.Writing_tracks_to_position_0,
_imageStream.Position);
_index.RemoveAll(t => t is { blockType: BlockType.TracksBlock, dataType: DataType.NoData }); _index.RemoveAll(t => t is { blockType: BlockType.TracksBlock, dataType: DataType.NoData });

View File

@@ -43,6 +43,7 @@ using Aaru.CommonTypes.Structs;
using Aaru.Decoders.CD; using Aaru.Decoders.CD;
using Aaru.Helpers; using Aaru.Helpers;
using Aaru.Logging; using Aaru.Logging;
using Humanizer;
using Session = Aaru.CommonTypes.Structs.Session; using Session = Aaru.CommonTypes.Structs.Session;
namespace Aaru.Images; namespace Aaru.Images;
@@ -689,7 +690,7 @@ public sealed partial class BlindWrite4
}; };
partition.Offset = partition.Start * 2352; partition.Offset = partition.Start * 2352;
partition.Type = track.Type.ToString(); partition.Type = track.Type.Humanize();
Partitions.Add(partition); Partitions.Add(partition);
Tracks.Add(track); Tracks.Add(track);
@@ -744,9 +745,8 @@ public sealed partial class BlindWrite4
// As long as subchannel is written for any track, it is present for all tracks // As long as subchannel is written for any track, it is present for all tracks
if(Tracks.Any(t => t.SubchannelType == TrackSubchannelType.Packed)) if(Tracks.Any(t => t.SubchannelType == TrackSubchannelType.Packed))
{ foreach(Track track in Tracks)
foreach(Track track in Tracks) track.SubchannelType = TrackSubchannelType.Packed; track.SubchannelType = TrackSubchannelType.Packed;
}
_imageInfo.MediaType = MediaType.CD; _imageInfo.MediaType = MediaType.CD;

View File

@@ -49,6 +49,7 @@ using Aaru.Filters;
using Aaru.Helpers; using Aaru.Helpers;
using Aaru.Helpers.IO; using Aaru.Helpers.IO;
using Aaru.Logging; using Aaru.Logging;
using Humanizer;
using Sentry; using Sentry;
using DMI = Aaru.Decoders.Xbox.DMI; using DMI = Aaru.Decoders.Xbox.DMI;
using Sector = Aaru.Decoders.CD.Sector; using Sector = Aaru.Decoders.CD.Sector;
@@ -1136,7 +1137,7 @@ public sealed partial class BlindWrite5
partition.Sequence = track.Sequence; partition.Sequence = track.Sequence;
partition.Offset = offsetBytes; partition.Offset = offsetBytes;
partition.Start = track.StartSector; partition.Start = track.StartSector;
partition.Type = track.Type.ToString(); partition.Type = track.Type.Humanize();
offsetBytes += partition.Size; offsetBytes += partition.Size;

View File

@@ -90,7 +90,7 @@ public sealed partial class CdrWin
ulong previousStartSector = 0; ulong previousStartSector = 0;
const ulong gdRomSession2Offset = 45000; const ulong gdRomSession2Offset = 45000;
var previousTrackFile = ""; string previousTrackFile = "";
foreach(CdrWinTrack cdrTrack in _discImage.Tracks) foreach(CdrWinTrack cdrTrack in _discImage.Tracks)
{ {

View File

@@ -42,6 +42,7 @@ using Aaru.CommonTypes.Structs;
using Aaru.Decoders.CD; using Aaru.Decoders.CD;
using Aaru.Helpers; using Aaru.Helpers;
using Aaru.Logging; using Aaru.Logging;
using Humanizer;
using Session = Aaru.CommonTypes.Structs.Session; using Session = Aaru.CommonTypes.Structs.Session;
namespace Aaru.Images; namespace Aaru.Images;
@@ -130,8 +131,7 @@ public sealed partial class CloneCd
{ {
if(inDisk || inSession || inEntry || inTrack || inCdText) if(inDisk || inSession || inEntry || inTrack || inCdText)
{ {
AaruLogging.Error(string.Format(Localization.Found_CloneCD_out_of_order_in_line_0, AaruLogging.Error(string.Format(Localization.Found_CloneCD_out_of_order_in_line_0, lineNumber));
lineNumber));
return ErrorNumber.InvalidArgument; return ErrorNumber.InvalidArgument;
} }
@@ -193,9 +193,7 @@ public sealed partial class CloneCd
if(discEntMatch.Success) if(discEntMatch.Success)
{ {
AaruLogging.Debug(MODULE_NAME, AaruLogging.Debug(MODULE_NAME, Localization.Found_TocEntries_at_line_0, lineNumber);
Localization.Found_TocEntries_at_line_0,
lineNumber);
} }
else if(discSessMatch.Success) else if(discSessMatch.Success)
AaruLogging.Debug(MODULE_NAME, Localization.Found_Sessions_at_line_0, lineNumber); AaruLogging.Debug(MODULE_NAME, Localization.Found_Sessions_at_line_0, lineNumber);
@@ -209,15 +207,11 @@ public sealed partial class CloneCd
} }
else if(cdtLenMatch.Success) else if(cdtLenMatch.Success)
{ {
AaruLogging.Debug(MODULE_NAME, AaruLogging.Debug(MODULE_NAME, Localization.Found_CDTextLength_at_line_0, lineNumber);
Localization.Found_CDTextLength_at_line_0,
lineNumber);
} }
else if(discCatMatch.Success) else if(discCatMatch.Success)
{ {
AaruLogging.Debug(MODULE_NAME, AaruLogging.Debug(MODULE_NAME, Localization.Found_Catalog_at_line_0_smallcase, lineNumber);
Localization.Found_Catalog_at_line_0_smallcase,
lineNumber);
_catalog = discCatMatch.Groups["value"].Value; _catalog = discCatMatch.Groups["value"].Value;
} }
@@ -231,15 +225,11 @@ public sealed partial class CloneCd
if(cdtEntsMatch.Success) if(cdtEntsMatch.Success)
{ {
AaruLogging.Debug(MODULE_NAME, AaruLogging.Debug(MODULE_NAME, Localization.Found_CD_Text_Entries_at_line_0, lineNumber);
Localization.Found_CD_Text_Entries_at_line_0,
lineNumber);
} }
else if(cdtEntMatch.Success) else if(cdtEntMatch.Success)
{ {
AaruLogging.Debug(MODULE_NAME, AaruLogging.Debug(MODULE_NAME, Localization.Found_CD_Text_Entry_at_line_0, lineNumber);
Localization.Found_CD_Text_Entry_at_line_0,
lineNumber);
string[] bytes = cdtEntMatch.Groups["value"] string[] bytes = cdtEntMatch.Groups["value"]
.Value.Split(new[] .Value.Split(new[]
@@ -260,15 +250,11 @@ public sealed partial class CloneCd
if(sessPregMatch.Success) if(sessPregMatch.Success)
{ {
AaruLogging.Debug(MODULE_NAME, AaruLogging.Debug(MODULE_NAME, Localization.Found_PreGapMode_at_line_0, lineNumber);
Localization.Found_PreGapMode_at_line_0,
lineNumber);
} }
else if(sessSubcMatch.Success) else if(sessSubcMatch.Success)
{ {
AaruLogging.Debug(MODULE_NAME, AaruLogging.Debug(MODULE_NAME, Localization.Found_PreGapSubC_at_line_0, lineNumber);
Localization.Found_PreGapSubC_at_line_0,
lineNumber);
} }
} }
else if(inEntry) else if(inEntry)
@@ -836,7 +822,7 @@ public sealed partial class CloneCd
Sequence = track.Sequence, Sequence = track.Sequence,
Offset = track.FileOffset, Offset = track.FileOffset,
Start = (ulong)track.Indexes[1], Start = (ulong)track.Indexes[1],
Type = track.Type.ToString() Type = track.Type.Humanize()
}; };
Partitions.Add(partition); Partitions.Add(partition);

View File

@@ -42,6 +42,7 @@ using Aaru.CommonTypes.Structs;
using Aaru.Decoders.CD; using Aaru.Decoders.CD;
using Aaru.Helpers; using Aaru.Helpers;
using Aaru.Logging; using Aaru.Logging;
using Humanizer;
using Session = Aaru.CommonTypes.Structs.Session; using Session = Aaru.CommonTypes.Structs.Session;
namespace Aaru.Images; namespace Aaru.Images;
@@ -406,8 +407,7 @@ public sealed partial class DiscJuggler
break; break;
case 1: case 1:
AaruLogging.Error(string.Format(Localization AaruLogging.Error(string.Format(Localization.Invalid_read_mode_0_for_this_track,
.Invalid_read_mode_0_for_this_track,
readMode)); readMode));
return ErrorNumber.InvalidArgument; return ErrorNumber.InvalidArgument;
@@ -514,8 +514,7 @@ public sealed partial class DiscJuggler
switch(readMode) switch(readMode)
{ {
case 0: case 0:
AaruLogging.Error(string.Format(Localization AaruLogging.Error(string.Format(Localization.Invalid_read_mode_0_for_this_track,
.Invalid_read_mode_0_for_this_track,
readMode)); readMode));
return ErrorNumber.InvalidArgument; return ErrorNumber.InvalidArgument;
@@ -609,7 +608,7 @@ public sealed partial class DiscJuggler
Sequence = track.Sequence, Sequence = track.Sequence,
Offset = track.FileOffset, Offset = track.FileOffset,
Start = track.StartSector, Start = track.StartSector,
Type = track.Type.ToString() Type = track.Type.Humanize()
}; };
if(track.Sequence > 1 && track.Pregap > 0) if(track.Sequence > 1 && track.Pregap > 0)

View File

@@ -103,8 +103,7 @@ public sealed partial class Gdi
} }
AaruLogging.Debug(MODULE_NAME, AaruLogging.Debug(MODULE_NAME,
Localization Localization.Found_track_0_starts_at_1_flags_2_type_3_file_4_offset_5_at_line_6,
.Found_track_0_starts_at_1_flags_2_type_3_file_4_offset_5_at_line_6,
trackMatch.Groups["track"].Value, trackMatch.Groups["track"].Value,
trackMatch.Groups["start"].Value, trackMatch.Groups["start"].Value,
trackMatch.Groups["flags"].Value, trackMatch.Groups["flags"].Value,
@@ -216,9 +215,7 @@ public sealed partial class Gdi
AaruLogging.Debug(MODULE_NAME, Localization.Session_information); AaruLogging.Debug(MODULE_NAME, Localization.Session_information);
AaruLogging.Debug(MODULE_NAME, AaruLogging.Debug(MODULE_NAME, "\t" + Localization.Disc_contains_0_sessions, _discImage.Sessions.Count);
"\t" + Localization.Disc_contains_0_sessions,
_discImage.Sessions.Count);
for(int i = 0; i < _discImage.Sessions.Count; i++) for(int i = 0; i < _discImage.Sessions.Count; i++)
{ {
@@ -232,34 +229,22 @@ public sealed partial class Gdi
"\t\t" + Localization.Starting_sector_0, "\t\t" + Localization.Starting_sector_0,
_discImage.Sessions[i].StartSector); _discImage.Sessions[i].StartSector);
AaruLogging.Debug(MODULE_NAME, AaruLogging.Debug(MODULE_NAME, "\t\t" + Localization.Ending_track_0, _discImage.Sessions[i].EndTrack);
"\t\t" + Localization.Ending_track_0,
_discImage.Sessions[i].EndTrack);
AaruLogging.Debug(MODULE_NAME, AaruLogging.Debug(MODULE_NAME, "\t\t" + Localization.Ending_sector_0, _discImage.Sessions[i].EndSector);
"\t\t" + Localization.Ending_sector_0,
_discImage.Sessions[i].EndSector);
} }
AaruLogging.Debug(MODULE_NAME, Localization.Track_information); AaruLogging.Debug(MODULE_NAME, Localization.Track_information);
AaruLogging.Debug(MODULE_NAME, AaruLogging.Debug(MODULE_NAME, "\t" + Localization.Disc_contains_0_tracks, _discImage.Tracks.Count);
"\t" + Localization.Disc_contains_0_tracks,
_discImage.Tracks.Count);
for(int i = 0; i < _discImage.Tracks.Count; i++) for(int i = 0; i < _discImage.Tracks.Count; i++)
{ {
AaruLogging.Debug(MODULE_NAME, AaruLogging.Debug(MODULE_NAME, "\t" + Localization.Track_0_information, _discImage.Tracks[i].Sequence);
"\t" + Localization.Track_0_information,
_discImage.Tracks[i].Sequence);
AaruLogging.Debug(MODULE_NAME, AaruLogging.Debug(MODULE_NAME, "\t\t" + Localization._0_bytes_per_sector, _discImage.Tracks[i].Bps);
"\t\t" + Localization._0_bytes_per_sector,
_discImage.Tracks[i].Bps);
AaruLogging.Debug(MODULE_NAME, AaruLogging.Debug(MODULE_NAME, "\t\t" + Localization.Pregap_0_sectors, _discImage.Tracks[i].Pregap);
"\t\t" + Localization.Pregap_0_sectors,
_discImage.Tracks[i].Pregap);
if((_discImage.Tracks[i].Flags & 0x8) == 0x8) if((_discImage.Tracks[i].Flags & 0x8) == 0x8)
AaruLogging.Debug(MODULE_NAME, "\t\t" + Localization.Track_is_flagged_as_quadraphonic); AaruLogging.Debug(MODULE_NAME, "\t\t" + Localization.Track_is_flagged_as_quadraphonic);
@@ -274,8 +259,7 @@ public sealed partial class Gdi
AaruLogging.Debug(MODULE_NAME, "\t\t" + Localization.Track_has_pre_emphasis_applied); AaruLogging.Debug(MODULE_NAME, "\t\t" + Localization.Track_has_pre_emphasis_applied);
AaruLogging.Debug(MODULE_NAME, AaruLogging.Debug(MODULE_NAME,
"\t\t" + "\t\t" + Localization.Track_resides_in_file_0_type_defined_as_1_starting_at_byte_2,
Localization.Track_resides_in_file_0_type_defined_as_1_starting_at_byte_2,
_discImage.Tracks[i].TrackFilter, _discImage.Tracks[i].TrackFilter,
_discImage.Tracks[i].TrackType, _discImage.Tracks[i].TrackType,
_discImage.Tracks[i].Offset); _discImage.Tracks[i].Offset);

View File

@@ -357,7 +357,7 @@ sealed class DeviceInfoCommand : Command<DeviceInfoCommand.Settings>
AaruLogging.WriteLine(removable AaruLogging.WriteLine(removable
? Localization.Core.Media_identified_as_0 ? Localization.Core.Media_identified_as_0
: Localization.Core.Device_identified_as_0, : Localization.Core.Device_identified_as_0,
mediaType); mediaType.Humanize());
Statistics.AddMedia(mediaType, true); Statistics.AddMedia(mediaType, true);
} }

View File

@@ -51,6 +51,7 @@ using Aaru.Decoders.SCSI.SSC;
using Aaru.Decoders.Xbox; using Aaru.Decoders.Xbox;
using Aaru.Localization; using Aaru.Localization;
using Aaru.Logging; using Aaru.Logging;
using Humanizer;
using Humanizer.Bytes; using Humanizer.Bytes;
using Spectre.Console; using Spectre.Console;
using Spectre.Console.Cli; using Spectre.Console.Cli;
@@ -796,7 +797,7 @@ sealed class MediaInfoCommand : Command<MediaInfoCommand.Settings>
AaruLogging.WriteLine(""); AaruLogging.WriteLine("");
} }
AaruLogging.WriteLine(Localization.Core.Media_identified_as_0, scsiInfo.MediaType); AaruLogging.WriteLine(Localization.Core.Media_identified_as_0, scsiInfo.MediaType.Humanize());
Statistics.AddMedia(scsiInfo.MediaType, true); Statistics.AddMedia(scsiInfo.MediaType, true);
if(scsiInfo.Toc != null || scsiInfo.RawToc != null) if(scsiInfo.Toc != null || scsiInfo.RawToc != null)
@@ -851,7 +852,7 @@ sealed class MediaInfoCommand : Command<MediaInfoCommand.Settings>
track.StartSector, track.StartSector,
track.EndSector, track.EndSector,
track.Pregap, track.Pregap,
track.Type); track.Type.Humanize());
} }
AaruLogging.WriteLine(); AaruLogging.WriteLine();