From 3c4ef2b3d68d9bfa46789191f2a73a5e1aed7f85 Mon Sep 17 00:00:00 2001 From: Natalia Portillo Date: Tue, 3 Oct 2023 16:52:02 +0100 Subject: [PATCH] [Aaru] 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. --- Aaru/Commands/Archive/Info.cs | 8 +- Aaru/Commands/Database/Update.cs | 7 +- Aaru/Commands/Device/DeviceReport.cs | 22 +++-- Aaru/Commands/Device/Info.cs | 108 +++++++++++---------- Aaru/Commands/Device/List.cs | 6 +- Aaru/Commands/Filesystem/ExtractFiles.cs | 33 ++++--- Aaru/Commands/Filesystem/Info.cs | 20 ++-- Aaru/Commands/Filesystem/Ls.cs | 28 +++--- Aaru/Commands/Filesystem/Options.cs | 6 +- Aaru/Commands/Formats.cs | 6 +- Aaru/Commands/Image/Checksum.cs | 41 ++++---- Aaru/Commands/Image/Compare.cs | 10 +- Aaru/Commands/Image/Convert.cs | 92 +++++++++--------- Aaru/Commands/Image/CreateSidecar.cs | 17 ++-- Aaru/Commands/Image/Decode.cs | 16 +-- Aaru/Commands/Image/Entropy.cs | 13 +-- Aaru/Commands/Image/Info.cs | 12 ++- Aaru/Commands/Image/Options.cs | 6 +- Aaru/Commands/Image/Print.cs | 16 +-- Aaru/Commands/Image/Verify.cs | 16 +-- Aaru/Commands/ListEncodings.cs | 6 +- Aaru/Commands/ListNamespaces.cs | 6 +- Aaru/Commands/Media/Dump.cs | 77 +++++++-------- Aaru/Commands/Media/Info.cs | 118 ++++++++++++----------- Aaru/Commands/Media/Scan.cs | 13 +-- Aaru/Commands/Remote.cs | 8 +- 26 files changed, 378 insertions(+), 333 deletions(-) diff --git a/Aaru/Commands/Archive/Info.cs b/Aaru/Commands/Archive/Info.cs index e0eb9d0f6..94160a69c 100644 --- a/Aaru/Commands/Archive/Info.cs +++ b/Aaru/Commands/Archive/Info.cs @@ -43,6 +43,8 @@ namespace Aaru.Commands.Archive; sealed class ArchiveInfoCommand : Command { + const string MODULE_NAME = "Analyze command"; + public ArchiveInfoCommand() : base("info", UI.Archive_Info_Command_Description) { AddArgument(new Argument @@ -86,9 +88,9 @@ sealed class ArchiveInfoCommand : Command Statistics.AddCommand("archive-info"); - AaruConsole.DebugWriteLine("Analyze command", "--debug={0}", debug); - AaruConsole.DebugWriteLine("Analyze command", "--input={0}", imagePath); - AaruConsole.DebugWriteLine("Analyze command", "--verbose={0}", verbose); + AaruConsole.DebugWriteLine(MODULE_NAME, "--debug={0}", debug); + AaruConsole.DebugWriteLine(MODULE_NAME, "--input={0}", imagePath); + AaruConsole.DebugWriteLine(MODULE_NAME, "--verbose={0}", verbose); /* TODO: This is just a stub for now */ diff --git a/Aaru/Commands/Database/Update.cs b/Aaru/Commands/Database/Update.cs index 859eb663e..e0a9ef299 100644 --- a/Aaru/Commands/Database/Update.cs +++ b/Aaru/Commands/Database/Update.cs @@ -47,7 +47,8 @@ namespace Aaru.Commands.Database; sealed class UpdateCommand : Command { - readonly bool _mainDbUpdate; + const string MODULE_NAME = "Update command"; + readonly bool _mainDbUpdate; public UpdateCommand(bool mainDbUpdate) : base("update", UI.Database_Update_Command_Description) { @@ -91,8 +92,8 @@ sealed class UpdateCommand : Command AnsiConsole.Markup(format, objects); }; - AaruConsole.DebugWriteLine("Update command", "--debug={0}", debug); - AaruConsole.DebugWriteLine("Update command", "--verbose={0}", verbose); + AaruConsole.DebugWriteLine(MODULE_NAME, "--debug={0}", debug); + AaruConsole.DebugWriteLine(MODULE_NAME, "--verbose={0}", verbose); if(clearAll) try diff --git a/Aaru/Commands/Device/DeviceReport.cs b/Aaru/Commands/Device/DeviceReport.cs index 301aef130..362f31b16 100644 --- a/Aaru/Commands/Device/DeviceReport.cs +++ b/Aaru/Commands/Device/DeviceReport.cs @@ -59,6 +59,8 @@ namespace Aaru.Commands.Device; sealed class DeviceReportCommand : Command { + const string MODULE_NAME = "Device-Report command"; + public DeviceReportCommand() : base("report", UI.Device_Report_Command_Description) { AddArgument(new Argument @@ -107,9 +109,9 @@ sealed class DeviceReportCommand : Command Statistics.AddCommand("device-report"); - AaruConsole.DebugWriteLine("Device-Report command", "--debug={0}", debug); - AaruConsole.DebugWriteLine("Device-Report command", "--device={0}", devicePath); - AaruConsole.DebugWriteLine("Device-Report command", "--verbose={0}", verbose); + AaruConsole.DebugWriteLine(MODULE_NAME, "--debug={0}", debug); + AaruConsole.DebugWriteLine(MODULE_NAME, "--device={0}", devicePath); + AaruConsole.DebugWriteLine(MODULE_NAME, "--verbose={0}", verbose); if(devicePath.Length == 2 && devicePath[1] == ':' && @@ -817,7 +819,7 @@ sealed class DeviceReportCommand : Command break; } default: - AaruConsole.DebugWriteLine("Device-Report command", + AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Core.Device_not_ready_Sense, decSense.Value.SenseKey, decSense.Value.ASC, decSense.Value.ASCQ); @@ -828,7 +830,7 @@ sealed class DeviceReportCommand : Command } else { - AaruConsole.DebugWriteLine("Device-Report command", + AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Core. Got_sense_status_but_no_sense_buffer); @@ -958,7 +960,7 @@ sealed class DeviceReportCommand : Command ctx.AddTask(Localization.Core.Waiting_for_drive_to_become_ready).IsIndeterminate(); sense = dev.ScsiTestUnitReady(out senseBuffer, dev.Timeout, out _); - AaruConsole.DebugWriteLine("Device reporting", "sense = {0}", sense); + AaruConsole.DebugWriteLine(MODULE_NAME, "sense = {0}", sense); if(!sense) return; @@ -1037,7 +1039,7 @@ sealed class DeviceReportCommand : Command break; } default: - AaruConsole.DebugWriteLine("Device-Report command", + AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Core.Device_not_ready_Sense, decSense.Value.SenseKey, decSense.Value.ASC, decSense.Value.ASCQ); @@ -1048,7 +1050,7 @@ sealed class DeviceReportCommand : Command } else { - AaruConsole.DebugWriteLine("Device-Report command", + AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Core.Got_sense_status_but_no_sense_buffer); mediaIsRecognized = false; @@ -1185,7 +1187,7 @@ sealed class DeviceReportCommand : Command break; } default: - AaruConsole.DebugWriteLine("Device-Report command", + AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Core.Device_not_ready_Sense, decSense.Value.SenseKey, decSense.Value.ASC, decSense.Value.ASCQ); @@ -1196,7 +1198,7 @@ sealed class DeviceReportCommand : Command } else { - AaruConsole.DebugWriteLine("Device-Report command", + AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Core.Got_sense_status_but_no_sense_buffer); mediaIsRecognized = false; diff --git a/Aaru/Commands/Device/Info.cs b/Aaru/Commands/Device/Info.cs index 8e8fb7db2..4fb74c83b 100644 --- a/Aaru/Commands/Device/Info.cs +++ b/Aaru/Commands/Device/Info.cs @@ -64,6 +64,8 @@ namespace Aaru.Commands.Device; sealed class DeviceInfoCommand : Command { + const string MODULE_NAME = "Device-Info command"; + public DeviceInfoCommand() : base("info", UI.Device_Info_Command_Description) { Add(new Option(new[] @@ -112,10 +114,10 @@ sealed class DeviceInfoCommand : Command Statistics.AddCommand("device-info"); - AaruConsole.DebugWriteLine("Device-Info command", "--debug={0}", debug); - AaruConsole.DebugWriteLine("Device-Info command", "--device={0}", devicePath); - AaruConsole.DebugWriteLine("Device-Info command", "--output-prefix={0}", outputPrefix); - AaruConsole.DebugWriteLine("Device-Info command", "--verbose={0}", verbose); + AaruConsole.DebugWriteLine(MODULE_NAME, "--debug={0}", debug); + AaruConsole.DebugWriteLine(MODULE_NAME, "--device={0}", devicePath); + AaruConsole.DebugWriteLine(MODULE_NAME, "--output-prefix={0}", outputPrefix); + AaruConsole.DebugWriteLine(MODULE_NAME, "--verbose={0}", verbose); if(devicePath.Length == 2 && devicePath[1] == ':' && @@ -256,25 +258,25 @@ sealed class DeviceInfoCommand : Command case TupleCodes.CISTPL_SPCL: case TupleCodes.CISTPL_SWIL: case TupleCodes.CISTPL_VERS_2: - AaruConsole.DebugWriteLine("Device-Info command", + AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Core.Invoke_Found_undecoded_tuple_ID_0, tuple.Code); break; default: - AaruConsole.DebugWriteLine("Device-Info command", + AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Core.Found_unknown_tuple_ID_0, (byte)tuple.Code); break; } else - AaruConsole.DebugWriteLine("Device-Info command", Localization.Core.Could_not_get_tuples); + AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Core.Could_not_get_tuples); } var devInfo = new DeviceInfo(dev); if(devInfo.AtaIdentify != null) { - DataFile.WriteTo("Device-Info command", outputPrefix, "_ata_identify.bin", "ATA IDENTIFY", + DataFile.WriteTo(MODULE_NAME, outputPrefix, "_ata_identify.bin", "ATA IDENTIFY", devInfo.AtaIdentify); Identify.IdentifyDevice? decodedIdentify = Identify.Decode(devInfo.AtaIdentify); @@ -356,7 +358,7 @@ sealed class DeviceInfoCommand : Command if(devInfo.AtapiIdentify != null) { - DataFile.WriteTo("Device-Info command", outputPrefix, "_atapi_identify.bin", "ATAPI IDENTIFY", + DataFile.WriteTo(MODULE_NAME, outputPrefix, "_atapi_identify.bin", "ATAPI IDENTIFY", devInfo.AtapiIdentify); AaruConsole.WriteLine(Decoders.ATA.Identify.Prettify(devInfo.AtapiIdentify)); @@ -367,7 +369,7 @@ sealed class DeviceInfoCommand : Command if(dev.Type != DeviceType.ATAPI) AaruConsole.WriteLine($"[bold]{UI.Title_SCSI_device}[/]"); - DataFile.WriteTo("Device-Info command", outputPrefix, "_scsi_inquiry.bin", UI.Title_SCSI_INQUIRY, + DataFile.WriteTo(MODULE_NAME, outputPrefix, "_scsi_inquiry.bin", UI.Title_SCSI_INQUIRY, devInfo.ScsiInquiryData); AaruConsole.WriteLine(Inquiry.Prettify(devInfo.ScsiInquiry)); @@ -380,21 +382,21 @@ sealed class DeviceInfoCommand : Command AaruConsole.WriteLine(Localization.Core.ASCII_Page_0_1, page.Key, EVPD.DecodeASCIIPage(page.Value)); - DataFile.WriteTo("Device-Info command", outputPrefix, page.Value); + DataFile.WriteTo(MODULE_NAME, outputPrefix, page.Value); break; case 0x80: AaruConsole.WriteLine(Localization.Core.Unit_Serial_Number_0, EVPD.DecodePage80(page.Value)); - DataFile.WriteTo("Device-Info command", outputPrefix, $"_scsi_evpd_{page.Key:X2}h.bin", + DataFile.WriteTo(MODULE_NAME, outputPrefix, $"_scsi_evpd_{page.Key:X2}h.bin", $"SCSI INQUIRY EVPD {page.Key:X2}h", page.Value); break; case 0x81: AaruConsole.WriteLine("{0}", EVPD.PrettifyPage_81(page.Value)); - DataFile.WriteTo("Device-Info command", outputPrefix, $"_scsi_evpd_{page.Key:X2}h.bin", + DataFile.WriteTo(MODULE_NAME, outputPrefix, $"_scsi_evpd_{page.Key:X2}h.bin", $"SCSI INQUIRY EVPD {page.Key:X2}h", page.Value); break; @@ -402,49 +404,49 @@ sealed class DeviceInfoCommand : Command AaruConsole.WriteLine(Localization.Core.ASCII_implemented_operating_definitions_0, EVPD.DecodePage82(page.Value)); - DataFile.WriteTo("Device-Info command", outputPrefix, $"_scsi_evpd_{page.Key:X2}h.bin", + DataFile.WriteTo(MODULE_NAME, outputPrefix, $"_scsi_evpd_{page.Key:X2}h.bin", $"SCSI INQUIRY EVPD {page.Key:X2}h", page.Value); break; case 0x83: AaruConsole.WriteLine("{0}", EVPD.PrettifyPage_83(page.Value)); - DataFile.WriteTo("Device-Info command", outputPrefix, $"_scsi_evpd_{page.Key:X2}h.bin", + DataFile.WriteTo(MODULE_NAME, outputPrefix, $"_scsi_evpd_{page.Key:X2}h.bin", $"SCSI INQUIRY EVPD {page.Key:X2}h", page.Value); break; case 0x84: AaruConsole.WriteLine("{0}", EVPD.PrettifyPage_84(page.Value)); - DataFile.WriteTo("Device-Info command", outputPrefix, $"_scsi_evpd_{page.Key:X2}h.bin", + DataFile.WriteTo(MODULE_NAME, outputPrefix, $"_scsi_evpd_{page.Key:X2}h.bin", $"SCSI INQUIRY EVPD {page.Key:X2}h", page.Value); break; case 0x85: AaruConsole.WriteLine("{0}", EVPD.PrettifyPage_85(page.Value)); - DataFile.WriteTo("Device-Info command", outputPrefix, $"_scsi_evpd_{page.Key:X2}h.bin", + DataFile.WriteTo(MODULE_NAME, outputPrefix, $"_scsi_evpd_{page.Key:X2}h.bin", $"SCSI INQUIRY EVPD {page.Key:X2}h", page.Value); break; case 0x86: AaruConsole.WriteLine("{0}", EVPD.PrettifyPage_86(page.Value)); - DataFile.WriteTo("Device-Info command", outputPrefix, $"_scsi_evpd_{page.Key:X2}h.bin", + DataFile.WriteTo(MODULE_NAME, outputPrefix, $"_scsi_evpd_{page.Key:X2}h.bin", $"SCSI INQUIRY EVPD {page.Key:X2}h", page.Value); break; case 0x89: AaruConsole.WriteLine("{0}", EVPD.PrettifyPage_89(page.Value)); - DataFile.WriteTo("Device-Info command", outputPrefix, $"_scsi_evpd_{page.Key:X2}h.bin", + DataFile.WriteTo(MODULE_NAME, outputPrefix, $"_scsi_evpd_{page.Key:X2}h.bin", $"SCSI INQUIRY EVPD {page.Key:X2}h", page.Value); break; case 0xB0: AaruConsole.WriteLine("{0}", EVPD.PrettifyPage_B0(page.Value)); - DataFile.WriteTo("Device-Info command", outputPrefix, $"_scsi_evpd_{page.Key:X2}h.bin", + DataFile.WriteTo(MODULE_NAME, outputPrefix, $"_scsi_evpd_{page.Key:X2}h.bin", $"SCSI INQUIRY EVPD {page.Key:X2}h", page.Value); break; @@ -452,7 +454,7 @@ sealed class DeviceInfoCommand : Command AaruConsole.WriteLine(Localization.Core.Manufacturer_assigned_Serial_Number_0, EVPD.DecodePageB1(page.Value)); - DataFile.WriteTo("Device-Info command", outputPrefix, $"_scsi_evpd_{page.Key:X2}h.bin", + DataFile.WriteTo(MODULE_NAME, outputPrefix, $"_scsi_evpd_{page.Key:X2}h.bin", $"SCSI INQUIRY EVPD {page.Key:X2}h", page.Value); break; @@ -460,7 +462,7 @@ sealed class DeviceInfoCommand : Command AaruConsole.WriteLine(Localization.Core.TapeAlert_Supported_Flags_Bitmap_0, EVPD.DecodePageB2(page.Value)); - DataFile.WriteTo("Device-Info command", outputPrefix, $"_scsi_evpd_{page.Key:X2}h.bin", + DataFile.WriteTo(MODULE_NAME, outputPrefix, $"_scsi_evpd_{page.Key:X2}h.bin", $"SCSI INQUIRY EVPD {page.Key:X2}h", page.Value); break; @@ -468,7 +470,7 @@ sealed class DeviceInfoCommand : Command AaruConsole.WriteLine(Localization.Core.Automation_Device_Serial_Number_0, EVPD.DecodePageB3(page.Value)); - DataFile.WriteTo("Device-Info command", outputPrefix, $"_scsi_evpd_{page.Key:X2}h.bin", + DataFile.WriteTo(MODULE_NAME, outputPrefix, $"_scsi_evpd_{page.Key:X2}h.bin", $"SCSI INQUIRY EVPD {page.Key:X2}h", page.Value); break; @@ -476,7 +478,7 @@ sealed class DeviceInfoCommand : Command AaruConsole.WriteLine(Localization.Core.Data_Transfer_Device_Element_Address_0, EVPD.DecodePageB4(page.Value)); - DataFile.WriteTo("Device-Info command", outputPrefix, $"_scsi_evpd_{page.Key:X2}h.bin", + DataFile.WriteTo(MODULE_NAME, outputPrefix, $"_scsi_evpd_{page.Key:X2}h.bin", $"SCSI INQUIRY EVPD {page.Key:X2}h", page.Value); break; @@ -484,7 +486,7 @@ sealed class DeviceInfoCommand : Command ToLowerInvariant().Trim() == "quantum": AaruConsole.WriteLine("{0}", EVPD.PrettifyPage_C0_Quantum(page.Value)); - DataFile.WriteTo("Device-Info command", outputPrefix, $"_scsi_evpd_{page.Key:X2}h.bin", + DataFile.WriteTo(MODULE_NAME, outputPrefix, $"_scsi_evpd_{page.Key:X2}h.bin", $"SCSI INQUIRY EVPD {page.Key:X2}h", page.Value); break; @@ -492,7 +494,7 @@ sealed class DeviceInfoCommand : Command ToLowerInvariant().Trim() == "seagate": AaruConsole.WriteLine("{0}", EVPD.PrettifyPage_C0_Seagate(page.Value)); - DataFile.WriteTo("Device-Info command", outputPrefix, $"_scsi_evpd_{page.Key:X2}h.bin", + DataFile.WriteTo(MODULE_NAME, outputPrefix, $"_scsi_evpd_{page.Key:X2}h.bin", $"SCSI INQUIRY EVPD {page.Key:X2}h", page.Value); break; @@ -500,7 +502,7 @@ sealed class DeviceInfoCommand : Command ToLowerInvariant().Trim() == "ibm": AaruConsole.WriteLine("{0}", EVPD.PrettifyPage_C0_IBM(page.Value)); - DataFile.WriteTo("Device-Info command", outputPrefix, $"_scsi_evpd_{page.Key:X2}h.bin", + DataFile.WriteTo(MODULE_NAME, outputPrefix, $"_scsi_evpd_{page.Key:X2}h.bin", $"SCSI INQUIRY EVPD {page.Key:X2}h", page.Value); break; @@ -508,7 +510,7 @@ sealed class DeviceInfoCommand : Command ToLowerInvariant().Trim() == "ibm": AaruConsole.WriteLine("{0}", EVPD.PrettifyPage_C1_IBM(page.Value)); - DataFile.WriteTo("Device-Info command", outputPrefix, $"_scsi_evpd_{page.Key:X2}h.bin", + DataFile.WriteTo(MODULE_NAME, outputPrefix, $"_scsi_evpd_{page.Key:X2}h.bin", $"SCSI INQUIRY EVPD {page.Key:X2}h", page.Value); break; @@ -517,7 +519,7 @@ sealed class DeviceInfoCommand : Command ToLowerInvariant().Trim() == "certance": AaruConsole.WriteLine("{0}", EVPD.PrettifyPage_C0_C1_Certance(page.Value)); - DataFile.WriteTo("Device-Info command", outputPrefix, $"_scsi_evpd_{page.Key:X2}h.bin", + DataFile.WriteTo(MODULE_NAME, outputPrefix, $"_scsi_evpd_{page.Key:X2}h.bin", $"SCSI INQUIRY EVPD {page.Key:X2}h", page.Value); break; @@ -526,7 +528,7 @@ sealed class DeviceInfoCommand : Command ToLowerInvariant().Trim() == "certance": AaruConsole.WriteLine("{0}", EVPD.PrettifyPage_C2_C3_C4_C5_C6_Certance(page.Value)); - DataFile.WriteTo("Device-Info command", outputPrefix, $"_scsi_evpd_{page.Key:X2}h.bin", + DataFile.WriteTo(MODULE_NAME, outputPrefix, $"_scsi_evpd_{page.Key:X2}h.bin", $"SCSI INQUIRY EVPD {page.Key:X2}h", page.Value); break; @@ -535,7 +537,7 @@ sealed class DeviceInfoCommand : Command ToLowerInvariant().Trim() == "hp": AaruConsole.WriteLine("{0}", EVPD.PrettifyPage_C0_to_C5_HP(page.Value)); - DataFile.WriteTo("Device-Info command", outputPrefix, $"_scsi_evpd_{page.Key:X2}h.bin", + DataFile.WriteTo(MODULE_NAME, outputPrefix, $"_scsi_evpd_{page.Key:X2}h.bin", $"SCSI INQUIRY EVPD {page.Key:X2}h", page.Value); break; @@ -543,7 +545,7 @@ sealed class DeviceInfoCommand : Command ToLowerInvariant().Trim() == "certance": AaruConsole.WriteLine("{0}", EVPD.PrettifyPage_DF_Certance(page.Value)); - DataFile.WriteTo("Device-Info command", outputPrefix, $"_scsi_evpd_{page.Key:X2}h.bin", + DataFile.WriteTo(MODULE_NAME, outputPrefix, $"_scsi_evpd_{page.Key:X2}h.bin", $"SCSI INQUIRY EVPD {page.Key:X2}h", page.Value); break; @@ -552,10 +554,10 @@ sealed class DeviceInfoCommand : Command if(page.Key == 0x00) continue; - AaruConsole.DebugWriteLine("Device-Info command", + AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Core.Found_undecoded_SCSI_VPD_page_0, page.Key); - DataFile.WriteTo("Device-Info command", outputPrefix, $"_scsi_evpd_{page.Key:X2}h.bin", + DataFile.WriteTo(MODULE_NAME, outputPrefix, $"_scsi_evpd_{page.Key:X2}h.bin", $"SCSI INQUIRY EVPD {page.Key:X2}h", page.Value); break; @@ -563,11 +565,11 @@ sealed class DeviceInfoCommand : Command } if(devInfo.ScsiModeSense6 != null) - DataFile.WriteTo("Device-Info command", outputPrefix, "_scsi_modesense6.bin", "SCSI MODE SENSE", + DataFile.WriteTo(MODULE_NAME, outputPrefix, "_scsi_modesense6.bin", "SCSI MODE SENSE", devInfo.ScsiModeSense6); if(devInfo.ScsiModeSense10 != null) - DataFile.WriteTo("Device-Info command", outputPrefix, "_scsi_modesense10.bin", "SCSI MODE SENSE", + DataFile.WriteTo(MODULE_NAME, outputPrefix, "_scsi_modesense10.bin", "SCSI MODE SENSE", devInfo.ScsiModeSense10); if(devInfo.ScsiMode.HasValue) @@ -577,15 +579,15 @@ sealed class DeviceInfoCommand : Command if(devInfo.MmcConfiguration != null) { - DataFile.WriteTo("Device-Info command", outputPrefix, "_mmc_getconfiguration.bin", + DataFile.WriteTo(MODULE_NAME, outputPrefix, "_mmc_getconfiguration.bin", "MMC GET CONFIGURATION", devInfo.MmcConfiguration); Features.SeparatedFeatures ftr = Features.Separate(devInfo.MmcConfiguration); - AaruConsole.DebugWriteLine("Device-Info command", Localization.Core.GET_CONFIGURATION_length_is_0, + AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Core.GET_CONFIGURATION_length_is_0, ftr.DataLength); - AaruConsole.DebugWriteLine("Device-Info command", + AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Core.GET_CONFIGURATION_current_profile_is_0, ftr.CurrentProfile); @@ -595,7 +597,7 @@ sealed class DeviceInfoCommand : Command foreach(Features.FeatureDescriptor desc in ftr.Descriptors) { - AaruConsole.DebugWriteLine("Device-Info command", Localization.Core.Feature_0, desc.Code); + AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Core.Feature_0, desc.Code); switch(desc.Code) { @@ -839,7 +841,7 @@ sealed class DeviceInfoCommand : Command } } else - AaruConsole.DebugWriteLine("Device-Info command", + AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Core.GET_CONFIGURATION_returned_no_feature_descriptors); } @@ -848,7 +850,7 @@ sealed class DeviceInfoCommand : Command if(devInfo.PlextorFeatures?.Eeprom != null) { - DataFile.WriteTo("Device-Info command", outputPrefix, "_plextor_eeprom.bin", "PLEXTOR READ EEPROM", + DataFile.WriteTo(MODULE_NAME, outputPrefix, "_plextor_eeprom.bin", "PLEXTOR READ EEPROM", devInfo.PlextorFeatures.Eeprom); AaruConsole.WriteLine(Localization.Core.Drive_has_loaded_a_total_of_0_discs, @@ -1006,7 +1008,7 @@ sealed class DeviceInfoCommand : Command if(devInfo.BlockLimits != null) { - DataFile.WriteTo("Device-Info command", outputPrefix, "_ssc_readblocklimits.bin", + DataFile.WriteTo(MODULE_NAME, outputPrefix, "_ssc_readblocklimits.bin", "SSC READ BLOCK LIMITS", devInfo.BlockLimits); AaruConsole.WriteLine(Localization.Core.Block_limits_for_device); @@ -1015,7 +1017,7 @@ sealed class DeviceInfoCommand : Command if(devInfo.DensitySupport != null) { - DataFile.WriteTo("Device-Info command", outputPrefix, "_ssc_reportdensitysupport.bin", + DataFile.WriteTo(MODULE_NAME, outputPrefix, "_ssc_reportdensitysupport.bin", "SSC REPORT DENSITY SUPPORT", devInfo.DensitySupport); if(devInfo.DensitySupportHeader.HasValue) @@ -1027,7 +1029,7 @@ sealed class DeviceInfoCommand : Command if(devInfo.MediumDensitySupport != null) { - DataFile.WriteTo("Device-Info command", outputPrefix, "_ssc_reportdensitysupport_medium.bin", + DataFile.WriteTo(MODULE_NAME, outputPrefix, "_ssc_reportdensitysupport_medium.bin", "SSC REPORT DENSITY SUPPORT (MEDIUM)", devInfo.MediumDensitySupport); if(devInfo.MediaTypeSupportHeader.HasValue) @@ -1049,21 +1051,21 @@ sealed class DeviceInfoCommand : Command if(devInfo.CID != null) { noInfo = false; - DataFile.WriteTo("Device-Info command", outputPrefix, "_mmc_cid.bin", "MMC CID", devInfo.CID); + DataFile.WriteTo(MODULE_NAME, outputPrefix, "_mmc_cid.bin", "MMC CID", devInfo.CID); AaruConsole.WriteLine("{0}", Decoders.MMC.Decoders.PrettifyCID(devInfo.CID)); } if(devInfo.CSD != null) { noInfo = false; - DataFile.WriteTo("Device-Info command", outputPrefix, "_mmc_csd.bin", "MMC CSD", devInfo.CSD); + DataFile.WriteTo(MODULE_NAME, outputPrefix, "_mmc_csd.bin", "MMC CSD", devInfo.CSD); AaruConsole.WriteLine("{0}", Decoders.MMC.Decoders.PrettifyCSD(devInfo.CSD)); } if(devInfo.OCR != null) { noInfo = false; - DataFile.WriteTo("Device-Info command", outputPrefix, "_mmc_ocr.bin", "MMC OCR", devInfo.OCR); + DataFile.WriteTo(MODULE_NAME, outputPrefix, "_mmc_ocr.bin", "MMC OCR", devInfo.OCR); AaruConsole.WriteLine("{0}", Decoders.MMC.Decoders.PrettifyOCR(devInfo.OCR)); } @@ -1071,7 +1073,7 @@ sealed class DeviceInfoCommand : Command { noInfo = false; - DataFile.WriteTo("Device-Info command", outputPrefix, "_mmc_ecsd.bin", "MMC Extended CSD", + DataFile.WriteTo(MODULE_NAME, outputPrefix, "_mmc_ecsd.bin", "MMC Extended CSD", devInfo.ExtendedCSD); AaruConsole.WriteLine("{0}", Decoders.MMC.Decoders.PrettifyExtendedCSD(devInfo.ExtendedCSD)); @@ -1090,7 +1092,7 @@ sealed class DeviceInfoCommand : Command { noInfo = false; - DataFile.WriteTo("Device-Info command", outputPrefix, "_sd_cid.bin", "SecureDigital CID", + DataFile.WriteTo(MODULE_NAME, outputPrefix, "_sd_cid.bin", "SecureDigital CID", devInfo.CID); AaruConsole.WriteLine("{0}", Decoders.SecureDigital.Decoders.PrettifyCID(devInfo.CID)); @@ -1100,7 +1102,7 @@ sealed class DeviceInfoCommand : Command { noInfo = false; - DataFile.WriteTo("Device-Info command", outputPrefix, "_sd_csd.bin", "SecureDigital CSD", + DataFile.WriteTo(MODULE_NAME, outputPrefix, "_sd_csd.bin", "SecureDigital CSD", devInfo.CSD); AaruConsole.WriteLine("{0}", Decoders.SecureDigital.Decoders.PrettifyCSD(devInfo.CSD)); @@ -1110,7 +1112,7 @@ sealed class DeviceInfoCommand : Command { noInfo = false; - DataFile.WriteTo("Device-Info command", outputPrefix, "_sd_ocr.bin", "SecureDigital OCR", + DataFile.WriteTo(MODULE_NAME, outputPrefix, "_sd_ocr.bin", "SecureDigital OCR", devInfo.OCR); AaruConsole.WriteLine("{0}", Decoders.SecureDigital.Decoders.PrettifyOCR(devInfo.OCR)); @@ -1120,7 +1122,7 @@ sealed class DeviceInfoCommand : Command { noInfo = false; - DataFile.WriteTo("Device-Info command", outputPrefix, "_sd_scr.bin", "SecureDigital SCR", + DataFile.WriteTo(MODULE_NAME, outputPrefix, "_sd_scr.bin", "SecureDigital SCR", devInfo.SCR); AaruConsole.WriteLine("{0}", Decoders.SecureDigital.Decoders.PrettifySCR(devInfo.SCR)); diff --git a/Aaru/Commands/Device/List.cs b/Aaru/Commands/Device/List.cs index 4fd775f7d..8c824df21 100644 --- a/Aaru/Commands/Device/List.cs +++ b/Aaru/Commands/Device/List.cs @@ -45,6 +45,8 @@ namespace Aaru.Commands.Device; sealed class ListDevicesCommand : Command { + const string MODULE_NAME = "List-Devices command"; + public ListDevicesCommand() : base("list", UI.Device_List_Command_Description) { AddArgument(new Argument @@ -88,8 +90,8 @@ sealed class ListDevicesCommand : Command Statistics.AddCommand("list-devices"); - AaruConsole.DebugWriteLine("List-Devices command", "--debug={0}", debug); - AaruConsole.DebugWriteLine("List-Devices command", "--verbose={0}", verbose); + AaruConsole.DebugWriteLine(MODULE_NAME, "--debug={0}", debug); + AaruConsole.DebugWriteLine(MODULE_NAME, "--verbose={0}", verbose); DeviceInfo[] devices = Devices.Device.ListDevices(out bool isRemote, out string serverApplication, out string serverVersion, out string serverOperatingSystem, diff --git a/Aaru/Commands/Filesystem/ExtractFiles.cs b/Aaru/Commands/Filesystem/ExtractFiles.cs index cebc1e686..f78d02dc5 100644 --- a/Aaru/Commands/Filesystem/ExtractFiles.cs +++ b/Aaru/Commands/Filesystem/ExtractFiles.cs @@ -52,7 +52,8 @@ namespace Aaru.Commands.Filesystem; sealed class ExtractFilesCommand : Command { - const long BUFFER_SIZE = 16777216; + const long BUFFER_SIZE = 16777216; + const string MODULE_NAME = "Extract-Files command"; public ExtractFilesCommand() : base("extract", UI.Filesystem_Extract_Command_Description) { @@ -125,13 +126,13 @@ sealed class ExtractFilesCommand : Command Statistics.AddCommand("extract-files"); - AaruConsole.DebugWriteLine("Extract-Files command", "--debug={0}", debug); - AaruConsole.DebugWriteLine("Extract-Files command", "--encoding={0}", encoding); - AaruConsole.DebugWriteLine("Extract-Files command", "--input={0}", imagePath); - AaruConsole.DebugWriteLine("Extract-Files command", "--options={0}", options); - AaruConsole.DebugWriteLine("Extract-Files command", "--output={0}", outputDir); - AaruConsole.DebugWriteLine("Extract-Files command", "--verbose={0}", verbose); - AaruConsole.DebugWriteLine("Extract-Files command", "--xattrs={0}", xattrs); + AaruConsole.DebugWriteLine(MODULE_NAME, "--debug={0}", debug); + AaruConsole.DebugWriteLine(MODULE_NAME, "--encoding={0}", encoding); + AaruConsole.DebugWriteLine(MODULE_NAME, "--input={0}", imagePath); + AaruConsole.DebugWriteLine(MODULE_NAME, "--options={0}", options); + AaruConsole.DebugWriteLine(MODULE_NAME, "--output={0}", outputDir); + AaruConsole.DebugWriteLine(MODULE_NAME, "--verbose={0}", verbose); + AaruConsole.DebugWriteLine(MODULE_NAME, "--xattrs={0}", xattrs); var filtersList = new FiltersList(); IFilter inputFilter = null; @@ -143,10 +144,10 @@ sealed class ExtractFilesCommand : Command }); Dictionary parsedOptions = Core.Options.Parse(options); - AaruConsole.DebugWriteLine("Extract-Files command", UI.Parsed_options); + AaruConsole.DebugWriteLine(MODULE_NAME, UI.Parsed_options); foreach(KeyValuePair parsedOption in parsedOptions) - AaruConsole.DebugWriteLine("Extract-Files command", "{0} = {1}", parsedOption.Key, parsedOption.Value); + AaruConsole.DebugWriteLine(MODULE_NAME, "{0} = {1}", parsedOption.Key, parsedOption.Value); parsedOptions.Add("debug", debug.ToString()); @@ -242,14 +243,14 @@ sealed class ExtractFilesCommand : Command return (int)opened; } - AaruConsole.DebugWriteLine("Extract-Files command", UI.Correctly_opened_image_file); + AaruConsole.DebugWriteLine(MODULE_NAME, UI.Correctly_opened_image_file); - AaruConsole.DebugWriteLine("Extract-Files command", UI.Image_without_headers_is_0_bytes, + AaruConsole.DebugWriteLine(MODULE_NAME, UI.Image_without_headers_is_0_bytes, imageFormat.Info.ImageSize); - AaruConsole.DebugWriteLine("Extract-Files command", UI.Image_has_0_sectors, imageFormat.Info.Sectors); + AaruConsole.DebugWriteLine(MODULE_NAME, UI.Image_has_0_sectors, imageFormat.Info.Sectors); - AaruConsole.DebugWriteLine("Extract-Files command", UI.Image_identifies_media_type_as_0, + AaruConsole.DebugWriteLine(MODULE_NAME, UI.Image_identifies_media_type_as_0, imageFormat.Info.MediaType); Statistics.AddMediaFormat(imageFormat.Format); @@ -276,7 +277,7 @@ sealed class ExtractFilesCommand : Command if(partitions.Count == 0) { - AaruConsole.DebugWriteLine("Ls command", UI.No_partitions_found); + AaruConsole.DebugWriteLine(MODULE_NAME, UI.No_partitions_found); partitions.Add(new Partition { @@ -380,7 +381,7 @@ sealed class ExtractFilesCommand : Command catch(Exception ex) { AaruConsole.ErrorWriteLine(string.Format(UI.Error_reading_file_0, ex.Message)); - AaruConsole.DebugWriteLine("Extract-Files command", ex.StackTrace); + AaruConsole.DebugWriteLine(MODULE_NAME, ex.StackTrace); return (int)ErrorNumber.UnexpectedException; } diff --git a/Aaru/Commands/Filesystem/Info.cs b/Aaru/Commands/Filesystem/Info.cs index 3beb60025..460b3ab55 100644 --- a/Aaru/Commands/Filesystem/Info.cs +++ b/Aaru/Commands/Filesystem/Info.cs @@ -49,6 +49,8 @@ namespace Aaru.Commands.Filesystem; sealed class FilesystemInfoCommand : Command { + const string MODULE_NAME = "Fs-info command"; + public FilesystemInfoCommand() : base("info", UI.Filesystem_Info_Command_Description) { Add(new Option(new[] @@ -108,12 +110,12 @@ sealed class FilesystemInfoCommand : Command Statistics.AddCommand("fs-info"); - AaruConsole.DebugWriteLine("Fs-info command", "--debug={0}", debug); - AaruConsole.DebugWriteLine("Fs-info command", "--encoding={0}", encoding); - AaruConsole.DebugWriteLine("Fs-info command", "--filesystems={0}", filesystems); - AaruConsole.DebugWriteLine("Fs-info command", "--input={0}", imagePath); - AaruConsole.DebugWriteLine("Fs-info command", "--partitions={0}", partitions); - AaruConsole.DebugWriteLine("Fs-info command", "--verbose={0}", verbose); + AaruConsole.DebugWriteLine(MODULE_NAME, "--debug={0}", debug); + AaruConsole.DebugWriteLine(MODULE_NAME, "--encoding={0}", encoding); + AaruConsole.DebugWriteLine(MODULE_NAME, "--filesystems={0}", filesystems); + AaruConsole.DebugWriteLine(MODULE_NAME, "--input={0}", imagePath); + AaruConsole.DebugWriteLine(MODULE_NAME, "--partitions={0}", partitions); + AaruConsole.DebugWriteLine(MODULE_NAME, "--verbose={0}", verbose); var filtersList = new FiltersList(); IFilter inputFilter = null; @@ -217,7 +219,7 @@ sealed class FilesystemInfoCommand : Command { AaruConsole.ErrorWriteLine(UI.Unable_to_open_image_format); AaruConsole.ErrorWriteLine(Localization.Core.Error_0, ex.Message); - AaruConsole.DebugWriteLine("Fs-info command", Localization.Core.Stack_trace_0, ex.StackTrace); + AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Core.Stack_trace_0, ex.StackTrace); return (int)ErrorNumber.CannotOpenFormat; } @@ -240,7 +242,7 @@ sealed class FilesystemInfoCommand : Command if(partitionsList.Count == 0) { - AaruConsole.DebugWriteLine("Fs-info command", UI.No_partitions_found); + AaruConsole.DebugWriteLine(MODULE_NAME, UI.No_partitions_found); if(!filesystems) { @@ -412,7 +414,7 @@ sealed class FilesystemInfoCommand : Command catch(Exception ex) { AaruConsole.ErrorWriteLine(string.Format(UI.Error_reading_file_0, ex.Message)); - AaruConsole.DebugWriteLine("Fs-info command", ex.StackTrace); + AaruConsole.DebugWriteLine(MODULE_NAME, ex.StackTrace); return (int)ErrorNumber.UnexpectedException; } diff --git a/Aaru/Commands/Filesystem/Ls.cs b/Aaru/Commands/Filesystem/Ls.cs index a1c67a8bc..6ec9038f2 100644 --- a/Aaru/Commands/Filesystem/Ls.cs +++ b/Aaru/Commands/Filesystem/Ls.cs @@ -50,6 +50,8 @@ namespace Aaru.Commands.Filesystem; sealed class LsCommand : Command { + const string MODULE_NAME = "Ls command"; + public LsCommand() : base("list", UI.Filesystem_List_Command_Description) { AddAlias("ls"); @@ -114,11 +116,11 @@ sealed class LsCommand : Command AnsiConsole.Markup(format, objects); }; - AaruConsole.DebugWriteLine("Ls command", "--debug={0}", debug); - AaruConsole.DebugWriteLine("Ls command", "--encoding={0}", encoding); - AaruConsole.DebugWriteLine("Ls command", "--input={0}", imagePath); - AaruConsole.DebugWriteLine("Ls command", "--options={0}", options); - AaruConsole.DebugWriteLine("Ls command", "--verbose={0}", verbose); + AaruConsole.DebugWriteLine(MODULE_NAME, "--debug={0}", debug); + AaruConsole.DebugWriteLine(MODULE_NAME, "--encoding={0}", encoding); + AaruConsole.DebugWriteLine(MODULE_NAME, "--input={0}", imagePath); + AaruConsole.DebugWriteLine(MODULE_NAME, "--options={0}", options); + AaruConsole.DebugWriteLine(MODULE_NAME, "--verbose={0}", verbose); Statistics.AddCommand("ls"); var filtersList = new FiltersList(); @@ -131,10 +133,10 @@ sealed class LsCommand : Command }); Dictionary parsedOptions = Core.Options.Parse(options); - AaruConsole.DebugWriteLine("Ls command", UI.Parsed_options); + AaruConsole.DebugWriteLine(MODULE_NAME, UI.Parsed_options); foreach(KeyValuePair parsedOption in parsedOptions) - AaruConsole.DebugWriteLine("Ls command", "{0} = {1}", parsedOption.Key, parsedOption.Value); + AaruConsole.DebugWriteLine(MODULE_NAME, "{0} = {1}", parsedOption.Key, parsedOption.Value); parsedOptions.Add("debug", debug.ToString()); @@ -213,14 +215,14 @@ sealed class LsCommand : Command return (int)opened; } - AaruConsole.DebugWriteLine("Ls command", UI.Correctly_opened_image_file); + AaruConsole.DebugWriteLine(MODULE_NAME, UI.Correctly_opened_image_file); - AaruConsole.DebugWriteLine("Ls command", UI.Image_without_headers_is_0_bytes, + AaruConsole.DebugWriteLine(MODULE_NAME, UI.Image_without_headers_is_0_bytes, imageFormat.Info.ImageSize); - AaruConsole.DebugWriteLine("Ls command", UI.Image_has_0_sectors, imageFormat.Info.Sectors); + AaruConsole.DebugWriteLine(MODULE_NAME, UI.Image_has_0_sectors, imageFormat.Info.Sectors); - AaruConsole.DebugWriteLine("Ls command", UI.Image_identifies_media_type_as_0, + AaruConsole.DebugWriteLine(MODULE_NAME, UI.Image_identifies_media_type_as_0, imageFormat.Info.MediaType); Statistics.AddMediaFormat(imageFormat.Format); @@ -247,7 +249,7 @@ sealed class LsCommand : Command if(partitions.Count == 0) { - AaruConsole.DebugWriteLine("Ls command", UI.No_partitions_found); + AaruConsole.DebugWriteLine(MODULE_NAME, UI.No_partitions_found); partitions.Add(new Partition { @@ -343,7 +345,7 @@ sealed class LsCommand : Command catch(Exception ex) { AaruConsole.ErrorWriteLine(string.Format(UI.Error_reading_file_0, ex.Message)); - AaruConsole.DebugWriteLine("Ls command", ex.StackTrace); + AaruConsole.DebugWriteLine(MODULE_NAME, ex.StackTrace); return (int)ErrorNumber.UnexpectedException; } diff --git a/Aaru/Commands/Filesystem/Options.cs b/Aaru/Commands/Filesystem/Options.cs index 59de7cced..1f282184f 100644 --- a/Aaru/Commands/Filesystem/Options.cs +++ b/Aaru/Commands/Filesystem/Options.cs @@ -47,6 +47,8 @@ namespace Aaru.Commands.Filesystem; sealed class ListOptionsCommand : Command { + const string MODULE_NAME = "List-Options command"; + public ListOptionsCommand() : base("options", UI.Filesystem_Options_Command_Description) => Handler = CommandHandler.Create(GetType().GetMethod(nameof(Invoke))); @@ -79,8 +81,8 @@ sealed class ListOptionsCommand : Command AnsiConsole.Markup(format, objects); }; - AaruConsole.DebugWriteLine("List-Options command", "--debug={0}", debug); - AaruConsole.DebugWriteLine("List-Options command", "--verbose={0}", verbose); + AaruConsole.DebugWriteLine(MODULE_NAME, "--debug={0}", debug); + AaruConsole.DebugWriteLine(MODULE_NAME, "--verbose={0}", verbose); Statistics.AddCommand("list-options"); PluginBase plugins = PluginBase.Singleton; diff --git a/Aaru/Commands/Formats.cs b/Aaru/Commands/Formats.cs index cf811a8cf..d3084982e 100644 --- a/Aaru/Commands/Formats.cs +++ b/Aaru/Commands/Formats.cs @@ -47,6 +47,8 @@ namespace Aaru.Commands; sealed class FormatsCommand : Command { + const string MODULE_NAME = "Formats command"; + public FormatsCommand() : base("formats", UI.List_Formats_Command_Description) => Handler = CommandHandler.Create(GetType().GetMethod(nameof(Invoke))); @@ -81,8 +83,8 @@ sealed class FormatsCommand : Command Statistics.AddCommand("formats"); - AaruConsole.DebugWriteLine("Formats command", "--debug={0}", debug); - AaruConsole.DebugWriteLine("Formats command", "--verbose={0}", verbose); + AaruConsole.DebugWriteLine(MODULE_NAME, "--debug={0}", debug); + AaruConsole.DebugWriteLine(MODULE_NAME, "--verbose={0}", verbose); PluginBase plugins = PluginBase.Singleton; var filtersList = new FiltersList(); diff --git a/Aaru/Commands/Image/Checksum.cs b/Aaru/Commands/Image/Checksum.cs index fbac20174..e0140f9ec 100644 --- a/Aaru/Commands/Image/Checksum.cs +++ b/Aaru/Commands/Image/Checksum.cs @@ -51,7 +51,8 @@ sealed class ChecksumCommand : Command const uint SECTORS_TO_READ = 256; // How many bytes to read at once - const int BYTES_TO_READ = 65536; + const int BYTES_TO_READ = 65536; + const string MODULE_NAME = "Checksum command"; public ChecksumCommand() : base("checksum", UI.Image_Checksum_Command_Description) { @@ -145,23 +146,23 @@ sealed class ChecksumCommand : Command Statistics.AddCommand("checksum"); - AaruConsole.DebugWriteLine("Checksum command", "--adler32={0}", adler32); - AaruConsole.DebugWriteLine("Checksum command", "--crc16={0}", crc16); - AaruConsole.DebugWriteLine("Checksum command", "--crc32={0}", crc32); - AaruConsole.DebugWriteLine("Checksum command", "--crc64={0}", crc64); - AaruConsole.DebugWriteLine("Checksum command", "--debug={0}", debug); - AaruConsole.DebugWriteLine("Checksum command", "--fletcher16={0}", fletcher16); - AaruConsole.DebugWriteLine("Checksum command", "--fletcher32={0}", fletcher32); - AaruConsole.DebugWriteLine("Checksum command", "--input={0}", imagePath); - AaruConsole.DebugWriteLine("Checksum command", "--md5={0}", md5); - AaruConsole.DebugWriteLine("Checksum command", "--separated-tracks={0}", separatedTracks); - AaruConsole.DebugWriteLine("Checksum command", "--sha1={0}", sha1); - AaruConsole.DebugWriteLine("Checksum command", "--sha256={0}", sha256); - AaruConsole.DebugWriteLine("Checksum command", "--sha384={0}", sha384); - AaruConsole.DebugWriteLine("Checksum command", "--sha512={0}", sha512); - AaruConsole.DebugWriteLine("Checksum command", "--spamsum={0}", spamSum); - AaruConsole.DebugWriteLine("Checksum command", "--verbose={0}", verbose); - AaruConsole.DebugWriteLine("Checksum command", "--whole-disc={0}", wholeDisc); + AaruConsole.DebugWriteLine(MODULE_NAME, "--adler32={0}", adler32); + AaruConsole.DebugWriteLine(MODULE_NAME, "--crc16={0}", crc16); + AaruConsole.DebugWriteLine(MODULE_NAME, "--crc32={0}", crc32); + AaruConsole.DebugWriteLine(MODULE_NAME, "--crc64={0}", crc64); + AaruConsole.DebugWriteLine(MODULE_NAME, "--debug={0}", debug); + AaruConsole.DebugWriteLine(MODULE_NAME, "--fletcher16={0}", fletcher16); + AaruConsole.DebugWriteLine(MODULE_NAME, "--fletcher32={0}", fletcher32); + AaruConsole.DebugWriteLine(MODULE_NAME, "--input={0}", imagePath); + AaruConsole.DebugWriteLine(MODULE_NAME, "--md5={0}", md5); + AaruConsole.DebugWriteLine(MODULE_NAME, "--separated-tracks={0}", separatedTracks); + AaruConsole.DebugWriteLine(MODULE_NAME, "--sha1={0}", sha1); + AaruConsole.DebugWriteLine(MODULE_NAME, "--sha256={0}", sha256); + AaruConsole.DebugWriteLine(MODULE_NAME, "--sha384={0}", sha384); + AaruConsole.DebugWriteLine(MODULE_NAME, "--sha512={0}", sha512); + AaruConsole.DebugWriteLine(MODULE_NAME, "--spamsum={0}", spamSum); + AaruConsole.DebugWriteLine(MODULE_NAME, "--verbose={0}", verbose); + AaruConsole.DebugWriteLine(MODULE_NAME, "--whole-disc={0}", wholeDisc); var filtersList = new FiltersList(); IFilter inputFilter = null; @@ -294,7 +295,7 @@ sealed class ChecksumCommand : Command } */ - AaruConsole.DebugWriteLine("Checksum command", + AaruConsole.DebugWriteLine(MODULE_NAME, UI.Track_0_starts_at_sector_1_and_ends_at_sector_2, currentTrack.Sequence, currentTrack.StartSector, currentTrack.EndSector); @@ -469,7 +470,7 @@ sealed class ChecksumCommand : Command preFileTask.StopTask(); } - AaruConsole.DebugWriteLine("Checksum command", + AaruConsole.DebugWriteLine(MODULE_NAME, UI.File_0_starts_at_block_1_and_ends_at_block_2, currentFile.File, currentFile.FirstBlock, currentFile.LastBlock); diff --git a/Aaru/Commands/Image/Compare.cs b/Aaru/Commands/Image/Compare.cs index 97472f1c8..27d6fa756 100644 --- a/Aaru/Commands/Image/Compare.cs +++ b/Aaru/Commands/Image/Compare.cs @@ -51,6 +51,8 @@ namespace Aaru.Commands.Image; sealed class CompareCommand : Command { + const string MODULE_NAME = "Compare command"; + public CompareCommand() : base("compare", UI.Image_Compare_Command_Description) { AddAlias("cmp"); @@ -103,10 +105,10 @@ sealed class CompareCommand : Command Statistics.AddCommand("compare"); - AaruConsole.DebugWriteLine("Compare command", "--debug={0}", debug); - AaruConsole.DebugWriteLine("Compare command", "--input1={0}", imagePath1); - AaruConsole.DebugWriteLine("Compare command", "--input2={0}", imagePath2); - AaruConsole.DebugWriteLine("Compare command", "--verbose={0}", verbose); + AaruConsole.DebugWriteLine(MODULE_NAME, "--debug={0}", debug); + AaruConsole.DebugWriteLine(MODULE_NAME, "--input1={0}", imagePath1); + AaruConsole.DebugWriteLine(MODULE_NAME, "--input2={0}", imagePath2); + AaruConsole.DebugWriteLine(MODULE_NAME, "--verbose={0}", verbose); var filtersList = new FiltersList(); IFilter inputFilter1 = null; diff --git a/Aaru/Commands/Image/Convert.cs b/Aaru/Commands/Image/Convert.cs index 3c014d62c..cd2b51ddc 100644 --- a/Aaru/Commands/Image/Convert.cs +++ b/Aaru/Commands/Image/Convert.cs @@ -65,6 +65,8 @@ namespace Aaru.Commands.Image; sealed class ConvertImageCommand : Command { + const string MODULE_NAME = "Convert-image command"; + public ConvertImageCommand() : base("convert", UI.Image_Convert_Command_Description) { Add(new Option(new[] @@ -217,43 +219,43 @@ sealed class ConvertImageCommand : Command Statistics.AddCommand("convert-image"); - AaruConsole.DebugWriteLine("Image convert command", "--cicm-xml={0}", cicmXml); - AaruConsole.DebugWriteLine("Image convert command", "--comments={0}", comments); - AaruConsole.DebugWriteLine("Image convert command", "--count={0}", count); - AaruConsole.DebugWriteLine("Image convert command", "--creator={0}", creator); - AaruConsole.DebugWriteLine("Image convert command", "--debug={0}", debug); - AaruConsole.DebugWriteLine("Image convert command", "--drive-manufacturer={0}", driveManufacturer); - AaruConsole.DebugWriteLine("Image convert command", "--drive-model={0}", driveModel); - AaruConsole.DebugWriteLine("Image convert command", "--drive-revision={0}", driveFirmwareRevision); - AaruConsole.DebugWriteLine("Image convert command", "--drive-serial={0}", driveSerialNumber); - AaruConsole.DebugWriteLine("Image convert command", "--force={0}", force); - AaruConsole.DebugWriteLine("Image convert command", "--format={0}", format); - AaruConsole.DebugWriteLine("Image convert command", "--geometry={0}", geometry); - AaruConsole.DebugWriteLine("Image convert command", "--input={0}", inputPath); - AaruConsole.DebugWriteLine("Image convert command", "--media-barcode={0}", mediaBarcode); - AaruConsole.DebugWriteLine("Image convert command", "--media-lastsequence={0}", lastMediaSequence); - AaruConsole.DebugWriteLine("Image convert command", "--media-manufacturer={0}", mediaManufacturer); - AaruConsole.DebugWriteLine("Image convert command", "--media-model={0}", mediaModel); - AaruConsole.DebugWriteLine("Image convert command", "--media-partnumber={0}", mediaPartNumber); - AaruConsole.DebugWriteLine("Image convert command", "--media-sequence={0}", mediaSequence); - AaruConsole.DebugWriteLine("Image convert command", "--media-serial={0}", mediaSerialNumber); - AaruConsole.DebugWriteLine("Image convert command", "--media-title={0}", mediaTitle); - AaruConsole.DebugWriteLine("Image convert command", "--options={0}", options); - AaruConsole.DebugWriteLine("Image convert command", "--output={0}", outputPath); - AaruConsole.DebugWriteLine("Image convert command", "--resume-file={0}", resumeFile); - AaruConsole.DebugWriteLine("Image convert command", "--verbose={0}", verbose); - AaruConsole.DebugWriteLine("Image convert command", "--fix-subchannel-position={0}", fixSubchannelPosition); - AaruConsole.DebugWriteLine("Image convert command", "--fix-subchannel={0}", fixSubchannel); - AaruConsole.DebugWriteLine("Image convert command", "--fix-subchannel-crc={0}", fixSubchannelCrc); - AaruConsole.DebugWriteLine("Image convert command", "--generate-subchannels={0}", generateSubchannels); - AaruConsole.DebugWriteLine("Image convert command", "--decrypt={0}", decrypt); - AaruConsole.DebugWriteLine("Image convert command", "--aaru-metadata={0}", aaruMetadata); + AaruConsole.DebugWriteLine(MODULE_NAME, "--cicm-xml={0}", cicmXml); + AaruConsole.DebugWriteLine(MODULE_NAME, "--comments={0}", comments); + AaruConsole.DebugWriteLine(MODULE_NAME, "--count={0}", count); + AaruConsole.DebugWriteLine(MODULE_NAME, "--creator={0}", creator); + AaruConsole.DebugWriteLine(MODULE_NAME, "--debug={0}", debug); + AaruConsole.DebugWriteLine(MODULE_NAME, "--drive-manufacturer={0}", driveManufacturer); + AaruConsole.DebugWriteLine(MODULE_NAME, "--drive-model={0}", driveModel); + AaruConsole.DebugWriteLine(MODULE_NAME, "--drive-revision={0}", driveFirmwareRevision); + AaruConsole.DebugWriteLine(MODULE_NAME, "--drive-serial={0}", driveSerialNumber); + AaruConsole.DebugWriteLine(MODULE_NAME, "--force={0}", force); + AaruConsole.DebugWriteLine(MODULE_NAME, "--format={0}", format); + AaruConsole.DebugWriteLine(MODULE_NAME, "--geometry={0}", geometry); + AaruConsole.DebugWriteLine(MODULE_NAME, "--input={0}", inputPath); + AaruConsole.DebugWriteLine(MODULE_NAME, "--media-barcode={0}", mediaBarcode); + AaruConsole.DebugWriteLine(MODULE_NAME, "--media-lastsequence={0}", lastMediaSequence); + AaruConsole.DebugWriteLine(MODULE_NAME, "--media-manufacturer={0}", mediaManufacturer); + AaruConsole.DebugWriteLine(MODULE_NAME, "--media-model={0}", mediaModel); + AaruConsole.DebugWriteLine(MODULE_NAME, "--media-partnumber={0}", mediaPartNumber); + AaruConsole.DebugWriteLine(MODULE_NAME, "--media-sequence={0}", mediaSequence); + AaruConsole.DebugWriteLine(MODULE_NAME, "--media-serial={0}", mediaSerialNumber); + AaruConsole.DebugWriteLine(MODULE_NAME, "--media-title={0}", mediaTitle); + AaruConsole.DebugWriteLine(MODULE_NAME, "--options={0}", options); + AaruConsole.DebugWriteLine(MODULE_NAME, "--output={0}", outputPath); + AaruConsole.DebugWriteLine(MODULE_NAME, "--resume-file={0}", resumeFile); + AaruConsole.DebugWriteLine(MODULE_NAME, "--verbose={0}", verbose); + AaruConsole.DebugWriteLine(MODULE_NAME, "--fix-subchannel-position={0}", fixSubchannelPosition); + AaruConsole.DebugWriteLine(MODULE_NAME, "--fix-subchannel={0}", fixSubchannel); + AaruConsole.DebugWriteLine(MODULE_NAME, "--fix-subchannel-crc={0}", fixSubchannelCrc); + AaruConsole.DebugWriteLine(MODULE_NAME, "--generate-subchannels={0}", generateSubchannels); + AaruConsole.DebugWriteLine(MODULE_NAME, "--decrypt={0}", decrypt); + AaruConsole.DebugWriteLine(MODULE_NAME, "--aaru-metadata={0}", aaruMetadata); Dictionary parsedOptions = Core.Options.Parse(options); - AaruConsole.DebugWriteLine("Image convert command", UI.Parsed_options); + AaruConsole.DebugWriteLine(MODULE_NAME, UI.Parsed_options); foreach(KeyValuePair parsedOption in parsedOptions) - AaruConsole.DebugWriteLine("Image convert command", "{0} = {1}", parsedOption.Key, parsedOption.Value); + AaruConsole.DebugWriteLine(MODULE_NAME, "{0} = {1}", parsedOption.Key, parsedOption.Value); if(count == 0) { @@ -325,7 +327,7 @@ sealed class ConvertImageCommand : Command catch(Exception ex) { AaruConsole.ErrorWriteLine(UI.Incorrect_metadata_sidecar_file_not_continuing); - AaruConsole.DebugWriteLine("Image conversion", $"{ex}"); + AaruConsole.DebugWriteLine(MODULE_NAME, $"{ex}"); return (int)ErrorNumber.InvalidSidecar; } @@ -357,7 +359,7 @@ sealed class ConvertImageCommand : Command catch(Exception ex) { AaruConsole.ErrorWriteLine(UI.Incorrect_metadata_sidecar_file_not_continuing); - AaruConsole.DebugWriteLine("Image conversion", $"{ex}"); + AaruConsole.DebugWriteLine(MODULE_NAME, $"{ex}"); return (int)ErrorNumber.InvalidSidecar; } @@ -404,7 +406,7 @@ sealed class ConvertImageCommand : Command catch(Exception ex) { AaruConsole.ErrorWriteLine(UI.Incorrect_resume_file_not_continuing); - AaruConsole.DebugWriteLine("Image conversion", $"{ex}"); + AaruConsole.DebugWriteLine(MODULE_NAME, $"{ex}"); return (int)ErrorNumber.InvalidResume; } @@ -502,14 +504,14 @@ sealed class ConvertImageCommand : Command }; #pragma warning restore 612 - AaruConsole.DebugWriteLine("Convert-image command", UI.Correctly_opened_image_file); + AaruConsole.DebugWriteLine(MODULE_NAME, UI.Correctly_opened_image_file); - AaruConsole.DebugWriteLine("Convert-image command", UI.Image_without_headers_is_0_bytes, + AaruConsole.DebugWriteLine(MODULE_NAME, UI.Image_without_headers_is_0_bytes, inputFormat.Info.ImageSize); - AaruConsole.DebugWriteLine("Convert-image command", UI.Image_has_0_sectors, inputFormat.Info.Sectors); + AaruConsole.DebugWriteLine(MODULE_NAME, UI.Image_has_0_sectors, inputFormat.Info.Sectors); - AaruConsole.DebugWriteLine("Convert-image command", UI.Image_identifies_media_type_as_0, mediaType); + AaruConsole.DebugWriteLine(MODULE_NAME, UI.Image_identifies_media_type_as_0, mediaType); Statistics.AddMediaFormat(inputFormat.Format); Statistics.AddMedia(mediaType, false); @@ -519,7 +521,7 @@ sealed class ConvertImageCommand : Command { AaruConsole.ErrorWriteLine(UI.Unable_to_open_image_format); AaruConsole.ErrorWriteLine(Localization.Core.Error_0, ex.Message); - AaruConsole.DebugWriteLine("Convert-image command", Localization.Core.Stack_trace_0, ex.StackTrace); + AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Core.Stack_trace_0, ex.StackTrace); return (int)ErrorNumber.CannotOpenFormat; } @@ -895,7 +897,7 @@ sealed class ConvertImageCommand : Command if(generatedTitleKeys == null) { List partitions = - Aaru.Core.Partitions.GetAll(inputOptical); + Core.Partitions.GetAll(inputOptical); partitions = partitions.FindAll(p => { @@ -909,7 +911,7 @@ sealed class ConvertImageCommand : Command TryGetValue("iso9660 filesystem", out Type pluginType)) { - AaruConsole.DebugWriteLine("Convert-image command", + AaruConsole.DebugWriteLine(MODULE_NAME, UI.Generating_decryption_keys); generatedTitleKeys = CSS.GenerateTitleKeys(inputOptical, @@ -938,7 +940,7 @@ sealed class ConvertImageCommand : Command if(generatedTitleKeys == null) { List partitions = - Aaru.Core.Partitions.GetAll(inputOptical); + Core.Partitions.GetAll(inputOptical); partitions = partitions.FindAll(p => { @@ -952,7 +954,7 @@ sealed class ConvertImageCommand : Command TryGetValue("iso9660 filesystem", out Type pluginType)) { - AaruConsole.DebugWriteLine("Convert-image command", + AaruConsole.DebugWriteLine(MODULE_NAME, UI.Generating_decryption_keys); generatedTitleKeys = CSS.GenerateTitleKeys(inputOptical, diff --git a/Aaru/Commands/Image/CreateSidecar.cs b/Aaru/Commands/Image/CreateSidecar.cs index 729020e03..279de9d71 100644 --- a/Aaru/Commands/Image/CreateSidecar.cs +++ b/Aaru/Commands/Image/CreateSidecar.cs @@ -54,6 +54,7 @@ namespace Aaru.Commands.Image; sealed class CreateSidecarCommand : Command { + const string MODULE_NAME = "Create sidecar command"; static ProgressTask _progressTask1; static ProgressTask _progressTask2; @@ -116,12 +117,12 @@ sealed class CreateSidecarCommand : Command Statistics.AddCommand("create-sidecar"); - AaruConsole.DebugWriteLine("Create sidecar command", "--block-size={0}", blockSize); - AaruConsole.DebugWriteLine("Create sidecar command", "--debug={0}", debug); - AaruConsole.DebugWriteLine("Create sidecar command", "--encoding={0}", encodingName); - AaruConsole.DebugWriteLine("Create sidecar command", "--input={0}", imagePath); - AaruConsole.DebugWriteLine("Create sidecar command", "--tape={0}", tape); - AaruConsole.DebugWriteLine("Create sidecar command", "--verbose={0}", verbose); + AaruConsole.DebugWriteLine(MODULE_NAME, "--block-size={0}", blockSize); + AaruConsole.DebugWriteLine(MODULE_NAME, "--debug={0}", debug); + AaruConsole.DebugWriteLine(MODULE_NAME, "--encoding={0}", encodingName); + AaruConsole.DebugWriteLine(MODULE_NAME, "--input={0}", imagePath); + AaruConsole.DebugWriteLine(MODULE_NAME, "--tape={0}", tape); + AaruConsole.DebugWriteLine(MODULE_NAME, "--verbose={0}", verbose); Encoding encodingClass = null; @@ -205,7 +206,7 @@ sealed class CreateSidecarCommand : Command return (int)opened; } - AaruConsole.DebugWriteLine("Create sidecar command", UI.Correctly_opened_image_file); + AaruConsole.DebugWriteLine(MODULE_NAME, UI.Correctly_opened_image_file); } catch(Exception ex) { @@ -297,7 +298,7 @@ sealed class CreateSidecarCommand : Command catch(Exception ex) { AaruConsole.ErrorWriteLine(string.Format(UI.Error_reading_file_0, ex.Message)); - AaruConsole.DebugWriteLine("Create sidecar command", ex.StackTrace); + AaruConsole.DebugWriteLine(MODULE_NAME, ex.StackTrace); return (int)ErrorNumber.UnexpectedException; } diff --git a/Aaru/Commands/Image/Decode.cs b/Aaru/Commands/Image/Decode.cs index 43d6f23d8..0c5af7e04 100644 --- a/Aaru/Commands/Image/Decode.cs +++ b/Aaru/Commands/Image/Decode.cs @@ -48,6 +48,8 @@ namespace Aaru.Commands.Image; sealed class DecodeCommand : Command { + const string MODULE_NAME = "Decode command"; + public DecodeCommand() : base("decode", UI.Image_Decode_Command_Description) { Add(new Option(new[] @@ -112,13 +114,13 @@ sealed class DecodeCommand : Command Statistics.AddCommand("decode"); - AaruConsole.DebugWriteLine("Decode command", "--debug={0}", debug); - AaruConsole.DebugWriteLine("Decode command", "--disk-tags={0}", diskTags); - AaruConsole.DebugWriteLine("Decode command", "--input={0}", imagePath); - AaruConsole.DebugWriteLine("Decode command", "--length={0}", length); - AaruConsole.DebugWriteLine("Decode command", "--sector-tags={0}", sectorTags); - AaruConsole.DebugWriteLine("Decode command", "--start={0}", startSector); - AaruConsole.DebugWriteLine("Decode command", "--verbose={0}", verbose); + AaruConsole.DebugWriteLine(MODULE_NAME, "--debug={0}", debug); + AaruConsole.DebugWriteLine(MODULE_NAME, "--disk-tags={0}", diskTags); + AaruConsole.DebugWriteLine(MODULE_NAME, "--input={0}", imagePath); + AaruConsole.DebugWriteLine(MODULE_NAME, "--length={0}", length); + AaruConsole.DebugWriteLine(MODULE_NAME, "--sector-tags={0}", sectorTags); + AaruConsole.DebugWriteLine(MODULE_NAME, "--start={0}", startSector); + AaruConsole.DebugWriteLine(MODULE_NAME, "--verbose={0}", verbose); var filtersList = new FiltersList(); IFilter inputFilter = null; diff --git a/Aaru/Commands/Image/Entropy.cs b/Aaru/Commands/Image/Entropy.cs index 21527e9c8..59ae456a0 100644 --- a/Aaru/Commands/Image/Entropy.cs +++ b/Aaru/Commands/Image/Entropy.cs @@ -44,6 +44,7 @@ namespace Aaru.Commands.Image; sealed class EntropyCommand : Command { + const string MODULE_NAME = "Entropy command"; static ProgressTask _progressTask1; static ProgressTask _progressTask2; @@ -106,12 +107,12 @@ sealed class EntropyCommand : Command Statistics.AddCommand("entropy"); - AaruConsole.DebugWriteLine("Entropy command", "--debug={0}", debug); - AaruConsole.DebugWriteLine("Entropy command", "--duplicated-sectors={0}", duplicatedSectors); - AaruConsole.DebugWriteLine("Entropy command", "--input={0}", imagePath); - AaruConsole.DebugWriteLine("Entropy command", "--separated-tracks={0}", separatedTracks); - AaruConsole.DebugWriteLine("Entropy command", "--verbose={0}", verbose); - AaruConsole.DebugWriteLine("Entropy command", "--whole-disc={0}", wholeDisc); + AaruConsole.DebugWriteLine(MODULE_NAME, "--debug={0}", debug); + AaruConsole.DebugWriteLine(MODULE_NAME, "--duplicated-sectors={0}", duplicatedSectors); + AaruConsole.DebugWriteLine(MODULE_NAME, "--input={0}", imagePath); + AaruConsole.DebugWriteLine(MODULE_NAME, "--separated-tracks={0}", separatedTracks); + AaruConsole.DebugWriteLine(MODULE_NAME, "--verbose={0}", verbose); + AaruConsole.DebugWriteLine(MODULE_NAME, "--whole-disc={0}", wholeDisc); var filtersList = new FiltersList(); IFilter inputFilter = null; diff --git a/Aaru/Commands/Image/Info.cs b/Aaru/Commands/Image/Info.cs index ccd86b2a6..a198a9426 100644 --- a/Aaru/Commands/Image/Info.cs +++ b/Aaru/Commands/Image/Info.cs @@ -45,6 +45,8 @@ namespace Aaru.Commands.Image; sealed class ImageInfoCommand : Command { + const string MODULE_NAME = "Image-info command"; + public ImageInfoCommand() : base("info", UI.Image_Info_Command_Description) { AddArgument(new Argument @@ -88,9 +90,9 @@ sealed class ImageInfoCommand : Command Statistics.AddCommand("image-info"); - AaruConsole.DebugWriteLine("Image-info command", "--debug={0}", debug); - AaruConsole.DebugWriteLine("Image-info command", "--input={0}", imagePath); - AaruConsole.DebugWriteLine("Image-info command", "--verbose={0}", verbose); + AaruConsole.DebugWriteLine(MODULE_NAME, "--debug={0}", debug); + AaruConsole.DebugWriteLine(MODULE_NAME, "--input={0}", imagePath); + AaruConsole.DebugWriteLine(MODULE_NAME, "--verbose={0}", verbose); var filtersList = new FiltersList(); IFilter inputFilter = null; @@ -156,7 +158,7 @@ sealed class ImageInfoCommand : Command { AaruConsole.ErrorWriteLine(UI.Unable_to_open_image_format); AaruConsole.ErrorWriteLine(Localization.Core.Error_0, ex.Message); - AaruConsole.DebugWriteLine("Image-info command", Localization.Core.Stack_trace_0, ex.StackTrace); + AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Core.Stack_trace_0, ex.StackTrace); return (int)ErrorNumber.CannotOpenFormat; } @@ -164,7 +166,7 @@ sealed class ImageInfoCommand : Command catch(Exception ex) { AaruConsole.ErrorWriteLine(string.Format(UI.Error_reading_file_0, ex.Message)); - AaruConsole.DebugWriteLine("Image-info command", ex.StackTrace); + AaruConsole.DebugWriteLine(MODULE_NAME, ex.StackTrace); return (int)ErrorNumber.UnexpectedException; } diff --git a/Aaru/Commands/Image/Options.cs b/Aaru/Commands/Image/Options.cs index b5f58a92f..347a29792 100644 --- a/Aaru/Commands/Image/Options.cs +++ b/Aaru/Commands/Image/Options.cs @@ -47,6 +47,8 @@ namespace Aaru.Commands.Image; sealed class ListOptionsCommand : Command { + const string MODULE_NAME = "List-Options command"; + public ListOptionsCommand() : base("options", UI.Image_Options_Command_Description) => Handler = CommandHandler.Create(GetType().GetMethod(nameof(Invoke))); @@ -79,8 +81,8 @@ sealed class ListOptionsCommand : Command AnsiConsole.Markup(format, objects); }; - AaruConsole.DebugWriteLine("List-Options command", "--debug={0}", debug); - AaruConsole.DebugWriteLine("List-Options command", "--verbose={0}", verbose); + AaruConsole.DebugWriteLine(MODULE_NAME, "--debug={0}", debug); + AaruConsole.DebugWriteLine(MODULE_NAME, "--verbose={0}", verbose); Statistics.AddCommand("list-options"); PluginBase plugins = PluginBase.Singleton; diff --git a/Aaru/Commands/Image/Print.cs b/Aaru/Commands/Image/Print.cs index e4a2c54d4..ea4e79972 100644 --- a/Aaru/Commands/Image/Print.cs +++ b/Aaru/Commands/Image/Print.cs @@ -46,6 +46,8 @@ namespace Aaru.Commands.Image; sealed class PrintHexCommand : Command { + const string MODULE_NAME = "PrintHex command"; + public PrintHexCommand() : base("print", UI.Image_Print_Command_Description) { Add(new Option(new[] @@ -110,13 +112,13 @@ sealed class PrintHexCommand : Command Statistics.AddCommand("print-hex"); - AaruConsole.DebugWriteLine("PrintHex command", "--debug={0}", debug); - AaruConsole.DebugWriteLine("PrintHex command", "--input={0}", imagePath); - AaruConsole.DebugWriteLine("PrintHex command", "--length={0}", length); - AaruConsole.DebugWriteLine("PrintHex command", "--long-sectors={0}", longSectors); - AaruConsole.DebugWriteLine("PrintHex command", "--start={0}", start); - AaruConsole.DebugWriteLine("PrintHex command", "--verbose={0}", verbose); - AaruConsole.DebugWriteLine("PrintHex command", "--width={0}", width); + AaruConsole.DebugWriteLine(MODULE_NAME, "--debug={0}", debug); + AaruConsole.DebugWriteLine(MODULE_NAME, "--input={0}", imagePath); + AaruConsole.DebugWriteLine(MODULE_NAME, "--length={0}", length); + AaruConsole.DebugWriteLine(MODULE_NAME, "--long-sectors={0}", longSectors); + AaruConsole.DebugWriteLine(MODULE_NAME, "--start={0}", start); + AaruConsole.DebugWriteLine(MODULE_NAME, "--verbose={0}", verbose); + AaruConsole.DebugWriteLine(MODULE_NAME, "--width={0}", width); var filtersList = new FiltersList(); IFilter inputFilter = null; diff --git a/Aaru/Commands/Image/Verify.cs b/Aaru/Commands/Image/Verify.cs index 274a0078f..a5d2a9a91 100644 --- a/Aaru/Commands/Image/Verify.cs +++ b/Aaru/Commands/Image/Verify.cs @@ -51,6 +51,8 @@ namespace Aaru.Commands.Image; sealed class VerifyCommand : Command { + const string MODULE_NAME = "Verify command"; + public VerifyCommand() : base("verify", UI.Image_Verify_Command_Description) { Add(new Option(new[] @@ -115,13 +117,13 @@ sealed class VerifyCommand : Command Statistics.AddCommand("verify"); - AaruConsole.DebugWriteLine("Verify command", "--debug={0}", debug); - AaruConsole.DebugWriteLine("Verify command", "--input={0}", imagePath); - AaruConsole.DebugWriteLine("Verify command", "--verbose={0}", verbose); - AaruConsole.DebugWriteLine("Verify command", "--verify-disc={0}", verifyDisc); - AaruConsole.DebugWriteLine("Verify command", "--verify-sectors={0}", verifySectors); - AaruConsole.DebugWriteLine("Verify command", "--create-graph={0}", createGraph); - AaruConsole.DebugWriteLine("Verify command", "--dimensions={0}", dimensions); + AaruConsole.DebugWriteLine(MODULE_NAME, "--debug={0}", debug); + AaruConsole.DebugWriteLine(MODULE_NAME, "--input={0}", imagePath); + AaruConsole.DebugWriteLine(MODULE_NAME, "--verbose={0}", verbose); + AaruConsole.DebugWriteLine(MODULE_NAME, "--verify-disc={0}", verifyDisc); + AaruConsole.DebugWriteLine(MODULE_NAME, "--verify-sectors={0}", verifySectors); + AaruConsole.DebugWriteLine(MODULE_NAME, "--create-graph={0}", createGraph); + AaruConsole.DebugWriteLine(MODULE_NAME, "--dimensions={0}", dimensions); var filtersList = new FiltersList(); IFilter inputFilter = null; diff --git a/Aaru/Commands/ListEncodings.cs b/Aaru/Commands/ListEncodings.cs index 45b252cd4..b29f7bf54 100644 --- a/Aaru/Commands/ListEncodings.cs +++ b/Aaru/Commands/ListEncodings.cs @@ -45,6 +45,8 @@ namespace Aaru.Commands; sealed class ListEncodingsCommand : Command { + const string MODULE_NAME = "List-Encodings command"; + public ListEncodingsCommand() : base("list-encodings", UI.List_Encodings_Command_Description) => Handler = CommandHandler.Create(GetType().GetMethod(nameof(Invoke))); @@ -79,8 +81,8 @@ sealed class ListEncodingsCommand : Command Statistics.AddCommand("list-encodings"); - AaruConsole.DebugWriteLine("List-Encodings command", "--debug={0}", debug); - AaruConsole.DebugWriteLine("List-Encodings command", "--verbose={0}", verbose); + AaruConsole.DebugWriteLine(MODULE_NAME, "--debug={0}", debug); + AaruConsole.DebugWriteLine(MODULE_NAME, "--verbose={0}", verbose); List encodings = Encoding.GetEncodings().Select(info => new CommonEncodingInfo { diff --git a/Aaru/Commands/ListNamespaces.cs b/Aaru/Commands/ListNamespaces.cs index f8ee7c000..be3e0375d 100644 --- a/Aaru/Commands/ListNamespaces.cs +++ b/Aaru/Commands/ListNamespaces.cs @@ -46,6 +46,8 @@ namespace Aaru.Commands; sealed class ListNamespacesCommand : Command { + const string MODULE_NAME = "List-Namespaces command"; + public ListNamespacesCommand() : base("list-namespaces", UI.List_Namespaces_Command_Description) => Handler = CommandHandler.Create(GetType().GetMethod(nameof(Invoke))); @@ -78,8 +80,8 @@ sealed class ListNamespacesCommand : Command AnsiConsole.Markup(format, objects); }; - AaruConsole.DebugWriteLine("List-Namespaces command", "--debug={0}", debug); - AaruConsole.DebugWriteLine("List-Namespaces command", "--verbose={0}", verbose); + AaruConsole.DebugWriteLine(MODULE_NAME, "--debug={0}", debug); + AaruConsole.DebugWriteLine(MODULE_NAME, "--verbose={0}", verbose); Statistics.AddCommand("list-namespaces"); PluginBase plugins = PluginBase.Singleton; diff --git a/Aaru/Commands/Media/Dump.cs b/Aaru/Commands/Media/Dump.cs index 6337e0293..e04a3171b 100644 --- a/Aaru/Commands/Media/Dump.cs +++ b/Aaru/Commands/Media/Dump.cs @@ -64,6 +64,7 @@ namespace Aaru.Commands.Media; // TODO: Add raw dumping sealed class DumpMediaCommand : Command { + const string MODULE_NAME = "Dump-Media command"; static ProgressTask _progressTask1; static ProgressTask _progressTask2; static readonly TimeSpan OneSecond = 1.Seconds(); @@ -270,50 +271,50 @@ sealed class DumpMediaCommand : Command Statistics.AddCommand("dump-media"); - AaruConsole.DebugWriteLine("Dump-Media command", "--cicm-xml={0}", cicmXml); - AaruConsole.DebugWriteLine("Dump-Media command", "--debug={0}", debug); - AaruConsole.DebugWriteLine("Dump-Media command", "--device={0}", devicePath); - AaruConsole.DebugWriteLine("Dump-Media command", "--encoding={0}", encoding); - AaruConsole.DebugWriteLine("Dump-Media command", "--first-pregap={0}", firstPregap); - AaruConsole.DebugWriteLine("Dump-Media command", "--fix-offset={0}", fixOffset); - AaruConsole.DebugWriteLine("Dump-Media command", "--force={0}", force); - AaruConsole.DebugWriteLine("Dump-Media command", "--format={0}", format); - AaruConsole.DebugWriteLine("Dump-Media command", "--metadata={0}", metadata); - AaruConsole.DebugWriteLine("Dump-Media command", "--options={0}", options); - AaruConsole.DebugWriteLine("Dump-Media command", "--output={0}", outputPath); - AaruConsole.DebugWriteLine("Dump-Media command", "--persistent={0}", persistent); - AaruConsole.DebugWriteLine("Dump-Media command", "--resume={0}", resume); - AaruConsole.DebugWriteLine("Dump-Media command", "--retry-passes={0}", retryPasses); - AaruConsole.DebugWriteLine("Dump-Media command", "--skip={0}", skip); - AaruConsole.DebugWriteLine("Dump-Media command", "--stop-on-error={0}", stopOnError); - AaruConsole.DebugWriteLine("Dump-Media command", "--trim={0}", trim); - AaruConsole.DebugWriteLine("Dump-Media command", "--verbose={0}", verbose); - AaruConsole.DebugWriteLine("Dump-Media command", "--subchannel={0}", subchannel); - AaruConsole.DebugWriteLine("Dump-Media command", "--private={0}", @private); - AaruConsole.DebugWriteLine("Dump-Media command", "--fix-subchannel-position={0}", fixSubchannelPosition); - AaruConsole.DebugWriteLine("Dump-Media command", "--retry-subchannel={0}", retrySubchannel); - AaruConsole.DebugWriteLine("Dump-Media command", "--fix-subchannel={0}", fixSubchannel); - AaruConsole.DebugWriteLine("Dump-Media command", "--fix-subchannel-crc={0}", fixSubchannelCrc); - AaruConsole.DebugWriteLine("Dump-Media command", "--generate-subchannels={0}", generateSubchannels); - AaruConsole.DebugWriteLine("Dump-Media command", "--skip-cdiready-hole={0}", skipCdiReadyHole); - AaruConsole.DebugWriteLine("Dump-Media command", "--eject={0}", eject); - AaruConsole.DebugWriteLine("Dump-Media command", "--max-blocks={0}", maxBlocks); - AaruConsole.DebugWriteLine("Dump-Media command", "--use-buffered-reads={0}", useBufferedReads); - AaruConsole.DebugWriteLine("Dump-Media command", "--store-encrypted={0}", storeEncrypted); - AaruConsole.DebugWriteLine("Dump-Media command", "--title-keys={0}", titleKeys); - AaruConsole.DebugWriteLine("Dump-Media command", "--ignore-cdr-runouts={0}", ignoreCdrRunOuts); - AaruConsole.DebugWriteLine("Dump-Media command", "--create-graph={0}", createGraph); - AaruConsole.DebugWriteLine("Dump-Media command", "--dimensions={0}", dimensions); - AaruConsole.DebugWriteLine("Dump-Media command", "--aaru-metadata={0}", aaruMetadata); + AaruConsole.DebugWriteLine(MODULE_NAME, "--cicm-xml={0}", cicmXml); + AaruConsole.DebugWriteLine(MODULE_NAME, "--debug={0}", debug); + AaruConsole.DebugWriteLine(MODULE_NAME, "--device={0}", devicePath); + AaruConsole.DebugWriteLine(MODULE_NAME, "--encoding={0}", encoding); + AaruConsole.DebugWriteLine(MODULE_NAME, "--first-pregap={0}", firstPregap); + AaruConsole.DebugWriteLine(MODULE_NAME, "--fix-offset={0}", fixOffset); + AaruConsole.DebugWriteLine(MODULE_NAME, "--force={0}", force); + AaruConsole.DebugWriteLine(MODULE_NAME, "--format={0}", format); + AaruConsole.DebugWriteLine(MODULE_NAME, "--metadata={0}", metadata); + AaruConsole.DebugWriteLine(MODULE_NAME, "--options={0}", options); + AaruConsole.DebugWriteLine(MODULE_NAME, "--output={0}", outputPath); + AaruConsole.DebugWriteLine(MODULE_NAME, "--persistent={0}", persistent); + AaruConsole.DebugWriteLine(MODULE_NAME, "--resume={0}", resume); + AaruConsole.DebugWriteLine(MODULE_NAME, "--retry-passes={0}", retryPasses); + AaruConsole.DebugWriteLine(MODULE_NAME, "--skip={0}", skip); + AaruConsole.DebugWriteLine(MODULE_NAME, "--stop-on-error={0}", stopOnError); + AaruConsole.DebugWriteLine(MODULE_NAME, "--trim={0}", trim); + AaruConsole.DebugWriteLine(MODULE_NAME, "--verbose={0}", verbose); + AaruConsole.DebugWriteLine(MODULE_NAME, "--subchannel={0}", subchannel); + AaruConsole.DebugWriteLine(MODULE_NAME, "--private={0}", @private); + AaruConsole.DebugWriteLine(MODULE_NAME, "--fix-subchannel-position={0}", fixSubchannelPosition); + AaruConsole.DebugWriteLine(MODULE_NAME, "--retry-subchannel={0}", retrySubchannel); + AaruConsole.DebugWriteLine(MODULE_NAME, "--fix-subchannel={0}", fixSubchannel); + AaruConsole.DebugWriteLine(MODULE_NAME, "--fix-subchannel-crc={0}", fixSubchannelCrc); + AaruConsole.DebugWriteLine(MODULE_NAME, "--generate-subchannels={0}", generateSubchannels); + AaruConsole.DebugWriteLine(MODULE_NAME, "--skip-cdiready-hole={0}", skipCdiReadyHole); + AaruConsole.DebugWriteLine(MODULE_NAME, "--eject={0}", eject); + AaruConsole.DebugWriteLine(MODULE_NAME, "--max-blocks={0}", maxBlocks); + AaruConsole.DebugWriteLine(MODULE_NAME, "--use-buffered-reads={0}", useBufferedReads); + AaruConsole.DebugWriteLine(MODULE_NAME, "--store-encrypted={0}", storeEncrypted); + AaruConsole.DebugWriteLine(MODULE_NAME, "--title-keys={0}", titleKeys); + AaruConsole.DebugWriteLine(MODULE_NAME, "--ignore-cdr-runouts={0}", ignoreCdrRunOuts); + AaruConsole.DebugWriteLine(MODULE_NAME, "--create-graph={0}", createGraph); + AaruConsole.DebugWriteLine(MODULE_NAME, "--dimensions={0}", dimensions); + AaruConsole.DebugWriteLine(MODULE_NAME, "--aaru-metadata={0}", aaruMetadata); // TODO: Disabled temporarily - //AaruConsole.DebugWriteLine("Dump-Media command", "--raw={0}", raw); + //AaruConsole.DebugWriteLine(MODULE_NAME, "--raw={0}", raw); Dictionary parsedOptions = Core.Options.Parse(options); - AaruConsole.DebugWriteLine("Dump-Media command", UI.Parsed_options); + AaruConsole.DebugWriteLine(MODULE_NAME, UI.Parsed_options); foreach(KeyValuePair parsedOption in parsedOptions) - AaruConsole.DebugWriteLine("Dump-Media command", "{0} = {1}", parsedOption.Key, parsedOption.Value); + AaruConsole.DebugWriteLine(MODULE_NAME, "{0} = {1}", parsedOption.Key, parsedOption.Value); Encoding encodingClass = null; diff --git a/Aaru/Commands/Media/Info.cs b/Aaru/Commands/Media/Info.cs index 41e418010..6b15fe9f9 100644 --- a/Aaru/Commands/Media/Info.cs +++ b/Aaru/Commands/Media/Info.cs @@ -51,6 +51,7 @@ using Aaru.Decoders.SCSI.MMC; using Aaru.Decoders.SCSI.SSC; using Aaru.Decoders.Xbox; using Aaru.Localization; +using Humanizer.Bytes; using Spectre.Console; using BCA = Aaru.Decoders.Bluray.BCA; using Cartridge = Aaru.Decoders.DVD.Cartridge; @@ -59,12 +60,13 @@ using DDS = Aaru.Decoders.DVD.DDS; using DMI = Aaru.Decoders.Xbox.DMI; using Session = Aaru.Decoders.CD.Session; using Spare = Aaru.Decoders.DVD.Spare; -using Humanizer.Bytes; namespace Aaru.Commands.Media; sealed class MediaInfoCommand : Command { + const string MODULE_NAME = "Media-Info command"; + public MediaInfoCommand() : base("info", UI.Media_Info_Command_Description) { Add(new Option(new[] @@ -113,10 +115,10 @@ sealed class MediaInfoCommand : Command Statistics.AddCommand("media-info"); - AaruConsole.DebugWriteLine("Media-Info command", "--debug={0}", debug); - AaruConsole.DebugWriteLine("Media-Info command", "--device={0}", devicePath); - AaruConsole.DebugWriteLine("Media-Info command", "--output-prefix={0}", outputPrefix); - AaruConsole.DebugWriteLine("Media-Info command", "--verbose={0}", verbose); + AaruConsole.DebugWriteLine(MODULE_NAME, "--debug={0}", debug); + AaruConsole.DebugWriteLine(MODULE_NAME, "--device={0}", devicePath); + AaruConsole.DebugWriteLine(MODULE_NAME, "--output-prefix={0}", outputPrefix); + AaruConsole.DebugWriteLine(MODULE_NAME, "--verbose={0}", verbose); if(devicePath.Length == 2 && devicePath[1] == ':' && @@ -203,11 +205,11 @@ sealed class MediaInfoCommand : Command return; if(scsiInfo.DeviceInfo.ScsiModeSense6 != null) - DataFile.WriteTo("Media-Info command", outputPrefix, "_scsi_modesense6.bin", "SCSI MODE SENSE (6)", + DataFile.WriteTo(MODULE_NAME, outputPrefix, "_scsi_modesense6.bin", "SCSI MODE SENSE (6)", scsiInfo.DeviceInfo.ScsiModeSense6); if(scsiInfo.DeviceInfo.ScsiModeSense10 != null) - DataFile.WriteTo("Media-Info command", outputPrefix, "_scsi_modesense10.bin", "SCSI MODE SENSE (10)", + DataFile.WriteTo(MODULE_NAME, outputPrefix, "_scsi_modesense10.bin", "SCSI MODE SENSE (10)", scsiInfo.DeviceInfo.ScsiModeSense10); switch(dev.ScsiType) @@ -221,11 +223,11 @@ sealed class MediaInfoCommand : Command case PeripheralDeviceTypes.BridgingExpander when dev.Model.StartsWith("MDM", StringComparison.Ordinal) || dev.Model.StartsWith("MDH", StringComparison.Ordinal): if(scsiInfo.ReadCapacity != null) - DataFile.WriteTo("Media-Info command", outputPrefix, "_readcapacity.bin", "SCSI READ CAPACITY", + DataFile.WriteTo(MODULE_NAME, outputPrefix, "_readcapacity.bin", "SCSI READ CAPACITY", scsiInfo.ReadCapacity); if(scsiInfo.ReadCapacity16 != null) - DataFile.WriteTo("Media-Info command", outputPrefix, "_readcapacity16.bin", + DataFile.WriteTo(MODULE_NAME, outputPrefix, "_readcapacity16.bin", "SCSI READ CAPACITY(16)", scsiInfo.ReadCapacity16); if(scsiInfo.Blocks != 0 && @@ -238,7 +240,7 @@ sealed class MediaInfoCommand : Command case PeripheralDeviceTypes.SequentialAccess: if(scsiInfo.DensitySupport != null) { - DataFile.WriteTo("Media-Info command", outputPrefix, "_ssc_reportdensitysupport_media.bin", + DataFile.WriteTo(MODULE_NAME, outputPrefix, "_ssc_reportdensitysupport_media.bin", "SSC REPORT DENSITY SUPPORT (MEDIA)", scsiInfo.DensitySupport); if(scsiInfo.DensitySupportHeader.HasValue) @@ -250,7 +252,7 @@ sealed class MediaInfoCommand : Command if(scsiInfo.MediaTypeSupport != null) { - DataFile.WriteTo("Media-Info command", outputPrefix, "_ssc_reportdensitysupport_medium_media.bin", + DataFile.WriteTo(MODULE_NAME, outputPrefix, "_ssc_reportdensitysupport_medium_media.bin", "SSC REPORT DENSITY SUPPORT (MEDIUM & MEDIA)", scsiInfo.MediaTypeSupport); if(scsiInfo.MediaTypeSupportHeader.HasValue) @@ -268,20 +270,20 @@ sealed class MediaInfoCommand : Command if(dev.ScsiType == PeripheralDeviceTypes.MultiMediaDevice) { if(scsiInfo.MmcConfiguration != null) - DataFile.WriteTo("Media-Info command", outputPrefix, "_getconfiguration_current.bin", + DataFile.WriteTo(MODULE_NAME, outputPrefix, "_getconfiguration_current.bin", "SCSI GET CONFIGURATION", scsiInfo.MmcConfiguration); if(scsiInfo.RecognizedFormatLayers != null) - DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_formatlayers.bin", + DataFile.WriteTo(MODULE_NAME, outputPrefix, "_readdiscstructure_formatlayers.bin", "SCSI READ DISC STRUCTURE", scsiInfo.RecognizedFormatLayers); if(scsiInfo.WriteProtectionStatus != null) - DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_writeprotection.bin", + DataFile.WriteTo(MODULE_NAME, outputPrefix, "_readdiscstructure_writeprotection.bin", "SCSI READ DISC STRUCTURE", scsiInfo.WriteProtectionStatus); if(scsiInfo.DvdPfi != null) { - DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_dvd_pfi.bin", + DataFile.WriteTo(MODULE_NAME, outputPrefix, "_readdiscstructure_dvd_pfi.bin", "SCSI READ DISC STRUCTURE", scsiInfo.DvdPfi); if(scsiInfo.DecodedPfi.HasValue) @@ -290,7 +292,7 @@ sealed class MediaInfoCommand : Command if(scsiInfo.DvdDmi != null) { - DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_dvd_dmi.bin", + DataFile.WriteTo(MODULE_NAME, outputPrefix, "_readdiscstructure_dvd_dmi.bin", "SCSI READ DISC STRUCTURE", scsiInfo.DvdDmi); if(DMI.IsXbox(scsiInfo.DvdDmi)) @@ -303,7 +305,7 @@ sealed class MediaInfoCommand : Command if(scsiInfo.DvdCmi != null) { - DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_dvd_cmi.bin", + DataFile.WriteTo(MODULE_NAME, outputPrefix, "_readdiscstructure_dvd_cmi.bin", "SCSI READ DISC STRUCTURE", scsiInfo.DvdCmi); AaruConsole.WriteLine($"[bold]{Localization.Core.Lead_In_CMI}:[/]", @@ -311,24 +313,24 @@ sealed class MediaInfoCommand : Command } if(scsiInfo.DvdDiscKey != null) - DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_dvd_disckey.bin", + DataFile.WriteTo(MODULE_NAME, outputPrefix, "_readdiscstructure_dvd_disckey.bin", "SCSI READ DISC STRUCTURE", scsiInfo.DvdDiscKey); if(scsiInfo.DvdSectorCmi != null) - DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_dvd_sectorcmi.bin", + DataFile.WriteTo(MODULE_NAME, outputPrefix, "_readdiscstructure_dvd_sectorcmi.bin", "SCSI READ DISC STRUCTURE", scsiInfo.DvdSectorCmi); if(scsiInfo.DvdBca != null) - DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_dvd_bca.bin", + DataFile.WriteTo(MODULE_NAME, outputPrefix, "_readdiscstructure_dvd_bca.bin", "SCSI READ DISC STRUCTURE", scsiInfo.DvdBca); if(scsiInfo.DvdAacs != null) - DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_dvd_aacs.bin", + DataFile.WriteTo(MODULE_NAME, outputPrefix, "_readdiscstructure_dvd_aacs.bin", "SCSI READ DISC STRUCTURE", scsiInfo.DvdAacs); if(scsiInfo.DvdRamDds != null) { - DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_dvdram_dds.bin", + DataFile.WriteTo(MODULE_NAME, outputPrefix, "_readdiscstructure_dvdram_dds.bin", "SCSI READ DISC STRUCTURE", scsiInfo.DvdRamDds); AaruConsole.WriteLine($"[bold]{UI.Disc_Definition_Structure}:[/]", @@ -337,7 +339,7 @@ sealed class MediaInfoCommand : Command if(scsiInfo.DvdRamCartridgeStatus != null) { - DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_dvdram_status.bin", + DataFile.WriteTo(MODULE_NAME, outputPrefix, "_readdiscstructure_dvdram_status.bin", "SCSI READ DISC STRUCTURE", scsiInfo.DvdRamCartridgeStatus); AaruConsole.WriteLine($"[bold]{Localization.Core.Medium_Status}:[/]", @@ -346,7 +348,7 @@ sealed class MediaInfoCommand : Command if(scsiInfo.DvdRamSpareArea != null) { - DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_dvdram_spare.bin", + DataFile.WriteTo(MODULE_NAME, outputPrefix, "_readdiscstructure_dvdram_spare.bin", "SCSI READ DISC STRUCTURE", scsiInfo.DvdRamSpareArea); AaruConsole.WriteLine($"[bold]{UI.Spare_Area_Information}:[/]", @@ -354,12 +356,12 @@ sealed class MediaInfoCommand : Command } if(scsiInfo.LastBorderOutRmd != null) - DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_dvd_lastrmd.bin", + DataFile.WriteTo(MODULE_NAME, outputPrefix, "_readdiscstructure_dvd_lastrmd.bin", "SCSI READ DISC STRUCTURE", scsiInfo.LastBorderOutRmd); if(scsiInfo.DvdPreRecordedInfo != null) { - DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_dvd_pri.bin", + DataFile.WriteTo(MODULE_NAME, outputPrefix, "_readdiscstructure_dvd_pri.bin", "SCSI READ DISC STRUCTURE", scsiInfo.DvdPreRecordedInfo); if(scsiInfo.DecodedDvdPrePitInformation.HasValue) @@ -368,12 +370,12 @@ sealed class MediaInfoCommand : Command } if(scsiInfo.DvdrMediaIdentifier != null) - DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_dvdr_mediaid.bin", + DataFile.WriteTo(MODULE_NAME, outputPrefix, "_readdiscstructure_dvdr_mediaid.bin", "SCSI READ DISC STRUCTURE", scsiInfo.DvdrMediaIdentifier); if(scsiInfo.DvdrPhysicalInformation != null) { - DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_dvdr_pfi.bin", + DataFile.WriteTo(MODULE_NAME, outputPrefix, "_readdiscstructure_dvdr_pfi.bin", "SCSI READ DISC STRUCTURE", scsiInfo.DvdrPhysicalInformation); if(scsiInfo.DecodedDvdrPfi.HasValue) @@ -382,48 +384,48 @@ sealed class MediaInfoCommand : Command } if(scsiInfo.DvdPlusAdip != null) - DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_dvd+_adip.bin", + DataFile.WriteTo(MODULE_NAME, outputPrefix, "_readdiscstructure_dvd+_adip.bin", "SCSI READ DISC STRUCTURE", scsiInfo.DvdPlusAdip); if(scsiInfo.DvdPlusDcb != null) - DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_dvd+_dcb.bin", + DataFile.WriteTo(MODULE_NAME, outputPrefix, "_readdiscstructure_dvd+_dcb.bin", "SCSI READ DISC STRUCTURE", scsiInfo.DvdPlusDcb); if(scsiInfo.HddvdCopyrightInformation != null) - DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_hddvd_cmi.bin", + DataFile.WriteTo(MODULE_NAME, outputPrefix, "_readdiscstructure_hddvd_cmi.bin", "SCSI READ DISC STRUCTURE", scsiInfo.HddvdCopyrightInformation); if(scsiInfo.HddvdrMediumStatus != null) - DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_hddvdr_status.bin", + DataFile.WriteTo(MODULE_NAME, outputPrefix, "_readdiscstructure_hddvdr_status.bin", "SCSI READ DISC STRUCTURE", scsiInfo.HddvdrMediumStatus); if(scsiInfo.HddvdrLastRmd != null) - DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_hddvdr_lastrmd.bin", + DataFile.WriteTo(MODULE_NAME, outputPrefix, "_readdiscstructure_hddvdr_lastrmd.bin", "SCSI READ DISC STRUCTURE", scsiInfo.HddvdrLastRmd); if(scsiInfo.DvdrLayerCapacity != null) - DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_dvdr_layercap.bin", + DataFile.WriteTo(MODULE_NAME, outputPrefix, "_readdiscstructure_dvdr_layercap.bin", "SCSI READ DISC STRUCTURE", scsiInfo.DvdrLayerCapacity); if(scsiInfo.DvdrDlMiddleZoneStart != null) - DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_dvd_mzs.bin", + DataFile.WriteTo(MODULE_NAME, outputPrefix, "_readdiscstructure_dvd_mzs.bin", "SCSI READ DISC STRUCTURE", scsiInfo.DvdrDlMiddleZoneStart); if(scsiInfo.DvdrDlJumpIntervalSize != null) - DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_dvd_jis.bin", + DataFile.WriteTo(MODULE_NAME, outputPrefix, "_readdiscstructure_dvd_jis.bin", "SCSI READ DISC STRUCTURE", scsiInfo.DvdrDlJumpIntervalSize); if(scsiInfo.DvdrDlManualLayerJumpStartLba != null) - DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_dvd_manuallj.bin", + DataFile.WriteTo(MODULE_NAME, outputPrefix, "_readdiscstructure_dvd_manuallj.bin", "SCSI READ DISC STRUCTURE", scsiInfo.DvdrDlManualLayerJumpStartLba); if(scsiInfo.DvdrDlRemapAnchorPoint != null) - DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_dvd_remapanchor.bin", + DataFile.WriteTo(MODULE_NAME, outputPrefix, "_readdiscstructure_dvd_remapanchor.bin", "SCSI READ DISC STRUCTURE", scsiInfo.DvdrDlRemapAnchorPoint); if(scsiInfo.BlurayDiscInformation != null) { - DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_bd_di.bin", + DataFile.WriteTo(MODULE_NAME, outputPrefix, "_readdiscstructure_bd_di.bin", "SCSI READ DISC STRUCTURE", scsiInfo.BlurayDiscInformation); AaruConsole.WriteLine($"[bold]{Localization.Core.Bluray_Disc_Information}:[/]", @@ -431,12 +433,12 @@ sealed class MediaInfoCommand : Command } if(scsiInfo.BlurayPac != null) - DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_bd_pac.bin", + DataFile.WriteTo(MODULE_NAME, outputPrefix, "_readdiscstructure_bd_pac.bin", "SCSI READ DISC STRUCTURE", scsiInfo.BlurayPac); if(scsiInfo.BlurayBurstCuttingArea != null) { - DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_bd_bca.bin", + DataFile.WriteTo(MODULE_NAME, outputPrefix, "_readdiscstructure_bd_bca.bin", "SCSI READ DISC STRUCTURE", scsiInfo.BlurayBurstCuttingArea); AaruConsole.WriteLine($"[bold]{Localization.Core.Bluray_Burst_Cutting_Area}:[/]", @@ -445,7 +447,7 @@ sealed class MediaInfoCommand : Command if(scsiInfo.BlurayDds != null) { - DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_bd_dds.bin", + DataFile.WriteTo(MODULE_NAME, outputPrefix, "_readdiscstructure_bd_dds.bin", "SCSI READ DISC STRUCTURE", scsiInfo.BlurayDds); AaruConsole.WriteLine($"[bold]{Localization.Core.Bluray_Disc_Definition_Structure}:[/]", @@ -454,26 +456,26 @@ sealed class MediaInfoCommand : Command if(scsiInfo.BlurayCartridgeStatus != null) { - DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_bd_cartstatus.bin", + DataFile.WriteTo(MODULE_NAME, outputPrefix, "_readdiscstructure_bd_cartstatus.bin", "SCSI READ DISC STRUCTURE", scsiInfo.BlurayCartridgeStatus); AaruConsole.WriteLine($"[bold]{Localization.Core.Bluray_Cartridge_Status}:[/]", $"\n{Markup.Escape(Decoders.Bluray.Cartridge.Prettify(scsiInfo. - BlurayCartridgeStatus))}"); + BlurayCartridgeStatus))}"); } if(scsiInfo.BluraySpareAreaInformation != null) { - DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_bd_spare.bin", + DataFile.WriteTo(MODULE_NAME, outputPrefix, "_readdiscstructure_bd_spare.bin", "SCSI READ DISC STRUCTURE", scsiInfo.BluraySpareAreaInformation); AaruConsole.WriteLine($"[bold]{Localization.Core.Bluray_Spare_Area_Information}:[/]", $"\n{Markup.Escape(Decoders.Bluray.Spare.Prettify(scsiInfo. - BluraySpareAreaInformation))}"); + BluraySpareAreaInformation))}"); } if(scsiInfo.BlurayRawDfl != null) - DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_bd_dfl.bin", + DataFile.WriteTo(MODULE_NAME, outputPrefix, "_readdiscstructure_bd_dfl.bin", "SCSI READ DISC STRUCTURE", scsiInfo.BlurayRawDfl); if(scsiInfo.BlurayTrackResources != null) @@ -481,7 +483,7 @@ sealed class MediaInfoCommand : Command AaruConsole.WriteLine($"[bold]{Localization.Core.Track_Resources_Information}:[/]", $"\n{Markup.Escape(DiscInformation.Prettify(scsiInfo.BlurayTrackResources))}"); - DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscinformation_001b.bin", + DataFile.WriteTo(MODULE_NAME, outputPrefix, "_readdiscinformation_001b.bin", "SCSI READ DISC INFORMATION", scsiInfo.BlurayTrackResources); } @@ -490,13 +492,13 @@ sealed class MediaInfoCommand : Command AaruConsole.WriteLine($"[bold]{Localization.Core.POW_Resources_Information}:[/]", $"\n{Markup.Escape(DiscInformation.Prettify(scsiInfo.BlurayPowResources))}"); - DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscinformation_010b.bin", + DataFile.WriteTo(MODULE_NAME, outputPrefix, "_readdiscinformation_010b.bin", "SCSI READ DISC INFORMATION", scsiInfo.BlurayPowResources); } if(scsiInfo.Toc != null) { - DataFile.WriteTo("Media-Info command", outputPrefix, "_toc.bin", "SCSI READ TOC/PMA/ATIP", + DataFile.WriteTo(MODULE_NAME, outputPrefix, "_toc.bin", "SCSI READ TOC/PMA/ATIP", scsiInfo.Toc); if(scsiInfo.DecodedToc.HasValue) @@ -506,7 +508,7 @@ sealed class MediaInfoCommand : Command if(scsiInfo.Atip != null) { - DataFile.WriteTo("Media-Info command", outputPrefix, "_atip.bin", "SCSI READ TOC/PMA/ATIP", + DataFile.WriteTo(MODULE_NAME, outputPrefix, "_atip.bin", "SCSI READ TOC/PMA/ATIP", scsiInfo.Atip); if(scsiInfo.DecodedAtip != null) @@ -516,7 +518,7 @@ sealed class MediaInfoCommand : Command if(scsiInfo.DiscInformation != null) { - DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscinformation_000b.bin", + DataFile.WriteTo(MODULE_NAME, outputPrefix, "_readdiscinformation_000b.bin", "SCSI READ DISC INFORMATION", scsiInfo.DiscInformation); if(scsiInfo.DecodedDiscInformation.HasValue) @@ -527,7 +529,7 @@ sealed class MediaInfoCommand : Command if(scsiInfo.Session != null) { - DataFile.WriteTo("Media-Info command", outputPrefix, "_session.bin", "SCSI READ TOC/PMA/ATIP", + DataFile.WriteTo(MODULE_NAME, outputPrefix, "_session.bin", "SCSI READ TOC/PMA/ATIP", scsiInfo.Session); if(scsiInfo.DecodedSession.HasValue) @@ -537,7 +539,7 @@ sealed class MediaInfoCommand : Command if(scsiInfo.RawToc != null) { - DataFile.WriteTo("Media-Info command", outputPrefix, "_rawtoc.bin", "SCSI READ TOC/PMA/ATIP", + DataFile.WriteTo(MODULE_NAME, outputPrefix, "_rawtoc.bin", "SCSI READ TOC/PMA/ATIP", scsiInfo.RawToc); if(scsiInfo.FullToc.HasValue) @@ -547,7 +549,7 @@ sealed class MediaInfoCommand : Command if(scsiInfo.Pma != null) { - DataFile.WriteTo("Media-Info command", outputPrefix, "_pma.bin", "SCSI READ TOC/PMA/ATIP", + DataFile.WriteTo(MODULE_NAME, outputPrefix, "_pma.bin", "SCSI READ TOC/PMA/ATIP", scsiInfo.Pma); AaruConsole.WriteLine($"[bold]{Localization.Core.PMA}:[/]", @@ -556,7 +558,7 @@ sealed class MediaInfoCommand : Command if(scsiInfo.CdTextLeadIn != null) { - DataFile.WriteTo("Media-Info command", outputPrefix, "_cdtext.bin", "SCSI READ TOC/PMA/ATIP", + DataFile.WriteTo(MODULE_NAME, outputPrefix, "_cdtext.bin", "SCSI READ TOC/PMA/ATIP", scsiInfo.CdTextLeadIn); if(scsiInfo.DecodedCdTextLeadIn.HasValue) @@ -573,7 +575,7 @@ sealed class MediaInfoCommand : Command Markup.Escape(isrc.Value)}"); if(scsiInfo.XboxSecuritySector != null) - DataFile.WriteTo("Media-Info command", outputPrefix, "_xbox_ss.bin", "KREON EXTRACT SS", + DataFile.WriteTo(MODULE_NAME, outputPrefix, "_xbox_ss.bin", "KREON EXTRACT SS", scsiInfo.XboxSecuritySector); if(scsiInfo.DecodedXboxSecuritySector.HasValue) @@ -605,7 +607,7 @@ sealed class MediaInfoCommand : Command if(scsiInfo.MediaSerialNumber != null) { - DataFile.WriteTo("Media-Info command", outputPrefix, "_mediaserialnumber.bin", + DataFile.WriteTo(MODULE_NAME, outputPrefix, "_mediaserialnumber.bin", "SCSI READ MEDIA SERIAL NUMBER", scsiInfo.MediaSerialNumber); AaruConsole.Write($"[bold]{Localization.Core.Media_Serial_Number}:[/] "); diff --git a/Aaru/Commands/Media/Scan.cs b/Aaru/Commands/Media/Scan.cs index 081748eb6..c127ecf27 100644 --- a/Aaru/Commands/Media/Scan.cs +++ b/Aaru/Commands/Media/Scan.cs @@ -46,6 +46,7 @@ namespace Aaru.Commands.Media; sealed class MediaScanCommand : Command { + const string MODULE_NAME = "Media-Scan command"; static ProgressTask _progressTask1; public MediaScanCommand() : base("scan", UI.Media_Scan_Command_Description) @@ -107,12 +108,12 @@ sealed class MediaScanCommand : Command Statistics.AddCommand("media-scan"); - AaruConsole.DebugWriteLine("Media-Scan command", "--debug={0}", debug); - AaruConsole.DebugWriteLine("Media-Scan command", "--device={0}", devicePath); - AaruConsole.DebugWriteLine("Media-Scan command", "--ibg-log={0}", ibgLog); - AaruConsole.DebugWriteLine("Media-Scan command", "--mhdd-log={0}", mhddLog); - AaruConsole.DebugWriteLine("Media-Scan command", "--verbose={0}", verbose); - AaruConsole.DebugWriteLine("Media-Scan command", "--use-buffered-reads={0}", useBufferedReads); + AaruConsole.DebugWriteLine(MODULE_NAME, "--debug={0}", debug); + AaruConsole.DebugWriteLine(MODULE_NAME, "--device={0}", devicePath); + AaruConsole.DebugWriteLine(MODULE_NAME, "--ibg-log={0}", ibgLog); + AaruConsole.DebugWriteLine(MODULE_NAME, "--mhdd-log={0}", mhddLog); + AaruConsole.DebugWriteLine(MODULE_NAME, "--verbose={0}", verbose); + AaruConsole.DebugWriteLine(MODULE_NAME, "--use-buffered-reads={0}", useBufferedReads); if(devicePath.Length == 2 && devicePath[1] == ':' && diff --git a/Aaru/Commands/Remote.cs b/Aaru/Commands/Remote.cs index eccd8f869..ee2283bc7 100644 --- a/Aaru/Commands/Remote.cs +++ b/Aaru/Commands/Remote.cs @@ -46,6 +46,8 @@ namespace Aaru.Commands; sealed class RemoteCommand : Command { + const string MODULE_NAME = "Remote command"; + public RemoteCommand() : base("remote", UI.Remote_Command_Description) { AddArgument(new Argument @@ -89,9 +91,9 @@ sealed class RemoteCommand : Command Statistics.AddCommand("remote"); - AaruConsole.DebugWriteLine("Remote command", "--debug={0}", debug); - AaruConsole.DebugWriteLine("Remote command", "--host={0}", host); - AaruConsole.DebugWriteLine("Remote command", "--verbose={0}", verbose); + AaruConsole.DebugWriteLine(MODULE_NAME, "--debug={0}", debug); + AaruConsole.DebugWriteLine(MODULE_NAME, "--host={0}", host); + AaruConsole.DebugWriteLine(MODULE_NAME, "--verbose={0}", verbose); try {