Пример #1
0
        private void LoadWebepgConfigFile()
        {
            if (File.Exists(_configFileDir + "\\WebEPG.xml"))
            {
                Log.Info("WebEPG Config: Loading Existing WebEPG.xml");

                XmlSerializer s = new XmlSerializer(typeof(WebepgConfigFile));
                TextReader    r = null;
                try
                {
                    r           = new StreamReader(_configFileDir + "\\WebEPG.xml");
                    _configFile = (WebepgConfigFile)s.Deserialize(r);
                    r.Close();
                }
                catch (InvalidOperationException ex)
                {
                    if (r != null)
                    {
                        r.Close();
                    }
                    Log.Error("WebEPG: Error loading config {0}: {1}", _configFileDir + "\\WebEPG.xml",
                              ex.Message);
                    LoadOldConfigFile();
                }
            }

            // no file found set defaults
            if (_configFile == null)
            {
                _configFile               = new WebepgConfigFile();
                _configFile.Channels      = new List <ChannelMap>();
                _configFile.RadioChannels = new List <ChannelMap>();
                _configFile.Info          = new WebepgInfo();
                _configFile.Info.GrabDays = 2;
            }

            TvMappings.ChannelMapping = new Dictionary <string, ChannelMap>();
            foreach (ChannelMap channel in _configFile.Channels)
            {
                TvMappings.ChannelMapping.Add(channel.displayName, channel);
                if (channel.merged != null && channel.merged.Count == 0)
                {
                    channel.merged = null;
                }
            }
            TvMappings.OnChannelMappingChanged();

            RadioMappings.ChannelMapping = new Dictionary <string, ChannelMap>();
            foreach (ChannelMap channel in _configFile.RadioChannels)
            {
                RadioMappings.ChannelMapping.Add(channel.displayName, channel);
                if (channel.merged != null && channel.merged.Count == 0)
                {
                    channel.merged = null;
                }
            }
            RadioMappings.OnChannelMappingChanged();

            nMaxGrab.Value = _configFile.Info.GrabDays;
        }
Пример #2
0
        public override void OnSectionActivated()
        {
            Initialize();
            TvMappings.LoadGroups();
            RadioMappings.LoadGroups();

            ShowStatus();

            base.OnSectionActivated();
        }
Пример #3
0
        private void DoSelect(Object source, GrabberSelectedEventArgs e)
        {
            GrabberSelectionInfo id = e.Selection;

            switch (tabMain.SelectedIndex)
            {
            case 1:
                TvMappings.OnGrabberSelected(source, e);
                break;

            case 2:
                RadioMappings.OnGrabberSelected(source, e);
                break;
            }
        }
Пример #4
0
        private void bAutoMap_Click(object sender, EventArgs e)
        {
            if (cbCountry.SelectedItem != null)
            {
                Cursor.Current        = Cursors.WaitCursor;
                tabMain.SelectedIndex = 1;
                if (TvMappings.ChannelMapping.Count == 0)
                {
                    TvMappings.DoImportChannels();
                }
                AutoMapChannels(TvMappings.ChannelMapping.Values);
                TvMappings.OnChannelMappingChanged();

                tabMain.SelectedIndex = 2;
                if (RadioMappings.ChannelMapping.Count == 0)
                {
                    RadioMappings.DoImportChannels();
                }
                AutoMapChannels(RadioMappings.ChannelMapping.Values);
                RadioMappings.OnChannelMappingChanged();
            }
            return;
        }