mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
Use same algorithm for all media image unit tests.
This commit is contained in:
@@ -26,11 +26,12 @@
|
||||
// Copyright © 2011-2021 Natalia Portillo
|
||||
// ****************************************************************************/
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
using Aaru.Checksums;
|
||||
using Aaru.CommonTypes;
|
||||
using Aaru.CommonTypes.Interfaces;
|
||||
using Aaru.Filters;
|
||||
using FluentAssertions.Execution;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace Aaru.Tests.Images
|
||||
@@ -87,46 +88,81 @@ namespace Aaru.Tests.Images
|
||||
"11ef56c80c94347d2e3f921d5c36c8de", "11ef56c80c94347d2e3f921d5c36c8de", "6f692a8fadfaa243d9f2d8d41f0e4cad"
|
||||
};
|
||||
|
||||
readonly string _dataFolder = Path.Combine(Consts.TEST_FILES_ROOT, "Media image formats", "2mg");
|
||||
|
||||
[Test]
|
||||
public void Test()
|
||||
public void Info()
|
||||
{
|
||||
for(int i = 0; i < _testFiles.Length; i++)
|
||||
Environment.CurrentDirectory = _dataFolder;
|
||||
|
||||
Assert.Multiple(() =>
|
||||
{
|
||||
string location = Path.Combine(Consts.TEST_FILES_ROOT, "Media image formats", "2mg", _testFiles[i]);
|
||||
IFilter filter = new LZip();
|
||||
filter.Open(location);
|
||||
IMediaImage image = new DiscImages.Apple2Mg();
|
||||
Assert.AreEqual(true, image.Open(filter), _testFiles[i]);
|
||||
Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]);
|
||||
Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]);
|
||||
Assert.AreEqual(_mediaTypes[i], image.Info.MediaType, _testFiles[i]);
|
||||
|
||||
// How many sectors to read at once
|
||||
const uint sectorsToRead = 256;
|
||||
ulong doneSectors = 0;
|
||||
|
||||
var ctx = new Md5Context();
|
||||
|
||||
while(doneSectors < image.Info.Sectors)
|
||||
for(int i = 0; i < _testFiles.Length; i++)
|
||||
{
|
||||
byte[] sector;
|
||||
var filter = new LZip();
|
||||
filter.Open(_testFiles[i]);
|
||||
|
||||
if(image.Info.Sectors - doneSectors >= sectorsToRead)
|
||||
{
|
||||
sector = image.ReadSectors(doneSectors, sectorsToRead);
|
||||
doneSectors += sectorsToRead;
|
||||
}
|
||||
else
|
||||
{
|
||||
sector = image.ReadSectors(doneSectors, (uint)(image.Info.Sectors - doneSectors));
|
||||
doneSectors += image.Info.Sectors - doneSectors;
|
||||
}
|
||||
var image = new DiscImages.Apple2Mg();
|
||||
bool opened = image.Open(filter);
|
||||
|
||||
ctx.Update(sector);
|
||||
Assert.AreEqual(true, opened, $"Open: {_testFiles[i]}");
|
||||
|
||||
using(new AssertionScope())
|
||||
{
|
||||
Assert.Multiple(() =>
|
||||
{
|
||||
Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]);
|
||||
Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]);
|
||||
Assert.AreEqual(_mediaTypes[i], image.Info.MediaType, _testFiles[i]);
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Assert.AreEqual(_md5S[i], ctx.End(), _testFiles[i]);
|
||||
}
|
||||
// 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++)
|
||||
{
|
||||
var filter = new LZip();
|
||||
filter.Open(_testFiles[i]);
|
||||
|
||||
var image = new DiscImages.Apple2Mg();
|
||||
bool opened = image.Open(filter);
|
||||
ulong doneSectors = 0;
|
||||
|
||||
Assert.AreEqual(true, opened, $"Open: {_testFiles[i]}");
|
||||
var ctx = new Md5Context();
|
||||
|
||||
while(doneSectors < image.Info.Sectors)
|
||||
{
|
||||
byte[] sector;
|
||||
|
||||
if(image.Info.Sectors - doneSectors >= SECTORS_TO_READ)
|
||||
{
|
||||
sector = image.ReadSectors(doneSectors, SECTORS_TO_READ);
|
||||
doneSectors += SECTORS_TO_READ;
|
||||
}
|
||||
else
|
||||
{
|
||||
sector = image.ReadSectors(doneSectors, (uint)(image.Info.Sectors - doneSectors));
|
||||
doneSectors += image.Info.Sectors - doneSectors;
|
||||
}
|
||||
|
||||
ctx.Update(sector);
|
||||
}
|
||||
|
||||
Assert.AreEqual(_md5S[i], ctx.End(), _testFiles[i]);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2539,74 +2539,77 @@ namespace Aaru.Tests.Images.AaruFormat
|
||||
}
|
||||
};
|
||||
|
||||
readonly string _dataFolder = Path.Combine(Consts.TEST_FILES_ROOT, "Media image formats", "AaruFormat", "V1");
|
||||
|
||||
[Test]
|
||||
public void Test()
|
||||
public void Info()
|
||||
{
|
||||
Environment.CurrentDirectory =
|
||||
Path.Combine(Consts.TEST_FILES_ROOT, "Media image formats", "AaruFormat", "V1");
|
||||
Environment.CurrentDirectory = _dataFolder;
|
||||
|
||||
for(int i = 0; i < _testFiles.Length; i++)
|
||||
Assert.Multiple(() =>
|
||||
{
|
||||
var filter = new ZZZNoFilter();
|
||||
filter.Open(_testFiles[i]);
|
||||
|
||||
var image = new DiscImages.AaruFormat();
|
||||
bool opened = image.Open(filter);
|
||||
|
||||
Assert.AreEqual(true, opened, $"Open: {_testFiles[i]}");
|
||||
|
||||
using(new AssertionScope())
|
||||
for(int i = 0; i < _testFiles.Length; i++)
|
||||
{
|
||||
Assert.Multiple(() =>
|
||||
var filter = new ZZZNoFilter();
|
||||
filter.Open(_testFiles[i]);
|
||||
|
||||
var image = new DiscImages.AaruFormat();
|
||||
bool opened = image.Open(filter);
|
||||
|
||||
Assert.AreEqual(true, opened, $"Open: {_testFiles[i]}");
|
||||
|
||||
using(new AssertionScope())
|
||||
{
|
||||
Assert.AreEqual(_sectors[i], image.Info.Sectors, $"Sectors: {_testFiles[i]}");
|
||||
Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, $"Sector size: {_testFiles[i]}");
|
||||
Assert.AreEqual(_mediaTypes[i], image.Info.MediaType, $"Media type: {_testFiles[i]}");
|
||||
|
||||
if(image.Info.XmlMediaType != XmlMediaType.OpticalDisc)
|
||||
return;
|
||||
|
||||
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]}");
|
||||
|
||||
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];
|
||||
|
||||
foreach(Track currentTrack in image.Tracks)
|
||||
Assert.Multiple(() =>
|
||||
{
|
||||
if(image.Info.ReadableSectorTags.Contains(SectorTagType.CdTrackFlags))
|
||||
flags[trackNo] = image.ReadSectorTag(currentTrack.TrackSequence,
|
||||
SectorTagType.CdTrackFlags)[0];
|
||||
Assert.AreEqual(_sectors[i], image.Info.Sectors, $"Sectors: {_testFiles[i]}");
|
||||
Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, $"Sector size: {_testFiles[i]}");
|
||||
Assert.AreEqual(_mediaTypes[i], image.Info.MediaType, $"Media type: {_testFiles[i]}");
|
||||
|
||||
trackNo++;
|
||||
}
|
||||
if(image.Info.XmlMediaType != XmlMediaType.OpticalDisc)
|
||||
return;
|
||||
|
||||
flags.Should().BeEquivalentTo(_trackFlags[i], $"Track flags: {_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]}");
|
||||
|
||||
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];
|
||||
|
||||
foreach(Track currentTrack in image.Tracks)
|
||||
{
|
||||
if(image.Info.ReadableSectorTags.Contains(SectorTagType.CdTrackFlags))
|
||||
flags[trackNo] = image.ReadSectorTag(currentTrack.TrackSequence,
|
||||
SectorTagType.CdTrackFlags)[0];
|
||||
|
||||
trackNo++;
|
||||
}
|
||||
|
||||
flags.Should().BeEquivalentTo(_trackFlags[i], $"Track flags: {_testFiles[i]}");
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// How many sectors to read at once
|
||||
const uint SECTORS_TO_READ = 256;
|
||||
|
||||
[Test]
|
||||
public void Hashes()
|
||||
{
|
||||
// How many sectors to read at once
|
||||
const uint sectorsToRead = 256;
|
||||
|
||||
Environment.CurrentDirectory =
|
||||
Path.Combine(Consts.TEST_FILES_ROOT, "Media image formats", "AaruFormat", "V1");
|
||||
Environment.CurrentDirectory = Environment.CurrentDirectory = _dataFolder;
|
||||
|
||||
Assert.Multiple(() =>
|
||||
{
|
||||
@@ -2639,15 +2642,15 @@ namespace Aaru.Tests.Images.AaruFormat
|
||||
{
|
||||
byte[] sector;
|
||||
|
||||
if(sectors - doneSectors >= sectorsToRead)
|
||||
if(sectors - doneSectors >= SECTORS_TO_READ)
|
||||
{
|
||||
sector =
|
||||
@long ? image.ReadSectorsLong(doneSectors, sectorsToRead,
|
||||
@long ? image.ReadSectorsLong(doneSectors, SECTORS_TO_READ,
|
||||
currentTrack.TrackSequence)
|
||||
: image.ReadSectors(doneSectors, sectorsToRead,
|
||||
: image.ReadSectors(doneSectors, SECTORS_TO_READ,
|
||||
currentTrack.TrackSequence);
|
||||
|
||||
doneSectors += sectorsToRead;
|
||||
doneSectors += SECTORS_TO_READ;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -2682,13 +2685,13 @@ namespace Aaru.Tests.Images.AaruFormat
|
||||
{
|
||||
byte[] sector;
|
||||
|
||||
if(sectors - doneSectors >= sectorsToRead)
|
||||
if(sectors - doneSectors >= SECTORS_TO_READ)
|
||||
{
|
||||
sector = image.ReadSectorsTag(doneSectors, sectorsToRead,
|
||||
sector = image.ReadSectorsTag(doneSectors, SECTORS_TO_READ,
|
||||
currentTrack.TrackSequence,
|
||||
SectorTagType.CdSectorSubchannel);
|
||||
|
||||
doneSectors += sectorsToRead;
|
||||
doneSectors += SECTORS_TO_READ;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -2714,10 +2717,10 @@ namespace Aaru.Tests.Images.AaruFormat
|
||||
{
|
||||
byte[] sector;
|
||||
|
||||
if(image.Info.Sectors - doneSectors >= sectorsToRead)
|
||||
if(image.Info.Sectors - doneSectors >= SECTORS_TO_READ)
|
||||
{
|
||||
sector = image.ReadSectors(doneSectors, sectorsToRead);
|
||||
doneSectors += sectorsToRead;
|
||||
sector = image.ReadSectors(doneSectors, SECTORS_TO_READ);
|
||||
doneSectors += SECTORS_TO_READ;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -2737,8 +2740,7 @@ namespace Aaru.Tests.Images.AaruFormat
|
||||
[Test]
|
||||
public void Tape()
|
||||
{
|
||||
Environment.CurrentDirectory =
|
||||
Path.Combine(Consts.TEST_FILES_ROOT, "Media image formats", "AaruFormat", "V1");
|
||||
Environment.CurrentDirectory = _dataFolder;
|
||||
|
||||
Assert.Multiple(() =>
|
||||
{
|
||||
|
||||
@@ -32,10 +32,10 @@ using System.Linq;
|
||||
using Aaru.Checksums;
|
||||
using Aaru.CommonTypes;
|
||||
using Aaru.CommonTypes.Enums;
|
||||
using Aaru.CommonTypes.Interfaces;
|
||||
using Aaru.CommonTypes.Structs;
|
||||
using Aaru.Filters;
|
||||
using FluentAssertions;
|
||||
using FluentAssertions.Execution;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace Aaru.Tests.Images
|
||||
@@ -1952,120 +1952,135 @@ namespace Aaru.Tests.Images
|
||||
}
|
||||
};
|
||||
|
||||
readonly string _dataFolder = Path.Combine(Consts.TEST_FILES_ROOT, "Media image formats", "Alcohol 120%");
|
||||
|
||||
[Test]
|
||||
public void Test()
|
||||
public void Info()
|
||||
{
|
||||
// How many sectors to read at once
|
||||
const uint sectorsToRead = 256;
|
||||
|
||||
Environment.CurrentDirectory = Path.Combine(Consts.TEST_FILES_ROOT, "Media image formats", "Alcohol 120%");
|
||||
|
||||
IFilter[] filters = new IFilter[_testFiles.Length];
|
||||
Environment.CurrentDirectory = _dataFolder;
|
||||
|
||||
for(int i = 0; i < _testFiles.Length; i++)
|
||||
{
|
||||
filters[i] = new ZZZNoFilter();
|
||||
filters[i].Open(_testFiles[i]);
|
||||
}
|
||||
var filter = new ZZZNoFilter();
|
||||
filter.Open(_testFiles[i]);
|
||||
|
||||
IOpticalMediaImage[] images = new IOpticalMediaImage[_testFiles.Length];
|
||||
var image = new DiscImages.Alcohol120();
|
||||
bool opened = image.Open(filter);
|
||||
|
||||
for(int i = 0; i < _testFiles.Length; i++)
|
||||
{
|
||||
images[i] = new DiscImages.Alcohol120();
|
||||
Assert.AreEqual(true, images[i].Open(filters[i]), $"Open: {_testFiles[i]}");
|
||||
}
|
||||
Assert.AreEqual(true, opened, $"Open: {_testFiles[i]}");
|
||||
|
||||
for(int i = 0; i < _testFiles.Length; i++)
|
||||
Assert.AreEqual(_sectors[i], images[i].Info.Sectors, $"Sectors: {_testFiles[i]}");
|
||||
|
||||
for(int i = 0; i < _testFiles.Length; i++)
|
||||
Assert.AreEqual(_mediaTypes[i], images[i].Info.MediaType, $"Media type: {_testFiles[i]}");
|
||||
|
||||
for(int i = 0; i < _testFiles.Length; i++)
|
||||
Assert.AreEqual(_tracks[i], images[i].Tracks.Count, $"Tracks: {_testFiles[i]}");
|
||||
|
||||
for(int i = 0; i < _testFiles.Length; i++)
|
||||
images[i].Tracks.Select(t => t.TrackSession).Should().
|
||||
BeEquivalentTo(_trackSessions[i], $"Track session: {_testFiles[i]}");
|
||||
|
||||
for(int i = 0; i < _testFiles.Length; i++)
|
||||
images[i].Tracks.Select(t => t.TrackStartSector).Should().
|
||||
BeEquivalentTo(_trackStarts[i], $"Track start: {_testFiles[i]}");
|
||||
|
||||
for(int i = 0; i < _testFiles.Length; i++)
|
||||
images[i].Tracks.Select(t => t.TrackEndSector).Should().
|
||||
BeEquivalentTo(_trackEnds[i], $"Track end: {_testFiles[i]}");
|
||||
|
||||
for(int i = 0; i < _testFiles.Length; i++)
|
||||
images[i].Tracks.Select(t => t.TrackPregap).Should().
|
||||
BeEquivalentTo(_trackPregaps[i], $"Track pregap: {_testFiles[i]}");
|
||||
|
||||
for(int i = 0; i < _testFiles.Length; i++)
|
||||
{
|
||||
int trackNo = 0;
|
||||
|
||||
foreach(Track currentTrack in images[i].Tracks)
|
||||
using(new AssertionScope())
|
||||
{
|
||||
if(images[i].Info.ReadableSectorTags.Contains(SectorTagType.CdTrackFlags))
|
||||
Assert.AreEqual(_trackFlags[i][trackNo],
|
||||
images[i].ReadSectorTag(currentTrack.TrackSequence, SectorTagType.CdTrackFlags)
|
||||
[0], $"Track flags: {_testFiles[i]}, track {currentTrack.TrackSequence}");
|
||||
Assert.Multiple(() =>
|
||||
{
|
||||
Assert.AreEqual(_sectors[i], image.Info.Sectors, $"Sectors: {_testFiles[i]}");
|
||||
Assert.AreEqual(_mediaTypes[i], image.Info.MediaType, $"Media type: {_testFiles[i]}");
|
||||
|
||||
trackNo++;
|
||||
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]}");
|
||||
|
||||
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];
|
||||
|
||||
foreach(Track currentTrack in image.Tracks)
|
||||
{
|
||||
if(image.Info.ReadableSectorTags.Contains(SectorTagType.CdTrackFlags))
|
||||
flags[trackNo] = image.ReadSectorTag(currentTrack.TrackSequence,
|
||||
SectorTagType.CdTrackFlags)[0];
|
||||
|
||||
trackNo++;
|
||||
}
|
||||
|
||||
flags.Should().BeEquivalentTo(_trackFlags[i], $"Track flags: {_testFiles[i]}");
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach(bool @long in new[]
|
||||
// How many sectors to read at once
|
||||
const uint SECTORS_TO_READ = 256;
|
||||
|
||||
[Test]
|
||||
public void Hashes()
|
||||
{
|
||||
Environment.CurrentDirectory = _dataFolder;
|
||||
|
||||
Assert.Multiple(() =>
|
||||
{
|
||||
false, true
|
||||
})
|
||||
for(int i = 0; i < _testFiles.Length; i++)
|
||||
{
|
||||
var ctx = new Md5Context();
|
||||
var filter = new ZZZNoFilter();
|
||||
filter.Open(_testFiles[i]);
|
||||
|
||||
foreach(Track currentTrack in images[i].Tracks)
|
||||
var image = new DiscImages.Alcohol120();
|
||||
bool opened = image.Open(filter);
|
||||
|
||||
Assert.AreEqual(true, opened, $"Open: {_testFiles[i]}");
|
||||
Md5Context ctx;
|
||||
|
||||
foreach(bool @long in new[]
|
||||
{
|
||||
ulong sectors = currentTrack.TrackEndSector - currentTrack.TrackStartSector + 1;
|
||||
ulong doneSectors = 0;
|
||||
false, true
|
||||
})
|
||||
{
|
||||
ctx = new Md5Context();
|
||||
|
||||
while(doneSectors < sectors)
|
||||
foreach(Track currentTrack in image.Tracks)
|
||||
{
|
||||
byte[] sector;
|
||||
ulong sectors = currentTrack.TrackEndSector - currentTrack.TrackStartSector + 1;
|
||||
ulong doneSectors = 0;
|
||||
|
||||
if(sectors - doneSectors >= sectorsToRead)
|
||||
while(doneSectors < sectors)
|
||||
{
|
||||
sector = @long ? images[i].
|
||||
ReadSectorsLong(doneSectors, sectorsToRead, currentTrack.TrackSequence)
|
||||
: images[i].
|
||||
ReadSectors(doneSectors, sectorsToRead, currentTrack.TrackSequence);
|
||||
byte[] sector;
|
||||
|
||||
doneSectors += sectorsToRead;
|
||||
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);
|
||||
}
|
||||
else
|
||||
{
|
||||
sector = @long ? images[i].ReadSectorsLong(doneSectors, (uint)(sectors - doneSectors),
|
||||
currentTrack.TrackSequence)
|
||||
: images[i].ReadSectors(doneSectors, (uint)(sectors - doneSectors),
|
||||
currentTrack.TrackSequence);
|
||||
|
||||
doneSectors += sectors - doneSectors;
|
||||
}
|
||||
|
||||
ctx.Update(sector);
|
||||
}
|
||||
|
||||
Assert.AreEqual(@long ? _longMd5S[i] : _md5S[i], ctx.End(),
|
||||
$"{(@long ? "Long hash" : "Hash")}: {_testFiles[i]}");
|
||||
}
|
||||
|
||||
Assert.AreEqual(@long ? _longMd5S[i] : _md5S[i], ctx.End(),
|
||||
$"{(@long ? "Long hash" : "Hash")}: {_testFiles[i]}");
|
||||
}
|
||||
if(!image.Info.ReadableSectorTags.Contains(SectorTagType.CdSectorSubchannel))
|
||||
continue;
|
||||
|
||||
for(int i = 0; i < _testFiles.Length; i++)
|
||||
if(images[i].Info.ReadableSectorTags.Contains(SectorTagType.CdSectorSubchannel))
|
||||
{
|
||||
var ctx = new Md5Context();
|
||||
ctx = new Md5Context();
|
||||
|
||||
foreach(Track currentTrack in images[i].Tracks)
|
||||
foreach(Track currentTrack in image.Tracks)
|
||||
{
|
||||
ulong sectors = currentTrack.TrackEndSector - currentTrack.TrackStartSector + 1;
|
||||
ulong doneSectors = 0;
|
||||
@@ -2074,19 +2089,18 @@ namespace Aaru.Tests.Images
|
||||
{
|
||||
byte[] sector;
|
||||
|
||||
if(sectors - doneSectors >= sectorsToRead)
|
||||
if(sectors - doneSectors >= SECTORS_TO_READ)
|
||||
{
|
||||
sector = images[i].ReadSectorsTag(doneSectors, sectorsToRead,
|
||||
currentTrack.TrackSequence,
|
||||
SectorTagType.CdSectorSubchannel);
|
||||
sector = image.ReadSectorsTag(doneSectors, SECTORS_TO_READ, currentTrack.TrackSequence,
|
||||
SectorTagType.CdSectorSubchannel);
|
||||
|
||||
doneSectors += sectorsToRead;
|
||||
doneSectors += SECTORS_TO_READ;
|
||||
}
|
||||
else
|
||||
{
|
||||
sector = images[i].ReadSectorsTag(doneSectors, (uint)(sectors - doneSectors),
|
||||
currentTrack.TrackSequence,
|
||||
SectorTagType.CdSectorSubchannel);
|
||||
sector = image.ReadSectorsTag(doneSectors, (uint)(sectors - doneSectors),
|
||||
currentTrack.TrackSequence,
|
||||
SectorTagType.CdSectorSubchannel);
|
||||
|
||||
doneSectors += sectors - doneSectors;
|
||||
}
|
||||
@@ -2097,6 +2111,7 @@ namespace Aaru.Tests.Images
|
||||
|
||||
Assert.AreEqual(_subchannelMd5S[i], ctx.End(), $"Subchannel hash: {_testFiles[i]}");
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -26,11 +26,12 @@
|
||||
// Copyright © 2011-2021 Natalia Portillo
|
||||
// ****************************************************************************/
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
using Aaru.Checksums;
|
||||
using Aaru.CommonTypes;
|
||||
using Aaru.CommonTypes.Interfaces;
|
||||
using Aaru.Filters;
|
||||
using FluentAssertions.Execution;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace Aaru.Tests.Images
|
||||
@@ -70,46 +71,81 @@ namespace Aaru.Tests.Images
|
||||
"243036c4617b666a6c886cc23d7274e0", "09bb2ff964a0c5c223a1900f085e3955"
|
||||
};
|
||||
|
||||
readonly string _dataFolder = Path.Combine(Consts.TEST_FILES_ROOT, "Media image formats", "Anex86");
|
||||
|
||||
[Test]
|
||||
public void Test()
|
||||
public void Info()
|
||||
{
|
||||
for(int i = 0; i < _testFiles.Length; i++)
|
||||
Environment.CurrentDirectory = _dataFolder;
|
||||
|
||||
Assert.Multiple(() =>
|
||||
{
|
||||
string location = Path.Combine(Consts.TEST_FILES_ROOT, "Media image formats", "Anex86", _testFiles[i]);
|
||||
IFilter filter = new LZip();
|
||||
filter.Open(location);
|
||||
IMediaImage image = new DiscImages.Anex86();
|
||||
Assert.AreEqual(true, image.Open(filter), _testFiles[i]);
|
||||
Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]);
|
||||
Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]);
|
||||
Assert.AreEqual(_mediaTypes[i], image.Info.MediaType, _testFiles[i]);
|
||||
|
||||
// How many sectors to read at once
|
||||
const uint sectorsToRead = 256;
|
||||
ulong doneSectors = 0;
|
||||
|
||||
var ctx = new Md5Context();
|
||||
|
||||
while(doneSectors < image.Info.Sectors)
|
||||
for(int i = 0; i < _testFiles.Length; i++)
|
||||
{
|
||||
byte[] sector;
|
||||
var filter = new LZip();
|
||||
filter.Open(_testFiles[i]);
|
||||
|
||||
if(image.Info.Sectors - doneSectors >= sectorsToRead)
|
||||
{
|
||||
sector = image.ReadSectors(doneSectors, sectorsToRead);
|
||||
doneSectors += sectorsToRead;
|
||||
}
|
||||
else
|
||||
{
|
||||
sector = image.ReadSectors(doneSectors, (uint)(image.Info.Sectors - doneSectors));
|
||||
doneSectors += image.Info.Sectors - doneSectors;
|
||||
}
|
||||
var image = new DiscImages.Anex86();
|
||||
bool opened = image.Open(filter);
|
||||
|
||||
ctx.Update(sector);
|
||||
Assert.AreEqual(true, opened, $"Open: {_testFiles[i]}");
|
||||
|
||||
using(new AssertionScope())
|
||||
{
|
||||
Assert.Multiple(() =>
|
||||
{
|
||||
Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]);
|
||||
Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]);
|
||||
Assert.AreEqual(_mediaTypes[i], image.Info.MediaType, _testFiles[i]);
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Assert.AreEqual(_md5S[i], ctx.End(), _testFiles[i]);
|
||||
}
|
||||
// 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++)
|
||||
{
|
||||
var filter = new LZip();
|
||||
filter.Open(_testFiles[i]);
|
||||
|
||||
var image = new DiscImages.Anex86();
|
||||
bool opened = image.Open(filter);
|
||||
ulong doneSectors = 0;
|
||||
|
||||
Assert.AreEqual(true, opened, $"Open: {_testFiles[i]}");
|
||||
var ctx = new Md5Context();
|
||||
|
||||
while(doneSectors < image.Info.Sectors)
|
||||
{
|
||||
byte[] sector;
|
||||
|
||||
if(image.Info.Sectors - doneSectors >= SECTORS_TO_READ)
|
||||
{
|
||||
sector = image.ReadSectors(doneSectors, SECTORS_TO_READ);
|
||||
doneSectors += SECTORS_TO_READ;
|
||||
}
|
||||
else
|
||||
{
|
||||
sector = image.ReadSectors(doneSectors, (uint)(image.Info.Sectors - doneSectors));
|
||||
doneSectors += image.Info.Sectors - doneSectors;
|
||||
}
|
||||
|
||||
ctx.Update(sector);
|
||||
}
|
||||
|
||||
Assert.AreEqual(_md5S[i], ctx.End(), _testFiles[i]);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -175,7 +175,7 @@ namespace Aaru.Tests.Images.AppleDOS
|
||||
}
|
||||
|
||||
// How many sectors to read at once
|
||||
const uint _sectorsToRead = 256;
|
||||
const uint SECTORS_TO_READ = 256;
|
||||
|
||||
[Test]
|
||||
public void Hashes()
|
||||
@@ -200,10 +200,10 @@ namespace Aaru.Tests.Images.AppleDOS
|
||||
{
|
||||
byte[] sector;
|
||||
|
||||
if(image.Info.Sectors - doneSectors >= _sectorsToRead)
|
||||
if(image.Info.Sectors - doneSectors >= SECTORS_TO_READ)
|
||||
{
|
||||
sector = image.ReadSectors(doneSectors, _sectorsToRead);
|
||||
doneSectors += _sectorsToRead;
|
||||
sector = image.ReadSectors(doneSectors, SECTORS_TO_READ);
|
||||
doneSectors += SECTORS_TO_READ;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -103,7 +103,7 @@ namespace Aaru.Tests.Images.AppleDOS
|
||||
}
|
||||
|
||||
// How many sectors to read at once
|
||||
const uint _sectorsToRead = 256;
|
||||
const uint SECTORS_TO_READ = 256;
|
||||
|
||||
[Test]
|
||||
public void Hashes()
|
||||
@@ -128,10 +128,10 @@ namespace Aaru.Tests.Images.AppleDOS
|
||||
{
|
||||
byte[] sector;
|
||||
|
||||
if(image.Info.Sectors - doneSectors >= _sectorsToRead)
|
||||
if(image.Info.Sectors - doneSectors >= SECTORS_TO_READ)
|
||||
{
|
||||
sector = image.ReadSectors(doneSectors, _sectorsToRead);
|
||||
doneSectors += _sectorsToRead;
|
||||
sector = image.ReadSectors(doneSectors, SECTORS_TO_READ);
|
||||
doneSectors += SECTORS_TO_READ;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -45,6 +45,7 @@ namespace Aaru.Tests.Images.AppleDOS
|
||||
"dos33.po.lz", "hfs1440.po.lz", "hfs.po.lz", "pascal800.po.lz", "pascal.po.lz", "prodos1440.po.lz",
|
||||
"prodos5mb.po.lz", "prodos800.po.lz", "prodosmod.po.lz", "prodos.po.lz"
|
||||
};
|
||||
|
||||
readonly ulong[] _sectors =
|
||||
{
|
||||
// dos33.po.lz
|
||||
@@ -77,6 +78,7 @@ namespace Aaru.Tests.Images.AppleDOS
|
||||
// prodos.po.lz
|
||||
560
|
||||
};
|
||||
|
||||
readonly uint[] _sectorSize =
|
||||
{
|
||||
// dos33.po.lz
|
||||
@@ -109,6 +111,7 @@ namespace Aaru.Tests.Images.AppleDOS
|
||||
// prodos.po.lz
|
||||
256
|
||||
};
|
||||
|
||||
readonly MediaType[] _mediaTypes =
|
||||
{
|
||||
// dos33.po.lz
|
||||
@@ -141,6 +144,7 @@ namespace Aaru.Tests.Images.AppleDOS
|
||||
// prodos.po.lz
|
||||
MediaType.Apple33SS
|
||||
};
|
||||
|
||||
readonly string[] _md5S =
|
||||
{
|
||||
// dos33.po.lz
|
||||
@@ -207,7 +211,7 @@ namespace Aaru.Tests.Images.AppleDOS
|
||||
}
|
||||
|
||||
// How many sectors to read at once
|
||||
const uint _sectorsToRead = 256;
|
||||
const uint SECTORS_TO_READ = 256;
|
||||
|
||||
[Test]
|
||||
public void Hashes()
|
||||
@@ -232,10 +236,10 @@ namespace Aaru.Tests.Images.AppleDOS
|
||||
{
|
||||
byte[] sector;
|
||||
|
||||
if(image.Info.Sectors - doneSectors >= _sectorsToRead)
|
||||
if(image.Info.Sectors - doneSectors >= SECTORS_TO_READ)
|
||||
{
|
||||
sector = image.ReadSectors(doneSectors, _sectorsToRead);
|
||||
doneSectors += _sectorsToRead;
|
||||
sector = image.ReadSectors(doneSectors, SECTORS_TO_READ);
|
||||
doneSectors += SECTORS_TO_READ;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -140,7 +140,7 @@ namespace Aaru.Tests.Images
|
||||
}
|
||||
|
||||
// How many sectors to read at once
|
||||
const uint _sectorsToRead = 256;
|
||||
const uint SECTORS_TO_READ = 256;
|
||||
|
||||
[Test]
|
||||
public void Hashes()
|
||||
@@ -169,10 +169,10 @@ namespace Aaru.Tests.Images
|
||||
{
|
||||
byte[] sector;
|
||||
|
||||
if(image.Info.Sectors - doneSectors >= _sectorsToRead)
|
||||
if(image.Info.Sectors - doneSectors >= SECTORS_TO_READ)
|
||||
{
|
||||
sector = image.ReadSectors(doneSectors, _sectorsToRead);
|
||||
doneSectors += _sectorsToRead;
|
||||
sector = image.ReadSectors(doneSectors, SECTORS_TO_READ);
|
||||
doneSectors += SECTORS_TO_READ;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -133,7 +133,7 @@ namespace Aaru.Tests.Images
|
||||
}
|
||||
|
||||
// How many sectors to read at once
|
||||
const uint _sectorsToRead = 256;
|
||||
const uint SECTORS_TO_READ = 256;
|
||||
|
||||
[Test]
|
||||
public void Hashes()
|
||||
@@ -158,10 +158,10 @@ namespace Aaru.Tests.Images
|
||||
{
|
||||
byte[] sector;
|
||||
|
||||
if(image.Info.Sectors - doneSectors >= _sectorsToRead)
|
||||
if(image.Info.Sectors - doneSectors >= SECTORS_TO_READ)
|
||||
{
|
||||
sector = image.ReadSectors(doneSectors, _sectorsToRead);
|
||||
doneSectors += _sectorsToRead;
|
||||
sector = image.ReadSectors(doneSectors, SECTORS_TO_READ);
|
||||
doneSectors += SECTORS_TO_READ;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -32,10 +32,10 @@ using System.Linq;
|
||||
using Aaru.Checksums;
|
||||
using Aaru.CommonTypes;
|
||||
using Aaru.CommonTypes.Enums;
|
||||
using Aaru.CommonTypes.Interfaces;
|
||||
using Aaru.CommonTypes.Structs;
|
||||
using Aaru.Filters;
|
||||
using FluentAssertions;
|
||||
using FluentAssertions.Execution;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace Aaru.Tests.Images
|
||||
@@ -1004,120 +1004,135 @@ namespace Aaru.Tests.Images
|
||||
}
|
||||
};
|
||||
|
||||
readonly string _dataFolder = Path.Combine(Consts.TEST_FILES_ROOT, "Media image formats", "BlindWrite 4");
|
||||
|
||||
[Test]
|
||||
public void Test()
|
||||
public void Info()
|
||||
{
|
||||
// How many sectors to read at once
|
||||
const uint sectorsToRead = 256;
|
||||
|
||||
Environment.CurrentDirectory = Path.Combine(Consts.TEST_FILES_ROOT, "Media image formats", "BlindWrite 4");
|
||||
|
||||
IFilter[] filters = new IFilter[_testFiles.Length];
|
||||
Environment.CurrentDirectory = _dataFolder;
|
||||
|
||||
for(int i = 0; i < _testFiles.Length; i++)
|
||||
{
|
||||
filters[i] = new ZZZNoFilter();
|
||||
filters[i].Open(_testFiles[i]);
|
||||
}
|
||||
var filter = new ZZZNoFilter();
|
||||
filter.Open(_testFiles[i]);
|
||||
|
||||
IOpticalMediaImage[] images = new IOpticalMediaImage[_testFiles.Length];
|
||||
var image = new DiscImages.BlindWrite4();
|
||||
bool opened = image.Open(filter);
|
||||
|
||||
for(int i = 0; i < _testFiles.Length; i++)
|
||||
{
|
||||
images[i] = new DiscImages.BlindWrite4();
|
||||
Assert.AreEqual(true, images[i].Open(filters[i]), $"Open: {_testFiles[i]}");
|
||||
}
|
||||
Assert.AreEqual(true, opened, $"Open: {_testFiles[i]}");
|
||||
|
||||
for(int i = 0; i < _testFiles.Length; i++)
|
||||
Assert.AreEqual(_sectors[i], images[i].Info.Sectors, $"Sectors: {_testFiles[i]}");
|
||||
|
||||
for(int i = 0; i < _testFiles.Length; i++)
|
||||
Assert.AreEqual(_mediaTypes[i], images[i].Info.MediaType, $"Media type: {_testFiles[i]}");
|
||||
|
||||
for(int i = 0; i < _testFiles.Length; i++)
|
||||
Assert.AreEqual(_tracks[i], images[i].Tracks.Count, $"Tracks: {_testFiles[i]}");
|
||||
|
||||
for(int i = 0; i < _testFiles.Length; i++)
|
||||
images[i].Tracks.Select(t => t.TrackSession).Should().
|
||||
BeEquivalentTo(_trackSessions[i], $"Track session: {_testFiles[i]}");
|
||||
|
||||
for(int i = 0; i < _testFiles.Length; i++)
|
||||
images[i].Tracks.Select(t => t.TrackStartSector).Should().
|
||||
BeEquivalentTo(_trackStarts[i], $"Track start: {_testFiles[i]}");
|
||||
|
||||
for(int i = 0; i < _testFiles.Length; i++)
|
||||
images[i].Tracks.Select(t => t.TrackEndSector).Should().
|
||||
BeEquivalentTo(_trackEnds[i], $"Track end: {_testFiles[i]}");
|
||||
|
||||
for(int i = 0; i < _testFiles.Length; i++)
|
||||
images[i].Tracks.Select(t => t.TrackPregap).Should().
|
||||
BeEquivalentTo(_trackPregaps[i], $"Track pregap: {_testFiles[i]}");
|
||||
|
||||
for(int i = 0; i < _testFiles.Length; i++)
|
||||
{
|
||||
int trackNo = 0;
|
||||
|
||||
foreach(Track currentTrack in images[i].Tracks)
|
||||
using(new AssertionScope())
|
||||
{
|
||||
if(images[i].Info.ReadableSectorTags.Contains(SectorTagType.CdTrackFlags))
|
||||
Assert.AreEqual(_trackFlags[i][trackNo],
|
||||
images[i].ReadSectorTag(currentTrack.TrackSequence, SectorTagType.CdTrackFlags)
|
||||
[0], $"Track flags: {_testFiles[i]}, track {currentTrack.TrackSequence}");
|
||||
Assert.Multiple(() =>
|
||||
{
|
||||
Assert.AreEqual(_sectors[i], image.Info.Sectors, $"Sectors: {_testFiles[i]}");
|
||||
Assert.AreEqual(_mediaTypes[i], image.Info.MediaType, $"Media type: {_testFiles[i]}");
|
||||
|
||||
trackNo++;
|
||||
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]}");
|
||||
|
||||
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];
|
||||
|
||||
foreach(Track currentTrack in image.Tracks)
|
||||
{
|
||||
if(image.Info.ReadableSectorTags.Contains(SectorTagType.CdTrackFlags))
|
||||
flags[trackNo] = image.ReadSectorTag(currentTrack.TrackSequence,
|
||||
SectorTagType.CdTrackFlags)[0];
|
||||
|
||||
trackNo++;
|
||||
}
|
||||
|
||||
flags.Should().BeEquivalentTo(_trackFlags[i], $"Track flags: {_testFiles[i]}");
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach(bool @long in new[]
|
||||
// How many sectors to read at once
|
||||
const uint SECTORS_TO_READ = 256;
|
||||
|
||||
[Test]
|
||||
public void Hashes()
|
||||
{
|
||||
Environment.CurrentDirectory = _dataFolder;
|
||||
|
||||
Assert.Multiple(() =>
|
||||
{
|
||||
false, true
|
||||
})
|
||||
for(int i = 0; i < _testFiles.Length; i++)
|
||||
{
|
||||
var ctx = new Md5Context();
|
||||
var filter = new ZZZNoFilter();
|
||||
filter.Open(_testFiles[i]);
|
||||
|
||||
foreach(Track currentTrack in images[i].Tracks)
|
||||
var image = new DiscImages.BlindWrite4();
|
||||
bool opened = image.Open(filter);
|
||||
|
||||
Assert.AreEqual(true, opened, $"Open: {_testFiles[i]}");
|
||||
Md5Context ctx;
|
||||
|
||||
foreach(bool @long in new[]
|
||||
{
|
||||
ulong sectors = currentTrack.TrackEndSector - currentTrack.TrackStartSector + 1;
|
||||
ulong doneSectors = 0;
|
||||
false, true
|
||||
})
|
||||
{
|
||||
ctx = new Md5Context();
|
||||
|
||||
while(doneSectors < sectors)
|
||||
foreach(Track currentTrack in image.Tracks)
|
||||
{
|
||||
byte[] sector;
|
||||
ulong sectors = currentTrack.TrackEndSector - currentTrack.TrackStartSector + 1;
|
||||
ulong doneSectors = 0;
|
||||
|
||||
if(sectors - doneSectors >= sectorsToRead)
|
||||
while(doneSectors < sectors)
|
||||
{
|
||||
sector = @long ? images[i].
|
||||
ReadSectorsLong(doneSectors, sectorsToRead, currentTrack.TrackSequence)
|
||||
: images[i].
|
||||
ReadSectors(doneSectors, sectorsToRead, currentTrack.TrackSequence);
|
||||
byte[] sector;
|
||||
|
||||
doneSectors += sectorsToRead;
|
||||
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);
|
||||
}
|
||||
else
|
||||
{
|
||||
sector = @long ? images[i].ReadSectorsLong(doneSectors, (uint)(sectors - doneSectors),
|
||||
currentTrack.TrackSequence)
|
||||
: images[i].ReadSectors(doneSectors, (uint)(sectors - doneSectors),
|
||||
currentTrack.TrackSequence);
|
||||
|
||||
doneSectors += sectors - doneSectors;
|
||||
}
|
||||
|
||||
ctx.Update(sector);
|
||||
}
|
||||
|
||||
Assert.AreEqual(@long ? _longMd5S[i] : _md5S[i], ctx.End(),
|
||||
$"{(@long ? "Long hash" : "Hash")}: {_testFiles[i]}");
|
||||
}
|
||||
|
||||
Assert.AreEqual(@long ? _longMd5S[i] : _md5S[i], ctx.End(),
|
||||
$"{(@long ? "Long hash" : "Hash")}: {_testFiles[i]}");
|
||||
}
|
||||
if(!image.Info.ReadableSectorTags.Contains(SectorTagType.CdSectorSubchannel))
|
||||
continue;
|
||||
|
||||
for(int i = 0; i < _testFiles.Length; i++)
|
||||
if(images[i].Info.ReadableSectorTags.Contains(SectorTagType.CdSectorSubchannel))
|
||||
{
|
||||
var ctx = new Md5Context();
|
||||
ctx = new Md5Context();
|
||||
|
||||
foreach(Track currentTrack in images[i].Tracks)
|
||||
foreach(Track currentTrack in image.Tracks)
|
||||
{
|
||||
ulong sectors = currentTrack.TrackEndSector - currentTrack.TrackStartSector + 1;
|
||||
ulong doneSectors = 0;
|
||||
@@ -1126,19 +1141,18 @@ namespace Aaru.Tests.Images
|
||||
{
|
||||
byte[] sector;
|
||||
|
||||
if(sectors - doneSectors >= sectorsToRead)
|
||||
if(sectors - doneSectors >= SECTORS_TO_READ)
|
||||
{
|
||||
sector = images[i].ReadSectorsTag(doneSectors, sectorsToRead,
|
||||
currentTrack.TrackSequence,
|
||||
SectorTagType.CdSectorSubchannel);
|
||||
sector = image.ReadSectorsTag(doneSectors, SECTORS_TO_READ, currentTrack.TrackSequence,
|
||||
SectorTagType.CdSectorSubchannel);
|
||||
|
||||
doneSectors += sectorsToRead;
|
||||
doneSectors += SECTORS_TO_READ;
|
||||
}
|
||||
else
|
||||
{
|
||||
sector = images[i].ReadSectorsTag(doneSectors, (uint)(sectors - doneSectors),
|
||||
currentTrack.TrackSequence,
|
||||
SectorTagType.CdSectorSubchannel);
|
||||
sector = image.ReadSectorsTag(doneSectors, (uint)(sectors - doneSectors),
|
||||
currentTrack.TrackSequence,
|
||||
SectorTagType.CdSectorSubchannel);
|
||||
|
||||
doneSectors += sectors - doneSectors;
|
||||
}
|
||||
@@ -1149,6 +1163,7 @@ namespace Aaru.Tests.Images
|
||||
|
||||
Assert.AreEqual(_subchannelMd5S[i], ctx.End(), $"Subchannel hash: {_testFiles[i]}");
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -32,10 +32,10 @@ using System.Linq;
|
||||
using Aaru.Checksums;
|
||||
using Aaru.CommonTypes;
|
||||
using Aaru.CommonTypes.Enums;
|
||||
using Aaru.CommonTypes.Interfaces;
|
||||
using Aaru.CommonTypes.Structs;
|
||||
using Aaru.Filters;
|
||||
using FluentAssertions;
|
||||
using FluentAssertions.Execution;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace Aaru.Tests.Images
|
||||
@@ -1190,121 +1190,135 @@ namespace Aaru.Tests.Images
|
||||
}
|
||||
};
|
||||
|
||||
readonly string _dataFolder = Path.Combine(Consts.TEST_FILES_ROOT, "Media image formats", "BlindWrite 5");
|
||||
|
||||
[Test]
|
||||
public void Test()
|
||||
public void Info()
|
||||
{
|
||||
// How many sectors to read at once
|
||||
const uint sectorsToRead = 256;
|
||||
|
||||
Environment.CurrentDirectory = Path.Combine(Consts.TEST_FILES_ROOT, "Media image formats", "BlindWrite 5");
|
||||
|
||||
IFilter[] filters = new IFilter[_testFiles.Length];
|
||||
Environment.CurrentDirectory = _dataFolder;
|
||||
|
||||
for(int i = 0; i < _testFiles.Length; i++)
|
||||
{
|
||||
filters[i] = new ZZZNoFilter();
|
||||
filters[i].Open(_testFiles[i]);
|
||||
}
|
||||
var filter = new ZZZNoFilter();
|
||||
filter.Open(_testFiles[i]);
|
||||
|
||||
IOpticalMediaImage[] images = new IOpticalMediaImage[_testFiles.Length];
|
||||
var image = new DiscImages.BlindWrite5();
|
||||
bool opened = image.Open(filter);
|
||||
|
||||
for(int i = 0; i < _testFiles.Length; i++)
|
||||
{
|
||||
images[i] = new DiscImages.BlindWrite5();
|
||||
System.Console.WriteLine(_testFiles[i]);
|
||||
Assert.AreEqual(true, images[i].Open(filters[i]), $"Open: {_testFiles[i]}");
|
||||
}
|
||||
Assert.AreEqual(true, opened, $"Open: {_testFiles[i]}");
|
||||
|
||||
for(int i = 0; i < _testFiles.Length; i++)
|
||||
Assert.AreEqual(_sectors[i], images[i].Info.Sectors, $"Sectors: {_testFiles[i]}");
|
||||
|
||||
for(int i = 0; i < _testFiles.Length; i++)
|
||||
Assert.AreEqual(_mediaTypes[i], images[i].Info.MediaType, $"Media type: {_testFiles[i]}");
|
||||
|
||||
for(int i = 0; i < _testFiles.Length; i++)
|
||||
Assert.AreEqual(_tracks[i], images[i].Tracks.Count, $"Tracks: {_testFiles[i]}");
|
||||
|
||||
for(int i = 0; i < _testFiles.Length; i++)
|
||||
images[i].Tracks.Select(t => t.TrackSession).Should().
|
||||
BeEquivalentTo(_trackSessions[i], $"Track session: {_testFiles[i]}");
|
||||
|
||||
for(int i = 0; i < _testFiles.Length; i++)
|
||||
images[i].Tracks.Select(t => t.TrackStartSector).Should().
|
||||
BeEquivalentTo(_trackStarts[i], $"Track start: {_testFiles[i]}");
|
||||
|
||||
for(int i = 0; i < _testFiles.Length; i++)
|
||||
images[i].Tracks.Select(t => t.TrackEndSector).Should().
|
||||
BeEquivalentTo(_trackEnds[i], $"Track end: {_testFiles[i]}");
|
||||
|
||||
for(int i = 0; i < _testFiles.Length; i++)
|
||||
images[i].Tracks.Select(t => t.TrackPregap).Should().
|
||||
BeEquivalentTo(_trackPregaps[i], $"Track pregap: {_testFiles[i]}");
|
||||
|
||||
for(int i = 0; i < _testFiles.Length; i++)
|
||||
{
|
||||
int trackNo = 0;
|
||||
|
||||
foreach(Track currentTrack in images[i].Tracks)
|
||||
using(new AssertionScope())
|
||||
{
|
||||
if(images[i].Info.ReadableSectorTags.Contains(SectorTagType.CdTrackFlags))
|
||||
Assert.AreEqual(_trackFlags[i][trackNo],
|
||||
images[i].ReadSectorTag(currentTrack.TrackSequence, SectorTagType.CdTrackFlags)
|
||||
[0], $"Track flags: {_testFiles[i]}, track {currentTrack.TrackSequence}");
|
||||
Assert.Multiple(() =>
|
||||
{
|
||||
Assert.AreEqual(_sectors[i], image.Info.Sectors, $"Sectors: {_testFiles[i]}");
|
||||
Assert.AreEqual(_mediaTypes[i], image.Info.MediaType, $"Media type: {_testFiles[i]}");
|
||||
|
||||
trackNo++;
|
||||
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]}");
|
||||
|
||||
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];
|
||||
|
||||
foreach(Track currentTrack in image.Tracks)
|
||||
{
|
||||
if(image.Info.ReadableSectorTags.Contains(SectorTagType.CdTrackFlags))
|
||||
flags[trackNo] = image.ReadSectorTag(currentTrack.TrackSequence,
|
||||
SectorTagType.CdTrackFlags)[0];
|
||||
|
||||
trackNo++;
|
||||
}
|
||||
|
||||
flags.Should().BeEquivalentTo(_trackFlags[i], $"Track flags: {_testFiles[i]}");
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach(bool @long in new[]
|
||||
// How many sectors to read at once
|
||||
const uint SECTORS_TO_READ = 256;
|
||||
|
||||
[Test]
|
||||
public void Hashes()
|
||||
{
|
||||
Environment.CurrentDirectory = _dataFolder;
|
||||
|
||||
Assert.Multiple(() =>
|
||||
{
|
||||
false, true
|
||||
})
|
||||
for(int i = 0; i < _testFiles.Length; i++)
|
||||
{
|
||||
var ctx = new Md5Context();
|
||||
var filter = new ZZZNoFilter();
|
||||
filter.Open(_testFiles[i]);
|
||||
|
||||
foreach(Track currentTrack in images[i].Tracks)
|
||||
var image = new DiscImages.BlindWrite5();
|
||||
bool opened = image.Open(filter);
|
||||
|
||||
Assert.AreEqual(true, opened, $"Open: {_testFiles[i]}");
|
||||
Md5Context ctx;
|
||||
|
||||
foreach(bool @long in new[]
|
||||
{
|
||||
ulong sectors = currentTrack.TrackEndSector - currentTrack.TrackStartSector + 1;
|
||||
ulong doneSectors = 0;
|
||||
false, true
|
||||
})
|
||||
{
|
||||
ctx = new Md5Context();
|
||||
|
||||
while(doneSectors < sectors)
|
||||
foreach(Track currentTrack in image.Tracks)
|
||||
{
|
||||
byte[] sector;
|
||||
ulong sectors = currentTrack.TrackEndSector - currentTrack.TrackStartSector + 1;
|
||||
ulong doneSectors = 0;
|
||||
|
||||
if(sectors - doneSectors >= sectorsToRead)
|
||||
while(doneSectors < sectors)
|
||||
{
|
||||
sector = @long ? images[i].
|
||||
ReadSectorsLong(doneSectors, sectorsToRead, currentTrack.TrackSequence)
|
||||
: images[i].
|
||||
ReadSectors(doneSectors, sectorsToRead, currentTrack.TrackSequence);
|
||||
byte[] sector;
|
||||
|
||||
doneSectors += sectorsToRead;
|
||||
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);
|
||||
}
|
||||
else
|
||||
{
|
||||
sector = @long ? images[i].ReadSectorsLong(doneSectors, (uint)(sectors - doneSectors),
|
||||
currentTrack.TrackSequence)
|
||||
: images[i].ReadSectors(doneSectors, (uint)(sectors - doneSectors),
|
||||
currentTrack.TrackSequence);
|
||||
|
||||
doneSectors += sectors - doneSectors;
|
||||
}
|
||||
|
||||
ctx.Update(sector);
|
||||
}
|
||||
|
||||
Assert.AreEqual(@long ? _longMd5S[i] : _md5S[i], ctx.End(),
|
||||
$"{(@long ? "Long hash" : "Hash")}: {_testFiles[i]}");
|
||||
}
|
||||
|
||||
Assert.AreEqual(@long ? _longMd5S[i] : _md5S[i], ctx.End(),
|
||||
$"{(@long ? "Long hash" : "Hash")}: {_testFiles[i]}");
|
||||
}
|
||||
if(!image.Info.ReadableSectorTags.Contains(SectorTagType.CdSectorSubchannel))
|
||||
continue;
|
||||
|
||||
for(int i = 0; i < _testFiles.Length; i++)
|
||||
if(images[i].Info.ReadableSectorTags.Contains(SectorTagType.CdSectorSubchannel))
|
||||
{
|
||||
var ctx = new Md5Context();
|
||||
ctx = new Md5Context();
|
||||
|
||||
foreach(Track currentTrack in images[i].Tracks)
|
||||
foreach(Track currentTrack in image.Tracks)
|
||||
{
|
||||
ulong sectors = currentTrack.TrackEndSector - currentTrack.TrackStartSector + 1;
|
||||
ulong doneSectors = 0;
|
||||
@@ -1313,19 +1327,18 @@ namespace Aaru.Tests.Images
|
||||
{
|
||||
byte[] sector;
|
||||
|
||||
if(sectors - doneSectors >= sectorsToRead)
|
||||
if(sectors - doneSectors >= SECTORS_TO_READ)
|
||||
{
|
||||
sector = images[i].ReadSectorsTag(doneSectors, sectorsToRead,
|
||||
currentTrack.TrackSequence,
|
||||
SectorTagType.CdSectorSubchannel);
|
||||
sector = image.ReadSectorsTag(doneSectors, SECTORS_TO_READ, currentTrack.TrackSequence,
|
||||
SectorTagType.CdSectorSubchannel);
|
||||
|
||||
doneSectors += sectorsToRead;
|
||||
doneSectors += SECTORS_TO_READ;
|
||||
}
|
||||
else
|
||||
{
|
||||
sector = images[i].ReadSectorsTag(doneSectors, (uint)(sectors - doneSectors),
|
||||
currentTrack.TrackSequence,
|
||||
SectorTagType.CdSectorSubchannel);
|
||||
sector = image.ReadSectorsTag(doneSectors, (uint)(sectors - doneSectors),
|
||||
currentTrack.TrackSequence,
|
||||
SectorTagType.CdSectorSubchannel);
|
||||
|
||||
doneSectors += sectors - doneSectors;
|
||||
}
|
||||
@@ -1336,6 +1349,7 @@ namespace Aaru.Tests.Images
|
||||
|
||||
Assert.AreEqual(_subchannelMd5S[i], ctx.End(), $"Subchannel hash: {_testFiles[i]}");
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -32,10 +32,10 @@ using System.Linq;
|
||||
using Aaru.Checksums;
|
||||
using Aaru.CommonTypes;
|
||||
using Aaru.CommonTypes.Enums;
|
||||
using Aaru.CommonTypes.Interfaces;
|
||||
using Aaru.CommonTypes.Structs;
|
||||
using Aaru.Filters;
|
||||
using FluentAssertions;
|
||||
using FluentAssertions.Execution;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace Aaru.Tests.Images
|
||||
@@ -467,117 +467,135 @@ namespace Aaru.Tests.Images
|
||||
}
|
||||
};
|
||||
|
||||
readonly string _dataFolder = Path.Combine(Consts.TEST_FILES_ROOT, "Media image formats", "BlindWrite 6");
|
||||
|
||||
[Test]
|
||||
public void Test()
|
||||
public void Info()
|
||||
{
|
||||
// How many sectors to read at once
|
||||
const uint sectorsToRead = 256;
|
||||
|
||||
Environment.CurrentDirectory = Path.Combine(Consts.TEST_FILES_ROOT, "Media image formats", "BlindWrite 6");
|
||||
|
||||
IFilter[] filters = new IFilter[_testFiles.Length];
|
||||
Environment.CurrentDirectory = _dataFolder;
|
||||
|
||||
for(int i = 0; i < _testFiles.Length; i++)
|
||||
{
|
||||
filters[i] = new ZZZNoFilter();
|
||||
filters[i].Open(_testFiles[i]);
|
||||
}
|
||||
var filter = new ZZZNoFilter();
|
||||
filter.Open(_testFiles[i]);
|
||||
|
||||
IOpticalMediaImage[] images = new IOpticalMediaImage[_testFiles.Length];
|
||||
var image = new DiscImages.BlindWrite5();
|
||||
bool opened = image.Open(filter);
|
||||
|
||||
for(int i = 0; i < _testFiles.Length; i++)
|
||||
{
|
||||
images[i] = new DiscImages.BlindWrite5();
|
||||
Assert.AreEqual(true, images[i].Open(filters[i]), $"Open: {_testFiles[i]}");
|
||||
}
|
||||
Assert.AreEqual(true, opened, $"Open: {_testFiles[i]}");
|
||||
|
||||
for(int i = 0; i < _testFiles.Length; i++)
|
||||
Assert.AreEqual(_sectors[i], images[i].Info.Sectors, $"Sectors: {_testFiles[i]}");
|
||||
|
||||
for(int i = 0; i < _testFiles.Length; i++)
|
||||
Assert.AreEqual(_mediaTypes[i], images[i].Info.MediaType, $"Media type: {_testFiles[i]}");
|
||||
|
||||
for(int i = 0; i < _testFiles.Length; i++)
|
||||
images[i].Tracks.Select(t => t.TrackSession).Should().
|
||||
BeEquivalentTo(_trackSessions[i], $"Track session: {_testFiles[i]}");
|
||||
|
||||
for(int i = 0; i < _testFiles.Length; i++)
|
||||
images[i].Tracks.Select(t => t.TrackStartSector).Should().
|
||||
BeEquivalentTo(_trackStarts[i], $"Track start: {_testFiles[i]}");
|
||||
|
||||
for(int i = 0; i < _testFiles.Length; i++)
|
||||
images[i].Tracks.Select(t => t.TrackEndSector).Should().
|
||||
BeEquivalentTo(_trackEnds[i], $"Track end: {_testFiles[i]}");
|
||||
|
||||
for(int i = 0; i < _testFiles.Length; i++)
|
||||
images[i].Tracks.Select(t => t.TrackPregap).Should().
|
||||
BeEquivalentTo(_trackPregaps[i], $"Track pregap: {_testFiles[i]}");
|
||||
|
||||
for(int i = 0; i < _testFiles.Length; i++)
|
||||
{
|
||||
int trackNo = 0;
|
||||
|
||||
foreach(Track currentTrack in images[i].Tracks)
|
||||
using(new AssertionScope())
|
||||
{
|
||||
if(images[i].Info.ReadableSectorTags.Contains(SectorTagType.CdTrackFlags))
|
||||
Assert.AreEqual(_trackFlags[i][trackNo],
|
||||
images[i].ReadSectorTag(currentTrack.TrackSequence, SectorTagType.CdTrackFlags)
|
||||
[0], $"Track flags: {_testFiles[i]}, track {currentTrack.TrackSequence}");
|
||||
Assert.Multiple(() =>
|
||||
{
|
||||
Assert.AreEqual(_sectors[i], image.Info.Sectors, $"Sectors: {_testFiles[i]}");
|
||||
Assert.AreEqual(_mediaTypes[i], image.Info.MediaType, $"Media type: {_testFiles[i]}");
|
||||
|
||||
trackNo++;
|
||||
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]}");
|
||||
|
||||
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];
|
||||
|
||||
foreach(Track currentTrack in image.Tracks)
|
||||
{
|
||||
if(image.Info.ReadableSectorTags.Contains(SectorTagType.CdTrackFlags))
|
||||
flags[trackNo] = image.ReadSectorTag(currentTrack.TrackSequence,
|
||||
SectorTagType.CdTrackFlags)[0];
|
||||
|
||||
trackNo++;
|
||||
}
|
||||
|
||||
flags.Should().BeEquivalentTo(_trackFlags[i], $"Track flags: {_testFiles[i]}");
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach(bool @long in new[]
|
||||
// How many sectors to read at once
|
||||
const uint SECTORS_TO_READ = 256;
|
||||
|
||||
[Test]
|
||||
public void Hashes()
|
||||
{
|
||||
Environment.CurrentDirectory = _dataFolder;
|
||||
|
||||
Assert.Multiple(() =>
|
||||
{
|
||||
false, true
|
||||
})
|
||||
for(int i = 0; i < _testFiles.Length; i++)
|
||||
{
|
||||
var ctx = new Md5Context();
|
||||
var filter = new ZZZNoFilter();
|
||||
filter.Open(_testFiles[i]);
|
||||
|
||||
foreach(Track currentTrack in images[i].Tracks)
|
||||
var image = new DiscImages.BlindWrite5();
|
||||
bool opened = image.Open(filter);
|
||||
|
||||
Assert.AreEqual(true, opened, $"Open: {_testFiles[i]}");
|
||||
Md5Context ctx;
|
||||
|
||||
foreach(bool @long in new[]
|
||||
{
|
||||
ulong sectors = currentTrack.TrackEndSector - currentTrack.TrackStartSector + 1;
|
||||
ulong doneSectors = 0;
|
||||
false, true
|
||||
})
|
||||
{
|
||||
ctx = new Md5Context();
|
||||
|
||||
while(doneSectors < sectors)
|
||||
foreach(Track currentTrack in image.Tracks)
|
||||
{
|
||||
byte[] sector;
|
||||
ulong sectors = currentTrack.TrackEndSector - currentTrack.TrackStartSector + 1;
|
||||
ulong doneSectors = 0;
|
||||
|
||||
if(sectors - doneSectors >= sectorsToRead)
|
||||
while(doneSectors < sectors)
|
||||
{
|
||||
sector = @long ? images[i].
|
||||
ReadSectorsLong(doneSectors, sectorsToRead, currentTrack.TrackSequence)
|
||||
: images[i].
|
||||
ReadSectors(doneSectors, sectorsToRead, currentTrack.TrackSequence);
|
||||
byte[] sector;
|
||||
|
||||
doneSectors += sectorsToRead;
|
||||
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);
|
||||
}
|
||||
else
|
||||
{
|
||||
sector = @long ? images[i].ReadSectorsLong(doneSectors, (uint)(sectors - doneSectors),
|
||||
currentTrack.TrackSequence)
|
||||
: images[i].ReadSectors(doneSectors, (uint)(sectors - doneSectors),
|
||||
currentTrack.TrackSequence);
|
||||
|
||||
doneSectors += sectors - doneSectors;
|
||||
}
|
||||
|
||||
ctx.Update(sector);
|
||||
}
|
||||
|
||||
Assert.AreEqual(@long ? _longMd5S[i] : _md5S[i], ctx.End(),
|
||||
$"{(@long ? "Long hash" : "Hash")}: {_testFiles[i]}");
|
||||
}
|
||||
|
||||
Assert.AreEqual(@long ? _longMd5S[i] : _md5S[i], ctx.End(),
|
||||
$"{(@long ? "Long hash" : "Hash")}: {_testFiles[i]}");
|
||||
}
|
||||
if(!image.Info.ReadableSectorTags.Contains(SectorTagType.CdSectorSubchannel))
|
||||
continue;
|
||||
|
||||
for(int i = 0; i < _testFiles.Length; i++)
|
||||
if(images[i].Info.ReadableSectorTags.Contains(SectorTagType.CdSectorSubchannel))
|
||||
{
|
||||
var ctx = new Md5Context();
|
||||
ctx = new Md5Context();
|
||||
|
||||
foreach(Track currentTrack in images[i].Tracks)
|
||||
foreach(Track currentTrack in image.Tracks)
|
||||
{
|
||||
ulong sectors = currentTrack.TrackEndSector - currentTrack.TrackStartSector + 1;
|
||||
ulong doneSectors = 0;
|
||||
@@ -586,19 +604,18 @@ namespace Aaru.Tests.Images
|
||||
{
|
||||
byte[] sector;
|
||||
|
||||
if(sectors - doneSectors >= sectorsToRead)
|
||||
if(sectors - doneSectors >= SECTORS_TO_READ)
|
||||
{
|
||||
sector = images[i].ReadSectorsTag(doneSectors, sectorsToRead,
|
||||
currentTrack.TrackSequence,
|
||||
SectorTagType.CdSectorSubchannel);
|
||||
sector = image.ReadSectorsTag(doneSectors, SECTORS_TO_READ, currentTrack.TrackSequence,
|
||||
SectorTagType.CdSectorSubchannel);
|
||||
|
||||
doneSectors += sectorsToRead;
|
||||
doneSectors += SECTORS_TO_READ;
|
||||
}
|
||||
else
|
||||
{
|
||||
sector = images[i].ReadSectorsTag(doneSectors, (uint)(sectors - doneSectors),
|
||||
currentTrack.TrackSequence,
|
||||
SectorTagType.CdSectorSubchannel);
|
||||
sector = image.ReadSectorsTag(doneSectors, (uint)(sectors - doneSectors),
|
||||
currentTrack.TrackSequence,
|
||||
SectorTagType.CdSectorSubchannel);
|
||||
|
||||
doneSectors += sectors - doneSectors;
|
||||
}
|
||||
@@ -609,6 +626,7 @@ namespace Aaru.Tests.Images
|
||||
|
||||
Assert.AreEqual(_subchannelMd5S[i], ctx.End(), $"Subchannel hash: {_testFiles[i]}");
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -32,10 +32,10 @@ using System.Linq;
|
||||
using Aaru.Checksums;
|
||||
using Aaru.CommonTypes;
|
||||
using Aaru.CommonTypes.Enums;
|
||||
using Aaru.CommonTypes.Interfaces;
|
||||
using Aaru.CommonTypes.Structs;
|
||||
using Aaru.Filters;
|
||||
using FluentAssertions;
|
||||
using FluentAssertions.Execution;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace Aaru.Tests.Images
|
||||
@@ -225,120 +225,135 @@ namespace Aaru.Tests.Images
|
||||
}
|
||||
};
|
||||
|
||||
readonly string _dataFolder = Path.Combine(Consts.TEST_FILES_ROOT, "Media image formats", "BlindWrite 7");
|
||||
|
||||
[Test]
|
||||
public void Test()
|
||||
public void Info()
|
||||
{
|
||||
// How many sectors to read at once
|
||||
const uint sectorsToRead = 256;
|
||||
|
||||
Environment.CurrentDirectory = Path.Combine(Consts.TEST_FILES_ROOT, "Media image formats", "BlindWrite 7");
|
||||
|
||||
IFilter[] filters = new IFilter[_testFiles.Length];
|
||||
Environment.CurrentDirectory = _dataFolder;
|
||||
|
||||
for(int i = 0; i < _testFiles.Length; i++)
|
||||
{
|
||||
filters[i] = new ZZZNoFilter();
|
||||
filters[i].Open(_testFiles[i]);
|
||||
}
|
||||
var filter = new ZZZNoFilter();
|
||||
filter.Open(_testFiles[i]);
|
||||
|
||||
IOpticalMediaImage[] images = new IOpticalMediaImage[_testFiles.Length];
|
||||
var image = new DiscImages.BlindWrite5();
|
||||
bool opened = image.Open(filter);
|
||||
|
||||
for(int i = 0; i < _testFiles.Length; i++)
|
||||
{
|
||||
images[i] = new DiscImages.BlindWrite5();
|
||||
Assert.AreEqual(true, images[i].Open(filters[i]), $"Open: {_testFiles[i]}");
|
||||
}
|
||||
Assert.AreEqual(true, opened, $"Open: {_testFiles[i]}");
|
||||
|
||||
for(int i = 0; i < _testFiles.Length; i++)
|
||||
Assert.AreEqual(_sectors[i], images[i].Info.Sectors, $"Sectors: {_testFiles[i]}");
|
||||
|
||||
for(int i = 0; i < _testFiles.Length; i++)
|
||||
Assert.AreEqual(_mediaTypes[i], images[i].Info.MediaType, $"Media type: {_testFiles[i]}");
|
||||
|
||||
for(int i = 0; i < _testFiles.Length; i++)
|
||||
Assert.AreEqual(_tracks[i], images[i].Tracks.Count, $"Tracks: {_testFiles[i]}");
|
||||
|
||||
for(int i = 0; i < _testFiles.Length; i++)
|
||||
images[i].Tracks.Select(t => t.TrackSession).Should().
|
||||
BeEquivalentTo(_trackSessions[i], $"Track session: {_testFiles[i]}");
|
||||
|
||||
for(int i = 0; i < _testFiles.Length; i++)
|
||||
images[i].Tracks.Select(t => t.TrackStartSector).Should().
|
||||
BeEquivalentTo(_trackStarts[i], $"Track start: {_testFiles[i]}");
|
||||
|
||||
for(int i = 0; i < _testFiles.Length; i++)
|
||||
images[i].Tracks.Select(t => t.TrackEndSector).Should().
|
||||
BeEquivalentTo(_trackEnds[i], $"Track end: {_testFiles[i]}");
|
||||
|
||||
for(int i = 0; i < _testFiles.Length; i++)
|
||||
images[i].Tracks.Select(t => t.TrackPregap).Should().
|
||||
BeEquivalentTo(_trackPregaps[i], $"Track pregap: {_testFiles[i]}");
|
||||
|
||||
for(int i = 0; i < _testFiles.Length; i++)
|
||||
{
|
||||
int trackNo = 0;
|
||||
|
||||
foreach(Track currentTrack in images[i].Tracks)
|
||||
using(new AssertionScope())
|
||||
{
|
||||
if(images[i].Info.ReadableSectorTags.Contains(SectorTagType.CdTrackFlags))
|
||||
Assert.AreEqual(_trackFlags[i][trackNo],
|
||||
images[i].ReadSectorTag(currentTrack.TrackSequence, SectorTagType.CdTrackFlags)
|
||||
[0], $"Track flags: {_testFiles[i]}, track {currentTrack.TrackSequence}");
|
||||
Assert.Multiple(() =>
|
||||
{
|
||||
Assert.AreEqual(_sectors[i], image.Info.Sectors, $"Sectors: {_testFiles[i]}");
|
||||
Assert.AreEqual(_mediaTypes[i], image.Info.MediaType, $"Media type: {_testFiles[i]}");
|
||||
|
||||
trackNo++;
|
||||
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]}");
|
||||
|
||||
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];
|
||||
|
||||
foreach(Track currentTrack in image.Tracks)
|
||||
{
|
||||
if(image.Info.ReadableSectorTags.Contains(SectorTagType.CdTrackFlags))
|
||||
flags[trackNo] = image.ReadSectorTag(currentTrack.TrackSequence,
|
||||
SectorTagType.CdTrackFlags)[0];
|
||||
|
||||
trackNo++;
|
||||
}
|
||||
|
||||
flags.Should().BeEquivalentTo(_trackFlags[i], $"Track flags: {_testFiles[i]}");
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach(bool @long in new[]
|
||||
// How many sectors to read at once
|
||||
const uint SECTORS_TO_READ = 256;
|
||||
|
||||
[Test]
|
||||
public void Hashes()
|
||||
{
|
||||
Environment.CurrentDirectory = _dataFolder;
|
||||
|
||||
Assert.Multiple(() =>
|
||||
{
|
||||
false, true
|
||||
})
|
||||
for(int i = 0; i < _testFiles.Length; i++)
|
||||
{
|
||||
var ctx = new Md5Context();
|
||||
var filter = new ZZZNoFilter();
|
||||
filter.Open(_testFiles[i]);
|
||||
|
||||
foreach(Track currentTrack in images[i].Tracks)
|
||||
var image = new DiscImages.BlindWrite5();
|
||||
bool opened = image.Open(filter);
|
||||
|
||||
Assert.AreEqual(true, opened, $"Open: {_testFiles[i]}");
|
||||
Md5Context ctx;
|
||||
|
||||
foreach(bool @long in new[]
|
||||
{
|
||||
ulong sectors = currentTrack.TrackEndSector - currentTrack.TrackStartSector + 1;
|
||||
ulong doneSectors = 0;
|
||||
false, true
|
||||
})
|
||||
{
|
||||
ctx = new Md5Context();
|
||||
|
||||
while(doneSectors < sectors)
|
||||
foreach(Track currentTrack in image.Tracks)
|
||||
{
|
||||
byte[] sector;
|
||||
ulong sectors = currentTrack.TrackEndSector - currentTrack.TrackStartSector + 1;
|
||||
ulong doneSectors = 0;
|
||||
|
||||
if(sectors - doneSectors >= sectorsToRead)
|
||||
while(doneSectors < sectors)
|
||||
{
|
||||
sector = @long ? images[i].
|
||||
ReadSectorsLong(doneSectors, sectorsToRead, currentTrack.TrackSequence)
|
||||
: images[i].
|
||||
ReadSectors(doneSectors, sectorsToRead, currentTrack.TrackSequence);
|
||||
byte[] sector;
|
||||
|
||||
doneSectors += sectorsToRead;
|
||||
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);
|
||||
}
|
||||
else
|
||||
{
|
||||
sector = @long ? images[i].ReadSectorsLong(doneSectors, (uint)(sectors - doneSectors),
|
||||
currentTrack.TrackSequence)
|
||||
: images[i].ReadSectors(doneSectors, (uint)(sectors - doneSectors),
|
||||
currentTrack.TrackSequence);
|
||||
|
||||
doneSectors += sectors - doneSectors;
|
||||
}
|
||||
|
||||
ctx.Update(sector);
|
||||
}
|
||||
|
||||
Assert.AreEqual(@long ? _longMd5S[i] : _md5S[i], ctx.End(),
|
||||
$"{(@long ? "Long hash" : "Hash")}: {_testFiles[i]}");
|
||||
}
|
||||
|
||||
Assert.AreEqual(@long ? _longMd5S[i] : _md5S[i], ctx.End(),
|
||||
$"{(@long ? "Long hash" : "Hash")}: {_testFiles[i]}");
|
||||
}
|
||||
if(!image.Info.ReadableSectorTags.Contains(SectorTagType.CdSectorSubchannel))
|
||||
continue;
|
||||
|
||||
for(int i = 0; i < _testFiles.Length; i++)
|
||||
if(images[i].Info.ReadableSectorTags.Contains(SectorTagType.CdSectorSubchannel))
|
||||
{
|
||||
var ctx = new Md5Context();
|
||||
ctx = new Md5Context();
|
||||
|
||||
foreach(Track currentTrack in images[i].Tracks)
|
||||
foreach(Track currentTrack in image.Tracks)
|
||||
{
|
||||
ulong sectors = currentTrack.TrackEndSector - currentTrack.TrackStartSector + 1;
|
||||
ulong doneSectors = 0;
|
||||
@@ -347,19 +362,18 @@ namespace Aaru.Tests.Images
|
||||
{
|
||||
byte[] sector;
|
||||
|
||||
if(sectors - doneSectors >= sectorsToRead)
|
||||
if(sectors - doneSectors >= SECTORS_TO_READ)
|
||||
{
|
||||
sector = images[i].ReadSectorsTag(doneSectors, sectorsToRead,
|
||||
currentTrack.TrackSequence,
|
||||
SectorTagType.CdSectorSubchannel);
|
||||
sector = image.ReadSectorsTag(doneSectors, SECTORS_TO_READ, currentTrack.TrackSequence,
|
||||
SectorTagType.CdSectorSubchannel);
|
||||
|
||||
doneSectors += sectorsToRead;
|
||||
doneSectors += SECTORS_TO_READ;
|
||||
}
|
||||
else
|
||||
{
|
||||
sector = images[i].ReadSectorsTag(doneSectors, (uint)(sectors - doneSectors),
|
||||
currentTrack.TrackSequence,
|
||||
SectorTagType.CdSectorSubchannel);
|
||||
sector = image.ReadSectorsTag(doneSectors, (uint)(sectors - doneSectors),
|
||||
currentTrack.TrackSequence,
|
||||
SectorTagType.CdSectorSubchannel);
|
||||
|
||||
doneSectors += sectors - doneSectors;
|
||||
}
|
||||
@@ -370,6 +384,7 @@ namespace Aaru.Tests.Images
|
||||
|
||||
Assert.AreEqual(_subchannelMd5S[i], ctx.End(), $"Subchannel hash: {_testFiles[i]}");
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -32,11 +32,11 @@ using System.Linq;
|
||||
using Aaru.Checksums;
|
||||
using Aaru.CommonTypes;
|
||||
using Aaru.CommonTypes.Enums;
|
||||
using Aaru.CommonTypes.Interfaces;
|
||||
using Aaru.CommonTypes.Structs;
|
||||
using Aaru.DiscImages;
|
||||
using Aaru.Filters;
|
||||
using FluentAssertions;
|
||||
using FluentAssertions.Execution;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace Aaru.Tests.Images
|
||||
@@ -864,120 +864,135 @@ namespace Aaru.Tests.Images
|
||||
}
|
||||
};
|
||||
|
||||
readonly string _dataFolder = Path.Combine(Consts.TEST_FILES_ROOT, "Media image formats", "CDRWin");
|
||||
|
||||
[Test]
|
||||
public void Test()
|
||||
public void Info()
|
||||
{
|
||||
// How many sectors to read at once
|
||||
const uint sectorsToRead = 256;
|
||||
|
||||
Environment.CurrentDirectory = Path.Combine(Consts.TEST_FILES_ROOT, "Media image formats", "CDRWin");
|
||||
|
||||
IFilter[] filters = new IFilter[_testFiles.Length];
|
||||
Environment.CurrentDirectory = _dataFolder;
|
||||
|
||||
for(int i = 0; i < _testFiles.Length; i++)
|
||||
{
|
||||
filters[i] = new ZZZNoFilter();
|
||||
filters[i].Open(_testFiles[i]);
|
||||
}
|
||||
var filter = new ZZZNoFilter();
|
||||
filter.Open(_testFiles[i]);
|
||||
|
||||
IOpticalMediaImage[] images = new IOpticalMediaImage[_testFiles.Length];
|
||||
var image = new CdrWin();
|
||||
bool opened = image.Open(filter);
|
||||
|
||||
for(int i = 0; i < _testFiles.Length; i++)
|
||||
{
|
||||
images[i] = new CdrWin();
|
||||
Assert.AreEqual(true, images[i].Open(filters[i]), $"Open: {_testFiles[i]}");
|
||||
}
|
||||
Assert.AreEqual(true, opened, $"Open: {_testFiles[i]}");
|
||||
|
||||
for(int i = 0; i < _testFiles.Length; i++)
|
||||
Assert.AreEqual(_sectors[i], images[i].Info.Sectors, $"Sectors: {_testFiles[i]}");
|
||||
|
||||
for(int i = 0; i < _testFiles.Length; i++)
|
||||
Assert.AreEqual(_mediaTypes[i], images[i].Info.MediaType, $"Media type: {_testFiles[i]}");
|
||||
|
||||
for(int i = 0; i < _testFiles.Length; i++)
|
||||
Assert.AreEqual(_tracks[i], images[i].Tracks.Count, $"Tracks: {_testFiles[i]}");
|
||||
|
||||
for(int i = 0; i < _testFiles.Length; i++)
|
||||
images[i].Tracks.Select(t => t.TrackSession).Should().
|
||||
BeEquivalentTo(_trackSessions[i], $"Track session: {_testFiles[i]}");
|
||||
|
||||
for(int i = 0; i < _testFiles.Length; i++)
|
||||
images[i].Tracks.Select(t => t.TrackStartSector).Should().
|
||||
BeEquivalentTo(_trackStarts[i], $"Track start: {_testFiles[i]}");
|
||||
|
||||
for(int i = 0; i < _testFiles.Length; i++)
|
||||
images[i].Tracks.Select(t => t.TrackEndSector).Should().
|
||||
BeEquivalentTo(_trackEnds[i], $"Track end: {_testFiles[i]}");
|
||||
|
||||
for(int i = 0; i < _testFiles.Length; i++)
|
||||
images[i].Tracks.Select(t => t.TrackPregap).Should().
|
||||
BeEquivalentTo(_trackPregaps[i], $"Track pregap: {_testFiles[i]}");
|
||||
|
||||
for(int i = 0; i < _testFiles.Length; i++)
|
||||
{
|
||||
int trackNo = 0;
|
||||
|
||||
foreach(Track currentTrack in images[i].Tracks)
|
||||
using(new AssertionScope())
|
||||
{
|
||||
if(images[i].Info.ReadableSectorTags.Contains(SectorTagType.CdTrackFlags))
|
||||
Assert.AreEqual(_trackFlags[i][trackNo],
|
||||
images[i].ReadSectorTag(currentTrack.TrackSequence, SectorTagType.CdTrackFlags)
|
||||
[0], $"Track flags: {_testFiles[i]}, track {currentTrack.TrackSequence}");
|
||||
Assert.Multiple(() =>
|
||||
{
|
||||
Assert.AreEqual(_sectors[i], image.Info.Sectors, $"Sectors: {_testFiles[i]}");
|
||||
Assert.AreEqual(_mediaTypes[i], image.Info.MediaType, $"Media type: {_testFiles[i]}");
|
||||
|
||||
trackNo++;
|
||||
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]}");
|
||||
|
||||
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];
|
||||
|
||||
foreach(Track currentTrack in image.Tracks)
|
||||
{
|
||||
if(image.Info.ReadableSectorTags.Contains(SectorTagType.CdTrackFlags))
|
||||
flags[trackNo] = image.ReadSectorTag(currentTrack.TrackSequence,
|
||||
SectorTagType.CdTrackFlags)[0];
|
||||
|
||||
trackNo++;
|
||||
}
|
||||
|
||||
flags.Should().BeEquivalentTo(_trackFlags[i], $"Track flags: {_testFiles[i]}");
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach(bool @long in new[]
|
||||
// How many sectors to read at once
|
||||
const uint SECTORS_TO_READ = 256;
|
||||
|
||||
[Test]
|
||||
public void Hashes()
|
||||
{
|
||||
Environment.CurrentDirectory = _dataFolder;
|
||||
|
||||
Assert.Multiple(() =>
|
||||
{
|
||||
false, true
|
||||
})
|
||||
for(int i = 0; i < _testFiles.Length; i++)
|
||||
{
|
||||
var ctx = new Md5Context();
|
||||
var filter = new ZZZNoFilter();
|
||||
filter.Open(_testFiles[i]);
|
||||
|
||||
foreach(Track currentTrack in images[i].Tracks)
|
||||
var image = new CdrWin();
|
||||
bool opened = image.Open(filter);
|
||||
|
||||
Assert.AreEqual(true, opened, $"Open: {_testFiles[i]}");
|
||||
Md5Context ctx;
|
||||
|
||||
foreach(bool @long in new[]
|
||||
{
|
||||
ulong sectors = currentTrack.TrackEndSector - currentTrack.TrackStartSector + 1;
|
||||
ulong doneSectors = 0;
|
||||
false, true
|
||||
})
|
||||
{
|
||||
ctx = new Md5Context();
|
||||
|
||||
while(doneSectors < sectors)
|
||||
foreach(Track currentTrack in image.Tracks)
|
||||
{
|
||||
byte[] sector;
|
||||
ulong sectors = currentTrack.TrackEndSector - currentTrack.TrackStartSector + 1;
|
||||
ulong doneSectors = 0;
|
||||
|
||||
if(sectors - doneSectors >= sectorsToRead)
|
||||
while(doneSectors < sectors)
|
||||
{
|
||||
sector = @long ? images[i].
|
||||
ReadSectorsLong(doneSectors, sectorsToRead, currentTrack.TrackSequence)
|
||||
: images[i].
|
||||
ReadSectors(doneSectors, sectorsToRead, currentTrack.TrackSequence);
|
||||
byte[] sector;
|
||||
|
||||
doneSectors += sectorsToRead;
|
||||
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);
|
||||
}
|
||||
else
|
||||
{
|
||||
sector = @long ? images[i].ReadSectorsLong(doneSectors, (uint)(sectors - doneSectors),
|
||||
currentTrack.TrackSequence)
|
||||
: images[i].ReadSectors(doneSectors, (uint)(sectors - doneSectors),
|
||||
currentTrack.TrackSequence);
|
||||
|
||||
doneSectors += sectors - doneSectors;
|
||||
}
|
||||
|
||||
ctx.Update(sector);
|
||||
}
|
||||
|
||||
Assert.AreEqual(@long ? _longMd5S[i] : _md5S[i], ctx.End(),
|
||||
$"{(@long ? "Long hash" : "Hash")}: {_testFiles[i]}");
|
||||
}
|
||||
|
||||
Assert.AreEqual(@long ? _longMd5S[i] : _md5S[i], ctx.End(),
|
||||
$"{(@long ? "Long hash" : "Hash")}: {_testFiles[i]}");
|
||||
}
|
||||
if(!image.Info.ReadableSectorTags.Contains(SectorTagType.CdSectorSubchannel))
|
||||
continue;
|
||||
|
||||
for(int i = 0; i < _testFiles.Length; i++)
|
||||
if(images[i].Info.ReadableSectorTags.Contains(SectorTagType.CdSectorSubchannel))
|
||||
{
|
||||
var ctx = new Md5Context();
|
||||
ctx = new Md5Context();
|
||||
|
||||
foreach(Track currentTrack in images[i].Tracks)
|
||||
foreach(Track currentTrack in image.Tracks)
|
||||
{
|
||||
ulong sectors = currentTrack.TrackEndSector - currentTrack.TrackStartSector + 1;
|
||||
ulong doneSectors = 0;
|
||||
@@ -986,19 +1001,18 @@ namespace Aaru.Tests.Images
|
||||
{
|
||||
byte[] sector;
|
||||
|
||||
if(sectors - doneSectors >= sectorsToRead)
|
||||
if(sectors - doneSectors >= SECTORS_TO_READ)
|
||||
{
|
||||
sector = images[i].ReadSectorsTag(doneSectors, sectorsToRead,
|
||||
currentTrack.TrackSequence,
|
||||
SectorTagType.CdSectorSubchannel);
|
||||
sector = image.ReadSectorsTag(doneSectors, SECTORS_TO_READ, currentTrack.TrackSequence,
|
||||
SectorTagType.CdSectorSubchannel);
|
||||
|
||||
doneSectors += sectorsToRead;
|
||||
doneSectors += SECTORS_TO_READ;
|
||||
}
|
||||
else
|
||||
{
|
||||
sector = images[i].ReadSectorsTag(doneSectors, (uint)(sectors - doneSectors),
|
||||
currentTrack.TrackSequence,
|
||||
SectorTagType.CdSectorSubchannel);
|
||||
sector = image.ReadSectorsTag(doneSectors, (uint)(sectors - doneSectors),
|
||||
currentTrack.TrackSequence,
|
||||
SectorTagType.CdSectorSubchannel);
|
||||
|
||||
doneSectors += sectors - doneSectors;
|
||||
}
|
||||
@@ -1009,6 +1023,7 @@ namespace Aaru.Tests.Images
|
||||
|
||||
Assert.AreEqual(_subchannelMd5S[i], ctx.End(), $"Subchannel hash: {_testFiles[i]}");
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -370,10 +370,12 @@ namespace Aaru.Tests.Images
|
||||
}
|
||||
};
|
||||
|
||||
readonly string _dataFolder = Path.Combine(Consts.TEST_FILES_ROOT, "Media image formats", "CDRWin 10");
|
||||
|
||||
[Test]
|
||||
public void Test()
|
||||
public void Info()
|
||||
{
|
||||
Environment.CurrentDirectory = Path.Combine(Consts.TEST_FILES_ROOT, "Media image formats", "CDRWin 10");
|
||||
Environment.CurrentDirectory = _dataFolder;
|
||||
|
||||
for(int i = 0; i < _testFiles.Length; i++)
|
||||
{
|
||||
@@ -425,13 +427,13 @@ namespace Aaru.Tests.Images
|
||||
}
|
||||
}
|
||||
|
||||
// How many sectors to read at once
|
||||
const uint SECTORS_TO_READ = 256;
|
||||
|
||||
[Test]
|
||||
public void Hashes()
|
||||
{
|
||||
// How many sectors to read at once
|
||||
const uint sectorsToRead = 256;
|
||||
|
||||
Environment.CurrentDirectory = Path.Combine(Consts.TEST_FILES_ROOT, "Media image formats", "CDRWin 10");
|
||||
Environment.CurrentDirectory = _dataFolder;
|
||||
|
||||
Assert.Multiple(() =>
|
||||
{
|
||||
@@ -462,14 +464,15 @@ namespace Aaru.Tests.Images
|
||||
{
|
||||
byte[] sector;
|
||||
|
||||
if(sectors - doneSectors >= sectorsToRead)
|
||||
if(sectors - doneSectors >= SECTORS_TO_READ)
|
||||
{
|
||||
sector =
|
||||
@long ? image.ReadSectorsLong(doneSectors, sectorsToRead,
|
||||
@long ? image.ReadSectorsLong(doneSectors, SECTORS_TO_READ,
|
||||
currentTrack.TrackSequence)
|
||||
: image.ReadSectors(doneSectors, sectorsToRead, currentTrack.TrackSequence);
|
||||
: image.ReadSectors(doneSectors, SECTORS_TO_READ,
|
||||
currentTrack.TrackSequence);
|
||||
|
||||
doneSectors += sectorsToRead;
|
||||
doneSectors += SECTORS_TO_READ;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -504,12 +507,12 @@ namespace Aaru.Tests.Images
|
||||
{
|
||||
byte[] sector;
|
||||
|
||||
if(sectors - doneSectors >= sectorsToRead)
|
||||
if(sectors - doneSectors >= SECTORS_TO_READ)
|
||||
{
|
||||
sector = image.ReadSectorsTag(doneSectors, sectorsToRead, currentTrack.TrackSequence,
|
||||
sector = image.ReadSectorsTag(doneSectors, SECTORS_TO_READ, currentTrack.TrackSequence,
|
||||
SectorTagType.CdSectorSubchannel);
|
||||
|
||||
doneSectors += sectorsToRead;
|
||||
doneSectors += SECTORS_TO_READ;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -252,7 +252,7 @@ namespace Aaru.Tests.Images
|
||||
}
|
||||
|
||||
// How many sectors to read at once
|
||||
const uint _sectorsToRead = 256;
|
||||
const uint SECTORS_TO_READ = 256;
|
||||
|
||||
[Test]
|
||||
public void Hashes()
|
||||
@@ -277,10 +277,10 @@ namespace Aaru.Tests.Images
|
||||
{
|
||||
byte[] sector;
|
||||
|
||||
if(image.Info.Sectors - doneSectors >= _sectorsToRead)
|
||||
if(image.Info.Sectors - doneSectors >= SECTORS_TO_READ)
|
||||
{
|
||||
sector = image.ReadSectors(doneSectors, _sectorsToRead);
|
||||
doneSectors += _sectorsToRead;
|
||||
sector = image.ReadSectors(doneSectors, SECTORS_TO_READ);
|
||||
doneSectors += SECTORS_TO_READ;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -26,11 +26,12 @@
|
||||
// Copyright © 2011-2021 Natalia Portillo
|
||||
// ****************************************************************************/
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
using Aaru.Checksums;
|
||||
using Aaru.CommonTypes;
|
||||
using Aaru.CommonTypes.Interfaces;
|
||||
using Aaru.Filters;
|
||||
using FluentAssertions.Execution;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace Aaru.Tests.Images.CisCopy
|
||||
@@ -80,46 +81,81 @@ namespace Aaru.Tests.Images.CisCopy
|
||||
"91f3fde8d56a536cdda4c6758e5dbc93", "91f3fde8d56a536cdda4c6758e5dbc93", "91f3fde8d56a536cdda4c6758e5dbc93"
|
||||
};
|
||||
|
||||
readonly string _dataFolder = Path.Combine(Consts.TEST_FILES_ROOT, "Media image formats", "CisCopy");
|
||||
|
||||
[Test]
|
||||
public void Test()
|
||||
public void Info()
|
||||
{
|
||||
for(int i = 0; i < _testFiles.Length; i++)
|
||||
Environment.CurrentDirectory = _dataFolder;
|
||||
|
||||
Assert.Multiple(() =>
|
||||
{
|
||||
string location = Path.Combine(Consts.TEST_FILES_ROOT, "Media image formats", "CisCopy", _testFiles[i]);
|
||||
IFilter filter = new LZip();
|
||||
filter.Open(location);
|
||||
IMediaImage image = new DiscImages.CisCopy();
|
||||
Assert.AreEqual(true, image.Open(filter), _testFiles[i]);
|
||||
Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]);
|
||||
Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]);
|
||||
Assert.AreEqual(_mediaTypes[i], image.Info.MediaType, _testFiles[i]);
|
||||
|
||||
// How many sectors to read at once
|
||||
const uint sectorsToRead = 256;
|
||||
ulong doneSectors = 0;
|
||||
|
||||
var ctx = new Md5Context();
|
||||
|
||||
while(doneSectors < image.Info.Sectors)
|
||||
for(int i = 0; i < _testFiles.Length; i++)
|
||||
{
|
||||
byte[] sector;
|
||||
var filter = new LZip();
|
||||
filter.Open(_testFiles[i]);
|
||||
|
||||
if(image.Info.Sectors - doneSectors >= sectorsToRead)
|
||||
{
|
||||
sector = image.ReadSectors(doneSectors, sectorsToRead);
|
||||
doneSectors += sectorsToRead;
|
||||
}
|
||||
else
|
||||
{
|
||||
sector = image.ReadSectors(doneSectors, (uint)(image.Info.Sectors - doneSectors));
|
||||
doneSectors += image.Info.Sectors - doneSectors;
|
||||
}
|
||||
var image = new DiscImages.CisCopy();
|
||||
bool opened = image.Open(filter);
|
||||
|
||||
ctx.Update(sector);
|
||||
Assert.AreEqual(true, opened, $"Open: {_testFiles[i]}");
|
||||
|
||||
using(new AssertionScope())
|
||||
{
|
||||
Assert.Multiple(() =>
|
||||
{
|
||||
Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]);
|
||||
Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]);
|
||||
Assert.AreEqual(_mediaTypes[i], image.Info.MediaType, _testFiles[i]);
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Assert.AreEqual(_md5S[i], ctx.End(), _testFiles[i]);
|
||||
}
|
||||
// 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++)
|
||||
{
|
||||
var filter = new LZip();
|
||||
filter.Open(_testFiles[i]);
|
||||
|
||||
var image = new DiscImages.CisCopy();
|
||||
bool opened = image.Open(filter);
|
||||
ulong doneSectors = 0;
|
||||
|
||||
Assert.AreEqual(true, opened, $"Open: {_testFiles[i]}");
|
||||
var ctx = new Md5Context();
|
||||
|
||||
while(doneSectors < image.Info.Sectors)
|
||||
{
|
||||
byte[] sector;
|
||||
|
||||
if(image.Info.Sectors - doneSectors >= SECTORS_TO_READ)
|
||||
{
|
||||
sector = image.ReadSectors(doneSectors, SECTORS_TO_READ);
|
||||
doneSectors += SECTORS_TO_READ;
|
||||
}
|
||||
else
|
||||
{
|
||||
sector = image.ReadSectors(doneSectors, (uint)(image.Info.Sectors - doneSectors));
|
||||
doneSectors += image.Info.Sectors - doneSectors;
|
||||
}
|
||||
|
||||
ctx.Update(sector);
|
||||
}
|
||||
|
||||
Assert.AreEqual(_md5S[i], ctx.End(), _testFiles[i]);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -32,11 +32,11 @@ using System.Linq;
|
||||
using Aaru.Checksums;
|
||||
using Aaru.CommonTypes;
|
||||
using Aaru.CommonTypes.Enums;
|
||||
using Aaru.CommonTypes.Interfaces;
|
||||
using Aaru.CommonTypes.Structs;
|
||||
using Aaru.DiscImages;
|
||||
using Aaru.Filters;
|
||||
using FluentAssertions;
|
||||
using FluentAssertions.Execution;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace Aaru.Tests.Images
|
||||
@@ -1392,120 +1392,135 @@ namespace Aaru.Tests.Images
|
||||
}
|
||||
};
|
||||
|
||||
readonly string _dataFolder = Path.Combine(Consts.TEST_FILES_ROOT, "Media image formats", "CloneCD");
|
||||
|
||||
[Test]
|
||||
public void Test()
|
||||
public void Info()
|
||||
{
|
||||
// How many sectors to read at once
|
||||
const uint sectorsToRead = 256;
|
||||
|
||||
Environment.CurrentDirectory = Path.Combine(Consts.TEST_FILES_ROOT, "Media image formats", "CloneCD");
|
||||
|
||||
IFilter[] filters = new IFilter[_testFiles.Length];
|
||||
Environment.CurrentDirectory = _dataFolder;
|
||||
|
||||
for(int i = 0; i < _testFiles.Length; i++)
|
||||
{
|
||||
filters[i] = new ZZZNoFilter();
|
||||
filters[i].Open(_testFiles[i]);
|
||||
}
|
||||
var filter = new ZZZNoFilter();
|
||||
filter.Open(_testFiles[i]);
|
||||
|
||||
IOpticalMediaImage[] images = new IOpticalMediaImage[_testFiles.Length];
|
||||
var image = new CloneCd();
|
||||
bool opened = image.Open(filter);
|
||||
|
||||
for(int i = 0; i < _testFiles.Length; i++)
|
||||
{
|
||||
images[i] = new CloneCd();
|
||||
Assert.AreEqual(true, images[i].Open(filters[i]), $"Open: {_testFiles[i]}");
|
||||
}
|
||||
Assert.AreEqual(true, opened, $"Open: {_testFiles[i]}");
|
||||
|
||||
for(int i = 0; i < _testFiles.Length; i++)
|
||||
Assert.AreEqual(_sectors[i], images[i].Info.Sectors, $"Sectors: {_testFiles[i]}");
|
||||
|
||||
for(int i = 0; i < _testFiles.Length; i++)
|
||||
Assert.AreEqual(_mediaTypes[i], images[i].Info.MediaType, $"Media type: {_testFiles[i]}");
|
||||
|
||||
for(int i = 0; i < _testFiles.Length; i++)
|
||||
Assert.AreEqual(_tracks[i], images[i].Tracks.Count, $"Tracks: {_testFiles[i]}");
|
||||
|
||||
for(int i = 0; i < _testFiles.Length; i++)
|
||||
images[i].Tracks.Select(t => t.TrackSession).Should().
|
||||
BeEquivalentTo(_trackSessions[i], $"Track session: {_testFiles[i]}");
|
||||
|
||||
for(int i = 0; i < _testFiles.Length; i++)
|
||||
images[i].Tracks.Select(t => t.TrackStartSector).Should().
|
||||
BeEquivalentTo(_trackStarts[i], $"Track start: {_testFiles[i]}");
|
||||
|
||||
for(int i = 0; i < _testFiles.Length; i++)
|
||||
images[i].Tracks.Select(t => t.TrackEndSector).Should().
|
||||
BeEquivalentTo(_trackEnds[i], $"Track end: {_testFiles[i]}");
|
||||
|
||||
for(int i = 0; i < _testFiles.Length; i++)
|
||||
images[i].Tracks.Select(t => t.TrackPregap).Should().
|
||||
BeEquivalentTo(_trackPregaps[i], $"Track pregap: {_testFiles[i]}");
|
||||
|
||||
for(int i = 0; i < _testFiles.Length; i++)
|
||||
{
|
||||
int trackNo = 0;
|
||||
|
||||
foreach(Track currentTrack in images[i].Tracks)
|
||||
using(new AssertionScope())
|
||||
{
|
||||
if(images[i].Info.ReadableSectorTags.Contains(SectorTagType.CdTrackFlags))
|
||||
Assert.AreEqual(_trackFlags[i][trackNo],
|
||||
images[i].ReadSectorTag(currentTrack.TrackSequence, SectorTagType.CdTrackFlags)
|
||||
[0], $"Track flags: {_testFiles[i]}, track {currentTrack.TrackSequence}");
|
||||
Assert.Multiple(() =>
|
||||
{
|
||||
Assert.AreEqual(_sectors[i], image.Info.Sectors, $"Sectors: {_testFiles[i]}");
|
||||
Assert.AreEqual(_mediaTypes[i], image.Info.MediaType, $"Media type: {_testFiles[i]}");
|
||||
|
||||
trackNo++;
|
||||
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]}");
|
||||
|
||||
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];
|
||||
|
||||
foreach(Track currentTrack in image.Tracks)
|
||||
{
|
||||
if(image.Info.ReadableSectorTags.Contains(SectorTagType.CdTrackFlags))
|
||||
flags[trackNo] = image.ReadSectorTag(currentTrack.TrackSequence,
|
||||
SectorTagType.CdTrackFlags)[0];
|
||||
|
||||
trackNo++;
|
||||
}
|
||||
|
||||
flags.Should().BeEquivalentTo(_trackFlags[i], $"Track flags: {_testFiles[i]}");
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach(bool @long in new[]
|
||||
// How many sectors to read at once
|
||||
const uint SECTORS_TO_READ = 256;
|
||||
|
||||
[Test]
|
||||
public void Hashes()
|
||||
{
|
||||
Environment.CurrentDirectory = _dataFolder;
|
||||
|
||||
Assert.Multiple(() =>
|
||||
{
|
||||
false, true
|
||||
})
|
||||
for(int i = 0; i < _testFiles.Length; i++)
|
||||
{
|
||||
var ctx = new Md5Context();
|
||||
var filter = new ZZZNoFilter();
|
||||
filter.Open(_testFiles[i]);
|
||||
|
||||
foreach(Track currentTrack in images[i].Tracks)
|
||||
var image = new CloneCd();
|
||||
bool opened = image.Open(filter);
|
||||
|
||||
Assert.AreEqual(true, opened, $"Open: {_testFiles[i]}");
|
||||
Md5Context ctx;
|
||||
|
||||
foreach(bool @long in new[]
|
||||
{
|
||||
ulong sectors = currentTrack.TrackEndSector - currentTrack.TrackStartSector + 1;
|
||||
ulong doneSectors = 0;
|
||||
false, true
|
||||
})
|
||||
{
|
||||
ctx = new Md5Context();
|
||||
|
||||
while(doneSectors < sectors)
|
||||
foreach(Track currentTrack in image.Tracks)
|
||||
{
|
||||
byte[] sector;
|
||||
ulong sectors = currentTrack.TrackEndSector - currentTrack.TrackStartSector + 1;
|
||||
ulong doneSectors = 0;
|
||||
|
||||
if(sectors - doneSectors >= sectorsToRead)
|
||||
while(doneSectors < sectors)
|
||||
{
|
||||
sector = @long ? images[i].
|
||||
ReadSectorsLong(doneSectors, sectorsToRead, currentTrack.TrackSequence)
|
||||
: images[i].
|
||||
ReadSectors(doneSectors, sectorsToRead, currentTrack.TrackSequence);
|
||||
byte[] sector;
|
||||
|
||||
doneSectors += sectorsToRead;
|
||||
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);
|
||||
}
|
||||
else
|
||||
{
|
||||
sector = @long ? images[i].ReadSectorsLong(doneSectors, (uint)(sectors - doneSectors),
|
||||
currentTrack.TrackSequence)
|
||||
: images[i].ReadSectors(doneSectors, (uint)(sectors - doneSectors),
|
||||
currentTrack.TrackSequence);
|
||||
|
||||
doneSectors += sectors - doneSectors;
|
||||
}
|
||||
|
||||
ctx.Update(sector);
|
||||
}
|
||||
|
||||
Assert.AreEqual(@long ? _longMd5S[i] : _md5S[i], ctx.End(),
|
||||
$"{(@long ? "Long hash" : "Hash")}: {_testFiles[i]}");
|
||||
}
|
||||
|
||||
Assert.AreEqual(@long ? _longMd5S[i] : _md5S[i], ctx.End(),
|
||||
$"{(@long ? "Long hash" : "Hash")}: {_testFiles[i]}");
|
||||
}
|
||||
if(!image.Info.ReadableSectorTags.Contains(SectorTagType.CdSectorSubchannel))
|
||||
continue;
|
||||
|
||||
for(int i = 0; i < _testFiles.Length; i++)
|
||||
if(images[i].Info.ReadableSectorTags.Contains(SectorTagType.CdSectorSubchannel))
|
||||
{
|
||||
var ctx = new Md5Context();
|
||||
ctx = new Md5Context();
|
||||
|
||||
foreach(Track currentTrack in images[i].Tracks)
|
||||
foreach(Track currentTrack in image.Tracks)
|
||||
{
|
||||
ulong sectors = currentTrack.TrackEndSector - currentTrack.TrackStartSector + 1;
|
||||
ulong doneSectors = 0;
|
||||
@@ -1514,19 +1529,18 @@ namespace Aaru.Tests.Images
|
||||
{
|
||||
byte[] sector;
|
||||
|
||||
if(sectors - doneSectors >= sectorsToRead)
|
||||
if(sectors - doneSectors >= SECTORS_TO_READ)
|
||||
{
|
||||
sector = images[i].ReadSectorsTag(doneSectors, sectorsToRead,
|
||||
currentTrack.TrackSequence,
|
||||
SectorTagType.CdSectorSubchannel);
|
||||
sector = image.ReadSectorsTag(doneSectors, SECTORS_TO_READ, currentTrack.TrackSequence,
|
||||
SectorTagType.CdSectorSubchannel);
|
||||
|
||||
doneSectors += sectorsToRead;
|
||||
doneSectors += SECTORS_TO_READ;
|
||||
}
|
||||
else
|
||||
{
|
||||
sector = images[i].ReadSectorsTag(doneSectors, (uint)(sectors - doneSectors),
|
||||
currentTrack.TrackSequence,
|
||||
SectorTagType.CdSectorSubchannel);
|
||||
sector = image.ReadSectorsTag(doneSectors, (uint)(sectors - doneSectors),
|
||||
currentTrack.TrackSequence,
|
||||
SectorTagType.CdSectorSubchannel);
|
||||
|
||||
doneSectors += sectors - doneSectors;
|
||||
}
|
||||
@@ -1537,6 +1551,7 @@ namespace Aaru.Tests.Images
|
||||
|
||||
Assert.AreEqual(_subchannelMd5S[i], ctx.End(), $"Subchannel hash: {_testFiles[i]}");
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -98,7 +98,7 @@ namespace Aaru.Tests.Images.Commodore64
|
||||
}
|
||||
|
||||
// How many sectors to read at once
|
||||
const uint _sectorsToRead = 256;
|
||||
const uint SECTORS_TO_READ = 256;
|
||||
|
||||
[Test]
|
||||
public void Hashes()
|
||||
@@ -123,10 +123,10 @@ namespace Aaru.Tests.Images.Commodore64
|
||||
{
|
||||
byte[] sector;
|
||||
|
||||
if(image.Info.Sectors - doneSectors >= _sectorsToRead)
|
||||
if(image.Info.Sectors - doneSectors >= SECTORS_TO_READ)
|
||||
{
|
||||
sector = image.ReadSectors(doneSectors, _sectorsToRead);
|
||||
doneSectors += _sectorsToRead;
|
||||
sector = image.ReadSectors(doneSectors, SECTORS_TO_READ);
|
||||
doneSectors += SECTORS_TO_READ;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -98,7 +98,7 @@ namespace Aaru.Tests.Images.Commodore64
|
||||
}
|
||||
|
||||
// How many sectors to read at once
|
||||
const uint _sectorsToRead = 256;
|
||||
const uint SECTORS_TO_READ = 256;
|
||||
|
||||
[Test]
|
||||
public void Hashes()
|
||||
@@ -123,10 +123,10 @@ namespace Aaru.Tests.Images.Commodore64
|
||||
{
|
||||
byte[] sector;
|
||||
|
||||
if(image.Info.Sectors - doneSectors >= _sectorsToRead)
|
||||
if(image.Info.Sectors - doneSectors >= SECTORS_TO_READ)
|
||||
{
|
||||
sector = image.ReadSectors(doneSectors, _sectorsToRead);
|
||||
doneSectors += _sectorsToRead;
|
||||
sector = image.ReadSectors(doneSectors, SECTORS_TO_READ);
|
||||
doneSectors += SECTORS_TO_READ;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -26,11 +26,12 @@
|
||||
// Copyright © 2011-2021 Natalia Portillo
|
||||
// ****************************************************************************/
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
using Aaru.Checksums;
|
||||
using Aaru.CommonTypes;
|
||||
using Aaru.CommonTypes.Interfaces;
|
||||
using Aaru.Filters;
|
||||
using FluentAssertions.Execution;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace Aaru.Tests.Images
|
||||
@@ -2491,46 +2492,81 @@ namespace Aaru.Tests.Images
|
||||
"1a9f2eeb3cbeeb057b9a9a5c6e9b0cc6"
|
||||
};
|
||||
|
||||
readonly string _dataFolder = Path.Combine(Consts.TEST_FILES_ROOT, "Media image formats", "CopyQM");
|
||||
|
||||
[Test]
|
||||
public void Test()
|
||||
public void Info()
|
||||
{
|
||||
for(int i = 0; i < _testFiles.Length; i++)
|
||||
Environment.CurrentDirectory = _dataFolder;
|
||||
|
||||
Assert.Multiple(() =>
|
||||
{
|
||||
string location = Path.Combine(Consts.TEST_FILES_ROOT, "Media image formats", "CopyQM", _testFiles[i]);
|
||||
IFilter filter = new LZip();
|
||||
filter.Open(location);
|
||||
IMediaImage image = new DiscImages.CopyQm();
|
||||
Assert.AreEqual(true, image.Open(filter), _testFiles[i]);
|
||||
Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]);
|
||||
Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]);
|
||||
Assert.AreEqual(_mediaTypes[i], image.Info.MediaType, _testFiles[i]);
|
||||
|
||||
// How many sectors to read at once
|
||||
const uint sectorsToRead = 256;
|
||||
ulong doneSectors = 0;
|
||||
|
||||
var ctx = new Md5Context();
|
||||
|
||||
while(doneSectors < image.Info.Sectors)
|
||||
for(int i = 0; i < _testFiles.Length; i++)
|
||||
{
|
||||
byte[] sector;
|
||||
var filter = new LZip();
|
||||
filter.Open(_testFiles[i]);
|
||||
|
||||
if(image.Info.Sectors - doneSectors >= sectorsToRead)
|
||||
{
|
||||
sector = image.ReadSectors(doneSectors, sectorsToRead);
|
||||
doneSectors += sectorsToRead;
|
||||
}
|
||||
else
|
||||
{
|
||||
sector = image.ReadSectors(doneSectors, (uint)(image.Info.Sectors - doneSectors));
|
||||
doneSectors += image.Info.Sectors - doneSectors;
|
||||
}
|
||||
var image = new DiscImages.CopyQm();
|
||||
bool opened = image.Open(filter);
|
||||
|
||||
ctx.Update(sector);
|
||||
Assert.AreEqual(true, opened, $"Open: {_testFiles[i]}");
|
||||
|
||||
using(new AssertionScope())
|
||||
{
|
||||
Assert.Multiple(() =>
|
||||
{
|
||||
Assert.AreEqual(_sectors[i], image.Info.Sectors, $"Sectors: {_testFiles[i]}");
|
||||
Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, $"Sector size: {_testFiles[i]}");
|
||||
Assert.AreEqual(_mediaTypes[i], image.Info.MediaType, $"Media type: {_testFiles[i]}");
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Assert.AreEqual(_md5S[i], ctx.End(), _testFiles[i]);
|
||||
}
|
||||
// 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++)
|
||||
{
|
||||
var filter = new LZip();
|
||||
filter.Open(_testFiles[i]);
|
||||
|
||||
var image = new DiscImages.CopyQm();
|
||||
bool opened = image.Open(filter);
|
||||
ulong doneSectors = 0;
|
||||
|
||||
Assert.AreEqual(true, opened, $"Open: {_testFiles[i]}");
|
||||
var ctx = new Md5Context();
|
||||
|
||||
while(doneSectors < image.Info.Sectors)
|
||||
{
|
||||
byte[] sector;
|
||||
|
||||
if(image.Info.Sectors - doneSectors >= SECTORS_TO_READ)
|
||||
{
|
||||
sector = image.ReadSectors(doneSectors, SECTORS_TO_READ);
|
||||
doneSectors += SECTORS_TO_READ;
|
||||
}
|
||||
else
|
||||
{
|
||||
sector = image.ReadSectors(doneSectors, (uint)(image.Info.Sectors - doneSectors));
|
||||
doneSectors += image.Info.Sectors - doneSectors;
|
||||
}
|
||||
|
||||
ctx.Update(sector);
|
||||
}
|
||||
|
||||
Assert.AreEqual(_md5S[i], ctx.End(), $"Hash: {_testFiles[i]}");
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -906,7 +906,7 @@ namespace Aaru.Tests.Images
|
||||
}
|
||||
|
||||
// How many sectors to read at once
|
||||
const uint _sectorsToRead = 256;
|
||||
const uint SECTORS_TO_READ = 256;
|
||||
|
||||
[Test]
|
||||
public void Hashes()
|
||||
@@ -931,10 +931,10 @@ namespace Aaru.Tests.Images
|
||||
{
|
||||
byte[] sector;
|
||||
|
||||
if(image.Info.Sectors - doneSectors >= _sectorsToRead)
|
||||
if(image.Info.Sectors - doneSectors >= SECTORS_TO_READ)
|
||||
{
|
||||
sector = image.ReadSectors(doneSectors, _sectorsToRead);
|
||||
doneSectors += _sectorsToRead;
|
||||
sector = image.ReadSectors(doneSectors, SECTORS_TO_READ);
|
||||
doneSectors += SECTORS_TO_READ;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -26,11 +26,12 @@
|
||||
// Copyright © 2011-2021 Natalia Portillo
|
||||
// ****************************************************************************/
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
using Aaru.Checksums;
|
||||
using Aaru.CommonTypes;
|
||||
using Aaru.CommonTypes.Interfaces;
|
||||
using Aaru.Filters;
|
||||
using FluentAssertions.Execution;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace Aaru.Tests.Images
|
||||
@@ -82,46 +83,88 @@ namespace Aaru.Tests.Images
|
||||
"c7df67f4e66dad658fe856d3c8b36c7a"
|
||||
};
|
||||
|
||||
readonly string _dataFolder = Path.Combine(Consts.TEST_FILES_ROOT, "Media image formats", "D88");
|
||||
|
||||
[Test]
|
||||
public void Test()
|
||||
public void Info()
|
||||
{
|
||||
for(int i = 0; i < _testFiles.Length; i++)
|
||||
Environment.CurrentDirectory = _dataFolder;
|
||||
|
||||
Assert.Multiple(() =>
|
||||
{
|
||||
string location = Path.Combine(Consts.TEST_FILES_ROOT, "Media image formats", "D88", _testFiles[i]);
|
||||
IFilter filter = new LZip();
|
||||
filter.Open(location);
|
||||
IMediaImage image = new DiscImages.D88();
|
||||
Assert.AreEqual(true, image.Open(filter), _testFiles[i]);
|
||||
Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]);
|
||||
Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]);
|
||||
Assert.AreEqual(_mediaTypes[i], image.Info.MediaType, _testFiles[i]);
|
||||
|
||||
// How many sectors to read at once
|
||||
const uint sectorsToRead = 256;
|
||||
ulong doneSectors = 0;
|
||||
|
||||
var ctx = new Md5Context();
|
||||
|
||||
while(doneSectors < image.Info.Sectors)
|
||||
for(int i = 0; i < _testFiles.Length; i++)
|
||||
{
|
||||
byte[] sector;
|
||||
var filter = new LZip();
|
||||
filter.Open(_testFiles[i]);
|
||||
|
||||
if(image.Info.Sectors - doneSectors >= sectorsToRead)
|
||||
{
|
||||
sector = image.ReadSectors(doneSectors, sectorsToRead);
|
||||
doneSectors += sectorsToRead;
|
||||
}
|
||||
else
|
||||
{
|
||||
sector = image.ReadSectors(doneSectors, (uint)(image.Info.Sectors - doneSectors));
|
||||
doneSectors += image.Info.Sectors - doneSectors;
|
||||
}
|
||||
var image = new DiscImages.D88();
|
||||
bool opened = image.Open(filter);
|
||||
|
||||
ctx.Update(sector);
|
||||
Assert.AreEqual(true, opened, $"Open: {_testFiles[i]}");
|
||||
|
||||
if(!opened)
|
||||
continue;
|
||||
|
||||
using(new AssertionScope())
|
||||
{
|
||||
Assert.Multiple(() =>
|
||||
{
|
||||
Assert.AreEqual(_sectors[i], image.Info.Sectors, $"Sectors: {_testFiles[i]}");
|
||||
Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, $"Sector size: {_testFiles[i]}");
|
||||
Assert.AreEqual(_mediaTypes[i], image.Info.MediaType, $"Media type: {_testFiles[i]}");
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Assert.AreEqual(_md5S[i], ctx.End(), _testFiles[i]);
|
||||
}
|
||||
// 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++)
|
||||
{
|
||||
var filter = new LZip();
|
||||
filter.Open(_testFiles[i]);
|
||||
|
||||
var image = new DiscImages.D88();
|
||||
bool opened = image.Open(filter);
|
||||
ulong doneSectors = 0;
|
||||
|
||||
Assert.AreEqual(true, opened, $"Open: {_testFiles[i]}");
|
||||
|
||||
if(!opened)
|
||||
continue;
|
||||
|
||||
var ctx = new Md5Context();
|
||||
|
||||
while(doneSectors < image.Info.Sectors)
|
||||
{
|
||||
byte[] sector;
|
||||
|
||||
if(image.Info.Sectors - doneSectors >= SECTORS_TO_READ)
|
||||
{
|
||||
sector = image.ReadSectors(doneSectors, SECTORS_TO_READ);
|
||||
doneSectors += SECTORS_TO_READ;
|
||||
}
|
||||
else
|
||||
{
|
||||
sector = image.ReadSectors(doneSectors, (uint)(image.Info.Sectors - doneSectors));
|
||||
doneSectors += image.Info.Sectors - doneSectors;
|
||||
}
|
||||
|
||||
ctx.Update(sector);
|
||||
}
|
||||
|
||||
Assert.AreEqual(_md5S[i], ctx.End(), $"Hash: {_testFiles[i]}");
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -26,11 +26,12 @@
|
||||
// Copyright © 2011-2021 Natalia Portillo
|
||||
// ****************************************************************************/
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
using Aaru.Checksums;
|
||||
using Aaru.CommonTypes;
|
||||
using Aaru.CommonTypes.Interfaces;
|
||||
using Aaru.Filters;
|
||||
using FluentAssertions.Execution;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace Aaru.Tests.Images
|
||||
@@ -67,46 +68,88 @@ namespace Aaru.Tests.Images
|
||||
"93e71b9ecdb39d3ec9245b4f451856d4", "93e71b9ecdb39d3ec9245b4f451856d4"
|
||||
};
|
||||
|
||||
readonly string _dataFolder = Path.Combine(Consts.TEST_FILES_ROOT, "Media image formats", "DART");
|
||||
|
||||
[Test]
|
||||
public void Test()
|
||||
public void Info()
|
||||
{
|
||||
for(int i = 0; i < _testFiles.Length; i++)
|
||||
Environment.CurrentDirectory = _dataFolder;
|
||||
|
||||
Assert.Multiple(() =>
|
||||
{
|
||||
string location = Path.Combine(Consts.TEST_FILES_ROOT, "Media image formats", "DART", _testFiles[i]);
|
||||
IFilter filter = new LZip();
|
||||
filter.Open(location);
|
||||
IMediaImage image = new DiscImages.Dart();
|
||||
Assert.AreEqual(true, image.Open(filter), _testFiles[i]);
|
||||
Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]);
|
||||
Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]);
|
||||
Assert.AreEqual(_mediaTypes[i], image.Info.MediaType, _testFiles[i]);
|
||||
|
||||
// How many sectors to read at once
|
||||
const uint sectorsToRead = 256;
|
||||
ulong doneSectors = 0;
|
||||
|
||||
var ctx = new Md5Context();
|
||||
|
||||
while(doneSectors < image.Info.Sectors)
|
||||
for(int i = 0; i < _testFiles.Length; i++)
|
||||
{
|
||||
byte[] sector;
|
||||
var filter = new LZip();
|
||||
filter.Open(_testFiles[i]);
|
||||
|
||||
if(image.Info.Sectors - doneSectors >= sectorsToRead)
|
||||
{
|
||||
sector = image.ReadSectors(doneSectors, sectorsToRead);
|
||||
doneSectors += sectorsToRead;
|
||||
}
|
||||
else
|
||||
{
|
||||
sector = image.ReadSectors(doneSectors, (uint)(image.Info.Sectors - doneSectors));
|
||||
doneSectors += image.Info.Sectors - doneSectors;
|
||||
}
|
||||
var image = new DiscImages.Dart();
|
||||
bool opened = image.Open(filter);
|
||||
|
||||
ctx.Update(sector);
|
||||
Assert.AreEqual(true, opened, $"Open: {_testFiles[i]}");
|
||||
|
||||
if(!opened)
|
||||
continue;
|
||||
|
||||
using(new AssertionScope())
|
||||
{
|
||||
Assert.Multiple(() =>
|
||||
{
|
||||
Assert.AreEqual(_sectors[i], image.Info.Sectors, $"Sectors: {_testFiles[i]}");
|
||||
Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, $"Sector size: {_testFiles[i]}");
|
||||
Assert.AreEqual(_mediaTypes[i], image.Info.MediaType, $"Media type: {_testFiles[i]}");
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Assert.AreEqual(_md5S[i], ctx.End(), _testFiles[i]);
|
||||
}
|
||||
// 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++)
|
||||
{
|
||||
var filter = new LZip();
|
||||
filter.Open(_testFiles[i]);
|
||||
|
||||
var image = new DiscImages.Dart();
|
||||
bool opened = image.Open(filter);
|
||||
ulong doneSectors = 0;
|
||||
|
||||
Assert.AreEqual(true, opened, $"Open: {_testFiles[i]}");
|
||||
|
||||
if(!opened)
|
||||
continue;
|
||||
|
||||
var ctx = new Md5Context();
|
||||
|
||||
while(doneSectors < image.Info.Sectors)
|
||||
{
|
||||
byte[] sector;
|
||||
|
||||
if(image.Info.Sectors - doneSectors >= SECTORS_TO_READ)
|
||||
{
|
||||
sector = image.ReadSectors(doneSectors, SECTORS_TO_READ);
|
||||
doneSectors += SECTORS_TO_READ;
|
||||
}
|
||||
else
|
||||
{
|
||||
sector = image.ReadSectors(doneSectors, (uint)(image.Info.Sectors - doneSectors));
|
||||
doneSectors += image.Info.Sectors - doneSectors;
|
||||
}
|
||||
|
||||
ctx.Update(sector);
|
||||
}
|
||||
|
||||
Assert.AreEqual(_md5S[i], ctx.End(), $"Hash: {_testFiles[i]}");
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -32,10 +32,10 @@ using System.Linq;
|
||||
using Aaru.Checksums;
|
||||
using Aaru.CommonTypes;
|
||||
using Aaru.CommonTypes.Enums;
|
||||
using Aaru.CommonTypes.Interfaces;
|
||||
using Aaru.CommonTypes.Structs;
|
||||
using Aaru.Filters;
|
||||
using FluentAssertions;
|
||||
using FluentAssertions.Execution;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace Aaru.Tests.Images
|
||||
@@ -1968,120 +1968,135 @@ namespace Aaru.Tests.Images
|
||||
}
|
||||
};
|
||||
|
||||
readonly string _dataFolder = Path.Combine(Consts.TEST_FILES_ROOT, "Media image formats", "DiscJuggler");
|
||||
|
||||
[Test]
|
||||
public void Test()
|
||||
public void Info()
|
||||
{
|
||||
// How many sectors to read at once
|
||||
const uint sectorsToRead = 256;
|
||||
|
||||
Environment.CurrentDirectory = Path.Combine(Consts.TEST_FILES_ROOT, "Media image formats", "DiscJuggler");
|
||||
|
||||
IFilter[] filters = new IFilter[_testFiles.Length];
|
||||
Environment.CurrentDirectory = _dataFolder;
|
||||
|
||||
for(int i = 0; i < _testFiles.Length; i++)
|
||||
{
|
||||
filters[i] = new ZZZNoFilter();
|
||||
filters[i].Open(_testFiles[i]);
|
||||
}
|
||||
var filter = new ZZZNoFilter();
|
||||
filter.Open(_testFiles[i]);
|
||||
|
||||
IOpticalMediaImage[] images = new IOpticalMediaImage[_testFiles.Length];
|
||||
var image = new DiscImages.DiscJuggler();
|
||||
bool opened = image.Open(filter);
|
||||
|
||||
for(int i = 0; i < _testFiles.Length; i++)
|
||||
{
|
||||
images[i] = new DiscImages.DiscJuggler();
|
||||
Assert.AreEqual(true, images[i].Open(filters[i]), $"Open: {_testFiles[i]}");
|
||||
}
|
||||
Assert.AreEqual(true, opened, $"Open: {_testFiles[i]}");
|
||||
|
||||
for(int i = 0; i < _testFiles.Length; i++)
|
||||
Assert.AreEqual(_sectors[i], images[i].Info.Sectors, $"Sectors: {_testFiles[i]}");
|
||||
|
||||
for(int i = 0; i < _testFiles.Length; i++)
|
||||
Assert.AreEqual(_mediaTypes[i], images[i].Info.MediaType, $"Media type: {_testFiles[i]}");
|
||||
|
||||
for(int i = 0; i < _testFiles.Length; i++)
|
||||
Assert.AreEqual(_tracks[i], images[i].Tracks.Count, $"Tracks: {_testFiles[i]}");
|
||||
|
||||
for(int i = 0; i < _testFiles.Length; i++)
|
||||
images[i].Tracks.Select(t => t.TrackSession).Should().
|
||||
BeEquivalentTo(_trackSessions[i], $"Track session: {_testFiles[i]}");
|
||||
|
||||
for(int i = 0; i < _testFiles.Length; i++)
|
||||
images[i].Tracks.Select(t => t.TrackStartSector).Should().
|
||||
BeEquivalentTo(_trackStarts[i], $"Track start: {_testFiles[i]}");
|
||||
|
||||
for(int i = 0; i < _testFiles.Length; i++)
|
||||
images[i].Tracks.Select(t => t.TrackEndSector).Should().
|
||||
BeEquivalentTo(_trackEnds[i], $"Track end: {_testFiles[i]}");
|
||||
|
||||
for(int i = 0; i < _testFiles.Length; i++)
|
||||
images[i].Tracks.Select(t => t.TrackPregap).Should().
|
||||
BeEquivalentTo(_trackPregaps[i], $"Track pregap: {_testFiles[i]}");
|
||||
|
||||
for(int i = 0; i < _testFiles.Length; i++)
|
||||
{
|
||||
int trackNo = 0;
|
||||
|
||||
foreach(Track currentTrack in images[i].Tracks)
|
||||
using(new AssertionScope())
|
||||
{
|
||||
if(images[i].Info.ReadableSectorTags.Contains(SectorTagType.CdTrackFlags))
|
||||
Assert.AreEqual(_trackFlags[i][trackNo],
|
||||
images[i].ReadSectorTag(currentTrack.TrackSequence, SectorTagType.CdTrackFlags)
|
||||
[0], $"Track flags: {_testFiles[i]}, track {currentTrack.TrackSequence}");
|
||||
Assert.Multiple(() =>
|
||||
{
|
||||
Assert.AreEqual(_sectors[i], image.Info.Sectors, $"Sectors: {_testFiles[i]}");
|
||||
Assert.AreEqual(_mediaTypes[i], image.Info.MediaType, $"Media type: {_testFiles[i]}");
|
||||
|
||||
trackNo++;
|
||||
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]}");
|
||||
|
||||
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];
|
||||
|
||||
foreach(Track currentTrack in image.Tracks)
|
||||
{
|
||||
if(image.Info.ReadableSectorTags.Contains(SectorTagType.CdTrackFlags))
|
||||
flags[trackNo] = image.ReadSectorTag(currentTrack.TrackSequence,
|
||||
SectorTagType.CdTrackFlags)[0];
|
||||
|
||||
trackNo++;
|
||||
}
|
||||
|
||||
flags.Should().BeEquivalentTo(_trackFlags[i], $"Track flags: {_testFiles[i]}");
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach(bool @long in new[]
|
||||
// How many sectors to read at once
|
||||
const uint SECTORS_TO_READ = 256;
|
||||
|
||||
[Test]
|
||||
public void Hashes()
|
||||
{
|
||||
Environment.CurrentDirectory = _dataFolder;
|
||||
|
||||
Assert.Multiple(() =>
|
||||
{
|
||||
false, true
|
||||
})
|
||||
for(int i = 0; i < _testFiles.Length; i++)
|
||||
{
|
||||
var ctx = new Md5Context();
|
||||
var filter = new ZZZNoFilter();
|
||||
filter.Open(_testFiles[i]);
|
||||
|
||||
foreach(Track currentTrack in images[i].Tracks)
|
||||
var image = new DiscImages.DiscJuggler();
|
||||
bool opened = image.Open(filter);
|
||||
|
||||
Assert.AreEqual(true, opened, $"Open: {_testFiles[i]}");
|
||||
Md5Context ctx;
|
||||
|
||||
foreach(bool @long in new[]
|
||||
{
|
||||
ulong sectors = currentTrack.TrackEndSector - currentTrack.TrackStartSector + 1;
|
||||
ulong doneSectors = 0;
|
||||
false, true
|
||||
})
|
||||
{
|
||||
ctx = new Md5Context();
|
||||
|
||||
while(doneSectors < sectors)
|
||||
foreach(Track currentTrack in image.Tracks)
|
||||
{
|
||||
byte[] sector;
|
||||
ulong sectors = currentTrack.TrackEndSector - currentTrack.TrackStartSector + 1;
|
||||
ulong doneSectors = 0;
|
||||
|
||||
if(sectors - doneSectors >= sectorsToRead)
|
||||
while(doneSectors < sectors)
|
||||
{
|
||||
sector = @long ? images[i].
|
||||
ReadSectorsLong(doneSectors, sectorsToRead, currentTrack.TrackSequence)
|
||||
: images[i].
|
||||
ReadSectors(doneSectors, sectorsToRead, currentTrack.TrackSequence);
|
||||
byte[] sector;
|
||||
|
||||
doneSectors += sectorsToRead;
|
||||
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);
|
||||
}
|
||||
else
|
||||
{
|
||||
sector = @long ? images[i].ReadSectorsLong(doneSectors, (uint)(sectors - doneSectors),
|
||||
currentTrack.TrackSequence)
|
||||
: images[i].ReadSectors(doneSectors, (uint)(sectors - doneSectors),
|
||||
currentTrack.TrackSequence);
|
||||
|
||||
doneSectors += sectors - doneSectors;
|
||||
}
|
||||
|
||||
ctx.Update(sector);
|
||||
}
|
||||
|
||||
Assert.AreEqual(@long ? _longMd5S[i] : _md5S[i], ctx.End(),
|
||||
$"{(@long ? "Long hash" : "Hash")}: {_testFiles[i]}");
|
||||
}
|
||||
|
||||
Assert.AreEqual(@long ? _longMd5S[i] : _md5S[i], ctx.End(),
|
||||
$"{(@long ? "Long hash" : "Hash")}: {_testFiles[i]}");
|
||||
}
|
||||
if(!image.Info.ReadableSectorTags.Contains(SectorTagType.CdSectorSubchannel))
|
||||
continue;
|
||||
|
||||
for(int i = 0; i < _testFiles.Length; i++)
|
||||
if(images[i].Info.ReadableSectorTags.Contains(SectorTagType.CdSectorSubchannel))
|
||||
{
|
||||
var ctx = new Md5Context();
|
||||
ctx = new Md5Context();
|
||||
|
||||
foreach(Track currentTrack in images[i].Tracks)
|
||||
foreach(Track currentTrack in image.Tracks)
|
||||
{
|
||||
ulong sectors = currentTrack.TrackEndSector - currentTrack.TrackStartSector + 1;
|
||||
ulong doneSectors = 0;
|
||||
@@ -2090,19 +2105,18 @@ namespace Aaru.Tests.Images
|
||||
{
|
||||
byte[] sector;
|
||||
|
||||
if(sectors - doneSectors >= sectorsToRead)
|
||||
if(sectors - doneSectors >= SECTORS_TO_READ)
|
||||
{
|
||||
sector = images[i].ReadSectorsTag(doneSectors, sectorsToRead,
|
||||
currentTrack.TrackSequence,
|
||||
SectorTagType.CdSectorSubchannel);
|
||||
sector = image.ReadSectorsTag(doneSectors, SECTORS_TO_READ, currentTrack.TrackSequence,
|
||||
SectorTagType.CdSectorSubchannel);
|
||||
|
||||
doneSectors += sectorsToRead;
|
||||
doneSectors += SECTORS_TO_READ;
|
||||
}
|
||||
else
|
||||
{
|
||||
sector = images[i].ReadSectorsTag(doneSectors, (uint)(sectors - doneSectors),
|
||||
currentTrack.TrackSequence,
|
||||
SectorTagType.CdSectorSubchannel);
|
||||
sector = image.ReadSectorsTag(doneSectors, (uint)(sectors - doneSectors),
|
||||
currentTrack.TrackSequence,
|
||||
SectorTagType.CdSectorSubchannel);
|
||||
|
||||
doneSectors += sectors - doneSectors;
|
||||
}
|
||||
@@ -2113,6 +2127,7 @@ namespace Aaru.Tests.Images
|
||||
|
||||
Assert.AreEqual(_subchannelMd5S[i], ctx.End(), $"Subchannel hash: {_testFiles[i]}");
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -26,11 +26,12 @@
|
||||
// Copyright © 2011-2021 Natalia Portillo
|
||||
// ****************************************************************************/
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
using Aaru.Checksums;
|
||||
using Aaru.CommonTypes;
|
||||
using Aaru.CommonTypes.Interfaces;
|
||||
using Aaru.Filters;
|
||||
using FluentAssertions.Execution;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace Aaru.Tests.Images
|
||||
@@ -164,48 +165,81 @@ namespace Aaru.Tests.Images
|
||||
"fcf747bd356b48d442ff74adb8f3516b"
|
||||
};
|
||||
|
||||
readonly string _dataFolder = Path.Combine(Consts.TEST_FILES_ROOT, "Media image formats", "DiskCopy 4.2");
|
||||
|
||||
[Test]
|
||||
public void Test()
|
||||
public void Info()
|
||||
{
|
||||
for(int i = 0; i < _testFiles.Length; i++)
|
||||
Environment.CurrentDirectory = _dataFolder;
|
||||
|
||||
Assert.Multiple(() =>
|
||||
{
|
||||
string location = Path.Combine(Consts.TEST_FILES_ROOT, "Media image formats", "DiskCopy 4.2",
|
||||
_testFiles[i]);
|
||||
|
||||
IFilter filter = new LZip();
|
||||
filter.Open(location);
|
||||
IMediaImage image = new DiscImages.DiskCopy42();
|
||||
Assert.AreEqual(true, image.Open(filter), _testFiles[i]);
|
||||
Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]);
|
||||
Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]);
|
||||
Assert.AreEqual(_mediaTypes[i], image.Info.MediaType, _testFiles[i]);
|
||||
|
||||
// How many sectors to read at once
|
||||
const uint sectorsToRead = 256;
|
||||
ulong doneSectors = 0;
|
||||
|
||||
var ctx = new Md5Context();
|
||||
|
||||
while(doneSectors < image.Info.Sectors)
|
||||
for(int i = 0; i < _testFiles.Length; i++)
|
||||
{
|
||||
byte[] sector;
|
||||
var filter = new LZip();
|
||||
filter.Open(_testFiles[i]);
|
||||
|
||||
if(image.Info.Sectors - doneSectors >= sectorsToRead)
|
||||
{
|
||||
sector = image.ReadSectors(doneSectors, sectorsToRead);
|
||||
doneSectors += sectorsToRead;
|
||||
}
|
||||
else
|
||||
{
|
||||
sector = image.ReadSectors(doneSectors, (uint)(image.Info.Sectors - doneSectors));
|
||||
doneSectors += image.Info.Sectors - doneSectors;
|
||||
}
|
||||
var image = new DiscImages.DiskCopy42();
|
||||
bool opened = image.Open(filter);
|
||||
|
||||
ctx.Update(sector);
|
||||
Assert.AreEqual(true, opened, $"Open: {_testFiles[i]}");
|
||||
|
||||
using(new AssertionScope())
|
||||
{
|
||||
Assert.Multiple(() =>
|
||||
{
|
||||
Assert.AreEqual(_sectors[i], image.Info.Sectors, $"Sectors: {_testFiles[i]}");
|
||||
Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, $"Sector size: {_testFiles[i]}");
|
||||
Assert.AreEqual(_mediaTypes[i], image.Info.MediaType, $"Media type: {_testFiles[i]}");
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Assert.AreEqual(_md5S[i], ctx.End(), _testFiles[i]);
|
||||
}
|
||||
// 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++)
|
||||
{
|
||||
var filter = new LZip();
|
||||
filter.Open(_testFiles[i]);
|
||||
|
||||
var image = new DiscImages.DiskCopy42();
|
||||
bool opened = image.Open(filter);
|
||||
ulong doneSectors = 0;
|
||||
|
||||
Assert.AreEqual(true, opened, $"Open: {_testFiles[i]}");
|
||||
var ctx = new Md5Context();
|
||||
|
||||
while(doneSectors < image.Info.Sectors)
|
||||
{
|
||||
byte[] sector;
|
||||
|
||||
if(image.Info.Sectors - doneSectors >= SECTORS_TO_READ)
|
||||
{
|
||||
sector = image.ReadSectors(doneSectors, SECTORS_TO_READ);
|
||||
doneSectors += SECTORS_TO_READ;
|
||||
}
|
||||
else
|
||||
{
|
||||
sector = image.ReadSectors(doneSectors, (uint)(image.Info.Sectors - doneSectors));
|
||||
doneSectors += image.Info.Sectors - doneSectors;
|
||||
}
|
||||
|
||||
ctx.Update(sector);
|
||||
}
|
||||
|
||||
Assert.AreEqual(_md5S[i], ctx.End(), $"Hash: {_testFiles[i]}");
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -163,7 +163,7 @@ namespace Aaru.Tests.Images.DiskCopy633
|
||||
}
|
||||
|
||||
// How many sectors to read at once
|
||||
const uint _sectorsToRead = 256;
|
||||
const uint SECTORS_TO_READ = 256;
|
||||
|
||||
[Test]
|
||||
public void Hashes()
|
||||
@@ -188,10 +188,10 @@ namespace Aaru.Tests.Images.DiskCopy633
|
||||
{
|
||||
byte[] sector;
|
||||
|
||||
if(image.Info.Sectors - doneSectors >= _sectorsToRead)
|
||||
if(image.Info.Sectors - doneSectors >= SECTORS_TO_READ)
|
||||
{
|
||||
sector = image.ReadSectors(doneSectors, _sectorsToRead);
|
||||
doneSectors += _sectorsToRead;
|
||||
sector = image.ReadSectors(doneSectors, SECTORS_TO_READ);
|
||||
doneSectors += SECTORS_TO_READ;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -316,7 +316,7 @@ namespace Aaru.Tests.Images.DiskCopy633.NDIF
|
||||
}
|
||||
|
||||
// How many sectors to read at once
|
||||
const uint _sectorsToRead = 256;
|
||||
const uint SECTORS_TO_READ = 256;
|
||||
|
||||
[Test]
|
||||
public void Hashes()
|
||||
@@ -341,10 +341,10 @@ namespace Aaru.Tests.Images.DiskCopy633.NDIF
|
||||
{
|
||||
byte[] sector;
|
||||
|
||||
if(image.Info.Sectors - doneSectors >= _sectorsToRead)
|
||||
if(image.Info.Sectors - doneSectors >= SECTORS_TO_READ)
|
||||
{
|
||||
sector = image.ReadSectors(doneSectors, _sectorsToRead);
|
||||
doneSectors += _sectorsToRead;
|
||||
sector = image.ReadSectors(doneSectors, SECTORS_TO_READ);
|
||||
doneSectors += SECTORS_TO_READ;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -200,7 +200,7 @@ namespace Aaru.Tests.Images.DiskCopy633.NDIF
|
||||
}
|
||||
|
||||
// How many sectors to read at once
|
||||
const uint _sectorsToRead = 256;
|
||||
const uint SECTORS_TO_READ = 256;
|
||||
|
||||
[Test]
|
||||
public void Hashes()
|
||||
@@ -225,10 +225,10 @@ namespace Aaru.Tests.Images.DiskCopy633.NDIF
|
||||
{
|
||||
byte[] sector;
|
||||
|
||||
if(image.Info.Sectors - doneSectors >= _sectorsToRead)
|
||||
if(image.Info.Sectors - doneSectors >= SECTORS_TO_READ)
|
||||
{
|
||||
sector = image.ReadSectors(doneSectors, _sectorsToRead);
|
||||
doneSectors += _sectorsToRead;
|
||||
sector = image.ReadSectors(doneSectors, SECTORS_TO_READ);
|
||||
doneSectors += SECTORS_TO_READ;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -205,7 +205,7 @@ namespace Aaru.Tests.Images.DiskCopy633.NDIF
|
||||
}
|
||||
|
||||
// How many sectors to read at once
|
||||
const uint _sectorsToRead = 256;
|
||||
const uint SECTORS_TO_READ = 256;
|
||||
|
||||
[Test]
|
||||
public void Hashes()
|
||||
@@ -230,10 +230,10 @@ namespace Aaru.Tests.Images.DiskCopy633.NDIF
|
||||
{
|
||||
byte[] sector;
|
||||
|
||||
if(image.Info.Sectors - doneSectors >= _sectorsToRead)
|
||||
if(image.Info.Sectors - doneSectors >= SECTORS_TO_READ)
|
||||
{
|
||||
sector = image.ReadSectors(doneSectors, _sectorsToRead);
|
||||
doneSectors += _sectorsToRead;
|
||||
sector = image.ReadSectors(doneSectors, SECTORS_TO_READ);
|
||||
doneSectors += SECTORS_TO_READ;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -201,7 +201,7 @@ namespace Aaru.Tests.Images.DiskCopy65
|
||||
}
|
||||
|
||||
// How many sectors to read at once
|
||||
const uint _sectorsToRead = 256;
|
||||
const uint SECTORS_TO_READ = 256;
|
||||
|
||||
[Test]
|
||||
public void Hashes()
|
||||
@@ -226,10 +226,10 @@ namespace Aaru.Tests.Images.DiskCopy65
|
||||
{
|
||||
byte[] sector;
|
||||
|
||||
if(image.Info.Sectors - doneSectors >= _sectorsToRead)
|
||||
if(image.Info.Sectors - doneSectors >= SECTORS_TO_READ)
|
||||
{
|
||||
sector = image.ReadSectors(doneSectors, _sectorsToRead);
|
||||
doneSectors += _sectorsToRead;
|
||||
sector = image.ReadSectors(doneSectors, SECTORS_TO_READ);
|
||||
doneSectors += SECTORS_TO_READ;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -201,7 +201,7 @@ namespace Aaru.Tests.Images.DiskCopy65
|
||||
}
|
||||
|
||||
// How many sectors to read at once
|
||||
const uint _sectorsToRead = 256;
|
||||
const uint SECTORS_TO_READ = 256;
|
||||
|
||||
[Test]
|
||||
public void Hashes()
|
||||
@@ -226,10 +226,10 @@ namespace Aaru.Tests.Images.DiskCopy65
|
||||
{
|
||||
byte[] sector;
|
||||
|
||||
if(image.Info.Sectors - doneSectors >= _sectorsToRead)
|
||||
if(image.Info.Sectors - doneSectors >= SECTORS_TO_READ)
|
||||
{
|
||||
sector = image.ReadSectors(doneSectors, _sectorsToRead);
|
||||
doneSectors += _sectorsToRead;
|
||||
sector = image.ReadSectors(doneSectors, SECTORS_TO_READ);
|
||||
doneSectors += SECTORS_TO_READ;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -201,7 +201,7 @@ namespace Aaru.Tests.Images.DiskCopy65
|
||||
}
|
||||
|
||||
// How many sectors to read at once
|
||||
const uint _sectorsToRead = 256;
|
||||
const uint SECTORS_TO_READ = 256;
|
||||
|
||||
[Test]
|
||||
public void Hashes()
|
||||
@@ -226,10 +226,10 @@ namespace Aaru.Tests.Images.DiskCopy65
|
||||
{
|
||||
byte[] sector;
|
||||
|
||||
if(image.Info.Sectors - doneSectors >= _sectorsToRead)
|
||||
if(image.Info.Sectors - doneSectors >= SECTORS_TO_READ)
|
||||
{
|
||||
sector = image.ReadSectors(doneSectors, _sectorsToRead);
|
||||
doneSectors += _sectorsToRead;
|
||||
sector = image.ReadSectors(doneSectors, SECTORS_TO_READ);
|
||||
doneSectors += SECTORS_TO_READ;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -201,7 +201,7 @@ namespace Aaru.Tests.Images.DiskCopy65
|
||||
}
|
||||
|
||||
// How many sectors to read at once
|
||||
const uint _sectorsToRead = 256;
|
||||
const uint SECTORS_TO_READ = 256;
|
||||
|
||||
[Test]
|
||||
public void Hashes()
|
||||
@@ -226,10 +226,10 @@ namespace Aaru.Tests.Images.DiskCopy65
|
||||
{
|
||||
byte[] sector;
|
||||
|
||||
if(image.Info.Sectors - doneSectors >= _sectorsToRead)
|
||||
if(image.Info.Sectors - doneSectors >= SECTORS_TO_READ)
|
||||
{
|
||||
sector = image.ReadSectors(doneSectors, _sectorsToRead);
|
||||
doneSectors += _sectorsToRead;
|
||||
sector = image.ReadSectors(doneSectors, SECTORS_TO_READ);
|
||||
doneSectors += SECTORS_TO_READ;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -199,7 +199,7 @@ namespace Aaru.Tests.Images.DiskImagesFramework
|
||||
}
|
||||
|
||||
// How many sectors to read at once
|
||||
const uint _sectorsToRead = 256;
|
||||
const uint SECTORS_TO_READ = 256;
|
||||
|
||||
[Test]
|
||||
public void Hashes()
|
||||
@@ -224,10 +224,10 @@ namespace Aaru.Tests.Images.DiskImagesFramework
|
||||
{
|
||||
byte[] sector;
|
||||
|
||||
if(image.Info.Sectors - doneSectors >= _sectorsToRead)
|
||||
if(image.Info.Sectors - doneSectors >= SECTORS_TO_READ)
|
||||
{
|
||||
sector = image.ReadSectors(doneSectors, _sectorsToRead);
|
||||
doneSectors += _sectorsToRead;
|
||||
sector = image.ReadSectors(doneSectors, SECTORS_TO_READ);
|
||||
doneSectors += SECTORS_TO_READ;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -285,7 +285,7 @@ namespace Aaru.Tests.Images.DiskImagesFramework.NDIF
|
||||
}
|
||||
|
||||
// How many sectors to read at once
|
||||
const uint _sectorsToRead = 256;
|
||||
const uint SECTORS_TO_READ = 256;
|
||||
|
||||
[Test]
|
||||
public void Hashes()
|
||||
@@ -310,10 +310,10 @@ namespace Aaru.Tests.Images.DiskImagesFramework.NDIF
|
||||
{
|
||||
byte[] sector;
|
||||
|
||||
if(image.Info.Sectors - doneSectors >= _sectorsToRead)
|
||||
if(image.Info.Sectors - doneSectors >= SECTORS_TO_READ)
|
||||
{
|
||||
sector = image.ReadSectors(doneSectors, _sectorsToRead);
|
||||
doneSectors += _sectorsToRead;
|
||||
sector = image.ReadSectors(doneSectors, SECTORS_TO_READ);
|
||||
doneSectors += SECTORS_TO_READ;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -285,7 +285,7 @@ namespace Aaru.Tests.Images.DiskImagesFramework.NDIF
|
||||
}
|
||||
|
||||
// How many sectors to read at once
|
||||
const uint _sectorsToRead = 256;
|
||||
const uint SECTORS_TO_READ = 256;
|
||||
|
||||
[Test]
|
||||
public void Hashes()
|
||||
@@ -310,10 +310,10 @@ namespace Aaru.Tests.Images.DiskImagesFramework.NDIF
|
||||
{
|
||||
byte[] sector;
|
||||
|
||||
if(image.Info.Sectors - doneSectors >= _sectorsToRead)
|
||||
if(image.Info.Sectors - doneSectors >= SECTORS_TO_READ)
|
||||
{
|
||||
sector = image.ReadSectors(doneSectors, _sectorsToRead);
|
||||
doneSectors += _sectorsToRead;
|
||||
sector = image.ReadSectors(doneSectors, SECTORS_TO_READ);
|
||||
doneSectors += SECTORS_TO_READ;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -285,7 +285,7 @@ namespace Aaru.Tests.Images.DiskImagesFramework.NDIF
|
||||
}
|
||||
|
||||
// How many sectors to read at once
|
||||
const uint _sectorsToRead = 256;
|
||||
const uint SECTORS_TO_READ = 256;
|
||||
|
||||
[Test]
|
||||
public void Hashes()
|
||||
@@ -310,10 +310,10 @@ namespace Aaru.Tests.Images.DiskImagesFramework.NDIF
|
||||
{
|
||||
byte[] sector;
|
||||
|
||||
if(image.Info.Sectors - doneSectors >= _sectorsToRead)
|
||||
if(image.Info.Sectors - doneSectors >= SECTORS_TO_READ)
|
||||
{
|
||||
sector = image.ReadSectors(doneSectors, _sectorsToRead);
|
||||
doneSectors += _sectorsToRead;
|
||||
sector = image.ReadSectors(doneSectors, SECTORS_TO_READ);
|
||||
doneSectors += SECTORS_TO_READ;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -298,7 +298,7 @@ namespace Aaru.Tests.Images.DiskImagesFramework.UDIF
|
||||
}
|
||||
|
||||
// How many sectors to read at once
|
||||
const uint _sectorsToRead = 256;
|
||||
const uint SECTORS_TO_READ = 256;
|
||||
|
||||
[Test]
|
||||
public void Hashes()
|
||||
@@ -323,10 +323,10 @@ namespace Aaru.Tests.Images.DiskImagesFramework.UDIF
|
||||
{
|
||||
byte[] sector;
|
||||
|
||||
if(image.Info.Sectors - doneSectors >= _sectorsToRead)
|
||||
if(image.Info.Sectors - doneSectors >= SECTORS_TO_READ)
|
||||
{
|
||||
sector = image.ReadSectors(doneSectors, _sectorsToRead);
|
||||
doneSectors += _sectorsToRead;
|
||||
sector = image.ReadSectors(doneSectors, SECTORS_TO_READ);
|
||||
doneSectors += SECTORS_TO_READ;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -298,7 +298,7 @@ namespace Aaru.Tests.Images.DiskImagesFramework.UDIF
|
||||
}
|
||||
|
||||
// How many sectors to read at once
|
||||
const uint _sectorsToRead = 256;
|
||||
const uint SECTORS_TO_READ = 256;
|
||||
|
||||
[Test]
|
||||
public void Hashes()
|
||||
@@ -323,10 +323,10 @@ namespace Aaru.Tests.Images.DiskImagesFramework.UDIF
|
||||
{
|
||||
byte[] sector;
|
||||
|
||||
if(image.Info.Sectors - doneSectors >= _sectorsToRead)
|
||||
if(image.Info.Sectors - doneSectors >= SECTORS_TO_READ)
|
||||
{
|
||||
sector = image.ReadSectors(doneSectors, _sectorsToRead);
|
||||
doneSectors += _sectorsToRead;
|
||||
sector = image.ReadSectors(doneSectors, SECTORS_TO_READ);
|
||||
doneSectors += SECTORS_TO_READ;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -298,7 +298,7 @@ namespace Aaru.Tests.Images.DiskImagesFramework.UDIF
|
||||
}
|
||||
|
||||
// How many sectors to read at once
|
||||
const uint _sectorsToRead = 256;
|
||||
const uint SECTORS_TO_READ = 256;
|
||||
|
||||
[Test]
|
||||
public void Hashes()
|
||||
@@ -323,10 +323,10 @@ namespace Aaru.Tests.Images.DiskImagesFramework.UDIF
|
||||
{
|
||||
byte[] sector;
|
||||
|
||||
if(image.Info.Sectors - doneSectors >= _sectorsToRead)
|
||||
if(image.Info.Sectors - doneSectors >= SECTORS_TO_READ)
|
||||
{
|
||||
sector = image.ReadSectors(doneSectors, _sectorsToRead);
|
||||
doneSectors += _sectorsToRead;
|
||||
sector = image.ReadSectors(doneSectors, SECTORS_TO_READ);
|
||||
doneSectors += SECTORS_TO_READ;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -298,7 +298,7 @@ namespace Aaru.Tests.Images.DiskImagesFramework.UDIF
|
||||
}
|
||||
|
||||
// How many sectors to read at once
|
||||
const uint _sectorsToRead = 256;
|
||||
const uint SECTORS_TO_READ = 256;
|
||||
|
||||
[Test]
|
||||
public void Hashes()
|
||||
@@ -323,10 +323,10 @@ namespace Aaru.Tests.Images.DiskImagesFramework.UDIF
|
||||
{
|
||||
byte[] sector;
|
||||
|
||||
if(image.Info.Sectors - doneSectors >= _sectorsToRead)
|
||||
if(image.Info.Sectors - doneSectors >= SECTORS_TO_READ)
|
||||
{
|
||||
sector = image.ReadSectors(doneSectors, _sectorsToRead);
|
||||
doneSectors += _sectorsToRead;
|
||||
sector = image.ReadSectors(doneSectors, SECTORS_TO_READ);
|
||||
doneSectors += SECTORS_TO_READ;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -297,7 +297,7 @@ namespace Aaru.Tests.Images.DiskImagesFramework.UDIF
|
||||
}
|
||||
|
||||
// How many sectors to read at once
|
||||
const uint _sectorsToRead = 256;
|
||||
const uint SECTORS_TO_READ = 256;
|
||||
|
||||
[Test]
|
||||
public void Hashes()
|
||||
@@ -322,10 +322,10 @@ namespace Aaru.Tests.Images.DiskImagesFramework.UDIF
|
||||
{
|
||||
byte[] sector;
|
||||
|
||||
if(image.Info.Sectors - doneSectors >= _sectorsToRead)
|
||||
if(image.Info.Sectors - doneSectors >= SECTORS_TO_READ)
|
||||
{
|
||||
sector = image.ReadSectors(doneSectors, _sectorsToRead);
|
||||
doneSectors += _sectorsToRead;
|
||||
sector = image.ReadSectors(doneSectors, SECTORS_TO_READ);
|
||||
doneSectors += SECTORS_TO_READ;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -297,7 +297,7 @@ namespace Aaru.Tests.Images.DiskImagesFramework.UDIF
|
||||
}
|
||||
|
||||
// How many sectors to read at once
|
||||
const uint _sectorsToRead = 256;
|
||||
const uint SECTORS_TO_READ = 256;
|
||||
|
||||
[Test]
|
||||
public void Hashes()
|
||||
@@ -322,10 +322,10 @@ namespace Aaru.Tests.Images.DiskImagesFramework.UDIF
|
||||
{
|
||||
byte[] sector;
|
||||
|
||||
if(image.Info.Sectors - doneSectors >= _sectorsToRead)
|
||||
if(image.Info.Sectors - doneSectors >= SECTORS_TO_READ)
|
||||
{
|
||||
sector = image.ReadSectors(doneSectors, _sectorsToRead);
|
||||
doneSectors += _sectorsToRead;
|
||||
sector = image.ReadSectors(doneSectors, SECTORS_TO_READ);
|
||||
doneSectors += SECTORS_TO_READ;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -298,7 +298,7 @@ namespace Aaru.Tests.Images.DiskImagesFramework.UDIF
|
||||
}
|
||||
|
||||
// How many sectors to read at once
|
||||
const uint _sectorsToRead = 256;
|
||||
const uint SECTORS_TO_READ = 256;
|
||||
|
||||
[Test]
|
||||
public void Hashes()
|
||||
@@ -323,10 +323,10 @@ namespace Aaru.Tests.Images.DiskImagesFramework.UDIF
|
||||
{
|
||||
byte[] sector;
|
||||
|
||||
if(image.Info.Sectors - doneSectors >= _sectorsToRead)
|
||||
if(image.Info.Sectors - doneSectors >= SECTORS_TO_READ)
|
||||
{
|
||||
sector = image.ReadSectors(doneSectors, _sectorsToRead);
|
||||
doneSectors += _sectorsToRead;
|
||||
sector = image.ReadSectors(doneSectors, SECTORS_TO_READ);
|
||||
doneSectors += SECTORS_TO_READ;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -298,7 +298,7 @@ namespace Aaru.Tests.Images.DiskImagesFramework.UDIF
|
||||
}
|
||||
|
||||
// How many sectors to read at once
|
||||
const uint _sectorsToRead = 256;
|
||||
const uint SECTORS_TO_READ = 256;
|
||||
|
||||
[Test]
|
||||
public void Hashes()
|
||||
@@ -323,10 +323,10 @@ namespace Aaru.Tests.Images.DiskImagesFramework.UDIF
|
||||
{
|
||||
byte[] sector;
|
||||
|
||||
if(image.Info.Sectors - doneSectors >= _sectorsToRead)
|
||||
if(image.Info.Sectors - doneSectors >= SECTORS_TO_READ)
|
||||
{
|
||||
sector = image.ReadSectors(doneSectors, _sectorsToRead);
|
||||
doneSectors += _sectorsToRead;
|
||||
sector = image.ReadSectors(doneSectors, SECTORS_TO_READ);
|
||||
doneSectors += SECTORS_TO_READ;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -298,7 +298,7 @@ namespace Aaru.Tests.Images.DiskImagesFramework.UDIF
|
||||
}
|
||||
|
||||
// How many sectors to read at once
|
||||
const uint _sectorsToRead = 256;
|
||||
const uint SECTORS_TO_READ = 256;
|
||||
|
||||
[Test]
|
||||
public void Hashes()
|
||||
@@ -323,10 +323,10 @@ namespace Aaru.Tests.Images.DiskImagesFramework.UDIF
|
||||
{
|
||||
byte[] sector;
|
||||
|
||||
if(image.Info.Sectors - doneSectors >= _sectorsToRead)
|
||||
if(image.Info.Sectors - doneSectors >= SECTORS_TO_READ)
|
||||
{
|
||||
sector = image.ReadSectors(doneSectors, _sectorsToRead);
|
||||
doneSectors += _sectorsToRead;
|
||||
sector = image.ReadSectors(doneSectors, SECTORS_TO_READ);
|
||||
doneSectors += SECTORS_TO_READ;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -142,7 +142,7 @@ namespace Aaru.Tests.Images.DiskUtilities
|
||||
}
|
||||
|
||||
// How many sectors to read at once
|
||||
const uint _sectorsToRead = 256;
|
||||
const uint SECTORS_TO_READ = 256;
|
||||
|
||||
[Test]
|
||||
public void Hashes()
|
||||
@@ -171,10 +171,10 @@ namespace Aaru.Tests.Images.DiskUtilities
|
||||
{
|
||||
byte[] sector;
|
||||
|
||||
if(image.Info.Sectors - doneSectors >= _sectorsToRead)
|
||||
if(image.Info.Sectors - doneSectors >= SECTORS_TO_READ)
|
||||
{
|
||||
sector = image.ReadSectors(doneSectors, _sectorsToRead);
|
||||
doneSectors += _sectorsToRead;
|
||||
sector = image.ReadSectors(doneSectors, SECTORS_TO_READ);
|
||||
doneSectors += SECTORS_TO_READ;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -175,7 +175,7 @@ namespace Aaru.Tests.Images.DiskUtilities
|
||||
}
|
||||
|
||||
// How many sectors to read at once
|
||||
const uint _sectorsToRead = 256;
|
||||
const uint SECTORS_TO_READ = 256;
|
||||
|
||||
[Test]
|
||||
public void Hashes()
|
||||
@@ -204,10 +204,10 @@ namespace Aaru.Tests.Images.DiskUtilities
|
||||
{
|
||||
byte[] sector;
|
||||
|
||||
if(image.Info.Sectors - doneSectors >= _sectorsToRead)
|
||||
if(image.Info.Sectors - doneSectors >= SECTORS_TO_READ)
|
||||
{
|
||||
sector = image.ReadSectors(doneSectors, _sectorsToRead);
|
||||
doneSectors += _sectorsToRead;
|
||||
sector = image.ReadSectors(doneSectors, SECTORS_TO_READ);
|
||||
doneSectors += SECTORS_TO_READ;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -2385,7 +2385,7 @@ namespace Aaru.Tests.Images
|
||||
}
|
||||
|
||||
// How many sectors to read at once
|
||||
const uint _sectorsToRead = 256;
|
||||
const uint SECTORS_TO_READ = 256;
|
||||
|
||||
[Test]
|
||||
public void Hashes()
|
||||
@@ -2410,10 +2410,10 @@ namespace Aaru.Tests.Images
|
||||
{
|
||||
byte[] sector;
|
||||
|
||||
if(image.Info.Sectors - doneSectors >= _sectorsToRead)
|
||||
if(image.Info.Sectors - doneSectors >= SECTORS_TO_READ)
|
||||
{
|
||||
sector = image.ReadSectors(doneSectors, _sectorsToRead);
|
||||
doneSectors += _sectorsToRead;
|
||||
sector = image.ReadSectors(doneSectors, SECTORS_TO_READ);
|
||||
doneSectors += SECTORS_TO_READ;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -731,10 +731,12 @@ namespace Aaru.Tests.Images
|
||||
null
|
||||
};
|
||||
|
||||
readonly string _dataFolder = Path.Combine(Consts.TEST_FILES_ROOT, "Media image formats", "HD-COPY");
|
||||
|
||||
[Test]
|
||||
public void Test()
|
||||
public void Info()
|
||||
{
|
||||
Environment.CurrentDirectory = Path.Combine(Consts.TEST_FILES_ROOT, "Media image formats", "GameJack 6");
|
||||
Environment.CurrentDirectory = _dataFolder;
|
||||
|
||||
for(int i = 0; i < _testFiles.Length; i++)
|
||||
{
|
||||
@@ -786,13 +788,13 @@ namespace Aaru.Tests.Images
|
||||
}
|
||||
}
|
||||
|
||||
// How many sectors to read at once
|
||||
const uint SECTORS_TO_READ = 256;
|
||||
|
||||
[Test]
|
||||
public void Hashes()
|
||||
{
|
||||
// How many sectors to read at once
|
||||
const uint sectorsToRead = 256;
|
||||
|
||||
Environment.CurrentDirectory = Path.Combine(Consts.TEST_FILES_ROOT, "Media image formats", "GameJack 6");
|
||||
Environment.CurrentDirectory = _dataFolder;
|
||||
|
||||
Assert.Multiple(() =>
|
||||
{
|
||||
@@ -823,14 +825,15 @@ namespace Aaru.Tests.Images
|
||||
{
|
||||
byte[] sector;
|
||||
|
||||
if(sectors - doneSectors >= sectorsToRead)
|
||||
if(sectors - doneSectors >= SECTORS_TO_READ)
|
||||
{
|
||||
sector =
|
||||
@long ? image.ReadSectorsLong(doneSectors, sectorsToRead,
|
||||
@long ? image.ReadSectorsLong(doneSectors, SECTORS_TO_READ,
|
||||
currentTrack.TrackSequence)
|
||||
: image.ReadSectors(doneSectors, sectorsToRead, currentTrack.TrackSequence);
|
||||
: image.ReadSectors(doneSectors, SECTORS_TO_READ,
|
||||
currentTrack.TrackSequence);
|
||||
|
||||
doneSectors += sectorsToRead;
|
||||
doneSectors += SECTORS_TO_READ;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -865,12 +868,12 @@ namespace Aaru.Tests.Images
|
||||
{
|
||||
byte[] sector;
|
||||
|
||||
if(sectors - doneSectors >= sectorsToRead)
|
||||
if(sectors - doneSectors >= SECTORS_TO_READ)
|
||||
{
|
||||
sector = image.ReadSectorsTag(doneSectors, sectorsToRead, currentTrack.TrackSequence,
|
||||
sector = image.ReadSectorsTag(doneSectors, SECTORS_TO_READ, currentTrack.TrackSequence,
|
||||
SectorTagType.CdSectorSubchannel);
|
||||
|
||||
doneSectors += sectorsToRead;
|
||||
doneSectors += SECTORS_TO_READ;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -1178,7 +1178,7 @@ namespace Aaru.Tests.Images
|
||||
}
|
||||
|
||||
// How many sectors to read at once
|
||||
const uint _sectorsToRead = 256;
|
||||
const uint SECTORS_TO_READ = 256;
|
||||
|
||||
[Test]
|
||||
public void Hashes()
|
||||
@@ -1207,10 +1207,10 @@ namespace Aaru.Tests.Images
|
||||
{
|
||||
byte[] sector;
|
||||
|
||||
if(image.Info.Sectors - doneSectors >= _sectorsToRead)
|
||||
if(image.Info.Sectors - doneSectors >= SECTORS_TO_READ)
|
||||
{
|
||||
sector = image.ReadSectors(doneSectors, _sectorsToRead);
|
||||
doneSectors += _sectorsToRead;
|
||||
sector = image.ReadSectors(doneSectors, SECTORS_TO_READ);
|
||||
doneSectors += SECTORS_TO_READ;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -410,7 +410,7 @@ namespace Aaru.Tests.Images.HxC
|
||||
}
|
||||
|
||||
// How many sectors to read at once
|
||||
const uint _sectorsToRead = 256;
|
||||
const uint SECTORS_TO_READ = 256;
|
||||
|
||||
[Test]
|
||||
public void Hashes()
|
||||
@@ -439,10 +439,10 @@ namespace Aaru.Tests.Images.HxC
|
||||
{
|
||||
byte[] sector;
|
||||
|
||||
if(image.Info.Sectors - doneSectors >= _sectorsToRead)
|
||||
if(image.Info.Sectors - doneSectors >= SECTORS_TO_READ)
|
||||
{
|
||||
sector = image.ReadSectors(doneSectors, _sectorsToRead);
|
||||
doneSectors += _sectorsToRead;
|
||||
sector = image.ReadSectors(doneSectors, SECTORS_TO_READ);
|
||||
doneSectors += SECTORS_TO_READ;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -422,7 +422,7 @@ namespace Aaru.Tests.Images.HxC
|
||||
}
|
||||
|
||||
// How many sectors to read at once
|
||||
const uint _sectorsToRead = 256;
|
||||
const uint SECTORS_TO_READ = 256;
|
||||
|
||||
[Test]
|
||||
public void Hashes()
|
||||
@@ -451,10 +451,10 @@ namespace Aaru.Tests.Images.HxC
|
||||
{
|
||||
byte[] sector;
|
||||
|
||||
if(image.Info.Sectors - doneSectors >= _sectorsToRead)
|
||||
if(image.Info.Sectors - doneSectors >= SECTORS_TO_READ)
|
||||
{
|
||||
sector = image.ReadSectors(doneSectors, _sectorsToRead);
|
||||
doneSectors += _sectorsToRead;
|
||||
sector = image.ReadSectors(doneSectors, SECTORS_TO_READ);
|
||||
doneSectors += SECTORS_TO_READ;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -190,7 +190,7 @@ namespace Aaru.Tests.Images
|
||||
}
|
||||
|
||||
// How many sectors to read at once
|
||||
const uint _sectorsToRead = 256;
|
||||
const uint SECTORS_TO_READ = 256;
|
||||
|
||||
[Test]
|
||||
public void Hashes()
|
||||
@@ -219,10 +219,10 @@ namespace Aaru.Tests.Images
|
||||
{
|
||||
byte[] sector;
|
||||
|
||||
if(image.Info.Sectors - doneSectors >= _sectorsToRead)
|
||||
if(image.Info.Sectors - doneSectors >= SECTORS_TO_READ)
|
||||
{
|
||||
sector = image.ReadSectors(doneSectors, _sectorsToRead);
|
||||
doneSectors += _sectorsToRead;
|
||||
sector = image.ReadSectors(doneSectors, SECTORS_TO_READ);
|
||||
doneSectors += SECTORS_TO_READ;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -3192,7 +3192,7 @@ namespace Aaru.Tests.Images
|
||||
}
|
||||
|
||||
// How many sectors to read at once
|
||||
const uint _sectorsToRead = 256;
|
||||
const uint SECTORS_TO_READ = 256;
|
||||
|
||||
[Test]
|
||||
public void Hashes()
|
||||
@@ -3221,10 +3221,10 @@ namespace Aaru.Tests.Images
|
||||
{
|
||||
byte[] sector;
|
||||
|
||||
if(image.Info.Sectors - doneSectors >= _sectorsToRead)
|
||||
if(image.Info.Sectors - doneSectors >= SECTORS_TO_READ)
|
||||
{
|
||||
sector = image.ReadSectors(doneSectors, _sectorsToRead);
|
||||
doneSectors += _sectorsToRead;
|
||||
sector = image.ReadSectors(doneSectors, SECTORS_TO_READ);
|
||||
doneSectors += SECTORS_TO_READ;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -32,11 +32,11 @@ using System.Linq;
|
||||
using Aaru.Checksums;
|
||||
using Aaru.CommonTypes;
|
||||
using Aaru.CommonTypes.Enums;
|
||||
using Aaru.CommonTypes.Interfaces;
|
||||
using Aaru.CommonTypes.Structs;
|
||||
using Aaru.DiscImages;
|
||||
using Aaru.Filters;
|
||||
using FluentAssertions;
|
||||
using FluentAssertions.Execution;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace Aaru.Tests.Images.IsoBuster
|
||||
@@ -864,121 +864,136 @@ namespace Aaru.Tests.Images.IsoBuster
|
||||
}
|
||||
};
|
||||
|
||||
readonly string _dataFolder =
|
||||
Path.Combine(Consts.TEST_FILES_ROOT, "Media image formats", "IsoBuster", "Cuesheet");
|
||||
|
||||
[Test]
|
||||
public void Test()
|
||||
public void Info()
|
||||
{
|
||||
// How many sectors to read at once
|
||||
const uint sectorsToRead = 256;
|
||||
|
||||
Environment.CurrentDirectory =
|
||||
Path.Combine(Consts.TEST_FILES_ROOT, "Media image formats", "IsoBuster", "Cuesheet");
|
||||
|
||||
IFilter[] filters = new IFilter[_testFiles.Length];
|
||||
Environment.CurrentDirectory = _dataFolder;
|
||||
|
||||
for(int i = 0; i < _testFiles.Length; i++)
|
||||
{
|
||||
filters[i] = new ZZZNoFilter();
|
||||
filters[i].Open(_testFiles[i]);
|
||||
}
|
||||
var filter = new ZZZNoFilter();
|
||||
filter.Open(_testFiles[i]);
|
||||
|
||||
IOpticalMediaImage[] images = new IOpticalMediaImage[_testFiles.Length];
|
||||
var image = new CdrWin();
|
||||
bool opened = image.Open(filter);
|
||||
|
||||
for(int i = 0; i < _testFiles.Length; i++)
|
||||
{
|
||||
images[i] = new CdrWin();
|
||||
Assert.AreEqual(true, images[i].Open(filters[i]), $"Open: {_testFiles[i]}");
|
||||
}
|
||||
Assert.AreEqual(true, opened, $"Open: {_testFiles[i]}");
|
||||
|
||||
for(int i = 0; i < _testFiles.Length; i++)
|
||||
Assert.AreEqual(_sectors[i], images[i].Info.Sectors, $"Sectors: {_testFiles[i]}");
|
||||
|
||||
for(int i = 0; i < _testFiles.Length; i++)
|
||||
Assert.AreEqual(_mediaTypes[i], images[i].Info.MediaType, $"Media type: {_testFiles[i]}");
|
||||
|
||||
for(int i = 0; i < _testFiles.Length; i++)
|
||||
Assert.AreEqual(_tracks[i], images[i].Tracks.Count, $"Tracks: {_testFiles[i]}");
|
||||
|
||||
for(int i = 0; i < _testFiles.Length; i++)
|
||||
images[i].Tracks.Select(t => t.TrackSession).Should().
|
||||
BeEquivalentTo(_trackSessions[i], $"Track session: {_testFiles[i]}");
|
||||
|
||||
for(int i = 0; i < _testFiles.Length; i++)
|
||||
images[i].Tracks.Select(t => t.TrackStartSector).Should().
|
||||
BeEquivalentTo(_trackStarts[i], $"Track start: {_testFiles[i]}");
|
||||
|
||||
for(int i = 0; i < _testFiles.Length; i++)
|
||||
images[i].Tracks.Select(t => t.TrackEndSector).Should().
|
||||
BeEquivalentTo(_trackEnds[i], $"Track end: {_testFiles[i]}");
|
||||
|
||||
for(int i = 0; i < _testFiles.Length; i++)
|
||||
images[i].Tracks.Select(t => t.TrackPregap).Should().
|
||||
BeEquivalentTo(_trackPregaps[i], $"Track pregap: {_testFiles[i]}");
|
||||
|
||||
for(int i = 0; i < _testFiles.Length; i++)
|
||||
{
|
||||
int trackNo = 0;
|
||||
|
||||
foreach(Track currentTrack in images[i].Tracks)
|
||||
using(new AssertionScope())
|
||||
{
|
||||
if(images[i].Info.ReadableSectorTags.Contains(SectorTagType.CdTrackFlags))
|
||||
Assert.AreEqual(_trackFlags[i][trackNo],
|
||||
images[i].ReadSectorTag(currentTrack.TrackSequence, SectorTagType.CdTrackFlags)
|
||||
[0], $"Track flags: {_testFiles[i]}, track {currentTrack.TrackSequence}");
|
||||
Assert.Multiple(() =>
|
||||
{
|
||||
Assert.AreEqual(_sectors[i], image.Info.Sectors, $"Sectors: {_testFiles[i]}");
|
||||
Assert.AreEqual(_mediaTypes[i], image.Info.MediaType, $"Media type: {_testFiles[i]}");
|
||||
|
||||
trackNo++;
|
||||
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]}");
|
||||
|
||||
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];
|
||||
|
||||
foreach(Track currentTrack in image.Tracks)
|
||||
{
|
||||
if(image.Info.ReadableSectorTags.Contains(SectorTagType.CdTrackFlags))
|
||||
flags[trackNo] = image.ReadSectorTag(currentTrack.TrackSequence,
|
||||
SectorTagType.CdTrackFlags)[0];
|
||||
|
||||
trackNo++;
|
||||
}
|
||||
|
||||
flags.Should().BeEquivalentTo(_trackFlags[i], $"Track flags: {_testFiles[i]}");
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach(bool @long in new[]
|
||||
// How many sectors to read at once
|
||||
const uint SECTORS_TO_READ = 256;
|
||||
|
||||
[Test]
|
||||
public void Hashes()
|
||||
{
|
||||
Environment.CurrentDirectory = _dataFolder;
|
||||
|
||||
Assert.Multiple(() =>
|
||||
{
|
||||
false, true
|
||||
})
|
||||
for(int i = 0; i < _testFiles.Length; i++)
|
||||
{
|
||||
var ctx = new Md5Context();
|
||||
var filter = new ZZZNoFilter();
|
||||
filter.Open(_testFiles[i]);
|
||||
|
||||
foreach(Track currentTrack in images[i].Tracks)
|
||||
var image = new CdrWin();
|
||||
bool opened = image.Open(filter);
|
||||
|
||||
Assert.AreEqual(true, opened, $"Open: {_testFiles[i]}");
|
||||
Md5Context ctx;
|
||||
|
||||
foreach(bool @long in new[]
|
||||
{
|
||||
ulong sectors = currentTrack.TrackEndSector - currentTrack.TrackStartSector + 1;
|
||||
ulong doneSectors = 0;
|
||||
false, true
|
||||
})
|
||||
{
|
||||
ctx = new Md5Context();
|
||||
|
||||
while(doneSectors < sectors)
|
||||
foreach(Track currentTrack in image.Tracks)
|
||||
{
|
||||
byte[] sector;
|
||||
ulong sectors = currentTrack.TrackEndSector - currentTrack.TrackStartSector + 1;
|
||||
ulong doneSectors = 0;
|
||||
|
||||
if(sectors - doneSectors >= sectorsToRead)
|
||||
while(doneSectors < sectors)
|
||||
{
|
||||
sector = @long ? images[i].
|
||||
ReadSectorsLong(doneSectors, sectorsToRead, currentTrack.TrackSequence)
|
||||
: images[i].
|
||||
ReadSectors(doneSectors, sectorsToRead, currentTrack.TrackSequence);
|
||||
byte[] sector;
|
||||
|
||||
doneSectors += sectorsToRead;
|
||||
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);
|
||||
}
|
||||
else
|
||||
{
|
||||
sector = @long ? images[i].ReadSectorsLong(doneSectors, (uint)(sectors - doneSectors),
|
||||
currentTrack.TrackSequence)
|
||||
: images[i].ReadSectors(doneSectors, (uint)(sectors - doneSectors),
|
||||
currentTrack.TrackSequence);
|
||||
|
||||
doneSectors += sectors - doneSectors;
|
||||
}
|
||||
|
||||
ctx.Update(sector);
|
||||
}
|
||||
|
||||
Assert.AreEqual(@long ? _longMd5S[i] : _md5S[i], ctx.End(),
|
||||
$"{(@long ? "Long hash" : "Hash")}: {_testFiles[i]}");
|
||||
}
|
||||
|
||||
Assert.AreEqual(@long ? _longMd5S[i] : _md5S[i], ctx.End(),
|
||||
$"{(@long ? "Long hash" : "Hash")}: {_testFiles[i]}");
|
||||
}
|
||||
if(!image.Info.ReadableSectorTags.Contains(SectorTagType.CdSectorSubchannel))
|
||||
continue;
|
||||
|
||||
for(int i = 0; i < _testFiles.Length; i++)
|
||||
if(images[i].Info.ReadableSectorTags.Contains(SectorTagType.CdSectorSubchannel))
|
||||
{
|
||||
var ctx = new Md5Context();
|
||||
ctx = new Md5Context();
|
||||
|
||||
foreach(Track currentTrack in images[i].Tracks)
|
||||
foreach(Track currentTrack in image.Tracks)
|
||||
{
|
||||
ulong sectors = currentTrack.TrackEndSector - currentTrack.TrackStartSector + 1;
|
||||
ulong doneSectors = 0;
|
||||
@@ -987,19 +1002,18 @@ namespace Aaru.Tests.Images.IsoBuster
|
||||
{
|
||||
byte[] sector;
|
||||
|
||||
if(sectors - doneSectors >= sectorsToRead)
|
||||
if(sectors - doneSectors >= SECTORS_TO_READ)
|
||||
{
|
||||
sector = images[i].ReadSectorsTag(doneSectors, sectorsToRead,
|
||||
currentTrack.TrackSequence,
|
||||
SectorTagType.CdSectorSubchannel);
|
||||
sector = image.ReadSectorsTag(doneSectors, SECTORS_TO_READ, currentTrack.TrackSequence,
|
||||
SectorTagType.CdSectorSubchannel);
|
||||
|
||||
doneSectors += sectorsToRead;
|
||||
doneSectors += SECTORS_TO_READ;
|
||||
}
|
||||
else
|
||||
{
|
||||
sector = images[i].ReadSectorsTag(doneSectors, (uint)(sectors - doneSectors),
|
||||
currentTrack.TrackSequence,
|
||||
SectorTagType.CdSectorSubchannel);
|
||||
sector = image.ReadSectorsTag(doneSectors, (uint)(sectors - doneSectors),
|
||||
currentTrack.TrackSequence,
|
||||
SectorTagType.CdSectorSubchannel);
|
||||
|
||||
doneSectors += sectors - doneSectors;
|
||||
}
|
||||
@@ -1010,6 +1024,7 @@ namespace Aaru.Tests.Images.IsoBuster
|
||||
|
||||
Assert.AreEqual(_subchannelMd5S[i], ctx.End(), $"Subchannel hash: {_testFiles[i]}");
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -166,7 +166,7 @@ namespace Aaru.Tests.Images.KryoFlux
|
||||
}
|
||||
|
||||
// How many sectors to read at once
|
||||
const uint _sectorsToRead = 256;
|
||||
const uint SECTORS_TO_READ = 256;
|
||||
|
||||
[Test]
|
||||
public void Hashes()
|
||||
@@ -195,10 +195,10 @@ namespace Aaru.Tests.Images.KryoFlux
|
||||
{
|
||||
byte[] sector;
|
||||
|
||||
if(image.Info.Sectors - doneSectors >= _sectorsToRead)
|
||||
if(image.Info.Sectors - doneSectors >= SECTORS_TO_READ)
|
||||
{
|
||||
sector = image.ReadSectors(doneSectors, _sectorsToRead);
|
||||
doneSectors += _sectorsToRead;
|
||||
sector = image.ReadSectors(doneSectors, SECTORS_TO_READ);
|
||||
doneSectors += SECTORS_TO_READ;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -167,7 +167,7 @@ namespace Aaru.Tests.Images.Lisa
|
||||
}
|
||||
|
||||
// How many sectors to read at once
|
||||
const uint _sectorsToRead = 256;
|
||||
const uint SECTORS_TO_READ = 256;
|
||||
|
||||
[Test]
|
||||
public void Hashes()
|
||||
@@ -196,10 +196,10 @@ namespace Aaru.Tests.Images.Lisa
|
||||
{
|
||||
byte[] sector;
|
||||
|
||||
if(image.Info.Sectors - doneSectors >= _sectorsToRead)
|
||||
if(image.Info.Sectors - doneSectors >= SECTORS_TO_READ)
|
||||
{
|
||||
sector = image.ReadSectors(doneSectors, _sectorsToRead);
|
||||
doneSectors += _sectorsToRead;
|
||||
sector = image.ReadSectors(doneSectors, SECTORS_TO_READ);
|
||||
doneSectors += SECTORS_TO_READ;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -101,7 +101,7 @@ namespace Aaru.Tests.Images.MAME
|
||||
}
|
||||
|
||||
// How many sectors to read at once
|
||||
const uint _sectorsToRead = 256;
|
||||
const uint SECTORS_TO_READ = 256;
|
||||
|
||||
[Test]
|
||||
public void Hashes()
|
||||
@@ -130,10 +130,10 @@ namespace Aaru.Tests.Images.MAME
|
||||
{
|
||||
byte[] sector;
|
||||
|
||||
if(image.Info.Sectors - doneSectors >= _sectorsToRead)
|
||||
if(image.Info.Sectors - doneSectors >= SECTORS_TO_READ)
|
||||
{
|
||||
sector = image.ReadSectors(doneSectors, _sectorsToRead);
|
||||
doneSectors += _sectorsToRead;
|
||||
sector = image.ReadSectors(doneSectors, SECTORS_TO_READ);
|
||||
doneSectors += SECTORS_TO_READ;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -32,11 +32,11 @@ using System.Linq;
|
||||
using Aaru.Checksums;
|
||||
using Aaru.CommonTypes;
|
||||
using Aaru.CommonTypes.Enums;
|
||||
using Aaru.CommonTypes.Interfaces;
|
||||
using Aaru.CommonTypes.Structs;
|
||||
using Aaru.DiscImages;
|
||||
using Aaru.Filters;
|
||||
using FluentAssertions;
|
||||
using FluentAssertions.Execution;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace Aaru.Tests.Images.MagicISO
|
||||
@@ -623,121 +623,136 @@ namespace Aaru.Tests.Images.MagicISO
|
||||
}
|
||||
};
|
||||
|
||||
readonly string _dataFolder =
|
||||
Path.Combine(Consts.TEST_FILES_ROOT, "Media image formats", "MagicISO", "Cuesheet");
|
||||
|
||||
[Test]
|
||||
public void Test()
|
||||
public void Info()
|
||||
{
|
||||
// How many sectors to read at once
|
||||
const uint sectorsToRead = 256;
|
||||
|
||||
Environment.CurrentDirectory =
|
||||
Path.Combine(Consts.TEST_FILES_ROOT, "Media image formats", "MagicISO", "Cuesheet");
|
||||
|
||||
IFilter[] filters = new IFilter[_testFiles.Length];
|
||||
Environment.CurrentDirectory = _dataFolder;
|
||||
|
||||
for(int i = 0; i < _testFiles.Length; i++)
|
||||
{
|
||||
filters[i] = new ZZZNoFilter();
|
||||
filters[i].Open(_testFiles[i]);
|
||||
}
|
||||
var filter = new ZZZNoFilter();
|
||||
filter.Open(_testFiles[i]);
|
||||
|
||||
IOpticalMediaImage[] images = new IOpticalMediaImage[_testFiles.Length];
|
||||
var image = new CdrWin();
|
||||
bool opened = image.Open(filter);
|
||||
|
||||
for(int i = 0; i < _testFiles.Length; i++)
|
||||
{
|
||||
images[i] = new CdrWin();
|
||||
Assert.AreEqual(true, images[i].Open(filters[i]), $"Open: {_testFiles[i]}");
|
||||
}
|
||||
Assert.AreEqual(true, opened, $"Open: {_testFiles[i]}");
|
||||
|
||||
for(int i = 0; i < _testFiles.Length; i++)
|
||||
Assert.AreEqual(_sectors[i], images[i].Info.Sectors, $"Sectors: {_testFiles[i]}");
|
||||
|
||||
for(int i = 0; i < _testFiles.Length; i++)
|
||||
Assert.AreEqual(_mediaTypes[i], images[i].Info.MediaType, $"Media type: {_testFiles[i]}");
|
||||
|
||||
for(int i = 0; i < _testFiles.Length; i++)
|
||||
Assert.AreEqual(_tracks[i], images[i].Tracks.Count, $"Tracks: {_testFiles[i]}");
|
||||
|
||||
for(int i = 0; i < _testFiles.Length; i++)
|
||||
images[i].Tracks.Select(t => t.TrackSession).Should().
|
||||
BeEquivalentTo(_trackSessions[i], $"Track session: {_testFiles[i]}");
|
||||
|
||||
for(int i = 0; i < _testFiles.Length; i++)
|
||||
images[i].Tracks.Select(t => t.TrackStartSector).Should().
|
||||
BeEquivalentTo(_trackStarts[i], $"Track start: {_testFiles[i]}");
|
||||
|
||||
for(int i = 0; i < _testFiles.Length; i++)
|
||||
images[i].Tracks.Select(t => t.TrackEndSector).Should().
|
||||
BeEquivalentTo(_trackEnds[i], $"Track end: {_testFiles[i]}");
|
||||
|
||||
for(int i = 0; i < _testFiles.Length; i++)
|
||||
images[i].Tracks.Select(t => t.TrackPregap).Should().
|
||||
BeEquivalentTo(_trackPregaps[i], $"Track pregap: {_testFiles[i]}");
|
||||
|
||||
for(int i = 0; i < _testFiles.Length; i++)
|
||||
{
|
||||
int trackNo = 0;
|
||||
|
||||
foreach(Track currentTrack in images[i].Tracks)
|
||||
using(new AssertionScope())
|
||||
{
|
||||
if(images[i].Info.ReadableSectorTags.Contains(SectorTagType.CdTrackFlags))
|
||||
Assert.AreEqual(_trackFlags[i][trackNo],
|
||||
images[i].ReadSectorTag(currentTrack.TrackSequence, SectorTagType.CdTrackFlags)
|
||||
[0], $"Track flags: {_testFiles[i]}, track {currentTrack.TrackSequence}");
|
||||
Assert.Multiple(() =>
|
||||
{
|
||||
Assert.AreEqual(_sectors[i], image.Info.Sectors, $"Sectors: {_testFiles[i]}");
|
||||
Assert.AreEqual(_mediaTypes[i], image.Info.MediaType, $"Media type: {_testFiles[i]}");
|
||||
|
||||
trackNo++;
|
||||
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]}");
|
||||
|
||||
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];
|
||||
|
||||
foreach(Track currentTrack in image.Tracks)
|
||||
{
|
||||
if(image.Info.ReadableSectorTags.Contains(SectorTagType.CdTrackFlags))
|
||||
flags[trackNo] = image.ReadSectorTag(currentTrack.TrackSequence,
|
||||
SectorTagType.CdTrackFlags)[0];
|
||||
|
||||
trackNo++;
|
||||
}
|
||||
|
||||
flags.Should().BeEquivalentTo(_trackFlags[i], $"Track flags: {_testFiles[i]}");
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach(bool @long in new[]
|
||||
// How many sectors to read at once
|
||||
const uint SECTORS_TO_READ = 256;
|
||||
|
||||
[Test]
|
||||
public void Hashes()
|
||||
{
|
||||
Environment.CurrentDirectory = _dataFolder;
|
||||
|
||||
Assert.Multiple(() =>
|
||||
{
|
||||
false, true
|
||||
})
|
||||
for(int i = 0; i < _testFiles.Length; i++)
|
||||
{
|
||||
var ctx = new Md5Context();
|
||||
var filter = new ZZZNoFilter();
|
||||
filter.Open(_testFiles[i]);
|
||||
|
||||
foreach(Track currentTrack in images[i].Tracks)
|
||||
var image = new CdrWin();
|
||||
bool opened = image.Open(filter);
|
||||
|
||||
Assert.AreEqual(true, opened, $"Open: {_testFiles[i]}");
|
||||
Md5Context ctx;
|
||||
|
||||
foreach(bool @long in new[]
|
||||
{
|
||||
ulong sectors = currentTrack.TrackEndSector - currentTrack.TrackStartSector + 1;
|
||||
ulong doneSectors = 0;
|
||||
false, true
|
||||
})
|
||||
{
|
||||
ctx = new Md5Context();
|
||||
|
||||
while(doneSectors < sectors)
|
||||
foreach(Track currentTrack in image.Tracks)
|
||||
{
|
||||
byte[] sector;
|
||||
ulong sectors = currentTrack.TrackEndSector - currentTrack.TrackStartSector + 1;
|
||||
ulong doneSectors = 0;
|
||||
|
||||
if(sectors - doneSectors >= sectorsToRead)
|
||||
while(doneSectors < sectors)
|
||||
{
|
||||
sector = @long ? images[i].
|
||||
ReadSectorsLong(doneSectors, sectorsToRead, currentTrack.TrackSequence)
|
||||
: images[i].
|
||||
ReadSectors(doneSectors, sectorsToRead, currentTrack.TrackSequence);
|
||||
byte[] sector;
|
||||
|
||||
doneSectors += sectorsToRead;
|
||||
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);
|
||||
}
|
||||
else
|
||||
{
|
||||
sector = @long ? images[i].ReadSectorsLong(doneSectors, (uint)(sectors - doneSectors),
|
||||
currentTrack.TrackSequence)
|
||||
: images[i].ReadSectors(doneSectors, (uint)(sectors - doneSectors),
|
||||
currentTrack.TrackSequence);
|
||||
|
||||
doneSectors += sectors - doneSectors;
|
||||
}
|
||||
|
||||
ctx.Update(sector);
|
||||
}
|
||||
|
||||
Assert.AreEqual(@long ? _longMd5S[i] : _md5S[i], ctx.End(),
|
||||
$"{(@long ? "Long hash" : "Hash")}: {_testFiles[i]}");
|
||||
}
|
||||
|
||||
Assert.AreEqual(@long ? _longMd5S[i] : _md5S[i], ctx.End(),
|
||||
$"{(@long ? "Long hash" : "Hash")}: {_testFiles[i]}");
|
||||
}
|
||||
if(!image.Info.ReadableSectorTags.Contains(SectorTagType.CdSectorSubchannel))
|
||||
continue;
|
||||
|
||||
for(int i = 0; i < _testFiles.Length; i++)
|
||||
if(images[i].Info.ReadableSectorTags.Contains(SectorTagType.CdSectorSubchannel))
|
||||
{
|
||||
var ctx = new Md5Context();
|
||||
ctx = new Md5Context();
|
||||
|
||||
foreach(Track currentTrack in images[i].Tracks)
|
||||
foreach(Track currentTrack in image.Tracks)
|
||||
{
|
||||
ulong sectors = currentTrack.TrackEndSector - currentTrack.TrackStartSector + 1;
|
||||
ulong doneSectors = 0;
|
||||
@@ -746,19 +761,18 @@ namespace Aaru.Tests.Images.MagicISO
|
||||
{
|
||||
byte[] sector;
|
||||
|
||||
if(sectors - doneSectors >= sectorsToRead)
|
||||
if(sectors - doneSectors >= SECTORS_TO_READ)
|
||||
{
|
||||
sector = images[i].ReadSectorsTag(doneSectors, sectorsToRead,
|
||||
currentTrack.TrackSequence,
|
||||
SectorTagType.CdSectorSubchannel);
|
||||
sector = image.ReadSectorsTag(doneSectors, SECTORS_TO_READ, currentTrack.TrackSequence,
|
||||
SectorTagType.CdSectorSubchannel);
|
||||
|
||||
doneSectors += sectorsToRead;
|
||||
doneSectors += SECTORS_TO_READ;
|
||||
}
|
||||
else
|
||||
{
|
||||
sector = images[i].ReadSectorsTag(doneSectors, (uint)(sectors - doneSectors),
|
||||
currentTrack.TrackSequence,
|
||||
SectorTagType.CdSectorSubchannel);
|
||||
sector = image.ReadSectorsTag(doneSectors, (uint)(sectors - doneSectors),
|
||||
currentTrack.TrackSequence,
|
||||
SectorTagType.CdSectorSubchannel);
|
||||
|
||||
doneSectors += sectors - doneSectors;
|
||||
}
|
||||
@@ -769,6 +783,7 @@ namespace Aaru.Tests.Images.MagicISO
|
||||
|
||||
Assert.AreEqual(_subchannelMd5S[i], ctx.End(), $"Subchannel hash: {_testFiles[i]}");
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -708,11 +708,12 @@ namespace Aaru.Tests.Images.MagicISO
|
||||
null
|
||||
};
|
||||
|
||||
readonly string _dataFolder = Path.Combine(Consts.TEST_FILES_ROOT, "Media image formats", "MagicISO", "Nero");
|
||||
|
||||
[Test]
|
||||
public void Test()
|
||||
public void Info()
|
||||
{
|
||||
Environment.CurrentDirectory =
|
||||
Path.Combine(Consts.TEST_FILES_ROOT, "Media image formats", "MagicISO", "Nero");
|
||||
Environment.CurrentDirectory = _dataFolder;
|
||||
|
||||
for(int i = 0; i < _testFiles.Length; i++)
|
||||
{
|
||||
@@ -764,14 +765,13 @@ namespace Aaru.Tests.Images.MagicISO
|
||||
}
|
||||
}
|
||||
|
||||
// How many sectors to read at once
|
||||
const uint SECTORS_TO_READ = 256;
|
||||
|
||||
[Test]
|
||||
public void Hashes()
|
||||
{
|
||||
// How many sectors to read at once
|
||||
const uint sectorsToRead = 256;
|
||||
|
||||
Environment.CurrentDirectory =
|
||||
Path.Combine(Consts.TEST_FILES_ROOT, "Media image formats", "MagicISO", "Nero");
|
||||
Environment.CurrentDirectory = _dataFolder;
|
||||
|
||||
Assert.Multiple(() =>
|
||||
{
|
||||
@@ -802,14 +802,15 @@ namespace Aaru.Tests.Images.MagicISO
|
||||
{
|
||||
byte[] sector;
|
||||
|
||||
if(sectors - doneSectors >= sectorsToRead)
|
||||
if(sectors - doneSectors >= SECTORS_TO_READ)
|
||||
{
|
||||
sector =
|
||||
@long ? image.ReadSectorsLong(doneSectors, sectorsToRead,
|
||||
@long ? image.ReadSectorsLong(doneSectors, SECTORS_TO_READ,
|
||||
currentTrack.TrackSequence)
|
||||
: image.ReadSectors(doneSectors, sectorsToRead, currentTrack.TrackSequence);
|
||||
: image.ReadSectors(doneSectors, SECTORS_TO_READ,
|
||||
currentTrack.TrackSequence);
|
||||
|
||||
doneSectors += sectorsToRead;
|
||||
doneSectors += SECTORS_TO_READ;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -844,12 +845,12 @@ namespace Aaru.Tests.Images.MagicISO
|
||||
{
|
||||
byte[] sector;
|
||||
|
||||
if(sectors - doneSectors >= sectorsToRead)
|
||||
if(sectors - doneSectors >= SECTORS_TO_READ)
|
||||
{
|
||||
sector = image.ReadSectorsTag(doneSectors, sectorsToRead, currentTrack.TrackSequence,
|
||||
sector = image.ReadSectorsTag(doneSectors, SECTORS_TO_READ, currentTrack.TrackSequence,
|
||||
SectorTagType.CdSectorSubchannel);
|
||||
|
||||
doneSectors += sectorsToRead;
|
||||
doneSectors += SECTORS_TO_READ;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -262,7 +262,7 @@ namespace Aaru.Tests.Images
|
||||
}
|
||||
|
||||
// How many sectors to read at once
|
||||
const uint _sectorsToRead = 256;
|
||||
const uint SECTORS_TO_READ = 256;
|
||||
|
||||
[Test]
|
||||
public void Hashes()
|
||||
@@ -291,10 +291,10 @@ namespace Aaru.Tests.Images
|
||||
{
|
||||
byte[] sector;
|
||||
|
||||
if(image.Info.Sectors - doneSectors >= _sectorsToRead)
|
||||
if(image.Info.Sectors - doneSectors >= SECTORS_TO_READ)
|
||||
{
|
||||
sector = image.ReadSectors(doneSectors, _sectorsToRead);
|
||||
doneSectors += _sectorsToRead;
|
||||
sector = image.ReadSectors(doneSectors, SECTORS_TO_READ);
|
||||
doneSectors += SECTORS_TO_READ;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -178,7 +178,7 @@ namespace Aaru.Tests.Images
|
||||
}
|
||||
|
||||
// How many sectors to read at once
|
||||
const uint _sectorsToRead = 256;
|
||||
const uint SECTORS_TO_READ = 256;
|
||||
|
||||
[Test]
|
||||
public void Hashes()
|
||||
@@ -207,10 +207,10 @@ namespace Aaru.Tests.Images
|
||||
{
|
||||
byte[] sector;
|
||||
|
||||
if(image.Info.Sectors - doneSectors >= _sectorsToRead)
|
||||
if(image.Info.Sectors - doneSectors >= SECTORS_TO_READ)
|
||||
{
|
||||
sector = image.ReadSectors(doneSectors, _sectorsToRead);
|
||||
doneSectors += _sectorsToRead;
|
||||
sector = image.ReadSectors(doneSectors, SECTORS_TO_READ);
|
||||
doneSectors += SECTORS_TO_READ;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -32,10 +32,10 @@ using System.Linq;
|
||||
using Aaru.Checksums;
|
||||
using Aaru.CommonTypes;
|
||||
using Aaru.CommonTypes.Enums;
|
||||
using Aaru.CommonTypes.Interfaces;
|
||||
using Aaru.CommonTypes.Structs;
|
||||
using Aaru.Filters;
|
||||
using FluentAssertions;
|
||||
using FluentAssertions.Execution;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace Aaru.Tests.Images.Nero
|
||||
@@ -5071,121 +5071,136 @@ namespace Aaru.Tests.Images.Nero
|
||||
}
|
||||
};
|
||||
|
||||
readonly string _dataFolder =
|
||||
Path.Combine(Consts.TEST_FILES_ROOT, "Media image formats", "Nero Burning ROM", "V2");
|
||||
|
||||
[Test]
|
||||
public void Test()
|
||||
public void Info()
|
||||
{
|
||||
// How many sectors to read at once
|
||||
const uint sectorsToRead = 256;
|
||||
|
||||
Environment.CurrentDirectory =
|
||||
Path.Combine(Consts.TEST_FILES_ROOT, "Media image formats", "Nero Burning ROM", "V2");
|
||||
|
||||
IFilter[] filters = new IFilter[_testFiles.Length];
|
||||
Environment.CurrentDirectory = _dataFolder;
|
||||
|
||||
for(int i = 0; i < _testFiles.Length; i++)
|
||||
{
|
||||
filters[i] = new ZZZNoFilter();
|
||||
filters[i].Open(_testFiles[i]);
|
||||
}
|
||||
var filter = new ZZZNoFilter();
|
||||
filter.Open(_testFiles[i]);
|
||||
|
||||
IOpticalMediaImage[] images = new IOpticalMediaImage[_testFiles.Length];
|
||||
var image = new DiscImages.Nero();
|
||||
bool opened = image.Open(filter);
|
||||
|
||||
for(int i = 0; i < _testFiles.Length; i++)
|
||||
{
|
||||
images[i] = new DiscImages.Nero();
|
||||
Assert.AreEqual(true, images[i].Open(filters[i]), $"Open: {_testFiles[i]}");
|
||||
}
|
||||
Assert.AreEqual(true, opened, $"Open: {_testFiles[i]}");
|
||||
|
||||
for(int i = 0; i < _testFiles.Length; i++)
|
||||
Assert.AreEqual(_sectors[i], images[i].Info.Sectors, $"Sectors: {_testFiles[i]}");
|
||||
|
||||
for(int i = 0; i < _testFiles.Length; i++)
|
||||
Assert.AreEqual(_mediaTypes[i], images[i].Info.MediaType, $"Media type: {_testFiles[i]}");
|
||||
|
||||
for(int i = 0; i < _testFiles.Length; i++)
|
||||
Assert.AreEqual(_tracks[i], images[i].Tracks.Count, $"Tracks: {_testFiles[i]}");
|
||||
|
||||
for(int i = 0; i < _testFiles.Length; i++)
|
||||
images[i].Tracks.Select(t => t.TrackSession).Should().
|
||||
BeEquivalentTo(_trackSessions[i], $"Track session: {_testFiles[i]}");
|
||||
|
||||
for(int i = 0; i < _testFiles.Length; i++)
|
||||
images[i].Tracks.Select(t => t.TrackStartSector).Should().
|
||||
BeEquivalentTo(_trackStarts[i], $"Track start: {_testFiles[i]}");
|
||||
|
||||
for(int i = 0; i < _testFiles.Length; i++)
|
||||
images[i].Tracks.Select(t => t.TrackEndSector).Should().
|
||||
BeEquivalentTo(_trackEnds[i], $"Track end: {_testFiles[i]}");
|
||||
|
||||
for(int i = 0; i < _testFiles.Length; i++)
|
||||
images[i].Tracks.Select(t => t.TrackPregap).Should().
|
||||
BeEquivalentTo(_trackPregaps[i], $"Track pregap: {_testFiles[i]}");
|
||||
|
||||
for(int i = 0; i < _testFiles.Length; i++)
|
||||
{
|
||||
int trackNo = 0;
|
||||
|
||||
foreach(Track currentTrack in images[i].Tracks)
|
||||
using(new AssertionScope())
|
||||
{
|
||||
if(images[i].Info.ReadableSectorTags.Contains(SectorTagType.CdTrackFlags))
|
||||
Assert.AreEqual(_trackFlags[i][trackNo],
|
||||
images[i].ReadSectorTag(currentTrack.TrackSequence, SectorTagType.CdTrackFlags)
|
||||
[0], $"Track flags: {_testFiles[i]}, track {currentTrack.TrackSequence}");
|
||||
Assert.Multiple(() =>
|
||||
{
|
||||
Assert.AreEqual(_sectors[i], image.Info.Sectors, $"Sectors: {_testFiles[i]}");
|
||||
Assert.AreEqual(_mediaTypes[i], image.Info.MediaType, $"Media type: {_testFiles[i]}");
|
||||
|
||||
trackNo++;
|
||||
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]}");
|
||||
|
||||
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];
|
||||
|
||||
foreach(Track currentTrack in image.Tracks)
|
||||
{
|
||||
if(image.Info.ReadableSectorTags.Contains(SectorTagType.CdTrackFlags))
|
||||
flags[trackNo] = image.ReadSectorTag(currentTrack.TrackSequence,
|
||||
SectorTagType.CdTrackFlags)[0];
|
||||
|
||||
trackNo++;
|
||||
}
|
||||
|
||||
flags.Should().BeEquivalentTo(_trackFlags[i], $"Track flags: {_testFiles[i]}");
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach(bool @long in new[]
|
||||
// How many sectors to read at once
|
||||
const uint SECTORS_TO_READ = 256;
|
||||
|
||||
[Test]
|
||||
public void Hashes()
|
||||
{
|
||||
Environment.CurrentDirectory = _dataFolder;
|
||||
|
||||
Assert.Multiple(() =>
|
||||
{
|
||||
false, true
|
||||
})
|
||||
for(int i = 0; i < _testFiles.Length; i++)
|
||||
{
|
||||
var ctx = new Md5Context();
|
||||
var filter = new ZZZNoFilter();
|
||||
filter.Open(_testFiles[i]);
|
||||
|
||||
foreach(Track currentTrack in images[i].Tracks)
|
||||
var image = new DiscImages.Nero();
|
||||
bool opened = image.Open(filter);
|
||||
|
||||
Assert.AreEqual(true, opened, $"Open: {_testFiles[i]}");
|
||||
Md5Context ctx;
|
||||
|
||||
foreach(bool @long in new[]
|
||||
{
|
||||
ulong sectors = currentTrack.TrackEndSector - currentTrack.TrackStartSector + 1;
|
||||
ulong doneSectors = 0;
|
||||
false, true
|
||||
})
|
||||
{
|
||||
ctx = new Md5Context();
|
||||
|
||||
while(doneSectors < sectors)
|
||||
foreach(Track currentTrack in image.Tracks)
|
||||
{
|
||||
byte[] sector;
|
||||
ulong sectors = currentTrack.TrackEndSector - currentTrack.TrackStartSector + 1;
|
||||
ulong doneSectors = 0;
|
||||
|
||||
if(sectors - doneSectors >= sectorsToRead)
|
||||
while(doneSectors < sectors)
|
||||
{
|
||||
sector = @long ? images[i].
|
||||
ReadSectorsLong(doneSectors, sectorsToRead, currentTrack.TrackSequence)
|
||||
: images[i].
|
||||
ReadSectors(doneSectors, sectorsToRead, currentTrack.TrackSequence);
|
||||
byte[] sector;
|
||||
|
||||
doneSectors += sectorsToRead;
|
||||
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);
|
||||
}
|
||||
else
|
||||
{
|
||||
sector = @long ? images[i].ReadSectorsLong(doneSectors, (uint)(sectors - doneSectors),
|
||||
currentTrack.TrackSequence)
|
||||
: images[i].ReadSectors(doneSectors, (uint)(sectors - doneSectors),
|
||||
currentTrack.TrackSequence);
|
||||
|
||||
doneSectors += sectors - doneSectors;
|
||||
}
|
||||
|
||||
ctx.Update(sector);
|
||||
}
|
||||
|
||||
Assert.AreEqual(@long ? _longMd5S[i] : _md5S[i], ctx.End(),
|
||||
$"{(@long ? "Long hash" : "Hash")}: {_testFiles[i]}");
|
||||
}
|
||||
|
||||
Assert.AreEqual(@long ? _longMd5S[i] : _md5S[i], ctx.End(),
|
||||
$"{(@long ? "Long hash" : "Hash")}: {_testFiles[i]}");
|
||||
}
|
||||
if(!image.Info.ReadableSectorTags.Contains(SectorTagType.CdSectorSubchannel))
|
||||
continue;
|
||||
|
||||
for(int i = 0; i < _testFiles.Length; i++)
|
||||
if(images[i].Info.ReadableSectorTags.Contains(SectorTagType.CdSectorSubchannel))
|
||||
{
|
||||
var ctx = new Md5Context();
|
||||
ctx = new Md5Context();
|
||||
|
||||
foreach(Track currentTrack in images[i].Tracks)
|
||||
foreach(Track currentTrack in image.Tracks)
|
||||
{
|
||||
ulong sectors = currentTrack.TrackEndSector - currentTrack.TrackStartSector + 1;
|
||||
ulong doneSectors = 0;
|
||||
@@ -5194,19 +5209,18 @@ namespace Aaru.Tests.Images.Nero
|
||||
{
|
||||
byte[] sector;
|
||||
|
||||
if(sectors - doneSectors >= sectorsToRead)
|
||||
if(sectors - doneSectors >= SECTORS_TO_READ)
|
||||
{
|
||||
sector = images[i].ReadSectorsTag(doneSectors, sectorsToRead,
|
||||
currentTrack.TrackSequence,
|
||||
SectorTagType.CdSectorSubchannel);
|
||||
sector = image.ReadSectorsTag(doneSectors, SECTORS_TO_READ, currentTrack.TrackSequence,
|
||||
SectorTagType.CdSectorSubchannel);
|
||||
|
||||
doneSectors += sectorsToRead;
|
||||
doneSectors += SECTORS_TO_READ;
|
||||
}
|
||||
else
|
||||
{
|
||||
sector = images[i].ReadSectorsTag(doneSectors, (uint)(sectors - doneSectors),
|
||||
currentTrack.TrackSequence,
|
||||
SectorTagType.CdSectorSubchannel);
|
||||
sector = image.ReadSectorsTag(doneSectors, (uint)(sectors - doneSectors),
|
||||
currentTrack.TrackSequence,
|
||||
SectorTagType.CdSectorSubchannel);
|
||||
|
||||
doneSectors += sectors - doneSectors;
|
||||
}
|
||||
@@ -5217,6 +5231,7 @@ namespace Aaru.Tests.Images.Nero
|
||||
|
||||
Assert.AreEqual(_subchannelMd5S[i], ctx.End(), $"Subchannel hash: {_testFiles[i]}");
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -33,7 +33,6 @@ using Aaru.Checksums;
|
||||
using Aaru.CommonTypes;
|
||||
using Aaru.CommonTypes.Enums;
|
||||
using Aaru.CommonTypes.Structs;
|
||||
using Aaru.DiscImages;
|
||||
using Aaru.Filters;
|
||||
using FluentAssertions;
|
||||
using FluentAssertions.Execution;
|
||||
@@ -477,18 +476,20 @@ namespace Aaru.Tests.Images.PowerISO
|
||||
}
|
||||
};
|
||||
|
||||
readonly string _dataFolder =
|
||||
Path.Combine(Consts.TEST_FILES_ROOT, "Media image formats", "PowerISO", "Cuesheet");
|
||||
|
||||
[Test]
|
||||
public void Test()
|
||||
public void Info()
|
||||
{
|
||||
Environment.CurrentDirectory =
|
||||
Path.Combine(Consts.TEST_FILES_ROOT, "Media image formats", "PowerISO", "Cuesheet");
|
||||
Environment.CurrentDirectory = _dataFolder;
|
||||
|
||||
for(int i = 0; i < _testFiles.Length; i++)
|
||||
{
|
||||
var filter = new ZZZNoFilter();
|
||||
filter.Open(_testFiles[i]);
|
||||
|
||||
var image = new CdrWin();
|
||||
var image = new DiscImages.DiscJuggler();
|
||||
bool opened = image.Open(filter);
|
||||
|
||||
Assert.AreEqual(true, opened, $"Open: {_testFiles[i]}");
|
||||
@@ -533,14 +534,13 @@ namespace Aaru.Tests.Images.PowerISO
|
||||
}
|
||||
}
|
||||
|
||||
// How many sectors to read at once
|
||||
const uint SECTORS_TO_READ = 256;
|
||||
|
||||
[Test]
|
||||
public void Hashes()
|
||||
{
|
||||
// How many sectors to read at once
|
||||
const uint sectorsToRead = 256;
|
||||
|
||||
Environment.CurrentDirectory =
|
||||
Path.Combine(Consts.TEST_FILES_ROOT, "Media image formats", "PowerISO", "Cuesheet");
|
||||
Environment.CurrentDirectory = _dataFolder;
|
||||
|
||||
Assert.Multiple(() =>
|
||||
{
|
||||
@@ -549,7 +549,7 @@ namespace Aaru.Tests.Images.PowerISO
|
||||
var filter = new ZZZNoFilter();
|
||||
filter.Open(_testFiles[i]);
|
||||
|
||||
var image = new CdrWin();
|
||||
var image = new DiscImages.DiscJuggler();
|
||||
bool opened = image.Open(filter);
|
||||
|
||||
Assert.AreEqual(true, opened, $"Open: {_testFiles[i]}");
|
||||
@@ -571,14 +571,15 @@ namespace Aaru.Tests.Images.PowerISO
|
||||
{
|
||||
byte[] sector;
|
||||
|
||||
if(sectors - doneSectors >= sectorsToRead)
|
||||
if(sectors - doneSectors >= SECTORS_TO_READ)
|
||||
{
|
||||
sector =
|
||||
@long ? image.ReadSectorsLong(doneSectors, sectorsToRead,
|
||||
@long ? image.ReadSectorsLong(doneSectors, SECTORS_TO_READ,
|
||||
currentTrack.TrackSequence)
|
||||
: image.ReadSectors(doneSectors, sectorsToRead, currentTrack.TrackSequence);
|
||||
: image.ReadSectors(doneSectors, SECTORS_TO_READ,
|
||||
currentTrack.TrackSequence);
|
||||
|
||||
doneSectors += sectorsToRead;
|
||||
doneSectors += SECTORS_TO_READ;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -613,12 +614,12 @@ namespace Aaru.Tests.Images.PowerISO
|
||||
{
|
||||
byte[] sector;
|
||||
|
||||
if(sectors - doneSectors >= sectorsToRead)
|
||||
if(sectors - doneSectors >= SECTORS_TO_READ)
|
||||
{
|
||||
sector = image.ReadSectorsTag(doneSectors, sectorsToRead, currentTrack.TrackSequence,
|
||||
sector = image.ReadSectorsTag(doneSectors, SECTORS_TO_READ, currentTrack.TrackSequence,
|
||||
SectorTagType.CdSectorSubchannel);
|
||||
|
||||
doneSectors += sectorsToRead;
|
||||
doneSectors += SECTORS_TO_READ;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -48,25 +48,25 @@ namespace Aaru.Tests.Images.QEMU
|
||||
readonly ulong[] _sectors =
|
||||
{
|
||||
// vhdx.vhdx.lz
|
||||
251904,
|
||||
251904
|
||||
};
|
||||
|
||||
readonly uint[] _sectorSize =
|
||||
{
|
||||
// vhdx.vhdx.lz
|
||||
512,
|
||||
512
|
||||
};
|
||||
|
||||
readonly MediaType[] _mediaTypes =
|
||||
{
|
||||
// vhdx.vhdx.lz
|
||||
MediaType.GENERIC_HDD,
|
||||
MediaType.GENERIC_HDD
|
||||
};
|
||||
|
||||
readonly string[] _md5S =
|
||||
{
|
||||
// vhdx.vhdx.lz
|
||||
"4bfc9e9e2dd86aa52ef709e77d2617ed",
|
||||
"4bfc9e9e2dd86aa52ef709e77d2617ed"
|
||||
};
|
||||
|
||||
readonly string _dataFolder = Path.Combine(Consts.TEST_FILES_ROOT, "Media image formats", "QEMU", "Hyper-V");
|
||||
@@ -83,7 +83,7 @@ namespace Aaru.Tests.Images.QEMU
|
||||
var filter = new LZip();
|
||||
filter.Open(_testFiles[i]);
|
||||
|
||||
var image = new DiscImages.Vhdx();
|
||||
var image = new Vhdx();
|
||||
bool opened = image.Open(filter);
|
||||
|
||||
Assert.AreEqual(true, opened, $"Open: {_testFiles[i]}");
|
||||
@@ -105,7 +105,7 @@ namespace Aaru.Tests.Images.QEMU
|
||||
}
|
||||
|
||||
// How many sectors to read at once
|
||||
const uint _sectorsToRead = 256;
|
||||
const uint SECTORS_TO_READ = 256;
|
||||
|
||||
[Test]
|
||||
public void Hashes()
|
||||
@@ -119,7 +119,7 @@ namespace Aaru.Tests.Images.QEMU
|
||||
var filter = new LZip();
|
||||
filter.Open(_testFiles[i]);
|
||||
|
||||
var image = new DiscImages.Vhdx();
|
||||
var image = new Vhdx();
|
||||
bool opened = image.Open(filter);
|
||||
ulong doneSectors = 0;
|
||||
|
||||
@@ -134,10 +134,10 @@ namespace Aaru.Tests.Images.QEMU
|
||||
{
|
||||
byte[] sector;
|
||||
|
||||
if(image.Info.Sectors - doneSectors >= _sectorsToRead)
|
||||
if(image.Info.Sectors - doneSectors >= SECTORS_TO_READ)
|
||||
{
|
||||
sector = image.ReadSectors(doneSectors, _sectorsToRead);
|
||||
doneSectors += _sectorsToRead;
|
||||
sector = image.ReadSectors(doneSectors, SECTORS_TO_READ);
|
||||
doneSectors += SECTORS_TO_READ;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -104,7 +104,7 @@ namespace Aaru.Tests.Images.QEMU
|
||||
}
|
||||
|
||||
// How many sectors to read at once
|
||||
const uint _sectorsToRead = 256;
|
||||
const uint SECTORS_TO_READ = 256;
|
||||
|
||||
[Test]
|
||||
public void Hashes()
|
||||
@@ -133,10 +133,10 @@ namespace Aaru.Tests.Images.QEMU
|
||||
{
|
||||
byte[] sector;
|
||||
|
||||
if(image.Info.Sectors - doneSectors >= _sectorsToRead)
|
||||
if(image.Info.Sectors - doneSectors >= SECTORS_TO_READ)
|
||||
{
|
||||
sector = image.ReadSectors(doneSectors, _sectorsToRead);
|
||||
doneSectors += _sectorsToRead;
|
||||
sector = image.ReadSectors(doneSectors, SECTORS_TO_READ);
|
||||
doneSectors += SECTORS_TO_READ;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -30,6 +30,7 @@ using System;
|
||||
using System.IO;
|
||||
using Aaru.Checksums;
|
||||
using Aaru.CommonTypes;
|
||||
using Aaru.DiscImages;
|
||||
using Aaru.Filters;
|
||||
using FluentAssertions.Execution;
|
||||
using NUnit.Framework;
|
||||
@@ -68,7 +69,8 @@ namespace Aaru.Tests.Images.QEMU
|
||||
"4bfc9e9e2dd86aa52ef709e77d2617ed"
|
||||
};
|
||||
|
||||
readonly string _dataFolder = Path.Combine(Consts.TEST_FILES_ROOT, "Media image formats", "QEMU", "QEMU Copy On Write");
|
||||
readonly string _dataFolder =
|
||||
Path.Combine(Consts.TEST_FILES_ROOT, "Media image formats", "QEMU", "QEMU Copy On Write");
|
||||
|
||||
[Test]
|
||||
public void Info()
|
||||
@@ -82,7 +84,7 @@ namespace Aaru.Tests.Images.QEMU
|
||||
var filter = new LZip();
|
||||
filter.Open(_testFiles[i]);
|
||||
|
||||
var image = new DiscImages.Qcow();
|
||||
var image = new Qcow();
|
||||
bool opened = image.Open(filter);
|
||||
|
||||
Assert.AreEqual(true, opened, $"Open: {_testFiles[i]}");
|
||||
@@ -104,7 +106,7 @@ namespace Aaru.Tests.Images.QEMU
|
||||
}
|
||||
|
||||
// How many sectors to read at once
|
||||
const uint _sectorsToRead = 256;
|
||||
const uint SECTORS_TO_READ = 256;
|
||||
|
||||
[Test]
|
||||
public void Hashes()
|
||||
@@ -118,7 +120,7 @@ namespace Aaru.Tests.Images.QEMU
|
||||
var filter = new LZip();
|
||||
filter.Open(_testFiles[i]);
|
||||
|
||||
var image = new DiscImages.Qcow();
|
||||
var image = new Qcow();
|
||||
bool opened = image.Open(filter);
|
||||
ulong doneSectors = 0;
|
||||
|
||||
@@ -133,10 +135,10 @@ namespace Aaru.Tests.Images.QEMU
|
||||
{
|
||||
byte[] sector;
|
||||
|
||||
if(image.Info.Sectors - doneSectors >= _sectorsToRead)
|
||||
if(image.Info.Sectors - doneSectors >= SECTORS_TO_READ)
|
||||
{
|
||||
sector = image.ReadSectors(doneSectors, _sectorsToRead);
|
||||
doneSectors += _sectorsToRead;
|
||||
sector = image.ReadSectors(doneSectors, SECTORS_TO_READ);
|
||||
doneSectors += SECTORS_TO_READ;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -118,7 +118,7 @@ namespace Aaru.Tests.Images.QEMU
|
||||
}
|
||||
|
||||
// How many sectors to read at once
|
||||
const uint _sectorsToRead = 256;
|
||||
const uint SECTORS_TO_READ = 256;
|
||||
|
||||
[Test]
|
||||
public void Hashes()
|
||||
@@ -147,10 +147,10 @@ namespace Aaru.Tests.Images.QEMU
|
||||
{
|
||||
byte[] sector;
|
||||
|
||||
if(image.Info.Sectors - doneSectors >= _sectorsToRead)
|
||||
if(image.Info.Sectors - doneSectors >= SECTORS_TO_READ)
|
||||
{
|
||||
sector = image.ReadSectors(doneSectors, _sectorsToRead);
|
||||
doneSectors += _sectorsToRead;
|
||||
sector = image.ReadSectors(doneSectors, SECTORS_TO_READ);
|
||||
doneSectors += SECTORS_TO_READ;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -118,7 +118,7 @@ namespace Aaru.Tests.Images.QEMU
|
||||
}
|
||||
|
||||
// How many sectors to read at once
|
||||
const uint _sectorsToRead = 256;
|
||||
const uint SECTORS_TO_READ = 256;
|
||||
|
||||
[Test]
|
||||
public void Hashes()
|
||||
@@ -147,10 +147,10 @@ namespace Aaru.Tests.Images.QEMU
|
||||
{
|
||||
byte[] sector;
|
||||
|
||||
if(image.Info.Sectors - doneSectors >= _sectorsToRead)
|
||||
if(image.Info.Sectors - doneSectors >= SECTORS_TO_READ)
|
||||
{
|
||||
sector = image.ReadSectors(doneSectors, _sectorsToRead);
|
||||
doneSectors += _sectorsToRead;
|
||||
sector = image.ReadSectors(doneSectors, SECTORS_TO_READ);
|
||||
doneSectors += SECTORS_TO_READ;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -30,6 +30,7 @@ using System;
|
||||
using System.IO;
|
||||
using Aaru.Checksums;
|
||||
using Aaru.CommonTypes;
|
||||
using Aaru.DiscImages;
|
||||
using Aaru.Filters;
|
||||
using FluentAssertions.Execution;
|
||||
using NUnit.Framework;
|
||||
@@ -68,7 +69,8 @@ namespace Aaru.Tests.Images.QEMU
|
||||
"4bfc9e9e2dd86aa52ef709e77d2617ed"
|
||||
};
|
||||
|
||||
readonly string _dataFolder = Path.Combine(Consts.TEST_FILES_ROOT, "Media image formats", "QEMU", "QEMU Enhanced Disk");
|
||||
readonly string _dataFolder =
|
||||
Path.Combine(Consts.TEST_FILES_ROOT, "Media image formats", "QEMU", "QEMU Enhanced Disk");
|
||||
|
||||
[Test]
|
||||
public void Info()
|
||||
@@ -82,7 +84,7 @@ namespace Aaru.Tests.Images.QEMU
|
||||
var filter = new LZip();
|
||||
filter.Open(_testFiles[i]);
|
||||
|
||||
var image = new DiscImages.Qed();
|
||||
var image = new Qed();
|
||||
bool opened = image.Open(filter);
|
||||
|
||||
Assert.AreEqual(true, opened, $"Open: {_testFiles[i]}");
|
||||
@@ -104,7 +106,7 @@ namespace Aaru.Tests.Images.QEMU
|
||||
}
|
||||
|
||||
// How many sectors to read at once
|
||||
const uint _sectorsToRead = 256;
|
||||
const uint SECTORS_TO_READ = 256;
|
||||
|
||||
[Test]
|
||||
public void Hashes()
|
||||
@@ -118,7 +120,7 @@ namespace Aaru.Tests.Images.QEMU
|
||||
var filter = new LZip();
|
||||
filter.Open(_testFiles[i]);
|
||||
|
||||
var image = new DiscImages.Qed();
|
||||
var image = new Qed();
|
||||
bool opened = image.Open(filter);
|
||||
ulong doneSectors = 0;
|
||||
|
||||
@@ -133,10 +135,10 @@ namespace Aaru.Tests.Images.QEMU
|
||||
{
|
||||
byte[] sector;
|
||||
|
||||
if(image.Info.Sectors - doneSectors >= _sectorsToRead)
|
||||
if(image.Info.Sectors - doneSectors >= SECTORS_TO_READ)
|
||||
{
|
||||
sector = image.ReadSectors(doneSectors, _sectorsToRead);
|
||||
doneSectors += _sectorsToRead;
|
||||
sector = image.ReadSectors(doneSectors, SECTORS_TO_READ);
|
||||
doneSectors += SECTORS_TO_READ;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -105,7 +105,7 @@ namespace Aaru.Tests.Images.QEMU
|
||||
}
|
||||
|
||||
// How many sectors to read at once
|
||||
const uint _sectorsToRead = 256;
|
||||
const uint SECTORS_TO_READ = 256;
|
||||
|
||||
[Test]
|
||||
public void Hashes()
|
||||
@@ -134,10 +134,10 @@ namespace Aaru.Tests.Images.QEMU
|
||||
{
|
||||
byte[] sector;
|
||||
|
||||
if(image.Info.Sectors - doneSectors >= _sectorsToRead)
|
||||
if(image.Info.Sectors - doneSectors >= SECTORS_TO_READ)
|
||||
{
|
||||
sector = image.ReadSectors(doneSectors, _sectorsToRead);
|
||||
doneSectors += _sectorsToRead;
|
||||
sector = image.ReadSectors(doneSectors, SECTORS_TO_READ);
|
||||
doneSectors += SECTORS_TO_READ;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -105,7 +105,7 @@ namespace Aaru.Tests.Images.QEMU
|
||||
}
|
||||
|
||||
// How many sectors to read at once
|
||||
const uint _sectorsToRead = 256;
|
||||
const uint SECTORS_TO_READ = 256;
|
||||
|
||||
[Test]
|
||||
public void Hashes()
|
||||
@@ -134,10 +134,10 @@ namespace Aaru.Tests.Images.QEMU
|
||||
{
|
||||
byte[] sector;
|
||||
|
||||
if(image.Info.Sectors - doneSectors >= _sectorsToRead)
|
||||
if(image.Info.Sectors - doneSectors >= SECTORS_TO_READ)
|
||||
{
|
||||
sector = image.ReadSectors(doneSectors, _sectorsToRead);
|
||||
doneSectors += _sectorsToRead;
|
||||
sector = image.ReadSectors(doneSectors, SECTORS_TO_READ);
|
||||
doneSectors += SECTORS_TO_READ;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -105,7 +105,7 @@ namespace Aaru.Tests.Images.QEMU
|
||||
}
|
||||
|
||||
// How many sectors to read at once
|
||||
const uint _sectorsToRead = 256;
|
||||
const uint SECTORS_TO_READ = 256;
|
||||
|
||||
[Test]
|
||||
public void Hashes()
|
||||
@@ -134,10 +134,10 @@ namespace Aaru.Tests.Images.QEMU
|
||||
{
|
||||
byte[] sector;
|
||||
|
||||
if(image.Info.Sectors - doneSectors >= _sectorsToRead)
|
||||
if(image.Info.Sectors - doneSectors >= SECTORS_TO_READ)
|
||||
{
|
||||
sector = image.ReadSectors(doneSectors, _sectorsToRead);
|
||||
doneSectors += _sectorsToRead;
|
||||
sector = image.ReadSectors(doneSectors, SECTORS_TO_READ);
|
||||
doneSectors += SECTORS_TO_READ;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -83,7 +83,7 @@ namespace Aaru.Tests.Images.QEMU
|
||||
var filter = new LZip();
|
||||
filter.Open(_testFiles[i]);
|
||||
|
||||
var image = new DiscImages.Vdi();
|
||||
var image = new Vdi();
|
||||
bool opened = image.Open(filter);
|
||||
|
||||
Assert.AreEqual(true, opened, $"Open: {_testFiles[i]}");
|
||||
@@ -105,7 +105,7 @@ namespace Aaru.Tests.Images.QEMU
|
||||
}
|
||||
|
||||
// How many sectors to read at once
|
||||
const uint _sectorsToRead = 256;
|
||||
const uint SECTORS_TO_READ = 256;
|
||||
|
||||
[Test]
|
||||
public void Hashes()
|
||||
@@ -119,7 +119,7 @@ namespace Aaru.Tests.Images.QEMU
|
||||
var filter = new LZip();
|
||||
filter.Open(_testFiles[i]);
|
||||
|
||||
var image = new DiscImages.Vdi();
|
||||
var image = new Vdi();
|
||||
bool opened = image.Open(filter);
|
||||
ulong doneSectors = 0;
|
||||
|
||||
@@ -134,10 +134,10 @@ namespace Aaru.Tests.Images.QEMU
|
||||
{
|
||||
byte[] sector;
|
||||
|
||||
if(image.Info.Sectors - doneSectors >= _sectorsToRead)
|
||||
if(image.Info.Sectors - doneSectors >= SECTORS_TO_READ)
|
||||
{
|
||||
sector = image.ReadSectors(doneSectors, _sectorsToRead);
|
||||
doneSectors += _sectorsToRead;
|
||||
sector = image.ReadSectors(doneSectors, SECTORS_TO_READ);
|
||||
doneSectors += SECTORS_TO_READ;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -42,17 +42,17 @@ namespace Aaru.Tests.Images.QEMU
|
||||
{
|
||||
readonly string[] _testFiles =
|
||||
{
|
||||
"qemu_dynamic_250mb.vhd.lz",
|
||||
"qemu_fixed_10mb.vhd.lz",
|
||||
"virtualpc.vhd.lz"
|
||||
"qemu_dynamic_250mb.vhd.lz", "qemu_fixed_10mb.vhd.lz", "virtualpc.vhd.lz"
|
||||
};
|
||||
|
||||
readonly ulong[] _sectors =
|
||||
{
|
||||
// qemu_dynamic_250mb.vhd.lz"
|
||||
512064,
|
||||
|
||||
// qemu_fixed_10mb.vhd.lz"
|
||||
20536,
|
||||
|
||||
// virtualpc.vhd.lz
|
||||
251940
|
||||
};
|
||||
@@ -61,8 +61,10 @@ namespace Aaru.Tests.Images.QEMU
|
||||
{
|
||||
// qemu_dynamic_250mb.vhd.lz"
|
||||
512,
|
||||
|
||||
// qemu_fixed_10mb.vhd.lz"
|
||||
512,
|
||||
|
||||
// virtualpc.vhd.lz
|
||||
512
|
||||
};
|
||||
@@ -71,8 +73,10 @@ namespace Aaru.Tests.Images.QEMU
|
||||
{
|
||||
// qemu_dynamic_250mb.vhd.lz"
|
||||
MediaType.Unknown,
|
||||
|
||||
// qemu_fixed_10mb.vhd.lz"
|
||||
MediaType.Unknown,
|
||||
|
||||
// virtualpc.vhd.lz
|
||||
MediaType.Unknown
|
||||
};
|
||||
@@ -81,8 +85,10 @@ namespace Aaru.Tests.Images.QEMU
|
||||
{
|
||||
// qemu_dynamic_250mb.vhd.lz"
|
||||
"0435d6781d14d34a32c6ac40f5e70d35",
|
||||
|
||||
// qemu_fixed_10mb.vhd.lz"
|
||||
"adfad4fb019f157e868baa39e7753db7",
|
||||
|
||||
// virtualpc.vhd.lz
|
||||
"6246bff640cb3a56d2611e7f8616384d"
|
||||
};
|
||||
@@ -123,7 +129,7 @@ namespace Aaru.Tests.Images.QEMU
|
||||
}
|
||||
|
||||
// How many sectors to read at once
|
||||
const uint _sectorsToRead = 256;
|
||||
const uint SECTORS_TO_READ = 256;
|
||||
|
||||
[Test]
|
||||
public void Hashes()
|
||||
@@ -152,10 +158,10 @@ namespace Aaru.Tests.Images.QEMU
|
||||
{
|
||||
byte[] sector;
|
||||
|
||||
if(image.Info.Sectors - doneSectors >= _sectorsToRead)
|
||||
if(image.Info.Sectors - doneSectors >= SECTORS_TO_READ)
|
||||
{
|
||||
sector = image.ReadSectors(doneSectors, _sectorsToRead);
|
||||
doneSectors += _sectorsToRead;
|
||||
sector = image.ReadSectors(doneSectors, SECTORS_TO_READ);
|
||||
doneSectors += SECTORS_TO_READ;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -2703,7 +2703,7 @@ namespace Aaru.Tests.Images
|
||||
}
|
||||
|
||||
// How many sectors to read at once
|
||||
const uint _sectorsToRead = 256;
|
||||
const uint SECTORS_TO_READ = 256;
|
||||
|
||||
[Test]
|
||||
public void Hashes()
|
||||
@@ -2728,10 +2728,10 @@ namespace Aaru.Tests.Images
|
||||
{
|
||||
byte[] sector;
|
||||
|
||||
if(image.Info.Sectors - doneSectors >= _sectorsToRead)
|
||||
if(image.Info.Sectors - doneSectors >= SECTORS_TO_READ)
|
||||
{
|
||||
sector = image.ReadSectors(doneSectors, _sectorsToRead);
|
||||
doneSectors += _sectorsToRead;
|
||||
sector = image.ReadSectors(doneSectors, SECTORS_TO_READ);
|
||||
doneSectors += SECTORS_TO_READ;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -104,7 +104,7 @@ namespace Aaru.Tests.Images
|
||||
}
|
||||
|
||||
// How many sectors to read at once
|
||||
const uint _sectorsToRead = 256;
|
||||
const uint SECTORS_TO_READ = 256;
|
||||
|
||||
[Test]
|
||||
public void Hashes()
|
||||
@@ -133,10 +133,10 @@ namespace Aaru.Tests.Images
|
||||
{
|
||||
byte[] sector;
|
||||
|
||||
if(image.Info.Sectors - doneSectors >= _sectorsToRead)
|
||||
if(image.Info.Sectors - doneSectors >= SECTORS_TO_READ)
|
||||
{
|
||||
sector = image.ReadSectors(doneSectors, _sectorsToRead);
|
||||
doneSectors += _sectorsToRead;
|
||||
sector = image.ReadSectors(doneSectors, SECTORS_TO_READ);
|
||||
doneSectors += SECTORS_TO_READ;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -1555,7 +1555,7 @@ namespace Aaru.Tests.Images
|
||||
}
|
||||
|
||||
// How many sectors to read at once
|
||||
const uint _sectorsToRead = 256;
|
||||
const uint SECTORS_TO_READ = 256;
|
||||
|
||||
[Test]
|
||||
public void Hashes()
|
||||
@@ -1584,10 +1584,10 @@ namespace Aaru.Tests.Images
|
||||
{
|
||||
byte[] sector;
|
||||
|
||||
if(image.Info.Sectors - doneSectors >= _sectorsToRead)
|
||||
if(image.Info.Sectors - doneSectors >= SECTORS_TO_READ)
|
||||
{
|
||||
sector = image.ReadSectors(doneSectors, _sectorsToRead);
|
||||
doneSectors += _sectorsToRead;
|
||||
sector = image.ReadSectors(doneSectors, SECTORS_TO_READ);
|
||||
doneSectors += SECTORS_TO_READ;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -166,7 +166,7 @@ namespace Aaru.Tests.Images.ShrinkWrap
|
||||
}
|
||||
|
||||
// How many sectors to read at once
|
||||
const uint _sectorsToRead = 256;
|
||||
const uint SECTORS_TO_READ = 256;
|
||||
|
||||
[Test]
|
||||
public void Hashes()
|
||||
@@ -195,10 +195,10 @@ namespace Aaru.Tests.Images.ShrinkWrap
|
||||
{
|
||||
byte[] sector;
|
||||
|
||||
if(image.Info.Sectors - doneSectors >= _sectorsToRead)
|
||||
if(image.Info.Sectors - doneSectors >= SECTORS_TO_READ)
|
||||
{
|
||||
sector = image.ReadSectors(doneSectors, _sectorsToRead);
|
||||
doneSectors += _sectorsToRead;
|
||||
sector = image.ReadSectors(doneSectors, SECTORS_TO_READ);
|
||||
doneSectors += SECTORS_TO_READ;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -215,7 +215,7 @@ namespace Aaru.Tests.Images.ShrinkWrap
|
||||
}
|
||||
|
||||
// How many sectors to read at once
|
||||
const uint _sectorsToRead = 256;
|
||||
const uint SECTORS_TO_READ = 256;
|
||||
|
||||
[Test]
|
||||
public void Hashes()
|
||||
@@ -244,10 +244,10 @@ namespace Aaru.Tests.Images.ShrinkWrap
|
||||
{
|
||||
byte[] sector;
|
||||
|
||||
if(image.Info.Sectors - doneSectors >= _sectorsToRead)
|
||||
if(image.Info.Sectors - doneSectors >= SECTORS_TO_READ)
|
||||
{
|
||||
sector = image.ReadSectors(doneSectors, _sectorsToRead);
|
||||
doneSectors += _sectorsToRead;
|
||||
sector = image.ReadSectors(doneSectors, SECTORS_TO_READ);
|
||||
doneSectors += SECTORS_TO_READ;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -215,7 +215,7 @@ namespace Aaru.Tests.Images.ShrinkWrap.NDIF
|
||||
}
|
||||
|
||||
// How many sectors to read at once
|
||||
const uint _sectorsToRead = 256;
|
||||
const uint SECTORS_TO_READ = 256;
|
||||
|
||||
[Test]
|
||||
public void Hashes()
|
||||
@@ -244,10 +244,10 @@ namespace Aaru.Tests.Images.ShrinkWrap.NDIF
|
||||
{
|
||||
byte[] sector;
|
||||
|
||||
if(image.Info.Sectors - doneSectors >= _sectorsToRead)
|
||||
if(image.Info.Sectors - doneSectors >= SECTORS_TO_READ)
|
||||
{
|
||||
sector = image.ReadSectors(doneSectors, _sectorsToRead);
|
||||
doneSectors += _sectorsToRead;
|
||||
sector = image.ReadSectors(doneSectors, SECTORS_TO_READ);
|
||||
doneSectors += SECTORS_TO_READ;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -215,7 +215,7 @@ namespace Aaru.Tests.Images.ShrinkWrap.NDIF
|
||||
}
|
||||
|
||||
// How many sectors to read at once
|
||||
const uint _sectorsToRead = 256;
|
||||
const uint SECTORS_TO_READ = 256;
|
||||
|
||||
[Test]
|
||||
public void Hashes()
|
||||
@@ -244,10 +244,10 @@ namespace Aaru.Tests.Images.ShrinkWrap.NDIF
|
||||
{
|
||||
byte[] sector;
|
||||
|
||||
if(image.Info.Sectors - doneSectors >= _sectorsToRead)
|
||||
if(image.Info.Sectors - doneSectors >= SECTORS_TO_READ)
|
||||
{
|
||||
sector = image.ReadSectors(doneSectors, _sectorsToRead);
|
||||
doneSectors += _sectorsToRead;
|
||||
sector = image.ReadSectors(doneSectors, SECTORS_TO_READ);
|
||||
doneSectors += SECTORS_TO_READ;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -215,7 +215,7 @@ namespace Aaru.Tests.Images.ShrinkWrap.NDIF
|
||||
}
|
||||
|
||||
// How many sectors to read at once
|
||||
const uint _sectorsToRead = 256;
|
||||
const uint SECTORS_TO_READ = 256;
|
||||
|
||||
[Test]
|
||||
public void Hashes()
|
||||
@@ -244,10 +244,10 @@ namespace Aaru.Tests.Images.ShrinkWrap.NDIF
|
||||
{
|
||||
byte[] sector;
|
||||
|
||||
if(image.Info.Sectors - doneSectors >= _sectorsToRead)
|
||||
if(image.Info.Sectors - doneSectors >= SECTORS_TO_READ)
|
||||
{
|
||||
sector = image.ReadSectors(doneSectors, _sectorsToRead);
|
||||
doneSectors += _sectorsToRead;
|
||||
sector = image.ReadSectors(doneSectors, SECTORS_TO_READ);
|
||||
doneSectors += SECTORS_TO_READ;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -215,7 +215,7 @@ namespace Aaru.Tests.Images.ShrinkWrap
|
||||
}
|
||||
|
||||
// How many sectors to read at once
|
||||
const uint _sectorsToRead = 256;
|
||||
const uint SECTORS_TO_READ = 256;
|
||||
|
||||
[Test]
|
||||
public void Hashes()
|
||||
@@ -244,10 +244,10 @@ namespace Aaru.Tests.Images.ShrinkWrap
|
||||
{
|
||||
byte[] sector;
|
||||
|
||||
if(image.Info.Sectors - doneSectors >= _sectorsToRead)
|
||||
if(image.Info.Sectors - doneSectors >= SECTORS_TO_READ)
|
||||
{
|
||||
sector = image.ReadSectors(doneSectors, _sectorsToRead);
|
||||
doneSectors += _sectorsToRead;
|
||||
sector = image.ReadSectors(doneSectors, SECTORS_TO_READ);
|
||||
doneSectors += SECTORS_TO_READ;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -800,7 +800,7 @@ namespace Aaru.Tests.Images
|
||||
}
|
||||
|
||||
// How many sectors to read at once
|
||||
const uint _sectorsToRead = 256;
|
||||
const uint SECTORS_TO_READ = 256;
|
||||
|
||||
[Test]
|
||||
public void Hashes()
|
||||
@@ -829,10 +829,10 @@ namespace Aaru.Tests.Images
|
||||
{
|
||||
byte[] sector;
|
||||
|
||||
if(image.Info.Sectors - doneSectors >= _sectorsToRead)
|
||||
if(image.Info.Sectors - doneSectors >= SECTORS_TO_READ)
|
||||
{
|
||||
sector = image.ReadSectors(doneSectors, _sectorsToRead);
|
||||
doneSectors += _sectorsToRead;
|
||||
sector = image.ReadSectors(doneSectors, SECTORS_TO_READ);
|
||||
doneSectors += SECTORS_TO_READ;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -511,11 +511,13 @@ namespace Aaru.Tests.Images.UltraISO
|
||||
}
|
||||
};
|
||||
|
||||
readonly string _dataFolder =
|
||||
Path.Combine(Consts.TEST_FILES_ROOT, "Media image formats", "UltraISO", "Alcohol");
|
||||
|
||||
[Test]
|
||||
public void Test()
|
||||
public void Info()
|
||||
{
|
||||
Environment.CurrentDirectory =
|
||||
Path.Combine(Consts.TEST_FILES_ROOT, "Media image formats", "UltraISO", "Alcohol");
|
||||
Environment.CurrentDirectory = _dataFolder;
|
||||
|
||||
for(int i = 0; i < _testFiles.Length; i++)
|
||||
{
|
||||
@@ -567,14 +569,13 @@ namespace Aaru.Tests.Images.UltraISO
|
||||
}
|
||||
}
|
||||
|
||||
// How many sectors to read at once
|
||||
const uint SECTORS_TO_READ = 256;
|
||||
|
||||
[Test]
|
||||
public void Hashes()
|
||||
{
|
||||
// How many sectors to read at once
|
||||
const uint sectorsToRead = 256;
|
||||
|
||||
Environment.CurrentDirectory =
|
||||
Path.Combine(Consts.TEST_FILES_ROOT, "Media image formats", "UltraISO", "Alcohol");
|
||||
Environment.CurrentDirectory = _dataFolder;
|
||||
|
||||
Assert.Multiple(() =>
|
||||
{
|
||||
@@ -605,14 +606,15 @@ namespace Aaru.Tests.Images.UltraISO
|
||||
{
|
||||
byte[] sector;
|
||||
|
||||
if(sectors - doneSectors >= sectorsToRead)
|
||||
if(sectors - doneSectors >= SECTORS_TO_READ)
|
||||
{
|
||||
sector =
|
||||
@long ? image.ReadSectorsLong(doneSectors, sectorsToRead,
|
||||
@long ? image.ReadSectorsLong(doneSectors, SECTORS_TO_READ,
|
||||
currentTrack.TrackSequence)
|
||||
: image.ReadSectors(doneSectors, sectorsToRead, currentTrack.TrackSequence);
|
||||
: image.ReadSectors(doneSectors, SECTORS_TO_READ,
|
||||
currentTrack.TrackSequence);
|
||||
|
||||
doneSectors += sectorsToRead;
|
||||
doneSectors += SECTORS_TO_READ;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -647,12 +649,12 @@ namespace Aaru.Tests.Images.UltraISO
|
||||
{
|
||||
byte[] sector;
|
||||
|
||||
if(sectors - doneSectors >= sectorsToRead)
|
||||
if(sectors - doneSectors >= SECTORS_TO_READ)
|
||||
{
|
||||
sector = image.ReadSectorsTag(doneSectors, sectorsToRead, currentTrack.TrackSequence,
|
||||
sector = image.ReadSectorsTag(doneSectors, SECTORS_TO_READ, currentTrack.TrackSequence,
|
||||
SectorTagType.CdSectorSubchannel);
|
||||
|
||||
doneSectors += sectorsToRead;
|
||||
doneSectors += SECTORS_TO_READ;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -376,11 +376,13 @@ namespace Aaru.Tests.Images.UltraISO
|
||||
}
|
||||
};
|
||||
|
||||
readonly string _dataFolder =
|
||||
Path.Combine(Consts.TEST_FILES_ROOT, "Media image formats", "UltraISO", "CloneCD");
|
||||
|
||||
[Test]
|
||||
public void Test()
|
||||
public void Info()
|
||||
{
|
||||
Environment.CurrentDirectory =
|
||||
Path.Combine(Consts.TEST_FILES_ROOT, "Media image formats", "UltraISO", "CloneCD");
|
||||
Environment.CurrentDirectory = _dataFolder;
|
||||
|
||||
for(int i = 0; i < _testFiles.Length; i++)
|
||||
{
|
||||
@@ -432,14 +434,13 @@ namespace Aaru.Tests.Images.UltraISO
|
||||
}
|
||||
}
|
||||
|
||||
// How many sectors to read at once
|
||||
const uint SECTORS_TO_READ = 256;
|
||||
|
||||
[Test]
|
||||
public void Hashes()
|
||||
{
|
||||
// How many sectors to read at once
|
||||
const uint sectorsToRead = 256;
|
||||
|
||||
Environment.CurrentDirectory =
|
||||
Path.Combine(Consts.TEST_FILES_ROOT, "Media image formats", "UltraISO", "CloneCD");
|
||||
Environment.CurrentDirectory = _dataFolder;
|
||||
|
||||
Assert.Multiple(() =>
|
||||
{
|
||||
@@ -470,14 +471,15 @@ namespace Aaru.Tests.Images.UltraISO
|
||||
{
|
||||
byte[] sector;
|
||||
|
||||
if(sectors - doneSectors >= sectorsToRead)
|
||||
if(sectors - doneSectors >= SECTORS_TO_READ)
|
||||
{
|
||||
sector =
|
||||
@long ? image.ReadSectorsLong(doneSectors, sectorsToRead,
|
||||
@long ? image.ReadSectorsLong(doneSectors, SECTORS_TO_READ,
|
||||
currentTrack.TrackSequence)
|
||||
: image.ReadSectors(doneSectors, sectorsToRead, currentTrack.TrackSequence);
|
||||
: image.ReadSectors(doneSectors, SECTORS_TO_READ,
|
||||
currentTrack.TrackSequence);
|
||||
|
||||
doneSectors += sectorsToRead;
|
||||
doneSectors += SECTORS_TO_READ;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -512,12 +514,12 @@ namespace Aaru.Tests.Images.UltraISO
|
||||
{
|
||||
byte[] sector;
|
||||
|
||||
if(sectors - doneSectors >= sectorsToRead)
|
||||
if(sectors - doneSectors >= SECTORS_TO_READ)
|
||||
{
|
||||
sector = image.ReadSectorsTag(doneSectors, sectorsToRead, currentTrack.TrackSequence,
|
||||
sector = image.ReadSectorsTag(doneSectors, SECTORS_TO_READ, currentTrack.TrackSequence,
|
||||
SectorTagType.CdSectorSubchannel);
|
||||
|
||||
doneSectors += sectorsToRead;
|
||||
doneSectors += SECTORS_TO_READ;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -522,11 +522,13 @@ namespace Aaru.Tests.Images.UltraISO
|
||||
}
|
||||
};
|
||||
|
||||
readonly string _dataFolder =
|
||||
Path.Combine(Consts.TEST_FILES_ROOT, "Media image formats", "UltraISO", "Cuesheet");
|
||||
|
||||
[Test]
|
||||
public void Test()
|
||||
public void Info()
|
||||
{
|
||||
Environment.CurrentDirectory =
|
||||
Path.Combine(Consts.TEST_FILES_ROOT, "Media image formats", "UltraISO", "Cuesheet");
|
||||
Environment.CurrentDirectory = _dataFolder;
|
||||
|
||||
for(int i = 0; i < _testFiles.Length; i++)
|
||||
{
|
||||
@@ -578,14 +580,13 @@ namespace Aaru.Tests.Images.UltraISO
|
||||
}
|
||||
}
|
||||
|
||||
// How many sectors to read at once
|
||||
const uint SECTORS_TO_READ = 256;
|
||||
|
||||
[Test]
|
||||
public void Hashes()
|
||||
{
|
||||
// How many sectors to read at once
|
||||
const uint sectorsToRead = 256;
|
||||
|
||||
Environment.CurrentDirectory =
|
||||
Path.Combine(Consts.TEST_FILES_ROOT, "Media image formats", "UltraISO", "Cuesheet");
|
||||
Environment.CurrentDirectory = _dataFolder;
|
||||
|
||||
Assert.Multiple(() =>
|
||||
{
|
||||
@@ -616,14 +617,15 @@ namespace Aaru.Tests.Images.UltraISO
|
||||
{
|
||||
byte[] sector;
|
||||
|
||||
if(sectors - doneSectors >= sectorsToRead)
|
||||
if(sectors - doneSectors >= SECTORS_TO_READ)
|
||||
{
|
||||
sector =
|
||||
@long ? image.ReadSectorsLong(doneSectors, sectorsToRead,
|
||||
@long ? image.ReadSectorsLong(doneSectors, SECTORS_TO_READ,
|
||||
currentTrack.TrackSequence)
|
||||
: image.ReadSectors(doneSectors, sectorsToRead, currentTrack.TrackSequence);
|
||||
: image.ReadSectors(doneSectors, SECTORS_TO_READ,
|
||||
currentTrack.TrackSequence);
|
||||
|
||||
doneSectors += sectorsToRead;
|
||||
doneSectors += SECTORS_TO_READ;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -658,12 +660,12 @@ namespace Aaru.Tests.Images.UltraISO
|
||||
{
|
||||
byte[] sector;
|
||||
|
||||
if(sectors - doneSectors >= sectorsToRead)
|
||||
if(sectors - doneSectors >= SECTORS_TO_READ)
|
||||
{
|
||||
sector = image.ReadSectorsTag(doneSectors, sectorsToRead, currentTrack.TrackSequence,
|
||||
sector = image.ReadSectorsTag(doneSectors, SECTORS_TO_READ, currentTrack.TrackSequence,
|
||||
SectorTagType.CdSectorSubchannel);
|
||||
|
||||
doneSectors += sectorsToRead;
|
||||
doneSectors += SECTORS_TO_READ;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -523,11 +523,12 @@ namespace Aaru.Tests.Images.UltraISO
|
||||
}
|
||||
};
|
||||
|
||||
readonly string _dataFolder = Path.Combine(Consts.TEST_FILES_ROOT, "Media image formats", "UltraISO", "Nero");
|
||||
|
||||
[Test]
|
||||
public void Test()
|
||||
public void Info()
|
||||
{
|
||||
Environment.CurrentDirectory =
|
||||
Path.Combine(Consts.TEST_FILES_ROOT, "Media image formats", "UltraISO", "Nero");
|
||||
Environment.CurrentDirectory = _dataFolder;
|
||||
|
||||
for(int i = 0; i < _testFiles.Length; i++)
|
||||
{
|
||||
@@ -579,14 +580,13 @@ namespace Aaru.Tests.Images.UltraISO
|
||||
}
|
||||
}
|
||||
|
||||
// How many sectors to read at once
|
||||
const uint SECTORS_TO_READ = 256;
|
||||
|
||||
[Test]
|
||||
public void Hashes()
|
||||
{
|
||||
// How many sectors to read at once
|
||||
const uint sectorsToRead = 256;
|
||||
|
||||
Environment.CurrentDirectory =
|
||||
Path.Combine(Consts.TEST_FILES_ROOT, "Media image formats", "UltraISO", "Nero");
|
||||
Environment.CurrentDirectory = _dataFolder;
|
||||
|
||||
Assert.Multiple(() =>
|
||||
{
|
||||
@@ -617,14 +617,15 @@ namespace Aaru.Tests.Images.UltraISO
|
||||
{
|
||||
byte[] sector;
|
||||
|
||||
if(sectors - doneSectors >= sectorsToRead)
|
||||
if(sectors - doneSectors >= SECTORS_TO_READ)
|
||||
{
|
||||
sector =
|
||||
@long ? image.ReadSectorsLong(doneSectors, sectorsToRead,
|
||||
@long ? image.ReadSectorsLong(doneSectors, SECTORS_TO_READ,
|
||||
currentTrack.TrackSequence)
|
||||
: image.ReadSectors(doneSectors, sectorsToRead, currentTrack.TrackSequence);
|
||||
: image.ReadSectors(doneSectors, SECTORS_TO_READ,
|
||||
currentTrack.TrackSequence);
|
||||
|
||||
doneSectors += sectorsToRead;
|
||||
doneSectors += SECTORS_TO_READ;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -659,12 +660,12 @@ namespace Aaru.Tests.Images.UltraISO
|
||||
{
|
||||
byte[] sector;
|
||||
|
||||
if(sectors - doneSectors >= sectorsToRead)
|
||||
if(sectors - doneSectors >= SECTORS_TO_READ)
|
||||
{
|
||||
sector = image.ReadSectorsTag(doneSectors, sectorsToRead, currentTrack.TrackSequence,
|
||||
sector = image.ReadSectorsTag(doneSectors, SECTORS_TO_READ, currentTrack.TrackSequence,
|
||||
SectorTagType.CdSectorSubchannel);
|
||||
|
||||
doneSectors += sectorsToRead;
|
||||
doneSectors += SECTORS_TO_READ;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -177,7 +177,7 @@ namespace Aaru.Tests.Images
|
||||
}
|
||||
|
||||
// How many sectors to read at once
|
||||
const uint _sectorsToRead = 256;
|
||||
const uint SECTORS_TO_READ = 256;
|
||||
|
||||
[Test]
|
||||
public void Hashes()
|
||||
@@ -206,10 +206,10 @@ namespace Aaru.Tests.Images
|
||||
{
|
||||
byte[] sector;
|
||||
|
||||
if(image.Info.Sectors - doneSectors >= _sectorsToRead)
|
||||
if(image.Info.Sectors - doneSectors >= SECTORS_TO_READ)
|
||||
{
|
||||
sector = image.ReadSectors(doneSectors, _sectorsToRead);
|
||||
doneSectors += _sectorsToRead;
|
||||
sector = image.ReadSectors(doneSectors, SECTORS_TO_READ);
|
||||
doneSectors += SECTORS_TO_READ;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -168,7 +168,7 @@ namespace Aaru.Tests.Images.VirtualBox
|
||||
}
|
||||
|
||||
// How many sectors to read at once
|
||||
const uint _sectorsToRead = 256;
|
||||
const uint SECTORS_TO_READ = 256;
|
||||
|
||||
[Test]
|
||||
public void Hashes()
|
||||
@@ -197,10 +197,10 @@ namespace Aaru.Tests.Images.VirtualBox
|
||||
{
|
||||
byte[] sector;
|
||||
|
||||
if(image.Info.Sectors - doneSectors >= _sectorsToRead)
|
||||
if(image.Info.Sectors - doneSectors >= SECTORS_TO_READ)
|
||||
{
|
||||
sector = image.ReadSectors(doneSectors, _sectorsToRead);
|
||||
doneSectors += _sectorsToRead;
|
||||
sector = image.ReadSectors(doneSectors, SECTORS_TO_READ);
|
||||
doneSectors += SECTORS_TO_READ;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -154,7 +154,7 @@ namespace Aaru.Tests.Images.VirtualPC
|
||||
}
|
||||
|
||||
// How many sectors to read at once
|
||||
const uint _sectorsToRead = 256;
|
||||
const uint SECTORS_TO_READ = 256;
|
||||
|
||||
[Test]
|
||||
public void Hashes()
|
||||
@@ -183,10 +183,10 @@ namespace Aaru.Tests.Images.VirtualPC
|
||||
{
|
||||
byte[] sector;
|
||||
|
||||
if(image.Info.Sectors - doneSectors >= _sectorsToRead)
|
||||
if(image.Info.Sectors - doneSectors >= SECTORS_TO_READ)
|
||||
{
|
||||
sector = image.ReadSectors(doneSectors, _sectorsToRead);
|
||||
doneSectors += _sectorsToRead;
|
||||
sector = image.ReadSectors(doneSectors, SECTORS_TO_READ);
|
||||
doneSectors += SECTORS_TO_READ;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -250,7 +250,7 @@ readonly string[] _md5S =
|
||||
}
|
||||
|
||||
// How many sectors to read at once
|
||||
const uint _sectorsToRead = 256;
|
||||
const uint SECTORS_TO_READ = 256;
|
||||
|
||||
[Test]
|
||||
public void Hashes()
|
||||
@@ -279,10 +279,10 @@ readonly string[] _md5S =
|
||||
{
|
||||
byte[] sector;
|
||||
|
||||
if(image.Info.Sectors - doneSectors >= _sectorsToRead)
|
||||
if(image.Info.Sectors - doneSectors >= SECTORS_TO_READ)
|
||||
{
|
||||
sector = image.ReadSectors(doneSectors, _sectorsToRead);
|
||||
doneSectors += _sectorsToRead;
|
||||
sector = image.ReadSectors(doneSectors, SECTORS_TO_READ);
|
||||
doneSectors += SECTORS_TO_READ;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -30,6 +30,7 @@ using System;
|
||||
using System.IO;
|
||||
using Aaru.Checksums;
|
||||
using Aaru.CommonTypes;
|
||||
using Aaru.DiscImages;
|
||||
using Aaru.Filters;
|
||||
using FluentAssertions.Execution;
|
||||
using NUnit.Framework;
|
||||
@@ -41,67 +42,79 @@ namespace Aaru.Tests.Images
|
||||
{
|
||||
readonly string[] _testFiles =
|
||||
{
|
||||
"ext2.partclone.lz",
|
||||
"fat16.partclone.lz",
|
||||
"fat32.partclone.lz",
|
||||
"hfsplus.partclone.lz",
|
||||
"ntfs.partclone.lz",
|
||||
"ext2.partclone.lz", "fat16.partclone.lz", "fat32.partclone.lz", "hfsplus.partclone.lz", "ntfs.partclone.lz"
|
||||
};
|
||||
|
||||
|
||||
readonly ulong[] _sectors =
|
||||
{
|
||||
// ext2.partclone.lz
|
||||
127882,
|
||||
|
||||
// fat16.partclone.lz
|
||||
1012032,
|
||||
|
||||
// fat32.partclone.lz
|
||||
1023057,
|
||||
|
||||
// hfsplus.partclone.lz
|
||||
127882,
|
||||
|
||||
// ntfs.partclone.lz
|
||||
1023056,
|
||||
1023056
|
||||
};
|
||||
|
||||
|
||||
readonly uint[] _sectorSize =
|
||||
{
|
||||
// ext2.partclone.lz
|
||||
4096,
|
||||
|
||||
// fat16.partclone.lz
|
||||
512,
|
||||
|
||||
// fat32.partclone.lz
|
||||
512,
|
||||
|
||||
// hfsplus.partclone.lz
|
||||
4096,
|
||||
|
||||
// ntfs.partclone.lz
|
||||
512,
|
||||
512
|
||||
};
|
||||
|
||||
|
||||
readonly MediaType[] _mediaTypes =
|
||||
{
|
||||
// ext2.partclone.lz
|
||||
MediaType.GENERIC_HDD,
|
||||
|
||||
// fat16.partclone.lz
|
||||
MediaType.GENERIC_HDD,
|
||||
|
||||
// fat32.partclone.lz
|
||||
MediaType.GENERIC_HDD,
|
||||
|
||||
// hfsplus.partclone.lz
|
||||
MediaType.GENERIC_HDD,
|
||||
|
||||
// ntfs.partclone.lz
|
||||
MediaType.GENERIC_HDD,
|
||||
MediaType.GENERIC_HDD
|
||||
};
|
||||
|
||||
|
||||
readonly string[] _md5S =
|
||||
{
|
||||
// ext2.partclone.lz
|
||||
"ff239c91166b6b13fa826dd258b40666",
|
||||
|
||||
// fat16.partclone.lz
|
||||
"f98b1a51ca2e7bf047d84969a2392a3d",
|
||||
|
||||
// fat32.partclone.lz
|
||||
"1b0b5eb965a401f16fa8a07e303cd1c0",
|
||||
|
||||
// hfsplus.partclone.lz
|
||||
"880a6777d05c496901e930684abbecff",
|
||||
|
||||
// ntfs.partclone.lz
|
||||
"61cc3faa286364e7ad5bab18120c1151",
|
||||
"61cc3faa286364e7ad5bab18120c1151"
|
||||
};
|
||||
|
||||
readonly string _dataFolder = Path.Combine(Consts.TEST_FILES_ROOT, "Media image formats", "partclone");
|
||||
@@ -118,7 +131,7 @@ namespace Aaru.Tests.Images
|
||||
var filter = new LZip();
|
||||
filter.Open(_testFiles[i]);
|
||||
|
||||
var image = new DiscImages.PartClone();
|
||||
var image = new PartClone();
|
||||
bool opened = image.Open(filter);
|
||||
|
||||
Assert.AreEqual(true, opened, $"Open: {_testFiles[i]}");
|
||||
@@ -140,7 +153,7 @@ namespace Aaru.Tests.Images
|
||||
}
|
||||
|
||||
// How many sectors to read at once
|
||||
const uint _sectorsToRead = 256;
|
||||
const uint SECTORS_TO_READ = 256;
|
||||
|
||||
[Test]
|
||||
public void Hashes()
|
||||
@@ -154,7 +167,7 @@ namespace Aaru.Tests.Images
|
||||
var filter = new LZip();
|
||||
filter.Open(_testFiles[i]);
|
||||
|
||||
var image = new DiscImages.PartClone();
|
||||
var image = new PartClone();
|
||||
bool opened = image.Open(filter);
|
||||
ulong doneSectors = 0;
|
||||
|
||||
@@ -169,10 +182,10 @@ namespace Aaru.Tests.Images
|
||||
{
|
||||
byte[] sector;
|
||||
|
||||
if(image.Info.Sectors - doneSectors >= _sectorsToRead)
|
||||
if(image.Info.Sectors - doneSectors >= SECTORS_TO_READ)
|
||||
{
|
||||
sector = image.ReadSectors(doneSectors, _sectorsToRead);
|
||||
doneSectors += _sectorsToRead;
|
||||
sector = image.ReadSectors(doneSectors, SECTORS_TO_READ);
|
||||
doneSectors += SECTORS_TO_READ;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -129,7 +129,7 @@ namespace Aaru.Tests.Images.pce
|
||||
}
|
||||
|
||||
// How many sectors to read at once
|
||||
const uint _sectorsToRead = 256;
|
||||
const uint SECTORS_TO_READ = 256;
|
||||
|
||||
[Test]
|
||||
public void Hashes()
|
||||
@@ -158,10 +158,10 @@ namespace Aaru.Tests.Images.pce
|
||||
{
|
||||
byte[] sector;
|
||||
|
||||
if(image.Info.Sectors - doneSectors >= _sectorsToRead)
|
||||
if(image.Info.Sectors - doneSectors >= SECTORS_TO_READ)
|
||||
{
|
||||
sector = image.ReadSectors(doneSectors, _sectorsToRead);
|
||||
doneSectors += _sectorsToRead;
|
||||
sector = image.ReadSectors(doneSectors, SECTORS_TO_READ);
|
||||
doneSectors += SECTORS_TO_READ;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -385,7 +385,7 @@ namespace Aaru.Tests.Images.pce
|
||||
}
|
||||
|
||||
// How many sectors to read at once
|
||||
const uint _sectorsToRead = 256;
|
||||
const uint SECTORS_TO_READ = 256;
|
||||
|
||||
[Test]
|
||||
public void Hashes()
|
||||
@@ -414,10 +414,10 @@ namespace Aaru.Tests.Images.pce
|
||||
{
|
||||
byte[] sector;
|
||||
|
||||
if(image.Info.Sectors - doneSectors >= _sectorsToRead)
|
||||
if(image.Info.Sectors - doneSectors >= SECTORS_TO_READ)
|
||||
{
|
||||
sector = image.ReadSectors(doneSectors, _sectorsToRead);
|
||||
doneSectors += _sectorsToRead;
|
||||
sector = image.ReadSectors(doneSectors, SECTORS_TO_READ);
|
||||
doneSectors += SECTORS_TO_READ;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -392,7 +392,7 @@ namespace Aaru.Tests.Images.pce
|
||||
}
|
||||
|
||||
// How many sectors to read at once
|
||||
const uint _sectorsToRead = 256;
|
||||
const uint SECTORS_TO_READ = 256;
|
||||
|
||||
[Test]
|
||||
public void Hashes()
|
||||
@@ -421,10 +421,10 @@ namespace Aaru.Tests.Images.pce
|
||||
{
|
||||
byte[] sector;
|
||||
|
||||
if(image.Info.Sectors - doneSectors >= _sectorsToRead)
|
||||
if(image.Info.Sectors - doneSectors >= SECTORS_TO_READ)
|
||||
{
|
||||
sector = image.ReadSectors(doneSectors, _sectorsToRead);
|
||||
doneSectors += _sectorsToRead;
|
||||
sector = image.ReadSectors(doneSectors, SECTORS_TO_READ);
|
||||
doneSectors += SECTORS_TO_READ;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user