mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
Fix structure naming in Apple filesystems.
This commit is contained in:
@@ -41,26 +41,24 @@ namespace DiscImageChef.Filesystems.AppleMFS
|
||||
// Information from Inside Macintosh Volume II
|
||||
public partial class AppleMFS : IReadOnlyFilesystem
|
||||
{
|
||||
bool mounted;
|
||||
bool debug;
|
||||
IMediaImage device;
|
||||
ulong partitionStart;
|
||||
|
||||
Dictionary<uint, string> idToFilename;
|
||||
Dictionary<uint, MFS_FileEntry> idToEntry;
|
||||
Dictionary<string, uint> filenameToId;
|
||||
|
||||
MFS_MasterDirectoryBlock volMDB;
|
||||
byte[] bootBlocks;
|
||||
byte[] mdbBlocks;
|
||||
byte[] directoryBlocks;
|
||||
byte[] blockMapBytes;
|
||||
uint[] blockMap;
|
||||
int sectorsPerBlock;
|
||||
byte[] bootTags;
|
||||
byte[] mdbTags;
|
||||
byte[] directoryTags;
|
||||
byte[] bitmapTags;
|
||||
bool mounted;
|
||||
bool debug;
|
||||
IMediaImage device;
|
||||
ulong partitionStart;
|
||||
Dictionary<uint, string> idToFilename;
|
||||
Dictionary<uint, FileEntry> idToEntry;
|
||||
Dictionary<string, uint> filenameToId;
|
||||
MasterDirectoryBlock volMDB;
|
||||
byte[] bootBlocks;
|
||||
byte[] mdbBlocks;
|
||||
byte[] directoryBlocks;
|
||||
byte[] blockMapBytes;
|
||||
uint[] blockMap;
|
||||
int sectorsPerBlock;
|
||||
byte[] bootTags;
|
||||
byte[] mdbTags;
|
||||
byte[] directoryTags;
|
||||
byte[] bitmapTags;
|
||||
|
||||
public FileSystemType XmlFsType { get; private set; }
|
||||
public string Name => "Apple Macintosh File System";
|
||||
@@ -70,11 +68,16 @@ namespace DiscImageChef.Filesystems.AppleMFS
|
||||
|
||||
// TODO: Implement Finder namespace (requires decoding Desktop database)
|
||||
public IEnumerable<(string name, Type type, string description)> SupportedOptions =>
|
||||
new (string name, Type type, string description)[] { };
|
||||
new (string name, Type type, string description)[]
|
||||
{ };
|
||||
|
||||
public Dictionary<string, string> Namespaces => null;
|
||||
|
||||
static Dictionary<string, string> GetDefaultOptions() =>
|
||||
new Dictionary<string, string> {{"debug", false.ToString()}};
|
||||
static Dictionary<string, string> GetDefaultOptions() => new Dictionary<string, string>
|
||||
{
|
||||
{
|
||||
"debug", false.ToString()
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -73,19 +73,19 @@ namespace DiscImageChef.Filesystems.AppleMFS
|
||||
bool FillDirectory()
|
||||
{
|
||||
idToFilename = new Dictionary<uint, string>();
|
||||
idToEntry = new Dictionary<uint, MFS_FileEntry>();
|
||||
idToEntry = new Dictionary<uint, FileEntry>();
|
||||
filenameToId = new Dictionary<string, uint>();
|
||||
|
||||
int offset = 0;
|
||||
|
||||
while(offset + 51 < directoryBlocks.Length)
|
||||
{
|
||||
var entry = new MFS_FileEntry
|
||||
var entry = new FileEntry
|
||||
{
|
||||
flFlags = (MFS_FileFlags)directoryBlocks[offset + 0]
|
||||
flFlags = (FileFlags)directoryBlocks[offset + 0]
|
||||
};
|
||||
|
||||
if(!entry.flFlags.HasFlag(MFS_FileFlags.Used))
|
||||
if(!entry.flFlags.HasFlag(FileFlags.Used))
|
||||
break;
|
||||
|
||||
entry.flTyp = directoryBlocks[offset + 1];
|
||||
@@ -108,10 +108,10 @@ namespace DiscImageChef.Filesystems.AppleMFS
|
||||
string lowerFilename = StringHandlers.
|
||||
PascalToString(entry.flNam, Encoding).ToLowerInvariant().Replace('/', ':');
|
||||
|
||||
if(entry.flFlags.HasFlag(MFS_FileFlags.Used) &&
|
||||
!idToFilename.ContainsKey(entry.flFlNum) &&
|
||||
!idToEntry.ContainsKey(entry.flFlNum) &&
|
||||
!filenameToId.ContainsKey(lowerFilename) &&
|
||||
if(entry.flFlags.HasFlag(FileFlags.Used) &&
|
||||
!idToFilename.ContainsKey(entry.flFlNum) &&
|
||||
!idToEntry.ContainsKey(entry.flFlNum) &&
|
||||
!filenameToId.ContainsKey(lowerFilename) &&
|
||||
entry.flFlNum > 0)
|
||||
{
|
||||
idToEntry.Add(entry.flFlNum, entry);
|
||||
|
||||
@@ -62,7 +62,7 @@ namespace DiscImageChef.Filesystems.AppleMFS
|
||||
if(!filenameToId.TryGetValue(path.ToLowerInvariant(), out uint fileId))
|
||||
return Errno.NoSuchFile;
|
||||
|
||||
if(!idToEntry.TryGetValue(fileId, out MFS_FileEntry entry))
|
||||
if(!idToEntry.TryGetValue(fileId, out FileEntry entry))
|
||||
return Errno.NoSuchFile;
|
||||
|
||||
if(fileBlock > entry.flPyLen / volMDB.drAlBlkSiz)
|
||||
@@ -111,7 +111,7 @@ namespace DiscImageChef.Filesystems.AppleMFS
|
||||
if(!filenameToId.TryGetValue(path.ToLowerInvariant(), out uint fileId))
|
||||
return Errno.NoSuchFile;
|
||||
|
||||
if(!idToEntry.TryGetValue(fileId, out MFS_FileEntry entry))
|
||||
if(!idToEntry.TryGetValue(fileId, out FileEntry entry))
|
||||
return Errno.NoSuchFile;
|
||||
|
||||
if(entry.flUsrWds.fdFlags.HasFlag(AppleCommon.FinderFlags.kIsAlias))
|
||||
@@ -132,7 +132,7 @@ namespace DiscImageChef.Filesystems.AppleMFS
|
||||
if(entry.flUsrWds.fdFlags.HasFlag(AppleCommon.FinderFlags.kIsInvisible))
|
||||
attributes |= FileAttributes.Hidden;
|
||||
|
||||
if(entry.flFlags.HasFlag(MFS_FileFlags.Locked))
|
||||
if(entry.flFlags.HasFlag(FileFlags.Locked))
|
||||
attributes |= FileAttributes.Immutable;
|
||||
|
||||
if(entry.flUsrWds.fdFlags.HasFlag(AppleCommon.FinderFlags.kIsOnDesk))
|
||||
@@ -258,7 +258,7 @@ namespace DiscImageChef.Filesystems.AppleMFS
|
||||
if(!filenameToId.TryGetValue(path.ToLowerInvariant(), out uint fileId))
|
||||
return Errno.NoSuchFile;
|
||||
|
||||
if(!idToEntry.TryGetValue(fileId, out MFS_FileEntry entry))
|
||||
if(!idToEntry.TryGetValue(fileId, out FileEntry entry))
|
||||
return Errno.NoSuchFile;
|
||||
|
||||
Errno error = GetAttributes(path, out FileAttributes attr);
|
||||
@@ -304,7 +304,7 @@ namespace DiscImageChef.Filesystems.AppleMFS
|
||||
if(!filenameToId.TryGetValue(path.ToLowerInvariant(), out uint fileId))
|
||||
return Errno.NoSuchFile;
|
||||
|
||||
if(!idToEntry.TryGetValue(fileId, out MFS_FileEntry entry))
|
||||
if(!idToEntry.TryGetValue(fileId, out FileEntry entry))
|
||||
return Errno.NoSuchFile;
|
||||
|
||||
uint nextBlock;
|
||||
|
||||
@@ -63,7 +63,7 @@ namespace DiscImageChef.Filesystems.AppleMFS
|
||||
|
||||
var sb = new StringBuilder();
|
||||
|
||||
var mdb = new MFS_MasterDirectoryBlock();
|
||||
var mdb = new MasterDirectoryBlock();
|
||||
|
||||
byte[] pString = new byte[16];
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ namespace DiscImageChef.Filesystems.AppleMFS
|
||||
public partial class AppleMFS
|
||||
{
|
||||
/// <summary>Master Directory Block, should be at offset 0x0400 bytes in volume</summary>
|
||||
struct MFS_MasterDirectoryBlock
|
||||
struct MasterDirectoryBlock
|
||||
{
|
||||
/// <summary>0x000, Signature, 0xD2D7</summary>
|
||||
public ushort drSigWord;
|
||||
@@ -77,15 +77,15 @@ namespace DiscImageChef.Filesystems.AppleMFS
|
||||
}
|
||||
|
||||
[Flags]
|
||||
enum MFS_FileFlags : byte
|
||||
enum FileFlags : byte
|
||||
{
|
||||
Locked = 0x01, Used = 0x80
|
||||
}
|
||||
|
||||
struct MFS_FileEntry
|
||||
struct FileEntry
|
||||
{
|
||||
/// <summary>0x00, Entry flags</summary>
|
||||
public MFS_FileFlags flFlags;
|
||||
public FileFlags flFlags;
|
||||
/// <summary>0x01, Version number</summary>
|
||||
public byte flTyp;
|
||||
/// <summary>0x02, FinderInfo</summary>
|
||||
|
||||
@@ -57,7 +57,7 @@ namespace DiscImageChef.Filesystems.AppleMFS
|
||||
if(options.TryGetValue("debug", out string debugString))
|
||||
bool.TryParse(debugString, out debug);
|
||||
|
||||
volMDB = new MFS_MasterDirectoryBlock();
|
||||
volMDB = new MasterDirectoryBlock();
|
||||
|
||||
mdbBlocks = device.ReadSector(2 + partitionStart);
|
||||
bootBlocks = device.ReadSector(0 + partitionStart);
|
||||
|
||||
@@ -76,7 +76,7 @@ namespace DiscImageChef.Filesystems.AppleMFS
|
||||
if(!filenameToId.TryGetValue(path.ToLowerInvariant(), out uint fileId))
|
||||
return Errno.NoSuchFile;
|
||||
|
||||
if(!idToEntry.TryGetValue(fileId, out MFS_FileEntry entry))
|
||||
if(!idToEntry.TryGetValue(fileId, out FileEntry entry))
|
||||
return Errno.NoSuchFile;
|
||||
|
||||
if(entry.flRLgLen > 0)
|
||||
@@ -162,7 +162,7 @@ namespace DiscImageChef.Filesystems.AppleMFS
|
||||
if(!filenameToId.TryGetValue(path.ToLowerInvariant(), out uint fileId))
|
||||
return Errno.NoSuchFile;
|
||||
|
||||
if(!idToEntry.TryGetValue(fileId, out MFS_FileEntry entry))
|
||||
if(!idToEntry.TryGetValue(fileId, out FileEntry entry))
|
||||
return Errno.NoSuchFile;
|
||||
|
||||
if(entry.flRLgLen > 0 &&
|
||||
|
||||
Reference in New Issue
Block a user