当前位置: 首页>>代码示例>>C#>>正文


C# StreamHandler.ReadCString方法代码示例

本文整理汇总了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();
        }
开发者ID:SkyFire,项目名称:Kamilla.Wow,代码行数:29,代码来源:SpellCasting.cs

示例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();
        }
开发者ID:CarlosX,项目名称:Kamilla.Wow,代码行数:15,代码来源:LFG.cs

示例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));
        }
开发者ID:CarlosX,项目名称:Kamilla,代码行数:58,代码来源:Pkt31NetworkLog.cs

示例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;
            }
        }
开发者ID:CarlosX,项目名称:Kamilla.Wow,代码行数:96,代码来源:ServerChatMessage.cs


注:本文中的StreamHandler.ReadCString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。