Beispiel #1
0
        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);
        }
Beispiel #2
0
 //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);
 }
Beispiel #3
0
 public void Deserialize(SerializedData state)
 {
     Model.DeserializeNode(this, state);
 }