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:
@@ -31,8 +31,8 @@
|
||||
// ****************************************************************************/
|
||||
|
||||
using System.IO;
|
||||
using System.Runtime.InteropServices;
|
||||
using DiscImageChef.CommonTypes.Interfaces;
|
||||
using DiscImageChef.Helpers;
|
||||
|
||||
namespace DiscImageChef.DiscImages
|
||||
{
|
||||
@@ -44,20 +44,20 @@ namespace DiscImageChef.DiscImages
|
||||
|
||||
if(stream.Length < 512) return false;
|
||||
|
||||
stream.Seek(-Marshal.SizeOf(footer), SeekOrigin.End);
|
||||
byte[] footerB = new byte[Marshal.SizeOf(footer)];
|
||||
stream.Seek(-Marshal.SizeOf<UdifFooter>(), SeekOrigin.End);
|
||||
byte[] footerB = new byte[Marshal.SizeOf<UdifFooter>()];
|
||||
|
||||
stream.Read(footerB, 0, Marshal.SizeOf(footer));
|
||||
footer = Helpers.Marshal.ByteArrayToStructureBigEndian<UdifFooter>(footerB);
|
||||
stream.Read(footerB, 0, Marshal.SizeOf<UdifFooter>());
|
||||
footer = Marshal.ByteArrayToStructureBigEndian<UdifFooter>(footerB);
|
||||
|
||||
if(footer.signature == UDIF_SIGNATURE) return true;
|
||||
|
||||
// Old UDIF as created by DiskCopy 6.5 using "OBSOLETE" format. (DiskCopy 5 rumored format?)
|
||||
stream.Seek(0, SeekOrigin.Begin);
|
||||
byte[] headerB = new byte[Marshal.SizeOf(footer)];
|
||||
byte[] headerB = new byte[Marshal.SizeOf<UdifFooter>()];
|
||||
|
||||
stream.Read(headerB, 0, Marshal.SizeOf(footer));
|
||||
footer = Helpers.Marshal.ByteArrayToStructureBigEndian<UdifFooter>(headerB);
|
||||
stream.Read(headerB, 0, Marshal.SizeOf<UdifFooter>());
|
||||
footer = Marshal.ByteArrayToStructureBigEndian<UdifFooter>(headerB);
|
||||
|
||||
return footer.signature == UDIF_SIGNATURE;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user