コード例 #1
0
    //private TreeNode _tGrabbers;


    public MergedChannelDetails(MergedChannel channel, GetGrabberSelectorCallback getGrabberSelectorCallback,
                                EventHandler ok_click)
    {
      InitializeComponent();

      _getGrabberSelector = getGrabberSelectorCallback;

      if (channel != null)
      {
        tbChannelName.Text = channel.id;
        tbGrabSite.Text = channel.grabber;
        tbStart.Text = channel.start;
        tbEnd.Text = channel.end;
      }
      bOk.Click += ok_click;
    }
コード例 #2
0
    //private void bMergedAdd_Click(object sender, EventArgs e)
    //{
    //  lvMerged.SelectedItems.Clear();
    //  //_mergeConfig = new MergedChannelDetails(tGrabbers, null, this.bMergedOk_Click);
    //  //_mergeConfig.MinimizeBox = false;
    //  //_mergeConfig.Show();
    //}

    //private void bMergedOk_Click(object sender, EventArgs e)
    //{
    //  if (lvMapping.SelectedItems.Count == 1)
    //  {
    //    ChannelMap channelMap = _channelMapping[lvMapping.SelectedItems[0].Text];
    //    if (lvMerged.SelectedItems.Count == 1)
    //    {
    //      MergedChannel channelDetails = (MergedChannel) lvMerged.SelectedItems[0].Tag;

    //      channelDetails.id = _mergeConfig.ChannelDetails.id;
    //      channelDetails.grabber = _mergeConfig.ChannelDetails.grabber;
    //      channelDetails.start = _mergeConfig.ChannelDetails.start;
    //      channelDetails.end = _mergeConfig.ChannelDetails.end;
    //    }
    //    else
    //    {
    //      channelMap.merged.Add(_mergeConfig.ChannelDetails);
    //    }
    //    UpdateMergedList(channelMap);
    //  }
    //  _mergeConfig.Close();
    //}

    //private void bMergedRemove_Click(object sender, EventArgs e)
    //{
    //  if (lvMerged.SelectedItems.Count == 1 && lvMapping.SelectedItems.Count == 1)
    //  {
    //    ChannelMap channelMap = _channelMapping[lvMapping.SelectedItems[0].Text];
    //    channelMap.merged.Remove((MergedChannel) lvMerged.SelectedItems[0].Tag);
    //    UpdateMergedList(channelMap);
    //  }
    //}

    //private void bMergedEdit_Click(object sender, EventArgs e)
    //{
    //  if (lvMerged.SelectedItems.Count == 1 && lvMapping.SelectedItems.Count == 1)
    //  {
    //    //MergedChannel channel = (MergedChannel) lvMerged.SelectedItems[0].Tag;
    //    //_mergeConfig = new MergedChannelDetails(tGrabbers, channel, this.bMergedOk_Click);
    //    //_mergeConfig.MinimizeBox = false;
    //    //_mergeConfig.Show();
    //  }
    //}

    private void tcMappingDetails_Selecting(object sender, TabControlCancelEventArgs e)
    {
      if (tcMappingDetails.SelectedIndex == 1)
      {
        if (lvMapping.SelectedItems.Count == 1)
        {
          if (_channelMapping.ContainsKey(lvMapping.SelectedItems[0].Text))
          {
            ChannelMap channelMap = _channelMapping[lvMapping.SelectedItems[0].Text];
            if (channelMap.merged == null || channelMap.merged.Count == 0)
            {
              channelMap.merged = new List<MergedChannel>();
              if (channelMap.id != null)
              {
                MergedChannel channel = new MergedChannel();
                channel.id = channelMap.id;
                channelMap.id = null;
                channel.grabber = channelMap.grabber;
                channelMap.grabber = null;
                channelMap.merged.Add(channel);
              }
              //_channelMapping.Remove(channel.Text);
              //_channelMapping.Add(channel.Text, channelMap);
            }
            UpdateMergedList(channelMap);
            UpdateList();
          }
        }
        else
        {
          e.Cancel = true;
          MessageBox.Show("Only one channel can be mapped to multiple channels at a time.", "Multiple Selection Error",
                          MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
        }
      }
      else
      {
        if (lvMapping.SelectedItems.Count == 1)
        {
          if (_channelMapping.ContainsKey(lvMapping.SelectedItems[0].Text))
          {
            if (_channelMapping[lvMapping.SelectedItems[0].Text].merged == null ||
                _channelMapping[lvMapping.SelectedItems[0].Text].merged.Count <= 1)
            {
              ChannelMap channelMap = _channelMapping[lvMapping.SelectedItems[0].Text];
              if (channelMap.merged != null)
              {
                if (channelMap.merged.Count > 0)
                {
                  channelMap.id = channelMap.merged[0].id;
                  channelMap.grabber = channelMap.merged[0].grabber;
                }
                channelMap.merged = null;
              }
              UpdateMergedList(channelMap);
              UpdateList();
            }
            else
            {
              e.Cancel = true;
              MessageBox.Show("Cannot convert multiple channels to single channel. Please remove one.",
                              "Multiple Channel Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
          }
        }
      }
    }
コード例 #3
0
    private void LoadOldConfigFile()
    {
      Log.Info("Trying to load old config file format");

      _configFile = new WebepgConfigFile();

      Xml xmlreader = new Xml(_configFileDir + "\\WebEPG.xml");

      _configFile.Info = new WebepgInfo();
      _configFile.Info.GrabDays = xmlreader.GetValueAsInt("General", "MaxDays", 2);
      _configFile.Info.GrabberDir = xmlreader.GetValueAsString("General", "GrabberDir", null);

      int AuthCount = xmlreader.GetValueAsInt("AuthSites", "Count", 0);
      if (AuthCount > 0)
      {
        _configFile.Sites = new List<SiteAuth>();
        for (int i = 1; i <= AuthCount; i++)
        {
          SiteAuth site = new SiteAuth();
          site.id = xmlreader.GetValueAsString("Auth" + i.ToString(), "Site", "");
          site.username = xmlreader.GetValueAsString("Auth" + i.ToString(), "Login", "");
          site.password = xmlreader.GetValueAsString("Auth" + i.ToString(), "Password", "");
          _configFile.Sites.Add(site);
        }
      }

      _configFile.Channels = new List<ChannelMap>();

      int channelCount = xmlreader.GetValueAsInt("ChannelMap", "Count", 0);

      for (int i = 1; i <= channelCount; i++)
      {
        ChannelMap channel = new ChannelMap();
        channel.displayName = xmlreader.GetValueAsString(i.ToString(), "DisplayName", "");
        string grabber = xmlreader.GetValueAsString(i.ToString(), "Grabber1", "");
        ;
        //if (mergedList.ContainsKey(channel.displayName))
        //{
        //  channel.merged = mergedList[channel.displayName];
        //  foreach (MergedChannel mergedChannel in channel.merged)
        //    mergedChannel.grabber = grabber;
        //}
        //else
        //{
        channel.id = xmlreader.GetValueAsString(i.ToString(), "ChannelID", "");
        channel.grabber = grabber;
        //}
        _configFile.Channels.Add(channel);
      }

      int mergeCount = xmlreader.GetValueAsInt("MergeChannels", "Count", 0);
      Dictionary<string, List<MergedChannel>> mergedList = new Dictionary<string, List<MergedChannel>>();

      if (mergeCount > 0)
      {
        for (int i = 1; i <= mergeCount; i++)
        {
          int channelcount = xmlreader.GetValueAsInt("Merge" + i.ToString(), "Channels", 0);
          if (channelcount > 0)
          {
            List<MergedChannel> mergedChannels = new List<MergedChannel>();
            ChannelMap channel = new ChannelMap();
            channel.displayName = xmlreader.GetValueAsString("Merge" + i.ToString(), "DisplayName", "");
            channel.merged = new List<MergedChannel>();
            for (int c = 1; c <= channelcount; c++)
            {
              MergedChannel mergedChannel = new MergedChannel();
              mergedChannel.id = xmlreader.GetValueAsString("Merge" + i.ToString(), "Channel" + c.ToString(), "");
              mergedChannel.start = xmlreader.GetValueAsString("Merge" + i.ToString(), "Start" + c.ToString(), "0:0");
              mergedChannel.end = xmlreader.GetValueAsString("Merge" + i.ToString(), "End" + c.ToString(), "0:0");
              channel.merged.Add(mergedChannel);
            }

            _configFile.Channels.Add(channel);
          }
        }
      }

      xmlreader.Clear();
      xmlreader.Dispose();
    }