mirror of
https://github.com/claunia/romrepomgr.git
synced 2025-12-16 19:24:51 +00:00
Ensure file reading operations return the expected data.
This commit is contained in:
@@ -83,8 +83,8 @@ public static class FAT
|
||||
var bpbSector = new byte[512];
|
||||
var fatSector = new byte[512];
|
||||
imageStream.Position = 0;
|
||||
imageStream.Read(bpbSector, 0, 512);
|
||||
imageStream.Read(fatSector, 0, 512);
|
||||
imageStream.EnsureRead(bpbSector, 0, 512);
|
||||
imageStream.EnsureRead(fatSector, 0, 512);
|
||||
|
||||
Array.Copy(bpbSector, 0x02, atariOem, 0, 6);
|
||||
Array.Copy(bpbSector, 0x03, dosOem, 0, 8);
|
||||
@@ -202,12 +202,12 @@ public static class FAT
|
||||
// First FAT1 sector resides at LBA 0x14
|
||||
var fat1Sector0 = new byte[512];
|
||||
imageStream.Position = 0x14 * 512;
|
||||
imageStream.Read(fat1Sector0, 0, 512);
|
||||
imageStream.EnsureRead(fat1Sector0, 0, 512);
|
||||
|
||||
// First FAT2 sector resides at LBA 0x1A
|
||||
var fat2Sector0 = new byte[512];
|
||||
imageStream.Position = 0x1A * 512;
|
||||
imageStream.Read(fat2Sector0, 0, 512);
|
||||
imageStream.EnsureRead(fat2Sector0, 0, 512);
|
||||
bool equalFatIds = fat1Sector0[0] == fat2Sector0[0] && fat1Sector0[1] == fat2Sector0[1];
|
||||
|
||||
// Volume is software interleaved 2:1
|
||||
@@ -221,7 +221,7 @@ public static class FAT
|
||||
})
|
||||
{
|
||||
imageStream.Position = position * 512;
|
||||
imageStream.Read(tmp, 0, 512);
|
||||
imageStream.EnsureRead(tmp, 0, 512);
|
||||
rootMs.Write(tmp, 0, tmp.Length);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user