protected void ReadPrototypeEntry(BinaryStream stream) { long uid = 0; if (Use64Bit) { uid = stream.ReadInt64(); } else { uid = stream.ReadUInt32(); } var buffer = (Use64Bit) ? BitConverter.GetBytes(uid) : BitConverter.GetBytes((uint)uid); var lookup = new EntityPrototypeInfo(stream, 8); var obj = Context.GetRefByPtr(lookup.Offset) as NomadObject; if (obj == null) { throw new InvalidDataException($"Couldn't find library '{uid:X8}' at offset {lookup.Offset:X8}!"); } // remove before writing var libId = new NomadValue("UID", DataType.BinHex, buffer); obj.Attributes.Add(libId); Prototypes.Add(uid, obj); }
public void Deserialize(BinaryStream stream) { if (Use32Bit) { UID = stream.ReadUInt32(); } else { UID = stream.ReadInt64(); } Offset = stream.ReadInt32() + 8; TotalCount = stream.ReadUInt16(); NodesCount = stream.ReadUInt16(); }