本文整理汇总了C#中PacketWriter.WriteUInt16方法的典型用法代码示例。如果您正苦于以下问题:C# PacketWriter.WriteUInt16方法的具体用法?C# PacketWriter.WriteUInt16怎么用?C# PacketWriter.WriteUInt16使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PacketWriter
的用法示例。
在下文中一共展示了PacketWriter.WriteUInt16方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateBuff
// Still no multi channel handle
/// <summary>
/// Create 'ChannelList' buffer
/// </summary>
/// <returns></returns>
public byte[] CreateBuff()
{
byte[] block = new byte[0x40]; // Create our null byte array
PacketWriter PW = new PacketWriter(block); // Initialize the reader
PW.WriteByteArray(0, EngineUtils.PacketUtils.calcPacket(block.Length, 0x7D6)); // Write the packet header
PW.WriteString(5, EngineEnum.PacketEnum.PacketCommand.success_0); // Write the success string cmd
PW.WriteUInt16(29, 1); // I don't know yet what is this
PW.WriteUInt16(31, 1); // I don't know yet what is this
PW.WriteString(32, channelname); // Write channel name
PW.WriteUInt32(44, 5); // I don't know yet what is this - multichannel
PW.WriteUInt32(48, 6); // I don't know yet what is this - multichannel
PW.WriteUInt32(52, 7); // I don't know yet what is this - multichannel
PW.WriteUInt32(56, 9); // I don't know yet what is this - multichannel
PW.WriteUInt32(60, 10); // I don't know yet what is this - multichannel
if (channelname.Length > 11) // Channel name can't contains over 11 letters
{
Error.Invoke("Channel name is too long");
return null;
}
return block;
}
示例2: Create
/// <summary>
/// The create.
/// </summary>
/// <param name="playerid">
/// </param>
/// <param name="message">
/// </param>
/// <param name="chatType">
/// The chat Type.
/// </param>
/// <returns>
/// </returns>
public static byte[] Create(uint playerid, string message, byte chatType)
{
PacketWriter writer = new PacketWriter(34);
writer.WriteUInt32(playerid);
writer.WriteString(message);
// Blob start
// This blob is actually byte array,
// but we have only one byte to send with it
// so I didn't add array stuff
// and made it always one byte.
writer.WriteUInt16(1);
writer.WriteByte(chatType);
// Blob ends
return writer.Finish();
}