Rutherther / NosSmooth

Nostale bot library written in C#. May describe the current state of the game/character from packets. Multiple sources available for capturing the packets from running game.
MIT License
6 stars 3 forks source link

Pass CanBeNull to string serializer and converter #47

Closed Rutherther closed 1 year ago

Rutherther commented 1 year ago

This resolves #25.

The IStringConverter and IStringSerializer was modified to receive DeserializeOptions as last parameter of Deserialize method. That contains CanBeNull. Serialize assumes null shall be serialized as null, no options need to be passed. If there is an object that may not be null and it will be serialized, it should not be null in the first place, that's the reason serialize options are not needed.

When CanBeNull is true, the behavior is the same. When it's null, "null strings" ("-1", "-") are treated like their actual value instead of null.