예제 #1
0
    public void Save()
    {
      if (_ConfigList != null)
      {
        string confFile = _strPath + "\\WebEPG.xml";
        if (File.Exists(confFile))
        {
          File.Delete(confFile.Replace(".xml", ".bak"));
          File.Move(confFile, confFile.Replace(".xml", ".bak"));
        }
        Xml xmlwriter = new Xml(confFile);

        xmlwriter.SetValue("General", "MaxDays", _MaxGrab.ToString());
        xmlwriter.SetValue("ChannelMap", "Count", _ConfigList.Count.ToString());

        for (int i = 0; i < _ConfigList.Count; i++)
        {
          EPGConfigData channel = (EPGConfigData)_ConfigList[i];
          xmlwriter.SetValue((i + 1).ToString(), "ChannelID", channel.ChannelID);
          xmlwriter.SetValue((i + 1).ToString(), "DisplayName", channel.DisplayName);
          xmlwriter.SetValue((i + 1).ToString(), "Grabber1", channel.PrimaryGrabberID);
          if (channel.Linked)
          {
            xmlwriter.SetValueAsBool((i + 1).ToString(), "Grabber1-Linked", channel.Linked);
            xmlwriter.SetValue((i + 1).ToString(), "Grabber1-Start", channel.linkStart);
            xmlwriter.SetValue((i + 1).ToString(), "Grabber1-End", channel.linkEnd);
          }
        }
        xmlwriter.Save();
      }
    }