public object Deserialize(string pathToFile) { CollisionComponentsWrapper deserializedComponent = null; using (FileStream fileStream = new FileStream(pathToFile, FileMode.Open)) { deserializedComponent = (CollisionComponentsWrapper)serializer.Deserialize(fileStream); } PostDeserializeObserver(deserializedComponent); return(deserializedComponent); }
public void PostDeserializeObserver(object deserializedObject) { CollisionComponentsWrapper wrapper = deserializedObject as CollisionComponentsWrapper; if (wrapper == null) { throw new InvalidCastException(); } foreach (var component in wrapper.SerializedComponents) { component.PostDeserializeInit(); } }