2017-07-19 16:31:08 +01:00
|
|
|
|
// /***************************************************************************
|
2020-02-27 12:31:25 +00:00
|
|
|
|
// Aaru Data Preservation Suite
|
2016-08-01 00:41:02 +01:00
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
|
//
|
|
|
|
|
|
// Filename : AppleMFS.cs
|
|
|
|
|
|
// Author(s) : Natalia Portillo <claunia@claunia.com>
|
|
|
|
|
|
//
|
|
|
|
|
|
// Component : Apple Macintosh File System plugin.
|
|
|
|
|
|
//
|
|
|
|
|
|
// --[ Description ] ----------------------------------------------------------
|
|
|
|
|
|
//
|
2016-08-01 00:43:31 +01:00
|
|
|
|
// Constructors and common variables for the Apple Macintosh File System plugin.
|
2016-08-01 00:41:02 +01:00
|
|
|
|
//
|
|
|
|
|
|
// --[ License ] --------------------------------------------------------------
|
|
|
|
|
|
//
|
|
|
|
|
|
// This library is free software; you can redistribute it and/or modify
|
|
|
|
|
|
// it under the terms of the GNU Lesser General Public License as
|
|
|
|
|
|
// published by the Free Software Foundation; either version 2.1 of the
|
|
|
|
|
|
// License, or (at your option) any later version.
|
|
|
|
|
|
//
|
|
|
|
|
|
// This library is distributed in the hope that it will be useful, but
|
|
|
|
|
|
// WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
|
|
// Lesser General Public License for more details.
|
|
|
|
|
|
//
|
|
|
|
|
|
// You should have received a copy of the GNU Lesser General Public
|
|
|
|
|
|
// License along with this library; if not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
|
//
|
|
|
|
|
|
// ----------------------------------------------------------------------------
|
2025-08-14 02:49:52 +01:00
|
|
|
|
// Copyright © 2011-2025 Natalia Portillo
|
2016-08-01 00:41:02 +01:00
|
|
|
|
// ****************************************************************************/
|
|
|
|
|
|
|
|
|
|
|
|
using System;
|
2016-08-01 17:59:22 +01:00
|
|
|
|
using System.Collections.Generic;
|
2017-06-06 21:23:20 +01:00
|
|
|
|
using System.Text;
|
2020-02-27 00:33:26 +00:00
|
|
|
|
using Aaru.CommonTypes.Interfaces;
|
2017-12-26 06:05:12 +00:00
|
|
|
|
using Schemas;
|
2016-08-01 00:41:02 +01:00
|
|
|
|
|
2020-07-20 15:43:52 +01:00
|
|
|
|
namespace Aaru.Filesystems
|
2016-08-01 00:41:02 +01:00
|
|
|
|
{
|
|
|
|
|
|
// Information from Inside Macintosh Volume II
|
2021-08-17 16:12:30 +01:00
|
|
|
|
/// <inheritdoc />
|
2021-08-17 21:23:10 +01:00
|
|
|
|
/// <summary>Implements the Apple Macintosh File System</summary>
|
2020-07-22 13:20:25 +01:00
|
|
|
|
public sealed partial class AppleMFS : IReadOnlyFilesystem
|
2016-08-01 00:41:02 +01:00
|
|
|
|
{
|
2020-07-20 21:11:32 +01:00
|
|
|
|
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;
|
2017-12-26 06:05:12 +00:00
|
|
|
|
|
2021-08-17 13:56:05 +01:00
|
|
|
|
/// <inheritdoc />
|
2017-12-26 08:01:40 +00:00
|
|
|
|
public FileSystemType XmlFsType { get; private set; }
|
2021-08-17 13:56:05 +01:00
|
|
|
|
/// <inheritdoc />
|
2021-08-17 21:23:10 +01:00
|
|
|
|
public string Name => "Apple Macintosh File System";
|
2021-08-17 13:56:05 +01:00
|
|
|
|
/// <inheritdoc />
|
2021-08-17 21:23:10 +01:00
|
|
|
|
public Guid Id => new Guid("36405F8D-0D26-4066-6538-5DBF5D065C3A");
|
2021-08-17 13:56:05 +01:00
|
|
|
|
/// <inheritdoc />
|
2021-08-17 21:23:10 +01:00
|
|
|
|
public Encoding Encoding { get; private set; }
|
2021-08-17 13:56:05 +01:00
|
|
|
|
/// <inheritdoc />
|
2021-08-17 21:23:10 +01:00
|
|
|
|
public string Author => "Natalia Portillo";
|
2016-08-01 17:59:22 +01:00
|
|
|
|
|
2017-12-28 18:08:15 +00:00
|
|
|
|
// TODO: Implement Finder namespace (requires decoding Desktop database)
|
2021-08-17 13:56:05 +01:00
|
|
|
|
/// <inheritdoc />
|
2017-12-28 18:08:15 +00:00
|
|
|
|
public IEnumerable<(string name, Type type, string description)> SupportedOptions =>
|
2020-02-19 03:44:44 +00:00
|
|
|
|
new (string name, Type type, string description)[]
|
2020-02-29 18:03:35 +00:00
|
|
|
|
{};
|
2017-12-28 18:08:15 +00:00
|
|
|
|
|
2021-08-17 13:56:05 +01:00
|
|
|
|
/// <inheritdoc />
|
2019-04-17 00:11:28 +01:00
|
|
|
|
public Dictionary<string, string> Namespaces => null;
|
|
|
|
|
|
|
2020-02-19 03:44:44 +00:00
|
|
|
|
static Dictionary<string, string> GetDefaultOptions() => new Dictionary<string, string>
|
|
|
|
|
|
{
|
|
|
|
|
|
{
|
|
|
|
|
|
"debug", false.ToString()
|
|
|
|
|
|
}
|
|
|
|
|
|
};
|
2016-08-01 00:41:02 +01:00
|
|
|
|
}
|
2017-12-19 20:33:03 +00:00
|
|
|
|
}
|