// /*************************************************************************** // 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-2021 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 = { "Non-bootable", "Apricot & XI RAM BIOS", "Generic ROM BIOS", "Apricot & XI ROM BIOS", "Apricot Portable ROM BIOS", "Apricot F1 ROM BIOS" }; readonly string[] _diskTypeCodes = { "MF1DD 70-track", "MF1DD", "MF2DD", "Winchester 5M", "Winchester 10M", "Winchester 20M" }; readonly int[] _lineModes = { 256, 200 }; readonly int[] _lineWidths = { 80, 40 }; readonly string[] _operatingSystemCodes = { "Invalid", "MS-DOS", "UCSD Pascal", "CP/M", "Concurrent CP/M" }; readonly string[] _parityTypes = { "None", "Odd", "Even", "Mark", "Space" }; readonly string[] _printDevices = { "Parallel", "Serial" }; readonly double[] _stopBits = { 1, 1.5, 2 }; /// public string Name => "ACT Apricot partitions"; /// public Guid Id => new("8CBF5864-7B5A-47A0-8CEB-199C74FA22DE"); /// public string Author => "Natalia Portillo"; /// 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