public static FcbEntry Deserialize(FcbEntry parent, Stream input, List <FcbEntry> pointers, Endian endian) { long position = input.Position; bool isOffset; var childCount = ReadCount(input, out isOffset, endian); if (isOffset == true) { return(pointers[(int)childCount]); } var child = new FcbEntry(); child.Position = position; pointers.Add(child); child.Deserialize(input, childCount, pointers, endian); return(child); }
public void Deserialize(Stream input) { input.Position = 0; var endian = Endian.Little; uint signature = 0x4643626E; var magic = input.ReadValueU32(endian); if (magic != signature) { throw new FormatException("invalid header magic"); } var version = input.ReadValueU16(endian); if (version != 3) { throw new FormatException("unsupported file version"); } var flags = input.ReadValueU16(endian); if (flags != 0) { //throw new FormatException("unsupported file flags"); } var totalObjectCount = input.ReadValueU32(endian); var totalValueCount = input.ReadValueU32(endian); var pointers = new List <FcbEntry>(); this.version = version; this.flags = flags; this.root = FcbEntry.Deserialize(null, input, pointers, endian); }