mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
Move common Apple filesystem constants to common class.
This commit is contained in:
@@ -38,5 +38,11 @@ namespace DiscImageChef.Filesystems
|
||||
{
|
||||
/// <summary>"LK", HFS bootblock magic</summary>
|
||||
internal const ushort BB_MAGIC = 0x4C4B;
|
||||
/// <summary>"BD", HFS magic</summary>
|
||||
internal const ushort HFS_MAGIC = 0x4244;
|
||||
/// <summary>"H+", HFS+ magic</summary>
|
||||
internal const ushort HFSP_MAGIC = 0x482B;
|
||||
/// <summary>"HX", HFSX magic</summary>
|
||||
internal const ushort HFSX_MAGIC = 0x4858;
|
||||
}
|
||||
}
|
||||
@@ -36,11 +36,6 @@ namespace DiscImageChef.Filesystems
|
||||
// https://developer.apple.com/legacy/library/documentation/mac/pdf/Files/File_Manager.pdf
|
||||
public partial class AppleHFS
|
||||
{
|
||||
/// <summary>"BD", HFS magic</summary>
|
||||
const ushort HFS_MAGIC = 0x4244;
|
||||
/// <summary>"H+", HFS+ magic</summary>
|
||||
const ushort HFSP_MAGIC = 0x482B;
|
||||
|
||||
/// <summary>Parent ID of the root directory.</summary>
|
||||
const uint kRootParentCnid = 1;
|
||||
/// <summary>Directory ID of the root directory.</summary>
|
||||
|
||||
@@ -64,13 +64,13 @@ namespace DiscImageChef.Filesystems
|
||||
{
|
||||
drSigWord = BigEndianBitConverter.ToUInt16(mdbSector, offset);
|
||||
|
||||
if(drSigWord != HFS_MAGIC)
|
||||
if(drSigWord != AppleCommon.HFS_MAGIC)
|
||||
continue;
|
||||
|
||||
drSigWord =
|
||||
BigEndianBitConverter.ToUInt16(mdbSector, offset + 0x7C); // Seek to embedded HFS+ signature
|
||||
|
||||
return drSigWord != HFSP_MAGIC;
|
||||
return drSigWord != AppleCommon.HFSP_MAGIC;
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -78,12 +78,12 @@ namespace DiscImageChef.Filesystems
|
||||
mdbSector = imagePlugin.ReadSector(2 + partition.Start);
|
||||
drSigWord = BigEndianBitConverter.ToUInt16(mdbSector, 0);
|
||||
|
||||
if(drSigWord != HFS_MAGIC)
|
||||
if(drSigWord != AppleCommon.HFS_MAGIC)
|
||||
return false;
|
||||
|
||||
drSigWord = BigEndianBitConverter.ToUInt16(mdbSector, 0x7C); // Seek to embedded HFS+ signature
|
||||
|
||||
return drSigWord != HFSP_MAGIC;
|
||||
return drSigWord != AppleCommon.HFSP_MAGIC;
|
||||
}
|
||||
|
||||
return false;
|
||||
@@ -116,7 +116,7 @@ namespace DiscImageChef.Filesystems
|
||||
{
|
||||
drSigWord = BigEndianBitConverter.ToUInt16(tmpSector, offset);
|
||||
|
||||
if(drSigWord != HFS_MAGIC)
|
||||
if(drSigWord != AppleCommon.HFS_MAGIC)
|
||||
continue;
|
||||
|
||||
bbSector = new byte[1024];
|
||||
@@ -139,7 +139,7 @@ namespace DiscImageChef.Filesystems
|
||||
mdbSector = imagePlugin.ReadSector(2 + partition.Start);
|
||||
drSigWord = BigEndianBitConverter.ToUInt16(mdbSector, 0);
|
||||
|
||||
if(drSigWord == HFS_MAGIC)
|
||||
if(drSigWord == AppleCommon.HFS_MAGIC)
|
||||
bbSector = imagePlugin.ReadSector(partition.Start);
|
||||
else
|
||||
return;
|
||||
@@ -225,7 +225,7 @@ namespace DiscImageChef.Filesystems
|
||||
mdb.drFndrInfo7 != 0)
|
||||
sb.AppendFormat("Mac OS X Volume ID: {0:X8}{1:X8}", mdb.drFndrInfo6, mdb.drFndrInfo7).AppendLine();
|
||||
|
||||
if(mdb.drEmbedSigWord == HFSP_MAGIC)
|
||||
if(mdb.drEmbedSigWord == AppleCommon.HFSP_MAGIC)
|
||||
{
|
||||
sb.AppendLine("Volume wraps a HFS+ volume.");
|
||||
sb.AppendFormat("Starting block of the HFS+ volume: {0}", mdb.xdrStABNt).AppendLine();
|
||||
|
||||
@@ -43,13 +43,6 @@ namespace DiscImageChef.Filesystems
|
||||
// Information from Apple TechNote 1150: https://developer.apple.com/legacy/library/technotes/tn/tn1150.html
|
||||
public class AppleHFSPlus : IFilesystem
|
||||
{
|
||||
/// <summary>"BD", HFS magic</summary>
|
||||
const ushort HFS_MAGIC = 0x4244;
|
||||
/// <summary>"H+", HFS+ magic</summary>
|
||||
const ushort HFSP_MAGIC = 0x482B;
|
||||
/// <summary>"HX", HFSX magic</summary>
|
||||
const ushort HFSX_MAGIC = 0x4858;
|
||||
|
||||
public FileSystemType XmlFsType { get; private set; }
|
||||
public Encoding Encoding { get; private set; }
|
||||
public string Name => "Apple HFS+ filesystem";
|
||||
@@ -72,11 +65,11 @@ namespace DiscImageChef.Filesystems
|
||||
|
||||
ushort drSigWord = BigEndianBitConverter.ToUInt16(vhSector, 0x400);
|
||||
|
||||
if(drSigWord == HFS_MAGIC) // "BD"
|
||||
if(drSigWord == AppleCommon.HFS_MAGIC) // "BD"
|
||||
{
|
||||
drSigWord = BigEndianBitConverter.ToUInt16(vhSector, 0x47C); // Read embedded HFS+ signature
|
||||
|
||||
if(drSigWord == HFSP_MAGIC) // "H+"
|
||||
if(drSigWord == AppleCommon.HFSP_MAGIC) // "H+"
|
||||
{
|
||||
ushort xdrStABNt = BigEndianBitConverter.ToUInt16(vhSector, 0x47E);
|
||||
|
||||
@@ -96,7 +89,7 @@ namespace DiscImageChef.Filesystems
|
||||
|
||||
drSigWord = BigEndianBitConverter.ToUInt16(vhSector, 0x400);
|
||||
|
||||
return drSigWord == HFSP_MAGIC || drSigWord == HFSX_MAGIC;
|
||||
return drSigWord == AppleCommon.HFSP_MAGIC || drSigWord == AppleCommon.HFSX_MAGIC;
|
||||
}
|
||||
|
||||
public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information,
|
||||
@@ -119,11 +112,11 @@ namespace DiscImageChef.Filesystems
|
||||
|
||||
ushort drSigWord = BigEndianBitConverter.ToUInt16(vhSector, 0x400);
|
||||
|
||||
if(drSigWord == HFS_MAGIC) // "BD"
|
||||
if(drSigWord == AppleCommon.HFS_MAGIC) // "BD"
|
||||
{
|
||||
drSigWord = BigEndianBitConverter.ToUInt16(vhSector, 0x47C); // Read embedded HFS+ signature
|
||||
|
||||
if(drSigWord == HFSP_MAGIC) // "H+"
|
||||
if(drSigWord == AppleCommon.HFSP_MAGIC) // "H+"
|
||||
{
|
||||
ushort xdrStABNt = BigEndianBitConverter.ToUInt16(vhSector, 0x47E);
|
||||
|
||||
@@ -150,8 +143,8 @@ namespace DiscImageChef.Filesystems
|
||||
|
||||
vh.signature = BigEndianBitConverter.ToUInt16(vhSector, 0x400);
|
||||
|
||||
if(vh.signature != HFSP_MAGIC &&
|
||||
vh.signature != HFSX_MAGIC)
|
||||
if(vh.signature != AppleCommon.HFSP_MAGIC &&
|
||||
vh.signature != AppleCommon.HFSX_MAGIC)
|
||||
return;
|
||||
|
||||
var sb = new StringBuilder();
|
||||
|
||||
Reference in New Issue
Block a user