🐛Move checksum initializers to instance constructors.

This commit is contained in:
2018-02-03 17:39:49 +00:00
parent 4b4671b4ef
commit b50b6c29ca
61 changed files with 1429 additions and 1599 deletions

View File

@@ -65,21 +65,20 @@ namespace DiscImageChef.Tests.Images
{
for(int i = 0; i < testfiles.Length; i++)
{
string location = Path.Combine(Consts.TestFilesRoot, "images", "2mg", testfiles[i]);
IFilter filter = new LZip();
string location = Path.Combine(Consts.TestFilesRoot, "images", "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(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]);
Assert.AreEqual(mediatypes[i], image.Info.MediaType, testfiles[i]);
// How many sectors to read at once
const uint SECTORS_TO_READ = 256;
ulong doneSectors = 0;
ulong doneSectors = 0;
Md5Context ctx = new Md5Context();
ctx.Init();
while(doneSectors < image.Info.Sectors)
{
@@ -87,13 +86,13 @@ namespace DiscImageChef.Tests.Images
if(image.Info.Sectors - doneSectors >= SECTORS_TO_READ)
{
sector = image.ReadSectors(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;
sector = image.ReadSectors(doneSectors, (uint)(image.Info.Sectors - doneSectors));
doneSectors += image.Info.Sectors - doneSectors;
}
ctx.Update(sector);

View File

@@ -69,21 +69,20 @@ namespace DiscImageChef.Tests.Images
{
for(int i = 0; i < testfiles.Length; i++)
{
string location = Path.Combine(Consts.TestFilesRoot, "images", "anex86", testfiles[i]);
IFilter filter = new LZip();
string location = Path.Combine(Consts.TestFilesRoot, "images", "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(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]);
Assert.AreEqual(mediatypes[i], image.Info.MediaType, testfiles[i]);
// How many sectors to read at once
const uint SECTORS_TO_READ = 256;
ulong doneSectors = 0;
ulong doneSectors = 0;
Md5Context ctx = new Md5Context();
ctx.Init();
while(doneSectors < image.Info.Sectors)
{
@@ -91,13 +90,13 @@ namespace DiscImageChef.Tests.Images
if(image.Info.Sectors - doneSectors >= SECTORS_TO_READ)
{
sector = image.ReadSectors(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;
sector = image.ReadSectors(doneSectors, (uint)(image.Info.Sectors - doneSectors));
doneSectors += image.Info.Sectors - doneSectors;
}
ctx.Update(sector);

View File

@@ -83,21 +83,20 @@ namespace DiscImageChef.Tests.Images
{
for(int i = 0; i < testfiles.Length; i++)
{
string location = Path.Combine(Consts.TestFilesRoot, "images", "ciscopy", testfiles[i]);
IFilter filter = new LZip();
string location = Path.Combine(Consts.TestFilesRoot, "images", "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(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]);
Assert.AreEqual(mediatypes[i], image.Info.MediaType, testfiles[i]);
// How many sectors to read at once
const uint SECTORS_TO_READ = 256;
ulong doneSectors = 0;
ulong doneSectors = 0;
Md5Context ctx = new Md5Context();
ctx.Init();
while(doneSectors < image.Info.Sectors)
{
@@ -105,13 +104,13 @@ namespace DiscImageChef.Tests.Images
if(image.Info.Sectors - doneSectors >= SECTORS_TO_READ)
{
sector = image.ReadSectors(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;
sector = image.ReadSectors(doneSectors, (uint)(image.Info.Sectors - doneSectors));
doneSectors += image.Info.Sectors - doneSectors;
}
ctx.Update(sector);

View File

@@ -71,17 +71,16 @@ namespace DiscImageChef.Tests.Images
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]);
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 SECTORS_TO_READ = 256;
ulong doneSectors = 0;
Md5Context ctx = new Md5Context();
ctx.Init();
while(doneSectors < image.Info.Sectors)
{

View File

@@ -85,21 +85,20 @@ namespace DiscImageChef.Tests.Images
{
for(int i = 0; i < testfiles.Length; i++)
{
string location = Path.Combine(Consts.TestFilesRoot, "images", "d88", testfiles[i]);
IFilter filter = new LZip();
string location = Path.Combine(Consts.TestFilesRoot, "images", "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(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]);
Assert.AreEqual(mediatypes[i], image.Info.MediaType, testfiles[i]);
// How many sectors to read at once
const uint SECTORS_TO_READ = 256;
ulong doneSectors = 0;
ulong doneSectors = 0;
Md5Context ctx = new Md5Context();
ctx.Init();
while(doneSectors < image.Info.Sectors)
{
@@ -107,13 +106,13 @@ namespace DiscImageChef.Tests.Images
if(image.Info.Sectors - doneSectors >= SECTORS_TO_READ)
{
sector = image.ReadSectors(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;
sector = image.ReadSectors(doneSectors, (uint)(image.Info.Sectors - doneSectors));
doneSectors += image.Info.Sectors - doneSectors;
}
ctx.Update(sector);

View File

@@ -66,21 +66,20 @@ namespace DiscImageChef.Tests.Images
{
for(int i = 0; i < testfiles.Length; i++)
{
string location = Path.Combine(Consts.TestFilesRoot, "images", "dart", testfiles[i]);
IFilter filter = new LZip();
string location = Path.Combine(Consts.TestFilesRoot, "images", "dart", 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(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]);
Assert.AreEqual(mediatypes[i], image.Info.MediaType, testfiles[i]);
// How many sectors to read at once
const uint SECTORS_TO_READ = 256;
ulong doneSectors = 0;
ulong doneSectors = 0;
Md5Context ctx = new Md5Context();
ctx.Init();
while(doneSectors < image.Info.Sectors)
{
@@ -88,13 +87,13 @@ namespace DiscImageChef.Tests.Images
if(image.Info.Sectors - doneSectors >= SECTORS_TO_READ)
{
sector = image.ReadSectors(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;
sector = image.ReadSectors(doneSectors, (uint)(image.Info.Sectors - doneSectors));
doneSectors += image.Info.Sectors - doneSectors;
}
ctx.Update(sector);

View File

@@ -86,21 +86,20 @@ namespace DiscImageChef.Tests.Images
{
for(int i = 0; i < testfiles.Length; i++)
{
string location = Path.Combine(Consts.TestFilesRoot, "images", "", testfiles[i]);
IFilter filter = new LZip();
string location = Path.Combine(Consts.TestFilesRoot, "images", "", 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(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]);
Assert.AreEqual(mediatypes[i], image.Info.MediaType, testfiles[i]);
// How many sectors to read at once
const uint SECTORS_TO_READ = 256;
ulong doneSectors = 0;
ulong doneSectors = 0;
Md5Context ctx = new Md5Context();
ctx.Init();
while(doneSectors < image.Info.Sectors)
{
@@ -108,13 +107,13 @@ namespace DiscImageChef.Tests.Images
if(image.Info.Sectors - doneSectors >= SECTORS_TO_READ)
{
sector = image.ReadSectors(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;
sector = image.ReadSectors(doneSectors, (uint)(image.Info.Sectors - doneSectors));
doneSectors += image.Info.Sectors - doneSectors;
}
ctx.Update(sector);