Redo Reformat and cleanup.

Rider EAP was having a bug interpreting .editorconfig that didn't generate the code style as we wanted.
This is now done with Rider-stable.
This commit is contained in:
2023-10-04 17:34:40 +01:00
parent bc8bf7a2dc
commit 7363a5d9c5
453 changed files with 7241 additions and 7126 deletions

View File

@@ -38,20 +38,35 @@ namespace Aaru.Tests.Checksums;
[TestFixture]
public class Adler32
{
static readonly byte[] _expectedEmpty = { 0x00, 0xf0, 0x00, 0x01 };
static readonly byte[] _expectedEmpty =
{
0x00, 0xf0, 0x00, 0x01
};
static readonly byte[] _expectedRandom =
{
// ReSharper disable once UseUtf8StringLiteral
0x37, 0x28, 0xd1, 0x86
};
static readonly byte[] _expectedRandom15 = { 0x34, 0xDC, 0x06, 0x7D };
static readonly byte[] _expectedRandom15 =
{
0x34, 0xDC, 0x06, 0x7D
};
static readonly byte[] _expectedRandom31 = { 0xD8, 0xF1, 0x0E, 0xAA };
static readonly byte[] _expectedRandom31 =
{
0xD8, 0xF1, 0x0E, 0xAA
};
static readonly byte[] _expectedRandom63 = { 0xD8, 0xAC, 0x20, 0x81 };
static readonly byte[] _expectedRandom63 =
{
0xD8, 0xAC, 0x20, 0x81
};
static readonly byte[] _expectedRandom2352 = { 0xEC, 0xD1, 0x73, 0x8B };
static readonly byte[] _expectedRandom2352 =
{
0xEC, 0xD1, 0x73, 0x8B
};
[Test]
public void EmptyData()

View File

@@ -37,16 +37,31 @@ namespace Aaru.Tests.Checksums;
[TestFixture]
public class Crc16Ccitt
{
static readonly byte[] _expectedEmpty = { 0xFF, 0xFF };
static readonly byte[] _expectedEmpty =
{
0xFF, 0xFF
};
static readonly byte[] _expectedRandom =
{
// ReSharper disable once UseUtf8StringLiteral
0x36, 0x40
};
static readonly byte[] _expectedRandom15 = { 0x16, 0x6e };
static readonly byte[] _expectedRandom31 = { 0xd0, 0x16 };
static readonly byte[] _expectedRandom63 = { 0x73, 0xc4 };
static readonly byte[] _expectedRandom2352 = { 0x19, 0x46 };
static readonly byte[] _expectedRandom15 =
{
0x16, 0x6e
};
static readonly byte[] _expectedRandom31 =
{
0xd0, 0x16
};
static readonly byte[] _expectedRandom63 =
{
0x73, 0xc4
};
static readonly byte[] _expectedRandom2352 =
{
0x19, 0x46
};
[Test]
public void EmptyData()

View File

@@ -38,16 +38,31 @@ namespace Aaru.Tests.Checksums;
[TestFixture]
public class Crc16Ibm
{
static readonly byte[] _expectedEmpty = { 0x00, 0x00 };
static readonly byte[] _expectedEmpty =
{
0x00, 0x00
};
static readonly byte[] _expectedRandom =
{
// ReSharper disable once UseUtf8StringLiteral
0x2d, 0x6d
};
static readonly byte[] _expectedRandom15 = { 0x72, 0xa6 };
static readonly byte[] _expectedRandom31 = { 0xf4, 0x9e };
static readonly byte[] _expectedRandom63 = { 0xfb, 0xd9 };
static readonly byte[] _expectedRandom2352 = { 0x23, 0xf4 };
static readonly byte[] _expectedRandom15 =
{
0x72, 0xa6
};
static readonly byte[] _expectedRandom31 =
{
0xf4, 0x9e
};
static readonly byte[] _expectedRandom63 =
{
0xfb, 0xd9
};
static readonly byte[] _expectedRandom2352 =
{
0x23, 0xf4
};
[Test]
public void EmptyData()

View File

@@ -38,16 +38,31 @@ namespace Aaru.Tests.Checksums;
[TestFixture]
public class Crc32
{
static readonly byte[] _expectedEmpty = { 0xa7, 0x38, 0xea, 0x1c };
static readonly byte[] _expectedEmpty =
{
0xa7, 0x38, 0xea, 0x1c
};
static readonly byte[] _expectedRandom =
{
// ReSharper disable once UseUtf8StringLiteral
0x2b, 0x6e, 0x68, 0x54
};
static readonly byte[] _expectedRandom15 = { 0xad, 0x6d, 0xa7, 0x27 };
static readonly byte[] _expectedRandom31 = { 0xa2, 0xad, 0x2f, 0xaa };
static readonly byte[] _expectedRandom63 = { 0xbf, 0xf6, 0xa3, 0x41 };
static readonly byte[] _expectedRandom2352 = { 0x08, 0xba, 0x93, 0xea };
static readonly byte[] _expectedRandom15 =
{
0xad, 0x6d, 0xa7, 0x27
};
static readonly byte[] _expectedRandom31 =
{
0xa2, 0xad, 0x2f, 0xaa
};
static readonly byte[] _expectedRandom63 =
{
0xbf, 0xf6, 0xa3, 0x41
};
static readonly byte[] _expectedRandom2352 =
{
0x08, 0xba, 0x93, 0xea
};
[Test]
public void EmptyData()

View File

@@ -38,12 +38,30 @@ namespace Aaru.Tests.Checksums;
[TestFixture]
public class Crc64
{
static readonly byte[] _expectedEmpty = { 0x60, 0x6b, 0x70, 0xa2, 0x3e, 0xba, 0xf6, 0xc2 };
static readonly byte[] _expectedRandom = { 0xbf, 0x09, 0x99, 0x2c, 0xc5, 0xed, 0xe3, 0x8e };
static readonly byte[] _expectedRandom15 = { 0x79, 0x7F, 0x37, 0x66, 0xFD, 0x93, 0x97, 0x5B };
static readonly byte[] _expectedRandom31 = { 0xCD, 0x92, 0x01, 0x90, 0x5A, 0x79, 0x37, 0xFD };
static readonly byte[] _expectedRandom63 = { 0x29, 0xF3, 0x31, 0xFC, 0x90, 0x70, 0x2B, 0xF4 };
static readonly byte[] _expectedRandom2352 = { 0x12, 0x64, 0x35, 0xDB, 0x43, 0x47, 0x76, 0x23 };
static readonly byte[] _expectedEmpty =
{
0x60, 0x6b, 0x70, 0xa2, 0x3e, 0xba, 0xf6, 0xc2
};
static readonly byte[] _expectedRandom =
{
0xbf, 0x09, 0x99, 0x2c, 0xc5, 0xed, 0xe3, 0x8e
};
static readonly byte[] _expectedRandom15 =
{
0x79, 0x7F, 0x37, 0x66, 0xFD, 0x93, 0x97, 0x5B
};
static readonly byte[] _expectedRandom31 =
{
0xCD, 0x92, 0x01, 0x90, 0x5A, 0x79, 0x37, 0xFD
};
static readonly byte[] _expectedRandom63 =
{
0x29, 0xF3, 0x31, 0xFC, 0x90, 0x70, 0x2B, 0xF4
};
static readonly byte[] _expectedRandom2352 =
{
0x12, 0x64, 0x35, 0xDB, 0x43, 0x47, 0x76, 0x23
};
[Test]
public void EmptyData()

View File

@@ -32,9 +32,6 @@ namespace Aaru.Tests;
static class Consts
{
public static string TestFilesRoot = OperatingSystem.IsWindows()
? "D:/AaruTests"
: OperatingSystem.IsMacOS()
? "/Volumes/AaruTests"
: "/mnt/AaruTests";
public static string TestFilesRoot = OperatingSystem.IsWindows() ? "D:/AaruTests" :
OperatingSystem.IsMacOS() ? "/Volumes/AaruTests" : "/mnt/AaruTests";
}

View File

@@ -40,13 +40,25 @@ namespace Aaru.Tests.Devices;
[TestFixture]
public class IomegaJaz
{
readonly string[] _testFiles = { "jaz1.bin.lz" };
readonly string[] _testFiles =
{
"jaz1.bin.lz"
};
readonly MediaType[] _mediaTypes = { MediaType.Jaz };
readonly MediaType[] _mediaTypes =
{
MediaType.Jaz
};
readonly ulong[] _sectors = { 2091050 };
readonly ulong[] _sectors =
{
2091050
};
readonly uint[] _sectorSize = { 512 };
readonly uint[] _sectorSize =
{
512
};
readonly string _dataFolder = Path.Combine(Consts.TestFilesRoot, "Device test dumps", "JAZ");

View File

@@ -40,13 +40,25 @@ namespace Aaru.Tests.Devices;
[TestFixture]
public class Ls120
{
readonly string[] _testFiles = { "ls120.bin.lz", "mf2dd.bin.lz", "mf2hd.bin.lz" };
readonly string[] _testFiles =
{
"ls120.bin.lz", "mf2dd.bin.lz", "mf2hd.bin.lz"
};
readonly MediaType[] _mediaTypes = { MediaType.LS120, MediaType.DOS_35_DS_DD_9, MediaType.DOS_35_HD };
readonly MediaType[] _mediaTypes =
{
MediaType.LS120, MediaType.DOS_35_DS_DD_9, MediaType.DOS_35_HD
};
readonly ulong[] _sectors = { 246528, 1440, 2880 };
readonly ulong[] _sectors =
{
246528, 1440, 2880
};
readonly uint[] _sectorSize = { 512, 512, 512 };
readonly uint[] _sectorSize =
{
512, 512, 512
};
readonly string _dataFolder = Path.Combine(Consts.TestFilesRoot, "Device test dumps", "LS-120");

View File

@@ -9,26 +9,50 @@ namespace Aaru.Tests.Devices.MultiMediaCard;
[TestFixture]
public class CID
{
readonly string[] cards = { "mmc_6600_32mb", "mmc_pretec_32mb", "mmc_takems_256mb" };
readonly string[] cards =
{
"mmc_6600_32mb", "mmc_pretec_32mb", "mmc_takems_256mb"
};
readonly string[] cids =
{
"15000030303030303007b20212909701", "06000033324d202020011923a457c601", "2c0000414620484d5010a9000b1a6801"
};
readonly byte[] manufacturers = { 0x15, 0x06, 0x2c };
readonly byte[] manufacturers =
{
0x15, 0x06, 0x2c
};
readonly ushort[] applications = { 0, 0, 0 };
readonly ushort[] applications =
{
0, 0, 0
};
readonly string[] names = { "000000", "32M ", "AF HMP" };
readonly string[] names =
{
"000000", "32M ", "AF HMP"
};
readonly byte[] revisions = { 0x07, 0x01, 0x10 };
readonly byte[] revisions =
{
0x07, 0x01, 0x10
};
readonly uint[] serials = { 0xb2021290, 0x1923a457, 0xa9000b1a };
readonly uint[] serials =
{
0xb2021290, 0x1923a457, 0xa9000b1a
};
readonly byte[] dates = { 0x97, 0xc6, 0x68 };
readonly byte[] dates =
{
0x97, 0xc6, 0x68
};
readonly byte[] crcs = { 0x00, 0x00, 0x00 };
readonly byte[] crcs =
{
0x00, 0x00, 0x00
};
[Test]
public void Test()

View File

@@ -11,74 +11,170 @@ namespace Aaru.Tests.Devices.MultiMediaCard;
[TestFixture]
public class CSD
{
readonly string[] cards = { "mmc_6600_32mb", "mmc_pretec_32mb", "mmc_takems_256mb" };
readonly string[] cards =
{
"mmc_6600_32mb", "mmc_pretec_32mb", "mmc_takems_256mb"
};
readonly string[] csds =
{
"8c26012a0f5901e9f6d983e392404001", "8c0e012a0ff981e9f6d981e18a400001", "905e002a1f5983d3edb683ff96400001"
};
readonly byte[] structure_versions = { 2, 2, 2 };
readonly byte[] structure_versions =
{
2, 2, 2
};
readonly byte[] spec_versions = { 3, 3, 4 };
readonly byte[] spec_versions =
{
3, 3, 4
};
readonly byte[] taacs = { 38, 14, 94 };
readonly byte[] taacs =
{
38, 14, 94
};
readonly byte[] nsacs = { 1, 1, 0 };
readonly byte[] nsacs =
{
1, 1, 0
};
readonly byte[] speeds = { 42, 42, 42 };
readonly byte[] speeds =
{
42, 42, 42
};
readonly ushort[] classes = { 245, 255, 501 };
readonly ushort[] classes =
{
245, 255, 501
};
readonly byte[] read_block_lengths = { 9, 9, 9 };
readonly byte[] read_block_lengths =
{
9, 9, 9
};
readonly bool[] read_partial_blocks = { false, true, true };
readonly bool[] read_partial_blocks =
{
false, true, true
};
readonly bool[] write_misaligned_block = { false, false, false };
readonly bool[] write_misaligned_block =
{
false, false, false
};
readonly bool[] read_misaligned_block = { false, false, false };
readonly bool[] read_misaligned_block =
{
false, false, false
};
readonly bool[] dsr_implemented = { false, false, false };
readonly bool[] dsr_implemented =
{
false, false, false
};
readonly uint[] card_sizes = { 1959, 1959, 3919 };
readonly uint[] card_sizes =
{
1959, 1959, 3919
};
readonly byte[] min_read_current = { 6, 6, 5 };
readonly byte[] min_read_current =
{
6, 6, 5
};
readonly byte[] max_read_current = { 6, 6, 5 };
readonly byte[] max_read_current =
{
6, 6, 5
};
readonly byte[] min_write_current = { 6, 6, 5 };
readonly byte[] min_write_current =
{
6, 6, 5
};
readonly byte[] max_write_current = { 6, 6, 5 };
readonly byte[] max_write_current =
{
6, 6, 5
};
readonly byte[] size_multiplier = { 3, 3, 5 };
readonly byte[] size_multiplier =
{
3, 3, 5
};
readonly byte[] sector_sizes = { 0, 0, 0 };
readonly byte[] sector_sizes =
{
0, 0, 0
};
readonly byte[] erase_sector_sizes = { 31, 15, 31 };
readonly byte[] erase_sector_sizes =
{
31, 15, 31
};
readonly byte[] write_protect_group_size = { 3, 1, 31 };
readonly byte[] write_protect_group_size =
{
3, 1, 31
};
readonly bool[] write_protect_group_enable = { true, true, true };
readonly bool[] write_protect_group_enable =
{
true, true, true
};
readonly byte[] default_eccs = { 0, 0, 0 };
readonly byte[] default_eccs =
{
0, 0, 0
};
readonly byte[] r2w_factors = { 4, 2, 5 };
readonly byte[] r2w_factors =
{
4, 2, 5
};
readonly byte[] write_block_lengths = { 9, 9, 9 };
readonly byte[] write_block_lengths =
{
9, 9, 9
};
readonly bool[] write_partial_blocks = { false, false, false };
readonly bool[] write_partial_blocks =
{
false, false, false
};
readonly bool[] file_format_group = { false, false, false };
readonly bool[] file_format_group =
{
false, false, false
};
readonly bool[] copy = { true, false, false };
readonly bool[] copy =
{
true, false, false
};
readonly bool[] permanent_write_protect = { false, false, false };
readonly bool[] permanent_write_protect =
{
false, false, false
};
readonly bool[] temporary_write_protect = { false, false, false };
readonly bool[] temporary_write_protect =
{
false, false, false
};
readonly byte[] file_format = { 0, 0, 0 };
readonly byte[] file_format =
{
0, 0, 0
};
readonly byte[] ecc = { 0, 0, 0 };
readonly byte[] ecc =
{
0, 0, 0
};
[Test]
public void Test()

View File

@@ -11,38 +11,35 @@ public class ExtendedCSD
{
new byte[]
{
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 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, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x34, 0x13, 0x00,
0x07, 0x01, 0x01, 0x00, 0x00, 0x00, 0x15, 0x1F, 0x20, 0x00, 0x00, 0x00, 0x00, 0x11, 0x05, 0x01,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x08, 0x00, 0x02, 0x00, 0x57, 0x01, 0x05, 0x0A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x01, 0x00, 0xC0, 0x33, 0x07, 0x10, 0x16, 0x00, 0x07, 0x07, 0x08, 0x01, 0x05,
0x01, 0x06, 0x20, 0x00, 0x07, 0x11, 0x1B, 0x55, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x1E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3C, 0x0A, 0x00, 0x00, 0x01, 0x00, 0x00, 0x1B, 0x01,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x20, 0x00, 0x01, 0x01, 0x01, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x1F, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x03, 0x07,
0x05, 0x00, 0x03, 0x01, 0x3F, 0x3F, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 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, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x34, 0x13, 0x00, 0x07, 0x01,
0x01, 0x00, 0x00, 0x00, 0x15, 0x1F, 0x20, 0x00, 0x00, 0x00, 0x00, 0x11, 0x05, 0x01, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x02, 0x00, 0x57, 0x01,
0x05, 0x0A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0xC0, 0x33, 0x07,
0x10, 0x16, 0x00, 0x07, 0x07, 0x08, 0x01, 0x05, 0x01, 0x06, 0x20, 0x00, 0x07, 0x11, 0x1B, 0x55, 0x05, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3C, 0x0A, 0x00, 0x00, 0x01,
0x00, 0x00, 0x1B, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x20, 0x00, 0x01, 0x01, 0x01,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x1F, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x03, 0x07, 0x05, 0x00, 0x03, 0x01, 0x3F, 0x3F, 0x01, 0x01,
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
}
};
@@ -88,124 +85,127 @@ public class ExtendedCSD
GeneralPurposePartitionSize = new byte[12],
PartitioningSetting = 0,
PartitionsAttribute = 0,
MaxEnhancedAreaSize = new byte[] { 52, 19, 0 },
PartitioningSupport = (PartitioningSupport)7,
HPIManagement = 1,
HWResetFunction = 1,
EnableBackgroundOperationsHandshake = 0,
ManuallyStartBackgroundOperations = 0,
StartSanitizeOperation = 0,
WriteReliabilityParameterRegister = 21,
WriteReliabilitySettingRegister = 31,
RPMBSize = 32,
FirmwareConfiguration = 0,
Reserved4 = 0,
UserAreaWriteProtectionRegister = 0,
Reserved5 = 0,
BootAreaWriteProtectionRegister = (BootAreaWriteProtectionRegister)17,
BootWriteProtectionStatus = 5,
HighCapacityEraseGroupDefinition = (HighCapacityEraseGroupDefinition)1,
Reserved6 = 0,
BootBusConditions = 0,
BootConfigProtection = 0,
PartitionConfiguration = 0,
Reserved7 = 0,
ErasedMemoryContent = 0,
Reserved8 = 0,
BusWidth = 0,
StrobeSupport = 1,
HighSpeedInterfaceTiming = 3,
Reserved9 = 0,
PowerClass = 0,
Reserved10 = 0,
CommandSetRevision = 0,
Reserved11 = 0,
CommandSet = 0,
Revision = 8,
Reserved12 = 0,
Structure = 2,
Reserved13 = 0,
DeviceType = (DeviceType)87,
DriverStrength = (DriverStrength)1,
OutOfInterruptBusyTiming = 5,
PartitionSwitchingTime = 10,
PowerClass52_195 = 0,
PowerClass26_195 = 0,
PowerClass52 = 0,
PowerClass26 = 0,
Reserved14 = 0,
MinimumReadPerformance26_4 = 0,
MinimumWritePerformance26_4 = 0,
MinimumReadPerformance26 = 0,
MinimumWritePerformance26 = 0,
MinimumReadPerformance52 = 0,
MinimumWritePerformance52 = 0,
SecureWriteProtectInformation = (SecureWriteProtectInformation)1,
SectorCount = 120832000,
SleepNotificationTimeout = 16,
SleepAwakeTimeout = 22,
ProductionStateAwarenessTimeout = 0,
SleepCurrentVccQ = 7,
SleepCurrentVcc = 7,
HighCapacityWriteProtectGroupSize = 8,
ReliableWriteSectorCount = 1,
HighCapacityEraseTimeout = 5,
HighCapacityEraseUnitSize = 1,
AccessSize = 6,
BootPartitionSize = 32,
Reserved15 = 0,
BootInformation = (BootInformation)7,
SecureTRIMMultiplier = 17,
SecureEraseMultiplier = 27,
SecureFeatureSupport = (SecureFeatureSupport)85,
TRIMMultiplier = 5,
Reserved16 = 0,
MinimumReadPerformanceDDR52 = 0,
MinimumWritePerformanceDDR52 = 0,
PowerClassDDR200_130 = 0,
PowerClassDDR200_195 = 0,
PowerClassDDR52_195 = 0,
PowerClassDDR52 = 0,
CacheFlushingPolicy = 0,
InitializationTimeAfterPartition = 30,
CorrectlyProgrammedSectors = 0,
BackgroundOperationsStatus = 0,
PowerOffNotificationTimeout = 60,
GenericCMD6Timeout = 10,
CacheSize = 65536,
PowerClassDDR200 = 0,
FirmwareVersion = 283,
DeviceVersion = 0,
OptimalTrimUnitSize = 1,
OptimalWriteSize = 32,
OptimalReadSize = 0,
PreEOLInformation = 1,
DeviceLifeEstimationTypeA = 1,
DeviceLifeEstimationTypeB = 1,
VendorHealthReport = new byte[32],
NumberOfFWSectorsCorrectlyProgrammed = 0,
Reserved17 = 0,
CMDQueuingDepth = 31,
CMDQueuingSupport = (CMDQueuingSupport)1,
Reserved18 = new byte[177],
BarrierSupport = 0,
FFUArgument = 0,
OperationCodesTimeout = 0,
FFUFeatures = 0,
SupportedModes = (SupportedModes)3,
ExtendedPartitionsSupport = (ExtendedPartitionsSupport)3,
LargeUnitSize = 7,
ContextManagementCaps = 5,
TagResourcesSize = 0,
TagUnitSize = 3,
DataTagSupport = (DataTagSupport)1,
MaxPackedWriteCommands = 63,
MaxPackedReadCommands = 63,
BackgroundOperationsSupport = (BackgroundOperationsSupport)1,
HPIFeatures = (HPIFeatures)1,
SupportedCommandSets = (DeviceSupportedCommandSets)1,
ExtendedSecurityCommandsError = 0,
Reserved19 = new byte[6]
MaxEnhancedAreaSize = new byte[]
{
52, 19, 0
},
PartitioningSupport = (PartitioningSupport)7,
HPIManagement = 1,
HWResetFunction = 1,
EnableBackgroundOperationsHandshake = 0,
ManuallyStartBackgroundOperations = 0,
StartSanitizeOperation = 0,
WriteReliabilityParameterRegister = 21,
WriteReliabilitySettingRegister = 31,
RPMBSize = 32,
FirmwareConfiguration = 0,
Reserved4 = 0,
UserAreaWriteProtectionRegister = 0,
Reserved5 = 0,
BootAreaWriteProtectionRegister = (BootAreaWriteProtectionRegister)17,
BootWriteProtectionStatus = 5,
HighCapacityEraseGroupDefinition = (HighCapacityEraseGroupDefinition)1,
Reserved6 = 0,
BootBusConditions = 0,
BootConfigProtection = 0,
PartitionConfiguration = 0,
Reserved7 = 0,
ErasedMemoryContent = 0,
Reserved8 = 0,
BusWidth = 0,
StrobeSupport = 1,
HighSpeedInterfaceTiming = 3,
Reserved9 = 0,
PowerClass = 0,
Reserved10 = 0,
CommandSetRevision = 0,
Reserved11 = 0,
CommandSet = 0,
Revision = 8,
Reserved12 = 0,
Structure = 2,
Reserved13 = 0,
DeviceType = (DeviceType)87,
DriverStrength = (DriverStrength)1,
OutOfInterruptBusyTiming = 5,
PartitionSwitchingTime = 10,
PowerClass52_195 = 0,
PowerClass26_195 = 0,
PowerClass52 = 0,
PowerClass26 = 0,
Reserved14 = 0,
MinimumReadPerformance26_4 = 0,
MinimumWritePerformance26_4 = 0,
MinimumReadPerformance26 = 0,
MinimumWritePerformance26 = 0,
MinimumReadPerformance52 = 0,
MinimumWritePerformance52 = 0,
SecureWriteProtectInformation = (SecureWriteProtectInformation)1,
SectorCount = 120832000,
SleepNotificationTimeout = 16,
SleepAwakeTimeout = 22,
ProductionStateAwarenessTimeout = 0,
SleepCurrentVccQ = 7,
SleepCurrentVcc = 7,
HighCapacityWriteProtectGroupSize = 8,
ReliableWriteSectorCount = 1,
HighCapacityEraseTimeout = 5,
HighCapacityEraseUnitSize = 1,
AccessSize = 6,
BootPartitionSize = 32,
Reserved15 = 0,
BootInformation = (BootInformation)7,
SecureTRIMMultiplier = 17,
SecureEraseMultiplier = 27,
SecureFeatureSupport = (SecureFeatureSupport)85,
TRIMMultiplier = 5,
Reserved16 = 0,
MinimumReadPerformanceDDR52 = 0,
MinimumWritePerformanceDDR52 = 0,
PowerClassDDR200_130 = 0,
PowerClassDDR200_195 = 0,
PowerClassDDR52_195 = 0,
PowerClassDDR52 = 0,
CacheFlushingPolicy = 0,
InitializationTimeAfterPartition = 30,
CorrectlyProgrammedSectors = 0,
BackgroundOperationsStatus = 0,
PowerOffNotificationTimeout = 60,
GenericCMD6Timeout = 10,
CacheSize = 65536,
PowerClassDDR200 = 0,
FirmwareVersion = 283,
DeviceVersion = 0,
OptimalTrimUnitSize = 1,
OptimalWriteSize = 32,
OptimalReadSize = 0,
PreEOLInformation = 1,
DeviceLifeEstimationTypeA = 1,
DeviceLifeEstimationTypeB = 1,
VendorHealthReport = new byte[32],
NumberOfFWSectorsCorrectlyProgrammed = 0,
Reserved17 = 0,
CMDQueuingDepth = 31,
CMDQueuingSupport = (CMDQueuingSupport)1,
Reserved18 = new byte[177],
BarrierSupport = 0,
FFUArgument = 0,
OperationCodesTimeout = 0,
FFUFeatures = 0,
SupportedModes = (SupportedModes)3,
ExtendedPartitionsSupport = (ExtendedPartitionsSupport)3,
LargeUnitSize = 7,
ContextManagementCaps = 5,
TagResourcesSize = 0,
TagUnitSize = 3,
DataTagSupport = (DataTagSupport)1,
MaxPackedWriteCommands = 63,
MaxPackedReadCommands = 63,
BackgroundOperationsSupport = (BackgroundOperationsSupport)1,
HPIFeatures = (HPIFeatures)1,
SupportedCommandSets = (DeviceSupportedCommandSets)1,
ExtendedSecurityCommandsError = 0,
Reserved19 = new byte[6]
}
};

View File

@@ -40,13 +40,25 @@ namespace Aaru.Tests.Devices;
[TestFixture]
public class PocketZip
{
readonly string[] _testFiles = { "clik!.bin.lz", "pocketzip.bin.lz" };
readonly string[] _testFiles =
{
"clik!.bin.lz", "pocketzip.bin.lz"
};
readonly MediaType[] _mediaTypes = { MediaType.PocketZip, MediaType.PocketZip };
readonly MediaType[] _mediaTypes =
{
MediaType.PocketZip, MediaType.PocketZip
};
readonly ulong[] _sectors = { 78882, 78882 };
readonly ulong[] _sectors =
{
78882, 78882
};
readonly uint[] _sectorSize = { 512, 512 };
readonly uint[] _sectorSize =
{
512, 512
};
readonly string _dataFolder = Path.Combine(Consts.TestFilesRoot, "Device test dumps", "PocketZIP");

View File

@@ -40,7 +40,10 @@ public class CID
"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 =
{
@@ -53,7 +56,10 @@ public class CID
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

@@ -25,11 +25,20 @@ public class CSD
"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 =
{
@@ -37,9 +46,15 @@ public class CSD
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 =
{
@@ -66,31 +81,55 @@ public class CSD
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 =
{
@@ -112,7 +151,10 @@ public class CSD
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

@@ -24,44 +24,114 @@ public class SCR
"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 }
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
}
};
[Test]

View File

@@ -275,8 +275,7 @@ public abstract class ReadOnlyFilesystemTest : FilesystemTest
if(ret != ErrorNumber.NoError)
return children;
while(fs.ReadDir(node, out string child) == ErrorNumber.NoError &&
child is not null)
while(fs.ReadDir(node, out string child) == ErrorNumber.NoError && child is not null)
{
var childPath = $"{path}/{child}";
fs.Stat(childPath, out FileEntryInfo stat);
@@ -300,8 +299,7 @@ public abstract class ReadOnlyFilesystemTest : FilesystemTest
else
data.Md5 = BuildFile(fs, childPath, stat.Length);
if(fs.ListXAttr(childPath, out List<string> xattrs) == ErrorNumber.NoError &&
xattrs.Count > 0)
if(fs.ListXAttr(childPath, out List<string> xattrs) == ErrorNumber.NoError && xattrs.Count > 0)
data.XattrsWithMd5 = BuildFileXattrs(fs, childPath);
children[child] = data;
@@ -372,14 +370,12 @@ public abstract class ReadOnlyFilesystemTest : FilesystemTest
List<string> contents = new();
while(fs.ReadDir(node, out string filename) == ErrorNumber.NoError &&
filename is not null)
while(fs.ReadDir(node, out string filename) == ErrorNumber.NoError && filename is not null)
contents.Add(filename);
fs.CloseDir(node);
if(children.Count == 0 &&
contents.Count == 0)
if(children.Count == 0 && contents.Count == 0)
return;
if(path == "/")
@@ -440,8 +436,9 @@ public abstract class ReadOnlyFilesystemTest : FilesystemTest
stat.StatusChangeTimeUtc = child.Value.Info.StatusChangeTimeUtc;
}
stat.Should().BeEquivalentTo(child.Value.Info,
string.Format(Localization.Wrong_info_for_0_in_1, childPath, testFile));
stat.Should().
BeEquivalentTo(child.Value.Info,
string.Format(Localization.Wrong_info_for_0_in_1, childPath, testFile));
byte[] buffer = Array.Empty<byte>();
@@ -457,9 +454,8 @@ public abstract class ReadOnlyFilesystemTest : FilesystemTest
{
Assert.IsNotNull(child.Value.Children,
string.
Format(
Localization.Contents_for_0_in_1_must_be_defined_in_unit_test_declaration,
childPath, testFile));
Format(Localization.Contents_for_0_in_1_must_be_defined_in_unit_test_declaration,
childPath, testFile));
if(child.Value.Children != null)
{
@@ -495,10 +491,8 @@ public abstract class ReadOnlyFilesystemTest : FilesystemTest
{
Assert.IsNull(child.Value.XattrsWithMd5,
string.
Format(
Localization.
Defined_extended_attributes_for_0_in_1_are_not_supported_by_filesystem,
childPath, testFile));
Format(Localization.Defined_extended_attributes_for_0_in_1_are_not_supported_by_filesystem,
childPath, testFile));
continue;
}
@@ -511,14 +505,11 @@ public abstract class ReadOnlyFilesystemTest : FilesystemTest
{
Assert.IsNotNull(child.Value.XattrsWithMd5,
string.
Format(
Localization.
Extended_attributes_for_0_in_1_must_be_defined_in_unit_test_declaration,
childPath, testFile));
Format(Localization.Extended_attributes_for_0_in_1_must_be_defined_in_unit_test_declaration,
childPath, testFile));
}
if(xattrs.Count > 0 ||
child.Value.XattrsWithMd5?.Count > 0)
if(xattrs.Count > 0 || child.Value.XattrsWithMd5?.Count > 0)
TestFileXattrs(fs, childPath, child.Value.XattrsWithMd5, testFile);
}
@@ -567,8 +558,7 @@ public abstract class ReadOnlyFilesystemTest : FilesystemTest
fs.ListXAttr(path, out List<string> contents);
if(xattrs.Count == 0 &&
contents.Count == 0)
if(xattrs.Count == 0 && contents.Count == 0)
return;
List<string> expectedNotFound = new();
@@ -578,8 +568,7 @@ public abstract class ReadOnlyFilesystemTest : FilesystemTest
byte[] buffer = Array.Empty<byte>();
ErrorNumber ret = fs.GetXattr(path, xattr.Key, ref buffer);
if(ret == ErrorNumber.NoSuchExtendedAttribute ||
!contents.Contains(xattr.Key))
if(ret == ErrorNumber.NoSuchExtendedAttribute || !contents.Contains(xattr.Key))
{
expectedNotFound.Add(xattr.Key);

View File

@@ -16,8 +16,18 @@ public class Marshal
{
0x27, 0x50, 0x48, 0x53, 0x44, 0x31, 0x36, 0x47, 0x60, 0x01, 0x1a, 0x77, 0xd2, 0x01, 0x47, 0x01
},
new byte[] { 0x02, 0x35, 0x80, 0x00, 0x01, 0x00, 0x00, 0x00 }, new byte[] { 0xba, 0xbe, 0xfa, 0xce },
new byte[] { 0xce, 0xfa, 0xad, 0xde }
new byte[]
{
0x02, 0x35, 0x80, 0x00, 0x01, 0x00, 0x00, 0x00
},
new byte[]
{
0xba, 0xbe, 0xfa, 0xce
},
new byte[]
{
0xce, 0xfa, 0xad, 0xde
}
};
[Test]

View File

@@ -197,17 +197,13 @@ public abstract class BlockMediaImageTest : BaseMediaImageTest
Assert.AreEqual(expectedPartition.Start, foundPartition.Start,
string.
Format(
Localization.
Expected_partition_0_to_start_at_sector_1_but_found_it_starts_at_2_in_3,
i, expectedPartition.Start, foundPartition.Start, testFile));
Format(Localization.Expected_partition_0_to_start_at_sector_1_but_found_it_starts_at_2_in_3,
i, expectedPartition.Start, foundPartition.Start, testFile));
Assert.AreEqual(expectedPartition.Length, foundPartition.Length,
string.
Format(
Localization.
Expected_partition_0_to_have_1_sectors_but_found_it_has_2_sectors_in_3,
i, expectedPartition.Length, foundPartition.Length, testFile));
Format(Localization.Expected_partition_0_to_have_1_sectors_but_found_it_has_2_sectors_in_3,
i, expectedPartition.Length, foundPartition.Length, testFile));
var expectedDataFilename = $"{testFile}.contents.partition{i}.json";

View File

@@ -81,19 +81,23 @@ public abstract class OpticalMediaImageTest : BaseMediaImageTest
Assert.AreEqual(test.Tracks.Length, image.Tracks.Count,
string.Format(Localization.Tracks_0, testFile));
image.Tracks.Select(t => t.Session).Should().
image.Tracks.Select(t => t.Session).
Should().
BeEquivalentTo(test.Tracks.Select(s => s.Session),
string.Format(Localization.Track_session_0, testFile));
image.Tracks.Select(t => t.StartSector).Should().
image.Tracks.Select(t => t.StartSector).
Should().
BeEquivalentTo(test.Tracks.Select(s => s.Start),
string.Format(Localization.Track_start_0, testFile));
image.Tracks.Select(t => t.EndSector).Should().
image.Tracks.Select(t => t.EndSector).
Should().
BeEquivalentTo(test.Tracks.Select(s => s.End),
string.Format(Localization.Track_end_0, testFile));
image.Tracks.Select(t => t.Pregap).Should().
image.Tracks.Select(t => t.Pregap).
Should().
BeEquivalentTo(test.Tracks.Select(s => s.Pregap),
string.Format(Localization.Track_pregap_0, testFile));
@@ -122,8 +126,9 @@ public abstract class OpticalMediaImageTest : BaseMediaImageTest
trackNo++;
}
flags.Should().BeEquivalentTo(test.Tracks.Select(s => s.Flags),
string.Format(Localization.Track_flags_0, testFile));
flags.Should().
BeEquivalentTo(test.Tracks.Select(s => s.Flags),
string.Format(Localization.Track_flags_0, testFile));
Assert.AreEqual(latestEndSector, image.Info.Sectors - 1,
string.Format(Localization.Last_sector_for_tracks_is_0_but_it_is_1_for_image,
@@ -177,8 +182,7 @@ public abstract class OpticalMediaImageTest : BaseMediaImageTest
ulong trackStart = track.Start + track.Pregap;
if(track.Number <= 1 &&
track.Pregap >= 150)
if(track.Number <= 1 && track.Pregap >= 150)
trackStart -= 150;
var partition = new Partition
@@ -250,10 +254,8 @@ public abstract class OpticalMediaImageTest : BaseMediaImageTest
{
Assert.NotNull(null,
string.
Format(
Localization.
Could_not_instantiate_filesystem_for_0_track_1_filesystem_2,
testFile, track.Number, i));
Format(Localization.Could_not_instantiate_filesystem_for_0_track_1_filesystem_2,
testFile, track.Number, i));
}
continue;
@@ -375,7 +377,10 @@ public abstract class OpticalMediaImageTest : BaseMediaImageTest
if(image.Info.MetadataMediaType == MetadataMediaType.OpticalDisc)
{
foreach(bool @long in new[] { false, true })
foreach(bool @long in new[]
{
false, true
})
{
ctx = new Md5Context();

View File

@@ -139,10 +139,9 @@ public abstract class FsExtractHashIssueTest
Assert.AreEqual(expectedData.Partitions[i].Volumes[j].VolumeName, fs.Metadata.VolumeName,
string.
Format(
Localization.Excepted_volume_name_0_for_filesystem_1_in_partition_2_but_found_3,
expectedData.Partitions[i].Volumes[j].VolumeName, j, i,
fs.Metadata.VolumeName));
Format(Localization.Excepted_volume_name_0_for_filesystem_1_in_partition_2_but_found_3,
expectedData.Partitions[i].Volumes[j].VolumeName, j, i,
fs.Metadata.VolumeName));
VolumeData volumeData = expectedData.Partitions[i].Volumes[j];
@@ -168,8 +167,7 @@ public abstract class FsExtractHashIssueTest
Assert.AreEqual(ErrorNumber.NoError, error,
string.Format(Localization.Error_0_reading_root_directory, error.ToString()));
while(fs.ReadDir(node, out string entry) == ErrorNumber.NoError &&
entry is not null)
while(fs.ReadDir(node, out string entry) == ErrorNumber.NoError && entry is not null)
{
error = fs.Stat(path + "/" + entry, out FileEntryInfo stat);
@@ -251,10 +249,8 @@ public abstract class FsExtractHashIssueTest
}
expectedXattrs.Should().
BeEmpty(
string.Format(Localization.Expected_extended_attributes_not_found_for_file_0,
path + "/" + entry),
expectedXattrs);
BeEmpty(string.Format(Localization.Expected_extended_attributes_not_found_for_file_0, path + "/" + entry),
expectedXattrs);
}
var buffer = new byte[stat.Length];

View File

@@ -88,8 +88,7 @@ public abstract class FsExtractIssueTest
var fs = Activator.CreateInstance(pluginType) as IReadOnlyFilesystem;
Assert.IsNotNull(fs,
string.Format(Localization.Could_not_instantiate_filesystem_0, pluginName));
Assert.IsNotNull(fs, string.Format(Localization.Could_not_instantiate_filesystem_0, pluginName));
filesystemFound = true;
@@ -136,8 +135,7 @@ public abstract class FsExtractIssueTest
Assert.AreEqual(ErrorNumber.NoError, error,
string.Format(Localization.Error_0_reading_root_directory, error.ToString()));
while(fs.ReadDir(node, out string entry) == ErrorNumber.NoError &&
entry is not null)
while(fs.ReadDir(node, out string entry) == ErrorNumber.NoError && entry is not null)
{
error = fs.Stat(path + "/" + entry, out FileEntryInfo stat);

View File

@@ -75,10 +75,8 @@ public abstract class OpticalImageConvertIssueTest
Assert.IsNotNull(outputOptical, Localization.Could_not_treat_new_image_as_optical_disc);
Assert.IsNotNull(inputOptical.Tracks, Localization.Existing_image_contains_no_tracks);
Assert.IsTrue(
outputOptical.Create(outputPath, inputFormat.Info.MediaType, ParsedOptions, inputFormat.Info.Sectors,
inputFormat.Info.SectorSize),
string.Format(Localization.Error_0_creating_output_image, outputOptical.ErrorMessage));
Assert.IsTrue(outputOptical.Create(outputPath, inputFormat.Info.MediaType, ParsedOptions, inputFormat.Info.Sectors, inputFormat.Info.SectorSize),
string.Format(Localization.Error_0_creating_output_image, outputOptical.ErrorMessage));
var metadata = new ImageInfo
{
@@ -107,7 +105,7 @@ public abstract class OpticalImageConvertIssueTest
List<DumpHardware> dumpHardware = inputFormat.DumpHardware;
foreach(MediaTagType mediaTag in inputFormat.Info.ReadableMediaTags.Where(mediaTag =>
outputOptical.SupportedMediaTags.Contains(mediaTag)))
outputOptical.SupportedMediaTags.Contains(mediaTag)))
{
AaruConsole.WriteLine(Localization.Converting_media_tag_0, mediaTag);
errno = inputFormat.ReadMediaTag(mediaTag, out byte[] tag);
@@ -158,8 +156,7 @@ public abstract class OpticalImageConvertIssueTest
else
result = true;
if(!result &&
sector.Length % 2352 != 0)
if(!result && sector.Length % 2352 != 0)
useNotLong = true;
}
@@ -371,16 +368,16 @@ public abstract class OpticalImageConvertIssueTest
if(trackFlags.Count > 0)
{
foreach((byte track, byte flags) in trackFlags)
{
outputOptical.WriteSectorTag(new[] { flags }, track, SectorTagType.CdTrackFlags);
}
outputOptical.WriteSectorTag(new[]
{
flags
}, track, SectorTagType.CdTrackFlags);
}
if(mcn != null)
outputOptical.WriteMediaTag(Encoding.UTF8.GetBytes(mcn), MediaTagType.CD_MCN);
if(resume != null ||
dumpHardware != null)
if(resume != null || dumpHardware != null)
{
if(resume != null)
outputOptical.SetDumpHardware(resume.Tries);
@@ -388,8 +385,7 @@ public abstract class OpticalImageConvertIssueTest
outputOptical.SetDumpHardware(dumpHardware);
}
if(sidecar != null ||
aaruMetadata != null)
if(sidecar != null || aaruMetadata != null)
{
if(sidecar != null)
outputOptical.SetMetadata(sidecar);

View File

@@ -76,19 +76,23 @@ public abstract class WritableOpticalMediaImageTest : BaseWritableMediaImageTest
Assert.AreEqual(test.Tracks.Length, image.Tracks.Count,
string.Format(Localization.Tracks_0, testFile));
image.Tracks.Select(t => t.Session).Should().
image.Tracks.Select(t => t.Session).
Should().
BeEquivalentTo(test.Tracks.Select(s => s.Session),
string.Format(Localization.Track_session_0, testFile));
image.Tracks.Select(t => t.StartSector).Should().
image.Tracks.Select(t => t.StartSector).
Should().
BeEquivalentTo(test.Tracks.Select(s => s.Start),
string.Format(Localization.Track_start_0, testFile));
image.Tracks.Select(t => t.EndSector).Should().
image.Tracks.Select(t => t.EndSector).
Should().
BeEquivalentTo(test.Tracks.Select(s => s.End),
string.Format(Localization.Track_end_0, testFile));
image.Tracks.Select(t => t.Pregap).Should().
image.Tracks.Select(t => t.Pregap).
Should().
BeEquivalentTo(test.Tracks.Select(s => s.Pregap),
string.Format(Localization.Track_pregap_0, testFile));
@@ -114,8 +118,9 @@ public abstract class WritableOpticalMediaImageTest : BaseWritableMediaImageTest
trackNo++;
}
flags.Should().BeEquivalentTo(test.Tracks.Select(s => s.Flags),
string.Format(Localization.Track_flags_0, testFile));
flags.Should().
BeEquivalentTo(test.Tracks.Select(s => s.Flags),
string.Format(Localization.Track_flags_0, testFile));
Assert.AreEqual(latestEndSector, image.Info.Sectors - 1,
string.Format(Localization.Last_sector_for_tracks_is_0_but_it_is_1_for_image,
@@ -172,23 +177,27 @@ public abstract class WritableOpticalMediaImageTest : BaseWritableMediaImageTest
string.Format(Localization.Trying_to_convert_unsupported_media_type_0_for_1,
inputFormat.Info.MediaType, testFile));
bool useLong = inputFormat.Info.ReadableSectorTags.Except(new[] { SectorTagType.CdTrackFlags }).Any();
bool useLong = inputFormat.Info.ReadableSectorTags.Except(new[]
{
SectorTagType.CdTrackFlags
}).
Any();
// TODO: Can be done with LINQ only
foreach(SectorTagType _ in inputFormat.Info.ReadableSectorTags.Where(sectorTag =>
!outputFormat.SupportedSectorTags.Contains(sectorTag)).Where(
sectorTag => sectorTag != SectorTagType.CdTrackFlags &&
sectorTag != SectorTagType.CdTrackIsrc &&
sectorTag != SectorTagType.CdSectorSubchannel))
foreach(SectorTagType _ in inputFormat.Info.ReadableSectorTags.
Where(sectorTag =>
!outputFormat.SupportedSectorTags.Contains(sectorTag)).
Where(sectorTag =>
sectorTag != SectorTagType.CdTrackFlags &&
sectorTag != SectorTagType.CdTrackIsrc &&
sectorTag != SectorTagType.CdSectorSubchannel))
useLong = false;
Assert.IsTrue(
outputFormat.Create(outputPath, inputFormat.Info.MediaType, new Dictionary<string, string>(),
inputFormat.Info.Sectors, inputFormat.Info.SectorSize),
string.Format(Localization.Error_0_creating_output_image, outputFormat.ErrorMessage));
Assert.IsTrue(outputFormat.Create(outputPath, inputFormat.Info.MediaType, new Dictionary<string, string>(), inputFormat.Info.Sectors, inputFormat.Info.SectorSize),
string.Format(Localization.Error_0_creating_output_image, outputFormat.ErrorMessage));
foreach(MediaTagType mediaTag in inputFormat.Info.ReadableMediaTags.Where(mediaTag =>
outputFormat.SupportedMediaTags.Contains(mediaTag)))
outputFormat.SupportedMediaTags.Contains(mediaTag)))
{
if(inputFormat.ReadMediaTag(mediaTag, out byte[] buffer) == ErrorNumber.NoError)
outputFormat.WriteMediaTag(buffer, mediaTag);
@@ -236,8 +245,7 @@ public abstract class WritableOpticalMediaImageTest : BaseWritableMediaImageTest
else
result = false;
if(!result &&
sector.Length % 2352 != 0)
if(!result && sector.Length % 2352 != 0)
useNotLong = true;
}
@@ -293,7 +301,8 @@ public abstract class WritableOpticalMediaImageTest : BaseWritableMediaImageTest
}
foreach(SectorTagType tag in inputFormat.Info.ReadableSectorTags.
Where(t => t == SectorTagType.CdTrackIsrc).OrderBy(t => t))
Where(t => t == SectorTagType.CdTrackIsrc).
OrderBy(t => t))
{
foreach(Track track in tracks)
{
@@ -307,7 +316,8 @@ public abstract class WritableOpticalMediaImageTest : BaseWritableMediaImageTest
}
foreach(SectorTagType tag in inputFormat.Info.ReadableSectorTags.
Where(t => t == SectorTagType.CdTrackFlags).OrderBy(t => t))
Where(t => t == SectorTagType.CdTrackFlags).
OrderBy(t => t))
{
foreach(Track track in tracks)
{
@@ -454,7 +464,10 @@ public abstract class WritableOpticalMediaImageTest : BaseWritableMediaImageTest
if(trackFlags.Count > 0)
{
foreach((byte track, byte flags) in trackFlags)
outputFormat.WriteSectorTag(new[] { flags }, track, SectorTagType.CdTrackFlags);
outputFormat.WriteSectorTag(new[]
{
flags
}, track, SectorTagType.CdTrackFlags);
}
if(mcn != null)
@@ -463,20 +476,17 @@ public abstract class WritableOpticalMediaImageTest : BaseWritableMediaImageTest
// TODO: Progress
if(inputFormat.Info.MediaType is MediaType.CD or MediaType.CDDA or MediaType.CDG or MediaType.CDEG
or MediaType.CDI or MediaType.CDROM or MediaType.CDROMXA
or MediaType.CDPLUS or MediaType.CDMO
or MediaType.CDR or MediaType.CDRW or MediaType.CDMRW or MediaType.VCD
or MediaType.SVCD
or MediaType.PCD or MediaType.DTSCD or MediaType.CDMIDI or MediaType.CDV
or MediaType.CDIREADY
or MediaType.FMTOWNS or MediaType.PS1CD or MediaType.PS2CD
or MediaType.MEGACD or MediaType.SATURNCD
or MediaType.CDPLUS or MediaType.CDMO or MediaType.CDR or MediaType.CDRW
or MediaType.CDMRW or MediaType.VCD or MediaType.SVCD or MediaType.PCD
or MediaType.DTSCD or MediaType.CDMIDI or MediaType.CDV
or MediaType.CDIREADY or MediaType.FMTOWNS or MediaType.PS1CD
or MediaType.PS2CD or MediaType.MEGACD or MediaType.SATURNCD
or MediaType.GDROM or MediaType.GDR or MediaType.MilCD
or MediaType.SuperCDROM2 or MediaType.JaguarCD
or MediaType.ThreeDO or MediaType.PCFX or MediaType.NeoGeoCD
or MediaType.CDTV or MediaType.CD32
or MediaType.Playdia or MediaType.Pippin or MediaType.VideoNow
or MediaType.VideoNowColor
or MediaType.VideoNowXp or MediaType.CVD)
or MediaType.SuperCDROM2 or MediaType.JaguarCD or MediaType.ThreeDO
or MediaType.PCFX or MediaType.NeoGeoCD or MediaType.CDTV
or MediaType.CD32 or MediaType.Playdia or MediaType.Pippin
or MediaType.VideoNow or MediaType.VideoNowColor or MediaType.VideoNowXp
or MediaType.CVD)
{
CompactDisc.GenerateSubchannels(subchannelExtents, tracks, trackFlags, inputFormat.Info.Sectors,
null, null, null, null, null, outputFormat);
@@ -518,19 +528,23 @@ public abstract class WritableOpticalMediaImageTest : BaseWritableMediaImageTest
Assert.AreEqual(test.Tracks.Length, image.Tracks.Count,
string.Format(Localization.Tracks_output_0, testFile));
image.Tracks.Select(t => t.Session).Should().
image.Tracks.Select(t => t.Session).
Should().
BeEquivalentTo(test.Tracks.Select(s => s.Session),
string.Format(Localization.Track_session_output_0, testFile));
image.Tracks.Select(t => t.StartSector).Should().
image.Tracks.Select(t => t.StartSector).
Should().
BeEquivalentTo(test.Tracks.Select(s => s.Start),
string.Format(Localization.Track_start_output_0, testFile));
image.Tracks.Select(t => t.EndSector).Should().
image.Tracks.Select(t => t.EndSector).
Should().
BeEquivalentTo(test.Tracks.Select(s => s.End),
string.Format(Localization.Track_end_output_0, testFile));
image.Tracks.Select(t => t.Pregap).Should().
image.Tracks.Select(t => t.Pregap).
Should().
BeEquivalentTo(test.Tracks.Select(s => s.Pregap),
string.Format(Localization.Track_pregap_output_0, testFile));
@@ -556,23 +570,23 @@ public abstract class WritableOpticalMediaImageTest : BaseWritableMediaImageTest
trackNo++;
}
flags.Should().BeEquivalentTo(test.Tracks.Select(s => s.Flags),
string.Format(Localization.Track_flags_output_0, testFile));
flags.Should().
BeEquivalentTo(test.Tracks.Select(s => s.Flags),
string.Format(Localization.Track_flags_output_0, testFile));
Assert.AreEqual(latestEndSector, image.Info.Sectors - 1,
string.
Format(
Localization.Last_sector_for_tracks_is_0_but_it_is_1_for_image_output,
latestEndSector, image.Info.Sectors));
Format(Localization.Last_sector_for_tracks_is_0_but_it_is_1_for_image_output,
latestEndSector, image.Info.Sectors));
});
}
Md5Context ctx;
foreach(bool @long in new[]
{
/*false,*/ true
})
{
/*false,*/ true
})
{
ctx = new Md5Context();
@@ -588,8 +602,8 @@ public abstract class WritableOpticalMediaImageTest : BaseWritableMediaImageTest
if(sectors - doneSectors >= SECTORS_TO_READ)
{
errno = @long
? image.ReadSectorsLong(doneSectors, SECTORS_TO_READ,
currentTrack.Sequence, out sector)
? image.ReadSectorsLong(doneSectors, SECTORS_TO_READ, currentTrack.Sequence,
out sector)
: image.ReadSectors(doneSectors, SECTORS_TO_READ, currentTrack.Sequence,
out sector);