Override Marshal.SizeOf in Helpers and use it instead of System's.

This commit is contained in:
2019-03-01 07:35:22 +00:00
parent 0ec558da55
commit e14c19279a
116 changed files with 1138 additions and 1182 deletions

View File

@@ -516,17 +516,17 @@ namespace DiscImageChef.Filesystems
if(imagePlugin.Info.SectorSize >= 256 && !useHumanBpb)
{
atariBpb = Helpers.Marshal.ByteArrayToStructureLittleEndian<AtariParameterBlock>(bpbSector);
msxBpb = Helpers.Marshal.ByteArrayToStructureLittleEndian<MsxParameterBlock>(bpbSector);
dos2Bpb = Helpers.Marshal.ByteArrayToStructureLittleEndian<BiosParameterBlock2>(bpbSector);
dos30Bpb = Helpers.Marshal.ByteArrayToStructureLittleEndian<BiosParameterBlock30>(bpbSector);
dos32Bpb = Helpers.Marshal.ByteArrayToStructureLittleEndian<BiosParameterBlock32>(bpbSector);
dos33Bpb = Helpers.Marshal.ByteArrayToStructureLittleEndian<BiosParameterBlock33>(bpbSector);
shortEbpb = Helpers.Marshal.ByteArrayToStructureLittleEndian<BiosParameterBlockShortEbpb>(bpbSector);
ebpb = Helpers.Marshal.ByteArrayToStructureLittleEndian<BiosParameterBlockEbpb>(bpbSector);
shortFat32Bpb = Helpers.Marshal.ByteArrayToStructureLittleEndian<Fat32ParameterBlockShort>(bpbSector);
fat32Bpb = Helpers.Marshal.ByteArrayToStructureLittleEndian<Fat32ParameterBlock>(bpbSector);
apricotBpb = Helpers.Marshal.ByteArrayToStructureLittleEndian<ApricotLabel>(bpbSector);
atariBpb = Marshal.ByteArrayToStructureLittleEndian<AtariParameterBlock>(bpbSector);
msxBpb = Marshal.ByteArrayToStructureLittleEndian<MsxParameterBlock>(bpbSector);
dos2Bpb = Marshal.ByteArrayToStructureLittleEndian<BiosParameterBlock2>(bpbSector);
dos30Bpb = Marshal.ByteArrayToStructureLittleEndian<BiosParameterBlock30>(bpbSector);
dos32Bpb = Marshal.ByteArrayToStructureLittleEndian<BiosParameterBlock32>(bpbSector);
dos33Bpb = Marshal.ByteArrayToStructureLittleEndian<BiosParameterBlock33>(bpbSector);
shortEbpb = Marshal.ByteArrayToStructureLittleEndian<BiosParameterBlockShortEbpb>(bpbSector);
ebpb = Marshal.ByteArrayToStructureLittleEndian<BiosParameterBlockEbpb>(bpbSector);
shortFat32Bpb = Marshal.ByteArrayToStructureLittleEndian<Fat32ParameterBlockShort>(bpbSector);
fat32Bpb = Marshal.ByteArrayToStructureLittleEndian<Fat32ParameterBlock>(bpbSector);
apricotBpb = Marshal.ByteArrayToStructureLittleEndian<ApricotLabel>(bpbSector);
int bitsInBpsAtari = CountBits.Count(atariBpb.bps);
int bitsInBpsMsx = CountBits.Count(msxBpb.bps);
@@ -1095,8 +1095,8 @@ namespace DiscImageChef.Filesystems
if(fat32Bpb.fsinfo_sector + partition.Start <= partition.End)
{
byte[] fsinfoSector = imagePlugin.ReadSector(fat32Bpb.fsinfo_sector + partition.Start);
FsInfoSector fsInfo = Helpers.Marshal.ByteArrayToStructureLittleEndian<FsInfoSector>(fsinfoSector);
byte[] fsinfoSector = imagePlugin.ReadSector(fat32Bpb.fsinfo_sector + partition.Start);
FsInfoSector fsInfo = Marshal.ByteArrayToStructureLittleEndian<FsInfoSector>(fsinfoSector);
if(fsInfo.signature1 == FSINFO_SIGNATURE1 && fsInfo.signature2 == FSINFO_SIGNATURE2 &&
fsInfo.signature3 == FSINFO_SIGNATURE3)
@@ -1530,7 +1530,7 @@ namespace DiscImageChef.Filesystems
if(rootDirectory[i + 0x0B] != 0x08 && rootDirectory[i + 0x0B] != 0x28) continue;
DirectoryEntry entry =
Helpers.Marshal.ByteArrayToStructureLittleEndian<DirectoryEntry>(rootDirectory, i, 32);
Marshal.ByteArrayToStructureLittleEndian<DirectoryEntry>(rootDirectory, i, 32);
byte[] fullname = new byte[11];
Array.Copy(entry.filename, 0, fullname, 0, 8);