We have an application that stores project information in a file by descending from TPersistent. We use TSteam.ReadComponentRes to read from a stream to the object.
We would like to be able to open project files with unknown properties (from newer versions or other development branches of our application). Currently this results in an exception in TReader, which is created by TStream. We've considered making a TStream descendant that uses a TReader descendant that handles this exception instead of stopping reading. Can anybody think of a more elegant way of doing this?
Call Stream.ReadResHeader, create a TReader instance, set its OnError event and call Reader.ReadRootComponent and free the reader (i.e. mimic the behaviour of TStream.ReadComponentRes).
Inside the OnError event handler you can set handled := true.