2017-10-08 20:41:54 +01:00
|
|
|
|
// /***************************************************************************
|
2020-02-27 12:31:25 +00:00
|
|
|
|
// Aaru Data Preservation Suite
|
2017-10-08 20:41:54 +01:00
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
|
//
|
|
|
|
|
|
// Filename : ISO9660.cs
|
|
|
|
|
|
// Author(s) : Natalia Portillo <claunia@claunia.com>
|
|
|
|
|
|
//
|
2017-12-19 03:50:57 +00:00
|
|
|
|
// Component : ISO9660 filesystem plugin.
|
2017-10-08 20:41:54 +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/>.
|
|
|
|
|
|
//
|
|
|
|
|
|
// ----------------------------------------------------------------------------
|
2024-12-19 10:45:18 +00:00
|
|
|
|
// Copyright © 2011-2025 Natalia Portillo
|
2019-07-31 20:19:22 +01:00
|
|
|
|
// In the loving memory of Facunda "Tata" Suárez Domínguez, R.I.P. 2019/07/24
|
2017-10-08 20:41:54 +01:00
|
|
|
|
// ****************************************************************************/
|
2017-12-19 19:33:46 +00:00
|
|
|
|
|
2017-10-08 20:41:54 +01:00
|
|
|
|
using System;
|
2019-07-19 12:14:30 +01:00
|
|
|
|
using System.Collections.Generic;
|
2020-07-20 07:47:12 +01:00
|
|
|
|
using System.Diagnostics.CodeAnalysis;
|
2017-10-08 20:41:54 +01:00
|
|
|
|
using System.Text;
|
2022-12-15 22:21:07 +00:00
|
|
|
|
using Aaru.CommonTypes.AaruMetadata;
|
2020-02-27 00:33:26 +00:00
|
|
|
|
using Aaru.CommonTypes.Interfaces;
|
2025-08-14 15:51:32 +01:00
|
|
|
|
using FileSystemInfo = Aaru.CommonTypes.Structs.FileSystemInfo;
|
2017-10-08 20:41:54 +01:00
|
|
|
|
|
2022-11-15 15:58:43 +00:00
|
|
|
|
namespace Aaru.Filesystems;
|
|
|
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
|
// This is coded following ECMA-119.
|
|
|
|
|
|
/// <inheritdoc />
|
|
|
|
|
|
/// <summary>Implements the High Sierra, ISO9660 and CD-i filesystems</summary>
|
|
|
|
|
|
[SuppressMessage("ReSharper", "UnusedType.Local")]
|
|
|
|
|
|
public sealed partial class ISO9660 : IReadOnlyFilesystem
|
|
|
|
|
|
{
|
2023-10-03 23:22:08 +01:00
|
|
|
|
const string MODULE_NAME = "ISO9660 plugin";
|
|
|
|
|
|
ushort _blockSize;
|
2022-03-06 13:29:38 +00:00
|
|
|
|
bool _cdi;
|
|
|
|
|
|
bool _debug;
|
2023-10-05 01:52:48 +01:00
|
|
|
|
Encoding _encoding;
|
2022-03-06 13:29:38 +00:00
|
|
|
|
bool _highSierra;
|
|
|
|
|
|
IMediaImage _image;
|
|
|
|
|
|
bool _joliet;
|
|
|
|
|
|
bool _mounted;
|
|
|
|
|
|
Namespace _namespace;
|
|
|
|
|
|
PathTableEntryInternal[] _pathTable;
|
|
|
|
|
|
Dictionary<string, DecodedDirectoryEntry> _rootDirectoryCache;
|
|
|
|
|
|
FileSystemInfo _statfs;
|
|
|
|
|
|
bool _useEvd;
|
|
|
|
|
|
bool _usePathTable;
|
|
|
|
|
|
bool _useTransTbl;
|
2019-07-19 12:14:30 +01:00
|
|
|
|
|
2023-10-03 23:22:08 +01:00
|
|
|
|
#region IReadOnlyFilesystem Members
|
|
|
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
|
/// <inheritdoc />
|
2022-12-17 22:41:56 +00:00
|
|
|
|
public FileSystem Metadata { get; private set; }
|
2023-10-03 23:22:08 +01:00
|
|
|
|
|
2022-12-17 22:41:56 +00:00
|
|
|
|
/// <inheritdoc />
|
2022-03-06 13:29:38 +00:00
|
|
|
|
public string Name => "ISO9660 Filesystem";
|
2023-10-03 23:22:08 +01:00
|
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
|
/// <inheritdoc />
|
|
|
|
|
|
public Guid Id => new("d812f4d3-c357-400d-90fd-3b22ef786aa8");
|
2023-10-03 23:22:08 +01:00
|
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
|
/// <inheritdoc />
|
2022-11-28 02:59:53 +00:00
|
|
|
|
public string Author => Authors.NataliaPortillo;
|
2019-07-19 12:14:30 +01:00
|
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
|
/// <inheritdoc />
|
|
|
|
|
|
public IEnumerable<(string name, Type type, string description)> SupportedOptions =>
|
|
|
|
|
|
new (string name, Type type, string description)[]
|
2020-02-29 18:03:35 +00:00
|
|
|
|
{
|
2022-03-06 13:29:38 +00:00
|
|
|
|
("use_path_table", typeof(bool), "Use path table for directory traversal"),
|
2023-10-04 17:34:40 +01:00
|
|
|
|
("use_trans_tbl", typeof(bool), "Use TRANS.TBL for filenames"),
|
|
|
|
|
|
("use_evd", typeof(bool),
|
|
|
|
|
|
"If present, use Enhanced Volume Descriptor with specified encoding (overrides namespace)")
|
2020-02-29 18:03:35 +00:00
|
|
|
|
};
|
2019-07-19 12:14:30 +01:00
|
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
|
/// <inheritdoc />
|
|
|
|
|
|
public Dictionary<string, string> Namespaces => new()
|
|
|
|
|
|
{
|
2023-10-04 17:34:40 +01:00
|
|
|
|
{
|
|
|
|
|
|
"normal", "Primary Volume Descriptor, ignoring ;1 suffixes"
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
"vms", "Primary Volume Descriptor, showing version suffixes"
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
"joliet", "Joliet Volume Descriptor (default)"
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
"rrip", "Rock Ridge"
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
"romeo", "Primary Volume Descriptor using the specified encoding codepage"
|
|
|
|
|
|
}
|
2022-03-06 13:29:38 +00:00
|
|
|
|
};
|
|
|
|
|
|
|
2023-10-03 23:22:08 +01:00
|
|
|
|
#endregion
|
|
|
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
|
static Dictionary<string, string> GetDefaultOptions() => new()
|
|
|
|
|
|
{
|
2023-10-04 17:34:40 +01:00
|
|
|
|
{
|
|
|
|
|
|
"debug", false.ToString()
|
|
|
|
|
|
}
|
2022-03-06 13:29:38 +00:00
|
|
|
|
};
|
2017-12-19 20:33:03 +00:00
|
|
|
|
}
|