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


C# PacketReader.ReadByte方法代码示例

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


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

示例1: Parse

        public IEnumerable<PlayerInfo> Parse(byte[] data)
        {
            var players = new List<PlayerInfo>();

            var reader = new PacketReader(data);

            var header = reader.ReadByte();
            var chard = Convert.ToChar(header);

            var numberOfPlayers = reader.ReadByte();

            for (byte i = 1; i <= numberOfPlayers; i++)
            {
                var player = new PlayerInfo();
                if (!reader.IsEnd)
                {
                    player.Index = reader.ReadByte(); // always returns 0
                    player.Index = i;
                    player.Name = reader.ReadUTFString();
                    player.Score = reader.ReadLong();
                    player.Duration = reader.ReadFloat();
                }
                players.Add(player);
            }

            return players;
        }
开发者ID:AlexSbyshko,项目名称:Barsik,代码行数:27,代码来源:PlayersParser.cs

示例2: UnicodeSpeechRequest

        public UnicodeSpeechRequest(byte[] data)
            : base(data)
        {
            PacketReader reader = new PacketReader(data);
            byte id = reader.ReadByte();
            ushort blockSize = reader.ReadUInt16();

            byte type = reader.ReadByte();
            this.type = (byte)(type & 0x0F);
            color = reader.ReadUInt16();
            font = reader.ReadUInt16();
            language = reader.ReadAnsiString(4);

            if ((type & 0xC0) != 0)
            {
                int numKeywords = (Data[12] << 4) + (Data[13] >> 4);
                reader.Skip(((numKeywords * 12 + 12) + 7) / 8);

                text = reader.ReadAnsiString(Lenght - reader.Offset);
            }
            else
            {
                text = reader.ReadUnicodeString(Lenght - reader.Offset);
            }
        }
开发者ID:greeduomacro,项目名称:phoenix,代码行数:25,代码来源:UnicodeSpeechRequest.cs

示例3: Menu

        public Menu(byte[] data)
            : base(data)
        {
            PacketReader reader = new PacketReader(data);
            byte id = reader.ReadByte();
            ushort blockSize = reader.ReadUInt16();

            dialogSerial = reader.ReadUInt32();
            menuSerial = reader.ReadUInt16();

            byte titleLen = reader.ReadByte();
            title = reader.ReadAnsiString(titleLen);

            byte optionCount = reader.ReadByte();
            MenuOption[] optionList = new MenuOption[optionCount];

            for (int i = 0; i < optionCount; i++) {
                optionList[i].Artwork = reader.ReadUInt16();
                optionList[i].Hue = reader.ReadUInt16();

                byte textLen = reader.ReadByte();
                optionList[i].Text = reader.ReadAnsiString(textLen);
            }

            options = Array.AsReadOnly<MenuOption>(optionList);

            // if (reader.Offset == reader.Length)
            //     System.Diagnostics.Debug.WriteLine("Menu packet resolved succesfully.", "Communication");
        }
开发者ID:greeduomacro,项目名称:phoenix,代码行数:29,代码来源:Menu.cs

示例4: IR_ARP

 /// <summary>
 /// Creates a new admin response packet.
 /// </summary>
 /// <param name="buffer">A buffer contaning the packet data.</param>
 public IR_ARP(byte[] buffer) {
     PacketReader reader = new PacketReader(buffer);
     Size = reader.ReadByte();
     Type = (PacketType)reader.ReadByte();
     ReqI = reader.ReadByte();
     Admin = reader.ReadBoolean();
 }
开发者ID:Kristoffeh,项目名称:InSim.NET_Library,代码行数:11,代码来源:IR_ARP.cs

示例5: IR_ERR

 /// <summary>
 /// Creates a new InSim Relay error packet.
 /// </summary>
 /// <param name="buffer">A buffer contaning the packet data.</param>
 public IR_ERR(byte[] buffer) {
     PacketReader reader = new PacketReader(buffer);
     Size = reader.ReadByte();
     Type = (PacketType)reader.ReadByte();
     ReqI = reader.ReadByte();
     ErrNo = (RelayError)reader.ReadByte();
 }
开发者ID:maindefine,项目名称:insimdotnet,代码行数:11,代码来源:IR_ERR.cs

示例6: IS_TINY

 /// <summary>
 /// Creates a new general purpose packet.
 /// </summary>
 /// <param name="buffer">A buffer contaning the packet data.</param>
 public IS_TINY(byte[] buffer)
     : this() {
     PacketReader reader = new PacketReader(buffer);
     Size = reader.ReadByte();
     Type = (PacketType)reader.ReadByte();
     ReqI = reader.ReadByte();
     SubT = (TinyType)reader.ReadByte();
 }
开发者ID:maindefine,项目名称:insimdotnet,代码行数:12,代码来源:IS_TINY.cs

示例7: IS_PLP

 /// <summary>
 /// Creates a new player pits packet.
 /// </summary>
 /// <param name="buffer">A buffer contaning the packet data.</param>
 public IS_PLP(byte[] buffer)
     : this() {
     PacketReader reader = new PacketReader(buffer);
     Size = reader.ReadByte();
     Type = (PacketType)reader.ReadByte();
     ReqI = reader.ReadByte();
     PLID = reader.ReadByte();
 }
