internal void DeserializeNode(DataNode node, SerializedData state) { if (state.Type != node.GetType()) { throw new Exception($"Type mismatch on deserialization: expected {state.Type}, got {node.GetType()}."); } reader.Init(state.Bytes); node.ReadBytes(reader); }
//If you serialize before & after some code, you can use this to check if it changed public bool IsEqualTo(SerializedData data) { if (Type != data.Type || Path != data.Path || Bytes.Length != data.Bytes.Length) { return(false); } for (int i = 0; i < Bytes.Length; ++i) { if (Bytes[i] != data.Bytes[i]) { return(false); } } return(true); }
public void Deserialize(SerializedData state) { Model.DeserializeNode(this, state); }