Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- currentState = new WorldstateHolder();
- Debug.Log("SaveSystem: ".Color(Color.magenta) + "LoadFromDisk(): Try load diff file");
- byte[] binary = null;
- string base64 = PlaysetPlugin.LoadTheWorld();
- if(!string.IsNullOrEmpty(base64)) {
- bool successfulConvert = true;
- try {
- binary = Convert.FromBase64String(base64);
- } catch(System.Exception) {
- Debug.LogWarning("SaveSystem: ".Color(Color.magenta) + "LoadFromDisk(): Unabled to convert diff file to byte-array");
- successfulConvert = false;
- }
- if(successfulConvert) {
- Debug.Log("SaveSystem: ".Color(Color.magenta) + "LoadFromDisk(): Successfully loaded diff file");
- stream = new MemoryStream(binary);
- reader = new BinaryReader(stream);
- try {
- ReadFromByteArray();
- }
- catch (Exception e) {
- currentState = new WorldstateHolder();
- Debug.Log("SaveSystem: ".Color(Color.magenta) + "LoadFromDisk(): failed reading binary stream from diff file: " + e);
- }
- //Clean up
- reader.Close();
- stream.Close();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement