TMPE
TMPE copied to clipboard
New persistence strategy
Resolves #1502
This PR provides a new way to save data so that changes can be made to the model without breaking old savegames.
The complete task list for this project is at #1502.
Also see this wiki page: https://github.com/CitiesSkylinesMods/TMPE/wiki/Loading-and-Saving-Data
Can add tests to your checklist (at least run manual test once):
- [ ] Old save in new serialization code (should read)
- [ ] New save in old serialization code (should do what? ignore new and load old, or have no old and load blank settings)
- [ ] New save in new serialization code
Can add tests to your checklist (at least run manual test once):
Here's what I tested:
- Transition from binary to XML:
- Reading old data:
- Load old data in new version. No XML found, so it reads the binary data.
- Saving new data with backward compatibility:
- Save new (XML) and old (binary) data to same file (default behavior until we decide we don't need to write the binary data anymore).
- Load in old version. It completely ignores the XML data.
- Load in new version. It sees the XML data and ignores the binary data.
- Reading old data:
- Versioning in XML (currently only tested in #1392 code):
- Reading old data:
- Load old data into new version. It detects the absence of the new feature, and reads the old way.
- Saving new data with backward compatibility:
- Save XML elements with and without the new feature.
- Load in old version. It skips elements with the new feature and reads elements without.
- Load in new version. It reads elements with the new feature and skips elements without.
- Reading old data:
@kvakvs If you weren't already aware, the original issue that prompted this was, as indicated in #1502, the inability to revise the save format without breaking older builds. While we don't support old versions, this still creates a problem for anyone (including ourselves) who wants to run test builds.
But since we don't support old versions, the intention is that once a feature is released to stable, the legacy code that writes data the old way gets removed. (The code to read the old way has to stay pretty much forever, though I imagine we'll identify exceptions on a case-by-case basis.)
I am converting this to draft, since TrafficManager.Util.Record
was not addressed.