Exporting save file to a string

Easy Save 2 has been replaced by Easy Save 3, so is no longer supported.
Locked
jinxology
Posts: 35
Joined: Sat Sep 13, 2014 5:21 pm

Exporting save file to a string

Post by jinxology »

I'm currently developing for WebGL using EasySave2. Is it possible to generate a string representing the player's save data so that they can can move their save to a different computer?
User avatar
Joel
Moodkie Staff
Posts: 4849
Joined: Wed Nov 07, 2012 10:32 pm

Re: Exporting save file to a string

Post by Joel »

Hi there,

You can use ES2.LoadRaw(filename) to get the file as a byte array, and then convert it to a Base-64 string. e.g.
//Get the file as a string.
string fileString = System.Convert.ToBase64String( ES2.LoadRaw("myFile.txt") );
// Save it back to a file.
ES2.SaveRaw( System.Convert.FromBase64String(fileString), "myNewFile.txt");
All the best,
Joel
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
jinxology
Posts: 35
Joined: Sat Sep 13, 2014 5:21 pm

Re: Exporting save file to a string

Post by jinxology »

Thanks Joel! As always, your customer support is seriously the best out there.
Locked