public static void Load(ISavable savable) { BinaryFormatter bf = new BinaryFormatter(); Stream stream = new FileStream(SAVE_BASE_PATH + savable.GetDefaultFileName(), FileMode.Open); SaveDataBase save = (SaveDataBase)bf.Deserialize(stream); savable.LoadSaveData(save); }
public static bool Save(ISavable savable) { var save = savable.GenerateSaveData(); BinaryFormatter bf = new BinaryFormatter(); try { Stream stream = new FileStream(SAVE_BASE_PATH + savable.GetDefaultFileName(), FileMode.OpenOrCreate); bf.Serialize(stream, save); return(true); }catch (System.Security.SecurityException e) { //ErrorDisplay.ShowMessage("Failed Saving, would you like to try again?"); return(false); } }