/// <summary> /// Load configuration from the isolated storage /// </summary> public void RetrieveConfiguration() { try { //var settings = IsolatedStorageSettings.ApplicationSettings; //SubOptionsWrapper um2 = null; //String name; //IsolatedStorageSettings.ApplicationSettings.TryGetValue("configuration", out um2); //IsolatedStorageSettings.ApplicationSettings.TryGetValue("username", out name); TreasureOptionsWrapper umXML = null; using (IsolatedStorageFile store = IsolatedStorageFile.GetUserStoreForSite()) { if (store.FileExists(TreasureOptionsWrapper.STORAGE_FILENAME)) { using (IsolatedStorageFileStream isoStream = store.OpenFile(TreasureOptionsWrapper.STORAGE_FILENAME, FileMode.Open)) { XmlSerializer s = new XmlSerializer(typeof(TreasureOptionsWrapper)); TextReader writer = new StreamReader(isoStream); umXML = s.Deserialize(writer) as TreasureOptionsWrapper; writer.Close(); } } } if (umXML != null) { this.Copy(umXML); } } catch (Exception e) { //Debug.WriteLine("DE-SERIALIZATION ERROR : " + e.Message); } }
/// <summary> /// /// </summary> /// <returns>A deep copy of the Submarine Game options</returns> public TreasureOptionsWrapper Clone() { TreasureOptionsWrapper tt = new TreasureOptionsWrapper(); tt._auditory = this._auditory.Clone(); tt._gOption = this._gOption.Clone(); tt._user = this._user.Clone(); return(tt); }
/// <summary> /// /// </summary> /// <param name="temp"></param> public void Copy(TreasureOptionsWrapper temp) { if (temp == null) { return; } this._auditory = temp._auditory.Clone(); this._gOption = temp._gOption.Clone(); this._user = temp._user.Clone(); }