public void OnAfterDeserialize() { foreach (FieldInfo field in _fields) { field.SetValue(this, JsonUtility.FromJson(GetString(null, field.Name), field.FieldType)); } try { AfterDeserialize?.Invoke(); } catch (Exception e) { LogError(e); } }
public override (Root xmlRoot, string warning) Load(byte[] projectFileRawXmlBytes) { // Note: Migrations not yet written for XML itself. ExtendedXmlSerializer has support for this // if we need it, put it in a new MigrationRunner.SetupMigrateXml() or similar. var xmlStr = Encoding.UTF8.GetString(projectFileRawXmlBytes); var versionNumOfData = RunPreDeserializeIntegrityChecks(xmlStr); var migrationRunner = MigrationRunner; migrationRunner.StartingSaveVersion = versionNumOfData; migrationRunner.TargetSaveVersion = CurrentSaveFormatVersion; var root = DeserializeProjectXml(xmlStr); RunIntegrityChecks(root.SaveVersion, root.Watermark); AfterDeserialize?.Invoke(this, root); return(root, ""); }