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


C# BufferChunk.NextByte方法代码示例

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


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

示例1: HandleInvalidPacket

 private void HandleInvalidPacket(BufferChunk packet, IPEndPoint src, string exception)
 {
     rtpSession.RaiseInvalidPacketEvent(string.Format("First byte: {0}, Source IP: {1}, " +
         "Exception: {2}", packet.NextByte(), src, exception));
 }
开发者ID:tdhieu,项目名称:openvss,代码行数:5,代码来源:RtpListener.cs

示例2: ReadPrivatePropertyFromBuffer

        private void ReadPrivatePropertyFromBuffer(BufferChunk buffer)
        {
            byte totalLength = buffer.NextByte();
            byte prefixLength = buffer.NextByte();
            int dataLength = totalLength - prefixLength - 1;

            // The cast to byte[] does a copy
            byte[] prefix = (byte[])buffer.NextBufferChunk(prefixLength);
            byte[] data = null;
            
            if(dataLength > 0)
            {
                // The cast to byte[] does a copy
                data = (byte[])buffer.NextBufferChunk(dataLength);
            }

            privs[prefix] = data;
        }
开发者ID:tdhieu,项目名称:openvss,代码行数:18,代码来源:RtcpData.cs

示例3: ReadDataFromBuffer

        /// <summary>
        /// Converts buffer into member data
        /// </summary>
        /// <param name="packet"></param>
        public override void ReadDataFromBuffer(BufferChunk buffer)
        {
            // Read SSRCs
            for(int i = 0; i < Header.ItemCount; i++)
            {
                ssrcs.Add(buffer.NextUInt32());
            }

            // Determine if there is a reason...
            // SSRCs are 32 bits each, Length is number of 32 bit words in packet data
            if(Header.Length > Header.ItemCount)
            {
                reason = (byte[])buffer.NextBufferChunk(buffer.NextByte());
            }
        }
开发者ID:tdhieu,项目名称:openvss,代码行数:19,代码来源:RtcpPacket.cs

示例4: ReadDataFromBuffer

        /// <summary>
        /// Deserializes the provided buffer into this object
        /// </summary>
        /// <param name="buffer"></param>
        public void ReadDataFromBuffer(BufferChunk buffer)
        {
            Rtcp.SDESType type;

            while((type = (Rtcp.SDESType)buffer.NextByte()) != Rtcp.SDESType.END)
            {
                switch(type)
                {
                    case Rtcp.SDESType.CNAME:
                    case Rtcp.SDESType.EMAIL:
                    case Rtcp.SDESType.LOC:
                    case Rtcp.SDESType.NAME:
                    case Rtcp.SDESType.NOTE:
                    case Rtcp.SDESType.PHONE:
                    case Rtcp.SDESType.TOOL:
                        ReadPropertyFromBuffer((int)type, buffer);
                        break;
                    
                    case Rtcp.SDESType.PRIV:
                        ReadPrivatePropertyFromBuffer(buffer);
                        break;

                    default:
                        throw new ApplicationException("Unexpected SDES type: " + type);
                }
            }
        }
开发者ID:tdhieu,项目名称:openvss,代码行数:31,代码来源:RtcpData.cs

示例5: ReadPropertyFromBuffer

        private void ReadPropertyFromBuffer(int type, BufferChunk buffer)
        {
            int dataLength = buffer.NextByte();

            if(dataLength != 0)
            {
                data[type] = (byte[])buffer.NextBufferChunk(dataLength);
            }
            else // Clear value
            {
                data[type] = null;
            }
        }
开发者ID:tdhieu,项目名称:openvss,代码行数:13,代码来源:RtcpData.cs

