Files
Aaru/Aaru.Tests/Images/BlindWrite5.cs

1355 lines
33 KiB
C#
Raw Normal View History

2020-07-23 04:09:59 +01:00
// /***************************************************************************
2020-07-25 02:01:36 +01:00
// Aaru Data Preservation Suite
2020-07-23 04:09:59 +01:00
// ----------------------------------------------------------------------------
//
2020-07-23 04:14:36 +01:00
// Filename : BlindWrite5.cs
2020-07-23 04:09:59 +01:00
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
2020-07-25 02:01:36 +01:00
// Component : Aaru unit testing.
2020-07-23 04:09:59 +01:00
//
// --[ License ] --------------------------------------------------------------
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
// ----------------------------------------------------------------------------
2020-12-31 23:08:23 +00:00
// Copyright © 2011-2021 Natalia Portillo
2020-07-23 04:09:59 +01:00
// ****************************************************************************/
using System;
using System.IO;
using System.Linq;
2020-07-23 04:09:59 +01:00
using Aaru.Checksums;
using Aaru.CommonTypes;
using Aaru.CommonTypes.Enums;
using Aaru.CommonTypes.Structs;
using Aaru.Filters;
using FluentAssertions;
using FluentAssertions.Execution;
2020-07-23 04:09:59 +01:00
using NUnit.Framework;
namespace Aaru.Tests.Images
{
[TestFixture]
public class BlindWrite5
{
readonly string[] _testFiles =
{
2021-01-09 03:16:23 +00:00
"dvdrom.B5T", "gigarec.B5T", "jaguarcd.B5T", "pcengine.B5T", "pcfx.B5T", "report_audiocd.B5T",
"report_cdr.B5T", "report_cdrom.B5T", "report_cdrw_2x.B5T", "test_all_tracks_are_track1.B5T",
"test_audiocd_cdtext.B5T", "test_castrated_leadout.B5T", "test_data_track_as_audio.B5T",
"test_data_track_as_audio_fixed_sub.B5T", "test_disc_starts_at_track2.B5T", "test_enhancedcd.B5T",
"test_incd_udf200_finalized.B5T", "test_multiple_indexes.B5T", "test_multisession.B5T",
"test_track1_overlaps_session2.B5T", "test_track2_inside_session2_leadin.B5T",
"test_track2_inside_track1.B5T", "test_videocd.B5T"
2020-07-23 04:09:59 +01:00
};
readonly ulong[] _sectors =
{
2021-01-09 03:16:23 +00:00
// dvdrom.B5T
0,
2020-11-10 21:50:04 +00:00
2021-01-09 03:16:23 +00:00
// gigarec.B5T
469652,
2020-11-10 21:50:04 +00:00
2021-01-09 03:16:23 +00:00
// jaguarcd.B5T
243587,
2020-11-10 21:50:04 +00:00
2021-01-09 03:16:23 +00:00
// pcengine.B5T
160956,
2020-11-10 21:50:04 +00:00
2021-01-09 03:16:23 +00:00
// pcfx.B5T
246680,
2020-11-10 21:50:04 +00:00
2021-01-09 03:16:23 +00:00
// report_audiocd.B5T
247073,
2020-11-10 21:50:04 +00:00
2021-01-09 03:16:23 +00:00
// report_cdr.B5T
254265,
2020-11-10 21:50:04 +00:00
2021-01-09 03:16:23 +00:00
// report_cdrom.B5T
254265,
2020-11-10 21:50:04 +00:00
2021-01-09 03:16:23 +00:00
// report_cdrw_2x.B5T
308224,
2020-11-10 21:50:04 +00:00
2021-01-09 03:16:23 +00:00
// test_all_tracks_are_track1.B5T
0,
2020-11-10 21:50:04 +00:00
2021-01-09 03:16:23 +00:00
// test_audiocd_cdtext.B5T
277696,
2020-11-10 21:50:04 +00:00
2021-01-09 03:16:23 +00:00
// test_castrated_leadout.B5T
0,
2020-11-10 21:50:04 +00:00
2021-01-09 03:16:23 +00:00
// test_data_track_as_audio.B5T
62385,
2020-11-10 21:50:04 +00:00
2021-01-09 03:16:23 +00:00
// test_data_track_as_audio_fixed_sub.B5T
62385,
// test_disc_starts_at_track2.B5T
62385,
// test_enhancedcd.B5T
59206,
// test_incd_udf200_finalized.B5T
350134,
// test_multiple_indexes.B5T
65536,
2020-11-10 21:50:04 +00:00
2021-01-09 03:16:23 +00:00
// test_multisession.B5T
51168,
// test_track1_overlaps_session2.B5T
0,
// test_track2_inside_session2_leadin.B5T
62385,
// test_track2_inside_track1.B5T
0,
// test_videocd.B5T
48794
2020-07-23 04:09:59 +01:00
};
readonly MediaType[] _mediaTypes =
{
2021-01-09 03:16:23 +00:00
// dvdrom.B5T
MediaType.DVDROM,
2020-11-10 21:50:04 +00:00
2021-01-09 03:16:23 +00:00
// gigarec.B5T
MediaType.CDR,
// jaguarcd.B5T
2020-11-10 21:50:04 +00:00
MediaType.CDDA,
2021-01-09 03:16:23 +00:00
// pcengine.B5T
MediaType.CD,
2020-11-10 21:50:04 +00:00
2021-01-09 03:16:23 +00:00
// pcfx.B5T
MediaType.CD,
2020-11-10 21:50:04 +00:00
2021-01-09 03:16:23 +00:00
// report_audiocd.B5T
MediaType.CDDA,
// report_cdr.B5T
MediaType.CDR,
2020-11-10 21:50:04 +00:00
2021-01-09 03:16:23 +00:00
// report_cdrom.B5T
2020-11-10 21:50:04 +00:00
MediaType.CDROM,
2021-01-09 03:16:23 +00:00
// report_cdrw_2x.B5T
2020-11-10 21:50:04 +00:00
MediaType.CDRW,
2021-01-09 03:16:23 +00:00
// test_all_tracks_are_track1.B5T
MediaType.CDR,
2020-11-10 21:50:04 +00:00
2021-01-09 03:16:23 +00:00
// test_audiocd_cdtext.B5T
MediaType.CDR,
2020-11-10 21:50:04 +00:00
2021-01-09 03:16:23 +00:00
// test_castrated_leadout.B5T
MediaType.CDR,
2020-11-10 21:50:04 +00:00
2021-01-09 03:16:23 +00:00
// test_data_track_as_audio.B5T
MediaType.CDR,
2020-11-10 21:50:04 +00:00
2021-01-09 03:16:23 +00:00
// test_data_track_as_audio_fixed_sub.B5T
MediaType.CDR,
2020-11-10 21:50:04 +00:00
2021-01-09 03:16:23 +00:00
// test_disc_starts_at_track2.B5T
MediaType.CDR,
2020-11-10 21:50:04 +00:00
2021-01-09 03:16:23 +00:00
// test_enhancedcd.B5T
MediaType.CDR,
// test_incd_udf200_finalized.B5T
MediaType.CDR,
// test_multiple_indexes.B5T
MediaType.CDR,
// test_multisession.B5T
MediaType.CDR,
// test_track1_overlaps_session2.B5T
MediaType.CDR,
2020-11-10 21:50:04 +00:00
2021-01-09 03:16:23 +00:00
// test_track2_inside_session2_leadin.B5T
MediaType.CDR,
// test_track2_inside_track1.B5T
MediaType.CDR,
// test_videocd.B5T
MediaType.CDR
2020-07-23 04:09:59 +01:00
};
readonly string[] _md5S =
{
2021-01-09 03:16:23 +00:00
// dvdrom.B5T
"UNKNOWN",
2020-11-10 21:50:04 +00:00
2021-01-09 03:16:23 +00:00
// gigarec.B5T
"e2e967adc0e5c530964ac4eebe8cac47",
2020-11-10 21:50:04 +00:00
2021-01-09 03:16:23 +00:00
// jaguarcd.B5T
"3dd5bd0f7d95a40d411761d69255567a",
2020-11-10 21:50:04 +00:00
2021-01-09 03:16:23 +00:00
// pcengine.B5T
"4f5165069b3c5f11afe5f59711bd945d",
2020-11-10 21:50:04 +00:00
2021-01-09 03:16:23 +00:00
// pcfx.B5T
"c1bc8de499756453d1387542bb32bb4d",
2020-11-10 21:50:04 +00:00
2021-01-09 03:16:23 +00:00
// report_audiocd.B5T
"c09f408a4416634d8ac1c1ffd0ed75a5",
2020-11-10 21:50:04 +00:00
2021-01-09 03:16:23 +00:00
// report_cdr.B5T
"65e79ef740833188a0f5be19da14c09d",
2020-11-10 21:50:04 +00:00
2021-01-09 03:16:23 +00:00
// report_cdrom.B5T
"bf4bbec517101d0d6f45d2e4d50cb875",
2020-11-10 21:50:04 +00:00
2021-01-09 03:16:23 +00:00
// report_cdrw_2x.B5T
"1e55aa420ca8f8ea77d5b597c9cfc19b",
2020-11-10 21:50:04 +00:00
2021-01-09 03:16:23 +00:00
// test_all_tracks_are_track1.B5T
"UNKNOWN",
2020-11-10 21:50:04 +00:00
2021-01-09 03:16:23 +00:00
// test_audiocd_cdtext.B5T
"7c8fc7bb768cff15d702ac8cd10108d7",
2020-11-10 21:50:04 +00:00
2021-01-09 03:16:23 +00:00
// test_castrated_leadout.B5T
"UNKNOWN",
2020-11-10 21:50:04 +00:00
2021-01-09 03:16:23 +00:00
// test_data_track_as_audio.B5T
"ce3d63e831b4e6191b05ec9ce452ad91",
2020-11-10 21:50:04 +00:00
2021-01-09 03:16:23 +00:00
// test_data_track_as_audio_fixed_sub.B5T
"ce3d63e831b4e6191b05ec9ce452ad91",
// test_disc_starts_at_track2.B5T
"25fb1b49726aaac09196ea56490beeb1",
2020-11-10 21:50:04 +00:00
2021-01-09 03:16:23 +00:00
// test_enhancedcd.B5T
"3736dbfcb7bf5648e3ac067379087001",
// test_incd_udf200_finalized.B5T
"901e4fe17ea6591b1fd53ba822428ef4",
// test_multiple_indexes.B5T
"1b13a8f8aeb23f0b8bbc68518217e771",
// test_multisession.B5T
"e2e19cf38891e67a0829d01842b4052e",
// test_track1_overlaps_session2.B5T
"UNKNOWN",
// test_track2_inside_session2_leadin.B5T
"4e797aa5dedaac71a0e67ebd9ac9d555",
// test_track2_inside_track1.B5T
"UNKNOWN",
// test_videocd.B5T
"203a40d27b9bee018705c2df8d15e96d"
2020-07-23 04:09:59 +01:00
};
readonly string[] _longMd5S =
{
2021-01-09 03:16:23 +00:00
// dvdrom.B5T
"UNKNOWN",
2020-11-10 21:50:04 +00:00
2021-01-09 03:16:23 +00:00
// gigarec.B5T
"1dc7801008110af6b8015aad64d91739",
2020-11-10 21:50:04 +00:00
2021-01-09 03:16:23 +00:00
// jaguarcd.B5T
"3dd5bd0f7d95a40d411761d69255567a",
2020-11-10 21:50:04 +00:00
2021-01-09 03:16:23 +00:00
// pcengine.B5T
"fd30db9486f67654179c90c8a5052edb",
2020-11-10 21:50:04 +00:00
2021-01-09 03:16:23 +00:00
// pcfx.B5T
"455ec326506d2c5b974c4617c1010796",
2020-11-10 21:50:04 +00:00
2021-01-09 03:16:23 +00:00
// report_audiocd.B5T
"c09f408a4416634d8ac1c1ffd0ed75a5",
2020-11-10 21:50:04 +00:00
2021-01-09 03:16:23 +00:00
// report_cdr.B5T
"47b32c32a6427ad1e6b4b1bd047df716",
2020-11-10 21:50:04 +00:00
2021-01-09 03:16:23 +00:00
// report_cdrom.B5T
"3d3f9cf7d1ba2249b1e7960071e5af46",
2020-11-10 21:50:04 +00:00
2021-01-09 03:16:23 +00:00
// report_cdrw_2x.B5T
"3af5f943ddb9427d9c63a4ce3b704db9",
2020-11-10 21:50:04 +00:00
2021-01-09 03:16:23 +00:00
// test_all_tracks_are_track1.B5T
"UNKNOWN",
2020-11-10 21:50:04 +00:00
2021-01-09 03:16:23 +00:00
// test_audiocd_cdtext.B5T
"7c8fc7bb768cff15d702ac8cd10108d7",
2020-11-10 21:50:04 +00:00
2021-01-09 03:16:23 +00:00
// test_castrated_leadout.B5T
"UNKNOWN",
2020-11-10 21:50:04 +00:00
2021-01-09 03:16:23 +00:00
// test_data_track_as_audio.B5T
"4bd5511229857ca167b45e607dea12dc",
2020-11-10 21:50:04 +00:00
2021-01-09 03:16:23 +00:00
// test_data_track_as_audio_fixed_sub.B5T
"4bd5511229857ca167b45e607dea12dc",
// test_disc_starts_at_track2.B5T
"8fd0dbe9085363cc20709f0ca76a373d",
// test_enhancedcd.B5T
"c2dfd5a32678c3ff049c143c98ad36a5",
// test_incd_udf200_finalized.B5T
"7b489457540c40037aabcf3f21e0201e",
// test_multiple_indexes.B5T
"1b13a8f8aeb23f0b8bbc68518217e771",
2020-11-10 21:50:04 +00:00
2021-01-09 03:16:23 +00:00
// test_multisession.B5T
"3e646a04eb29a8e0ad892b6ac00ba962",
// test_track1_overlaps_session2.B5T
"UNKNOWN",
// test_track2_inside_session2_leadin.B5T
"311d641c93a3fe1dfae7deb3a2be28c7",
// test_track2_inside_track1.B5T
"UNKNOWN",
// test_videocd.B5T
"a686cade367db0a12fef1d9862f39e1d"
2020-07-23 04:09:59 +01:00
};
readonly string[] _subchannelMd5S =
{
2021-01-09 03:16:23 +00:00
// dvdrom.B5T
2020-11-10 21:50:04 +00:00
null,
2021-01-09 03:16:23 +00:00
// gigarec.B5T
2020-11-10 21:50:04 +00:00
null,
2021-01-09 03:16:23 +00:00
// jaguarcd.B5T
2020-11-10 21:50:04 +00:00
null,
2021-01-09 03:16:23 +00:00
// pcengine.B5T
2020-11-10 21:50:04 +00:00
null,
2021-01-09 03:16:23 +00:00
// pcfx.B5T
2020-11-10 21:50:04 +00:00
null,
2021-01-09 03:16:23 +00:00
// report_audiocd.B5T
2020-11-10 21:50:04 +00:00
null,
2021-01-09 03:16:23 +00:00
// report_cdr.B5T
2020-11-10 21:50:04 +00:00
null,
2021-01-09 03:16:23 +00:00
// report_cdrom.B5T
2020-11-10 21:50:04 +00:00
null,
2021-01-09 03:16:23 +00:00
// report_cdrw_2x.B5T
2020-11-10 21:50:04 +00:00
null,
2021-01-09 03:16:23 +00:00
// test_all_tracks_are_track1.B5T
2020-11-10 21:50:04 +00:00
null,
2021-01-09 03:16:23 +00:00
// test_audiocd_cdtext.B5T
2020-11-10 21:50:04 +00:00
null,
2021-01-09 03:16:23 +00:00
// test_castrated_leadout.B5T
2020-11-10 21:50:04 +00:00
null,
2021-01-09 03:16:23 +00:00
// test_data_track_as_audio.B5T
2020-11-10 21:50:04 +00:00
null,
2021-01-09 03:16:23 +00:00
// test_data_track_as_audio_fixed_sub.B5T
2020-11-10 21:50:04 +00:00
null,
2021-01-09 03:16:23 +00:00
// test_disc_starts_at_track2.B5T
null,
// test_enhancedcd.B5T
null,
// test_incd_udf200_finalized.B5T
null,
// test_multiple_indexes.B5T
null,
// test_multisession.B5T
null,
// test_track1_overlaps_session2.B5T
null,
// test_track2_inside_session2_leadin.B5T
null,
// test_track2_inside_track1.B5T
null,
// test_videocd.B5T
2020-11-10 21:50:04 +00:00
null
2020-07-23 04:09:59 +01:00
};
readonly int[] _tracks =
{
2021-01-09 03:16:23 +00:00
// dvdrom.B5T
1,
2020-11-10 21:50:04 +00:00
2021-01-09 03:16:23 +00:00
// gigarec.B5T
1,
2020-11-10 21:50:04 +00:00
2021-01-09 03:16:23 +00:00
// jaguarcd.B5T
11,
2020-11-10 21:50:04 +00:00
2021-01-09 03:16:23 +00:00
// pcengine.B5T
16,
2020-11-10 21:50:04 +00:00
2021-01-09 03:16:23 +00:00
// pcfx.B5T
8,
2020-11-10 21:50:04 +00:00
2021-01-09 03:16:23 +00:00
// report_audiocd.B5T
14,
// report_cdr.B5T
2020-11-10 21:50:04 +00:00
1,
2021-01-09 03:16:23 +00:00
// report_cdrom.B5T
2020-11-10 21:50:04 +00:00
1,
2021-01-09 03:16:23 +00:00
// report_cdrw_2x.B5T
2020-11-10 21:50:04 +00:00
1,
2021-01-09 03:16:23 +00:00
// test_all_tracks_are_track1.B5T
2020-11-10 21:50:04 +00:00
2,
2021-01-09 03:16:23 +00:00
// test_audiocd_cdtext.B5T
2020-11-10 21:50:04 +00:00
11,
2021-01-09 03:16:23 +00:00
// test_castrated_leadout.B5T
2020-11-10 21:50:04 +00:00
11,
2021-01-09 03:16:23 +00:00
// test_data_track_as_audio.B5T
2,
// test_data_track_as_audio_fixed_sub.B5T
2,
// test_disc_starts_at_track2.B5T
2,
// test_enhancedcd.B5T
2020-11-10 21:50:04 +00:00
3,
2021-01-09 03:16:23 +00:00
// test_incd_udf200_finalized.B5T
1,
2020-11-10 21:50:04 +00:00
2021-01-09 03:16:23 +00:00
// test_multiple_indexes.B5T
5,
// test_multisession.B5T
4,
// test_track1_overlaps_session2.B5T
2,
2020-11-10 21:50:04 +00:00
2021-01-09 03:16:23 +00:00
// test_track2_inside_session2_leadin.B5T
3,
// test_track2_inside_track1.B5T
3,
// test_videocd.B5T
2
2020-07-23 04:09:59 +01:00
};
readonly int[][] _trackSessions =
{
2021-01-09 03:16:23 +00:00
// dvdrom.B5T
2020-07-23 04:09:59 +01:00
new[]
{
2021-01-09 03:16:23 +00:00
1
2020-07-23 04:09:59 +01:00
},
2020-11-10 21:50:04 +00:00
2021-01-09 03:16:23 +00:00
// gigarec.B5T
2020-07-23 04:09:59 +01:00
new[]
{
2021-01-09 03:16:23 +00:00
1
2020-07-23 04:09:59 +01:00
},
2020-11-10 21:50:04 +00:00
2021-01-09 03:16:23 +00:00
// jaguarcd.B5T
2020-07-23 04:09:59 +01:00
new[]
{
2021-01-09 03:16:23 +00:00
1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2
2020-07-23 04:09:59 +01:00
},
2020-11-10 21:50:04 +00:00
2021-01-09 03:16:23 +00:00
// pcengine.B5T
2020-07-23 04:09:59 +01:00
new[]
{
2021-01-09 03:16:23 +00:00
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
2020-07-23 04:09:59 +01:00
},
2020-11-10 21:50:04 +00:00
2021-01-09 03:16:23 +00:00
// pcfx.B5T
2020-07-23 04:09:59 +01:00
new[]
{
2021-01-09 03:16:23 +00:00
1, 1, 1, 1, 1, 1, 1, 1
2020-07-23 04:09:59 +01:00
},
2020-11-10 21:50:04 +00:00
2021-01-09 03:16:23 +00:00
// report_audiocd.B5T
2020-07-23 04:09:59 +01:00
new[]
{
2021-01-09 03:16:23 +00:00
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
2020-07-23 04:09:59 +01:00
},
2020-11-10 21:50:04 +00:00
2021-01-09 03:16:23 +00:00
// report_cdr.B5T
2020-07-23 04:09:59 +01:00
new[]
{
1
},
2020-11-10 21:50:04 +00:00
2021-01-09 03:16:23 +00:00
// report_cdrom.B5T
2020-07-23 04:09:59 +01:00
new[]
{
1
},
2021-01-09 03:16:23 +00:00
// report_cdrw_2x.B5T
2020-07-23 04:09:59 +01:00
new[]
{
2020-11-10 21:50:04 +00:00
1
2020-07-23 04:09:59 +01:00
},
2020-11-10 21:50:04 +00:00
2021-01-09 03:16:23 +00:00
// test_all_tracks_are_track1.B5T
2020-07-23 04:09:59 +01:00
new[]
{
2021-01-09 03:16:23 +00:00
1, 2
2020-07-23 04:09:59 +01:00
},
2020-11-10 21:50:04 +00:00
2021-01-09 03:16:23 +00:00
// test_audiocd_cdtext.B5T
2020-07-23 04:09:59 +01:00
new[]
{
2021-01-09 03:16:23 +00:00
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
2020-07-23 04:09:59 +01:00
},
2020-11-10 21:50:04 +00:00
2021-01-09 03:16:23 +00:00
// test_castrated_leadout.B5T
2020-07-23 04:09:59 +01:00
new[]
{
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
},
2020-11-10 21:50:04 +00:00
2021-01-09 03:16:23 +00:00
// test_data_track_as_audio.B5T
2020-07-23 04:09:59 +01:00
new[]
{
2021-01-09 03:16:23 +00:00
1, 2
2020-07-23 04:09:59 +01:00
},
2020-11-10 21:50:04 +00:00
2021-01-09 03:16:23 +00:00
// test_data_track_as_audio_fixed_sub.B5T
2020-07-23 04:09:59 +01:00
new[]
{
2021-01-09 03:16:23 +00:00
1, 2
2020-07-23 04:09:59 +01:00
},
2020-11-10 21:50:04 +00:00
2021-01-09 03:16:23 +00:00
// test_disc_starts_at_track2.B5T
2020-07-23 04:09:59 +01:00
new[]
{
2021-01-09 03:16:23 +00:00
1, 2
},
// test_enhancedcd.B5T
new[]
{
1, 1, 2
},
// test_incd_udf200_finalized.B5T
new[]
{
1
},
// test_multiple_indexes.B5T
new[]
{
1, 1, 1, 1, 1
2020-07-23 04:09:59 +01:00
},
2020-11-10 21:50:04 +00:00
2021-01-09 03:16:23 +00:00
// test_multisession.B5T
2020-07-23 04:09:59 +01:00
new[]
{
2021-01-09 03:16:23 +00:00
1, 2, 3, 4
},
// test_track1_overlaps_session2.B5T
new[]
{
1
},
// test_track2_inside_session2_leadin.B5T
new[]
{
1, 1, 2
},
// test_track2_inside_track1.B5T
new[]
{
1, 1, 1
},
// test_videocd.B5T
new[]
{
1, 1
2020-07-23 04:09:59 +01:00
}
};
readonly ulong[][] _trackStarts =
{
2021-01-09 03:16:23 +00:00
// dvdrom.B5T
new ulong[]
{
0
},
// gigarec.B5T
2020-07-23 04:09:59 +01:00
new ulong[]
{
2021-01-09 03:16:23 +00:00
0
2020-07-23 04:09:59 +01:00
},
2020-11-10 21:50:04 +00:00
2021-01-09 03:16:23 +00:00
// jaguarcd.B5T
2020-07-23 04:09:59 +01:00
new ulong[]
{
2021-01-09 03:16:23 +00:00
0, 27490, 28237, 78892, 100054, 133203, 160908, 181466, 202024, 222582, 243140
2020-07-23 04:09:59 +01:00
},
2020-11-10 21:50:04 +00:00
2021-01-09 03:16:23 +00:00
// pcengine.B5T
2020-07-23 04:09:59 +01:00
new ulong[]
{
2021-01-09 03:16:23 +00:00
0, 3590, 38464, 47217, 53501, 61819, 68563, 75397, 83130, 86481, 91267, 99274, 106693, 112238, 120270,
126229
2020-07-23 04:09:59 +01:00
},
2020-11-10 21:50:04 +00:00
2021-01-09 03:16:23 +00:00
// pcfx.B5T
2020-07-23 04:09:59 +01:00
new ulong[]
{
2021-01-09 03:16:23 +00:00
0, 4395, 4909, 5941, 42059, 220645, 225646, 235498
2020-07-23 04:09:59 +01:00
},
2020-11-10 21:50:04 +00:00
2021-01-09 03:16:23 +00:00
// report_audiocd.B5T
2020-07-23 04:09:59 +01:00
new ulong[]
{
2021-01-09 03:16:23 +00:00
0, 16549, 30051, 47950, 63314, 78925, 94732, 117125, 136166, 154072, 170751, 186539, 201799, 224449
2020-07-23 04:09:59 +01:00
},
2020-11-10 21:50:04 +00:00
2021-01-09 03:16:23 +00:00
// report_cdr.B5T
2020-07-23 04:09:59 +01:00
new ulong[]
{
0
},
2020-11-10 21:50:04 +00:00
2021-01-09 03:16:23 +00:00
// report_cdrom.B5T
2020-07-23 04:09:59 +01:00
new ulong[]
{
0
},
2020-11-10 21:50:04 +00:00
2021-01-09 03:16:23 +00:00
// report_cdrw_2x.B5T
2020-07-23 04:09:59 +01:00
new ulong[]
{
0
},
2021-01-09 03:16:23 +00:00
// test_all_tracks_are_track1.B5T
2020-07-23 04:09:59 +01:00
new ulong[]
{
2021-01-09 03:16:23 +00:00
0, 25539
2020-07-23 04:09:59 +01:00
},
2020-11-10 21:50:04 +00:00
2021-01-09 03:16:23 +00:00
// test_audiocd_cdtext.B5T
2020-07-23 04:09:59 +01:00
new ulong[]
{
2021-01-09 03:16:23 +00:00
0, 29902, 65184, 78576, 95230, 126297, 155109, 191835, 222926, 243588, 269750
2020-07-23 04:09:59 +01:00
},
2020-11-10 21:50:04 +00:00
2021-01-09 03:16:23 +00:00
// test_castrated_leadout.B5T
2020-07-23 04:09:59 +01:00
new ulong[]
{
2021-01-09 03:16:23 +00:00
0, 29902, 65184, 78576, 95230, 126297, 155109, 191835, 222926, 243588, 269750
2020-07-23 04:09:59 +01:00
},
2020-11-10 21:50:04 +00:00
2021-01-09 03:16:23 +00:00
// test_data_track_as_audio.B5T
2020-07-23 04:09:59 +01:00
new ulong[]
{
2021-01-09 03:16:23 +00:00
0, 36789
2020-07-23 04:09:59 +01:00
},
2020-11-10 21:50:04 +00:00
2021-01-09 03:16:23 +00:00
// test_data_track_as_audio_fixed_sub.B5T
2020-07-23 04:09:59 +01:00
new ulong[]
{
2021-01-09 03:16:23 +00:00
0, 36789
2020-07-23 04:09:59 +01:00
},
2020-11-10 21:50:04 +00:00
2021-01-09 03:16:23 +00:00
// test_disc_starts_at_track2.B5T
2020-07-23 04:09:59 +01:00
new ulong[]
{
2021-01-09 03:16:23 +00:00
0, 36789
2020-07-23 04:09:59 +01:00
},
2020-11-10 21:50:04 +00:00
2021-01-09 03:16:23 +00:00
// test_enhancedcd.B5T
2020-07-23 04:09:59 +01:00
new ulong[]
{
2021-01-09 03:16:23 +00:00
0, 14405, 40203
},
// test_incd_udf200_finalized.B5T
new ulong[]
{
0
},
// test_multiple_indexes.B5T
new ulong[]
{
0, 4804, 13875, 41185, 54989
},
// test_multisession.B5T
new ulong[]
{
0, 19383, 32710, 45228
},
// test_track1_overlaps_session2.B5T
new ulong[]
{
0
2020-07-23 04:09:59 +01:00
},
2020-11-10 21:50:04 +00:00
2021-01-09 03:16:23 +00:00
// test_track2_inside_session2_leadin.B5T
2020-07-23 04:09:59 +01:00
new ulong[]
{
2021-01-09 03:16:23 +00:00
0, 25500, 36789
},
// test_track2_inside_track1.B5T
new ulong[]
{
0, 13350, 36939
},
// test_videocd.B5T
new ulong[]
{
0, 1252
2020-07-23 04:09:59 +01:00
}
};
readonly ulong[][] _trackEnds =
{
2021-01-09 03:16:23 +00:00
// dvdrom.B5T
2020-07-23 04:09:59 +01:00
new ulong[]
{
2021-01-09 03:16:23 +00:00
0
2020-07-23 04:09:59 +01:00
},
2020-11-10 21:50:04 +00:00
2021-01-09 03:16:23 +00:00
// gigarec.B5T
2020-07-23 04:09:59 +01:00
new ulong[]
{
2021-01-09 03:16:23 +00:00
469651
2020-07-23 04:09:59 +01:00
},
2020-11-10 21:50:04 +00:00
2021-01-09 03:16:23 +00:00
// jaguarcd.B5T
2020-07-23 04:09:59 +01:00
new ulong[]
{
2021-01-09 03:16:23 +00:00
16239, 28236, 78891, 100053, 133202, 160907, 181465, 202023, 222581, 243139, 243586
2020-07-23 04:09:59 +01:00
},
2020-11-10 21:50:04 +00:00
2021-01-09 03:16:23 +00:00
// pcengine.B5T
2020-07-23 04:09:59 +01:00
new ulong[]
{
2021-01-09 03:16:23 +00:00
3589, 38463, 47216, 53500, 61818, 68562, 75396, 83129, 86480, 91266, 99273, 106692, 112237, 120269,
126228, 160955
2020-07-23 04:09:59 +01:00
},
2020-11-10 21:50:04 +00:00
2021-01-09 03:16:23 +00:00
// pcfx.B5T
2020-07-23 04:09:59 +01:00
new ulong[]
{
2021-01-09 03:16:23 +00:00
4394, 4908, 5940, 42058, 220644, 225645, 235497, 246679
2020-07-23 04:09:59 +01:00
},
2020-11-10 21:50:04 +00:00
2021-01-09 03:16:23 +00:00
// report_audiocd.B5T
2020-07-23 04:09:59 +01:00
new ulong[]
{
2021-01-09 03:16:23 +00:00
16548, 30050, 47949, 63313, 78924, 94731, 117124, 136165, 154071, 170750, 186538, 201798, 224448, 247072
2020-07-23 04:09:59 +01:00
},
2020-11-10 21:50:04 +00:00
2021-01-09 03:16:23 +00:00
// report_cdr.B5T
2020-07-23 04:09:59 +01:00
new ulong[]
{
2021-01-09 03:16:23 +00:00
254264
2020-07-23 04:09:59 +01:00
},
2020-11-10 21:50:04 +00:00
2021-01-09 03:16:23 +00:00
// report_cdrom.B5T
2020-07-23 04:09:59 +01:00
new ulong[]
{
2021-01-09 03:16:23 +00:00
254264
2020-07-23 04:09:59 +01:00
},
2021-01-09 03:16:23 +00:00
// report_cdrw_2x.B5T
2020-07-23 04:09:59 +01:00
new ulong[]
{
2021-01-09 03:16:23 +00:00
308223
2020-07-23 04:09:59 +01:00
},
2020-11-10 21:50:04 +00:00
2021-01-09 03:16:23 +00:00
// test_all_tracks_are_track1.B5T
2020-07-23 04:09:59 +01:00
new ulong[]
{
2021-01-09 03:16:23 +00:00
25538, 51077
2020-07-23 04:09:59 +01:00
},
2020-11-10 21:50:04 +00:00
2021-01-09 03:16:23 +00:00
// test_audiocd_cdtext.B5T
2020-07-23 04:09:59 +01:00
new ulong[]
{
2021-01-09 03:16:23 +00:00
29901, 65183, 78575, 95229, 126296, 155108, 191834, 222925, 243587, 269749, 277695
2020-07-23 04:09:59 +01:00
},
2020-11-10 21:50:04 +00:00
2021-01-09 03:16:23 +00:00
// test_castrated_leadout.B5T
2020-07-23 04:09:59 +01:00
new ulong[]
{
2021-01-09 03:16:23 +00:00
29901, 65183, 78575, 95229, 126296, 155108, 191834, 222925, 243587, 269749, 1049
2020-07-23 04:09:59 +01:00
},
2020-11-10 21:50:04 +00:00
2021-01-09 03:16:23 +00:00
// test_data_track_as_audio.B5T
2020-07-23 04:09:59 +01:00
new ulong[]
{
2021-01-09 03:16:23 +00:00
25538, 62384
2020-07-23 04:09:59 +01:00
},
2020-11-10 21:50:04 +00:00
2021-01-09 03:16:23 +00:00
// test_data_track_as_audio_fixed_sub.B5T
2020-07-23 04:09:59 +01:00
new ulong[]
{
2021-01-09 03:16:23 +00:00
25538, 62384
2020-07-23 04:09:59 +01:00
},
2020-11-10 21:50:04 +00:00
2021-01-09 03:16:23 +00:00
// test_disc_starts_at_track2.B5T
2020-07-23 04:09:59 +01:00
new ulong[]
{
2021-01-09 03:16:23 +00:00
25538, 62384
},
// test_enhancedcd.B5T
new ulong[]
{
14404, 28952, 59205
2020-07-23 04:09:59 +01:00
},
2020-11-10 21:50:04 +00:00
2021-01-09 03:16:23 +00:00
// test_incd_udf200_finalized.B5T
2020-07-23 04:09:59 +01:00
new ulong[]
{
2021-01-09 03:16:23 +00:00
350133
},
// test_multiple_indexes.B5T
new ulong[]
{
4803, 13874, 41184, 54988, 65535
},
// test_multisession.B5T
new ulong[]
{
8132, 25959, 38477, 51167
},
// test_track1_overlaps_session2.B5T
new ulong[]
{
0
},
// test_track2_inside_session2_leadin.B5T
new ulong[]
{
25499, 25538, 62384
},
// test_track2_inside_track1.B5T
new ulong[]
{
13349, 25538, 62384
},
// test_videocd.B5T
new ulong[]
{
1251, 48793
2020-07-23 04:09:59 +01:00
}
};
readonly ulong[][] _trackPregaps =
{
2021-01-09 03:16:23 +00:00
// dvdrom.B5T
2020-07-23 04:09:59 +01:00
new ulong[]
{
2021-01-09 03:16:23 +00:00
0
2020-07-23 04:09:59 +01:00
},
2020-11-10 21:50:04 +00:00
2021-01-09 03:16:23 +00:00
// gigarec.B5T
2020-07-23 04:09:59 +01:00
new ulong[]
{
2021-01-09 03:16:23 +00:00
150
2020-07-23 04:09:59 +01:00
},
2020-11-10 21:50:04 +00:00
2021-01-09 03:16:23 +00:00
// jaguarcd.B5T
2020-07-23 04:09:59 +01:00
new ulong[]
{
2021-01-09 03:16:23 +00:00
150, 150, 0, 0, 0, 0, 0, 0, 0, 0, 0
2020-07-23 04:09:59 +01:00
},
2020-11-10 21:50:04 +00:00
2021-01-09 03:16:23 +00:00
// pcengine.B5T
2020-07-23 04:09:59 +01:00
new ulong[]
{
2021-01-09 03:16:23 +00:00
150, 0, 150, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
2020-07-23 04:09:59 +01:00
},
2020-11-10 21:50:04 +00:00
2021-01-09 03:16:23 +00:00
// pcfx.B5T
new ulong[]
{
150, 0, 0, 0, 0, 150, 0, 0
},
// report_audiocd.B5T
new ulong[]
{
150, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
},
// report_cdr.B5T
2020-07-23 04:09:59 +01:00
new ulong[]
{
150
},
2020-11-10 21:50:04 +00:00
2021-01-09 03:16:23 +00:00
// report_cdrom.B5T
2020-07-23 04:09:59 +01:00
new ulong[]
{
150
},
2020-11-10 21:50:04 +00:00
2021-01-09 03:16:23 +00:00
// report_cdrw_2x.B5T
2020-07-23 04:09:59 +01:00
new ulong[]
{
150
},
2020-11-10 21:50:04 +00:00
2021-01-09 03:16:23 +00:00
// test_all_tracks_are_track1.B5T
2020-07-23 04:09:59 +01:00
new ulong[]
{
2021-01-09 03:16:23 +00:00
150, 150
2020-07-23 04:09:59 +01:00
},
2021-01-09 03:16:23 +00:00
// test_audiocd_cdtext.B5T
2020-07-23 04:09:59 +01:00
new ulong[]
{
2021-01-09 03:16:23 +00:00
150, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
2020-07-23 04:09:59 +01:00
},
2020-11-10 21:50:04 +00:00
2021-01-09 03:16:23 +00:00
// test_castrated_leadout.B5T
2020-07-23 04:09:59 +01:00
new ulong[]
{
2021-01-09 03:16:23 +00:00
150, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
2020-07-23 04:09:59 +01:00
},
2020-11-10 21:50:04 +00:00
2021-01-09 03:16:23 +00:00
// test_data_track_as_audio.B5T
2020-07-23 04:09:59 +01:00
new ulong[]
{
2021-01-09 03:16:23 +00:00
150, 150
2020-07-23 04:09:59 +01:00
},
2020-11-10 21:50:04 +00:00
2021-01-09 03:16:23 +00:00
// test_data_track_as_audio_fixed_sub.B5T
2020-07-23 04:09:59 +01:00
new ulong[]
{
2021-01-09 03:16:23 +00:00
150, 150
2020-07-23 04:09:59 +01:00
},
2020-11-10 21:50:04 +00:00
2021-01-09 03:16:23 +00:00
// test_disc_starts_at_track2.B5T
2020-07-23 04:09:59 +01:00
new ulong[]
{
2021-01-09 03:16:23 +00:00
150, 150
2020-07-23 04:09:59 +01:00
},
2020-11-10 21:50:04 +00:00
2021-01-09 03:16:23 +00:00
// test_enhancedcd.B5T
2020-07-23 04:09:59 +01:00
new ulong[]
{
2021-01-09 03:16:23 +00:00
150, 0, 150
2020-07-23 04:09:59 +01:00
},
2020-11-10 21:50:04 +00:00
2021-01-09 03:16:23 +00:00
// test_incd_udf200_finalized.B5T
2020-07-23 04:09:59 +01:00
new ulong[]
{
2021-01-09 03:16:23 +00:00
150
2020-07-23 04:09:59 +01:00
},
2020-11-10 21:50:04 +00:00
2021-01-09 03:16:23 +00:00
// test_multiple_indexes.B5T
2020-07-23 04:09:59 +01:00
new ulong[]
{
2021-01-09 03:16:23 +00:00
150, 0, 0, 0, 0
},
// test_multisession.B5T
new ulong[]
{
150, 150, 150, 150
},
// test_track1_overlaps_session2.B5T
new ulong[]
{
150
},
// test_track2_inside_session2_leadin.B5T
new ulong[]
{
150, 0, 150
},
// test_track2_inside_track1.B5T
new ulong[]
{
150, 0, 150
},
// test_videocd.B5T
new ulong[]
{
150, 0
2020-07-23 04:09:59 +01:00
}
};
readonly byte[][] _trackFlags =
{
2021-01-09 03:16:23 +00:00
// dvdrom.B5T
null,
// gigarec.B5T
2020-07-23 04:09:59 +01:00
new byte[]
{
2021-01-09 03:16:23 +00:00
4
2020-07-23 04:09:59 +01:00
},
2020-11-10 21:50:04 +00:00
2021-01-09 03:16:23 +00:00
// jaguarcd.B5T
2020-07-23 04:09:59 +01:00
new byte[]
{
2021-01-09 03:16:23 +00:00
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
2020-07-23 04:09:59 +01:00
},
2020-11-10 21:50:04 +00:00
2021-01-09 03:16:23 +00:00
// pcengine.B5T
2020-07-23 04:09:59 +01:00
new byte[]
{
2021-01-09 03:16:23 +00:00
0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4
2020-07-23 04:09:59 +01:00
},
2020-11-10 21:50:04 +00:00
2021-01-09 03:16:23 +00:00
// pcfx.B5T
2020-07-23 04:09:59 +01:00
new byte[]
{
2021-01-09 03:16:23 +00:00
0, 4, 4, 4, 4, 0, 0, 0
2020-07-23 04:09:59 +01:00
},
2020-11-10 21:50:04 +00:00
2021-01-09 03:16:23 +00:00
// report_audiocd.B5T
2020-07-23 04:09:59 +01:00
new byte[]
{
2021-01-09 03:16:23 +00:00
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
2020-07-23 04:09:59 +01:00
},
2020-11-10 21:50:04 +00:00
2021-01-09 03:16:23 +00:00
// report_cdr.B5T
2020-07-23 04:09:59 +01:00
new byte[]
{
4
},
2020-11-10 21:50:04 +00:00
2021-01-09 03:16:23 +00:00
// report_cdrom.B5T
2020-07-23 04:09:59 +01:00
new byte[]
{
4
},
2020-11-10 21:50:04 +00:00
2021-01-09 03:16:23 +00:00
// report_cdrw_2x.B5T
2020-11-10 21:50:04 +00:00
new byte[]
2020-07-23 04:09:59 +01:00
{
2020-11-10 21:50:04 +00:00
4
2020-07-23 04:09:59 +01:00
},
2020-11-10 21:50:04 +00:00
2021-01-09 03:16:23 +00:00
// test_all_tracks_are_track1.B5T
2020-07-23 04:09:59 +01:00
new byte[]
{
2021-01-09 03:16:23 +00:00
4, 4
2020-07-23 04:09:59 +01:00
},
2020-11-10 21:50:04 +00:00
2021-01-09 03:16:23 +00:00
// test_audiocd_cdtext.B5T
2020-07-23 04:09:59 +01:00
new byte[]
{
2021-01-09 03:16:23 +00:00
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2
2020-07-23 04:09:59 +01:00
},
2020-11-10 21:50:04 +00:00
2021-01-09 03:16:23 +00:00
// test_castrated_leadout.B5T
2020-07-23 04:09:59 +01:00
new byte[]
{
2021-01-09 03:16:23 +00:00
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2
2020-07-23 04:09:59 +01:00
},
2020-11-10 21:50:04 +00:00
2021-01-09 03:16:23 +00:00
// test_data_track_as_audio.B5T
2020-07-23 04:09:59 +01:00
new byte[]
{
2021-01-09 03:16:23 +00:00
4, 2
2020-07-23 04:09:59 +01:00
},
2020-11-10 21:50:04 +00:00
2021-01-09 03:16:23 +00:00
// test_data_track_as_audio_fixed_sub.B5T
2020-07-23 04:09:59 +01:00
new byte[]
{
2021-01-09 03:16:23 +00:00
4, 2
2020-07-23 04:09:59 +01:00
},
2020-11-10 21:50:04 +00:00
2021-01-09 03:16:23 +00:00
// test_disc_starts_at_track2.B5T
2020-07-23 04:09:59 +01:00
new byte[]
{
2021-01-09 03:16:23 +00:00
4, 4
2020-07-23 04:09:59 +01:00
},
2020-11-10 21:50:04 +00:00
2021-01-09 03:16:23 +00:00
// test_enhancedcd.B5T
2020-07-23 04:09:59 +01:00
new byte[]
{
2021-01-09 03:16:23 +00:00
0, 0, 4
},
// test_incd_udf200_finalized.B5T
new byte[]
{
7
},
// test_multiple_indexes.B5T
new byte[]
{
2, 0, 0, 8, 1
},
// test_multisession.B5T
new byte[]
{
4, 4, 4, 4
},
// test_track1_overlaps_session2.B5T
new byte[]
{
4, 4
},
// test_track2_inside_session2_leadin.B5T
new byte[]
{
4, 4, 4
},
// test_track2_inside_track1.B5T
new byte[]
{
4, 4, 4
},
// test_videocd.B5T
new byte[]
{
4, 4
2020-07-23 04:09:59 +01:00
}
};
readonly string _dataFolder = Path.Combine(Consts.TEST_FILES_ROOT, "Media image formats", "BlindWrite 5");
2020-07-23 04:09:59 +01:00
[Test]
public void Info()
2020-07-23 04:09:59 +01:00
{
Environment.CurrentDirectory = _dataFolder;
for(int i = 0; i < _testFiles.Length; i++)
{
var filter = new ZZZNoFilter();
filter.Open(_testFiles[i]);
var image = new DiscImages.BlindWrite5();
bool opened = image.Open(filter);
Assert.AreEqual(true, opened, $"Open: {_testFiles[i]}");
2020-07-23 04:09:59 +01:00
using(new AssertionScope())
{
Assert.Multiple(() =>
{
Assert.AreEqual(_sectors[i], image.Info.Sectors, $"Sectors: {_testFiles[i]}");
Assert.AreEqual(_mediaTypes[i], image.Info.MediaType, $"Media type: {_testFiles[i]}");
Assert.AreEqual(_tracks[i], image.Tracks.Count, $"Tracks: {_testFiles[i]}");
image.Tracks.Select(t => t.TrackSession).Should().
BeEquivalentTo(_trackSessions[i], $"Track session: {_testFiles[i]}");
image.Tracks.Select(t => t.TrackStartSector).Should().
BeEquivalentTo(_trackStarts[i], $"Track start: {_testFiles[i]}");
2020-07-23 04:09:59 +01:00
image.Tracks.Select(t => t.TrackEndSector).Should().
BeEquivalentTo(_trackEnds[i], $"Track end: {_testFiles[i]}");
image.Tracks.Select(t => t.TrackPregap).Should().
BeEquivalentTo(_trackPregaps[i], $"Track pregap: {_testFiles[i]}");
int trackNo = 0;
byte[] flags = new byte[image.Tracks.Count];
2020-07-23 04:09:59 +01:00
foreach(Track currentTrack in image.Tracks)
{
if(image.Info.ReadableSectorTags.Contains(SectorTagType.CdTrackFlags))
flags[trackNo] = image.ReadSectorTag(currentTrack.TrackSequence,
SectorTagType.CdTrackFlags)[0];
2020-07-23 04:09:59 +01:00
trackNo++;
}
flags.Should().BeEquivalentTo(_trackFlags[i], $"Track flags: {_testFiles[i]}");
});
2020-07-23 04:09:59 +01:00
}
}
}
2020-07-23 04:09:59 +01:00
// How many sectors to read at once
const uint SECTORS_TO_READ = 256;
[Test]
public void Hashes()
{
Environment.CurrentDirectory = _dataFolder;
Assert.Multiple(() =>
{
for(int i = 0; i < _testFiles.Length; i++)
2020-07-23 04:09:59 +01:00
{
var filter = new ZZZNoFilter();
filter.Open(_testFiles[i]);
var image = new DiscImages.BlindWrite5();
bool opened = image.Open(filter);
Assert.AreEqual(true, opened, $"Open: {_testFiles[i]}");
Md5Context ctx;
2020-07-23 04:09:59 +01:00
foreach(bool @long in new[]
2020-07-23 04:09:59 +01:00
{
false, true
})
{
ctx = new Md5Context();
2020-07-23 04:09:59 +01:00
foreach(Track currentTrack in image.Tracks)
2020-07-23 04:09:59 +01:00
{
ulong sectors = currentTrack.TrackEndSector - currentTrack.TrackStartSector + 1;
ulong doneSectors = 0;
2020-07-23 04:09:59 +01:00
while(doneSectors < sectors)
2020-07-23 04:09:59 +01:00
{
byte[] sector;
if(sectors - doneSectors >= SECTORS_TO_READ)
{
sector =
@long ? image.ReadSectorsLong(doneSectors, SECTORS_TO_READ,
currentTrack.TrackSequence)
: image.ReadSectors(doneSectors, SECTORS_TO_READ,
currentTrack.TrackSequence);
doneSectors += SECTORS_TO_READ;
}
else
{
sector =
@long ? image.ReadSectorsLong(doneSectors, (uint)(sectors - doneSectors),
currentTrack.TrackSequence)
: image.ReadSectors(doneSectors, (uint)(sectors - doneSectors),
currentTrack.TrackSequence);
doneSectors += sectors - doneSectors;
}
ctx.Update(sector);
2020-07-23 04:09:59 +01:00
}
}
Assert.AreEqual(@long ? _longMd5S[i] : _md5S[i], ctx.End(),
$"{(@long ? "Long hash" : "Hash")}: {_testFiles[i]}");
2020-07-23 04:09:59 +01:00
}
if(!image.Info.ReadableSectorTags.Contains(SectorTagType.CdSectorSubchannel))
continue;
2020-07-23 04:09:59 +01:00
ctx = new Md5Context();
2020-07-23 04:09:59 +01:00
foreach(Track currentTrack in image.Tracks)
2020-07-23 04:09:59 +01:00
{
ulong sectors = currentTrack.TrackEndSector - currentTrack.TrackStartSector + 1;
2020-07-23 04:09:59 +01:00
ulong doneSectors = 0;
while(doneSectors < sectors)
{
byte[] sector;
if(sectors - doneSectors >= SECTORS_TO_READ)
2020-07-23 04:09:59 +01:00
{
sector = image.ReadSectorsTag(doneSectors, SECTORS_TO_READ, currentTrack.TrackSequence,
SectorTagType.CdSectorSubchannel);
2020-07-23 04:09:59 +01:00
doneSectors += SECTORS_TO_READ;
2020-07-23 04:09:59 +01:00
}
else
{
sector = image.ReadSectorsTag(doneSectors, (uint)(sectors - doneSectors),
currentTrack.TrackSequence,
SectorTagType.CdSectorSubchannel);
2020-07-23 04:09:59 +01:00
doneSectors += sectors - doneSectors;
}
ctx.Update(sector);
}
}
Assert.AreEqual(_subchannelMd5S[i], ctx.End(), $"Subchannel hash: {_testFiles[i]}");
2020-07-23 04:09:59 +01:00
}
});
2020-07-23 04:09:59 +01:00
}
}
}