[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.
This commit is contained in:
2023-10-03 16:52:02 +01:00
parent 1703b3b6a1
commit 3c4ef2b3d6
26 changed files with 378 additions and 333 deletions

View File

@@ -43,6 +43,8 @@ namespace Aaru.Commands.Archive;
sealed class ArchiveInfoCommand : Command sealed class ArchiveInfoCommand : Command
{ {
const string MODULE_NAME = "Analyze command";
public ArchiveInfoCommand() : base("info", UI.Archive_Info_Command_Description) public ArchiveInfoCommand() : base("info", UI.Archive_Info_Command_Description)
{ {
AddArgument(new Argument<string> AddArgument(new Argument<string>
@@ -86,9 +88,9 @@ sealed class ArchiveInfoCommand : Command
Statistics.AddCommand("archive-info"); Statistics.AddCommand("archive-info");
AaruConsole.DebugWriteLine("Analyze command", "--debug={0}", debug); AaruConsole.DebugWriteLine(MODULE_NAME, "--debug={0}", debug);
AaruConsole.DebugWriteLine("Analyze command", "--input={0}", imagePath); AaruConsole.DebugWriteLine(MODULE_NAME, "--input={0}", imagePath);
AaruConsole.DebugWriteLine("Analyze command", "--verbose={0}", verbose); AaruConsole.DebugWriteLine(MODULE_NAME, "--verbose={0}", verbose);
/* TODO: This is just a stub for now */ /* TODO: This is just a stub for now */

View File

@@ -47,7 +47,8 @@ namespace Aaru.Commands.Database;
sealed class UpdateCommand : Command 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) public UpdateCommand(bool mainDbUpdate) : base("update", UI.Database_Update_Command_Description)
{ {
@@ -91,8 +92,8 @@ sealed class UpdateCommand : Command
AnsiConsole.Markup(format, objects); AnsiConsole.Markup(format, objects);
}; };
AaruConsole.DebugWriteLine("Update command", "--debug={0}", debug); AaruConsole.DebugWriteLine(MODULE_NAME, "--debug={0}", debug);
AaruConsole.DebugWriteLine("Update command", "--verbose={0}", verbose); AaruConsole.DebugWriteLine(MODULE_NAME, "--verbose={0}", verbose);
if(clearAll) if(clearAll)
try try

View File

@@ -59,6 +59,8 @@ namespace Aaru.Commands.Device;
sealed class DeviceReportCommand : Command sealed class DeviceReportCommand : Command
{ {
const string MODULE_NAME = "Device-Report command";
public DeviceReportCommand() : base("report", UI.Device_Report_Command_Description) public DeviceReportCommand() : base("report", UI.Device_Report_Command_Description)
{ {
AddArgument(new Argument<string> AddArgument(new Argument<string>
@@ -107,9 +109,9 @@ sealed class DeviceReportCommand : Command
Statistics.AddCommand("device-report"); Statistics.AddCommand("device-report");
AaruConsole.DebugWriteLine("Device-Report command", "--debug={0}", debug); AaruConsole.DebugWriteLine(MODULE_NAME, "--debug={0}", debug);
AaruConsole.DebugWriteLine("Device-Report command", "--device={0}", devicePath); AaruConsole.DebugWriteLine(MODULE_NAME, "--device={0}", devicePath);
AaruConsole.DebugWriteLine("Device-Report command", "--verbose={0}", verbose); AaruConsole.DebugWriteLine(MODULE_NAME, "--verbose={0}", verbose);
if(devicePath.Length == 2 && if(devicePath.Length == 2 &&
devicePath[1] == ':' && devicePath[1] == ':' &&
@@ -817,7 +819,7 @@ sealed class DeviceReportCommand : Command
break; break;
} }
default: default:
AaruConsole.DebugWriteLine("Device-Report command", AaruConsole.DebugWriteLine(MODULE_NAME,
Localization.Core.Device_not_ready_Sense, Localization.Core.Device_not_ready_Sense,
decSense.Value.SenseKey, decSense.Value.ASC, decSense.Value.SenseKey, decSense.Value.ASC,
decSense.Value.ASCQ); decSense.Value.ASCQ);
@@ -828,7 +830,7 @@ sealed class DeviceReportCommand : Command
} }
else else
{ {
AaruConsole.DebugWriteLine("Device-Report command", AaruConsole.DebugWriteLine(MODULE_NAME,
Localization.Core. Localization.Core.
Got_sense_status_but_no_sense_buffer); 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(); ctx.AddTask(Localization.Core.Waiting_for_drive_to_become_ready).IsIndeterminate();
sense = dev.ScsiTestUnitReady(out senseBuffer, dev.Timeout, out _); sense = dev.ScsiTestUnitReady(out senseBuffer, dev.Timeout, out _);
AaruConsole.DebugWriteLine("Device reporting", "sense = {0}", sense); AaruConsole.DebugWriteLine(MODULE_NAME, "sense = {0}", sense);
if(!sense) if(!sense)
return; return;
@@ -1037,7 +1039,7 @@ sealed class DeviceReportCommand : Command
break; break;
} }
default: default:
AaruConsole.DebugWriteLine("Device-Report command", AaruConsole.DebugWriteLine(MODULE_NAME,
Localization.Core.Device_not_ready_Sense, Localization.Core.Device_not_ready_Sense,
decSense.Value.SenseKey, decSense.Value.ASC, decSense.Value.SenseKey, decSense.Value.ASC,
decSense.Value.ASCQ); decSense.Value.ASCQ);
@@ -1048,7 +1050,7 @@ sealed class DeviceReportCommand : Command
} }
else else
{ {
AaruConsole.DebugWriteLine("Device-Report command", AaruConsole.DebugWriteLine(MODULE_NAME,
Localization.Core.Got_sense_status_but_no_sense_buffer); Localization.Core.Got_sense_status_but_no_sense_buffer);
mediaIsRecognized = false; mediaIsRecognized = false;
@@ -1185,7 +1187,7 @@ sealed class DeviceReportCommand : Command
break; break;
} }
default: default:
AaruConsole.DebugWriteLine("Device-Report command", AaruConsole.DebugWriteLine(MODULE_NAME,
Localization.Core.Device_not_ready_Sense, Localization.Core.Device_not_ready_Sense,
decSense.Value.SenseKey, decSense.Value.ASC, decSense.Value.SenseKey, decSense.Value.ASC,
decSense.Value.ASCQ); decSense.Value.ASCQ);
@@ -1196,7 +1198,7 @@ sealed class DeviceReportCommand : Command
} }
else else
{ {
AaruConsole.DebugWriteLine("Device-Report command", AaruConsole.DebugWriteLine(MODULE_NAME,
Localization.Core.Got_sense_status_but_no_sense_buffer); Localization.Core.Got_sense_status_but_no_sense_buffer);
mediaIsRecognized = false; mediaIsRecognized = false;

View File

@@ -64,6 +64,8 @@ namespace Aaru.Commands.Device;
sealed class DeviceInfoCommand : Command sealed class DeviceInfoCommand : Command
{ {
const string MODULE_NAME = "Device-Info command";
public DeviceInfoCommand() : base("info", UI.Device_Info_Command_Description) public DeviceInfoCommand() : base("info", UI.Device_Info_Command_Description)
{ {
Add(new Option<string>(new[] Add(new Option<string>(new[]
@@ -112,10 +114,10 @@ sealed class DeviceInfoCommand : Command
Statistics.AddCommand("device-info"); Statistics.AddCommand("device-info");
AaruConsole.DebugWriteLine("Device-Info command", "--debug={0}", debug); AaruConsole.DebugWriteLine(MODULE_NAME, "--debug={0}", debug);
AaruConsole.DebugWriteLine("Device-Info command", "--device={0}", devicePath); AaruConsole.DebugWriteLine(MODULE_NAME, "--device={0}", devicePath);
AaruConsole.DebugWriteLine("Device-Info command", "--output-prefix={0}", outputPrefix); AaruConsole.DebugWriteLine(MODULE_NAME, "--output-prefix={0}", outputPrefix);
AaruConsole.DebugWriteLine("Device-Info command", "--verbose={0}", verbose); AaruConsole.DebugWriteLine(MODULE_NAME, "--verbose={0}", verbose);
if(devicePath.Length == 2 && if(devicePath.Length == 2 &&
devicePath[1] == ':' && devicePath[1] == ':' &&
@@ -256,25 +258,25 @@ sealed class DeviceInfoCommand : Command
case TupleCodes.CISTPL_SPCL: case TupleCodes.CISTPL_SPCL:
case TupleCodes.CISTPL_SWIL: case TupleCodes.CISTPL_SWIL:
case TupleCodes.CISTPL_VERS_2: case TupleCodes.CISTPL_VERS_2:
AaruConsole.DebugWriteLine("Device-Info command", AaruConsole.DebugWriteLine(MODULE_NAME,
Localization.Core.Invoke_Found_undecoded_tuple_ID_0, tuple.Code); Localization.Core.Invoke_Found_undecoded_tuple_ID_0, tuple.Code);
break; break;
default: default:
AaruConsole.DebugWriteLine("Device-Info command", AaruConsole.DebugWriteLine(MODULE_NAME,
Localization.Core.Found_unknown_tuple_ID_0, (byte)tuple.Code); Localization.Core.Found_unknown_tuple_ID_0, (byte)tuple.Code);
break; break;
} }
else 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); var devInfo = new DeviceInfo(dev);
if(devInfo.AtaIdentify != null) 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); devInfo.AtaIdentify);
Identify.IdentifyDevice? decodedIdentify = Identify.Decode(devInfo.AtaIdentify); Identify.IdentifyDevice? decodedIdentify = Identify.Decode(devInfo.AtaIdentify);
@@ -356,7 +358,7 @@ sealed class DeviceInfoCommand : Command
if(devInfo.AtapiIdentify != null) 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); devInfo.AtapiIdentify);
AaruConsole.WriteLine(Decoders.ATA.Identify.Prettify(devInfo.AtapiIdentify)); AaruConsole.WriteLine(Decoders.ATA.Identify.Prettify(devInfo.AtapiIdentify));
@@ -367,7 +369,7 @@ sealed class DeviceInfoCommand : Command
if(dev.Type != DeviceType.ATAPI) if(dev.Type != DeviceType.ATAPI)
AaruConsole.WriteLine($"[bold]{UI.Title_SCSI_device}[/]"); 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); devInfo.ScsiInquiryData);
AaruConsole.WriteLine(Inquiry.Prettify(devInfo.ScsiInquiry)); AaruConsole.WriteLine(Inquiry.Prettify(devInfo.ScsiInquiry));
@@ -380,21 +382,21 @@ sealed class DeviceInfoCommand : Command
AaruConsole.WriteLine(Localization.Core.ASCII_Page_0_1, page.Key, AaruConsole.WriteLine(Localization.Core.ASCII_Page_0_1, page.Key,
EVPD.DecodeASCIIPage(page.Value)); EVPD.DecodeASCIIPage(page.Value));
DataFile.WriteTo("Device-Info command", outputPrefix, page.Value); DataFile.WriteTo(MODULE_NAME, outputPrefix, page.Value);
break; break;
case 0x80: case 0x80:
AaruConsole.WriteLine(Localization.Core.Unit_Serial_Number_0, AaruConsole.WriteLine(Localization.Core.Unit_Serial_Number_0,
EVPD.DecodePage80(page.Value)); 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); $"SCSI INQUIRY EVPD {page.Key:X2}h", page.Value);
break; break;
case 0x81: case 0x81:
AaruConsole.WriteLine("{0}", EVPD.PrettifyPage_81(page.Value)); 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); $"SCSI INQUIRY EVPD {page.Key:X2}h", page.Value);
break; break;
@@ -402,49 +404,49 @@ sealed class DeviceInfoCommand : Command
AaruConsole.WriteLine(Localization.Core.ASCII_implemented_operating_definitions_0, AaruConsole.WriteLine(Localization.Core.ASCII_implemented_operating_definitions_0,
EVPD.DecodePage82(page.Value)); 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); $"SCSI INQUIRY EVPD {page.Key:X2}h", page.Value);
break; break;
case 0x83: case 0x83:
AaruConsole.WriteLine("{0}", EVPD.PrettifyPage_83(page.Value)); 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); $"SCSI INQUIRY EVPD {page.Key:X2}h", page.Value);
break; break;
case 0x84: case 0x84:
AaruConsole.WriteLine("{0}", EVPD.PrettifyPage_84(page.Value)); 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); $"SCSI INQUIRY EVPD {page.Key:X2}h", page.Value);
break; break;
case 0x85: case 0x85:
AaruConsole.WriteLine("{0}", EVPD.PrettifyPage_85(page.Value)); 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); $"SCSI INQUIRY EVPD {page.Key:X2}h", page.Value);
break; break;
case 0x86: case 0x86:
AaruConsole.WriteLine("{0}", EVPD.PrettifyPage_86(page.Value)); 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); $"SCSI INQUIRY EVPD {page.Key:X2}h", page.Value);
break; break;
case 0x89: case 0x89:
AaruConsole.WriteLine("{0}", EVPD.PrettifyPage_89(page.Value)); 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); $"SCSI INQUIRY EVPD {page.Key:X2}h", page.Value);
break; break;
case 0xB0: case 0xB0:
AaruConsole.WriteLine("{0}", EVPD.PrettifyPage_B0(page.Value)); 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); $"SCSI INQUIRY EVPD {page.Key:X2}h", page.Value);
break; break;
@@ -452,7 +454,7 @@ sealed class DeviceInfoCommand : Command
AaruConsole.WriteLine(Localization.Core.Manufacturer_assigned_Serial_Number_0, AaruConsole.WriteLine(Localization.Core.Manufacturer_assigned_Serial_Number_0,
EVPD.DecodePageB1(page.Value)); 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); $"SCSI INQUIRY EVPD {page.Key:X2}h", page.Value);
break; break;
@@ -460,7 +462,7 @@ sealed class DeviceInfoCommand : Command
AaruConsole.WriteLine(Localization.Core.TapeAlert_Supported_Flags_Bitmap_0, AaruConsole.WriteLine(Localization.Core.TapeAlert_Supported_Flags_Bitmap_0,
EVPD.DecodePageB2(page.Value)); 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); $"SCSI INQUIRY EVPD {page.Key:X2}h", page.Value);
break; break;
@@ -468,7 +470,7 @@ sealed class DeviceInfoCommand : Command
AaruConsole.WriteLine(Localization.Core.Automation_Device_Serial_Number_0, AaruConsole.WriteLine(Localization.Core.Automation_Device_Serial_Number_0,
EVPD.DecodePageB3(page.Value)); 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); $"SCSI INQUIRY EVPD {page.Key:X2}h", page.Value);
break; break;
@@ -476,7 +478,7 @@ sealed class DeviceInfoCommand : Command
AaruConsole.WriteLine(Localization.Core.Data_Transfer_Device_Element_Address_0, AaruConsole.WriteLine(Localization.Core.Data_Transfer_Device_Element_Address_0,
EVPD.DecodePageB4(page.Value)); 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); $"SCSI INQUIRY EVPD {page.Key:X2}h", page.Value);
break; break;
@@ -484,7 +486,7 @@ sealed class DeviceInfoCommand : Command
ToLowerInvariant().Trim() == "quantum": ToLowerInvariant().Trim() == "quantum":
AaruConsole.WriteLine("{0}", EVPD.PrettifyPage_C0_Quantum(page.Value)); 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); $"SCSI INQUIRY EVPD {page.Key:X2}h", page.Value);
break; break;
@@ -492,7 +494,7 @@ sealed class DeviceInfoCommand : Command
ToLowerInvariant().Trim() == "seagate": ToLowerInvariant().Trim() == "seagate":
AaruConsole.WriteLine("{0}", EVPD.PrettifyPage_C0_Seagate(page.Value)); 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); $"SCSI INQUIRY EVPD {page.Key:X2}h", page.Value);
break; break;
@@ -500,7 +502,7 @@ sealed class DeviceInfoCommand : Command
ToLowerInvariant().Trim() == "ibm": ToLowerInvariant().Trim() == "ibm":
AaruConsole.WriteLine("{0}", EVPD.PrettifyPage_C0_IBM(page.Value)); 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); $"SCSI INQUIRY EVPD {page.Key:X2}h", page.Value);
break; break;
@@ -508,7 +510,7 @@ sealed class DeviceInfoCommand : Command
ToLowerInvariant().Trim() == "ibm": ToLowerInvariant().Trim() == "ibm":
AaruConsole.WriteLine("{0}", EVPD.PrettifyPage_C1_IBM(page.Value)); 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); $"SCSI INQUIRY EVPD {page.Key:X2}h", page.Value);
break; break;
@@ -517,7 +519,7 @@ sealed class DeviceInfoCommand : Command
ToLowerInvariant().Trim() == "certance": ToLowerInvariant().Trim() == "certance":
AaruConsole.WriteLine("{0}", EVPD.PrettifyPage_C0_C1_Certance(page.Value)); 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); $"SCSI INQUIRY EVPD {page.Key:X2}h", page.Value);
break; break;
@@ -526,7 +528,7 @@ sealed class DeviceInfoCommand : Command
ToLowerInvariant().Trim() == "certance": ToLowerInvariant().Trim() == "certance":
AaruConsole.WriteLine("{0}", EVPD.PrettifyPage_C2_C3_C4_C5_C6_Certance(page.Value)); 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); $"SCSI INQUIRY EVPD {page.Key:X2}h", page.Value);
break; break;
@@ -535,7 +537,7 @@ sealed class DeviceInfoCommand : Command
ToLowerInvariant().Trim() == "hp": ToLowerInvariant().Trim() == "hp":
AaruConsole.WriteLine("{0}", EVPD.PrettifyPage_C0_to_C5_HP(page.Value)); 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); $"SCSI INQUIRY EVPD {page.Key:X2}h", page.Value);
break; break;
@@ -543,7 +545,7 @@ sealed class DeviceInfoCommand : Command
ToLowerInvariant().Trim() == "certance": ToLowerInvariant().Trim() == "certance":
AaruConsole.WriteLine("{0}", EVPD.PrettifyPage_DF_Certance(page.Value)); 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); $"SCSI INQUIRY EVPD {page.Key:X2}h", page.Value);
break; break;
@@ -552,10 +554,10 @@ sealed class DeviceInfoCommand : Command
if(page.Key == 0x00) if(page.Key == 0x00)
continue; continue;
AaruConsole.DebugWriteLine("Device-Info command", AaruConsole.DebugWriteLine(MODULE_NAME,
Localization.Core.Found_undecoded_SCSI_VPD_page_0, page.Key); 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); $"SCSI INQUIRY EVPD {page.Key:X2}h", page.Value);
break; break;
@@ -563,11 +565,11 @@ sealed class DeviceInfoCommand : Command
} }
if(devInfo.ScsiModeSense6 != null) 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); devInfo.ScsiModeSense6);
if(devInfo.ScsiModeSense10 != null) 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); devInfo.ScsiModeSense10);
if(devInfo.ScsiMode.HasValue) if(devInfo.ScsiMode.HasValue)
@@ -577,15 +579,15 @@ sealed class DeviceInfoCommand : Command
if(devInfo.MmcConfiguration != null) 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); "MMC GET CONFIGURATION", devInfo.MmcConfiguration);
Features.SeparatedFeatures ftr = Features.Separate(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); ftr.DataLength);
AaruConsole.DebugWriteLine("Device-Info command", AaruConsole.DebugWriteLine(MODULE_NAME,
Localization.Core.GET_CONFIGURATION_current_profile_is_0, Localization.Core.GET_CONFIGURATION_current_profile_is_0,
ftr.CurrentProfile); ftr.CurrentProfile);
@@ -595,7 +597,7 @@ sealed class DeviceInfoCommand : Command
foreach(Features.FeatureDescriptor desc in ftr.Descriptors) 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) switch(desc.Code)
{ {
@@ -839,7 +841,7 @@ sealed class DeviceInfoCommand : Command
} }
} }
else else
AaruConsole.DebugWriteLine("Device-Info command", AaruConsole.DebugWriteLine(MODULE_NAME,
Localization.Core.GET_CONFIGURATION_returned_no_feature_descriptors); Localization.Core.GET_CONFIGURATION_returned_no_feature_descriptors);
} }
@@ -848,7 +850,7 @@ sealed class DeviceInfoCommand : Command
if(devInfo.PlextorFeatures?.Eeprom != null) 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); devInfo.PlextorFeatures.Eeprom);
AaruConsole.WriteLine(Localization.Core.Drive_has_loaded_a_total_of_0_discs, AaruConsole.WriteLine(Localization.Core.Drive_has_loaded_a_total_of_0_discs,
@@ -1006,7 +1008,7 @@ sealed class DeviceInfoCommand : Command
if(devInfo.BlockLimits != null) 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); "SSC READ BLOCK LIMITS", devInfo.BlockLimits);
AaruConsole.WriteLine(Localization.Core.Block_limits_for_device); AaruConsole.WriteLine(Localization.Core.Block_limits_for_device);
@@ -1015,7 +1017,7 @@ sealed class DeviceInfoCommand : Command
if(devInfo.DensitySupport != null) 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); "SSC REPORT DENSITY SUPPORT", devInfo.DensitySupport);
if(devInfo.DensitySupportHeader.HasValue) if(devInfo.DensitySupportHeader.HasValue)
@@ -1027,7 +1029,7 @@ sealed class DeviceInfoCommand : Command
if(devInfo.MediumDensitySupport != null) 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); "SSC REPORT DENSITY SUPPORT (MEDIUM)", devInfo.MediumDensitySupport);
if(devInfo.MediaTypeSupportHeader.HasValue) if(devInfo.MediaTypeSupportHeader.HasValue)
@@ -1049,21 +1051,21 @@ sealed class DeviceInfoCommand : Command
if(devInfo.CID != null) if(devInfo.CID != null)
{ {
noInfo = false; 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)); AaruConsole.WriteLine("{0}", Decoders.MMC.Decoders.PrettifyCID(devInfo.CID));
} }
if(devInfo.CSD != null) if(devInfo.CSD != null)
{ {
noInfo = false; 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)); AaruConsole.WriteLine("{0}", Decoders.MMC.Decoders.PrettifyCSD(devInfo.CSD));
} }
if(devInfo.OCR != null) if(devInfo.OCR != null)
{ {
noInfo = false; 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)); AaruConsole.WriteLine("{0}", Decoders.MMC.Decoders.PrettifyOCR(devInfo.OCR));
} }
@@ -1071,7 +1073,7 @@ sealed class DeviceInfoCommand : Command
{ {
noInfo = false; 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); devInfo.ExtendedCSD);
AaruConsole.WriteLine("{0}", Decoders.MMC.Decoders.PrettifyExtendedCSD(devInfo.ExtendedCSD)); AaruConsole.WriteLine("{0}", Decoders.MMC.Decoders.PrettifyExtendedCSD(devInfo.ExtendedCSD));
@@ -1090,7 +1092,7 @@ sealed class DeviceInfoCommand : Command
{ {
noInfo = false; 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); devInfo.CID);
AaruConsole.WriteLine("{0}", Decoders.SecureDigital.Decoders.PrettifyCID(devInfo.CID)); AaruConsole.WriteLine("{0}", Decoders.SecureDigital.Decoders.PrettifyCID(devInfo.CID));
@@ -1100,7 +1102,7 @@ sealed class DeviceInfoCommand : Command
{ {
noInfo = false; 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); devInfo.CSD);
AaruConsole.WriteLine("{0}", Decoders.SecureDigital.Decoders.PrettifyCSD(devInfo.CSD)); AaruConsole.WriteLine("{0}", Decoders.SecureDigital.Decoders.PrettifyCSD(devInfo.CSD));
@@ -1110,7 +1112,7 @@ sealed class DeviceInfoCommand : Command
{ {
noInfo = false; 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); devInfo.OCR);
AaruConsole.WriteLine("{0}", Decoders.SecureDigital.Decoders.PrettifyOCR(devInfo.OCR)); AaruConsole.WriteLine("{0}", Decoders.SecureDigital.Decoders.PrettifyOCR(devInfo.OCR));
@@ -1120,7 +1122,7 @@ sealed class DeviceInfoCommand : Command
{ {
noInfo = false; 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); devInfo.SCR);
AaruConsole.WriteLine("{0}", Decoders.SecureDigital.Decoders.PrettifySCR(devInfo.SCR)); AaruConsole.WriteLine("{0}", Decoders.SecureDigital.Decoders.PrettifySCR(devInfo.SCR));

