public void saveInfo(ConfSendMail mailSettings) { try { var myfile = File.Create(pathModule + @"\SettingMail.xml"); XmlSerializer xml = new XmlSerializer(typeof(ConfSendMail)); xml.Serialize(myfile, mailSettings); myfile.Close(); } catch (Exception ex) { MessageBox.Show("" + ex.Message); } }
public void Load() { if (File.Exists("SettingMail.xml")) { XmlSerializer reader = new System.Xml.Serialization.XmlSerializer(typeof(ConfSendMail)); StreamReader file = new System.IO.StreamReader(pathModule + @"\SettingMail.xml"); ConfSendMail mail = new ConfSendMail(); mail = (ConfSendMail)reader.Deserialize(file); this.smtp = mail.smtp; this.port = mail.port; this.login = mail.login; this.password = Utils.Decrypt(mail.password); this.dest1_enable = mail.dest1_enable; this.dest1 = mail.dest1; this.dest2_enable = mail.dest2_enable; this.dest2 = mail.dest2; this.active = mail.active; this.totalTicks = mail.totalTicks; this.remaningTicks = mail.remaningTicks; file.Close(); } }