using System.IO;
using SabreTools.IO.Extensions;
namespace SabreTools.FileTypes.Aaru
{
///
/// Index entry
///
///
public class IndexEntry
{
/// Type of item pointed by this entry
public AaruBlockType blockType;
/// Type of data contained by the block pointed by this entry
public AaruDataType dataType;
/// Offset in file where item is stored
public ulong offset;
///
/// Read a stream as an IndexHeader
///
/// IndexHeader as a stream
/// Populated IndexHeader, null on failure
public static IndexEntry Deserialize(Stream stream)
{
var indexEntry = new IndexEntry();
indexEntry.blockType = (AaruBlockType)stream.ReadUInt32();
indexEntry.dataType = (AaruDataType)stream.ReadUInt16();
indexEntry.offset = stream.ReadUInt64();
return indexEntry;
}
}
}