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


C# IChannel.ToString方法代码示例

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


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

示例1: Connected

        public void Connected(IChannel channel)
        {
            if (channel.ToString().Substring(0, channel.ToString().IndexOf(":", StringComparison.Ordinal))
                != _channel.ToString().Substring(0, _channel.ToString().IndexOf(":", StringComparison.Ordinal)))
            {
                channel.Disconnect();
                return;
            }

            _channel = channel;

            var keepHandlerChannel = _channel as IKeepHandlerChannel;
            if (keepHandlerChannel != null)
            {
                keepHandlerChannel.SetHandler(this);
            }
            _socketIO.Emit("connection", this);

            Send("1", "", _endPoint + "?server=netronics");
            if(_heartbeatTimer == null)
                _heartbeatTimer = new Timer(state => Send("2", ""), null, 0, 10000);
        }
开发者ID:victoryfree,项目名称:Netronics,代码行数:22,代码来源:Client.cs

示例2: ChannelTraceRecord

 internal ChannelTraceRecord(IChannel channel)
 {
     this.channelType = channel == null ? null : channel.ToString();
 }
开发者ID:krytht,项目名称:DotNetReferenceSource,代码行数:4,代码来源:ChannelTraceRecord.cs

示例3: GrabEpgForChannel

    /// <summary>
    /// This method will try to start the epg grabber for the channel and tuning details specified
    /// Epg grabbing can only be started if there is a card idle which can receive the channel specified
    /// </summary>
    /// <param name="channel">channel to grab/param>
    /// <param name="tuning">tuning information</param>
    /// <param name="card">card to use for grabbing</param>
    /// <returns>true if grabbing has started else false</returns>
    private bool GrabEpgForChannel(Channel channel, IChannel tuning, Card card)
    {
      if (channel == null)
      {
        Log.Error("Epg: invalid channel");
        return false;
      }
      if (tuning == null)
      {
        Log.Error("Epg: invalid tuning");
        return false;
      }
      if (card == null)
      {
        Log.Error("Epg: invalid card");
        return false;
      }
      if (_tvController == null)
      {
        Log.Error("Epg: invalid tvcontroller");
        return false;
      }
      if (_user == null)
      {
        Log.Error("Epg: invalid user");
        return false;
      }
      //remove following check to enable multi-card epg grabbing (still beta)
      if (_tvController.AllCardsIdle == false)
      {
        Log.Epg("Epg: card:{0} cards are not idle", card.IdCard);
        return false;
      }

      TvResult result;
      //handle ATSC
      ATSCChannel atscChannel = tuning as ATSCChannel;
      if (atscChannel != null)
      {
        if (_tvController.Type(card.IdCard) == CardType.Atsc)
        {
          if (IsCardIdle(card.IdCard) == false)
          {
            Log.Epg("Epg: card:{0} atsc card is not idle", card.IdCard);
            return false; //card is busy
          }
          try
          {
            IUser cardUser;
            if (_tvController.IsCardInUse(card.IdCard, out cardUser) == false)
            {
              _user.CardId = card.IdCard;
              result = RemoteControl.Instance.Tune(ref _user, tuning, channel.IdChannel);
              if (result == TvResult.Succeeded)
              {
                if (!_isRunning || false == _tvController.GrabEpg(this, card.IdCard))
                {
                  if (!_isRunning)
                    Log.Epg("Tuning finished but EpgGrabber no longer enabled");
                  _tvController.StopGrabbingEpg(_user);
                  _user.CardId = -1;
                  Log.Epg("Epg: card:{0} could not start atsc epg grabbing", card.IdCard);
                  return false;
                }
                _user.CardId = card.IdCard;
                return true;
              }
              _user.CardId = -1;
              Log.Epg("Epg: card:{0} could not tune to channel:{1}", card.IdCard, result.ToString());
              return false;
            }
          }
          catch (Exception ex)
          {
            Log.Write(ex);
            throw;
          }
          return false;
        }
        Log.Epg("Epg: card:{0} could not tune to atsc channel:{1}", card.IdCard, tuning.ToString());
        return false;
      }

      //handle DVBC
      DVBCChannel dvbcChannel = tuning as DVBCChannel;
      if (dvbcChannel != null)
      {
        if (_tvController.Type(card.IdCard) == CardType.DvbC)
        {
          if (IsCardIdle(card.IdCard) == false)
          {
            Log.Epg("Epg: card:{0} dvbc card is not idle", card.IdCard);
//.........这里部分代码省略.........
开发者ID:npcomplete111,项目名称:MediaPortal-1,代码行数:101,代码来源:EpgCard.cs

示例4: GrabEpgForChannel

    /// <summary>
    /// This method will try to start the epg grabber for the channel and tuning details specified
    /// Epg grabbing can only be started if there is a card idle which can receive the channel specified
    /// </summary>
    /// <param name="channel">channel to grab/param>
    /// <param name="tuning">tuning information</param>
    /// <param name="card">card to use for grabbing</param>
    /// <returns>true if grabbing has started else false</returns>
    private bool GrabEpgForChannel(Channel channel, IChannel tuning, Card card)
    {
      if (channel == null)
      {
        Log.Error("Epg: invalid channel");
        return false;
      }
      if (tuning == null)
      {
        Log.Error("Epg: invalid tuning");
        return false;
      }
      if (card == null)
      {
        Log.Error("Epg: invalid card");
        return false;
      }
      if (_tvController == null)
      {
        Log.Error("Epg: invalid tvcontroller");
        return false;
      }
      if (_user == null)
      {
        Log.Error("Epg: invalid user");
        return false;
      }
      //remove following check to enable multi-card epg grabbing (still beta)
      if (_tvController.AllCardsIdle == false)
      {
        Log.Epg("Epg: card:{0} cards are not idle", card.IdCard);
        return false;
      }

      TvResult result = TvResult.UnknownError;
      //handle ATSC
      ATSCChannel atscChannel = tuning as ATSCChannel;
      if (atscChannel != null)
      {
        if (_tvController.Type(card.IdCard) == CardType.Atsc)
        {
          if (IsCardIdle(card.IdCard) == false)
          {
            Log.Epg("Epg: card:{0} atsc card is not idle", card.IdCard);
            return false; //card is busy
          }
          return TuneEPGgrabber(channel, tuning, card, result);   
        }
        Log.Epg("Epg: card:{0} could not tune to atsc channel:{1}", card.IdCard, tuning.ToString());
        return false;
      }

      //handle DVBC
      DVBCChannel dvbcChannel = tuning as DVBCChannel;
      if (dvbcChannel != null)
      {
        if (_tvController.Type(card.IdCard) == CardType.DvbC)
        {
          if (IsCardIdle(card.IdCard) == false)
          {
            Log.Epg("Epg: card:{0} dvbc card is not idle", card.IdCard);
            return false; //card is busy
          }
          return TuneEPGgrabber(channel, tuning, card, result);   
        }
        Log.Epg("Epg: card:{0} could not tune to dvbc channel:{1}", card.IdCard, tuning.ToString());
        return false;
      }

      //handle DVBS
      DVBSChannel dvbsChannel = tuning as DVBSChannel;
      if (dvbsChannel != null)
      {
        if (_tvController.Type(card.IdCard) == CardType.DvbS)
        {
          if (IsCardIdle(card.IdCard) == false)
          {
            Log.Epg("Epg: card:{0} dvbs card is not idle", card.IdCard);
            return false; //card is busy
          }
          return TuneEPGgrabber(channel, tuning, card, result);   
        }
        Log.Epg("Epg: card:{0} could not tune to dvbs channel:{1}", card.IdCard, tuning.ToString());
        return false;
      }

      //handle DVBT
      DVBTChannel dvbtChannel = tuning as DVBTChannel;
      if (dvbtChannel != null)
      {
        if (_tvController.Type(card.IdCard) == CardType.DvbT)
        {
//.........这里部分代码省略.........
开发者ID:sanyaade-embedded-systems,项目名称:MediaPortal-1,代码行数:101,代码来源:EpgCard.cs

示例5: RegisterChannelInternal

        [System.Security.SecurityCritical]  // auto-generated 
        unsafe internal static void RegisterChannelInternal(IChannel chnl, bool ensureSecurity)
        { 
            // Validate arguments 
            if(null == chnl)
            { 
                throw new ArgumentNullException("chnl");
            }
            Contract.EndContractBlock();
 
            bool fLocked = false;
            RuntimeHelpers.PrepareConstrainedRegions(); 
            try 
            {
                Monitor.Enter(s_channelLock, ref fLocked); 
                String chnlName = chnl.ChannelName;

                RegisteredChannelList regChnlList = s_registeredChannels;
 
                // Check to make sure that the channel has not been registered
                if((chnlName == null) || 
                   (chnlName.Length == 0) || 
                   (-1 == regChnlList.FindChannelIndex(chnl.ChannelName)))
                { 
                    if (ensureSecurity)
                    {
                        ISecurableChannel securableChannel = chnl as ISecurableChannel;
                        if (securableChannel != null) 
                            securableChannel.IsSecured = ensureSecurity;
                        else 
                            throw new RemotingException(Environment.GetResourceString("Remoting_Channel_CannotBeSecured", chnl.ChannelName??chnl.ToString())); 

                    } 
                    RegisteredChannel[] oldList = regChnlList.RegisteredChannels;
                    RegisteredChannel[] newList = null;
                    if (oldList == null)
                    { 
                        newList = new RegisteredChannel[1];
                    } 
                    else 
                        newList = new RegisteredChannel[oldList.Length + 1];
 
                    if (!unloadHandlerRegistered && !(chnl is CrossAppDomainChannel))
                    {
                        // Register a unload handler only once and if the channel being registered
                        // is not the x-domain channel. x-domain channel does nothing inside its 
                        // StopListening implementation
                        AppDomain.CurrentDomain.DomainUnload += new EventHandler(UnloadHandler); 
                        unloadHandlerRegistered = true; 
                    }
 
                    // Add the interface to the array in priority order
                    int priority = chnl.ChannelPriority;
                    int current = 0;
 
                    // Find the place in the array to insert
                    while (current < oldList.Length) 
                    { 
                        RegisteredChannel oldChannel = oldList[current];
                        if (priority > oldChannel.Channel.ChannelPriority) 
                        {
                            newList[current] = new RegisteredChannel(chnl);
                            break;
                        } 
                        else
                        { 
                            newList[current] = oldChannel; 
                            current++;
                        } 
                    }

                    if (current == oldList.Length)
                    { 
                        // chnl has lower priority than all old channels, so we insert
                        //   it at the end of the list. 
                        newList[oldList.Length] = new RegisteredChannel(chnl); 
                    }
                    else 
                    {
                        // finish copying rest of the old channels
                        while (current < oldList.Length)
                        { 
                            newList[current + 1] = oldList[current];
                            current++; 
                        } 
                    }
 
                    if (perf_Contexts != null) {
                        perf_Contexts->cChannels++;
                    }
 
                    s_registeredChannels = new RegisteredChannelList(newList);
                } 
                else 
                {
                    throw new RemotingException(Environment.GetResourceString("Remoting_ChannelNameAlreadyRegistered", chnl.ChannelName)); 
                }

                RefreshChannelData();
            } // lock (s_channelLock) 
//.........这里部分代码省略.........
开发者ID:wsky,项目名称:System.Runtime.Remoting,代码行数:101,代码来源:ChannelServices.cs

示例6: BeforeTune

    private bool BeforeTune(IChannel channel, ref IUser user, out TvResult result)
    {
      result = TvResult.UnknownError;
      //@FIX this fails for back-2-back recordings
      //if (CurrentDbChannel(ref user) == idChannel && idChannel >= 0)
      //{
      //  return true;
      //}
      Log.Debug("card: user: {0}:{1}:{2} tune {3}", user.Name, user.CardId, user.SubChannel, channel.ToString());
      _cardHandler.Card.CamType = (CamType)_cardHandler.DataBaseCard.CamType;
      _cardHandler.SetParameters();

      //check if transponder differs
      ITvCardContext context = _cardHandler.Card.Context as ITvCardContext;
      if (_cardHandler.Card.SubChannels.Length > 0)
      {
        if (IsTunedToTransponder(channel) == false)
        {
          if (context.IsOwner(user) || user.IsAdmin)
          {
            Log.Debug("card: to different transponder");

            //remove all subchannels, except for this user...
            IUser[] users = context.Users;
            for (int i = 0; i < users.Length; ++i)
            {
              if (users[i].Name != user.Name)
              {
                Log.Debug("  stop subchannel: {0} user: {1}", i, users[i].Name);

                //fix for b2b mantis; http://mantis.team-mediaportal.com/view.php?id=1112
                if (users[i].IsAdmin)
                  // if we are stopping an on-going recording/schedule (=admin), we have to make sure that we remove the schedule also.
                {
                  Log.Debug("user is scheduler: {0}", users[i].Name);
                  int recScheduleId = RemoteControl.Instance.GetRecordingSchedule(users[i].CardId,
                                                                                  users[i].IdChannel);

                  if (recScheduleId > 0)
                  {
                    Schedule schedule = Schedule.Retrieve(recScheduleId);
                    Log.Info("removing schedule with id: {0}", schedule.IdSchedule);
                    RemoteControl.Instance.StopRecordingSchedule(schedule.IdSchedule);
                    schedule.Delete();
                  }
                }
                else
                {
                  _cardHandler.Card.FreeSubChannel(users[i].SubChannel);
                  context.Remove(users[i]);
                }
              }
            }
          }
          else
          {
            Log.Debug("card: user: {0} is not the card owner. Cannot switch transponder", user.Name);
            result = TvResult.NotTheOwner;
            return false;
          }
        }
        else // same transponder, free previous subchannel before tuning..
        {
          _cardHandler.Card.FreeSubChannel(user.SubChannel);
        }
      }

      if (OnBeforeTuneEvent != null)
      {
        OnBeforeTuneEvent(_cardHandler);
      }

      TvCardBase card = _cardHandler.Card as TvCardBase;
      if (card != null)
      {
        card.AfterTuneEvent -= new TvCardBase.OnAfterTuneDelegate(Card_OnAfterTuneEvent);
        card.AfterTuneEvent += new TvCardBase.OnAfterTuneDelegate(Card_OnAfterTuneEvent);
      }
      else
      {
        HybridCard hybridCard = _cardHandler.Card as HybridCard;
        if (hybridCard != null)
        {
          hybridCard.AfterTuneEvent = new TvCardBase.OnAfterTuneDelegate(Card_OnAfterTuneEvent);
        }
      }

      result = TvResult.Succeeded;
      return true;
    }
开发者ID:npcomplete111,项目名称:MediaPortal-1,代码行数:90,代码来源:CardTuner.cs

示例7: RegisterChannelInternal

 internal static unsafe void RegisterChannelInternal(IChannel chnl, bool ensureSecurity)
 {
     if (chnl == null)
     {
         throw new ArgumentNullException("chnl");
     }
     bool lockTaken = false;
     RuntimeHelpers.PrepareConstrainedRegions();
     try
     {
         Monitor.Enter(s_channelLock, ref lockTaken);
         string channelName = chnl.ChannelName;
         RegisteredChannelList list = s_registeredChannels;
         if (((channelName != null) && (channelName.Length != 0)) && (-1 != list.FindChannelIndex(chnl.ChannelName)))
         {
             goto Label_0180;
         }
         if (ensureSecurity)
         {
             ISecurableChannel channel = chnl as ISecurableChannel;
             if (channel == null)
             {
                 object[] values = new object[] { chnl.ChannelName ?? chnl.ToString() };
                 throw new RemotingException(Environment.GetResourceString("Remoting_Channel_CannotBeSecured", values));
             }
             channel.IsSecured = ensureSecurity;
         }
         RegisteredChannel[] registeredChannels = list.RegisteredChannels;
         RegisteredChannel[] channels = null;
         if (registeredChannels == null)
         {
             channels = new RegisteredChannel[1];
         }
         else
         {
             channels = new RegisteredChannel[registeredChannels.Length + 1];
         }
         if (!unloadHandlerRegistered && !(chnl is CrossAppDomainChannel))
         {
             AppDomain.CurrentDomain.DomainUnload += new EventHandler(ChannelServices.UnloadHandler);
             unloadHandlerRegistered = true;
         }
         int channelPriority = chnl.ChannelPriority;
         int index = 0;
         while (index < registeredChannels.Length)
         {
             RegisteredChannel channel2 = registeredChannels[index];
             if (channelPriority > channel2.Channel.ChannelPriority)
             {
                 channels[index] = new RegisteredChannel(chnl);
                 break;
             }
             channels[index] = channel2;
             index++;
         }
         if (index != registeredChannels.Length)
         {
             goto Label_014F;
         }
         channels[registeredChannels.Length] = new RegisteredChannel(chnl);
         goto Label_0157;
     Label_013D:
         channels[index + 1] = registeredChannels[index];
         index++;
     Label_014F:
         if (index < registeredChannels.Length)
         {
             goto Label_013D;
         }
     Label_0157:
         if (perf_Contexts != null)
         {
             perf_Contexts.cChannels++;
         }
         s_registeredChannels = new RegisteredChannelList(channels);
         goto Label_01A4;
     Label_0180:;
         throw new RemotingException(Environment.GetResourceString("Remoting_ChannelNameAlreadyRegistered", new object[] { chnl.ChannelName }));
     Label_01A4:
         RefreshChannelData();
     }
     finally
     {
         if (lockTaken)
         {
             Monitor.Exit(s_channelLock);
         }
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:89,代码来源:ChannelServices.cs


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