/// <summary> /// Loads the preferences the user has entered as XML /// </summary> private void LoadPreferenceData() { prefs = new SkyBoxPreference(); if (File.Exists(Path.Combine(this.folder, "preference.xml"))) { try { System.Xml.Serialization.XmlSerializer reader = new System.Xml.Serialization.XmlSerializer(prefs.GetType()); System.IO.StreamReader file = new System.IO.StreamReader(Path.Combine(this.folder, "preference.xml")); prefs = (SkyBoxPreference)reader.Deserialize(file); file.Close(); } catch (System.Exception e) { Debug.LogException(e); } } }
/// <summary> /// Loads the preferences the user has entered as XML /// </summary> private void LoadPreferenceData() { prefs = new SkyBoxPreference(); if( File.Exists(Path.Combine(this.folder, "preference.xml")) ) { try { System.Xml.Serialization.XmlSerializer reader = new System.Xml.Serialization.XmlSerializer(prefs.GetType()); System.IO.StreamReader file = new System.IO.StreamReader(Path.Combine(this.folder, "preference.xml")); prefs = (SkyBoxPreference) reader.Deserialize(file); file.Close(); } catch (System.Exception e) { Debug.LogException(e); } } }
/// <summary> /// Saves the preferences the user has entered as XML /// </summary> private void SavePreferenceData() { try { System.Xml.Serialization.XmlSerializer writer = new System.Xml.Serialization.XmlSerializer(prefs.GetType()); StreamWriter file = new System.IO.StreamWriter(Path.Combine(this.folder, "preference.xml")); writer.Serialize(file, prefs); file.Close(); } catch (System.Exception e) { Debug.LogException(e); } }