Exemplo n.º 1
0
        /// <summary>
        /// Load external channel configurations.
        /// </summary>
        internal static void LoadExternalConfigs()
        {
            IList <Card> cards = Card.ListAll();

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

                Card dummyCard = new Card(0, "device path", "Dummy TV Card", 0, false, DateTime.Now, "recording folder", 0,
                                          false, 0, "timeshifting folder", 0, 0, false, false, false, 0);
                cards.Add(dummyCard);
            }

            _externalChannelConfigs = new ExternalChannelConfig[cards.Count];

            int index = 0;

            foreach (Card card in cards)
            {
                string fileName = Path.Combine(ExtCfgFolder, String.Format("ExternalChannelConfig{0}.xml", card.IdCard));
                try
                {
                    _externalChannelConfigs[index] = ExternalChannelConfig.Load(fileName);
                }
                catch (Exception ex)
                {
                    _externalChannelConfigs[index] = new ExternalChannelConfig(fileName);
                    Log.Error(ex.ToString());
                }

                _externalChannelConfigs[index].CardId = card.IdCard;
                index++;
            }
        }
Exemplo n.º 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++;
            }
        }