ES2 console example with ES3

Discussion and help for Easy Save 3
Post Reply
csmith
Posts: 1
Joined: Sat Dec 30, 2023 5:42 pm

ES2 console example with ES3

Post by csmith »

Hi,

I am using ES3 for saving and loading on console platform and found this ES2 example for reading and writing bytes on console:

https://docs.moodkie.com/easy-save-2/su ... platforms/

However I couldn't find a "ReadAllBytes()" function when converting this logic to ES3, and I can't seem to access the stream in the ES3 writer:

Code: Select all

ES3Settings settings = new ES3Settings();
settings.location = ES3.Location.Resources;

using (ES3Writer writer = ES3Writer.Create(settings))
{
	writer.WriteProperty("myTag", 123);
	writer.Save();
	byte[] bytes = writer.stream.ReadAllBytes();
	SaveToStorageAPI(bytes);
}
This is the current state of my load data function which seems to be OK:

Code: Select all

ES3Settings settings = new ES3Settings();
settings.location = ES3.Location.Resources;
var bytes = LoadFromStorageAPI();

using (ES3Reader reader = ES3Reader.Create(bytes, settings))
{
	int myInt = reader.Read<int>("myTag");
}
Is it possible to use similar logic as given in the ES2 console example with ES3 to save and load bytes to memory?

Thanks
User avatar
Joel
Moodkie Staff
Posts: 4849
Joined: Wed Nov 07, 2012 10:32 pm

Re: ES2 console example with ES3

Post by Joel »

Hi there,

You should follow the Integrating with other storage APIs instructions in ES3:
https://docs.moodkie.com/easy-save-3/es ... rage-apis/

All the best,
Joel
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
Post Reply