Пример #1
0
 public void Add(BackupPeriodSetting backupPeriodSetting)
 {
     using (XmlWriter writer = XmlWriter.Create("BackupPeriodSettings.xml"))
     {
         writer.WriteStartDocument();
         writer.WriteStartElement("Settings");
         writer.WriteStartElement("BackupSetting");
         writer.WriteElementString("RepeatOn", backupPeriodSetting.RepeatOn);
         writer.WriteElementString("Period", backupPeriodSetting.Period);
         writer.WriteElementString("Time", backupPeriodSetting.Time);
         writer.WriteEndElement();
         writer.WriteEndElement();
         writer.WriteEndDocument();
     }
 }
Пример #2
0
        public BackupPeriodSetting GetBackupPeriodSetting()
        {
            BackupPeriodSetting backupPeriodSetting = new BackupPeriodSetting();

            XmlDocument xmlDoc = new XmlDocument();

            xmlDoc.Load("BackupPeriodSettings.xml");

            //sender info
            XmlNodeList senderNodeList = xmlDoc.DocumentElement.SelectNodes("BackupSetting");

            backupPeriodSetting.RepeatOn = senderNodeList[0].SelectSingleNode("RepeatOn").InnerText;
            backupPeriodSetting.Period   = senderNodeList[0].SelectSingleNode("Period").InnerText;
            backupPeriodSetting.Time     = senderNodeList[0].SelectSingleNode("Time").InnerText;
            return(backupPeriodSetting);
        }