[Refactor] Replace byte array initializations with string literals for improved readability

This commit is contained in:
2025-11-24 03:23:37 +00:00
parent 0ddd930ee1
commit 98f52803c9
11 changed files with 15 additions and 33 deletions

View File

@@ -67,19 +67,13 @@ public static class MMC
const string MODULE_NAME = "Media detection";
static readonly byte[] _ps3Id =
[
0x50, 0x6C, 0x61, 0x79, 0x53, 0x74, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x33, 0x00, 0x00, 0x00, 0x00
];
"PlayStation3\0\0\0\0"u8.ToArray();
static readonly byte[] _ps4Id =
[
0x50, 0x6C, 0x61, 0x79, 0x53, 0x74, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x34, 0x00, 0x00, 0x00, 0x00
];
"PlayStation4\0\0\0\0"u8.ToArray();
static readonly byte[] _ps5Id =
[
0x50, 0x6C, 0x61, 0x79, 0x53, 0x74, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x35, 0x00, 0x00, 0x00, 0x00
];
"PlayStation5\0\0\0\0"u8.ToArray();
static readonly byte[] _operaId = [0x01, 0x5A, 0x5A, 0x5A, 0x5A, 0x5A, 0x01];

View File

@@ -35,6 +35,6 @@ public sealed partial class HPOFS
// Do not translate
const string FS_TYPE = "hpofs";
readonly byte[] _medinfoSignature = "MEDINFO "u8.ToArray();
readonly byte[] _type = [0x48, 0x50, 0x4F, 0x46, 0x53, 0x00, 0x00, 0x00];
readonly byte[] _type = "HPOFS\0\0\0"u8.ToArray();
readonly byte[] _volinfoSignature = "VOLINFO "u8.ToArray();
}

View File

@@ -37,7 +37,5 @@ public sealed partial class QNX4
{
const string FS_TYPE = "qnx4";
readonly byte[] _rootDirFname =
[
0x2F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
];
"/\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"u8.ToArray();
}

View File

@@ -35,5 +35,5 @@ public sealed partial class ReFS
const uint FSRS = 0x53525346;
const string FS_TYPE = "refs";
readonly byte[] _signature = [0x52, 0x65, 0x46, 0x53, 0x00, 0x00, 0x00, 0x00];
readonly byte[] _signature = "ReFS\0\0\0\0"u8.ToArray();
}

View File

@@ -36,7 +36,7 @@ public sealed partial class Reiser
const string FS_TYPE = "reiserfs";
readonly byte[] _magic35 = [0x52, 0x65, 0x49, 0x73, 0x45, 0x72, 0x46, 0x73, 0x00, 0x00];
readonly byte[] _magic36 = [0x52, 0x65, 0x49, 0x73, 0x45, 0x72, 0x32, 0x46, 0x73, 0x00];
readonly byte[] _magicJr = [0x52, 0x65, 0x49, 0x73, 0x45, 0x72, 0x33, 0x46, 0x73, 0x00];
readonly byte[] _magic35 = "ReIsErFs\0\0"u8.ToArray();
readonly byte[] _magic36 = "ReIsEr2Fs\0"u8.ToArray();
readonly byte[] _magicJr = "ReIsEr3Fs\0"u8.ToArray();
}

View File

@@ -37,7 +37,5 @@ public sealed partial class Reiser4
const string FS_TYPE = "reiser4";
readonly byte[] _magic =
[
0x52, 0x65, 0x49, 0x73, 0x45, 0x72, 0x34, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
];
"ReIsEr4\0\0\0\0\0\0\0\0\0"u8.ToArray();
}

View File

@@ -38,8 +38,5 @@ public sealed partial class UDF
{
const string FS_TYPE = "udf";
readonly byte[] _magic =
[
0x2A, 0x4F, 0x53, 0x54, 0x41, 0x20, 0x55, 0x44, 0x46, 0x20, 0x43, 0x6F, 0x6D, 0x70, 0x6C, 0x69, 0x61, 0x6E,
0x74, 0x00, 0x00, 0x00, 0x00
];
"*OSTA UDF Compliant\0\0\0\0"u8.ToArray();
}

View File

@@ -39,5 +39,5 @@ public sealed partial class DiskDupe
const uint TRACKMAP_OFFSET = 100;
/// <summary>The header identification string</summary>
readonly byte[] _headerMagic = [0x49, 0x4d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00];
readonly byte[] _headerMagic = "IM\0\0\0\0\0\0\0\0"u8.ToArray();
}

View File

@@ -35,7 +35,5 @@ namespace Aaru.Images;
public sealed partial class Nhdr0
{
readonly byte[] _signature =
[
0x54, 0x39, 0x38, 0x48, 0x44, 0x44, 0x49, 0x4D, 0x41, 0x47, 0x45, 0x2E, 0x52, 0x30, 0x00
];
"T98HDDIMAGE.R0\0"u8.ToArray();
}

View File

@@ -67,8 +67,5 @@ public sealed partial class Partimage
const uint MAX_CACHE_SIZE = 16777216;
const uint MAX_CACHED_SECTORS = MAX_CACHE_SIZE / 512;
readonly byte[] _partimageMagic =
[
0x50, 0x61, 0x52, 0x74, 0x49, 0x6D, 0x41, 0x67, 0x45, 0x2D, 0x56, 0x6F, 0x4C, 0x75, 0x4D, 0x65, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
];
"PaRtImAgE-VoLuMe\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"u8.ToArray();
}

View File

@@ -34,5 +34,5 @@ namespace Aaru.Images;
public sealed partial class Virtual98
{
readonly byte[] _signature = [0x56, 0x48, 0x44, 0x31, 0x2E, 0x30, 0x30, 0x00];
readonly byte[] _signature = "VHD1.00\0"u8.ToArray();
}