/// <summary> /// </summary> private void GetRecentSessionInfo() { StreamReader sr = null; try { string iniPath = AppDomain.CurrentDomain.BaseDirectory.TrimEnd(new char[] { '\\' }) + "profiles.dat"; var fi = new FileInfo(iniPath); if (fi.Exists) { sr = new StreamReader(iniPath); var content = sr.ReadToEnd(); content = GenUtil.Cypher(content); lstProfiles = XmlSerialization.Deserialize <List <ProfileDetail> >(content); } } catch (Exception ex) { MessageBox.Show(ex.Message, "Error"); } finally { if (sr != null) { sr.Dispose(); } } }
/// <summary> /// </summary> private void SaveCurrentSessionInfo() { StreamWriter sw = null; try { string iniPath = AppDomain.CurrentDomain.BaseDirectory.TrimEnd(new char[] { '\\' }) + "profiles.dat"; sw = new StreamWriter(iniPath, false); var xml = XmlSerialization.Serialize(lstProfiles); xml = GenUtil.Cypher(xml); sw.Write(xml); } catch (Exception ex) { MessageBox.Show(ex.Message, "Error"); } finally { if (sw != null) { sw.Dispose(); } } }