Example #1
0
 /// <summary>
 /// Deserializes the given object.
 /// </summary>
 /// <param name="stream">Stream containing data.</param>
 /// <param name="type">The type of the object to create.</param>
 /// <returns>The deserialized object.</returns>
 public object Deserialize(Type type, SerializeStream stream)
 {
     if (type == typeof(int))
     {
         return(stream.ReadInt("value"));
     }
     else if (type == typeof(float))
     {
         return(stream.ReadFloat("value"));
     }
     else if (type == typeof(bool))
     {
         return(stream.ReadBool("value"));
     }
     else
     {
         throw new NotSupportedException("Type: " + type.Name + " not supported at the moment");
     }
 }