本文整理汇总了C#中ClientMsg.WriteNullTermString方法的典型用法代码示例。如果您正苦于以下问题:C# ClientMsg.WriteNullTermString方法的具体用法?C# ClientMsg.WriteNullTermString怎么用?C# ClientMsg.WriteNullTermString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ClientMsg
的用法示例。
在下文中一共展示了ClientMsg.WriteNullTermString方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SendChatRoomMessage
/// <summary>
/// Sends a message to a chat room.
/// </summary>
/// <param name="steamIdChat">The SteamID of the chat room.</param>
/// <param name="type">The message type.</param>
/// <param name="message">The message.</param>
public void SendChatRoomMessage( SteamID steamIdChat, EChatEntryType type, string message )
{
SteamID chatId = steamIdChat.ConvertToUInt64(); // copy the steamid so we don't modify it
if ( chatId.IsClanAccount )
{
// this steamid is incorrect, so we'll fix it up
chatId.AccountInstance = ( uint )SteamID.ChatInstanceFlags.Clan;
chatId.AccountType = EAccountType.Chat;
}
var chatMsg = new ClientMsg<MsgClientChatMsg>();
chatMsg.Body.ChatMsgType = type;
chatMsg.Body.SteamIdChatRoom = chatId;
chatMsg.Body.SteamIdChatter = Client.SteamID;
chatMsg.WriteNullTermString( message, Encoding.UTF8 );
this.Client.Send( chatMsg );
}
示例2: SendGuestPass
/// <summary>
/// Send a guest pass or gift to a target user, defined by their account id or email
/// </summary>
/// <param name="giftId">64-bit GID of the gift</param>
/// <param name="accountId">Account ID of the recipient</param>
/// <param name="email">Optional email of the recipient</param>
public void SendGuestPass( ulong giftId, uint accountId, string email = null )
{
var sendGift = new ClientMsg<MsgClientSendGuestPass>();
sendGift.Body.GiftId = giftId;
if ( string.IsNullOrEmpty( email ) )
{
sendGift.Body.GiftType = 1;
sendGift.Body.AccountId = accountId;
sendGift.WriteNullTermString( "" );
}
else
{
sendGift.Body.GiftType = 0;
sendGift.Body.AccountId = 0;
sendGift.WriteNullTermString( email );
}
this.Client.Send( sendGift );
}