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

@@ -37,6 +37,7 @@ using System.Text;
using DiscImageChef.CommonTypes;
using DiscImageChef.CommonTypes.Interfaces;
using Schemas;
using Marshal = DiscImageChef.Helpers.Marshal;
namespace DiscImageChef.Filesystems
{
@@ -174,7 +175,7 @@ namespace DiscImageChef.Filesystems
if(sbSectorOff + partition.Start >= partition.End) return false;
int sbSizeInBytes = Marshal.SizeOf(typeof(ext2FSSuperBlock));
int sbSizeInBytes = Marshal.SizeOf<ext2FSSuperBlock>();
uint sbSizeInSectors = (uint)(sbSizeInBytes / imagePlugin.Info.SectorSize);
if(sbSizeInBytes % imagePlugin.Info.SectorSize > 0) sbSizeInSectors++;
@@ -199,7 +200,7 @@ namespace DiscImageChef.Filesystems
bool ext3 = false;
bool ext4 = false;
int sbSizeInBytes = Marshal.SizeOf(typeof(ext2FSSuperBlock));
int sbSizeInBytes = Marshal.SizeOf<ext2FSSuperBlock>();
uint sbSizeInSectors = (uint)(sbSizeInBytes / imagePlugin.Info.SectorSize);
if(sbSizeInBytes % imagePlugin.Info.SectorSize > 0) sbSizeInSectors++;
@@ -209,7 +210,7 @@ namespace DiscImageChef.Filesystems
byte[] sbSector = imagePlugin.ReadSectors(sbSectorOff + partition.Start, sbSizeInSectors);
byte[] sblock = new byte[sbSizeInBytes];
Array.Copy(sbSector, sbOff, sblock, 0, sbSizeInBytes);
ext2FSSuperBlock supblk = Helpers.Marshal.ByteArrayToStructureLittleEndian<ext2FSSuperBlock>(sblock);
ext2FSSuperBlock supblk = Marshal.ByteArrayToStructureLittleEndian<ext2FSSuperBlock>(sblock);
XmlFsType = new FileSystemType();