2017-07-19 16:31:08 +01:00
|
|
|
|
// /***************************************************************************
|
2020-02-27 12:31:25 +00:00
|
|
|
|
// Aaru Data Preservation Suite
|
2016-07-28 18:13:49 +01:00
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
|
//
|
2022-12-07 13:07:31 +00:00
|
|
|
|
// Filename : Info.cs
|
2016-07-28 18:13:49 +01:00
|
|
|
|
// Author(s) : Natalia Portillo <claunia@claunia.com>
|
|
|
|
|
|
//
|
|
|
|
|
|
// Component : Apple ProDOS filesystem plugin.
|
|
|
|
|
|
//
|
|
|
|
|
|
// --[ 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/>.
|
|
|
|
|
|
//
|
|
|
|
|
|
// ----------------------------------------------------------------------------
|
2022-12-03 16:07:10 +00:00
|
|
|
|
// Copyright © 2011-2023 Natalia Portillo
|
2016-07-28 18:13:49 +01:00
|
|
|
|
// ****************************************************************************/
|
2015-03-22 07:32:40 +00:00
|
|
|
|
|
2022-03-07 07:36:44 +00:00
|
|
|
|
// ReSharper disable NotAccessedField.Local
|
|
|
|
|
|
|
2015-03-22 07:32:40 +00:00
|
|
|
|
using System;
|
2020-07-20 07:47:12 +01:00
|
|
|
|
using System.Diagnostics.CodeAnalysis;
|
2017-12-21 07:08:26 +00:00
|
|
|
|
using System.Linq;
|
2017-07-19 16:31:08 +01:00
|
|
|
|
using System.Text;
|
2022-12-15 22:21:07 +00:00
|
|
|
|
using Aaru.CommonTypes.AaruMetadata;
|
2021-09-19 21:16:47 +01:00
|
|
|
|
using Aaru.CommonTypes.Enums;
|
2020-02-27 00:33:26 +00:00
|
|
|
|
using Aaru.CommonTypes.Interfaces;
|
|
|
|
|
|
using Aaru.Console;
|
2020-02-29 18:03:35 +00:00
|
|
|
|
using Claunia.Encoding;
|
2017-12-21 14:30:38 +00:00
|
|
|
|
using Encoding = System.Text.Encoding;
|
2022-12-15 22:21:07 +00:00
|
|
|
|
using Partition = Aaru.CommonTypes.Partition;
|
2015-10-18 22:04:03 +01:00
|
|
|
|
|
2022-11-15 15:58:43 +00:00
|
|
|
|
namespace Aaru.Filesystems;
|
|
|
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
|
// Information from Apple ProDOS 8 Technical Reference
|
|
|
|
|
|
/// <inheritdoc />
|
|
|
|
|
|
/// <summary>Implements detection of Apple ProDOS filesystem</summary>
|
|
|
|
|
|
[SuppressMessage("ReSharper", "UnusedMember.Local"), SuppressMessage("ReSharper", "UnusedType.Local")]
|
2022-12-07 13:07:31 +00:00
|
|
|
|
public sealed partial class ProDOSPlugin
|
2015-03-22 07:32:40 +00:00
|
|
|
|
{
|
2022-03-06 13:29:38 +00:00
|
|
|
|
/// <inheritdoc />
|
|
|
|
|
|
public bool Identify(IMediaImage imagePlugin, Partition partition)
|
2015-03-22 07:32:40 +00:00
|
|
|
|
{
|
2022-03-06 13:29:38 +00:00
|
|
|
|
if(partition.Length < 3)
|
|
|
|
|
|
return false;
|
2015-03-22 07:32:40 +00:00
|
|
|
|
|
2022-11-15 15:58:43 +00:00
|
|
|
|
uint multiplier = (uint)(imagePlugin.Info.SectorSize == 256 ? 2 : 1);
|
2018-01-05 23:58:03 +00:00
|
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
|
// Blocks 0 and 1 are boot code
|
2022-11-15 15:58:43 +00:00
|
|
|
|
ErrorNumber errno = imagePlugin.ReadSectors((2 * multiplier) + partition.Start, multiplier,
|
2022-03-06 13:29:38 +00:00
|
|
|
|
out byte[] rootDirectoryKeyBlock);
|
2021-09-19 21:16:47 +01:00
|
|
|
|
|
2022-03-17 23:54:41 +00:00
|
|
|
|
if(errno != ErrorNumber.NoError)
|
|
|
|
|
|
return false;
|
|
|
|
|
|
|
2022-11-15 15:58:43 +00:00
|
|
|
|
bool apmFromHddOnCd = false;
|
2017-07-20 13:14:12 +01:00
|
|
|
|
|
2022-03-16 11:47:00 +00:00
|
|
|
|
if(imagePlugin.Info.SectorSize is 2352 or 2448 or 2048)
|
2022-03-06 13:29:38 +00:00
|
|
|
|
{
|
|
|
|
|
|
errno = imagePlugin.ReadSectors(partition.Start, 2, out byte[] tmp);
|
2020-02-29 18:03:35 +00:00
|
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
|
if(errno != ErrorNumber.NoError)
|
2020-02-29 18:03:35 +00:00
|
|
|
|
return false;
|
2015-03-22 07:32:40 +00:00
|
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
|
foreach(int offset in new[]
|
|
|
|
|
|
{
|
|
|
|
|
|
0, 0x200, 0x400, 0x600, 0x800, 0xA00
|
|
|
|
|
|
}.Where(offset => tmp.Length > offset + 0x200 && BitConverter.ToUInt16(tmp, offset) == 0 &&
|
|
|
|
|
|
(byte)((tmp[offset + 0x04] & STORAGE_TYPE_MASK) >> 4) == ROOT_DIRECTORY_TYPE &&
|
|
|
|
|
|
tmp[offset + 0x23] == ENTRY_LENGTH && tmp[offset + 0x24] == ENTRIES_PER_BLOCK))
|
|
|
|
|
|
{
|
|
|
|
|
|
Array.Copy(tmp, offset, rootDirectoryKeyBlock, 0, 0x200);
|
|
|
|
|
|
apmFromHddOnCd = true;
|
2020-02-29 18:03:35 +00:00
|
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2015-03-22 07:32:40 +00:00
|
|
|
|
|
2022-11-15 15:58:43 +00:00
|
|
|
|
ushort prePointer = BitConverter.ToUInt16(rootDirectoryKeyBlock, 0);
|
2022-03-06 13:29:38 +00:00
|
|
|
|
AaruConsole.DebugWriteLine("ProDOS plugin", "prePointer = {0}", prePointer);
|
2020-02-29 18:03:35 +00:00
|
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
|
if(prePointer != 0)
|
|
|
|
|
|
return false;
|
2015-03-22 07:32:40 +00:00
|
|
|
|
|
2022-11-15 15:58:43 +00:00
|
|
|
|
byte storageType = (byte)((rootDirectoryKeyBlock[0x04] & STORAGE_TYPE_MASK) >> 4);
|
2022-03-06 13:29:38 +00:00
|
|
|
|
AaruConsole.DebugWriteLine("ProDOS plugin", "storage_type = {0}", storageType);
|
2020-02-29 18:03:35 +00:00
|
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
|
if(storageType != ROOT_DIRECTORY_TYPE)
|
|
|
|
|
|
return false;
|
2015-03-22 07:32:40 +00:00
|
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
|
byte entryLength = rootDirectoryKeyBlock[0x23];
|
|
|
|
|
|
AaruConsole.DebugWriteLine("ProDOS plugin", "entry_length = {0}", entryLength);
|
2015-03-22 07:32:40 +00:00
|
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
|
if(entryLength != ENTRY_LENGTH)
|
|
|
|
|
|
return false;
|
2020-02-29 18:03:35 +00:00
|
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
|
byte entriesPerBlock = rootDirectoryKeyBlock[0x24];
|
|
|
|
|
|
AaruConsole.DebugWriteLine("ProDOS plugin", "entries_per_block = {0}", entriesPerBlock);
|
2020-02-29 18:03:35 +00:00
|
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
|
if(entriesPerBlock != ENTRIES_PER_BLOCK)
|
|
|
|
|
|
return false;
|
2017-12-19 20:33:03 +00:00
|
|
|
|
|
2022-11-15 15:58:43 +00:00
|
|
|
|
ushort bitMapPointer = BitConverter.ToUInt16(rootDirectoryKeyBlock, 0x27);
|
2022-03-06 13:29:38 +00:00
|
|
|
|
AaruConsole.DebugWriteLine("ProDOS plugin", "bit_map_pointer = {0}", bitMapPointer);
|
2020-02-29 18:03:35 +00:00
|
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
|
if(bitMapPointer > partition.End)
|
|
|
|
|
|
return false;
|
2015-03-22 07:32:40 +00:00
|
|
|
|
|
2022-11-15 15:58:43 +00:00
|
|
|
|
ushort totalBlocks = BitConverter.ToUInt16(rootDirectoryKeyBlock, 0x29);
|
2015-03-22 07:32:40 +00:00
|
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
|
if(apmFromHddOnCd)
|
|
|
|
|
|
totalBlocks /= 4;
|
2021-09-19 21:16:47 +01:00
|
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
|
AaruConsole.DebugWriteLine("ProDOS plugin", "{0} <= ({1} - {2} + 1)? {3}", totalBlocks, partition.End,
|
|
|
|
|
|
partition.Start, totalBlocks <= partition.End - partition.Start + 1);
|
2015-03-22 07:32:40 +00:00
|
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
|
return totalBlocks <= partition.End - partition.Start + 1;
|
|
|
|
|
|
}
|
2017-07-20 13:14:12 +01:00
|
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
|
/// <inheritdoc />
|
2022-12-17 22:41:56 +00:00
|
|
|
|
public void GetInformation(IMediaImage imagePlugin, Partition partition, Encoding encoding, out string information,
|
|
|
|
|
|
out FileSystem metadata)
|
2022-03-06 13:29:38 +00:00
|
|
|
|
{
|
2022-12-17 23:17:18 +00:00
|
|
|
|
encoding ??= new Apple2c();
|
|
|
|
|
|
information = "";
|
|
|
|
|
|
metadata = new FileSystem();
|
2022-11-15 15:58:43 +00:00
|
|
|
|
var sbInformation = new StringBuilder();
|
|
|
|
|
|
uint multiplier = (uint)(imagePlugin.Info.SectorSize == 256 ? 2 : 1);
|
2017-07-20 13:14:12 +01:00
|
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
|
// Blocks 0 and 1 are boot code
|
2022-11-15 15:58:43 +00:00
|
|
|
|
ErrorNumber errno = imagePlugin.ReadSectors((2 * multiplier) + partition.Start, multiplier,
|
2022-03-06 13:29:38 +00:00
|
|
|
|
out byte[] rootDirectoryKeyBlockBytes);
|
2015-03-22 07:32:40 +00:00
|
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
|
if(errno != ErrorNumber.NoError)
|
|
|
|
|
|
return;
|
2020-02-29 18:03:35 +00:00
|
|
|
|
|
2022-11-15 15:58:43 +00:00
|
|
|
|
bool apmFromHddOnCd = false;
|
2015-03-22 07:32:40 +00:00
|
|
|
|
|
2022-03-16 11:47:00 +00:00
|
|
|
|
if(imagePlugin.Info.SectorSize is 2352 or 2448 or 2048)
|
2022-03-06 13:29:38 +00:00
|
|
|
|
{
|
|
|
|
|
|
errno = imagePlugin.ReadSectors(partition.Start, 2, out byte[] tmp);
|
2017-07-20 13:14:12 +01:00
|
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
|
if(errno != ErrorNumber.NoError)
|
|
|
|
|
|
return;
|
2020-02-29 18:03:35 +00:00
|
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
|
foreach(int offset in new[]
|
|
|
|
|
|
{
|
|
|
|
|
|
0, 0x200, 0x400, 0x600, 0x800, 0xA00
|
|
|
|
|
|
}.Where(offset => BitConverter.ToUInt16(tmp, offset) == 0 &&
|
|
|
|
|
|
(byte)((tmp[offset + 0x04] & STORAGE_TYPE_MASK) >> 4) == ROOT_DIRECTORY_TYPE &&
|
|
|
|
|
|
tmp[offset + 0x23] == ENTRY_LENGTH && tmp[offset + 0x24] == ENTRIES_PER_BLOCK))
|
2017-07-20 13:14:12 +01:00
|
|
|
|
{
|
2022-03-06 13:29:38 +00:00
|
|
|
|
Array.Copy(tmp, offset, rootDirectoryKeyBlockBytes, 0, 0x200);
|
|
|
|
|
|
apmFromHddOnCd = true;
|
|
|
|
|
|
|
|
|
|
|
|
break;
|
2020-02-29 18:03:35 +00:00
|
|
|
|
}
|
2022-03-06 13:29:38 +00:00
|
|
|
|
}
|
2015-03-22 07:32:40 +00:00
|
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
|
var rootDirectoryKeyBlock = new RootDirectoryKeyBlock
|
|
|
|
|
|
{
|
|
|
|
|
|
header = new RootDirectoryHeader(),
|
|
|
|
|
|
zero = BitConverter.ToUInt16(rootDirectoryKeyBlockBytes, 0x00),
|
|
|
|
|
|
next_pointer = BitConverter.ToUInt16(rootDirectoryKeyBlockBytes, 0x02)
|
|
|
|
|
|
};
|
2015-03-22 07:32:40 +00:00
|
|
|
|
|
2022-03-07 07:36:44 +00:00
|
|
|
|
rootDirectoryKeyBlock.header.storage_type = (byte)((rootDirectoryKeyBlockBytes[0x04] & STORAGE_TYPE_MASK) >> 4);
|
2015-03-22 07:32:40 +00:00
|
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
|
rootDirectoryKeyBlock.header.name_length = (byte)(rootDirectoryKeyBlockBytes[0x04] & NAME_LENGTH_MASK);
|
2022-11-15 15:58:43 +00:00
|
|
|
|
byte[] temporal = new byte[rootDirectoryKeyBlock.header.name_length];
|
2022-03-06 13:29:38 +00:00
|
|
|
|
Array.Copy(rootDirectoryKeyBlockBytes, 0x05, temporal, 0, rootDirectoryKeyBlock.header.name_length);
|
2022-12-17 23:17:18 +00:00
|
|
|
|
rootDirectoryKeyBlock.header.volume_name = encoding.GetString(temporal);
|
2022-03-06 13:29:38 +00:00
|
|
|
|
rootDirectoryKeyBlock.header.reserved = BitConverter.ToUInt64(rootDirectoryKeyBlockBytes, 0x14);
|
2017-07-20 13:14:12 +01:00
|
|
|
|
|
2022-11-15 15:58:43 +00:00
|
|
|
|
ushort tempTimestampLeft = BitConverter.ToUInt16(rootDirectoryKeyBlockBytes, 0x1C);
|
|
|
|
|
|
ushort tempTimestampRight = BitConverter.ToUInt16(rootDirectoryKeyBlockBytes, 0x1E);
|
2015-03-22 07:32:40 +00:00
|
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
|
bool dateCorrect;
|
2015-03-22 07:32:40 +00:00
|
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
|
try
|
|
|
|
|
|
{
|
2022-11-15 15:58:43 +00:00
|
|
|
|
uint tempTimestamp = (uint)((tempTimestampLeft << 16) + tempTimestampRight);
|
|
|
|
|
|
int year = (int)((tempTimestamp & YEAR_MASK) >> 25);
|
|
|
|
|
|
int month = (int)((tempTimestamp & MONTH_MASK) >> 21);
|
|
|
|
|
|
int day = (int)((tempTimestamp & DAY_MASK) >> 16);
|
|
|
|
|
|
int hour = (int)((tempTimestamp & HOUR_MASK) >> 8);
|
|
|
|
|
|
int minute = (int)(tempTimestamp & MINUTE_MASK);
|
2022-03-06 13:29:38 +00:00
|
|
|
|
year += 1900;
|
|
|
|
|
|
|
|
|
|
|
|
if(year < 1940)
|
|
|
|
|
|
year += 100;
|
|
|
|
|
|
|
|
|
|
|
|
AaruConsole.DebugWriteLine("ProDOS plugin", "temp_timestamp_left = 0x{0:X4}", tempTimestampLeft);
|
|
|
|
|
|
AaruConsole.DebugWriteLine("ProDOS plugin", "temp_timestamp_right = 0x{0:X4}", tempTimestampRight);
|
|
|
|
|
|
AaruConsole.DebugWriteLine("ProDOS plugin", "temp_timestamp = 0x{0:X8}", tempTimestamp);
|
|
|
|
|
|
|
|
|
|
|
|
AaruConsole.DebugWriteLine("ProDOS plugin",
|
2022-11-28 02:59:53 +00:00
|
|
|
|
Localization.Datetime_field_year_0_month_1_day_2_hour_3_minute_4, year, month,
|
|
|
|
|
|
day, hour, minute);
|
2022-03-06 13:29:38 +00:00
|
|
|
|
|
|
|
|
|
|
rootDirectoryKeyBlock.header.creation_time = new DateTime(year, month, day, hour, minute, 0);
|
|
|
|
|
|
dateCorrect = true;
|
|
|
|
|
|
}
|
|
|
|
|
|
catch(ArgumentOutOfRangeException)
|
|
|
|
|
|
{
|
|
|
|
|
|
dateCorrect = false;
|
|
|
|
|
|
}
|
2015-03-22 07:32:40 +00:00
|
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
|
rootDirectoryKeyBlock.header.version = rootDirectoryKeyBlockBytes[0x20];
|
|
|
|
|
|
rootDirectoryKeyBlock.header.min_version = rootDirectoryKeyBlockBytes[0x21];
|
|
|
|
|
|
rootDirectoryKeyBlock.header.access = rootDirectoryKeyBlockBytes[0x22];
|
|
|
|
|
|
rootDirectoryKeyBlock.header.entry_length = rootDirectoryKeyBlockBytes[0x23];
|
|
|
|
|
|
rootDirectoryKeyBlock.header.entries_per_block = rootDirectoryKeyBlockBytes[0x24];
|
2020-02-29 18:03:35 +00:00
|
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
|
rootDirectoryKeyBlock.header.file_count = BitConverter.ToUInt16(rootDirectoryKeyBlockBytes, 0x25);
|
|
|
|
|
|
rootDirectoryKeyBlock.header.bit_map_pointer = BitConverter.ToUInt16(rootDirectoryKeyBlockBytes, 0x27);
|
|
|
|
|
|
rootDirectoryKeyBlock.header.total_blocks = BitConverter.ToUInt16(rootDirectoryKeyBlockBytes, 0x29);
|
2020-02-29 18:03:35 +00:00
|
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
|
if(apmFromHddOnCd)
|
2023-10-01 04:00:02 +01:00
|
|
|
|
sbInformation.AppendLine(Localization.ProDOS_uses_512_bytes_sector_while_device_uses_2048_bytes_sector).
|
2022-11-28 02:59:53 +00:00
|
|
|
|
AppendLine();
|
2020-02-29 18:03:35 +00:00
|
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
|
if(rootDirectoryKeyBlock.header.version != VERSION1 ||
|
|
|
|
|
|
rootDirectoryKeyBlock.header.min_version != VERSION1)
|
|
|
|
|
|
{
|
2022-11-28 02:59:53 +00:00
|
|
|
|
sbInformation.AppendLine(Localization.Warning_Detected_unknown_ProDOS_version_ProDOS_filesystem);
|
|
|
|
|
|
sbInformation.AppendLine(Localization.All_of_the_following_information_may_be_incorrect);
|
2022-03-06 13:29:38 +00:00
|
|
|
|
}
|
2020-02-29 18:03:35 +00:00
|
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
|
if(rootDirectoryKeyBlock.header.version == VERSION1)
|
2022-11-28 02:59:53 +00:00
|
|
|
|
sbInformation.AppendLine(Localization.ProDOS_version_one_used_to_create_this_volume);
|
2022-03-06 13:29:38 +00:00
|
|
|
|
else
|
2022-11-28 02:59:53 +00:00
|
|
|
|
sbInformation.AppendFormat(Localization.Unknown_ProDOS_version_with_field_0_used_to_create_this_volume,
|
2022-03-06 13:29:38 +00:00
|
|
|
|
rootDirectoryKeyBlock.header.version).AppendLine();
|
|
|
|
|
|
|
|
|
|
|
|
if(rootDirectoryKeyBlock.header.min_version == VERSION1)
|
2022-11-28 02:59:53 +00:00
|
|
|
|
sbInformation.AppendLine(Localization.ProDOS_version_one_at_least_required_for_reading_this_volume);
|
2022-03-06 13:29:38 +00:00
|
|
|
|
else
|
|
|
|
|
|
sbInformation.
|
2022-11-28 02:59:53 +00:00
|
|
|
|
AppendFormat(Localization.Unknown_ProDOS_version_with_field_0_is_at_least_required_for_reading_this_volume,
|
2022-03-06 13:29:38 +00:00
|
|
|
|
rootDirectoryKeyBlock.header.min_version).AppendLine();
|
2020-02-29 18:03:35 +00:00
|
|
|
|
|
2022-11-28 02:59:53 +00:00
|
|
|
|
sbInformation.AppendFormat(Localization.Volume_name_is_0, rootDirectoryKeyBlock.header.volume_name).
|
|
|
|
|
|
AppendLine();
|
2020-02-29 18:03:35 +00:00
|
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
|
if(dateCorrect)
|
2022-11-28 02:59:53 +00:00
|
|
|
|
sbInformation.AppendFormat(Localization.Volume_created_on_0, rootDirectoryKeyBlock.header.creation_time).
|
2020-02-29 18:03:35 +00:00
|
|
|
|
AppendLine();
|
2015-03-22 07:32:40 +00:00
|
|
|
|
|
2022-11-28 02:59:53 +00:00
|
|
|
|
sbInformation.
|
|
|
|
|
|
AppendFormat(Localization._0_bytes_per_directory_entry, rootDirectoryKeyBlock.header.entry_length).
|
|
|
|
|
|
AppendLine();
|
2020-02-29 18:03:35 +00:00
|
|
|
|
|
2022-11-28 02:59:53 +00:00
|
|
|
|
sbInformation.
|
|
|
|
|
|
AppendFormat(Localization._0_entries_per_directory_block, rootDirectoryKeyBlock.header.entries_per_block).
|
|
|
|
|
|
AppendLine();
|
2020-02-29 18:03:35 +00:00
|
|
|
|
|
2022-11-28 02:59:53 +00:00
|
|
|
|
sbInformation.AppendFormat(Localization._0_files_in_root_directory, rootDirectoryKeyBlock.header.file_count).
|
|
|
|
|
|
AppendLine();
|
2022-03-07 07:36:44 +00:00
|
|
|
|
|
2022-11-28 02:59:53 +00:00
|
|
|
|
sbInformation.AppendFormat(Localization._0_blocks_in_volume, rootDirectoryKeyBlock.header.total_blocks).
|
|
|
|
|
|
AppendLine();
|
2020-02-29 18:03:35 +00:00
|
|
|
|
|
2022-11-28 02:59:53 +00:00
|
|
|
|
sbInformation.AppendFormat(Localization.Bitmap_starts_at_block_0, rootDirectoryKeyBlock.header.bit_map_pointer).
|
2022-03-06 13:29:38 +00:00
|
|
|
|
AppendLine();
|
2015-03-22 07:32:40 +00:00
|
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
|
if((rootDirectoryKeyBlock.header.access & READ_ATTRIBUTE) == READ_ATTRIBUTE)
|
2022-11-28 02:59:53 +00:00
|
|
|
|
sbInformation.AppendLine(Localization.Volume_can_be_read);
|
2015-03-22 07:32:40 +00:00
|
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
|
if((rootDirectoryKeyBlock.header.access & WRITE_ATTRIBUTE) == WRITE_ATTRIBUTE)
|
2022-11-28 02:59:53 +00:00
|
|
|
|
sbInformation.AppendLine(Localization.Volume_can_be_written);
|
2015-03-22 07:32:40 +00:00
|
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
|
if((rootDirectoryKeyBlock.header.access & RENAME_ATTRIBUTE) == RENAME_ATTRIBUTE)
|
2022-11-28 02:59:53 +00:00
|
|
|
|
sbInformation.AppendLine(Localization.Volume_can_be_renamed);
|
2018-06-20 22:22:21 +01:00
|
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
|
if((rootDirectoryKeyBlock.header.access & DESTROY_ATTRIBUTE) == DESTROY_ATTRIBUTE)
|
2022-11-28 02:59:53 +00:00
|
|
|
|
sbInformation.AppendLine(Localization.Volume_can_be_destroyed);
|
2020-02-29 18:03:35 +00:00
|
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
|
if((rootDirectoryKeyBlock.header.access & BACKUP_ATTRIBUTE) == BACKUP_ATTRIBUTE)
|
2022-11-28 02:59:53 +00:00
|
|
|
|
sbInformation.AppendLine(Localization.Volume_must_be_backed_up);
|
2017-12-28 05:52:04 +00:00
|
|
|
|
|
2022-11-28 02:59:53 +00:00
|
|
|
|
// TODO: Fix mask
|
2022-03-06 13:29:38 +00:00
|
|
|
|
if((rootDirectoryKeyBlock.header.access & RESERVED_ATTRIBUTE_MASK) != 0)
|
2022-11-28 02:59:53 +00:00
|
|
|
|
AaruConsole.DebugWriteLine("ProDOS plugin", Localization.Reserved_attributes_are_set_0,
|
2022-03-06 13:29:38 +00:00
|
|
|
|
rootDirectoryKeyBlock.header.access);
|
2016-07-21 17:16:08 +01:00
|
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
|
information = sbInformation.ToString();
|
2015-03-22 07:32:40 +00:00
|
|
|
|
|
2022-12-17 22:41:56 +00:00
|
|
|
|
metadata = new FileSystem
|
2015-03-22 07:32:40 +00:00
|
|
|
|
{
|
2022-12-15 22:21:07 +00:00
|
|
|
|
VolumeName = rootDirectoryKeyBlock.header.volume_name,
|
|
|
|
|
|
Files = rootDirectoryKeyBlock.header.file_count,
|
|
|
|
|
|
Clusters = rootDirectoryKeyBlock.header.total_blocks,
|
|
|
|
|
|
Type = FS_TYPE
|
2022-03-06 13:29:38 +00:00
|
|
|
|
};
|
2015-03-22 07:32:40 +00:00
|
|
|
|
|
2022-12-17 22:41:56 +00:00
|
|
|
|
metadata.ClusterSize = (uint)((partition.End - partition.Start + 1) * imagePlugin.Info.SectorSize /
|
|
|
|
|
|
metadata.Clusters);
|
2015-03-22 07:32:40 +00:00
|
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
|
if(!dateCorrect)
|
|
|
|
|
|
return;
|
2015-03-22 07:32:40 +00:00
|
|
|
|
|
2022-12-17 22:41:56 +00:00
|
|
|
|
metadata.CreationDate = rootDirectoryKeyBlock.header.creation_time;
|
2022-03-06 13:29:38 +00:00
|
|
|
|
}
|
2017-12-19 20:33:03 +00:00
|
|
|
|
}
|