public void ThrowExceptionOnSavingAnUnsupportedStream() { using (var otherStreamThanMemory = new BufferedStream(new MemoryStream())) using (var dataWriter = new BinaryWriter(otherStreamThanMemory)) Assert.Throws <BinaryDataSaver.UnableToSave>( () => BinaryDataSaver.SaveDataType(otherStreamThanMemory, typeof(object), dataWriter)); }
public static void LoadGlobal() { //only open if existing if ((GlobalSaveData)BinaryDataSaver.LoadData(GameManager.instance.globalSaveData) != null) { GameManager.instance.globalSaveData = (GlobalSaveData)BinaryDataSaver.LoadData(GameManager.instance.globalSaveData); } }
public static void ManageData() { BinaryDataSaver binaryDataSaver = new BinaryDataSaver(); RestSharpDataSender restSharpDataSender = new RestSharpDataSender(); bool internetConnection = restSharpDataSender.CheckInternetConnection(); if (internetConnection) { restSharpDataSender.SendMessageWithRestClient("smt message"); } else { binaryDataSaver.SaveData("smt message", "../../smtfloder"); } }
//global save and load public static void SaveGlobal() { BinaryDataSaver.SaveData(GameManager.instance.globalSaveData); Debug.Log("Save the game globally"); }
public void ThrowExceptionOnSavingAnInvalidObject() { Assert.Throws <NullReferenceException>( () => BinaryDataSaver.SaveDataType(null, typeof(object), null)); }