[Refactor] Use collection expressions.

This commit is contained in:
2024-05-01 04:39:38 +01:00
parent f7ca79b09e
commit 134ce7041e
667 changed files with 12936 additions and 13750 deletions

View File

@@ -10,56 +10,50 @@ namespace Aaru.Tests.Devices.SecureDigital;
public class CID
{
readonly string[] cards =
{
[
"microsdhc_goodram_16gb", "microsdhc_kingston_4gb", "microsdhc_kingston_8gb", "microsdhc_kodak_2gb",
"microsdhc_nobrand_2gb", "microsdhc_sandisk_16gb", "microsdhc_sandisk_32gb", "microsdhc_trascend_2gb",
"sd_adata_4gb", "sdhc_fujifilm_4gb", "sdhc_kodak_4gb", "sdhc_pny_4gb", "sdhc_puntitos_4gb", "sd_pqi_64mb"
};
];
readonly string[] cids =
{
[
"275048534431364760011a77d2014701", "02544d534430344738b26a38aa008901", "02544d5341303847049cd164d9009a01",
"1b534d30303030301075a72c7e00a501", "02544d534430324738a2cd4987009101", "035344534c313647800eace07e00e801",
"0353445342333247809b2f1533012301", "1b534d30303030301000ca9e3d00b201", "1d4144534420202010000256db006701",
"275048534430344730b00de36100b801", "64504320202020201088026f6400aa01", "035344534430344780708200ac009501",
"035344544f000000ff000147da00fa01", "02544d5344303634055744cb0f003401"
};
];
readonly byte[] manufacturers =
{
[
0x27, 0x02, 0x02, 0x1b, 0x02, 0x03, 0x03, 0x1b, 0x1d, 0x27, 0x64, 0x03, 0x03, 0x02
};
];
readonly string[] applications =
{
[
"PH", "TM", "TM", "SM", "TM", "SD", "SD", "SM", "AD", "PH", "PC", "SD", "SD", "TM"
};
];
readonly string[] names =
{
[
"SD16G", "SD04G", "SA08G", "00000", "SD02G", "SL16G", "SB32G", "00000", "SD ", "SD04G", " ", "SD04G",
"TO", "SD064"
};
];
readonly byte[] revisions =
{
0x60, 0x38, 0x04, 0x10, 0x38, 0x80, 0x80, 0x10, 0x10, 0x30, 0x10, 0x80, 0xff, 0x05
};
readonly byte[] revisions = [0x60, 0x38, 0x04, 0x10, 0x38, 0x80, 0x80, 0x10, 0x10, 0x30, 0x10, 0x80, 0xff, 0x05];
readonly uint[] serials =
{
[
0x011a77d2, 0xb26a38aa, 0x9cd164d9, 0x75a72c7e, 0xa2cd4987, 0x0eace07e, 0x9b2f1533, 0x00ca9e3d, 0x000256db,
0xb00de361, 0x88026f64, 0x708200ac, 0x000147da, 0x5744cb0f
};
];
readonly ushort[] dates =
{
[
0x147, 0x089, 0x09a, 0x0a5, 0x091, 0x0e8, 0x123, 0x0b2, 0x067, 0x0b8, 0x0aa, 0x095, 0x0fa, 0x034
};
];
readonly byte[] crcs =
{
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};
readonly byte[] crcs = [0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00];
[Test]
public void Test()

View File

@@ -10,151 +10,109 @@ namespace Aaru.Tests.Devices.SecureDigital;
public class CSD
{
readonly string[] cards =
{
[
"microsdhc_goodram_16gb", "microsdhc_kingston_4gb", "microsdhc_kingston_8gb", "microsdhc_kodak_2gb",
"microsdhc_nobrand_2gb", "microsdhc_sandisk_16gb", "microsdhc_sandisk_32gb", "microsdhc_trascend_2gb",
"sd_adata_4gb", "sdhc_fujifilm_4gb", "sdhc_kodak_4gb", "sdhc_pny_4gb", "sdhc_puntitos_4gb", "sd_pqi_64mb"
};
];
readonly string[] csds =
{
[
"400e00325b590000740f7f800a400001", "400e00325b5900001d877f800a400001", "400e00325b5900003b677f800a400001",
"002601325b5a83c7f6dbff9f16804001", "002e00325b5a83a9ffffff8016800001", "400e00325b59000076b27f800a404001",
"400e00325b590000edc87f800a404001", "007fff325b5a83baf6dbdfff0e800001", "005e0032575b83d56db7ffff96c00001",
"400e00325b5900001da77f800a400001", "400e00325b5900001deb7f800a400001", "400e00325b5900001d8a7f800a404001",
"400e00325b5900001dbf7f800a400001", "002d0032135983c9f6d9cf8016400001"
};
];
readonly byte[] structure_versions =
{
1, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 1, 1, 0
};
readonly byte[] structure_versions = [1, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 1, 1, 0];
readonly byte[] taacs =
{
14, 14, 14, 38, 46, 14, 14, 127, 94, 14, 14, 14, 14, 45
};
readonly byte[] taacs = [14, 14, 14, 38, 46, 14, 14, 127, 94, 14, 14, 14, 14, 45];
readonly byte[] nsacs =
{
0, 0, 0, 1, 0, 0, 0, 255, 0, 0, 0, 0, 0, 0
};
readonly byte[] nsacs = [0, 0, 0, 1, 0, 0, 0, 255, 0, 0, 0, 0, 0, 0];
readonly byte[] speeds =
{
[
// ReSharper disable once UseUtf8StringLiteral
50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50
};
];
readonly ushort[] classes =
{
1461, 1461, 1461, 1461, 1461, 1461, 1461, 1461, 1397, 1461, 1461, 1461, 1461, 309
};
readonly ushort[] classes = [1461, 1461, 1461, 1461, 1461, 1461, 1461, 1461, 1397, 1461, 1461, 1461, 1461, 309];
readonly byte[] read_block_lengths =
{
9, 9, 9, 10, 10, 9, 9, 10, 11, 9, 9, 9, 9, 9
};
readonly byte[] read_block_lengths = [9, 9, 9, 10, 10, 9, 9, 10, 11, 9, 9, 9, 9, 9];
readonly bool[] read_partial_blocks =
{
[
false, false, false, true, true, false, false, true, true, false, false, false, false, true
};
];
readonly bool[] write_misaligned_block =
{
[
false, false, false, false, false, false, false, false, false, false, false, false, false, false
};
];
readonly bool[] read_misaligned_block =
{
[
false, false, false, false, false, false, false, false, false, false, false, false, false, false
};
];
readonly bool[] dsr_implemented =
{
[
false, false, false, false, false, false, false, false, false, false, false, false, false, false
};
];
readonly uint[] card_sizes =
{
[
29711, 7559, 15207, 3871, 3751, 30386, 60872, 3819, 3925, 7591, 7659, 7562, 7615, 3879
};
];
readonly byte[] min_read_current =
{
0, 0, 0, 6, 7, 0, 0, 6, 5, 0, 0, 0, 0, 6
};
readonly byte[] min_read_current = [0, 0, 0, 6, 7, 0, 0, 6, 5, 0, 0, 0, 0, 6];
readonly byte[] max_read_current =
{
0, 0, 0, 6, 7, 0, 0, 6, 5, 0, 0, 0, 0, 6
};
readonly byte[] max_read_current = [0, 0, 0, 6, 7, 0, 0, 6, 5, 0, 0, 0, 0, 6];
readonly byte[] min_write_current =
{
0, 0, 0, 6, 7, 0, 0, 6, 5, 0, 0, 0, 0, 6
};
readonly byte[] min_write_current = [0, 0, 0, 6, 7, 0, 0, 6, 5, 0, 0, 0, 0, 6];
readonly byte[] max_write_current =
{
0, 0, 0, 6, 7, 0, 0, 6, 5, 0, 0, 0, 0, 6
};
readonly byte[] max_write_current = [0, 0, 0, 6, 7, 0, 0, 6, 5, 0, 0, 0, 0, 6];
readonly byte[] size_multiplier =
{
0, 0, 0, 7, 7, 0, 0, 7, 7, 0, 0, 0, 0, 3
};
readonly byte[] size_multiplier = [0, 0, 0, 7, 7, 0, 0, 7, 7, 0, 0, 0, 0, 3];
readonly bool[] erase_block_enable =
{
[
true, true, true, true, true, true, true, true, true, true, true, true, true, true
};
];
readonly byte[] erase_sector_sizes =
{
127, 127, 127, 127, 127, 127, 127, 63, 127, 127, 127, 127, 127, 31
};
readonly byte[] erase_sector_sizes = [127, 127, 127, 127, 127, 127, 127, 63, 127, 127, 127, 127, 127, 31];
readonly byte[] write_protect_group_size =
{
0, 0, 0, 31, 0, 0, 0, 127, 127, 0, 0, 0, 0, 0
};
readonly byte[] write_protect_group_size = [0, 0, 0, 31, 0, 0, 0, 127, 127, 0, 0, 0, 0, 0];
readonly bool[] write_protect_group_enable =
{
[
false, false, false, false, false, false, false, false, true, false, false, false, false, false
};
];
readonly byte[] r2w_factors =
{
2, 2, 2, 5, 5, 2, 2, 3, 5, 2, 2, 2, 2, 5
};
readonly byte[] r2w_factors = [2, 2, 2, 5, 5, 2, 2, 3, 5, 2, 2, 2, 2, 5];
readonly bool[] file_format_group =
{
[
false, false, false, false, false, false, false, false, false, false, false, false, false, false
};
];
readonly bool[] copy =
{
[
false, false, false, true, false, true, true, false, false, false, false, true, false, false, false
};
];
readonly bool[] permanent_write_protect =
{
[
false, false, false, false, false, false, false, false, false, false, false, false, false, false
};
];
readonly bool[] temporary_write_protect =
{
[
false, false, false, false, false, false, false, false, false, false, false, false, false, false
};
];
readonly byte[] file_format =
{
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
};
readonly byte[] file_format = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
[Test]
public void Test()

View File

@@ -11,128 +11,55 @@ namespace Aaru.Tests.Devices.SecureDigital;
public class SCR
{
readonly string[] cards =
{
[
"microsdhc_goodram_16gb", "microsdhc_kingston_4gb", "microsdhc_kingston_8gb", "microsdhc_kodak_2gb",
"microsdhc_nobrand_2gb", "microsdhc_sandisk_16gb", "microsdhc_sandisk_32gb", "microsdhc_trascend_2gb",
"sd_adata_4gb", "sdhc_fujifilm_4gb", "sdhc_kodak_4gb", "sdhc_pny_4gb", "sdhc_puntitos_4gb", "sd_pqi_64mb"
};
];
readonly string[] scrs =
{
[
"0205808301000000", "02b500001c022102", "0235800001000000", "02a5000000000000", "02a500001c021402",
"0235800100000000", "0235804300000000", "0225800000000000", "0125000000000000", "0235800001000000",
"0235000000000000", "0235000000000000", "02b5800000000000", "00a5000008070302"
};
];
readonly byte[] structure_version =
{
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
};
readonly byte[] structure_version = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
readonly byte[] specification_version =
{
2, 2, 2, 2, 2, 2, 2, 2, 1, 2, 2, 2, 2, 0
};
readonly byte[] specification_version = [2, 2, 2, 2, 2, 2, 2, 2, 1, 2, 2, 2, 2, 0];
readonly bool[] data_stat_after_erase =
{
[
false, true, false, true, true, false, false, false, false, false, false, false, true, true
};
];
readonly byte[] sd_security =
{
0, 3, 3, 2, 2, 3, 3, 2, 2, 3, 3, 3, 3, 2
};
readonly byte[] sd_security = [0, 3, 3, 2, 2, 3, 3, 2, 2, 3, 3, 3, 3, 2];
readonly byte[] sd_bus_widths =
{
5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5
};
readonly byte[] sd_bus_widths = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5];
readonly bool[] sd_spec3 =
{
[
true, false, true, false, false, true, true, true, false, true, false, false, true, false
};
];
readonly byte[] ex_security =
{
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
};
readonly byte[] ex_security = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
readonly bool[] sd_spec4 =
{
[
false, false, false, false, false, false, false, false, false, false, false, false, false, false
};
];
readonly byte[] sd_specx =
{
2, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0
};
readonly byte[] sd_specx = [2, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0];
readonly byte[] cmd_support =
{
3, 0, 0, 0, 0, 1, 3, 0, 0, 0, 0, 0, 0, 0
};
readonly byte[] cmd_support = [3, 0, 0, 0, 0, 1, 3, 0, 0, 0, 0, 0, 0, 0];
readonly byte[][] mfg =
{
new byte[]
{
0x01, 0x00, 0x00, 0x00
},
new byte[]
{
0x1c, 0x02, 0x21, 0x02
},
new byte[]
{
0x01, 0x00, 0x00, 0x00
},
new byte[]
{
0x00, 0x00, 0x00, 0x00
},
new byte[]
{
0x1c, 0x02, 0x14, 0x02
},
new byte[]
{
0x00, 0x00, 0x00, 0x00
},
new byte[]
{
0x00, 0x00, 0x00, 0x00
},
new byte[]
{
0x00, 0x00, 0x00, 0x00
},
new byte[]
{
0x00, 0x00, 0x00, 0x00
},
new byte[]
{
0x01, 0x00, 0x00, 0x00
},
new byte[]
{
0x00, 0x00, 0x00, 0x00
},
new byte[]
{
0x00, 0x00, 0x00, 0x00
},
new byte[]
{
0x00, 0x00, 0x00, 0x00
},
new byte[]
{
0x08, 0x07, 0x03, 0x02
}
};
[
[0x01, 0x00, 0x00, 0x00], [0x1c, 0x02, 0x21, 0x02], [0x01, 0x00, 0x00, 0x00], [0x00, 0x00, 0x00, 0x00],
[0x1c, 0x02, 0x14, 0x02], [0x00, 0x00, 0x00, 0x00], [0x00, 0x00, 0x00, 0x00], [0x00, 0x00, 0x00, 0x00],
[0x00, 0x00, 0x00, 0x00], [0x01, 0x00, 0x00, 0x00], [0x00, 0x00, 0x00, 0x00], [0x00, 0x00, 0x00, 0x00],
[0x00, 0x00, 0x00, 0x00], [0x08, 0x07, 0x03, 0x02]
];
[Test]
public void Test()