本文整理汇总了C#中System.IO.PacketReader.MoveToData方法的典型用法代码示例。如果您正苦于以下问题:C# PacketReader.MoveToData方法的具体用法?C# PacketReader.MoveToData怎么用?C# PacketReader.MoveToData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.IO.PacketReader
的用法示例。
在下文中一共展示了PacketReader.MoveToData方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnCompressedGump
private static void OnCompressedGump(PacketReader p, PacketHandlerEventArgs e)
{
p.MoveToData();
uint sender = p.ReadUInt32();
uint id = p.ReadUInt32();
if (id == responseID)
_responseSender = sender;
if (id != compressedID)
return;
p.Seek(19, SeekOrigin.Begin);
p.Seek(p.ReadInt32(), SeekOrigin.Current);
int lines = p.ReadInt32(), cLen = p.ReadInt32(), dLen = p.ReadInt32();
if (cLen < 5)
return;
byte[] buffer = new byte[dLen];
ZLib.uncompress(buffer, ref dLen, p.CopyBytes(p.Position, cLen - 4), cLen - 4);
string afk = string.Empty;
for (int i = 0, pos = 0; i < lines; i++)
{
int strLen = (buffer[pos++] << 8) | buffer[pos++];
string str = Encoding.BigEndianUnicode.GetString(buffer, pos, strLen * 2);
int index = str.IndexOf('>');
if (index != -1 && index < str.Length - 1)
afk += str[index + 1].ToString().ToUpper().Normalize(NormalizationForm.FormD)[0];
pos += strLen * 2;
}
afk = afk.Trim();
if (afk.Length == 5 && _responseSender != 0)
{
/*ClientCommunication.SendToClient(new CloseGump(responseID));
WorldEx.SendToServer(new GumpResponse(responseSender, responseID, 0x310, new int[0], new[] { new GumpTextEntry(0x310, afk) }));
responseSender = 0;*/
WorldEx.OverHeadMessage(afk);
}
}
示例2: ProcessPacket
public static void ProcessPacket( byte[] data )
{
PacketHandler call = m_Table[data[0]] as PacketHandler;
if ( call != null )
{
PacketReader pvSrc = new PacketReader( data, RPVEditor.PacketInfo.IsDyn( data[0] ) );
pvSrc.MoveToData();
call( pvSrc );
}
}