private MidGameSettingsPacket loadData_set(string fileName) { FileStream file = null; MidGameSettingsPacket returnPacket = null; try { BinaryFormatter formatter = new BinaryFormatter(); file = File.Open(Application.persistentDataPath + fileName, FileMode.Open); returnPacket = formatter.Deserialize(file) as MidGameSettingsPacket; } catch (Exception e) { Debug.Log("There was an exception...? Loading Set"); returnPacket = new MidGameSettingsPacket(); } finally { if (file != null) { file.Close(); } } Debug.Log("Path is: " + (Application.persistentDataPath + fileName)); return(returnPacket); }
private void saveData_set(MidGameSettingsPacket packet, string fileName) { FileStream file = null; try { BinaryFormatter formatter = new BinaryFormatter(); file = File.Create(Application.persistentDataPath + fileName); formatter.Serialize(file, packet); } catch (Exception e) { Debug.Log("There was an exception...? Saving Set"); } finally { if (file != null) { file.Close(); } } }
private void loadMidGameSettingsData() { midGameSettingsPacket = loadData_set(Constants.fileName_midGamSettings); }