hadashiA / VYaml

The extra fast, low memory footprint YAML library for C#, focued on .NET and Unity.
MIT License
305 stars 18 forks source link

deserializer isn't distinguish long and double type. #52

Closed jinialadin1 closed 10 months ago

jinialadin1 commented 10 months ago

Hello, I'm trying to parsing the Unity Scene file using this library.

image

left is the original Image and right side is the deserialized and serialized by the library

As you can see in the above image, fileID is long type as I believe, but the deserializer make it as double type. fileID was 1058064039477804610 but changed to 1.0580640394778E+18.

So when I serialize it again, the scene file would be corrupted due to those issue. Could you fix it? Thank you so much.

I used this library like below code

    var memory = new ReadOnlyMemory<byte>(Encoding.UTF8.GetBytes(sceneString));
    var collection = YamlSerializer.DeserializeMultipleDocuments<dynamic>(memory).ToList();
    ...

would it be possible to customize deserialize only for the type IYamlFormatter<KeyValuePair<TKey, TValue>> when TKey is string and it is fileID ?

hadashiA commented 10 months ago

Helo, tanks for the report.

Fixed in #55