示例6: ThreeBytesToInt

        /// <summary>
        /// Converts 3 bytes into a big-endian integer
        /// </summary>
        /// <param name="data"></param>
        /// <returns>Big-endian formatted integer</returns>
        private static int ThreeBytesToInt(BufferChunk data)
        {
            int ret = 0;

            ret += (data.NextByte() << 1 * 8);
            ret += (data.NextByte() << 2 * 8);
            ret += (data.NextByte() << 3 * 8);

            // If the 8th bit of the second byte (what will be the 24th bit)
            // is turned on, the value is signed, so sign extend our integer
            if(((byte)(ret >> 1 * 8) & 0x80) == 0x80)
            {
                ret += 0xFF;
            }

            return ret;
        }
开发者ID:tdhieu,项目名称:openvss,代码行数:22,代码来源:RtcpData.cs

示例7: ReadDataFromBuffer

        /// <summary>
        /// Deserializes the provided buffer into this object
        /// </summary>
        /// <param name="buffer"></param>
        public override void ReadDataFromBuffer(BufferChunk buffer)
        {
            SDESType type;

            while ((type = (SDESType)buffer.NextByte()) != SDESType.END)
            {
                switch (type)
                {
                    case SDESType.CNAME:
                    case SDESType.EMAIL:
                    case SDESType.LOC:
                    case SDESType.NAME:
                    case SDESType.NOTE:
                    case SDESType.PHONE:
                    case SDESType.TOOL:
                        ReadPropertyFromBuffer((int)type, buffer);
                        break;

                    case SDESType.PRIV:
                        ReadPrivatePropertyFromBuffer(buffer);
                        break;

                    default:
                        throw new ApplicationException(string.Format(CultureInfo.CurrentCulture,
                            Strings.UnexpectedSDESType, type));
                }
            }
        }
开发者ID:Wiladams,项目名称:NewTOAPIA,代码行数:32,代码来源:SdesData.cs

示例8: ThreeBytesToInt

        /// <summary>
        /// Converts 3 bytes into a big-endian integer
        /// </summary>
        /// <param name="data"></param>
        /// <returns>Big-endian formatted integer</returns>
        private static int ThreeBytesToInt(BufferChunk data)
        {
            int ret = 0;

            ret += data.NextByte();
            ret += (data.NextByte() << 8);
            ret += (data.NextByte() << 16);

      
            if(((byte)(ret >> 16) & 0x80) == 0x80)
            {
                ret += 0xFF;
            }

            return ret;
        }
开发者ID:psyCHOder,项目名称:conferencexp,代码行数:21,代码来源:RtcpData.cs

示例9: Run

        override public void Run()
        {
            BufferChunk bc = new BufferChunk(7);
            short s = 25000;
            int i = 545434;
            byte b = 56;

            bc += s;
            bc += i;
            bc += b;

            if (bc.NextInt16() != s)
                throw new TestCaseException("Short failed for " + s);
            if (bc.NextInt32() != i)
                throw new TestCaseException("Int failed for " + i);
            if (bc.NextByte() != b)
                throw new TestCaseException("Byte failed for " + b);

            bc.Reset();

            s = short.MaxValue;
            i = int.MaxValue;
            b = byte.MaxValue;

            bc += s;
            bc += i;
            bc += b;

            if (bc.NextInt16() != s)
                throw new TestCaseException("Short failed for " + s);
            if (bc.NextInt32() != i)
                throw new TestCaseException("Int failed for " + i);
            if (bc.NextByte() != b)
                throw new TestCaseException("Byte failed for " + b);

            bc.Reset();

            s = short.MinValue;
            i = int.MinValue;
            b = byte.MinValue;

            bc += s;
            bc += i;
            bc += b;

            if (bc.NextInt16() != s)
                throw new TestCaseException("Short failed for " + s);
            if (bc.NextInt32() != i)
                throw new TestCaseException("Int failed for " + i);
            if (bc.NextByte() != b)
                throw new TestCaseException("Byte failed for " + b);

        }
开发者ID:psyCHOder,项目名称:conferencexp,代码行数:53,代码来源:TestCases.cs


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