[Aaru.Decoders] Introduced constants for module names

Introduces constant fields for respective debug module names, replacing the hardcoded ones.
This is done to standardize the naming convention, reduce redundancy and potentially avoid any typos or name mismatches across the project.
This change makes the code more maintainable and easier to update in case module names need to be changed.
This commit is contained in:
2023-10-03 17:21:19 +01:00
parent 3d72f0d7da
commit 2a52c3075d
15 changed files with 98 additions and 74 deletions

View File

@@ -55,6 +55,8 @@ namespace Aaru.Decoders.CD;
SuppressMessage("ReSharper", "MemberCanBePrivate.Global"), SuppressMessage("ReSharper", "NotAccessedField.Global")]
public static class ATIP
{
const string MODULE_NAME = "CD ATIP decoder";
public static CDATIP Decode(byte[] CDATIPResponse)
{
if(CDATIPResponse is not { Length: > 4 })
@@ -65,7 +67,7 @@ public static class ATIP
if(CDATIPResponse.Length != 32 &&
CDATIPResponse.Length != 28)
{
AaruConsole.DebugWriteLine("CD ATIP decoder",
AaruConsole.DebugWriteLine(MODULE_NAME,
Localization.
Expected_CD_ATIP_size_32_bytes_is_not_received_size_0_bytes_not_decoding,
CDATIPResponse.Length);

View File

@@ -55,6 +55,8 @@ namespace Aaru.Decoders.CD;
SuppressMessage("ReSharper", "MemberCanBePrivate.Global"), SuppressMessage("ReSharper", "NotAccessedField.Global")]
public static class CDTextOnLeadIn
{
const string MODULE_NAME = "CD-TEXT decoder";
public enum PackTypeIndicator : byte
{
/// <summary>Title of the track (or album if track == 0)</summary>
@@ -110,7 +112,7 @@ public static class CDTextOnLeadIn
if(decoded.DataLength + 2 != CDTextResponse.Length)
{
AaruConsole.DebugWriteLine("CD-TEXT decoder",
AaruConsole.DebugWriteLine(MODULE_NAME,
Localization.
Expected_CD_TEXT_size_0_bytes_is_not_received_size_1_bytes_not_decoding,
decoded.DataLength + 2, CDTextResponse.Length);

View File

@@ -60,6 +60,8 @@ namespace Aaru.Decoders.CD;
SuppressMessage("ReSharper", "MemberCanBePrivate.Global")]
public static class FullTOC
{
const string MODULE_NAME = "CD full TOC decoder";
public static CDFullTOC? Decode(byte[] CDFullTOCResponse)
{
if(CDFullTOCResponse is not { Length: > 4 })
@@ -76,7 +78,7 @@ public static class FullTOC
if(decoded.DataLength + 2 != CDFullTOCResponse.Length)
{
AaruConsole.DebugWriteLine("CD full TOC decoder",
AaruConsole.DebugWriteLine(MODULE_NAME,
Localization.
Expected_CDFullTOC_size_0_bytes_is_not_received_size_1_bytes_not_decoding,
decoded.DataLength + 2, CDFullTOCResponse.Length);

View File

@@ -55,6 +55,8 @@ namespace Aaru.Decoders.CD;
SuppressMessage("ReSharper", "MemberCanBePrivate.Global")]
public static class PMA
{
const string MODULE_NAME = "CD PMA decoder";
public static CDPMA? Decode(byte[] CDPMAResponse)
{
if(CDPMAResponse is not { Length: > 4 })
@@ -74,7 +76,7 @@ public static class PMA
if(decoded.DataLength + 2 != CDPMAResponse.Length)
{
AaruConsole.DebugWriteLine("CD PMA decoder",
AaruConsole.DebugWriteLine(MODULE_NAME,
Localization.
Expected_CD_PMA_size_0_bytes_is_not_received_size_1_bytes_not_decoding,
decoded.DataLength + 2, CDPMAResponse.Length);

View File

@@ -53,6 +53,8 @@ namespace Aaru.Decoders.CD;
SuppressMessage("ReSharper", "MemberCanBePrivate.Global")]
public static class Session
{
const string MODULE_NAME = "CD Session Info decoder";
public static CDSessionInfo? Decode(byte[] CDSessionInfoResponse)
{
if(CDSessionInfoResponse is not { Length: > 4 })
@@ -69,7 +71,7 @@ public static class Session
if(decoded.DataLength + 2 != CDSessionInfoResponse.Length)
{
AaruConsole.DebugWriteLine("CD Session Info decoder",
AaruConsole.DebugWriteLine(MODULE_NAME,
Localization.
Expected_CDSessionInfo_size_0_bytes_is_not_received_size_1_bytes_not_decoding,
decoded.DataLength + 2, CDSessionInfoResponse.Length);

View File

@@ -56,6 +56,8 @@ namespace Aaru.Decoders.CD;
SuppressMessage("ReSharper", "MemberCanBePrivate.Global")]
public static class TOC
{
const string MODULE_NAME = "CD TOC decoder";
public static CDTOC? Decode(byte[] CDTOCResponse)
{
if(CDTOCResponse is not { Length: > 4 })
@@ -72,7 +74,7 @@ public static class TOC
if(decoded.DataLength + 2 != CDTOCResponse.Length)
{
AaruConsole.DebugWriteLine("CD TOC decoder",
AaruConsole.DebugWriteLine(MODULE_NAME,
Localization.
Expected_CD_TOC_size_0_bytes_is_not_received_size_1_bytes_not_decoding,
decoded.DataLength + 2, CDTOCResponse.Length);