开发者ID:Kristoffeh,项目名称:InSim.NET_Library,代码行数:12,代码来源:IS_PLP.cs

示例8: IS_SMALL

 /// <summary>
 /// Creates a new general purpose packet.
 /// </summary>
 /// <param name="buffer">A buffer contaning the packet data.</param>
 public IS_SMALL(byte[] buffer)
     : this() {
     PacketReader reader = new PacketReader(buffer);
     Size = reader.ReadByte();
     Type = (PacketType)reader.ReadByte();
     ReqI = reader.ReadByte();
     SubT = (SmallType)reader.ReadByte();
     UVal = reader.ReadUInt32();
 }
开发者ID:Kristoffeh,项目名称:InSim.NET_Library,代码行数:13,代码来源:IS_SMALL.cs

示例9: IS_PFL

 /// <summary>
 /// Creates a new player flags packet.
 /// </summary>
 /// <param name="buffer">A buffer contaning the packet data.</param>
 public IS_PFL(byte[] buffer)
     : this() {
     PacketReader reader = new PacketReader(buffer);
     Size = reader.ReadByte();
     Type = (PacketType)reader.ReadByte();
     ReqI = reader.ReadByte();
     PLID = reader.ReadByte();
     Flags = (PlayerFlags)reader.ReadUInt16();
 }
开发者ID:maindefine,项目名称:insimdotnet,代码行数:13,代码来源:IS_PFL.cs

示例10: Read

 public override void Read(PacketReader r)
 {
     CommandId = r.ReadByte();
     PetId1 = r.ReadInt32();
     PetId2 = r.ReadInt32();
     ObjectId = r.ReadInt32();
     ObjectSlot = (SlotObject)new SlotObject().Read(r);
     Currency = r.ReadByte();
 }
开发者ID:JuixGames,项目名称:K_Relay,代码行数:9,代码来源:PetYardCommandPacket.cs

示例11: IS_PSF

 /// <summary>
 /// Creates a new pit stop finished.
 /// </summary>
 /// <param name="buffer">A buffer contaning the packet data.</param>
 public IS_PSF(byte[] buffer)
     : this() {
     PacketReader reader = new PacketReader(buffer);
     Size = reader.ReadByte();
     Type = (PacketType)reader.ReadByte();
     ReqI = reader.ReadByte();
     PLID = reader.ReadByte();
     STime = TimeSpan.FromMilliseconds(reader.ReadUInt32());
 }
开发者ID:Kristoffeh,项目名称:InSim.NET_Library,代码行数:13,代码来源:IS_PSF.cs

示例12: IS_CCH

 /// <summary>
 /// Creates a new camera change packet.
 /// </summary>
 /// <param name="buffer">A buffer contaning the packet data.</param>
 public IS_CCH(byte[] buffer)
     : this() {
     PacketReader reader = new PacketReader(buffer);
     Size = reader.ReadByte();
     Type = (PacketType)reader.ReadByte();
     ReqI = reader.ReadByte();
     PLID = reader.ReadByte();
     Camera = (ViewIndentifier)reader.ReadByte();
 }
开发者ID:maindefine,项目名称:insimdotnet,代码行数:13,代码来源:IS_CCH.cs

示例13: IS_REO

 /// <summary>
 /// Creates a new reorder packet.
 /// </summary>
 /// <param name="buffer">A buffer contaning the packet data.</param>
 public IS_REO(byte[] buffer)
     : this() {
     PacketReader reader = new PacketReader(buffer);
     Size = reader.ReadByte();
     Type = (PacketType)reader.ReadByte();
     ReqI = reader.ReadByte();
     NumP = reader.ReadByte();
     PLID = new List<byte>(reader.ReadBytes(NumP));
 }
开发者ID:maindefine,项目名称:insimdotnet,代码行数:13,代码来源:IS_REO.cs

示例14: HInfo

        /// <summary>
        /// Creates a new <see cref="HInfo"/> sub-packet.
        /// </summary>
        /// <param name="reader">A <see cref="PacketReader"/> contaning the packet object.</param>
        public HInfo(PacketReader reader) {
            if (reader == null) {
                throw new ArgumentNullException("reader");
            }

            HName = reader.ReadString(32);
            Track = reader.ReadString(6);
            Flags = (HostFlags)reader.ReadByte();
            NumConns = reader.ReadByte();
        }
开发者ID:maindefine,项目名称:insimdotnet,代码行数:14,代码来源:HInfo.cs

示例15: IS_CPR

 /// <summary>
 /// Creates a new connection player rename packet.
 /// </summary>
 /// <param name="buffer">A buffer contaning the packet data.</param>
 public IS_CPR(byte[] buffer)
     : this() {
     PacketReader reader = new PacketReader(buffer);
     Size = reader.ReadByte();
     Type = (PacketType)reader.ReadByte();
     ReqI = reader.ReadByte();
     UCID = reader.ReadByte();
     PName = reader.ReadString(24);
     Plate = reader.ReadString(8);
 }
开发者ID:Kristoffeh,项目名称:InSim.NET_Library,代码行数:14,代码来源:IS_CPR.cs


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