本文整理汇总了C#中StreamHandler.ReadCString方法的典型用法代码示例。如果您正苦于以下问题:C# StreamHandler.ReadCString方法的具体用法?C# StreamHandler.ReadCString怎么用?C# StreamHandler.ReadCString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StreamHandler
的用法示例。
在下文中一共展示了StreamHandler.ReadCString方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Read
public void Read(StreamHandler Reader)
{
Flags = (SpellCastTargetFlags)Reader.ReadUInt32();
if ((Flags & (
SpellCastTargetFlags.Unit | SpellCastTargetFlags.Unk2 |
SpellCastTargetFlags.Object |
SpellCastTargetFlags.Corpse | SpellCastTargetFlags.PvPCorpse
)) != 0)
TargetUnit = Reader.ReadPackedGuid();
if ((Flags & (SpellCastTargetFlags.Item | SpellCastTargetFlags.TradeItem)) != 0)
TargetItem = Reader.ReadPackedGuid();
if ((Flags & SpellCastTargetFlags.SourceLocation) != 0)
{
SourceTransportGuid = Reader.ReadPackedGuid();
SourceLocation = Reader.ReadVector3();
}
if ((Flags & SpellCastTargetFlags.DestLocation) != 0)
{
DestTransportGuid = Reader.ReadPackedGuid();
DestLocation = Reader.ReadVector3();
}
if ((Flags & SpellCastTargetFlags.String) != 0)
StringTarget = Reader.ReadCString();
}
示例2: Read
public override void Read(StreamHandler reader)
{
this.Roles = (GroupRoles)reader.ReadUInt32();
reader.Skip(2); // 2 bools
uint count = reader.ReadByte();
Dungeons = new DungeonEntry[count];
for (uint i = 0; i < count; ++i)
Dungeons[i] = new DungeonEntry(reader.ReadUInt32());
reader.Skip(4);
this.Comment = reader.ReadCString();
}
示例3: InternalOpenForReading
protected unsafe override void InternalOpenForReading(Stream stream, bool closeStream)
{
base.InternalOpenForReading(stream, closeStream);
int optLen;
var headerBytes = m_stream.ReadBytes(MainHeader.Size);
fixed (byte* ptr = headerBytes)
{
var header = (MainHeader*)ptr;
GetClientBuildInfo(header->ClientBuild);
var langBytes = stackalloc byte[5];
langBytes[0] = header->Lang[0];
langBytes[1] = header->Lang[1];
langBytes[2] = (byte)'-';
langBytes[3] = header->Lang[2];
langBytes[4] = header->Lang[3];
var lang = new string((sbyte*)langBytes, 0, 5);
try
{
this.Culture = CultureInfo.GetCultureInfo(lang);
}
catch
{
}
optLen = header->OptionalHeaderLength;
Marshal.Copy(new IntPtr(header->SessionKey), m_sessionKey, 0, 40);
this.SnifferId = (PktSnifferId)header->SnifferId;
this.StartTicks = header->StartedOnTicks;
this.StartTime = header->StartedOnUnix.AsUnixTime();
}
if (this.SnifferId == PktSnifferId.Kamilla)
{
using (var reader = new StreamHandler(m_stream.ReadBytes(optLen)))
{
var flags = (OptHeaderFlags)reader.ReadUInt32();
if ((flags & OptHeaderFlags.HasOCAD) != 0)
reader.Skip(4);
if ((flags & OptHeaderFlags.HasSnifferDescString) != 0)
this.SnifferDesc = reader.ReadCString();
if ((flags & OptHeaderFlags.HasFCAD) != 0)
this.FCAD = reader.ReadBytes(16);
if ((flags & OptHeaderFlags.HasSCAD) != 0)
this.SCAD = reader.ReadBytes(16);
}
}
else
m_stream.Skip(optLen);
this.InternalSetCapacity((int)((m_stream.Length - m_stream.Position) / 100));
}
示例4: ReadFromStreamHandler
private void ReadFromStreamHandler(StreamHandler Reader, WowOpcodes opcode)
{
GameMasterMessage = (opcode == WowOpcodes.SMSG_GM_MESSAGECHAT);
m_type = (ChatMessageType)Reader.ReadByte();
if (m_type == ChatMessageType.Addon2)
m_type = ChatMessageType.Addon;
m_language = (Language)Reader.ReadUInt32();
m_senderGUID = Reader.ReadGuid();
m_unknownUInt32 = Reader.ReadUInt32();
switch (m_type)
{
case ChatMessageType.MonsterSay:
case ChatMessageType.MonsterParty:
case ChatMessageType.MonsterYell:
case ChatMessageType.MonsterWhisper:
case ChatMessageType.MonsterEmote:
case ChatMessageType.BattleNet:
case ChatMessageType.RaidBossEmote:
case ChatMessageType.RaidBossWhisper:
Reader.Skip(4);
m_senderName = Reader.ReadCString();
m_targetGUID = Reader.ReadGuid();
if (!m_targetGUID.IsEmpty
&& !m_targetGUID.IsPlayer
&& !m_targetGUID.IsPet)
{
Reader.Skip(4);
m_targetName = Reader.ReadCString();
}
if (m_language == Language.Addon)
m_addonPrefix = Reader.ReadCString();
Reader.Skip(4);
m_text = Reader.ReadCString();
m_flags = (ChatMessageFlags)Reader.ReadByte();
if (m_type == ChatMessageType.RaidBossEmote || m_type == ChatMessageType.RaidBossWhisper)
{
m_displayTime = Reader.ReadSingle();
m_suspendEvent = Reader.ReadBoolean();
}
break;
case ChatMessageType.BGSystemNeutral:
case ChatMessageType.BGSystemAlliance:
case ChatMessageType.BGSystemHorde:
m_targetGUID = Reader.ReadGuid();
if (!m_targetGUID.IsEmpty
&& !m_targetGUID.IsPlayer)
{
Reader.Skip(4);
m_targetName = Reader.ReadCString();
}
if (m_language == Language.Addon)
m_addonPrefix = Reader.ReadCString();
Reader.Skip(4);
m_text = Reader.ReadCString();
m_flags = (ChatMessageFlags)Reader.ReadByte();
break;
case ChatMessageType.Achievement:
case ChatMessageType.GuildAchievement:
m_targetGUID = Reader.ReadGuid();
if (m_language == Language.Addon)
m_addonPrefix = Reader.ReadCString();
Reader.Skip(4);
m_text = Reader.ReadCString();
m_flags = (ChatMessageFlags)Reader.ReadByte();
m_achievementId = Reader.ReadUInt32();
break;
case ChatMessageType.WhisperForeign:
Reader.Skip(4);
m_senderName = Reader.ReadCString();
m_targetGUID = Reader.ReadGuid();
if (m_language == Language.Addon)
m_addonPrefix = Reader.ReadCString();
Reader.Skip(4);
m_text = Reader.ReadCString();
m_flags = (ChatMessageFlags)Reader.ReadByte();
break;
default:
if (GameMasterMessage)
{
Reader.Skip(4);
m_senderName = Reader.ReadCString();
}
if (m_type == ChatMessageType.Channel)
m_channel = Reader.ReadCString();
m_targetGUID = Reader.ReadGuid();
if (m_language == Language.Addon)
m_addonPrefix = Reader.ReadCString();
Reader.Skip(4);
m_text = Reader.ReadCString();
m_flags = (ChatMessageFlags)Reader.ReadByte();
break;
}
}