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


C# IChannel类代码示例

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


IChannel类属于命名空间,在下文中一共展示了IChannel类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: Form1

        public Form1()
        {
            InitializeComponent();

            log4net.Config.XmlConfigurator.Configure();

            textBox1.Text = ConfigurationManager.AppSettings["Path"];
            _application = new Application(ApplicationName);

            _workerFiber = new PoolFiber();
            _workerFiber.Start();

            _importar = new Channel<string>();
            _importar.Subscribe(_workerFiber, Work);

            _notificationType = new NotificationType(SampleNotificationType, "Sample Notification");

            _growl = new GrowlConnector { EncryptionAlgorithm = Cryptography.SymmetricAlgorithmType.AES };
            _growl.NotificationCallback += GrowlNotificationCallback;
            _growl.Register(_application, new[] { _notificationType });

            folderWatch.Created += FolderWatchCreated;
            folderWatch.Renamed += FolderWatchRenamed;
            folderWatch.Deleted += FolderWatchDeleted;

            InitDatabase();

            if (!_autostart) return;

            Operar(true,true);
        }
开发者ID:galbarello,项目名称:Importador.Fidecard,代码行数:31,代码来源:Form1.cs

示例15: SetUp

        public void SetUp()
        {
            testSender = MockRepository.GenerateStub<ISendMessages>();

            messagePersister = new InMemoryPersistence();

            httpChannel = new HttpChannel(messagePersister)
                              {
                                  ListenUrl = "http://localhost:8092/Gateway/",
                                  ReturnAddress = "Gateway.Tests.Input"
                              };

            httpChannel.MessageReceived += httpChannel_MessageReceived;

            httpChannel.Start();

            bus = Configure.With()
                .DefaultBuilder()
                .XmlSerializer()
                .FileShareDataBus("./databus")
                .InMemoryFaultManagement()
                .UnicastBus()
                .MsmqTransport()
                .CreateBus()
                .Start();
        }
开发者ID:bishoprook,项目名称:NServiceBus,代码行数:26,代码来源:on_its_input_queue.cs


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