Example #1
0
        private void ExternalChannels_Load(object sender, EventArgs e)
        {
            ArrayList cards = new ArrayList();

            TVDatabase.GetCards(ref cards);

            if (cards.Count == 0)
            {
                cards.Add(0);
            }

            _tvCardTabs      = new TabPage[cards.Count];
            _tvCardStbSetups = new StbSetup[cards.Count];

            comboBoxCopyFrom.Items.Clear();

            int index = 0;

            foreach (int cardId in cards)
            {
                string cardName = String.Format("TV Card {0}", cardId);

                comboBoxCopyFrom.Items.Add(cardName);

                _tvCardStbSetups[index]      = new StbSetup(cardId);
                _tvCardStbSetups[index].Name = "StbSetup" + index;
                _tvCardStbSetups[index].Dock = DockStyle.Fill;

                _tvCardTabs[index] = new TabPage(cardName);
                _tvCardTabs[index].Controls.Add(_tvCardStbSetups[index]);

                tabControlTVCards.TabPages.Add(_tvCardTabs[index]);

                index++;
            }

            comboBoxCopyFrom.SelectedIndex = 0;

            // Setup quick setup combo box
            string[] quickSetupFiles = Directory.GetFiles(Common.FolderSTB, "*.xml", SearchOption.TopDirectoryOnly);
            foreach (string file in quickSetupFiles)
            {
                comboBoxQuickSetup.Items.Add(Path.GetFileNameWithoutExtension(file));
            }

            comboBoxQuickSetup.Items.Add("Clear all");
        }
Example #2
0
        /// <summary>
        /// Load external channel configurations.
        /// </summary>
        private static void LoadExternalConfigs()
        {
            ArrayList cards = new ArrayList();

            TVDatabase.GetCards(ref cards);

            if (cards.Count == 0)
            {
                Log.Warn("TV2BlasterPlugin: Cannot load external channel configurations, there are no TV cards registered");

                cards.Add(0);
            }

            _externalChannelConfigs = new ExternalChannelConfig[cards.Count];

            int index = 0;

            foreach (int cardId in cards)
            {
                string fileName = Path.Combine(ExtCfgFolder, String.Format("ExternalChannelConfig{0}.xml", cardId));

                try
                {
                    _externalChannelConfigs[index] = ExternalChannelConfig.Load(fileName);
                }
                catch (Exception ex)
                {
                    Log.Error(ex);

                    _externalChannelConfigs[index] = new ExternalChannelConfig(fileName);
                }

                _externalChannelConfigs[index].CardId = cardId;
                index++;
            }
        }