本文整理汇总了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;
}
示例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);
}
}
示例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");
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}
示例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());
}
示例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();
}
示例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));
}
示例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();
}
示例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);
}