当前位置: 首页>>代码示例>>C#>>正文


C# TvBusinessLayer.GetCardByDevicePath方法代码示例

本文整理汇总了C#中TvDatabase.TvBusinessLayer.GetCardByDevicePath方法的典型用法代码示例。如果您正苦于以下问题:C# TvBusinessLayer.GetCardByDevicePath方法的具体用法?C# TvBusinessLayer.GetCardByDevicePath怎么用?C# TvBusinessLayer.GetCardByDevicePath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TvDatabase.TvBusinessLayer的用法示例。


在下文中一共展示了TvBusinessLayer.GetCardByDevicePath方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Main

    static void Main(string[] args)
    {
      TvBusinessLayer layer = new TvBusinessLayer();
      layer.AddCard("name1", "path1", 1);
      layer.AddCard("name2", "path2", 2);
      layer.AddCard("name3", "path3", 3);
      layer.AddCard("name4", "path4", 4);

      Card card = layer.GetCardByName("name2");
      card = layer.GetCardByDevicePath("path4");

      Channel channel = layer.AddChannel("provider", "name");
      channel = layer.AddChannel("provider", "name");
      

      DatabaseManager.Instance.SaveChanges();

    }
开发者ID:arangas,项目名称:MediaPortal-1,代码行数:18,代码来源:Program.cs

示例2: TvCardDvbB2C2

    /// <summary>
    /// Initializes a new instance of the <see cref="TvCardDvbB2C2"/> class.
    /// </summary>
    /// <param name="device">The device.</param>
    public TvCardDvbB2C2(DsDevice device, DeviceInfo deviceInfo)
      : base(device)
    {
      _deviceInfo = deviceInfo;
      _devicePath = deviceInfo.DevicePath;
      _name = deviceInfo.Name;
      GetPreloadBitAndCardId();

      _useDISEqCMotor = false;
      TvBusinessLayer layer = new TvBusinessLayer();
      Card card = layer.GetCardByDevicePath(_devicePath);
      if (card != null)
      {
        Setting setting = layer.GetSetting("dvbs" + card.IdCard + "motorEnabled", "no");
        if (setting.Value == "yes")
          _useDISEqCMotor = true;
      }
      _conditionalAccess = new ConditionalAccess(null, null, null, this);
      _ptrDisEqc = Marshal.AllocCoTaskMem(20);
      _disEqcMotor = new DiSEqCMotor(this);
      GetTunerCapabilities();
    }
开发者ID:hkjensen,项目名称:MediaPortal-1,代码行数:26,代码来源:TvCardDvbB2C2.cs

