public DDTFile(string path) { using (BinaryReader reader = new BinaryReader(File.OpenRead(path))) { _rootDirectory = (DDTDirectoryEntry)DDTEntryFactory.GetEntry(null, reader); } }
public static DDTEntry GetEntry(DDTEntry parent, BinaryReader reader) { int nameOffset = reader.ReadInt32(); uint dataOffset = reader.ReadUInt32(); int numData = reader.ReadInt32(); long posNextEntry = reader.GetPosition(); DDTEntry entry; if (numData < 0) { int numChildren = ~numData + 1; entry = new DDTDirectoryEntry(reader, parent, nameOffset, dataOffset, numChildren); } else { entry = new DDTFileEntry(reader, parent, nameOffset, dataOffset, numData); } reader.Seek(posNextEntry, SeekOrigin.Begin); return entry; }