diff --git a/Aaru.Core/Devices/Dumping/Sbc/Cache.cs b/Aaru.Core/Devices/Dumping/Sbc/Cache.cs index f139f0f95..98da25532 100644 --- a/Aaru.Core/Devices/Dumping/Sbc/Cache.cs +++ b/Aaru.Core/Devices/Dumping/Sbc/Cache.cs @@ -125,7 +125,7 @@ partial class Dump if(key.All(static k => k == 0)) { - outputFormat.WriteSectorTag([0, 0, 0, 0, 0], i + j, false, SectorTagType.DvdTitleKeyDecrypted); + outputFormat.WriteSectorTag(new byte[5], i + j, false, SectorTagType.DvdTitleKeyDecrypted); _resume.MissingTitleKeys?.Remove(i + j); diff --git a/Aaru.Core/Devices/Dumping/Sbc/Data.cs b/Aaru.Core/Devices/Dumping/Sbc/Data.cs index 38f5332ce..57926f39d 100644 --- a/Aaru.Core/Devices/Dumping/Sbc/Data.cs +++ b/Aaru.Core/Devices/Dumping/Sbc/Data.cs @@ -143,12 +143,9 @@ partial class Dump // not encrypted even if the CMI says it is. if(titleKey.Value.Key.All(static k => k == 0)) { - outputFormat.WriteSectorTag([0, 0, 0, 0, 0], i + j, false, SectorTagType.DvdSectorTitleKey); + outputFormat.WriteSectorTag(new byte[5], i + j, false, SectorTagType.DvdSectorTitleKey); - outputFormat.WriteSectorTag([0, 0, 0, 0, 0], - i + j, - false, - SectorTagType.DvdTitleKeyDecrypted); + outputFormat.WriteSectorTag(new byte[5], i + j, false, SectorTagType.DvdTitleKeyDecrypted); _resume.MissingTitleKeys.Remove(i + j); diff --git a/Aaru.Core/Devices/Dumping/Sbc/Error.cs b/Aaru.Core/Devices/Dumping/Sbc/Error.cs index 5019f8866..4afb35840 100644 --- a/Aaru.Core/Devices/Dumping/Sbc/Error.cs +++ b/Aaru.Core/Devices/Dumping/Sbc/Error.cs @@ -314,10 +314,7 @@ partial class Dump if(key.All(static k => k == 0)) { - outputFormat.WriteSectorTag([0, 0, 0, 0, 0], - badSector, - false, - SectorTagType.DvdTitleKeyDecrypted); + outputFormat.WriteSectorTag(new byte[5], badSector, false, SectorTagType.DvdTitleKeyDecrypted); _resume.MissingTitleKeys?.Remove(badSector); } @@ -449,9 +446,9 @@ partial class Dump // If the decoded title key is zeroed, there should be no copy protection if((titleKey.Value.CMI & 0x80) >> 7 == 0 || titleKey.Value.Key.All(static k => k == 0)) { - outputFormat.WriteSectorTag([0, 0, 0, 0, 0], missingKey, false, SectorTagType.DvdSectorTitleKey); + outputFormat.WriteSectorTag(new byte[5], missingKey, false, SectorTagType.DvdSectorTitleKey); - outputFormat.WriteSectorTag([0, 0, 0, 0, 0], missingKey, false, SectorTagType.DvdTitleKeyDecrypted); + outputFormat.WriteSectorTag(new byte[5], missingKey, false, SectorTagType.DvdTitleKeyDecrypted); _resume.MissingTitleKeys.Remove(missingKey); diff --git a/Aaru.Core/Devices/Dumping/Sbc/Trim.cs b/Aaru.Core/Devices/Dumping/Sbc/Trim.cs index 0cfb2985e..d268da001 100644 --- a/Aaru.Core/Devices/Dumping/Sbc/Trim.cs +++ b/Aaru.Core/Devices/Dumping/Sbc/Trim.cs @@ -107,7 +107,7 @@ partial class Dump if(key.All(static k => k == 0)) { - outputFormat.WriteSectorTag([0, 0, 0, 0, 0], badSector, false, SectorTagType.DvdTitleKeyDecrypted); + outputFormat.WriteSectorTag(new byte[5], badSector, false, SectorTagType.DvdTitleKeyDecrypted); _resume.MissingTitleKeys?.Remove(badSector); } diff --git a/Aaru.Images/A2R/Write.cs b/Aaru.Images/A2R/Write.cs index 4ed0458f5..a3dc70714 100644 --- a/Aaru.Images/A2R/Write.cs +++ b/Aaru.Images/A2R/Write.cs @@ -277,7 +277,7 @@ public sealed partial class A2R _writingStream.WriteByte(1); _writingStream.Write(BitConverter.GetBytes(_currentResolution), 0, 4); - byte[] reserved = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]; + var reserved = new byte[11]; _writingStream.Write(reserved, 0, 11); diff --git a/Aaru.Images/Alcohol120/Read.cs b/Aaru.Images/Alcohol120/Read.cs index 4d6cd3e68..76020b904 100644 --- a/Aaru.Images/Alcohol120/Read.cs +++ b/Aaru.Images/Alcohol120/Read.cs @@ -676,7 +676,7 @@ public sealed partial class Alcohol120 byte lastSession = 0; var tocMs = new MemoryStream(); - tocMs.Write([0, 0], 0, 2); // Reserved for TOC session numbers + tocMs.Write(new byte[2], 0, 2); // Reserved for TOC session numbers foreach(KeyValuePair> sessionToc in _alcToc) { diff --git a/Aaru.Images/Alcohol120/Write.cs b/Aaru.Images/Alcohol120/Write.cs index 26bed6285..0098f461e 100644 --- a/Aaru.Images/Alcohol120/Write.cs +++ b/Aaru.Images/Alcohol120/Write.cs @@ -1073,7 +1073,7 @@ public sealed partial class Alcohol120 _descriptorStream.Write(filename, 0, filename.Length); // Write filename null termination - _descriptorStream.Write([0, 0], 0, 2); + _descriptorStream.Write(new byte[2], 0, 2); _descriptorStream.Flush(); _descriptorStream.Close(); diff --git a/Aaru.Images/BLU/Properties.cs b/Aaru.Images/BLU/Properties.cs index e5a18fc7e..9a39079ab 100644 --- a/Aaru.Images/BLU/Properties.cs +++ b/Aaru.Images/BLU/Properties.cs @@ -72,6 +72,8 @@ public sealed partial class Blu public IEnumerable SupportedMediaTags => []; /// + + // ReSharper disable once ArrayWithDefaultValuesInitialization public IEnumerable SupportedSectorTags => [SectorTagType.AppleSonyTag]; /// diff --git a/Aaru.Images/BlindWrite5/Read.cs b/Aaru.Images/BlindWrite5/Read.cs index 856b9d37a..d63216515 100644 --- a/Aaru.Images/BlindWrite5/Read.cs +++ b/Aaru.Images/BlindWrite5/Read.cs @@ -700,7 +700,7 @@ public sealed partial class BlindWrite5 Partitions = []; var fullTocStream = new MemoryStream(); - fullTocStream.Write([0, 0], 0, 2); + fullTocStream.Write(new byte[2], 0, 2); ulong offsetBytes = 0; _offsetMap = new Dictionary(); diff --git a/Aaru.Images/D88/Constants.cs b/Aaru.Images/D88/Constants.cs index 4bd52eabc..c767c4102 100644 --- a/Aaru.Images/D88/Constants.cs +++ b/Aaru.Images/D88/Constants.cs @@ -38,5 +38,5 @@ namespace Aaru.Images; public sealed partial class D88 { const byte READ_ONLY = 0x10; - readonly byte[] _reservedEmpty = [0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]; + readonly byte[] _reservedEmpty = new byte[9]; } \ No newline at end of file diff --git a/Aaru.Images/DiskCopy42/Properties.cs b/Aaru.Images/DiskCopy42/Properties.cs index bdb8a9405..4024904c8 100644 --- a/Aaru.Images/DiskCopy42/Properties.cs +++ b/Aaru.Images/DiskCopy42/Properties.cs @@ -68,6 +68,8 @@ public sealed partial class DiskCopy42 public IEnumerable SupportedMediaTags => []; /// + + // ReSharper disable once ArrayWithDefaultValuesInitialization public IEnumerable SupportedSectorTags => [SectorTagType.AppleSonyTag]; /// diff --git a/Aaru.Images/GDI/Read.cs b/Aaru.Images/GDI/Read.cs index 88c87b302..ec71410ef 100644 --- a/Aaru.Images/GDI/Read.cs +++ b/Aaru.Images/GDI/Read.cs @@ -553,7 +553,7 @@ public sealed partial class Gdi if(tag != SectorTagType.CdTrackFlags) return ErrorNumber.NotSupported; - buffer = [0x00]; + buffer = new byte[1]; return ErrorNumber.NoError; } diff --git a/Aaru.Tests/Checksums/CRC16IBM.cs b/Aaru.Tests/Checksums/CRC16IBM.cs index af7e02dc6..50108ccc0 100644 --- a/Aaru.Tests/Checksums/CRC16IBM.cs +++ b/Aaru.Tests/Checksums/CRC16IBM.cs @@ -38,7 +38,7 @@ namespace Aaru.Tests.Checksums; [TestFixture] public class Crc16Ibm { - static readonly byte[] _expectedEmpty = [0x00, 0x00]; + static readonly byte[] _expectedEmpty = new byte[2]; static readonly byte[] _expectedRandom = [ // ReSharper disable once UseUtf8StringLiteral diff --git a/Aaru.Tests/Devices/MultiMediaCard/CID.cs b/Aaru.Tests/Devices/MultiMediaCard/CID.cs index 24906b814..0dbc7d0c3 100644 --- a/Aaru.Tests/Devices/MultiMediaCard/CID.cs +++ b/Aaru.Tests/Devices/MultiMediaCard/CID.cs @@ -18,7 +18,7 @@ public class CID readonly byte[] manufacturers = [0x15, 0x06, 0x2c]; - readonly ushort[] applications = [0, 0, 0]; + readonly ushort[] applications = new ushort[3]; readonly string[] names = ["000000", "32M ", "AF HMP"]; @@ -28,7 +28,7 @@ public class CID readonly byte[] dates = [0x97, 0xc6, 0x68]; - readonly byte[] crcs = [0x00, 0x00, 0x00]; + readonly byte[] crcs = new byte[3]; [Test] public void Test() diff --git a/Aaru.Tests/Devices/MultiMediaCard/CSD.cs b/Aaru.Tests/Devices/MultiMediaCard/CSD.cs index 01cd07708..ee2190c52 100644 --- a/Aaru.Tests/Devices/MultiMediaCard/CSD.cs +++ b/Aaru.Tests/Devices/MultiMediaCard/CSD.cs @@ -34,11 +34,11 @@ public class CSD readonly bool[] read_partial_blocks = [false, true, true]; - readonly bool[] write_misaligned_block = [false, false, false]; + readonly bool[] write_misaligned_block = new bool[3]; - readonly bool[] read_misaligned_block = [false, false, false]; + readonly bool[] read_misaligned_block = new bool[3]; - readonly bool[] dsr_implemented = [false, false, false]; + readonly bool[] dsr_implemented = new bool[3]; readonly uint[] card_sizes = [1959, 1959, 3919]; @@ -52,7 +52,7 @@ public class CSD readonly byte[] size_multiplier = [3, 3, 5]; - readonly byte[] sector_sizes = [0, 0, 0]; + readonly byte[] sector_sizes = new byte[3]; readonly byte[] erase_sector_sizes = [31, 15, 31]; @@ -60,25 +60,25 @@ public class CSD readonly bool[] write_protect_group_enable = [true, true, true]; - readonly byte[] default_eccs = [0, 0, 0]; + readonly byte[] default_eccs = new byte[3]; readonly byte[] r2w_factors = [4, 2, 5]; readonly byte[] write_block_lengths = [9, 9, 9]; - readonly bool[] write_partial_blocks = [false, false, false]; + readonly bool[] write_partial_blocks = new bool[3]; - readonly bool[] file_format_group = [false, false, false]; + readonly bool[] file_format_group = new bool[3]; readonly bool[] copy = [true, false, false]; - readonly bool[] permanent_write_protect = [false, false, false]; + readonly bool[] permanent_write_protect = new bool[3]; - readonly bool[] temporary_write_protect = [false, false, false]; + readonly bool[] temporary_write_protect = new bool[3]; - readonly byte[] file_format = [0, 0, 0]; + readonly byte[] file_format = new byte[3]; - readonly byte[] ecc = [0, 0, 0]; + readonly byte[] ecc = new byte[3]; [Test] public void Test() diff --git a/Aaru.Tests/Devices/SecureDigital/CID.cs b/Aaru.Tests/Devices/SecureDigital/CID.cs index 621072912..dd29cd6e0 100644 --- a/Aaru.Tests/Devices/SecureDigital/CID.cs +++ b/Aaru.Tests/Devices/SecureDigital/CID.cs @@ -53,7 +53,7 @@ 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 = new byte[14]; [Test] public void Test() diff --git a/Aaru.Tests/Devices/SecureDigital/CSD.cs b/Aaru.Tests/Devices/SecureDigital/CSD.cs index c113182ec..be200a683 100644 --- a/Aaru.Tests/Devices/SecureDigital/CSD.cs +++ b/Aaru.Tests/Devices/SecureDigital/CSD.cs @@ -46,20 +46,11 @@ public class CSD 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[] write_misaligned_block = new bool[14]; - readonly bool[] read_misaligned_block = - [ - false, false, false, false, false, false, false, false, false, false, false, false, false, false - ]; + readonly bool[] read_misaligned_block = new bool[14]; - readonly bool[] dsr_implemented = - [ - false, false, false, false, false, false, false, false, false, false, false, false, false, false - ]; + readonly bool[] dsr_implemented = new bool[14]; readonly uint[] card_sizes = [ @@ -102,17 +93,11 @@ public class CSD 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[] permanent_write_protect = new bool[14]; - readonly bool[] temporary_write_protect = - [ - false, false, false, false, false, false, false, false, false, false, false, false, false, false - ]; + readonly bool[] temporary_write_protect = new bool[14]; - readonly byte[] file_format = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]; + readonly byte[] file_format = new byte[14]; [Test] public void Test() diff --git a/Aaru.Tests/Devices/SecureDigital/SCR.cs b/Aaru.Tests/Devices/SecureDigital/SCR.cs index 775c089ff..9453b7661 100644 --- a/Aaru.Tests/Devices/SecureDigital/SCR.cs +++ b/Aaru.Tests/Devices/SecureDigital/SCR.cs @@ -24,7 +24,7 @@ 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 = new byte[14]; readonly byte[] specification_version = [2, 2, 2, 2, 2, 2, 2, 2, 1, 2, 2, 2, 2, 0]; @@ -42,12 +42,9 @@ public class SCR 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 = new byte[14]; - readonly bool[] sd_spec4 = - [ - false, false, false, false, false, false, false, false, false, false, false, false, false, false - ]; + readonly bool[] sd_spec4 = new bool[14]; readonly byte[] sd_specx = [2, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0]; @@ -55,10 +52,9 @@ public class SCR readonly byte[][] mfg = [ - [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] + [0x01, 0x00, 0x00, 0x00], [0x1c, 0x02, 0x21, 0x02], [0x01, 0x00, 0x00, 0x00], new byte[4], + [0x1c, 0x02, 0x14, 0x02], new byte[4], new byte[4], new byte[4], new byte[4], [0x01, 0x00, 0x00, 0x00], + new byte[4], new byte[4], new byte[4], [0x08, 0x07, 0x03, 0x02] ]; [Test]