// /*************************************************************************** // Aaru Data Preservation Suite // ---------------------------------------------------------------------------- // // Filename : Structs.cs // Author(s) : Natalia Portillo // // Component : Zoo 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 . // // ---------------------------------------------------------------------------- // Copyright © 2011-2025 Natalia Portillo // ****************************************************************************/ // Copied from zoo.h /* The contents of this file are hereby released to the public domain. -- Rahul Dhesi 1986/11/14 */ using System.Runtime.InteropServices; namespace Aaru.Archives; public sealed partial class Zoo { #region Nested type: Direntry [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi, Pack = 1)] struct Direntry { /// tag -- redundancy check public readonly uint zoo_tag; /// type of directory entry. always 1 for now public readonly byte type; /// 0 = no packing, 1 = normal LZW public readonly byte packing_method; /// pos'n of next directory entry public readonly int next; /// position of this file public readonly int offset; /// DOS format date public readonly ushort date; /// DOS format time public readonly ushort time; /// CRC of this file public readonly ushort file_crc; public readonly int org_size; public readonly int size_now; public readonly byte major_ver; /// minimum version needed to extract public readonly byte minor_ver; /// will be 1 if deleted, 0 if not public readonly byte deleted; /// file structure if any public readonly byte struc; /// points to comment; zero if none public readonly int comment; /// length of comment, 0 if none public readonly ushort cmt_size; /// filename [MarshalAs(UnmanagedType.ByValArray, SizeConst = FNAMESIZE)] public readonly byte[] fname; /// length of variable part of dir entry public readonly short var_dir_len; /// timezone where file was archived public readonly byte tz; /// CRC of directory entry public readonly ushort dir_crc; /* fields for variable part of directory entry follow */ /// length of long filename public readonly byte namlen; /// length of directory name public readonly byte dirlen; /// long filename [MarshalAs(UnmanagedType.ByValArray, SizeConst = LFNAMESIZE)] public byte[] lfname; /// directory name [MarshalAs(UnmanagedType.ByValArray, SizeConst = PATHSIZE)] public byte[] dirname; /// Filesystem ID public ushort system_id; /// File attributes -- 24 bits public uint fattr; /// version flag bits -- one byte in archive public ushort vflag; /// file version number if any public ushort version_no; } #endregion #region Nested type: ZooHeader [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi, Pack = 1)] readonly struct ZooHeader { /// archive header text [MarshalAs(UnmanagedType.ByValArray, SizeConst = SIZ_TEXT)] public readonly byte[] text; /// identifies archives public readonly uint zoo_tag; /// where the archive's data starts public readonly int zoo_start; /// for consistency checking of zoo_start public readonly int zoo_minus; public readonly byte major_ver; /// minimum version to extract all files public readonly byte minor_ver; /// type of archive header public readonly byte type; /// position of archive comment public readonly int acmt_pos; /// length of archive comment public readonly ushort acmt_len; /// byte in archive; data about versions public readonly ushort vdata; } #endregion }