mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
Override Marshal.SizeOf in Helpers and use it instead of System's.
This commit is contained in:
@@ -32,9 +32,9 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using DiscImageChef.CommonTypes.Structs;
|
||||
using DiscImageChef.Helpers;
|
||||
|
||||
namespace DiscImageChef.Filesystems.CPM
|
||||
{
|
||||
@@ -71,8 +71,7 @@ namespace DiscImageChef.Filesystems.CPM
|
||||
|
||||
for(int off = 0; off < directory.Length; off += 32)
|
||||
{
|
||||
DirectoryEntry entry =
|
||||
Helpers.Marshal.ByteArrayToStructureLittleEndian<DirectoryEntry>(directory, off, 32);
|
||||
DirectoryEntry entry = Marshal.ByteArrayToStructureLittleEndian<DirectoryEntry>(directory, off, 32);
|
||||
|
||||
if((entry.statusUser & 0x7F) < 0x20)
|
||||
{
|
||||
|
||||
@@ -33,11 +33,11 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using DiscImageChef.CommonTypes;
|
||||
using DiscImageChef.CommonTypes.Interfaces;
|
||||
using DiscImageChef.Console;
|
||||
using DiscImageChef.Helpers;
|
||||
using Schemas;
|
||||
|
||||
namespace DiscImageChef.Filesystems.CPM
|
||||
@@ -181,7 +181,7 @@ namespace DiscImageChef.Filesystems.CPM
|
||||
|
||||
// Read the superblock
|
||||
AmstradSuperBlock amsSb =
|
||||
Helpers.Marshal.ByteArrayToStructureLittleEndian<AmstradSuperBlock>(sector, amsSbOffset, 16);
|
||||
Marshal.ByteArrayToStructureLittleEndian<AmstradSuperBlock>(sector, amsSbOffset, 16);
|
||||
|
||||
// Check that format byte and sidedness indicate the same number of sizes
|
||||
if(amsSb.format == 0 && (amsSb.sidedness & 0x02) == 0 ||
|
||||
@@ -297,8 +297,7 @@ namespace DiscImageChef.Filesystems.CPM
|
||||
if(sum == 0)
|
||||
{
|
||||
// Read the superblock
|
||||
HardDiskSuperBlock hddSb =
|
||||
Helpers.Marshal.ByteArrayToStructureLittleEndian<HardDiskSuperBlock>(sector);
|
||||
HardDiskSuperBlock hddSb = Marshal.ByteArrayToStructureLittleEndian<HardDiskSuperBlock>(sector);
|
||||
|
||||
// Calculate volume size
|
||||
sectorSize = (ulong)(hddSb.recordsPerSector * 128);
|
||||
|
||||
@@ -36,12 +36,12 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using DiscImageChef.CommonTypes;
|
||||
using DiscImageChef.CommonTypes.Interfaces;
|
||||
using DiscImageChef.CommonTypes.Structs;
|
||||
using DiscImageChef.Console;
|
||||
using DiscImageChef.Helpers;
|
||||
using Schemas;
|
||||
using FileAttributes = DiscImageChef.CommonTypes.Structs.FileAttributes;
|
||||
using FileSystemInfo = DiscImageChef.CommonTypes.Structs.FileSystemInfo;
|
||||
@@ -224,7 +224,7 @@ namespace DiscImageChef.Filesystems.CPM
|
||||
if(allocationBlocks.Count > 256)
|
||||
{
|
||||
DirectoryEntry16 entry =
|
||||
Helpers.Marshal.ByteArrayToStructureLittleEndian<DirectoryEntry16>(directory, dOff, 32);
|
||||
Marshal.ByteArrayToStructureLittleEndian<DirectoryEntry16>(directory, dOff, 32);
|
||||
|
||||
bool hidden = (entry.statusUser & 0x80) == 0x80;
|
||||
bool rdOnly = (entry.filename[0] & 0x80) == 0x80 || (entry.extension[0] & 0x80) == 0x80;
|
||||
@@ -311,7 +311,7 @@ namespace DiscImageChef.Filesystems.CPM
|
||||
else
|
||||
{
|
||||
DirectoryEntry entry =
|
||||
Helpers.Marshal.ByteArrayToStructureLittleEndian<DirectoryEntry>(directory, dOff, 32);
|
||||
Marshal.ByteArrayToStructureLittleEndian<DirectoryEntry>(directory, dOff, 32);
|
||||
|
||||
bool hidden = (entry.statusUser & 0x80) == 0x80;
|
||||
bool rdOnly = (entry.filename[0] & 0x80) == 0x80 || (entry.extension[0] & 0x80) == 0x80;
|
||||
@@ -398,8 +398,7 @@ namespace DiscImageChef.Filesystems.CPM
|
||||
// A password entry (or a file entry in PDOS, but this does not handle that case)
|
||||
else if((directory[dOff] & 0x7F) >= 0x10 && (directory[dOff] & 0x7F) < 0x20)
|
||||
{
|
||||
PasswordEntry entry =
|
||||
Helpers.Marshal.ByteArrayToStructureLittleEndian<PasswordEntry>(directory, dOff, 32);
|
||||
PasswordEntry entry = Marshal.ByteArrayToStructureLittleEndian<PasswordEntry>(directory, dOff, 32);
|
||||
|
||||
int user = entry.userNumber & 0x0F;
|
||||
|
||||
@@ -443,7 +442,7 @@ namespace DiscImageChef.Filesystems.CPM
|
||||
{
|
||||
case 0x20:
|
||||
LabelEntry labelEntry =
|
||||
Helpers.Marshal.ByteArrayToStructureLittleEndian<LabelEntry>(directory, dOff, 32);
|
||||
Marshal.ByteArrayToStructureLittleEndian<LabelEntry>(directory, dOff, 32);
|
||||
|
||||
// The volume label defines if one of the fields in CP/M 3 timestamp is a creation or an
|
||||
// access time
|
||||
@@ -476,7 +475,7 @@ namespace DiscImageChef.Filesystems.CPM
|
||||
directory[dOff + 30] == 0x00 && directory[dOff + 31] == 0x00)
|
||||
{
|
||||
DateEntry dateEntry =
|
||||
Helpers.Marshal.ByteArrayToStructureLittleEndian<DateEntry>(directory, dOff, 32);
|
||||
Marshal.ByteArrayToStructureLittleEndian<DateEntry>(directory, dOff, 32);
|
||||
|
||||
FileEntryInfo fInfo;
|
||||
|
||||
@@ -529,8 +528,7 @@ namespace DiscImageChef.Filesystems.CPM
|
||||
else if(directory[dOff + 1] == 0x00)
|
||||
{
|
||||
TrdPartyDateEntry trdPartyDateEntry =
|
||||
Helpers.Marshal.ByteArrayToStructureLittleEndian<TrdPartyDateEntry>(directory, dOff,
|
||||
32);
|
||||
Marshal.ByteArrayToStructureLittleEndian<TrdPartyDateEntry>(directory, dOff, 32);
|
||||
|
||||
FileEntryInfo fInfo;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user