示例3: DoTvScan

    private void DoTvScan()
    {
      int channelsNew = 0;
      int channelsUpdated = 0;

      string buttonText = mpButtonScanTv.Text;
      checkButton.Enabled = false;
      try
      {
        _isScanning = true;
        _stopScanning = false;
        mpButtonScanTv.Text = "Cancel...";
        RemoteControl.Instance.EpgGrabberEnabled = false;
        TvBusinessLayer layer = new TvBusinessLayer();
        Card card = layer.GetCardByDevicePath(RemoteControl.Instance.CardDevice(_cardNumber));
        mpComboBoxCountry.Enabled = false;
        mpComboBoxSource.Enabled = false;
        mpComboBoxSensitivity.Enabled = false;
        checkBoxCreateSignalGroup.Enabled = false;
        checkBoxNoMerge.Enabled = false;
        mpButtonScanRadio.Enabled = false;
        mpButtonAddSvideoChannels.Enabled = false;
        mpListView1.Items.Clear();
        CountryCollection countries = new CountryCollection();
        IUser user = new User();
        user.CardId = _cardNumber;
        AnalogChannel temp = new AnalogChannel();
        temp.TunerSource = mpComboBoxSource.SelectedIndex == 0 ? TunerInputType.Antenna : TunerInputType.Cable;
        temp.VideoSource = AnalogChannel.VideoInputType.Tuner;
        temp.AudioSource = AnalogChannel.AudioInputType.Tuner;
        temp.Country = countries.Countries[mpComboBoxCountry.SelectedIndex];
        temp.IsRadio = false;
        temp.IsTv = true;
        TvResult tuneResult = RemoteControl.Instance.Tune(ref user, temp, -1);
        if (tuneResult == TvResult.SWEncoderMissing)
        {
          Log.Error("analog: DoTvScan error (missing software encoder)");
          MessageBox.Show("Please install a supported audio/video encoder for your software analog card",
                          "Unable to scan", MessageBoxButtons.OK, MessageBoxIcon.Error);
          return;
        }
        if (tuneResult == TvResult.GraphBuildingFailed)
        {
          Log.Error("analog: DoTvScan error (missing software encoder)");
          MessageBox.Show(
            "The graph building. Mostly your card is not supported by TvServer. Please create a report in our forum",
            "Unable to scan", MessageBoxButtons.OK, MessageBoxIcon.Error);
          return;
        }
        if (string.IsNullOrEmpty(_configuration.Graph.Capture.Name))
        {
          _configuration = Configuration.readConfiguration(_cardNumber, _cardName, _devicePath);
          ReCheckSettings();
        }
        int minChannel = RemoteControl.Instance.MinChannel(_cardNumber);
        int maxChannel = RemoteControl.Instance.MaxChannel(_cardNumber);
        if (maxChannel <= 0)
        {
          maxChannel = mpComboBoxSource.SelectedIndex == 0 ? 69 : 125;
        }
        if (minChannel < 0)
          minChannel = 1;
        Log.Info("Min channel = {0}. Max channel = {1}", minChannel, maxChannel);
        for (int channelNr = minChannel; channelNr <= maxChannel; channelNr++)
        {
          if (_stopScanning)
            return;
          float percent = ((float)((channelNr - minChannel)) / (maxChannel - minChannel));
          percent *= 100f;
          if (percent > 100f)
            percent = 100f;
          if (percent < 0)
            percent = 0f;
          progressBar1.Value = (int)percent;
          AnalogChannel channel = new AnalogChannel();
          channel.TunerSource = mpComboBoxSource.SelectedIndex == 0 ? TunerInputType.Antenna : TunerInputType.Cable;
          channel.Country = countries.Countries[mpComboBoxCountry.SelectedIndex];
          channel.ChannelNumber = channelNr;
          channel.IsTv = true;
          channel.IsRadio = false;
          channel.VideoSource = AnalogChannel.VideoInputType.Tuner;
          channel.AudioSource = AnalogChannel.AudioInputType.Automatic;
          string line = String.Format("channel:{0} source:{1} ", channel.ChannelNumber, mpComboBoxSource.SelectedItem);
          ListViewItem item = mpListView1.Items.Add(new ListViewItem(line));
          item.EnsureVisible();

          IChannel[] channels = RemoteControl.Instance.Scan(_cardNumber, channel);
          UpdateStatus();
          if (channels == null || channels.Length == 0)
          {
            if (RemoteControl.Instance.TunerLocked(_cardNumber) == false)
            {
              line = String.Format("channel:{0} source:{1} : No Signal", channel.ChannelNumber,
                                   mpComboBoxSource.SelectedItem);
              item.Text = line;
              item.ForeColor = Color.Red;
              continue;
            }
            line = String.Format("channel:{0} source:{1} : Nothing found", channel.ChannelNumber,
                                 mpComboBoxSource.SelectedItem);
//.........这里部分代码省略.........
开发者ID:npcomplete111,项目名称:MediaPortal-1,代码行数:101,代码来源:CardAnalog.cs

示例4: mpButtonScan_Click

 private void mpButtonScan_Click(object sender, EventArgs e)
 {
   if (_isScanning == false)
   {
     TvBusinessLayer layer = new TvBusinessLayer();
     Card card = layer.GetCardByDevicePath(RemoteControl.Instance.CardDevice(_cardNumber));
     if (card.Enabled == false)
     {
       MessageBox.Show(this, "Tuner is disabled. Please enable the tuner before scanning.");
       return;
     }
     if (!RemoteControl.Instance.CardPresent(card.IdCard))
     {
       MessageBox.Show(this, "Tuner is not found. Please make sure the tuner is present before scanning.");
       return;
     }
     // Check if the card is locked for scanning.
     IUser user;
     if (RemoteControl.Instance.IsCardInUse(_cardNumber, out user))
     {
       MessageBox.Show(this,
                       "Tuner is locked. Scanning is not possible at the moment. Perhaps you are using another part of a hybrid card?");
       return;
     }
     Thread scanThread = new Thread(DoTvScan);
     scanThread.Name = "Analog TV scan thread";
     scanThread.Start();
   }
   else
   {
     _stopScanning = true;
   }
 }
开发者ID:npcomplete111,项目名称:MediaPortal-1,代码行数:33,代码来源:CardAnalog.cs

示例5: OnSectionDeActivated

    public override void OnSectionDeActivated()
    {
      base.OnSectionDeActivated();
      TvBusinessLayer layer = new TvBusinessLayer();
      Setting setting = layer.GetSetting("analog" + _cardNumber + "Country", "0");
      setting.Value = mpComboBoxCountry.SelectedIndex.ToString();
      setting.Persist();
      setting = layer.GetSetting("analog" + _cardNumber + "Source", "0");
      setting.Value = mpComboBoxSource.SelectedIndex.ToString();
      setting.Persist();

      setting = layer.GetSetting("analog" + _cardNumber + "createsignalgroup", "false");
      setting.Value = checkBoxCreateSignalGroup.Checked ? "true" : "false";
      setting.Persist();

      UpdateConfiguration();
      Configuration.writeConfiguration(_configuration);
      Card card = layer.GetCardByDevicePath(RemoteControl.Instance.CardDevice(_cardNumber));
      if (card.Enabled)
      {
        try
        {
          RemoteControl.Instance.ReloadCardConfiguration(_cardNumber);
        }
        catch
        {
          Log.WriteFile("Could not reload card configuration");
        }
        return;
      }
    }
开发者ID:npcomplete111,项目名称:MediaPortal-1,代码行数:31,代码来源:CardAnalog.cs

示例6: checkButton_Click

 private void checkButton_Click(object sender, EventArgs e)
 {
   IUser user;
   try
   {
     TvBusinessLayer layer = new TvBusinessLayer();
     Card card = layer.GetCardByDevicePath(RemoteControl.Instance.CardDevice(_cardNumber));
     if (card.Enabled == false)
     {
       MessageBox.Show(this, "Card is disabled, please enable the card before checking quality control");
       return;
     }
     else if (!RemoteControl.Instance.CardPresent(card.IdCard))
     {
       MessageBox.Show(this, "Card is not found, please make sure card is present before checking quality control");
       return;
     }
     // Check if the card is locked for scanning.
     if (RemoteControl.Instance.IsCardInUse(_cardNumber, out user))
     {
       MessageBox.Show(this,
                       "Card is locked. Checking quality control not possible at the moment ! Perhaps you are scanning an other part of a hybrid card.");
       return;
     }
     user = new User();
     user.CardId = _cardNumber;
     AnalogChannel temp = new AnalogChannel();
     temp.VideoSource = AnalogChannel.VideoInputType.Tuner;
     temp.AudioSource = AnalogChannel.AudioInputType.Tuner;
     temp.IsRadio = false;
     temp.IsTv = true;
     RemoteControl.Instance.Tune(ref user, temp, -1);
     if (RemoteControl.Instance.SupportsQualityControl(_cardNumber))
     {
       _cardName = RemoteControl.Instance.CardName(_cardNumber);
       _devicePath = RemoteControl.Instance.CardDevice(_cardNumber);
       bitRateModeGroup.Enabled = RemoteControl.Instance.SupportsBitRateModes(_cardNumber);
       if (RemoteControl.Instance.SupportsPeakBitRateMode(_cardNumber))
       {
         vbrPeakPlayback.Enabled = true;
         vbrPeakRecord.Enabled = true;
       }
       else
       {
         vbrPeakPlayback.Enabled = false;
         vbrPeakRecord.Enabled = false;
       }
       if (RemoteControl.Instance.SupportsBitRate(_cardNumber))
       {
         bitRate.Enabled = true;
         customSettingsGroup.Enabled = true;
         customValue.Enabled = true;
         customValuePeak.Enabled = true;
       }
       else
       {
         bitRate.Enabled = false;
         customSettingsGroup.Enabled = false;
         customValue.Enabled = false;
         customValuePeak.Enabled = false;
       }
       _configuration = Configuration.readConfiguration(_cardNumber, _cardName, _devicePath);
       customValue.Value = _configuration.CustomQualityValue;
       customValuePeak.Value = _configuration.CustomPeakQualityValue;
       SetBitRateModes();
       SetBitRate();
       ReCheckSettings();
     }
     else
     {
       Log.WriteFile("Card doesn't support quality control");
       MessageBox.Show("The used encoder doesn't support quality control.",
                       "MediaPortal - TV Server management console", MessageBoxButtons.OK, MessageBoxIcon.Information);
       if (string.IsNullOrEmpty(_configuration.Graph.Capture.Name))
       {
         _configuration = Configuration.readConfiguration(_cardNumber, _cardName, _devicePath);
         ReCheckSettings();
       }
     }
   }
   finally
   {
     user = new User();
     user.CardId = _cardNumber;
     RemoteControl.Instance.StopCard(user);
   }
 }
开发者ID:npcomplete111,项目名称:MediaPortal-1,代码行数:87,代码来源:CardAnalog.cs

示例7: InitScanProcess

    private void InitScanProcess()
    {
      // once completed reset to new beginning
      switch (scanState)
      {
        case ScanState.Done:
          scanState = ScanState.Initialized;
          listViewStatus.Items.Clear();
          SetButtonState();
          return;

        case ScanState.Initialized:
          // common checks
          TvBusinessLayer layer = new TvBusinessLayer();
          Card card = layer.GetCardByDevicePath(RemoteControl.Instance.CardDevice(_cardNumber));
          if (card.Enabled == false)
          {
            MessageBox.Show(this, "Tuner is disabled. Please enable the tuner before scanning.");
            return;
          }
          if (!RemoteControl.Instance.CardPresent(card.IdCard))
          {
            MessageBox.Show(this, "Tuner is not found. Please make sure the tuner is present before scanning.");
            return;
          }
          // Check if the card is locked for scanning.
          IUser user;
          if (RemoteControl.Instance.IsCardInUse(_cardNumber, out user))
          {
            MessageBox.Show(this,
                            "Tuner is locked. Scanning is not possible at the moment. Perhaps you are using another part of a hybrid card?");
            return;
          }
          SetButtonState();
          ShowActiveGroup(1); // force progess visible
          // End common checks

          listViewStatus.Items.Clear();

          // Scan type dependent handling
          _dvbcChannels.Clear();
          switch (ActiveScanType)
          {
              // use tuning details from file
            case ScanTypes.Predefined:
              CustomFileName tuningFile = (CustomFileName)mpComboBoxRegion.SelectedItem;
              _dvbcChannels = (List<DVBCTuning>)fileFilters.LoadList(tuningFile.FileName, typeof (List<DVBCTuning>));
              if (_dvbcChannels == null)
              {
                _dvbcChannels = new List<DVBCTuning>();
              }
              break;

              // scan Network Information Table for transponder info
            case ScanTypes.NIT:
              _dvbcChannels.Clear();
              DVBCChannel tuneChannel = GetManualTuning();

              listViewStatus.Items.Clear();
              string line = String.Format("Scan freq:{0} {1} symbolrate:{2} ...", tuneChannel.Frequency,
                                          tuneChannel.ModulationType, tuneChannel.SymbolRate);
              ListViewItem item = listViewStatus.Items.Add(new ListViewItem(line));
              item.EnsureVisible();

              IChannel[] channels = RemoteControl.Instance.ScanNIT(_cardNumber, tuneChannel);
              if (channels != null)
              {
                for (int i = 0; i < channels.Length; ++i)
                {
                  DVBCChannel ch = (DVBCChannel)channels[i];
                  _dvbcChannels.Add(ch.TuningInfo);
                  item = listViewStatus.Items.Add(new ListViewItem(ch.TuningInfo.ToString()));
                  item.EnsureVisible();
                }
              }

              ListViewItem lastItem =
                listViewStatus.Items.Add(
                  new ListViewItem(String.Format("Scan done, found {0} transponders...", _dvbcChannels.Count)));
              lastItem.EnsureVisible();

              // automatically save list for re-use
              SaveTransponderList();
              break;

              // scan only single inputted transponder
            case ScanTypes.SingleTransponder:
              DVBCChannel singleTuneChannel = GetManualTuning();
              _dvbcChannels.Add(singleTuneChannel.TuningInfo);
              break;
          }
          if (_dvbcChannels.Count != 0)
          {
            StartScanThread();
          }
          else
          {
            scanState = ScanState.Done;
            SetButtonState();
          }
//.........这里部分代码省略.........
开发者ID:npcomplete111,项目名称:MediaPortal-1,代码行数:101,代码来源:CardDvbC.cs

示例8: importButton_Click


//.........这里部分代码省略.........
              else
              {
                dbChannel = layer.AddNewChannel(displayName, chChannelNumber);
              }

              dbChannel.GrabEpg = grabEpg;
              dbChannel.IsRadio = isRadio;
              dbChannel.IsTv = isTv;
              dbChannel.LastGrabTime = lastGrabTime;
              dbChannel.SortOrder = sortOrder;
              dbChannel.TimesWatched = timesWatched;
              dbChannel.TotalTimeWatched = totalTimeWatched;
              dbChannel.VisibleInGuide = visibileInGuide;
              dbChannel.DisplayName = displayName;
              dbChannel.Persist();

              //
              // chemelli: When we import channels we need to add those to the "AllChannels" group
              //
              if (isTv)
              {
                layer.AddChannelToGroup(dbChannel, TvConstants.TvGroupNames.AllChannels);
              }
              else
              {
                layer.AddChannelToRadioGroup(dbChannel, TvConstants.RadioGroupNames.AllChannels);
              }

              foreach (XmlNode nodeMap in mappingList)
              {
                int idCard = Int32.Parse(nodeMap.Attributes["IdCard"].Value);
                XmlNode nodeCard =
                  doc.SelectSingleNode(String.Format("/tvserver/servers/server/cards/card[@IdCard={0}]", idCard));
                Card dbCard = layer.GetCardByDevicePath(nodeCard.Attributes["DevicePath"].Value);
                if (dbCard != null)
                {
                  layer.MapChannelToCard(dbCard, dbChannel, false);
                }
              }
              foreach (XmlNode nodeTune in tuningList)
              {
                int bandwidth = Int32.Parse(nodeTune.Attributes["Bandwidth"].Value);
                int channelNumber = Int32.Parse(nodeTune.Attributes["ChannelNumber"].Value);
                int channelType = Int32.Parse(nodeTune.Attributes["ChannelType"].Value);
                int countryId = Int32.Parse(nodeTune.Attributes["CountryId"].Value);
                int diseqc = Int32.Parse(nodeTune.Attributes["Diseqc"].Value);
                bool fta = (nodeTune.Attributes["FreeToAir"].Value == "True");
                int frequency = Int32.Parse(nodeTune.Attributes["Frequency"].Value);
                int majorChannel = Int32.Parse(nodeTune.Attributes["MajorChannel"].Value);
                int minorChannel = Int32.Parse(nodeTune.Attributes["MinorChannel"].Value);
                int modulation = Int32.Parse(nodeTune.Attributes["Modulation"].Value);
                string name = nodeTune.Attributes["Name"].Value;
                int networkId = Int32.Parse(nodeTune.Attributes["NetworkId"].Value);
                int pmtPid = Int32.Parse(nodeTune.Attributes["PmtPid"].Value);
                int polarisation = Int32.Parse(nodeTune.Attributes["Polarisation"].Value);
                string provider = GetNodeAttribute(nodeTune, "Provider", "");
                int serviceId = Int32.Parse(nodeTune.Attributes["ServiceId"].Value);
                int switchingFrequency = Int32.Parse(nodeTune.Attributes["SwitchingFrequency"].Value);
                int symbolrate = Int32.Parse(nodeTune.Attributes["Symbolrate"].Value);
                int transportId = Int32.Parse(nodeTune.Attributes["TransportId"].Value);
                int tuningSource = Int32.Parse(GetNodeAttribute(nodeTune, "TuningSource", "0"));
                int videoSource = Int32.Parse(GetNodeAttribute(nodeTune, "VideoSource", "0"));
                int audioSource = Int32.Parse(GetNodeAttribute(nodeTune, "AudioSource", "0"));
                bool isVCRSignal = (GetNodeAttribute(nodeChannel, "IsVCRSignal", "False") == "True");
                int SatIndex = Int32.Parse(GetNodeAttribute(nodeTune, "SatIndex", "-1"));
                int InnerFecRate = Int32.Parse(GetNodeAttribute(nodeTune, "InnerFecRate", "-1"));
开发者ID:nio22,项目名称:MediaPortal-1,代码行数:67,代码来源:ImportExport.cs

示例9: TvCardDvbSS2

 /// <summary>
 /// Initializes a new instance of the <see cref="TvCardDvbSS2"/> class.
 /// </summary>
 /// <param name="epgEvents">The EPG events interface.</param>
 /// <param name="device">The device.</param>
 public TvCardDvbSS2(IEpgEvents epgEvents, DsDevice device)
   : base(epgEvents, device)
 {
   _useDISEqCMotor = false;
   TvBusinessLayer layer = new TvBusinessLayer();
   Card card = layer.GetCardByDevicePath(device.DevicePath);
   if (card != null)
   {
     Setting setting = layer.GetSetting("dvbs" + card.IdCard + "motorEnabled", "no");
     if (setting.Value == "yes")
       _useDISEqCMotor = true;
   }
   _conditionalAccess = new ConditionalAccess(null, null, null, this);
   _ptrDisEqc = Marshal.AllocCoTaskMem(20);
   _disEqcMotor = new DiSEqCMotor(this);
   GetTunerCapabilities();
 }
开发者ID:nio22,项目名称:MediaPortal-1,代码行数:22,代码来源:TvCardDvbSS2.cs

示例10: OnSectionActivated

    public override void OnSectionActivated()
    {
      base.OnSectionActivated();
      UpdateStatus();
      TvBusinessLayer layer = new TvBusinessLayer();
      int index = Int32.Parse(layer.GetSetting("dvbip" + _cardNumber.ToString() + "Service", "0").Value);
      if (index < mpComboBoxService.Items.Count) mpComboBoxService.SelectedIndex = index;


      Card card = layer.GetCardByDevicePath(RemoteControl.Instance.CardDevice(_cardNumber));
      checkBoxCreateGroups.Checked =
        (layer.GetSetting("dvbip" + _cardNumber.ToString() + "creategroups", "false").Value == "true");
    }
开发者ID:arangas,项目名称:MediaPortal-1,代码行数:13,代码来源:CardDvbIP.cs

示例11: DoScan

    private void DoScan()
    {
      int tvChannelsNew = 0;
      int radioChannelsNew = 0;
      int tvChannelsUpdated = 0;
      int radioChannelsUpdated = 0;

      string buttonText = mpButtonScanTv.Text;
      IUser user = new User();
      user.CardId = _cardNumber;
      try
      {
        // First lock the card, because so that other parts of a hybrid card can't be used at the same time
        _isScanning = true;
        _stopScanning = false;
        mpButtonScanTv.Text = "Cancel...";
        RemoteControl.Instance.EpgGrabberEnabled = false;
        listViewStatus.Items.Clear();

        PlayList playlist = new PlayList();
        if (mpComboBoxService.SelectedIndex == 0)
        {
          //TODO read SAP announcements
        }
        else
        {
          IPlayListIO playlistIO =
            PlayListFactory.CreateIO(String.Format(@"{0}\TuningParameters\dvbip\{1}.m3u", PathManager.GetDataPath,
                                                   mpComboBoxService.SelectedItem));
          playlistIO.Load(playlist,
                          String.Format(@"{0}\TuningParameters\dvbip\{1}.m3u", PathManager.GetDataPath,
                                        mpComboBoxService.SelectedItem));
        }
        if (playlist.Count == 0) return;

        mpComboBoxService.Enabled = false;
        checkBoxCreateGroups.Enabled = false;
        checkBoxEnableChannelMoveDetection.Enabled = false;
        TvBusinessLayer layer = new TvBusinessLayer();
        Card card = layer.GetCardByDevicePath(RemoteControl.Instance.CardDevice(_cardNumber));

        int index = -1;
        IEnumerator<PlayListItem> enumerator = playlist.GetEnumerator();

        while (enumerator.MoveNext())
        {
          if (_stopScanning) return;
          index++;
          float percent = ((float)(index)) / playlist.Count;
          percent *= 100f;
          if (percent > 100f) percent = 100f;
          progressBar1.Value = (int)percent;

          string url = enumerator.Current.FileName.Substring(enumerator.Current.FileName.LastIndexOf('\\') + 1);
          string name = enumerator.Current.Description;

          DVBIPChannel tuneChannel = new DVBIPChannel();
          tuneChannel.Url = url;
          tuneChannel.Name = name;
          string line = String.Format("{0}- {1} - {2}", 1 + index, tuneChannel.Name, tuneChannel.Url);
          ListViewItem item = listViewStatus.Items.Add(new ListViewItem(line));
          item.EnsureVisible();
          RemoteControl.Instance.Tune(ref user, tuneChannel, -1);
          IChannel[] channels;
          channels = RemoteControl.Instance.Scan(_cardNumber, tuneChannel);
          UpdateStatus();
          if (channels == null || channels.Length == 0)
          {
            if (RemoteControl.Instance.TunerLocked(_cardNumber) == false)
            {
              line = String.Format("{0}- {1} - {2} :No Signal", 1 + index, tuneChannel.Url, tuneChannel.Name);
              item.Text = line;
              item.ForeColor = Color.Red;
              continue;
            }
            else
            {
              line = String.Format("{0}- {1} - {2} :Nothing found", 1 + index, tuneChannel.Url, tuneChannel.Name);
              item.Text = line;
              item.ForeColor = Color.Red;
              continue;
            }
          }

          int newChannels = 0;
          int updatedChannels = 0;

          for (int i = 0; i < channels.Length; ++i)
          {
            Channel dbChannel;
            DVBIPChannel channel = (DVBIPChannel)channels[i];
            if (channels.Length > 1)
            {
              if (channel.Name.IndexOf("Unknown") == 0)
              {
                channel.Name = name + (i + 1);
              }
            }
            else
            {
//.........这里部分代码省略.........
开发者ID:arangas,项目名称:MediaPortal-1,代码行数:101,代码来源:CardDvbIP.cs

示例12: InitController


//.........这里部分代码省略.........

        for (int i = 0; i < _localCardCollection.Cards.Count; ++i)
        {
          //for each card, check if its already mentioned in the database
          bool found = false;
          IList<Card> cards = _ourServer.ReferringCard();
          foreach (Card card in cards)
          {
            if (card.DevicePath == _localCardCollection.Cards[i].DevicePath)
            {
              found = true;
              break;
            }
          }
          if (!found)
          {
            // card is not yet in the database, so add it
            Log.Info("Controller: add card:{0}", _localCardCollection.Cards[i].Name);
            layer.AddCard(_localCardCollection.Cards[i].Name, _localCardCollection.Cards[i].DevicePath, _ourServer);
          }
        }
        //notify log about cards from the database which are removed from the pc
        IList<Card> cardsInDbs = Card.ListAll();
        int cardsInstalled = _localCardCollection.Cards.Count;
        foreach (Card dbsCard in cardsInDbs)
        {
          if (dbsCard.ReferencedServer().IdServer == _ourServer.IdServer)
          {
            bool found = false;
            for (int cardNumber = 0; cardNumber < cardsInstalled; ++cardNumber)
            {
              if (dbsCard.DevicePath == _localCardCollection.Cards[cardNumber].DevicePath)
              {
                Card cardDB = layer.GetCardByDevicePath(_localCardCollection.Cards[cardNumber].DevicePath);

                bool cardEnabled = cardDB.Enabled;
                bool cardPresent = _localCardCollection.Cards[cardNumber].CardPresent;

                if (cardEnabled && cardPresent)
                {
                  ITVCard unknownCard = _localCardCollection.Cards[cardNumber];

                  if (unknownCard is TvCardBase)
                  {
                    TvCardBase card = (TvCardBase)unknownCard;
                    if (card.PreloadCard)
                    {
                      try
                      {
                        Log.Info("Controller: preloading card :{0}", card.Name);
                        card.BuildGraph();
                        if (unknownCard is TvCardAnalog)
                        {
                          ((TvCardAnalog)unknownCard).ReloadCardConfiguration();
                        }
                      }
                      catch (Exception ex)
                      {
                        Log.Error("failed to preload card '{0}', ex = {1}", card.Name, ex);
                      }
                    }
                    else
                    {
                      Log.Info("Controller: NOT preloading card :{0}", card.Name);
                    }
                  }
开发者ID:npcomplete111,项目名称:MediaPortal-1,代码行数:67,代码来源:TVController.cs

示例13: DoScan

 private void DoScan()
 {
   int tvChannelsNew = 0;
   int radioChannelsNew = 0;
   int tvChannelsUpdated = 0;
   int radioChannelsUpdated = 0;
   string buttonText = mpButtonScanTv.Text;
   try
   {
     _isScanning = true;
     _stopScanning = false;
     mpButtonScanTv.Text = "Cancel...";
     RemoteControl.Instance.EpgGrabberEnabled = false;
     if (_atscChannels.Count == 0)
       return;
     mpComboBoxFrequencies.Enabled = false;
     listViewStatus.Items.Clear();
     TvBusinessLayer layer = new TvBusinessLayer();
     Card card = layer.GetCardByDevicePath(RemoteControl.Instance.CardDevice(_cardNumber));
     IUser user = new User();
     user.CardId = _cardNumber;
     int minchan = 2;
     int maxchan = 69;
     //Check if QAM if so then the number of channels varies
     if (checkBoxQAM.Checked)
     {
       minchan = 0;
       maxchan = _atscChannels.Count;
     }
     for (int index = minchan; index < maxchan; ++index)
     {
       if (_stopScanning)
         return;
       float percent = ((float)(index)) / (maxchan - minchan);
       percent *= 100f;
       if (percent > 100f)
         percent = 100f;
       progressBar1.Value = (int)percent;
       ATSCChannel tuneChannel = new ATSCChannel();
       tuneChannel.NetworkId = -1;
       tuneChannel.TransportId = -1;
       tuneChannel.ServiceId = -1;
       tuneChannel.MinorChannel = -1;
       tuneChannel.MajorChannel = -1;
       if (checkBoxQAM.Checked)
       {
         Log.WriteFile("ATSC tune: QAM checkbox selected... using Modulation 256Qam");
         tuneChannel.PhysicalChannel = index + 1;
         tuneChannel.Frequency = _atscChannels[index].frequency;
         tuneChannel.ModulationType = ModulationType.Mod256Qam;
       }
       else
       {
         Log.WriteFile("ATSC tune: QAM checkbox not selected... using Modulation 8Vsb");
         tuneChannel.PhysicalChannel = index;
         tuneChannel.Frequency = -1;
         tuneChannel.ModulationType = ModulationType.Mod8Vsb;
       }
       Log.WriteFile("ATSC tune: PhysicalChannel: {0} Frequency: {1} Modulation: {2}", tuneChannel.PhysicalChannel,
                     tuneChannel.Frequency, tuneChannel.ModulationType);
       string line = String.Format("physical channel:{0} frequency:{1} modulation:{2}", tuneChannel.PhysicalChannel,
                                   tuneChannel.Frequency, tuneChannel.ModulationType);
       ListViewItem item = listViewStatus.Items.Add(new ListViewItem(line));
       item.EnsureVisible();
       if (index == minchan)
       {
         RemoteControl.Instance.Scan(ref user, tuneChannel, -1);
       }
       IChannel[] channels = RemoteControl.Instance.Scan(_cardNumber, tuneChannel);
       UpdateStatus();
       /*if (channels == null || channels.Length == 0)
       {
         if (checkBoxQAM.Checked)
         {
           //try Modulation 64Qam now
           tuneChannel.PhysicalChannel = index + 1;
           tuneChannel.Frequency = _atscChannels[index].frequency;
           tuneChannel.ModulationType = ModulationType.Mod64Qam;
           line = String.Format("physical channel:{0} frequency:{1} modulation:{2}: No signal", tuneChannel.PhysicalChannel, tuneChannel.Frequency, tuneChannel.ModulationType);
           item.Text = line;
           channels = RemoteControl.Instance.Scan(_cardNumber, tuneChannel);
         }
       }*/
       UpdateStatus();
       if (channels == null || channels.Length == 0)
       {
         if (RemoteControl.Instance.TunerLocked(_cardNumber) == false)
         {
           line = String.Format("physical channel:{0} frequency:{1} modulation:{2}: No signal",
                                tuneChannel.PhysicalChannel, tuneChannel.Frequency, tuneChannel.ModulationType);
           item.Text = line;
           item.ForeColor = Color.Red;
           continue;
         }
         line = String.Format("physical channel:{0} frequency:{1} modulation:{2}: Nothing found",
                              tuneChannel.PhysicalChannel, tuneChannel.Frequency, tuneChannel.ModulationType);
         item.Text = line;
         item.ForeColor = Color.Red;
         continue;
       }
//.........这里部分代码省略.........
开发者ID:npcomplete111,项目名称:MediaPortal-1,代码行数:101,代码来源:CardAtsc.cs

示例14: mpButtonScanTv_Click

    private void mpButtonScanTv_Click(object sender, EventArgs e)
    {
      if (_isScanning == false)
      {
        checkBoxQAM.Enabled = false;

        TvBusinessLayer layer = new TvBusinessLayer();
        Card card = layer.GetCardByDevicePath(RemoteControl.Instance.CardDevice(_cardNumber));
        if (card.Enabled == false)
        {
          MessageBox.Show(this, "Tuner is disabled. Please enable the tuner before scanning.");
          return;
        }
        if (!RemoteControl.Instance.CardPresent(card.IdCard))
        {
          MessageBox.Show(this, "Tuner is not found. Please make sure the tuner is present before scanning.");
          return;
        }
        // Check if the card is locked for scanning.
        IUser user;
        if (RemoteControl.Instance.IsCardInUse(_cardNumber, out user))
        {
          MessageBox.Show(this,
                          "Tuner is locked. Scanning is not possible at the moment. Perhaps you are using another part of a hybrid card?");
          return;
        }
        SimpleFileName tuningFile = (SimpleFileName)mpComboBoxFrequencies.SelectedItem;
        _atscChannels = (List<ATSCTuning>)fileFilters.LoadList(tuningFile.FileName, typeof (List<ATSCTuning>));
        if (_atscChannels == null)
        {
          return;
        }
        Thread scanThread = new Thread(DoScan);
        scanThread.Name = "ATSC scan thread";
        scanThread.Start();
        listViewStatus.Items.Clear();
      }
      else
      {
        _stopScanning = true;
      }
    }
开发者ID:npcomplete111,项目名称:MediaPortal-1,代码行数:42,代码来源:CardAtsc.cs

示例15: ConditionalAccess

    //anysee _anysee = null;

    #endregion

    //ctor
    /// <summary>
    /// Initializes a new instance of the <see cref="ConditionalAccess"/> class.
    /// </summary>
    /// <param name="tunerFilter">The tuner filter.</param>
    /// <param name="analyzerFilter">The capture filter.</param>
    /// <param name="winTvUsbCiFilter">The WinTV CI filter.</param>
    /// <param name="card">Determines the type of TV card</param>    
    public ConditionalAccess(IBaseFilter tunerFilter, IBaseFilter analyzerFilter, IBaseFilter winTvUsbCiFilter,
                             TvCardBase card)
    {
      try
      {
        //System.Diagnostics.Debugger.Launch();        
        if (card != null && card.DevicePath != null)
        {
          //fetch decrypt limit from DB and apply it.
          TvBusinessLayer layer = new TvBusinessLayer();
          Card c = layer.GetCardByDevicePath(card.DevicePath);
          _decryptLimit = c.DecryptLimit;
          _useCam = c.CAM;
          _CamType = (CamType)c.CamType;
          Log.Log.WriteFile("CAM is {0} model", _CamType);
        }

        _mapSubChannels = new Dictionary<int, ConditionalAccessContext>();
        TunerDri driTuner = card as TunerDri;
        if (driTuner != null)
        {
          _tunerDri = driTuner;
          _ciMenu = driTuner;
        }
        if (tunerFilter == null && analyzerFilter == null)
          return;
        //DVB checks. Conditional Access & DiSEqC etc.
        bool isDVBS = (card is TvCardDVBS);
        bool isDVBT = (card is TvCardDVBT);
        bool isDVBC = (card is TvCardDVBC);

        if (isDVBC || isDVBS || isDVBT)
        {
          Log.Log.WriteFile("Check for KNC");
          // Lookup device index of current card. only counting KNC cards by device path
          int DeviceIndex = KNCDeviceLookup.GetDeviceIndex(card);
          _knc = new KNCAPI(tunerFilter, (uint)DeviceIndex);
          if (_knc.IsKNC)
          {
            //if (_knc.IsCamReady()) 
            _ciMenu = _knc; // Register KNC CI Menu capabilities when CAM detected and ready
            Log.Log.WriteFile("KNC card detected");
            return;
          }
          Release.DisposeToNull(ref _knc);

          Log.Log.WriteFile("Check for Digital Everywhere");
          _digitalEveryWhere = new DigitalEverywhere(tunerFilter);
          if (_digitalEveryWhere.IsDigitalEverywhere)
          {
            Log.Log.WriteFile("Digital Everywhere card detected");
            _diSEqCMotor = new DiSEqCMotor(_digitalEveryWhere);

            if (_digitalEveryWhere.IsCamReady())
            {
              Log.Log.WriteFile("Digital Everywhere registering CI menu capabilities");
              _ciMenu = _digitalEveryWhere; // Register FireDTV CI Menu capabilities when CAM detected and ready
            }
            //_digitalEveryWhere.ResetCAM();
            return;
          }
          Release.DisposeToNull(ref _digitalEveryWhere);

          Log.Log.WriteFile("Check for Twinhan");
          _twinhan = new Twinhan(tunerFilter);
          if (_twinhan.IsTwinhan)
          {
            Log.Log.WriteFile("Twinhan card detected");
            _diSEqCMotor = new DiSEqCMotor(_twinhan);
            Log.Log.WriteFile("Twinhan registering CI menu capabilities");
            _ciMenu = _twinhan; // Register Twinhan CI Menu capabilities when CAM detected and ready
            return;
          }
          Release.DisposeToNull(ref _twinhan);

          Log.Log.WriteFile("Check for TechnoTrend");
          _technoTrend = new TechnoTrendAPI(tunerFilter);
          if (_technoTrend.IsTechnoTrend)
          {
            ////if (_technoTrend.IsCamPresent()) 
            _ciMenu = _technoTrend; // Register Technotrend CI Menu capabilities
            Log.Log.WriteFile("TechnoTrend card detected");
            return;
          }
          Release.DisposeToNull(ref _technoTrend);

          Log.Log.WriteFile("Check for Hauppauge");
          _hauppauge = new Hauppauge(tunerFilter);
//.........这里部分代码省略.........
开发者ID:arangas,项目名称:MediaPortal-1,代码行数:101,代码来源:ConditionalAccess.cs


注:本文中的TvDatabase.TvBusinessLayer.GetCardByDevicePath方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。