Skip to content

EM Serialization#334

Merged
DanzaG merged 1 commit intoLostArtefacts:masterfrom
lahm86:master
May 14, 2022
Merged

EM Serialization#334
DanzaG merged 1 commit intoLostArtefacts:masterfrom
lahm86:master

Conversation

@lahm86
Copy link
Copy Markdown
Collaborator

@lahm86 lahm86 commented May 14, 2022

#333 EM Serialization

Reserialization of EM mapping is now supported. Although there will be added bloat for values not originally mentioned in the JSON, nulls will be ignored. The serializer will also take care to write inherited properties first so that these are set correctly on deserialization. The Comments and EMType/ConditionType fields will always be first for clarity if scanning through the JSON file.

In terms of testing, see https://github.com/lahm86/TREnvironmentEditorTests/blob/main/TREnvironmentEditorTests/RewriteTest.cs. This reads in current EM data, serializes it again and then applies each individual function from the original and "new" JSON on two separate level objects and verifies that the output is identical.

Some trigger issues came to light when the JSON has additional values that we hadn't specified before.

  • Fixes the setting of TrigAction in FDActionListItem - it was previously removing the wrong value before setting the new one. The new JSON will have the value defined, previously we only specified TrigAction and Parameter. So this wasn't a problem before because the value was essentially 0, so the bug in line 34 of FDActionListItem wasn't kicking in.
  • Fixes the setting of OneShot in FDTrigSetup as this was toggling rather than respecting the passed in value. This is similar to above, so because OneShot is always defined in the JSON, it was in effect toggling it after the value had been set already and so generally was becoming true in all cases.

Also:

  • The Timer value in FDTrigSetup can now be set.
  • Unit tests for FD updated for above.

- Reserialization of EM mapping is now supported. Although there will be added bloat for values not originally mentioned, nulls will be ignored. The serializer will also take care to write inherited properties first so that these are set correctly on deserialization.
- Fixes the setting of TrigAction in FDActionListItem - it was previously removing the wrong value before setting the new one.
- Fixes the setting on OneShot in FDTrigSetup as this was toggling rather than respecting the passed in value.
- The Timer value in FDTrigSetup can now be set.
- Unit tests for FD updated.
@DanzaG DanzaG merged commit 2a69870 into LostArtefacts:master May 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants