using System.IO; using System.Text; namespace SabreTools.FileTypes.Aaru { /// /// Header for the index, followed by entries /// /// public class IndexHeader { /// Identifier, public AaruBlockType identifier; /// How many entries follow this header public ushort entries; /// CRC64-ECMA of the index public ulong crc64; /// /// Read a stream as an IndexHeader /// /// IndexHeader as a stream /// Populated IndexHeader, null on failure public static IndexHeader Deserialize(Stream stream) { IndexHeader indexHeader = new IndexHeader(); using (BinaryReader br = new BinaryReader(stream, Encoding.Default, true)) { indexHeader.identifier = (AaruBlockType)br.ReadUInt32(); indexHeader.entries = br.ReadUInt16(); indexHeader.crc64 = br.ReadUInt64(); } return indexHeader; } } }