using System.IO; using System.Text; 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) { IndexEntry indexEntry = new IndexEntry(); #if NET20 || NET35 || NET40 using (var br = new BinaryReader(stream, Encoding.Default)) #else using (var br = new BinaryReader(stream, Encoding.Default, true)) #endif { indexEntry.blockType = (AaruBlockType)br.ReadUInt32(); indexEntry.dataType = (AaruDataType)br.ReadUInt16(); indexEntry.offset = br.ReadUInt64(); } return indexEntry; } } }