// /*************************************************************************** // Aaru Data Preservation Suite // ---------------------------------------------------------------------------- // // Filename : Apricot.cs // Author(s) : Natalia Portillo // // Component : Partitioning scheme plugins. // // --[ Description ] ---------------------------------------------------------- // // Manages ACT Apricot partitions. // // --[ 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 . // // ---------------------------------------------------------------------------- // Copyright © 2011-2023 Natalia Portillo // ****************************************************************************/ using System; using System.Collections.Generic; using System.Runtime.InteropServices; using Aaru.CommonTypes; using Aaru.CommonTypes.Enums; using Aaru.CommonTypes.Interfaces; using Aaru.Console; using Aaru.Helpers; using Marshal = Aaru.Helpers.Marshal; namespace Aaru.Partitions; /// /// Implements decoding of Apricot partitions public sealed class Apricot : IPartition { readonly int[] _baudRates = { 50, 75, 110, 134, 150, 300, 600, 1200, 1800, 2400, 3600, 4800, 7200, 9600, 19200 }; readonly string[] _bootTypeCodes = { Localization.Non_bootable, Localization.Apricot_XI_RAM_BIOS, Localization.Generic_ROM_BIOS, Localization.Apricot_XI_ROM_BIOS, Localization.Apricot_Portable_ROM_BIOS, Localization.Apricot_F1_ROM_BIOS }; readonly string[] _diskTypeCodes = { Localization.MF1DD_70_track, "MF1DD", "MF2DD", "Winchester 5M", "Winchester 10M", "Winchester 20M" }; readonly int[] _lineModes = { 256, 200 }; readonly int[] _lineWidths = { 80, 40 }; readonly string[] _operatingSystemCodes = { Localization.Invalid_operating_system, "MS-DOS", "UCSD Pascal", Localization.CPM, "Concurrent CP/M" }; readonly string[] _parityTypes = { Localization.None_parity, Localization.Odd_parity, Localization.Even_parity, Localization.Mark_parity, Localization.Space_parity }; readonly string[] _printDevices = { Localization.Parallel_print_device, Localization.Serial_print_device }; readonly double[] _stopBits = { 1, 1.5, 2 }; /// public string Name => Localization.Apricot_Name; /// public Guid Id => new("8CBF5864-7B5A-47A0-8CEB-199C74FA22DE"); /// public string Author => Authors.NataliaPortillo; /// public bool GetInformation(IMediaImage imagePlugin, out List partitions, ulong sectorOffset) { partitions = new List(); // I think Apricot can't chain partitions so. if(sectorOffset != 0) return false; ErrorNumber errno = imagePlugin.ReadSector(0, out byte[] sector); if(errno != ErrorNumber.NoError || sector.Length < 512) return false; Label label = Marshal.ByteArrayToStructureLittleEndian