View File

@@ -45,6 +45,8 @@ namespace Aaru.Commands.Device;
sealed class ListDevicesCommand : Command sealed class ListDevicesCommand : Command
{ {
const string MODULE_NAME = "List-Devices command";
public ListDevicesCommand() : base("list", UI.Device_List_Command_Description) public ListDevicesCommand() : base("list", UI.Device_List_Command_Description)
{ {
AddArgument(new Argument<string> AddArgument(new Argument<string>
@@ -88,8 +90,8 @@ sealed class ListDevicesCommand : Command
Statistics.AddCommand("list-devices"); Statistics.AddCommand("list-devices");
AaruConsole.DebugWriteLine("List-Devices command", "--debug={0}", debug); AaruConsole.DebugWriteLine(MODULE_NAME, "--debug={0}", debug);
AaruConsole.DebugWriteLine("List-Devices command", "--verbose={0}", verbose); AaruConsole.DebugWriteLine(MODULE_NAME, "--verbose={0}", verbose);
DeviceInfo[] devices = Devices.Device.ListDevices(out bool isRemote, out string serverApplication, DeviceInfo[] devices = Devices.Device.ListDevices(out bool isRemote, out string serverApplication,
out string serverVersion, out string serverOperatingSystem, out string serverVersion, out string serverOperatingSystem,

View File

@@ -52,7 +52,8 @@ namespace Aaru.Commands.Filesystem;
sealed class ExtractFilesCommand : Command 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) public ExtractFilesCommand() : base("extract", UI.Filesystem_Extract_Command_Description)
{ {
@@ -125,13 +126,13 @@ sealed class ExtractFilesCommand : Command
Statistics.AddCommand("extract-files"); Statistics.AddCommand("extract-files");
AaruConsole.DebugWriteLine("Extract-Files command", "--debug={0}", debug); AaruConsole.DebugWriteLine(MODULE_NAME, "--debug={0}", debug);
AaruConsole.DebugWriteLine("Extract-Files command", "--encoding={0}", encoding); AaruConsole.DebugWriteLine(MODULE_NAME, "--encoding={0}", encoding);
AaruConsole.DebugWriteLine("Extract-Files command", "--input={0}", imagePath); AaruConsole.DebugWriteLine(MODULE_NAME, "--input={0}", imagePath);
AaruConsole.DebugWriteLine("Extract-Files command", "--options={0}", options); AaruConsole.DebugWriteLine(MODULE_NAME, "--options={0}", options);
AaruConsole.DebugWriteLine("Extract-Files command", "--output={0}", outputDir); AaruConsole.DebugWriteLine(MODULE_NAME, "--output={0}", outputDir);
AaruConsole.DebugWriteLine("Extract-Files command", "--verbose={0}", verbose); AaruConsole.DebugWriteLine(MODULE_NAME, "--verbose={0}", verbose);
AaruConsole.DebugWriteLine("Extract-Files command", "--xattrs={0}", xattrs); AaruConsole.DebugWriteLine(MODULE_NAME, "--xattrs={0}", xattrs);
var filtersList = new FiltersList(); var filtersList = new FiltersList();
IFilter inputFilter = null; IFilter inputFilter = null;
@@ -143,10 +144,10 @@ sealed class ExtractFilesCommand : Command
}); });
Dictionary<string, string> parsedOptions = Core.Options.Parse(options); Dictionary<string, string> parsedOptions = Core.Options.Parse(options);
AaruConsole.DebugWriteLine("Extract-Files command", UI.Parsed_options); AaruConsole.DebugWriteLine(MODULE_NAME, UI.Parsed_options);
foreach(KeyValuePair<string, string> parsedOption in parsedOptions) foreach(KeyValuePair<string, string> 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()); parsedOptions.Add("debug", debug.ToString());
@@ -242,14 +243,14 @@ sealed class ExtractFilesCommand : Command
return (int)opened; 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); 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); imageFormat.Info.MediaType);
Statistics.AddMediaFormat(imageFormat.Format); Statistics.AddMediaFormat(imageFormat.Format);
@@ -276,7 +277,7 @@ sealed class ExtractFilesCommand : Command
if(partitions.Count == 0) if(partitions.Count == 0)
{ {
AaruConsole.DebugWriteLine("Ls command", UI.No_partitions_found); AaruConsole.DebugWriteLine(MODULE_NAME, UI.No_partitions_found);
partitions.Add(new Partition partitions.Add(new Partition
{ {
@@ -380,7 +381,7 @@ sealed class ExtractFilesCommand : Command
catch(Exception ex) catch(Exception ex)
{ {
AaruConsole.ErrorWriteLine(string.Format(UI.Error_reading_file_0, ex.Message)); 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; return (int)ErrorNumber.UnexpectedException;
} }

View File

@@ -49,6 +49,8 @@ namespace Aaru.Commands.Filesystem;
sealed class FilesystemInfoCommand : Command sealed class FilesystemInfoCommand : Command
{ {
const string MODULE_NAME = "Fs-info command";
public FilesystemInfoCommand() : base("info", UI.Filesystem_Info_Command_Description) public FilesystemInfoCommand() : base("info", UI.Filesystem_Info_Command_Description)
{ {
Add(new Option<string>(new[] Add(new Option<string>(new[]
@@ -108,12 +110,12 @@ sealed class FilesystemInfoCommand : Command
Statistics.AddCommand("fs-info"); Statistics.AddCommand("fs-info");
AaruConsole.DebugWriteLine("Fs-info command", "--debug={0}", debug); AaruConsole.DebugWriteLine(MODULE_NAME, "--debug={0}", debug);
AaruConsole.DebugWriteLine("Fs-info command", "--encoding={0}", encoding); AaruConsole.DebugWriteLine(MODULE_NAME, "--encoding={0}", encoding);
AaruConsole.DebugWriteLine("Fs-info command", "--filesystems={0}", filesystems); AaruConsole.DebugWriteLine(MODULE_NAME, "--filesystems={0}", filesystems);
AaruConsole.DebugWriteLine("Fs-info command", "--input={0}", imagePath); AaruConsole.DebugWriteLine(MODULE_NAME, "--input={0}", imagePath);
AaruConsole.DebugWriteLine("Fs-info command", "--partitions={0}", partitions); AaruConsole.DebugWriteLine(MODULE_NAME, "--partitions={0}", partitions);
AaruConsole.DebugWriteLine("Fs-info command", "--verbose={0}", verbose); AaruConsole.DebugWriteLine(MODULE_NAME, "--verbose={0}", verbose);
var filtersList = new FiltersList(); var filtersList = new FiltersList();
IFilter inputFilter = null; IFilter inputFilter = null;
@@ -217,7 +219,7 @@ sealed class FilesystemInfoCommand : Command
{ {
AaruConsole.ErrorWriteLine(UI.Unable_to_open_image_format); AaruConsole.ErrorWriteLine(UI.Unable_to_open_image_format);
AaruConsole.ErrorWriteLine(Localization.Core.Error_0, ex.Message); 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; return (int)ErrorNumber.CannotOpenFormat;
} }
@@ -240,7 +242,7 @@ sealed class FilesystemInfoCommand : Command
if(partitionsList.Count == 0) if(partitionsList.Count == 0)
{ {
AaruConsole.DebugWriteLine("Fs-info command", UI.No_partitions_found); AaruConsole.DebugWriteLine(MODULE_NAME, UI.No_partitions_found);
if(!filesystems) if(!filesystems)
{ {
@@ -412,7 +414,7 @@ sealed class FilesystemInfoCommand : Command
catch(Exception ex) catch(Exception ex)
{ {
AaruConsole.ErrorWriteLine(string.Format(UI.Error_reading_file_0, ex.Message)); 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; return (int)ErrorNumber.UnexpectedException;
} }

View File

@@ -50,6 +50,8 @@ namespace Aaru.Commands.Filesystem;
sealed class LsCommand : Command sealed class LsCommand : Command
{ {
const string MODULE_NAME = "Ls command";
public LsCommand() : base("list", UI.Filesystem_List_Command_Description) public LsCommand() : base("list", UI.Filesystem_List_Command_Description)
{ {
AddAlias("ls"); AddAlias("ls");
@@ -114,11 +116,11 @@ sealed class LsCommand : Command
AnsiConsole.Markup(format, objects); AnsiConsole.Markup(format, objects);
}; };
AaruConsole.DebugWriteLine("Ls command", "--debug={0}", debug); AaruConsole.DebugWriteLine(MODULE_NAME, "--debug={0}", debug);
AaruConsole.DebugWriteLine("Ls command", "--encoding={0}", encoding); AaruConsole.DebugWriteLine(MODULE_NAME, "--encoding={0}", encoding);
AaruConsole.DebugWriteLine("Ls command", "--input={0}", imagePath); AaruConsole.DebugWriteLine(MODULE_NAME, "--input={0}", imagePath);
AaruConsole.DebugWriteLine("Ls command", "--options={0}", options); AaruConsole.DebugWriteLine(MODULE_NAME, "--options={0}", options);
AaruConsole.DebugWriteLine("Ls command", "--verbose={0}", verbose); AaruConsole.DebugWriteLine(MODULE_NAME, "--verbose={0}", verbose);
Statistics.AddCommand("ls"); Statistics.AddCommand("ls");
var filtersList = new FiltersList(); var filtersList = new FiltersList();
@@ -131,10 +133,10 @@ sealed class LsCommand : Command
}); });
Dictionary<string, string> parsedOptions = Core.Options.Parse(options); Dictionary<string, string> parsedOptions = Core.Options.Parse(options);
AaruConsole.DebugWriteLine("Ls command", UI.Parsed_options); AaruConsole.DebugWriteLine(MODULE_NAME, UI.Parsed_options);
foreach(KeyValuePair<string, string> parsedOption in parsedOptions) foreach(KeyValuePair<string, string> 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()); parsedOptions.Add("debug", debug.ToString());
@@ -213,14 +215,14 @@ sealed class LsCommand : Command
return (int)opened; 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); 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); imageFormat.Info.MediaType);
Statistics.AddMediaFormat(imageFormat.Format); Statistics.AddMediaFormat(imageFormat.Format);
@@ -247,7 +249,7 @@ sealed class LsCommand : Command
if(partitions.Count == 0) if(partitions.Count == 0)
{ {
AaruConsole.DebugWriteLine("Ls command", UI.No_partitions_found); AaruConsole.DebugWriteLine(MODULE_NAME, UI.No_partitions_found);
partitions.Add(new Partition partitions.Add(new Partition
{ {
@@ -343,7 +345,7 @@ sealed class LsCommand : Command
catch(Exception ex) catch(Exception ex)
{ {
AaruConsole.ErrorWriteLine(string.Format(UI.Error_reading_file_0, ex.Message)); 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; return (int)ErrorNumber.UnexpectedException;
} }

View File

@@ -47,6 +47,8 @@ namespace Aaru.Commands.Filesystem;
sealed class ListOptionsCommand : Command sealed class ListOptionsCommand : Command
{ {
const string MODULE_NAME = "List-Options command";
public ListOptionsCommand() : base("options", UI.Filesystem_Options_Command_Description) => public ListOptionsCommand() : base("options", UI.Filesystem_Options_Command_Description) =>
Handler = CommandHandler.Create(GetType().GetMethod(nameof(Invoke))); Handler = CommandHandler.Create(GetType().GetMethod(nameof(Invoke)));
@@ -79,8 +81,8 @@ sealed class ListOptionsCommand : Command
AnsiConsole.Markup(format, objects); AnsiConsole.Markup(format, objects);
}; };
AaruConsole.DebugWriteLine("List-Options command", "--debug={0}", debug); AaruConsole.DebugWriteLine(MODULE_NAME, "--debug={0}", debug);
AaruConsole.DebugWriteLine("List-Options command", "--verbose={0}", verbose); AaruConsole.DebugWriteLine(MODULE_NAME, "--verbose={0}", verbose);
Statistics.AddCommand("list-options"); Statistics.AddCommand("list-options");
PluginBase plugins = PluginBase.Singleton; PluginBase plugins = PluginBase.Singleton;

View File

@@ -47,6 +47,8 @@ namespace Aaru.Commands;
sealed class FormatsCommand : Command sealed class FormatsCommand : Command
{ {
const string MODULE_NAME = "Formats command";
public FormatsCommand() : base("formats", UI.List_Formats_Command_Description) => public FormatsCommand() : base("formats", UI.List_Formats_Command_Description) =>
Handler = CommandHandler.Create(GetType().GetMethod(nameof(Invoke))); Handler = CommandHandler.Create(GetType().GetMethod(nameof(Invoke)));
@@ -81,8 +83,8 @@ sealed class FormatsCommand : Command
Statistics.AddCommand("formats"); Statistics.AddCommand("formats");
AaruConsole.DebugWriteLine("Formats command", "--debug={0}", debug); AaruConsole.DebugWriteLine(MODULE_NAME, "--debug={0}", debug);
AaruConsole.DebugWriteLine("Formats command", "--verbose={0}", verbose); AaruConsole.DebugWriteLine(MODULE_NAME, "--verbose={0}", verbose);
PluginBase plugins = PluginBase.Singleton; PluginBase plugins = PluginBase.Singleton;
var filtersList = new FiltersList(); var filtersList = new FiltersList();

View File

@@ -51,7 +51,8 @@ sealed class ChecksumCommand : Command
const uint SECTORS_TO_READ = 256; const uint SECTORS_TO_READ = 256;
// How many bytes to read at once // 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) public ChecksumCommand() : base("checksum", UI.Image_Checksum_Command_Description)
{ {
@@ -145,23 +146,23 @@ sealed class ChecksumCommand : Command
Statistics.AddCommand("checksum"); Statistics.AddCommand("checksum");
AaruConsole.DebugWriteLine("Checksum command", "--adler32={0}", adler32); AaruConsole.DebugWriteLine(MODULE_NAME, "--adler32={0}", adler32);
AaruConsole.DebugWriteLine("Checksum command", "--crc16={0}", crc16); AaruConsole.DebugWriteLine(MODULE_NAME, "--crc16={0}", crc16);
AaruConsole.DebugWriteLine("Checksum command", "--crc32={0}", crc32); AaruConsole.DebugWriteLine(MODULE_NAME, "--crc32={0}", crc32);
AaruConsole.DebugWriteLine("Checksum command", "--crc64={0}", crc64); AaruConsole.DebugWriteLine(MODULE_NAME, "--crc64={0}", crc64);
AaruConsole.DebugWriteLine("Checksum command", "--debug={0}", debug); AaruConsole.DebugWriteLine(MODULE_NAME, "--debug={0}", debug);
AaruConsole.DebugWriteLine("Checksum command", "--fletcher16={0}", fletcher16); AaruConsole.DebugWriteLine(MODULE_NAME, "--fletcher16={0}", fletcher16);
AaruConsole.DebugWriteLine("Checksum command", "--fletcher32={0}", fletcher32); AaruConsole.DebugWriteLine(MODULE_NAME, "--fletcher32={0}", fletcher32);
AaruConsole.DebugWriteLine("Checksum command", "--input={0}", imagePath); AaruConsole.DebugWriteLine(MODULE_NAME, "--input={0}", imagePath);
AaruConsole.DebugWriteLine("Checksum command", "--md5={0}", md5); AaruConsole.DebugWriteLine(MODULE_NAME, "--md5={0}", md5);
AaruConsole.DebugWriteLine("Checksum command", "--separated-tracks={0}", separatedTracks); AaruConsole.DebugWriteLine(MODULE_NAME, "--separated-tracks={0}", separatedTracks);
AaruConsole.DebugWriteLine("Checksum command", "--sha1={0}", sha1); AaruConsole.DebugWriteLine(MODULE_NAME, "--sha1={0}", sha1);
AaruConsole.DebugWriteLine("Checksum command", "--sha256={0}", sha256); AaruConsole.DebugWriteLine(MODULE_NAME, "--sha256={0}", sha256);
AaruConsole.DebugWriteLine("Checksum command", "--sha384={0}", sha384); AaruConsole.DebugWriteLine(MODULE_NAME, "--sha384={0}", sha384);
AaruConsole.DebugWriteLine("Checksum command", "--sha512={0}", sha512); AaruConsole.DebugWriteLine(MODULE_NAME, "--sha512={0}", sha512);
AaruConsole.DebugWriteLine("Checksum command", "--spamsum={0}", spamSum); AaruConsole.DebugWriteLine(MODULE_NAME, "--spamsum={0}", spamSum);
AaruConsole.DebugWriteLine("Checksum command", "--verbose={0}", verbose); AaruConsole.DebugWriteLine(MODULE_NAME, "--verbose={0}", verbose);
AaruConsole.DebugWriteLine("Checksum command", "--whole-disc={0}", wholeDisc); AaruConsole.DebugWriteLine(MODULE_NAME, "--whole-disc={0}", wholeDisc);
var filtersList = new FiltersList(); var filtersList = new FiltersList();
IFilter inputFilter = null; 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, UI.Track_0_starts_at_sector_1_and_ends_at_sector_2,
currentTrack.Sequence, currentTrack.StartSector, currentTrack.Sequence, currentTrack.StartSector,
currentTrack.EndSector); currentTrack.EndSector);
@@ -469,7 +470,7 @@ sealed class ChecksumCommand : Command
preFileTask.StopTask(); preFileTask.StopTask();
} }
AaruConsole.DebugWriteLine("Checksum command", AaruConsole.DebugWriteLine(MODULE_NAME,
UI.File_0_starts_at_block_1_and_ends_at_block_2, UI.File_0_starts_at_block_1_and_ends_at_block_2,
currentFile.File, currentFile.FirstBlock, currentFile.File, currentFile.FirstBlock,
currentFile.LastBlock); currentFile.LastBlock);

View File

@@ -51,6 +51,8 @@ namespace Aaru.Commands.Image;
sealed class CompareCommand : Command sealed class CompareCommand : Command
{ {
const string MODULE_NAME = "Compare command";
public CompareCommand() : base("compare", UI.Image_Compare_Command_Description) public CompareCommand() : base("compare", UI.Image_Compare_Command_Description)
{ {
AddAlias("cmp"); AddAlias("cmp");
@@ -103,10 +105,10 @@ sealed class CompareCommand : Command
Statistics.AddCommand("compare"); Statistics.AddCommand("compare");
AaruConsole.DebugWriteLine("Compare command", "--debug={0}", debug); AaruConsole.DebugWriteLine(MODULE_NAME, "--debug={0}", debug);
AaruConsole.DebugWriteLine("Compare command", "--input1={0}", imagePath1); AaruConsole.DebugWriteLine(MODULE_NAME, "--input1={0}", imagePath1);
AaruConsole.DebugWriteLine("Compare command", "--input2={0}", imagePath2); AaruConsole.DebugWriteLine(MODULE_NAME, "--input2={0}", imagePath2);
AaruConsole.DebugWriteLine("Compare command", "--verbose={0}", verbose); AaruConsole.DebugWriteLine(MODULE_NAME, "--verbose={0}", verbose);
var filtersList = new FiltersList(); var filtersList = new FiltersList();
IFilter inputFilter1 = null; IFilter inputFilter1 = null;

View File

@@ -65,6 +65,8 @@ namespace Aaru.Commands.Image;
sealed class ConvertImageCommand : Command sealed class ConvertImageCommand : Command
{ {
const string MODULE_NAME = "Convert-image command";
public ConvertImageCommand() : base("convert", UI.Image_Convert_Command_Description) public ConvertImageCommand() : base("convert", UI.Image_Convert_Command_Description)
{ {
Add(new Option<string>(new[] Add(new Option<string>(new[]
@@ -217,43 +219,43 @@ sealed class ConvertImageCommand : Command
Statistics.AddCommand("convert-image"); Statistics.AddCommand("convert-image");
AaruConsole.DebugWriteLine("Image convert command", "--cicm-xml={0}", cicmXml); AaruConsole.DebugWriteLine(MODULE_NAME, "--cicm-xml={0}", cicmXml);
AaruConsole.DebugWriteLine("Image convert command", "--comments={0}", comments); AaruConsole.DebugWriteLine(MODULE_NAME, "--comments={0}", comments);
AaruConsole.DebugWriteLine("Image convert command", "--count={0}", count); AaruConsole.DebugWriteLine(MODULE_NAME, "--count={0}", count);
AaruConsole.DebugWriteLine("Image convert command", "--creator={0}", creator); AaruConsole.DebugWriteLine(MODULE_NAME, "--creator={0}", creator);
AaruConsole.DebugWriteLine("Image convert command", "--debug={0}", debug); AaruConsole.DebugWriteLine(MODULE_NAME, "--debug={0}", debug);
AaruConsole.DebugWriteLine("Image convert command", "--drive-manufacturer={0}", driveManufacturer); AaruConsole.DebugWriteLine(MODULE_NAME, "--drive-manufacturer={0}", driveManufacturer);
AaruConsole.DebugWriteLine("Image convert command", "--drive-model={0}", driveModel); AaruConsole.DebugWriteLine(MODULE_NAME, "--drive-model={0}", driveModel);
AaruConsole.DebugWriteLine("Image convert command", "--drive-revision={0}", driveFirmwareRevision); AaruConsole.DebugWriteLine(MODULE_NAME, "--drive-revision={0}", driveFirmwareRevision);
AaruConsole.DebugWriteLine("Image convert command", "--drive-serial={0}", driveSerialNumber); AaruConsole.DebugWriteLine(MODULE_NAME, "--drive-serial={0}", driveSerialNumber);
AaruConsole.DebugWriteLine("Image convert command", "--force={0}", force); AaruConsole.DebugWriteLine(MODULE_NAME, "--force={0}", force);
AaruConsole.DebugWriteLine("Image convert command", "--format={0}", format); AaruConsole.DebugWriteLine(MODULE_NAME, "--format={0}", format);
AaruConsole.DebugWriteLine("Image convert command", "--geometry={0}", geometry); AaruConsole.DebugWriteLine(MODULE_NAME, "--geometry={0}", geometry);
AaruConsole.DebugWriteLine("Image convert command", "--input={0}", inputPath); AaruConsole.DebugWriteLine(MODULE_NAME, "--input={0}", inputPath);
AaruConsole.DebugWriteLine("Image convert command", "--media-barcode={0}", mediaBarcode); AaruConsole.DebugWriteLine(MODULE_NAME, "--media-barcode={0}", mediaBarcode);
AaruConsole.DebugWriteLine("Image convert command", "--media-lastsequence={0}", lastMediaSequence); AaruConsole.DebugWriteLine(MODULE_NAME, "--media-lastsequence={0}", lastMediaSequence);
AaruConsole.DebugWriteLine("Image convert command", "--media-manufacturer={0}", mediaManufacturer); AaruConsole.DebugWriteLine(MODULE_NAME, "--media-manufacturer={0}", mediaManufacturer);
AaruConsole.DebugWriteLine("Image convert command", "--media-model={0}", mediaModel); AaruConsole.DebugWriteLine(MODULE_NAME, "--media-model={0}", mediaModel);
AaruConsole.DebugWriteLine("Image convert command", "--media-partnumber={0}", mediaPartNumber); AaruConsole.DebugWriteLine(MODULE_NAME, "--media-partnumber={0}", mediaPartNumber);
AaruConsole.DebugWriteLine("Image convert command", "--media-sequence={0}", mediaSequence); AaruConsole.DebugWriteLine(MODULE_NAME, "--media-sequence={0}", mediaSequence);
AaruConsole.DebugWriteLine("Image convert command", "--media-serial={0}", mediaSerialNumber); AaruConsole.DebugWriteLine(MODULE_NAME, "--media-serial={0}", mediaSerialNumber);
AaruConsole.DebugWriteLine("Image convert command", "--media-title={0}", mediaTitle); AaruConsole.DebugWriteLine(MODULE_NAME, "--media-title={0}", mediaTitle);
AaruConsole.DebugWriteLine("Image convert command", "--options={0}", options); AaruConsole.DebugWriteLine(MODULE_NAME, "--options={0}", options);
AaruConsole.DebugWriteLine("Image convert command", "--output={0}", outputPath); AaruConsole.DebugWriteLine(MODULE_NAME, "--output={0}", outputPath);
AaruConsole.DebugWriteLine("Image convert command", "--resume-file={0}", resumeFile); AaruConsole.DebugWriteLine(MODULE_NAME, "--resume-file={0}", resumeFile);
AaruConsole.DebugWriteLine("Image convert command", "--verbose={0}", verbose); AaruConsole.DebugWriteLine(MODULE_NAME, "--verbose={0}", verbose);
AaruConsole.DebugWriteLine("Image convert command", "--fix-subchannel-position={0}", fixSubchannelPosition); AaruConsole.DebugWriteLine(MODULE_NAME, "--fix-subchannel-position={0}", fixSubchannelPosition);
AaruConsole.DebugWriteLine("Image convert command", "--fix-subchannel={0}", fixSubchannel); AaruConsole.DebugWriteLine(MODULE_NAME, "--fix-subchannel={0}", fixSubchannel);
AaruConsole.DebugWriteLine("Image convert command", "--fix-subchannel-crc={0}", fixSubchannelCrc); AaruConsole.DebugWriteLine(MODULE_NAME, "--fix-subchannel-crc={0}", fixSubchannelCrc);
AaruConsole.DebugWriteLine("Image convert command", "--generate-subchannels={0}", generateSubchannels); AaruConsole.DebugWriteLine(MODULE_NAME, "--generate-subchannels={0}", generateSubchannels);
AaruConsole.DebugWriteLine("Image convert command", "--decrypt={0}", decrypt); AaruConsole.DebugWriteLine(MODULE_NAME, "--decrypt={0}", decrypt);
AaruConsole.DebugWriteLine("Image convert command", "--aaru-metadata={0}", aaruMetadata); AaruConsole.DebugWriteLine(MODULE_NAME, "--aaru-metadata={0}", aaruMetadata);
Dictionary<string, string> parsedOptions = Core.Options.Parse(options); Dictionary<string, string> parsedOptions = Core.Options.Parse(options);
AaruConsole.DebugWriteLine("Image convert command", UI.Parsed_options); AaruConsole.DebugWriteLine(MODULE_NAME, UI.Parsed_options);
foreach(KeyValuePair<string, string> parsedOption in parsedOptions) foreach(KeyValuePair<string, string> 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) if(count == 0)
{ {
@@ -325,7 +327,7 @@ sealed class ConvertImageCommand : Command
catch(Exception ex) catch(Exception ex)
{ {
AaruConsole.ErrorWriteLine(UI.Incorrect_metadata_sidecar_file_not_continuing); AaruConsole.ErrorWriteLine(UI.Incorrect_metadata_sidecar_file_not_continuing);
AaruConsole.DebugWriteLine("Image conversion", $"{ex}"); AaruConsole.DebugWriteLine(MODULE_NAME, $"{ex}");
return (int)ErrorNumber.InvalidSidecar; return (int)ErrorNumber.InvalidSidecar;
} }
@@ -357,7 +359,7 @@ sealed class ConvertImageCommand : Command
catch(Exception ex) catch(Exception ex)
{ {
AaruConsole.ErrorWriteLine(UI.Incorrect_metadata_sidecar_file_not_continuing); AaruConsole.ErrorWriteLine(UI.Incorrect_metadata_sidecar_file_not_continuing);
AaruConsole.DebugWriteLine("Image conversion", $"{ex}"); AaruConsole.DebugWriteLine(MODULE_NAME, $"{ex}");
return (int)ErrorNumber.InvalidSidecar; return (int)ErrorNumber.InvalidSidecar;
} }
@@ -404,7 +406,7 @@ sealed class ConvertImageCommand : Command
catch(Exception ex) catch(Exception ex)
{ {
AaruConsole.ErrorWriteLine(UI.Incorrect_resume_file_not_continuing); AaruConsole.ErrorWriteLine(UI.Incorrect_resume_file_not_continuing);
AaruConsole.DebugWriteLine("Image conversion", $"{ex}"); AaruConsole.DebugWriteLine(MODULE_NAME, $"{ex}");
return (int)ErrorNumber.InvalidResume; return (int)ErrorNumber.InvalidResume;
} }
@@ -502,14 +504,14 @@ sealed class ConvertImageCommand : Command
}; };
#pragma warning restore 612 #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); 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.AddMediaFormat(inputFormat.Format);
Statistics.AddMedia(mediaType, false); Statistics.AddMedia(mediaType, false);
@@ -519,7 +521,7 @@ sealed class ConvertImageCommand : Command
{ {
AaruConsole.ErrorWriteLine(UI.Unable_to_open_image_format); AaruConsole.ErrorWriteLine(UI.Unable_to_open_image_format);
AaruConsole.ErrorWriteLine(Localization.Core.Error_0, ex.Message); 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; return (int)ErrorNumber.CannotOpenFormat;
} }
@@ -895,7 +897,7 @@ sealed class ConvertImageCommand : Command
if(generatedTitleKeys == null) if(generatedTitleKeys == null)
{ {
List<Partition> partitions = List<Partition> partitions =
Aaru.Core.Partitions.GetAll(inputOptical); Core.Partitions.GetAll(inputOptical);
partitions = partitions.FindAll(p => partitions = partitions.FindAll(p =>
{ {
@@ -909,7 +911,7 @@ sealed class ConvertImageCommand : Command
TryGetValue("iso9660 filesystem", TryGetValue("iso9660 filesystem",
out Type pluginType)) out Type pluginType))
{ {
AaruConsole.DebugWriteLine("Convert-image command", AaruConsole.DebugWriteLine(MODULE_NAME,
UI.Generating_decryption_keys); UI.Generating_decryption_keys);
generatedTitleKeys = CSS.GenerateTitleKeys(inputOptical, generatedTitleKeys = CSS.GenerateTitleKeys(inputOptical,
@@ -938,7 +940,7 @@ sealed class ConvertImageCommand : Command
if(generatedTitleKeys == null) if(generatedTitleKeys == null)
{ {
List<Partition> partitions = List<Partition> partitions =
Aaru.Core.Partitions.GetAll(inputOptical); Core.Partitions.GetAll(inputOptical);
partitions = partitions.FindAll(p => partitions = partitions.FindAll(p =>
{ {
@@ -952,7 +954,7 @@ sealed class ConvertImageCommand : Command
TryGetValue("iso9660 filesystem", TryGetValue("iso9660 filesystem",
out Type pluginType)) out Type pluginType))
{ {
AaruConsole.DebugWriteLine("Convert-image command", AaruConsole.DebugWriteLine(MODULE_NAME,
UI.Generating_decryption_keys); UI.Generating_decryption_keys);
generatedTitleKeys = CSS.GenerateTitleKeys(inputOptical, generatedTitleKeys = CSS.GenerateTitleKeys(inputOptical,

View File

@@ -54,6 +54,7 @@ namespace Aaru.Commands.Image;
sealed class CreateSidecarCommand : Command sealed class CreateSidecarCommand : Command
{ {
const string MODULE_NAME = "Create sidecar command";
static ProgressTask _progressTask1; static ProgressTask _progressTask1;
static ProgressTask _progressTask2; static ProgressTask _progressTask2;
@@ -116,12 +117,12 @@ sealed class CreateSidecarCommand : Command
Statistics.AddCommand("create-sidecar"); Statistics.AddCommand("create-sidecar");
AaruConsole.DebugWriteLine("Create sidecar command", "--block-size={0}", blockSize); AaruConsole.DebugWriteLine(MODULE_NAME, "--block-size={0}", blockSize);
AaruConsole.DebugWriteLine("Create sidecar command", "--debug={0}", debug); AaruConsole.DebugWriteLine(MODULE_NAME, "--debug={0}", debug);
AaruConsole.DebugWriteLine("Create sidecar command", "--encoding={0}", encodingName); AaruConsole.DebugWriteLine(MODULE_NAME, "--encoding={0}", encodingName);
AaruConsole.DebugWriteLine("Create sidecar command", "--input={0}", imagePath); AaruConsole.DebugWriteLine(MODULE_NAME, "--input={0}", imagePath);
AaruConsole.DebugWriteLine("Create sidecar command", "--tape={0}", tape); AaruConsole.DebugWriteLine(MODULE_NAME, "--tape={0}", tape);
AaruConsole.DebugWriteLine("Create sidecar command", "--verbose={0}", verbose); AaruConsole.DebugWriteLine(MODULE_NAME, "--verbose={0}", verbose);
Encoding encodingClass = null; Encoding encodingClass = null;
@@ -205,7 +206,7 @@ sealed class CreateSidecarCommand : Command
return (int)opened; 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) catch(Exception ex)
{ {
@@ -297,7 +298,7 @@ sealed class CreateSidecarCommand : Command
catch(Exception ex) catch(Exception ex)
{ {
AaruConsole.ErrorWriteLine(string.Format(UI.Error_reading_file_0, ex.Message)); 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; return (int)ErrorNumber.UnexpectedException;
} }

View File

@@ -48,6 +48,8 @@ namespace Aaru.Commands.Image;
sealed class DecodeCommand : Command sealed class DecodeCommand : Command
{ {
const string MODULE_NAME = "Decode command";
public DecodeCommand() : base("decode", UI.Image_Decode_Command_Description) public DecodeCommand() : base("decode", UI.Image_Decode_Command_Description)
{ {
Add(new Option<bool>(new[] Add(new Option<bool>(new[]
@@ -112,13 +114,13 @@ sealed class DecodeCommand : Command
Statistics.AddCommand("decode"); Statistics.AddCommand("decode");
AaruConsole.DebugWriteLine("Decode command", "--debug={0}", debug); AaruConsole.DebugWriteLine(MODULE_NAME, "--debug={0}", debug);
AaruConsole.DebugWriteLine("Decode command", "--disk-tags={0}", diskTags); AaruConsole.DebugWriteLine(MODULE_NAME, "--disk-tags={0}", diskTags);
AaruConsole.DebugWriteLine("Decode command", "--input={0}", imagePath); AaruConsole.DebugWriteLine(MODULE_NAME, "--input={0}", imagePath);
AaruConsole.DebugWriteLine("Decode command", "--length={0}", length); AaruConsole.DebugWriteLine(MODULE_NAME, "--length={0}", length);
AaruConsole.DebugWriteLine("Decode command", "--sector-tags={0}", sectorTags); AaruConsole.DebugWriteLine(MODULE_NAME, "--sector-tags={0}", sectorTags);
AaruConsole.DebugWriteLine("Decode command", "--start={0}", startSector); AaruConsole.DebugWriteLine(MODULE_NAME, "--start={0}", startSector);
AaruConsole.DebugWriteLine("Decode command", "--verbose={0}", verbose); AaruConsole.DebugWriteLine(MODULE_NAME, "--verbose={0}", verbose);
var filtersList = new FiltersList(); var filtersList = new FiltersList();
IFilter inputFilter = null; IFilter inputFilter = null;

View File

@@ -44,6 +44,7 @@ namespace Aaru.Commands.Image;
sealed class EntropyCommand : Command sealed class EntropyCommand : Command
{ {
const string MODULE_NAME = "Entropy command";
static ProgressTask _progressTask1; static ProgressTask _progressTask1;
static ProgressTask _progressTask2; static ProgressTask _progressTask2;
@@ -106,12 +107,12 @@ sealed class EntropyCommand : Command
Statistics.AddCommand("entropy"); Statistics.AddCommand("entropy");
AaruConsole.DebugWriteLine("Entropy command", "--debug={0}", debug); AaruConsole.DebugWriteLine(MODULE_NAME, "--debug={0}", debug);
AaruConsole.DebugWriteLine("Entropy command", "--duplicated-sectors={0}", duplicatedSectors); AaruConsole.DebugWriteLine(MODULE_NAME, "--duplicated-sectors={0}", duplicatedSectors);
AaruConsole.DebugWriteLine("Entropy command", "--input={0}", imagePath); AaruConsole.DebugWriteLine(MODULE_NAME, "--input={0}", imagePath);
AaruConsole.DebugWriteLine("Entropy command", "--separated-tracks={0}", separatedTracks); AaruConsole.DebugWriteLine(MODULE_NAME, "--separated-tracks={0}", separatedTracks);
AaruConsole.DebugWriteLine("Entropy command", "--verbose={0}", verbose); AaruConsole.DebugWriteLine(MODULE_NAME, "--verbose={0}", verbose);
AaruConsole.DebugWriteLine("Entropy command", "--whole-disc={0}", wholeDisc); AaruConsole.DebugWriteLine(MODULE_NAME, "--whole-disc={0}", wholeDisc);
var filtersList = new FiltersList(); var filtersList = new FiltersList();
IFilter inputFilter = null; IFilter inputFilter = null;

View File

@@ -45,6 +45,8 @@ namespace Aaru.Commands.Image;
sealed class ImageInfoCommand : Command sealed class ImageInfoCommand : Command
{ {
const string MODULE_NAME = "Image-info command";
public ImageInfoCommand() : base("info", UI.Image_Info_Command_Description) public ImageInfoCommand() : base("info", UI.Image_Info_Command_Description)
{ {
AddArgument(new Argument<string> AddArgument(new Argument<string>
@@ -88,9 +90,9 @@ sealed class ImageInfoCommand : Command
Statistics.AddCommand("image-info"); Statistics.AddCommand("image-info");
AaruConsole.DebugWriteLine("Image-info command", "--debug={0}", debug); AaruConsole.DebugWriteLine(MODULE_NAME, "--debug={0}", debug);
AaruConsole.DebugWriteLine("Image-info command", "--input={0}", imagePath); AaruConsole.DebugWriteLine(MODULE_NAME, "--input={0}", imagePath);
AaruConsole.DebugWriteLine("Image-info command", "--verbose={0}", verbose); AaruConsole.DebugWriteLine(MODULE_NAME, "--verbose={0}", verbose);
var filtersList = new FiltersList(); var filtersList = new FiltersList();
IFilter inputFilter = null; IFilter inputFilter = null;
@@ -156,7 +158,7 @@ sealed class ImageInfoCommand : Command
{ {
AaruConsole.ErrorWriteLine(UI.Unable_to_open_image_format); AaruConsole.ErrorWriteLine(UI.Unable_to_open_image_format);
AaruConsole.ErrorWriteLine(Localization.Core.Error_0, ex.Message); 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; return (int)ErrorNumber.CannotOpenFormat;
} }
@@ -164,7 +166,7 @@ sealed class ImageInfoCommand : Command
catch(Exception ex) catch(Exception ex)
{ {
AaruConsole.ErrorWriteLine(string.Format(UI.Error_reading_file_0, ex.Message)); 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; return (int)ErrorNumber.UnexpectedException;
} }

View File

@@ -47,6 +47,8 @@ namespace Aaru.Commands.Image;
sealed class ListOptionsCommand : Command sealed class ListOptionsCommand : Command
{ {
const string MODULE_NAME = "List-Options command";
public ListOptionsCommand() : base("options", UI.Image_Options_Command_Description) => public ListOptionsCommand() : base("options", UI.Image_Options_Command_Description) =>
Handler = CommandHandler.Create(GetType().GetMethod(nameof(Invoke))); Handler = CommandHandler.Create(GetType().GetMethod(nameof(Invoke)));
@@ -79,8 +81,8 @@ sealed class ListOptionsCommand : Command
AnsiConsole.Markup(format, objects); AnsiConsole.Markup(format, objects);
}; };
AaruConsole.DebugWriteLine("List-Options command", "--debug={0}", debug); AaruConsole.DebugWriteLine(MODULE_NAME, "--debug={0}", debug);
AaruConsole.DebugWriteLine("List-Options command", "--verbose={0}", verbose); AaruConsole.DebugWriteLine(MODULE_NAME, "--verbose={0}", verbose);
Statistics.AddCommand("list-options"); Statistics.AddCommand("list-options");
PluginBase plugins = PluginBase.Singleton; PluginBase plugins = PluginBase.Singleton;

View File

@@ -46,6 +46,8 @@ namespace Aaru.Commands.Image;
sealed class PrintHexCommand : Command sealed class PrintHexCommand : Command
{ {
const string MODULE_NAME = "PrintHex command";
public PrintHexCommand() : base("print", UI.Image_Print_Command_Description) public PrintHexCommand() : base("print", UI.Image_Print_Command_Description)
{ {
Add(new Option<ulong>(new[] Add(new Option<ulong>(new[]
@@ -110,13 +112,13 @@ sealed class PrintHexCommand : Command
Statistics.AddCommand("print-hex"); Statistics.AddCommand("print-hex");
AaruConsole.DebugWriteLine("PrintHex command", "--debug={0}", debug); AaruConsole.DebugWriteLine(MODULE_NAME, "--debug={0}", debug);
AaruConsole.DebugWriteLine("PrintHex command", "--input={0}", imagePath); AaruConsole.DebugWriteLine(MODULE_NAME, "--input={0}", imagePath);
AaruConsole.DebugWriteLine("PrintHex command", "--length={0}", length); AaruConsole.DebugWriteLine(MODULE_NAME, "--length={0}", length);
AaruConsole.DebugWriteLine("PrintHex command", "--long-sectors={0}", longSectors); AaruConsole.DebugWriteLine(MODULE_NAME, "--long-sectors={0}", longSectors);
AaruConsole.DebugWriteLine("PrintHex command", "--start={0}", start); AaruConsole.DebugWriteLine(MODULE_NAME, "--start={0}", start);
AaruConsole.DebugWriteLine("PrintHex command", "--verbose={0}", verbose); AaruConsole.DebugWriteLine(MODULE_NAME, "--verbose={0}", verbose);
AaruConsole.DebugWriteLine("PrintHex command", "--width={0}", width); AaruConsole.DebugWriteLine(MODULE_NAME, "--width={0}", width);
var filtersList = new FiltersList(); var filtersList = new FiltersList();
IFilter inputFilter = null; IFilter inputFilter = null;

View File

@@ -51,6 +51,8 @@ namespace Aaru.Commands.Image;
sealed class VerifyCommand : Command sealed class VerifyCommand : Command
{ {
const string MODULE_NAME = "Verify command";
public VerifyCommand() : base("verify", UI.Image_Verify_Command_Description) public VerifyCommand() : base("verify", UI.Image_Verify_Command_Description)
{ {
Add(new Option<bool>(new[] Add(new Option<bool>(new[]
@@ -115,13 +117,13 @@ sealed class VerifyCommand : Command
Statistics.AddCommand("verify"); Statistics.AddCommand("verify");
AaruConsole.DebugWriteLine("Verify command", "--debug={0}", debug); AaruConsole.DebugWriteLine(MODULE_NAME, "--debug={0}", debug);
AaruConsole.DebugWriteLine("Verify command", "--input={0}", imagePath); AaruConsole.DebugWriteLine(MODULE_NAME, "--input={0}", imagePath);
AaruConsole.DebugWriteLine("Verify command", "--verbose={0}", verbose); AaruConsole.DebugWriteLine(MODULE_NAME, "--verbose={0}", verbose);
AaruConsole.DebugWriteLine("Verify command", "--verify-disc={0}", verifyDisc); AaruConsole.DebugWriteLine(MODULE_NAME, "--verify-disc={0}", verifyDisc);
AaruConsole.DebugWriteLine("Verify command", "--verify-sectors={0}", verifySectors); AaruConsole.DebugWriteLine(MODULE_NAME, "--verify-sectors={0}", verifySectors);
AaruConsole.DebugWriteLine("Verify command", "--create-graph={0}", createGraph); AaruConsole.DebugWriteLine(MODULE_NAME, "--create-graph={0}", createGraph);
AaruConsole.DebugWriteLine("Verify command", "--dimensions={0}", dimensions); AaruConsole.DebugWriteLine(MODULE_NAME, "--dimensions={0}", dimensions);
var filtersList = new FiltersList(); var filtersList = new FiltersList();
IFilter inputFilter = null; IFilter inputFilter = null;

View File

@@ -45,6 +45,8 @@ namespace Aaru.Commands;
sealed class ListEncodingsCommand : Command sealed class ListEncodingsCommand : Command
{ {
const string MODULE_NAME = "List-Encodings command";
public ListEncodingsCommand() : base("list-encodings", UI.List_Encodings_Command_Description) => public ListEncodingsCommand() : base("list-encodings", UI.List_Encodings_Command_Description) =>
Handler = CommandHandler.Create(GetType().GetMethod(nameof(Invoke))); Handler = CommandHandler.Create(GetType().GetMethod(nameof(Invoke)));
@@ -79,8 +81,8 @@ sealed class ListEncodingsCommand : Command
Statistics.AddCommand("list-encodings"); Statistics.AddCommand("list-encodings");
AaruConsole.DebugWriteLine("List-Encodings command", "--debug={0}", debug); AaruConsole.DebugWriteLine(MODULE_NAME, "--debug={0}", debug);
AaruConsole.DebugWriteLine("List-Encodings command", "--verbose={0}", verbose); AaruConsole.DebugWriteLine(MODULE_NAME, "--verbose={0}", verbose);
List<CommonEncodingInfo> encodings = Encoding.GetEncodings().Select(info => new CommonEncodingInfo List<CommonEncodingInfo> encodings = Encoding.GetEncodings().Select(info => new CommonEncodingInfo
{ {

View File

@@ -46,6 +46,8 @@ namespace Aaru.Commands;
sealed class ListNamespacesCommand : Command sealed class ListNamespacesCommand : Command
{ {
const string MODULE_NAME = "List-Namespaces command";
public ListNamespacesCommand() : base("list-namespaces", UI.List_Namespaces_Command_Description) => public ListNamespacesCommand() : base("list-namespaces", UI.List_Namespaces_Command_Description) =>
Handler = CommandHandler.Create(GetType().GetMethod(nameof(Invoke))); Handler = CommandHandler.Create(GetType().GetMethod(nameof(Invoke)));
@@ -78,8 +80,8 @@ sealed class ListNamespacesCommand : Command
AnsiConsole.Markup(format, objects); AnsiConsole.Markup(format, objects);
}; };
AaruConsole.DebugWriteLine("List-Namespaces command", "--debug={0}", debug); AaruConsole.DebugWriteLine(MODULE_NAME, "--debug={0}", debug);
AaruConsole.DebugWriteLine("List-Namespaces command", "--verbose={0}", verbose); AaruConsole.DebugWriteLine(MODULE_NAME, "--verbose={0}", verbose);
Statistics.AddCommand("list-namespaces"); Statistics.AddCommand("list-namespaces");
PluginBase plugins = PluginBase.Singleton; PluginBase plugins = PluginBase.Singleton;

View File

@@ -64,6 +64,7 @@ namespace Aaru.Commands.Media;
// TODO: Add raw dumping // TODO: Add raw dumping
sealed class DumpMediaCommand : Command sealed class DumpMediaCommand : Command
{ {
const string MODULE_NAME = "Dump-Media command";
static ProgressTask _progressTask1; static ProgressTask _progressTask1;
static ProgressTask _progressTask2; static ProgressTask _progressTask2;
static readonly TimeSpan OneSecond = 1.Seconds(); static readonly TimeSpan OneSecond = 1.Seconds();
@@ -270,50 +271,50 @@ sealed class DumpMediaCommand : Command
Statistics.AddCommand("dump-media"); Statistics.AddCommand("dump-media");
AaruConsole.DebugWriteLine("Dump-Media command", "--cicm-xml={0}", cicmXml); AaruConsole.DebugWriteLine(MODULE_NAME, "--cicm-xml={0}", cicmXml);
AaruConsole.DebugWriteLine("Dump-Media command", "--debug={0}", debug); AaruConsole.DebugWriteLine(MODULE_NAME, "--debug={0}", debug);
AaruConsole.DebugWriteLine("Dump-Media command", "--device={0}", devicePath); AaruConsole.DebugWriteLine(MODULE_NAME, "--device={0}", devicePath);
AaruConsole.DebugWriteLine("Dump-Media command", "--encoding={0}", encoding); AaruConsole.DebugWriteLine(MODULE_NAME, "--encoding={0}", encoding);
AaruConsole.DebugWriteLine("Dump-Media command", "--first-pregap={0}", firstPregap); AaruConsole.DebugWriteLine(MODULE_NAME, "--first-pregap={0}", firstPregap);
AaruConsole.DebugWriteLine("Dump-Media command", "--fix-offset={0}", fixOffset); AaruConsole.DebugWriteLine(MODULE_NAME, "--fix-offset={0}", fixOffset);
AaruConsole.DebugWriteLine("Dump-Media command", "--force={0}", force); AaruConsole.DebugWriteLine(MODULE_NAME, "--force={0}", force);
AaruConsole.DebugWriteLine("Dump-Media command", "--format={0}", format); AaruConsole.DebugWriteLine(MODULE_NAME, "--format={0}", format);
AaruConsole.DebugWriteLine("Dump-Media command", "--metadata={0}", metadata); AaruConsole.DebugWriteLine(MODULE_NAME, "--metadata={0}", metadata);
AaruConsole.DebugWriteLine("Dump-Media command", "--options={0}", options); AaruConsole.DebugWriteLine(MODULE_NAME, "--options={0}", options);
AaruConsole.DebugWriteLine("Dump-Media command", "--output={0}", outputPath); AaruConsole.DebugWriteLine(MODULE_NAME, "--output={0}", outputPath);
AaruConsole.DebugWriteLine("Dump-Media command", "--persistent={0}", persistent); AaruConsole.DebugWriteLine(MODULE_NAME, "--persistent={0}", persistent);
AaruConsole.DebugWriteLine("Dump-Media command", "--resume={0}", resume); AaruConsole.DebugWriteLine(MODULE_NAME, "--resume={0}", resume);
AaruConsole.DebugWriteLine("Dump-Media command", "--retry-passes={0}", retryPasses); AaruConsole.DebugWriteLine(MODULE_NAME, "--retry-passes={0}", retryPasses);
AaruConsole.DebugWriteLine("Dump-Media command", "--skip={0}", skip); AaruConsole.DebugWriteLine(MODULE_NAME, "--skip={0}", skip);
AaruConsole.DebugWriteLine("Dump-Media command", "--stop-on-error={0}", stopOnError); AaruConsole.DebugWriteLine(MODULE_NAME, "--stop-on-error={0}", stopOnError);
AaruConsole.DebugWriteLine("Dump-Media command", "--trim={0}", trim); AaruConsole.DebugWriteLine(MODULE_NAME, "--trim={0}", trim);
AaruConsole.DebugWriteLine("Dump-Media command", "--verbose={0}", verbose); AaruConsole.DebugWriteLine(MODULE_NAME, "--verbose={0}", verbose);
AaruConsole.DebugWriteLine("Dump-Media command", "--subchannel={0}", subchannel); AaruConsole.DebugWriteLine(MODULE_NAME, "--subchannel={0}", subchannel);
AaruConsole.DebugWriteLine("Dump-Media command", "--private={0}", @private); AaruConsole.DebugWriteLine(MODULE_NAME, "--private={0}", @private);
AaruConsole.DebugWriteLine("Dump-Media command", "--fix-subchannel-position={0}", fixSubchannelPosition); AaruConsole.DebugWriteLine(MODULE_NAME, "--fix-subchannel-position={0}", fixSubchannelPosition);
AaruConsole.DebugWriteLine("Dump-Media command", "--retry-subchannel={0}", retrySubchannel); AaruConsole.DebugWriteLine(MODULE_NAME, "--retry-subchannel={0}", retrySubchannel);
AaruConsole.DebugWriteLine("Dump-Media command", "--fix-subchannel={0}", fixSubchannel); AaruConsole.DebugWriteLine(MODULE_NAME, "--fix-subchannel={0}", fixSubchannel);
AaruConsole.DebugWriteLine("Dump-Media command", "--fix-subchannel-crc={0}", fixSubchannelCrc); AaruConsole.DebugWriteLine(MODULE_NAME, "--fix-subchannel-crc={0}", fixSubchannelCrc);
AaruConsole.DebugWriteLine("Dump-Media command", "--generate-subchannels={0}", generateSubchannels); AaruConsole.DebugWriteLine(MODULE_NAME, "--generate-subchannels={0}", generateSubchannels);
AaruConsole.DebugWriteLine("Dump-Media command", "--skip-cdiready-hole={0}", skipCdiReadyHole); AaruConsole.DebugWriteLine(MODULE_NAME, "--skip-cdiready-hole={0}", skipCdiReadyHole);
AaruConsole.DebugWriteLine("Dump-Media command", "--eject={0}", eject); AaruConsole.DebugWriteLine(MODULE_NAME, "--eject={0}", eject);
AaruConsole.DebugWriteLine("Dump-Media command", "--max-blocks={0}", maxBlocks); AaruConsole.DebugWriteLine(MODULE_NAME, "--max-blocks={0}", maxBlocks);
AaruConsole.DebugWriteLine("Dump-Media command", "--use-buffered-reads={0}", useBufferedReads); AaruConsole.DebugWriteLine(MODULE_NAME, "--use-buffered-reads={0}", useBufferedReads);
AaruConsole.DebugWriteLine("Dump-Media command", "--store-encrypted={0}", storeEncrypted); AaruConsole.DebugWriteLine(MODULE_NAME, "--store-encrypted={0}", storeEncrypted);
AaruConsole.DebugWriteLine("Dump-Media command", "--title-keys={0}", titleKeys); AaruConsole.DebugWriteLine(MODULE_NAME, "--title-keys={0}", titleKeys);
AaruConsole.DebugWriteLine("Dump-Media command", "--ignore-cdr-runouts={0}", ignoreCdrRunOuts); AaruConsole.DebugWriteLine(MODULE_NAME, "--ignore-cdr-runouts={0}", ignoreCdrRunOuts);
AaruConsole.DebugWriteLine("Dump-Media command", "--create-graph={0}", createGraph); AaruConsole.DebugWriteLine(MODULE_NAME, "--create-graph={0}", createGraph);
AaruConsole.DebugWriteLine("Dump-Media command", "--dimensions={0}", dimensions); AaruConsole.DebugWriteLine(MODULE_NAME, "--dimensions={0}", dimensions);
AaruConsole.DebugWriteLine("Dump-Media command", "--aaru-metadata={0}", aaruMetadata); AaruConsole.DebugWriteLine(MODULE_NAME, "--aaru-metadata={0}", aaruMetadata);
// TODO: Disabled temporarily // TODO: Disabled temporarily
//AaruConsole.DebugWriteLine("Dump-Media command", "--raw={0}", raw); //AaruConsole.DebugWriteLine(MODULE_NAME, "--raw={0}", raw);
Dictionary<string, string> parsedOptions = Core.Options.Parse(options); Dictionary<string, string> parsedOptions = Core.Options.Parse(options);
AaruConsole.DebugWriteLine("Dump-Media command", UI.Parsed_options); AaruConsole.DebugWriteLine(MODULE_NAME, UI.Parsed_options);
foreach(KeyValuePair<string, string> parsedOption in parsedOptions) foreach(KeyValuePair<string, string> 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; Encoding encodingClass = null;

View File

@@ -51,6 +51,7 @@ using Aaru.Decoders.SCSI.MMC;
using Aaru.Decoders.SCSI.SSC; using Aaru.Decoders.SCSI.SSC;
using Aaru.Decoders.Xbox; using Aaru.Decoders.Xbox;
using Aaru.Localization; using Aaru.Localization;
using Humanizer.Bytes;
using Spectre.Console; using Spectre.Console;
using BCA = Aaru.Decoders.Bluray.BCA; using BCA = Aaru.Decoders.Bluray.BCA;
using Cartridge = Aaru.Decoders.DVD.Cartridge; using Cartridge = Aaru.Decoders.DVD.Cartridge;
@@ -59,12 +60,13 @@ using DDS = Aaru.Decoders.DVD.DDS;
using DMI = Aaru.Decoders.Xbox.DMI; using DMI = Aaru.Decoders.Xbox.DMI;
using Session = Aaru.Decoders.CD.Session; using Session = Aaru.Decoders.CD.Session;
using Spare = Aaru.Decoders.DVD.Spare; using Spare = Aaru.Decoders.DVD.Spare;
using Humanizer.Bytes;
namespace Aaru.Commands.Media; namespace Aaru.Commands.Media;
sealed class MediaInfoCommand : Command sealed class MediaInfoCommand : Command
{ {
const string MODULE_NAME = "Media-Info command";
public MediaInfoCommand() : base("info", UI.Media_Info_Command_Description) public MediaInfoCommand() : base("info", UI.Media_Info_Command_Description)
{ {
Add(new Option<string>(new[] Add(new Option<string>(new[]
@@ -113,10 +115,10 @@ sealed class MediaInfoCommand : Command
Statistics.AddCommand("media-info"); Statistics.AddCommand("media-info");
AaruConsole.DebugWriteLine("Media-Info command", "--debug={0}", debug); AaruConsole.DebugWriteLine(MODULE_NAME, "--debug={0}", debug);
AaruConsole.DebugWriteLine("Media-Info command", "--device={0}", devicePath); AaruConsole.DebugWriteLine(MODULE_NAME, "--device={0}", devicePath);
AaruConsole.DebugWriteLine("Media-Info command", "--output-prefix={0}", outputPrefix); AaruConsole.DebugWriteLine(MODULE_NAME, "--output-prefix={0}", outputPrefix);
AaruConsole.DebugWriteLine("Media-Info command", "--verbose={0}", verbose); AaruConsole.DebugWriteLine(MODULE_NAME, "--verbose={0}", verbose);
if(devicePath.Length == 2 && if(devicePath.Length == 2 &&
devicePath[1] == ':' && devicePath[1] == ':' &&
@@ -203,11 +205,11 @@ sealed class MediaInfoCommand : Command
return; return;
if(scsiInfo.DeviceInfo.ScsiModeSense6 != null) 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); scsiInfo.DeviceInfo.ScsiModeSense6);
if(scsiInfo.DeviceInfo.ScsiModeSense10 != null) 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); scsiInfo.DeviceInfo.ScsiModeSense10);
switch(dev.ScsiType) switch(dev.ScsiType)
@@ -221,11 +223,11 @@ sealed class MediaInfoCommand : Command
case PeripheralDeviceTypes.BridgingExpander when dev.Model.StartsWith("MDM", StringComparison.Ordinal) || case PeripheralDeviceTypes.BridgingExpander when dev.Model.StartsWith("MDM", StringComparison.Ordinal) ||
dev.Model.StartsWith("MDH", StringComparison.Ordinal): dev.Model.StartsWith("MDH", StringComparison.Ordinal):
if(scsiInfo.ReadCapacity != null) 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); scsiInfo.ReadCapacity);
if(scsiInfo.ReadCapacity16 != null) 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); "SCSI READ CAPACITY(16)", scsiInfo.ReadCapacity16);
if(scsiInfo.Blocks != 0 && if(scsiInfo.Blocks != 0 &&
@@ -238,7 +240,7 @@ sealed class MediaInfoCommand : Command
case PeripheralDeviceTypes.SequentialAccess: case PeripheralDeviceTypes.SequentialAccess:
if(scsiInfo.DensitySupport != null) 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); "SSC REPORT DENSITY SUPPORT (MEDIA)", scsiInfo.DensitySupport);
if(scsiInfo.DensitySupportHeader.HasValue) if(scsiInfo.DensitySupportHeader.HasValue)
@@ -250,7 +252,7 @@ sealed class MediaInfoCommand : Command
if(scsiInfo.MediaTypeSupport != null) 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); "SSC REPORT DENSITY SUPPORT (MEDIUM & MEDIA)", scsiInfo.MediaTypeSupport);
if(scsiInfo.MediaTypeSupportHeader.HasValue) if(scsiInfo.MediaTypeSupportHeader.HasValue)
@@ -268,20 +270,20 @@ sealed class MediaInfoCommand : Command
if(dev.ScsiType == PeripheralDeviceTypes.MultiMediaDevice) if(dev.ScsiType == PeripheralDeviceTypes.MultiMediaDevice)
{ {
if(scsiInfo.MmcConfiguration != null) 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); "SCSI GET CONFIGURATION", scsiInfo.MmcConfiguration);
if(scsiInfo.RecognizedFormatLayers != null) 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); "SCSI READ DISC STRUCTURE", scsiInfo.RecognizedFormatLayers);
if(scsiInfo.WriteProtectionStatus != null) 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); "SCSI READ DISC STRUCTURE", scsiInfo.WriteProtectionStatus);
if(scsiInfo.DvdPfi != null) 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); "SCSI READ DISC STRUCTURE", scsiInfo.DvdPfi);
if(scsiInfo.DecodedPfi.HasValue) if(scsiInfo.DecodedPfi.HasValue)
@@ -290,7 +292,7 @@ sealed class MediaInfoCommand : Command
if(scsiInfo.DvdDmi != null) 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); "SCSI READ DISC STRUCTURE", scsiInfo.DvdDmi);
if(DMI.IsXbox(scsiInfo.DvdDmi)) if(DMI.IsXbox(scsiInfo.DvdDmi))
@@ -303,7 +305,7 @@ sealed class MediaInfoCommand : Command
if(scsiInfo.DvdCmi != null) 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); "SCSI READ DISC STRUCTURE", scsiInfo.DvdCmi);
AaruConsole.WriteLine($"[bold]{Localization.Core.Lead_In_CMI}:[/]", AaruConsole.WriteLine($"[bold]{Localization.Core.Lead_In_CMI}:[/]",
@@ -311,24 +313,24 @@ sealed class MediaInfoCommand : Command
} }
if(scsiInfo.DvdDiscKey != null) 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); "SCSI READ DISC STRUCTURE", scsiInfo.DvdDiscKey);
if(scsiInfo.DvdSectorCmi != null) 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); "SCSI READ DISC STRUCTURE", scsiInfo.DvdSectorCmi);
if(scsiInfo.DvdBca != null) 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); "SCSI READ DISC STRUCTURE", scsiInfo.DvdBca);
if(scsiInfo.DvdAacs != null) 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); "SCSI READ DISC STRUCTURE", scsiInfo.DvdAacs);
if(scsiInfo.DvdRamDds != null) 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); "SCSI READ DISC STRUCTURE", scsiInfo.DvdRamDds);
AaruConsole.WriteLine($"[bold]{UI.Disc_Definition_Structure}:[/]", AaruConsole.WriteLine($"[bold]{UI.Disc_Definition_Structure}:[/]",
@@ -337,7 +339,7 @@ sealed class MediaInfoCommand : Command
if(scsiInfo.DvdRamCartridgeStatus != null) 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); "SCSI READ DISC STRUCTURE", scsiInfo.DvdRamCartridgeStatus);
AaruConsole.WriteLine($"[bold]{Localization.Core.Medium_Status}:[/]", AaruConsole.WriteLine($"[bold]{Localization.Core.Medium_Status}:[/]",
@@ -346,7 +348,7 @@ sealed class MediaInfoCommand : Command
if(scsiInfo.DvdRamSpareArea != null) 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); "SCSI READ DISC STRUCTURE", scsiInfo.DvdRamSpareArea);
AaruConsole.WriteLine($"[bold]{UI.Spare_Area_Information}:[/]", AaruConsole.WriteLine($"[bold]{UI.Spare_Area_Information}:[/]",
@@ -354,12 +356,12 @@ sealed class MediaInfoCommand : Command
} }
if(scsiInfo.LastBorderOutRmd != null) 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); "SCSI READ DISC STRUCTURE", scsiInfo.LastBorderOutRmd);
if(scsiInfo.DvdPreRecordedInfo != null) 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); "SCSI READ DISC STRUCTURE", scsiInfo.DvdPreRecordedInfo);
if(scsiInfo.DecodedDvdPrePitInformation.HasValue) if(scsiInfo.DecodedDvdPrePitInformation.HasValue)
@@ -368,12 +370,12 @@ sealed class MediaInfoCommand : Command
} }
if(scsiInfo.DvdrMediaIdentifier != null) 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); "SCSI READ DISC STRUCTURE", scsiInfo.DvdrMediaIdentifier);
if(scsiInfo.DvdrPhysicalInformation != null) 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); "SCSI READ DISC STRUCTURE", scsiInfo.DvdrPhysicalInformation);
if(scsiInfo.DecodedDvdrPfi.HasValue) if(scsiInfo.DecodedDvdrPfi.HasValue)
@@ -382,48 +384,48 @@ sealed class MediaInfoCommand : Command
} }
if(scsiInfo.DvdPlusAdip != null) 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); "SCSI READ DISC STRUCTURE", scsiInfo.DvdPlusAdip);
if(scsiInfo.DvdPlusDcb != null) 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); "SCSI READ DISC STRUCTURE", scsiInfo.DvdPlusDcb);
if(scsiInfo.HddvdCopyrightInformation != null) 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); "SCSI READ DISC STRUCTURE", scsiInfo.HddvdCopyrightInformation);
if(scsiInfo.HddvdrMediumStatus != null) 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); "SCSI READ DISC STRUCTURE", scsiInfo.HddvdrMediumStatus);
if(scsiInfo.HddvdrLastRmd != null) 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); "SCSI READ DISC STRUCTURE", scsiInfo.HddvdrLastRmd);
if(scsiInfo.DvdrLayerCapacity != null) 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); "SCSI READ DISC STRUCTURE", scsiInfo.DvdrLayerCapacity);
if(scsiInfo.DvdrDlMiddleZoneStart != null) 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); "SCSI READ DISC STRUCTURE", scsiInfo.DvdrDlMiddleZoneStart);
if(scsiInfo.DvdrDlJumpIntervalSize != null) 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); "SCSI READ DISC STRUCTURE", scsiInfo.DvdrDlJumpIntervalSize);
if(scsiInfo.DvdrDlManualLayerJumpStartLba != null) 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); "SCSI READ DISC STRUCTURE", scsiInfo.DvdrDlManualLayerJumpStartLba);
if(scsiInfo.DvdrDlRemapAnchorPoint != null) 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); "SCSI READ DISC STRUCTURE", scsiInfo.DvdrDlRemapAnchorPoint);
if(scsiInfo.BlurayDiscInformation != null) 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); "SCSI READ DISC STRUCTURE", scsiInfo.BlurayDiscInformation);
AaruConsole.WriteLine($"[bold]{Localization.Core.Bluray_Disc_Information}:[/]", AaruConsole.WriteLine($"[bold]{Localization.Core.Bluray_Disc_Information}:[/]",
@@ -431,12 +433,12 @@ sealed class MediaInfoCommand : Command
} }
if(scsiInfo.BlurayPac != null) 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); "SCSI READ DISC STRUCTURE", scsiInfo.BlurayPac);
if(scsiInfo.BlurayBurstCuttingArea != null) 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); "SCSI READ DISC STRUCTURE", scsiInfo.BlurayBurstCuttingArea);
AaruConsole.WriteLine($"[bold]{Localization.Core.Bluray_Burst_Cutting_Area}:[/]", AaruConsole.WriteLine($"[bold]{Localization.Core.Bluray_Burst_Cutting_Area}:[/]",
@@ -445,7 +447,7 @@ sealed class MediaInfoCommand : Command
if(scsiInfo.BlurayDds != null) 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); "SCSI READ DISC STRUCTURE", scsiInfo.BlurayDds);
AaruConsole.WriteLine($"[bold]{Localization.Core.Bluray_Disc_Definition_Structure}:[/]", AaruConsole.WriteLine($"[bold]{Localization.Core.Bluray_Disc_Definition_Structure}:[/]",
@@ -454,26 +456,26 @@ sealed class MediaInfoCommand : Command
if(scsiInfo.BlurayCartridgeStatus != null) 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); "SCSI READ DISC STRUCTURE", scsiInfo.BlurayCartridgeStatus);
AaruConsole.WriteLine($"[bold]{Localization.Core.Bluray_Cartridge_Status}:[/]", AaruConsole.WriteLine($"[bold]{Localization.Core.Bluray_Cartridge_Status}:[/]",
$"\n{Markup.Escape(Decoders.Bluray.Cartridge.Prettify(scsiInfo. $"\n{Markup.Escape(Decoders.Bluray.Cartridge.Prettify(scsiInfo.
BlurayCartridgeStatus))}"); BlurayCartridgeStatus))}");
} }
if(scsiInfo.BluraySpareAreaInformation != null) 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); "SCSI READ DISC STRUCTURE", scsiInfo.BluraySpareAreaInformation);
AaruConsole.WriteLine($"[bold]{Localization.Core.Bluray_Spare_Area_Information}:[/]", AaruConsole.WriteLine($"[bold]{Localization.Core.Bluray_Spare_Area_Information}:[/]",
$"\n{Markup.Escape(Decoders.Bluray.Spare.Prettify(scsiInfo. $"\n{Markup.Escape(Decoders.Bluray.Spare.Prettify(scsiInfo.
BluraySpareAreaInformation))}"); BluraySpareAreaInformation))}");
} }
if(scsiInfo.BlurayRawDfl != null) 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); "SCSI READ DISC STRUCTURE", scsiInfo.BlurayRawDfl);
if(scsiInfo.BlurayTrackResources != null) if(scsiInfo.BlurayTrackResources != null)
@@ -481,7 +483,7 @@ sealed class MediaInfoCommand : Command
AaruConsole.WriteLine($"[bold]{Localization.Core.Track_Resources_Information}:[/]", AaruConsole.WriteLine($"[bold]{Localization.Core.Track_Resources_Information}:[/]",
$"\n{Markup.Escape(DiscInformation.Prettify(scsiInfo.BlurayTrackResources))}"); $"\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); "SCSI READ DISC INFORMATION", scsiInfo.BlurayTrackResources);
} }
@@ -490,13 +492,13 @@ sealed class MediaInfoCommand : Command
AaruConsole.WriteLine($"[bold]{Localization.Core.POW_Resources_Information}:[/]", AaruConsole.WriteLine($"[bold]{Localization.Core.POW_Resources_Information}:[/]",
$"\n{Markup.Escape(DiscInformation.Prettify(scsiInfo.BlurayPowResources))}"); $"\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); "SCSI READ DISC INFORMATION", scsiInfo.BlurayPowResources);
} }
if(scsiInfo.Toc != null) 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); scsiInfo.Toc);
if(scsiInfo.DecodedToc.HasValue) if(scsiInfo.DecodedToc.HasValue)
@@ -506,7 +508,7 @@ sealed class MediaInfoCommand : Command
if(scsiInfo.Atip != null) 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); scsiInfo.Atip);
if(scsiInfo.DecodedAtip != null) if(scsiInfo.DecodedAtip != null)
@@ -516,7 +518,7 @@ sealed class MediaInfoCommand : Command
if(scsiInfo.DiscInformation != null) 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); "SCSI READ DISC INFORMATION", scsiInfo.DiscInformation);
if(scsiInfo.DecodedDiscInformation.HasValue) if(scsiInfo.DecodedDiscInformation.HasValue)
@@ -527,7 +529,7 @@ sealed class MediaInfoCommand : Command
if(scsiInfo.Session != null) 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); scsiInfo.Session);
if(scsiInfo.DecodedSession.HasValue) if(scsiInfo.DecodedSession.HasValue)
@@ -537,7 +539,7 @@ sealed class MediaInfoCommand : Command
if(scsiInfo.RawToc != null) 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); scsiInfo.RawToc);
if(scsiInfo.FullToc.HasValue) if(scsiInfo.FullToc.HasValue)
@@ -547,7 +549,7 @@ sealed class MediaInfoCommand : Command
if(scsiInfo.Pma != null) 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); scsiInfo.Pma);
AaruConsole.WriteLine($"[bold]{Localization.Core.PMA}:[/]", AaruConsole.WriteLine($"[bold]{Localization.Core.PMA}:[/]",
@@ -556,7 +558,7 @@ sealed class MediaInfoCommand : Command
if(scsiInfo.CdTextLeadIn != null) 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); scsiInfo.CdTextLeadIn);
if(scsiInfo.DecodedCdTextLeadIn.HasValue) if(scsiInfo.DecodedCdTextLeadIn.HasValue)
@@ -573,7 +575,7 @@ sealed class MediaInfoCommand : Command
Markup.Escape(isrc.Value)}"); Markup.Escape(isrc.Value)}");
if(scsiInfo.XboxSecuritySector != null) 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); scsiInfo.XboxSecuritySector);
if(scsiInfo.DecodedXboxSecuritySector.HasValue) if(scsiInfo.DecodedXboxSecuritySector.HasValue)
@@ -605,7 +607,7 @@ sealed class MediaInfoCommand : Command
if(scsiInfo.MediaSerialNumber != null) 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); "SCSI READ MEDIA SERIAL NUMBER", scsiInfo.MediaSerialNumber);
AaruConsole.Write($"[bold]{Localization.Core.Media_Serial_Number}:[/] "); AaruConsole.Write($"[bold]{Localization.Core.Media_Serial_Number}:[/] ");

View File

@@ -46,6 +46,7 @@ namespace Aaru.Commands.Media;
sealed class MediaScanCommand : Command sealed class MediaScanCommand : Command
{ {
const string MODULE_NAME = "Media-Scan command";
static ProgressTask _progressTask1; static ProgressTask _progressTask1;
public MediaScanCommand() : base("scan", UI.Media_Scan_Command_Description) public MediaScanCommand() : base("scan", UI.Media_Scan_Command_Description)
@@ -107,12 +108,12 @@ sealed class MediaScanCommand : Command
Statistics.AddCommand("media-scan"); Statistics.AddCommand("media-scan");
AaruConsole.DebugWriteLine("Media-Scan command", "--debug={0}", debug); AaruConsole.DebugWriteLine(MODULE_NAME, "--debug={0}", debug);
AaruConsole.DebugWriteLine("Media-Scan command", "--device={0}", devicePath); AaruConsole.DebugWriteLine(MODULE_NAME, "--device={0}", devicePath);
AaruConsole.DebugWriteLine("Media-Scan command", "--ibg-log={0}", ibgLog); AaruConsole.DebugWriteLine(MODULE_NAME, "--ibg-log={0}", ibgLog);
AaruConsole.DebugWriteLine("Media-Scan command", "--mhdd-log={0}", mhddLog); AaruConsole.DebugWriteLine(MODULE_NAME, "--mhdd-log={0}", mhddLog);
AaruConsole.DebugWriteLine("Media-Scan command", "--verbose={0}", verbose); AaruConsole.DebugWriteLine(MODULE_NAME, "--verbose={0}", verbose);
AaruConsole.DebugWriteLine("Media-Scan command", "--use-buffered-reads={0}", useBufferedReads); AaruConsole.DebugWriteLine(MODULE_NAME, "--use-buffered-reads={0}", useBufferedReads);
if(devicePath.Length == 2 && if(devicePath.Length == 2 &&
devicePath[1] == ':' && devicePath[1] == ':' &&

View File

@@ -46,6 +46,8 @@ namespace Aaru.Commands;
sealed class RemoteCommand : Command sealed class RemoteCommand : Command
{ {
const string MODULE_NAME = "Remote command";
public RemoteCommand() : base("remote", UI.Remote_Command_Description) public RemoteCommand() : base("remote", UI.Remote_Command_Description)
{ {
AddArgument(new Argument<string> AddArgument(new Argument<string>
@@ -89,9 +91,9 @@ sealed class RemoteCommand : Command
Statistics.AddCommand("remote"); Statistics.AddCommand("remote");
AaruConsole.DebugWriteLine("Remote command", "--debug={0}", debug); AaruConsole.DebugWriteLine(MODULE_NAME, "--debug={0}", debug);
AaruConsole.DebugWriteLine("Remote command", "--host={0}", host); AaruConsole.DebugWriteLine(MODULE_NAME, "--host={0}", host);
AaruConsole.DebugWriteLine("Remote command", "--verbose={0}", verbose); AaruConsole.DebugWriteLine(MODULE_NAME, "--verbose={0}", verbose);
try try
{ {