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) { var indexHeader = new IndexHeader(); #if NET20 || NET35 || NET40 using (var br = new BinaryReader(stream, Encoding.Default)) #else using (var br = new BinaryReader(stream, Encoding.Default, true)) #endif { indexHeader.identifier = (AaruBlockType)br.ReadUInt32(); indexHeader.entries = br.ReadUInt16(); indexHeader.crc64 = br.ReadUInt64(); } return indexHeader; } } }