本文整理汇总了C#中StreamHandler.WriteCString方法的典型用法代码示例。如果您正苦于以下问题:C# StreamHandler.WriteCString方法的具体用法?C# StreamHandler.WriteCString怎么用?C# StreamHandler.WriteCString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StreamHandler
的用法示例。
在下文中一共展示了StreamHandler.WriteCString方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Write
public void Write(StreamHandler Writer)
{
Writer.WriteUInt32((uint)Flags);
if ((Flags & (
SpellCastTargetFlags.Unit | SpellCastTargetFlags.Unk2 |
SpellCastTargetFlags.Object |
SpellCastTargetFlags.Corpse | SpellCastTargetFlags.PvPCorpse
)) != 0)
Writer.WritePackedGuid(TargetUnit);
if ((Flags & (SpellCastTargetFlags.Item | SpellCastTargetFlags.TradeItem)) != 0)
Writer.WritePackedGuid(TargetItem);
if ((Flags & SpellCastTargetFlags.SourceLocation) != 0)
{
Writer.WritePackedGuid(SourceTransportGuid);
Writer.WriteStruct<Vector3>(SourceLocation);
}
if ((Flags & SpellCastTargetFlags.DestLocation) != 0)
{
Writer.WritePackedGuid(DestTransportGuid);
Writer.WriteStruct<Vector3>(DestLocation);
}
if ((Flags & SpellCastTargetFlags.String) != 0)
Writer.WriteCString(StringTarget);
}
示例2: Save
public override void Save(StreamHandler writer)
{
writer.WriteUInt32((uint)Roles);
writer.WriteUInt16(0);
writer.WriteByte((byte)Dungeons.Length);
foreach (var entry in Dungeons)
writer.WriteUInt32(entry.Entry);
writer.WriteByte(3);
writer.WriteUInt16(0);
writer.WriteByte(0);
writer.WriteCString(Comment);
}
示例3: Save
/// <summary>
/// Saves the current ChatMessage to a stream using a StreamHandler.
/// </summary>
/// <param name="Writer">
/// Instance of StreamHandler used to save the current ChatMessage to a stream.
/// </param>
public override void Save(StreamHandler Writer)
{
Writer.WriteByte((byte)m_type);
Writer.WriteUInt32((uint)m_language);
Writer.WriteGuid(m_senderGUID);
Writer.WriteUInt32(m_unknownUInt32);
switch (m_type)
{
case ChatMessageType.MonsterSay:
case ChatMessageType.MonsterParty:
case ChatMessageType.MonsterYell:
case ChatMessageType.MonsterWhisper:
case ChatMessageType.MonsterEmote:
case ChatMessageType.RaidBossEmote:
case ChatMessageType.RaidBossWhisper:
case ChatMessageType.BattleNet:
Writer.WriteChatString(m_senderName ?? "<sender>");
Writer.WriteGuid(m_targetGUID);
if (!m_targetGUID.IsEmpty
&& !m_targetGUID.IsPlayer
&& !m_targetGUID.IsPet)
{
Writer.WriteChatString(m_targetName ?? "<target>");
}
if (m_language == Language.Addon)
Writer.WriteCString(m_addonPrefix ?? "<prefix>");
Writer.WriteChatString(m_text ?? "<text>");
Writer.WriteByte((byte)m_flags);
if (m_type == ChatMessageType.RaidBossEmote || m_type == ChatMessageType.RaidBossWhisper)
{
Writer.WriteSingle(m_displayTime);
Writer.WriteBoolean(m_suspendEvent);
}
break;
case ChatMessageType.BGSystemNeutral:
case ChatMessageType.BGSystemAlliance:
case ChatMessageType.BGSystemHorde:
Writer.WriteGuid(m_targetGUID);
if (!m_targetGUID.IsEmpty
&& !m_targetGUID.IsPlayer)
{
Writer.WriteChatString(m_targetName);
}
if (m_language == Language.Addon)
Writer.WriteCString(m_addonPrefix ?? "<prefix>");
Writer.WriteChatString(m_text ?? "<text>");
Writer.WriteByte((byte)m_flags);
break;
case ChatMessageType.Achievement:
case ChatMessageType.GuildAchievement:
Writer.WriteGuid(m_targetGUID);
if (m_language == Language.Addon)
Writer.WriteCString(m_addonPrefix ?? "<prefix>");
Writer.WriteChatString(m_text ?? "<text>");
Writer.WriteByte((byte)m_flags);
Writer.WriteUInt32(m_achievementId);
break;
case ChatMessageType.WhisperForeign:
Writer.WriteChatString(m_senderName ?? "<sender>");
Writer.WriteGuid(m_targetGUID);
if (m_language == Language.Addon)
Writer.WriteCString(m_addonPrefix ?? "<prefix>");
Writer.WriteChatString(m_text ?? "<text>");
Writer.WriteByte((byte)m_flags);
break;
default:
if (GameMasterMessage)
Writer.WriteChatString(m_senderName ?? "<sender>");
if (m_type == ChatMessageType.Channel)
Writer.WriteCString(m_channel ?? "<channel>");
Writer.WriteGuid(m_targetGUID);
if (m_language == Language.Addon)
Writer.WriteCString(m_addonPrefix ?? "<prefix>");
Writer.WriteChatString(m_text ?? "<text>");
Writer.WriteByte((byte)m_flags);
break;
}
}