Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use more concise data types for deserialization #5

Open
mburtscher opened this issue Dec 27, 2020 · 4 comments
Open

Use more concise data types for deserialization #5

mburtscher opened this issue Dec 27, 2020 · 4 comments

Comments

@mburtscher
Copy link
Contributor

Currently most of the data is deserialized with either string, int and float. However there are several data points which could use much more concise data types such as TimeSpan, bool or custom implementations for Speed, Distance etc.

I have created some custom type converters for YamlDotNet in my SDK project:
https://github.com/OpenIRacingTools/Sdk/tree/master/OpenIRacingTools.Sdk/Yaml

They can be registered in YamlDotNet using WithTypeConverter() method:
https://github.com/OpenIRacingTools/Sdk/blob/master/OpenIRacingTools.Sdk/Sdk.cs#L55

@mburtscher
Copy link
Contributor Author

There is also a lot of information which can be expressed using proper enum types:

https://github.com/OpenIRacingTools/Sdk/tree/master/OpenIRacingTools.Sdk/Model/Enums

The code mentioned above contains an EnumTypeConverter which will read string representation for serialization of enum values from the Display attribute like in WeatherType.

@LuckyNoS7evin
Copy link
Contributor

Yes, this was/is on the roadmap, something "to be done"

@LuckyNoS7evin
Copy link
Contributor

@mburtscher if you want to do this could you do some testing on serialization times?

I'm of the opinion that we should be leaving it down to the developer to do what they want with the data. Now the reason for the serialization module was to just give the "basics" and therefore the basic types that iRacing gives out.

So if they give you a float it should be serialized as a float.

There is a Client separate from this SDK which may be the place to do this https://github.com/SlevinthHeaven/s7evemetry

@mburtscher
Copy link
Contributor Author

@LuckyNoS7evin I'm sorry for not responding. I don't think that I will have the time to work on any of this the coming weeks/months. So feel free to close if you don't feel like it was a significant improvement.

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

No branches or pull requests

2 participants