using System.IO;
using SabreTools.IO.Extensions;
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();
indexHeader.identifier = (AaruBlockType)stream.ReadUInt32();
indexHeader.entries = stream.ReadUInt16();
indexHeader.crc64 = stream.ReadUInt64();
return indexHeader;
}
}
}