[Aaru.Filesystems] Introduced constants for module names

Introduces constant fields for respective debug module names, replacing the hardcoded ones.
This is done to standardize the naming convention, reduce redundancy and potentially avoid any typos or name mismatches across the project.
This change makes the code more maintainable and easier to update in case module names need to be changed.
This commit is contained in:
2023-10-03 17:47:32 +01:00
parent 741bb5389a
commit 4ef3252b24
67 changed files with 721 additions and 687 deletions

View File

@@ -87,10 +87,10 @@ public sealed partial class FAT
ulong expectedClusters = humanBpb.bpc > 0 ? partition.Size / humanBpb.bpc : 0;
AaruConsole.DebugWriteLine("FAT plugin", "Human bpc = {0}", humanBpb.bpc);
AaruConsole.DebugWriteLine("FAT plugin", "Human clusters = {0}", humanBpb.clusters);
AaruConsole.DebugWriteLine("FAT plugin", "Human big_clusters = {0}", humanBpb.big_clusters);
AaruConsole.DebugWriteLine("FAT plugin", "Human expected clusters = {0}", expectedClusters);
AaruConsole.DebugWriteLine(MODULE_NAME, "Human bpc = {0}", humanBpb.bpc);
AaruConsole.DebugWriteLine(MODULE_NAME, "Human clusters = {0}", humanBpb.clusters);
AaruConsole.DebugWriteLine(MODULE_NAME, "Human big_clusters = {0}", humanBpb.big_clusters);
AaruConsole.DebugWriteLine(MODULE_NAME, "Human expected clusters = {0}", expectedClusters);
// Check clusters for Human68k are correct
bool humanClustersCorrect = humanBpb.clusters == 0 ? humanBpb.big_clusters == expectedClusters
@@ -107,9 +107,9 @@ public sealed partial class FAT
// Check correct branch for Human68k
bool humanBranchCorrect = bpbSector[0] == 0x60 && bpbSector[1] >= 0x20 && bpbSector[1] < 0xFE;
AaruConsole.DebugWriteLine("FAT plugin", "humanClustersCorrect = {0}", humanClustersCorrect);
AaruConsole.DebugWriteLine("FAT plugin", "humanOemCorrect = {0}", humanOemCorrect);
AaruConsole.DebugWriteLine("FAT plugin", "humanBranchCorrect = {0}", humanBranchCorrect);
AaruConsole.DebugWriteLine(MODULE_NAME, "humanClustersCorrect = {0}", humanClustersCorrect);
AaruConsole.DebugWriteLine(MODULE_NAME, "humanOemCorrect = {0}", humanOemCorrect);
AaruConsole.DebugWriteLine(MODULE_NAME, "humanBranchCorrect = {0}", humanBranchCorrect);
// If all Human68k checks are correct, it is a Human68k FAT16
if(humanClustersCorrect &&
@@ -152,25 +152,25 @@ public sealed partial class FAT
string oemString = Encoding.ASCII.GetString(dosOem);
AaruConsole.DebugWriteLine("FAT plugin", "atari_oem_correct = {0}", atariOemCorrect);
AaruConsole.DebugWriteLine("FAT plugin", "dos_oem_correct = {0}", dosOemCorrect);
AaruConsole.DebugWriteLine("FAT plugin", "bps = {0}", bps);
AaruConsole.DebugWriteLine("FAT plugin", "bits in bps = {0}", bitsInBps);
AaruConsole.DebugWriteLine("FAT plugin", "spc = {0}", spc);
AaruConsole.DebugWriteLine("FAT plugin", "correct_spc = {0}", correctSpc);
AaruConsole.DebugWriteLine("FAT plugin", "reserved_secs = {0}", reservedSecs);
AaruConsole.DebugWriteLine("FAT plugin", "fats_no = {0}", numberOfFats);
AaruConsole.DebugWriteLine("FAT plugin", "root_entries = {0}", rootEntries);
AaruConsole.DebugWriteLine("FAT plugin", "sectors = {0}", sectors);
AaruConsole.DebugWriteLine("FAT plugin", "media_descriptor = 0x{0:X2}", mediaDescriptor);
AaruConsole.DebugWriteLine("FAT plugin", "fat_sectors = {0}", fatSectors);
AaruConsole.DebugWriteLine("FAT plugin", "msx_id = \"{0}\"", msxString);
AaruConsole.DebugWriteLine("FAT plugin", "big_sectors = {0}", bigSectors);
AaruConsole.DebugWriteLine("FAT plugin", "bpb_signature = 0x{0:X2}", bpbSignature);
AaruConsole.DebugWriteLine("FAT plugin", "fat32_signature = 0x{0:X2}", fat32Signature);
AaruConsole.DebugWriteLine("FAT plugin", "fat32_id = \"{0}\"", fat32String);
AaruConsole.DebugWriteLine("FAT plugin", "huge_sectors = {0}", hugeSectors);
AaruConsole.DebugWriteLine("FAT plugin", "fat_id = 0x{0:X2}", fatId);
AaruConsole.DebugWriteLine(MODULE_NAME, "atari_oem_correct = {0}", atariOemCorrect);
AaruConsole.DebugWriteLine(MODULE_NAME, "dos_oem_correct = {0}", dosOemCorrect);
AaruConsole.DebugWriteLine(MODULE_NAME, "bps = {0}", bps);
AaruConsole.DebugWriteLine(MODULE_NAME, "bits in bps = {0}", bitsInBps);
AaruConsole.DebugWriteLine(MODULE_NAME, "spc = {0}", spc);
AaruConsole.DebugWriteLine(MODULE_NAME, "correct_spc = {0}", correctSpc);
AaruConsole.DebugWriteLine(MODULE_NAME, "reserved_secs = {0}", reservedSecs);
AaruConsole.DebugWriteLine(MODULE_NAME, "fats_no = {0}", numberOfFats);
AaruConsole.DebugWriteLine(MODULE_NAME, "root_entries = {0}", rootEntries);
AaruConsole.DebugWriteLine(MODULE_NAME, "sectors = {0}", sectors);
AaruConsole.DebugWriteLine(MODULE_NAME, "media_descriptor = 0x{0:X2}", mediaDescriptor);
AaruConsole.DebugWriteLine(MODULE_NAME, "fat_sectors = {0}", fatSectors);
AaruConsole.DebugWriteLine(MODULE_NAME, "msx_id = \"{0}\"", msxString);
AaruConsole.DebugWriteLine(MODULE_NAME, "big_sectors = {0}", bigSectors);
AaruConsole.DebugWriteLine(MODULE_NAME, "bpb_signature = 0x{0:X2}", bpbSignature);
AaruConsole.DebugWriteLine(MODULE_NAME, "fat32_signature = 0x{0:X2}", fat32Signature);
AaruConsole.DebugWriteLine(MODULE_NAME, "fat32_id = \"{0}\"", fat32String);
AaruConsole.DebugWriteLine(MODULE_NAME, "huge_sectors = {0}", hugeSectors);
AaruConsole.DebugWriteLine(MODULE_NAME, "fat_id = 0x{0:X2}", fatId);
ushort apricotBps = BitConverter.ToUInt16(bpbSector, 0x50);
byte apricotSpc = bpbSector[0x52];
@@ -186,15 +186,15 @@ public sealed partial class FAT
int bitsInApricotBps = CountBits.Count(apricotBps);
byte apricotPartitions = bpbSector[0x0C];
AaruConsole.DebugWriteLine("FAT plugin", "apricot_bps = {0}", apricotBps);
AaruConsole.DebugWriteLine("FAT plugin", "apricot_spc = {0}", apricotSpc);
AaruConsole.DebugWriteLine("FAT plugin", "apricot_correct_spc = {0}", apricotCorrectSpc);
AaruConsole.DebugWriteLine("FAT plugin", "apricot_reserved_secs = {0}", apricotReservedSecs);
AaruConsole.DebugWriteLine("FAT plugin", "apricot_fats_no = {0}", apricotFatsNo);
AaruConsole.DebugWriteLine("FAT plugin", "apricot_root_entries = {0}", apricotRootEntries);
AaruConsole.DebugWriteLine("FAT plugin", "apricot_sectors = {0}", apricotSectors);
AaruConsole.DebugWriteLine("FAT plugin", "apricot_media_descriptor = 0x{0:X2}", apricotMediaDescriptor);
AaruConsole.DebugWriteLine("FAT plugin", "apricot_fat_sectors = {0}", apricotFatSectors);
AaruConsole.DebugWriteLine(MODULE_NAME, "apricot_bps = {0}", apricotBps);
AaruConsole.DebugWriteLine(MODULE_NAME, "apricot_spc = {0}", apricotSpc);
AaruConsole.DebugWriteLine(MODULE_NAME, "apricot_correct_spc = {0}", apricotCorrectSpc);
AaruConsole.DebugWriteLine(MODULE_NAME, "apricot_reserved_secs = {0}", apricotReservedSecs);
AaruConsole.DebugWriteLine(MODULE_NAME, "apricot_fats_no = {0}", apricotFatsNo);
AaruConsole.DebugWriteLine(MODULE_NAME, "apricot_root_entries = {0}", apricotRootEntries);
AaruConsole.DebugWriteLine(MODULE_NAME, "apricot_sectors = {0}", apricotSectors);
AaruConsole.DebugWriteLine(MODULE_NAME, "apricot_media_descriptor = 0x{0:X2}", apricotMediaDescriptor);
AaruConsole.DebugWriteLine(MODULE_NAME, "apricot_fat_sectors = {0}", apricotFatSectors);
// This is to support FAT partitions on hybrid ISO/USB images
if(imagePlugin.Info.MetadataMediaType == MetadataMediaType.OpticalDisc)
@@ -347,7 +347,7 @@ public sealed partial class FAT
byte fat3 = fatSector[2];
ushort fatCluster2 = (ushort)(((fat2 << 8) + fat3) & 0xFFF);
AaruConsole.DebugWriteLine("FAT plugin", "1st fat cluster 1 = {0:X3}", fatCluster2);
AaruConsole.DebugWriteLine(MODULE_NAME, "1st fat cluster 1 = {0:X3}", fatCluster2);
if(fatCluster2 < 0xFF0)
return false;
@@ -403,7 +403,7 @@ public sealed partial class FAT
fat2SectorNo == 0)
return false;
AaruConsole.DebugWriteLine("FAT plugin", Localization.Second_fat_starts_at_0, fat2SectorNo);
AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Second_fat_starts_at_0, fat2SectorNo);
errno = imagePlugin.ReadSector(fat2SectorNo, out byte[] fat2Sector);