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

BSON support #44

Closed
heckubiss opened this issue May 14, 2015 · 4 comments
Closed

BSON support #44

heckubiss opened this issue May 14, 2015 · 4 comments

Comments

@heckubiss
Copy link

I have a list of abstract data class i would like to serialize to a file.
public List level = new List ();

I tried doing it with the Unity serializer. I am able to write and read from a file but when i read back, the data is incorrect so I thought I would try full serializer

I was able to get to this point but not sure how to send to a file and then deserialize

// add stuff to level

    object classdata= level;
    fsData data;
    fsSerializer _serializer = new fsSerializer();
    _serializer.TrySerialize(classdata, out data).AssertSuccessWithoutWarnings();
@jacobdufault
Copy link
Owner

Do System.IO.File.ReadAllText and System.IO.File.WriteAllText work?

Ie,

Saving the JSON to disk:
System.IO.File.WriteAllText("state", fsJsonPrinter.PrettyJson(data))

Restoring the JSON from disk:
fsData data = fsJsonParser.Parse(System.IO.File.ReadAllText("state"))

Please also see the StringSerializationAPI in the README.

See:

@heckubiss
Copy link
Author

OH sorry , I think I asked the wrong question.
How can I take a class and Serialize to binary?

@jacobdufault
Copy link
Owner

What do you mean by binary? BSON is not currently supported - I'd be happy to accept a pull request though if you implemented it via a fsBsonPrinter similar to fsJsonPrinter.

@jacobdufault jacobdufault changed the title How to write serialized data to file BSON support Jun 5, 2015
@jacobdufault
Copy link
Owner

Closing for now. Feel free to submit a PR with BSON support and I'll integrate it into the main repro.

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