Advertisement
Guest User

Untitled

a guest
Oct 9th, 2015
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.06 KB | None | 0 0
  1. currentState = new WorldstateHolder();
  2. Debug.Log("SaveSystem: ".Color(Color.magenta) + "LoadFromDisk(): Try load diff file");
  3. byte[] binary = null;
  4. string base64 = PlaysetPlugin.LoadTheWorld();
  5. if(!string.IsNullOrEmpty(base64)) {
  6. bool successfulConvert = true;
  7. try {
  8. binary = Convert.FromBase64String(base64);
  9. } catch(System.Exception) {
  10. Debug.LogWarning("SaveSystem: ".Color(Color.magenta) + "LoadFromDisk(): Unabled to convert diff file to byte-array");
  11. successfulConvert = false;
  12. }
  13. if(successfulConvert) {
  14. Debug.Log("SaveSystem: ".Color(Color.magenta) + "LoadFromDisk(): Successfully loaded diff file");
  15. stream = new MemoryStream(binary);
  16. reader = new BinaryReader(stream);
  17.  
  18. try {
  19. ReadFromByteArray();
  20. }
  21. catch (Exception e) {
  22. currentState = new WorldstateHolder();
  23. Debug.Log("SaveSystem: ".Color(Color.magenta) + "LoadFromDisk(): failed reading binary stream from diff file: " + e);
  24. }
  25. //Clean up
  26. reader.Close();
  27. stream.Close();
  28. }
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement