• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# IChannel类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: Decode

        /// <summary>
        /// BSON 패킷 구조를 따르는 PacketBuffer을 BSON Data로 변환 시키는 메서드
        /// </summary>
        /// <param name="buffer">BSON 패킷 구조를 따르는 Packet Buffer</param>
        /// <returns>BSON Data</returns>
        public dynamic Decode(IChannel channel, PacketBuffer buffer)
        {
            //버퍼 읽기 시작을 알림
            buffer.BeginBufferIndex();

            if (buffer.AvailableBytes() < 5) //버퍼길이가 5미만이면 리턴
                return null;

            uint len = buffer.ReadUInt32();
            if (len > buffer.AvailableBytes())
            {
                //버퍼의 길이가 실제 패킷 길이보다 모자름으로, 리셋후 리턴
                buffer.ResetBufferIndex();
                return null;
            }

            var data = new byte[len];
            buffer.ReadBytes(data);

            buffer.EndBufferIndex();

            var stream = new MemoryStream(data);
            dynamic res = Serializer.Deserialize(new BsonReader(stream));
            stream.Dispose();

            return res;
        }
开发者ID:victoryfree,项目名称:Netronics,代码行数:32,代码来源:BsonDecoder.cs


示例2: AbstractSocketChannel

        protected AbstractSocketChannel(IChannel parent, Socket socket)
            : base(parent)
        {
            Socket = socket;
            _state = StateFlags.Open;

            try
            {
                Socket.Blocking = false;
            }
            catch (SocketException ex)
            {
                try
                {
                    socket.Close();
                }
                catch (SocketException ex2)
                {
                    if (Logger.IsWarningEnabled)
                    {
                        Logger.Warning("Failed to close a partially initialized socket.", ex2);
                    }
                }

                throw new ChannelException("Failed to enter non-blocking mode.", ex);
            }
        }
开发者ID:helios-io,项目名称:helios,代码行数:27,代码来源:AbstractSocketChannel.cs


示例3: MessageConsumerBuilder

 public MessageConsumerBuilder(IChannel channel, string queueName)
 {
     _channel = channel;
     _queueName = queueName;
     _prefetchHigh = _channel.DefaultPrefetchHigh;
     _prefetchLow = _channel.DefaultPrefetchLow;
 }
开发者ID:drzo,项目名称:opensim4opencog,代码行数:7,代码来源:MessageConsumerBuilder.cs


示例4: Disconnected

 public void Disconnected(IChannel channel)
 {
     channelLock.EnterWriteLock();
     _channels.Remove(channel);
     channelLock.ExitWriteLock();
     SendMessage(channel + " 88" + "\r\n> ");
 }
开发者ID:victoryfree,项目名称:Netronics,代码行数:7,代码来源:Handler.cs


示例5: Decode

        public object Decode(IChannel channel, PacketBuffer buffer)
        {
            //버퍼 읽기 시작을 알림
            buffer.BeginBufferIndex();

            if (buffer.AvailableBytes() < 6) //버퍼길이가 5미만이면 리턴
                return null;
            buffer.ReadByte();
            uint len = buffer.ReadUInt32();
            if (len > buffer.AvailableBytes())
            {
                //버퍼의 길이가 실제 패킷 길이보다 모자름으로, 리셋후 리턴
                buffer.ResetBufferIndex();
                return null;
            }

            var data = new byte[len];
            buffer.ReadBytes(data);

            buffer.EndBufferIndex();

            var stream = new MemoryStream(data);
            var res = Unpacker.Create(stream).Unpack<MessagePackObject>();
            stream.Dispose();

            return res;
        }
开发者ID:shlee322,项目名称:Netronics,代码行数:27,代码来源:MsgPackDecoder.cs


示例6: GetReport

        public IMessage GetReport(IChannel channel)
        {
            log.Debug("public Message getReport(Session session): called");

            // Generate a dummy report, the coordinator expects a report but doesn't care what it is.
            return channel.CreateTextMessage("Dummy Run, Ok.");
        }
开发者ID:drzo,项目名称:opensim4opencog,代码行数:7,代码来源:TestCase1DummyRun.cs


示例7: abort

        /// <summary>Method abort</summary>
        /// <param name="error"></param>
        /// <param name="channel"></param>
        /// <exception cref="BEEPException" />
        public virtual void abort(BEEPError error, IChannel channel)
        {
            tuningChannels.Remove(channel);
            log.debug("TuningProfile.abort");

            // Log entry or something - throw an exception???
        }
开发者ID:BDizzle,项目名称:BeepForNet,代码行数:11,代码来源:TuningProfile.cs


示例8: IsCamAbleToDecryptChannel

    private bool IsCamAbleToDecryptChannel(IUser user, ITvCardHandler tvcard, IChannel tuningDetail, int decryptLimit)
    {
      if (!tuningDetail.FreeToAir)
      {
        bool isCamAbleToDecryptChannel = true;
        if (decryptLimit > 0)
        {
          int camDecrypting = NumberOfChannelsDecrypting(tvcard);

          //Check if the user is currently occupying a decoding slot and subtract that from the number of channels it is decoding.
          if (user.CardId == tvcard.DataBaseCard.IdCard)
          {
            bool isFreeToAir = IsFreeToAir(tvcard, ref user);
            if (!isFreeToAir)
            {
              int numberOfUsersOnCurrentChannel = GetNumberOfUsersOnCurrentChannel(tvcard, user);

              //Only subtract the slot the user is currently occupying if he is the only user occupying the slot.
              if (numberOfUsersOnCurrentChannel == 1)
              {
                --camDecrypting;
              }
            }
          }
          //check if cam is capable of descrambling an extra channel
          isCamAbleToDecryptChannel = (camDecrypting < decryptLimit);
        }

        return isCamAbleToDecryptChannel;
      }
      return true;
    }
开发者ID:sanyaade-embedded-systems,项目名称:MediaPortal-1,代码行数:32,代码来源:CardAllocationBase.cs


示例9: SecurityDuplexSessionChannel

		public SecurityDuplexSessionChannel (ChannelFactoryBase factory, IChannel innerChannel, EndpointAddress remoteAddress, Uri via, InitiatorMessageSecurityBindingSupport security)
			: base (factory, remoteAddress, via)
		{
			this.channel = innerChannel;
			session = new SecurityDuplexSession (this);
			InitializeSecurityFunctionality (security);
		}
开发者ID:nickchal,项目名称:pash,代码行数:7,代码来源:SecurityDuplexSessionChannel.cs


示例10: Run

        public void Run(ModuleInfo info, CancellationToken token = default(CancellationToken))
        {
            double a = 0;
            double b = Math.PI/2;
            double h = 0.00000001;
            const int pointsNum = 2;
            var points = new IPoint[pointsNum];
            var channels = new IChannel[pointsNum];
            for (int i = 0; i < pointsNum; ++i)
            {
                points[i] = info.CreatePoint();
                channels[i] = points[i].CreateChannel();
                points[i].ExecuteClass("FirstModule.IntegralModule");
            }

            double y = a;
            for (int i = 0; i < pointsNum; ++i)
            {
                channels[i].WriteData(y);
                channels[i].WriteData(y + (b - a) / pointsNum);
                channels[i].WriteData(h);
                y += (b - a) / pointsNum;
            }
            DateTime time = DateTime.Now;            
            Console.WriteLine("Waiting for result...");

            double res = 0;
            for (int i = pointsNum - 1; i >= 0; --i)
            {
                res += channels[i].ReadData(typeof(double));
            }

            Console.WriteLine("Result found: res = {0}, time = {1}", res, Math.Round((DateTime.Now - time).TotalSeconds,3));
            
        }
开发者ID:AndriyKhavro,项目名称:Parcs.NET,代码行数:35,代码来源:MainIntegralModule.cs


示例11: _connection_OnReceived

 private static void _connection_OnReceived(object Data, System.IO.Ports.SerialPort port, IChannel channel, DateTime Timestamp)
 {
     //receive the data
     _display.Clear();
     Font fontNinaB = Resources.GetFont(Resources.FontResources.NinaB);
     var display = (string)Data;
     try
     {
         var ary = (string[]) Data;
         if (ary != null)
         {
             display = "";
             for (int i = 0; i < ary.Length; i++)
             {
                 display += ary[i] + ",";
             }
         }
     }
     catch (Exception)
     {
     }
     _display.DrawText(display, fontNinaB, Color.White, 10, 64);
     _display.Flush();
     //echo it back
     _connection.Write(Data);
 }
开发者ID:nothingmn,项目名称:AGENT.Contrib,代码行数:26,代码来源:Program.cs


示例12: SetInstanceIdChannel

 internal void SetInstanceIdChannel(string instanceId, IChannel channel)
 {
     lock (this)
     {
         this.channels[instanceId] = channel;
     }
 }
开发者ID:HakanL,项目名称:animatroller,代码行数:7,代码来源:NettyServer.cs


示例13: Decode

        public dynamic Decode(IChannel channel, PacketBuffer buffer)
        {
            buffer.BeginBufferIndex();
            if (buffer.AvailableBytes() < 1)
            {
                buffer.ResetBufferIndex();
                return null;
            }

            var data = new byte[buffer.AvailableBytes()];
            buffer.ReadBytes(data);

            string s = System.Text.Encoding.UTF8.GetString(data);
            int len = s.IndexOf('\n');
            if (len == -1)
            {
                buffer.ResetBufferIndex();
                return null;
            }
            s = s.Substring(0, len + 1);

            buffer.SetPosition(System.Text.Encoding.UTF8.GetByteCount(s));
            buffer.EndBufferIndex();

            return s;
        }
开发者ID:growingdever,项目名称:Netronics,代码行数:26,代码来源:PacketEncoder.cs


示例14: CreateProgramAMSConfigParams

 public CreateProgramAMSConfigParams(IChannel channel, string aAssetlName, string aProgramlName, TimeSpan DVR_WindowLength)
 {
     _channel = channel;
     _aAssetlName = aAssetlName;
     _aProgramlName = aProgramlName;
     _dvrWindowLength = DVR_WindowLength;
 }
开发者ID:villalongacu,项目名称:VooPpointMgr,代码行数:7,代码来源:CreateProgramAMSConfigParams.cs


示例15: AddRange

 public void AddRange(IChannel[] values)
 {
     foreach (IChannel chnl in values)
     {
         InnerList.Add(chnl);
     }
 }
开发者ID:wuyingyou,项目名称:uniframework,代码行数:7,代码来源:ChannelCollection.cs


示例16: AbstractChannel

 ///// <summary>
 // /// Creates a new instance.
 // ///
 // /// @param parent
 // ///        the parent of this channel. {@code null} if there's no parent.
 // /// </summary>
 //protected AbstractChannel(IChannel parent)
 //    : this(DefaultChannelId.NewInstance())
 //{
 //}
 /// <summary>
 /// Creates a new instance.
 ///
 //* @param parent
 //*        the parent of this channel. {@code null} if there's no parent.
 /// </summary>
 protected AbstractChannel(IChannel parent /*, ChannelId id*/)
 {
     this.Parent = parent;
     //this.Id = id;
     this.channelUnsafe = this.NewUnsafe();
     this.pipeline = new DefaultChannelPipeline(this);
 }
开发者ID:dalong123,项目名称:DotNetty,代码行数:23,代码来源:AbstractChannel.cs


示例17: Abort

 private static void Abort(IChannel channel, ChannelFactory channelFactory)
 {
     if (channel != null)
         channel.Abort();
     if (channelFactory != null)
         channelFactory.Abort();
 }
开发者ID:tian1ll1,项目名称:WPF_Examples,代码行数:7,代码来源:client.cs


示例18: Decode

        public dynamic Decode(IChannel channel, PacketBuffer buffer)
        {
            buffer.BeginBufferIndex();
            if(buffer.AvailableBytes() > MaxBufferSize)
            {
                channel.Disconnect();
                return null;
            }

            if (buffer.AvailableBytes() == 0)
                return null;

            Request request;

            try
            {
                request = Request.Parse(buffer);
            }
            catch (Exception)
            {
                buffer.ResetBufferIndex();
                return null;
            }

            buffer.EndBufferIndex();
            return request;
        }
开发者ID:victoryfree,项目名称:Netronics,代码行数:27,代码来源:HttpDecoder.cs


示例19: Play

        /// <summary>
        /// </summary>
        /// <param name="channel"> </param>
        protected override void Play(IChannel channel)
        {
            // REALLY NEED TO CHANGE THIS IOC/TEMPLATE METHOD IN BASE CLASS

            // http://blogs.msdn.com/danielfe/archive/2004/06/08/151212.aspx
            // _channel = channel;
            //if (channel == null) throw new ArgumentNullException("channel", "Must specify a channel to play. ");

            var url = channel.CurrentTrack.TrackUrl;

            if (!IsInstalled) return;
            //Trace.WriteLine(string.Format("{0} will attempt to stream {1}", this.PlayerType.ToString(), url));

            var thread = new Thread
                (() =>
                    {
                        iTunesApp player = new iTunesAppClass();
                        player.OpenURL(ParseStreamUri(url).AbsoluteUri);
                        player.Play();
                    });
            thread.Start();

            //Parallel.Invoke(
            //    () => startPlayer(url));
        }
开发者ID:jaypatrick,项目名称:dica,代码行数:28,代码来源:ITunes.cs


示例20: CreateMediaItem

    /// <summary>
    /// Creates a MediaItem that represents a TV stream. The MediaItem also holds information about stream indices to provide PiP
    /// functions (<paramref name="slotIndex"/>).
    /// </summary>
    /// <param name="slotIndex">Index of the slot (0/1)</param>
    /// <param name="path">Path or URL of the stream</param>
    /// <param name="channel"></param>
    /// <returns></returns>
    public static LiveTvMediaItem CreateMediaItem(int slotIndex, string path, IChannel channel)
    {
      if (!String.IsNullOrEmpty(path))
      {
        ISystemResolver systemResolver = ServiceRegistration.Get<ISystemResolver>();
        IDictionary<Guid, MediaItemAspect> aspects = new Dictionary<Guid, MediaItemAspect>();
        MediaItemAspect providerResourceAspect;
        MediaItemAspect mediaAspect;

        SlimTvResourceAccessor resourceAccessor = new SlimTvResourceAccessor(slotIndex, path);
        aspects[ProviderResourceAspect.ASPECT_ID] = providerResourceAspect = new MediaItemAspect(ProviderResourceAspect.Metadata);
        aspects[MediaAspect.ASPECT_ID] = mediaAspect = new MediaItemAspect(MediaAspect.Metadata);
        // VideoAspect needs to be included to associate VideoPlayer later!
        aspects[VideoAspect.ASPECT_ID] = new MediaItemAspect(VideoAspect.Metadata);
        providerResourceAspect.SetAttribute(ProviderResourceAspect.ATTR_SYSTEM_ID, systemResolver.LocalSystemId);

        String raPath = resourceAccessor.CanonicalLocalResourcePath.Serialize();
        providerResourceAspect.SetAttribute(ProviderResourceAspect.ATTR_RESOURCE_ACCESSOR_PATH, raPath);

        mediaAspect.SetAttribute(MediaAspect.ATTR_TITLE, "Live TV");
        mediaAspect.SetAttribute(MediaAspect.ATTR_MIME_TYPE, "video/livetv"); // Custom mimetype for LiveTv

        LiveTvMediaItem tvStream = new LiveTvMediaItem(new Guid(), aspects);

        tvStream.AdditionalProperties[LiveTvMediaItem.SLOT_INDEX] = slotIndex;
        tvStream.AdditionalProperties[LiveTvMediaItem.CHANNEL] = channel;
        tvStream.AdditionalProperties[LiveTvMediaItem.TUNING_TIME] = DateTime.Now;
        return tvStream;
      }
      return null;
    }
开发者ID:joconno4,项目名称:MediaPortal-2,代码行数:39,代码来源:SlimTvMediaItemBuilder.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# IChannelHandlerContext类代码示例发布时间:2022-05-24
下一篇:
C# ICertificatePal类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap