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


C# Packet.ReadBytes方法代码示例

本文整理汇总了C#中WowPacketParser.Misc.Packet.ReadBytes方法的典型用法代码示例。如果您正苦于以下问题:C# Packet.ReadBytes方法的具体用法?C# Packet.ReadBytes怎么用?C# Packet.ReadBytes使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在WowPacketParser.Misc.Packet的用法示例。


在下文中一共展示了Packet.ReadBytes方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: HandleAuctionListItems

        public static void HandleAuctionListItems(Packet packet)
        {
            packet.ReadInt32("Offset");
            packet.ReadPackedGuid128("Auctioneer");

            packet.ReadByte("MinLevel");
            packet.ReadByte("MaxLevel");
            packet.ReadInt32("InvType");
            packet.ReadInt32("ItemClass");
            packet.ReadInt32("ItemSubclass");
            packet.ReadInt32("Quality");
            var sort = packet.ReadByte("SortCount");

            packet.ResetBitReader();

            var len = packet.ReadBits(8);
            packet.ReadWoWString("Name", len);

            packet.ReadBit("OnlyUsable");
            packet.ReadBit("ExactMatch");

            var size = packet.ReadInt32("DataSize");
            var data = packet.ReadBytes(size);
            var sorts = new Packet(data, packet.Opcode, packet.Time, packet.Direction, packet.Number, packet.Writer, packet.FileName);
            for (var i = 0; i < sort; ++i)
            {
                sorts.ReadByte("UnkByte1", i);
                sorts.ReadByte("UnkByte2", i);
            }
        }
开发者ID:TrinityCore,项目名称:WowPacketParser,代码行数:30,代码来源:AuctionHandler.cs

示例2: HandleClientWardenData

        public static void HandleClientWardenData(Packet packet)
        {
            var opcode = packet.ReadEnum<WardenClientOpcode>("Warden Client Opcode", TypeCode.Byte);

            switch (opcode)
            {
                case WardenClientOpcode.CheatCheckResults:
                {
                    var length = packet.ReadUInt16("Check Result Length");

                    packet.ReadInt32("Check Result Checksum");

                    var result = packet.ReadBytes(length);
                    packet.WriteLine("Check Results: " + Utilities.ByteArrayToHexString(result));

                    break;
                }
                case WardenClientOpcode.TransformedSeed:
                {
                    var sha1 = packet.ReadBytes(20);
                    packet.WriteLine("SHA1 Seed: " + Utilities.ByteArrayToHexString(sha1));
                    break;
                }
            }
        }
开发者ID:Nihilianth,项目名称:WowPacketParser,代码行数:25,代码来源:WardenHandler.cs

示例3: HandleServerWardenData

        public static void HandleServerWardenData(Packet packet)
        {
            var opcode = packet.ReadEnum<WardenServerOpcode>("Warden Server Opcode", TypeCode.Byte);

            packet.SetPosition(0);

            switch (opcode)
            {
                case WardenServerOpcode.ModuleInfo:
                {
                    packet.ReadByte();
                    packet.ReadBytes("Module MD5", 16);
                    packet.ReadBytes("Module RC4", 16);
                    packet.ReadUInt32("Module Length");
                    break;
                }
                case WardenServerOpcode.ModuleChunk:
                {
                    packet.ReadByte();

                    var length = packet.ReadUInt16("Chunk Length");
                    packet.ReadBytes("Module Chunk", length);
                    break;
                }
                case WardenServerOpcode.CheatChecks:
                {
                    packet.ReadByte();

                    byte length;
                    while ((length = packet.ReadByte()) != 0)
                    {
                        packet.ReadBytes("String", length);
                    }

                    // var rest = (int)(packet.GetLength() - packet.GetPosition());
                    break;
                }
                case WardenServerOpcode.Data:
                {
                    while (packet.CanRead())
                    {
                        packet.ReadByte();

                        var length = packet.ReadUInt16("Data Length");
                        packet.ReadInt32("Data Checksum");
                        packet.ReadBytes("Data", length);
                    }
                    break;
                }
                case WardenServerOpcode.Seed:
                {
                    packet.ReadByte();
                    packet.ReadBytes("Seed", 16);
                    break;
                }
            }
        }
开发者ID:samaelsacred,项目名称:WowPacketParser,代码行数:57,代码来源:WardenHandler.cs

示例4: HandleServerAddonsList

        public static void HandleServerAddonsList(Packet packet)
        {
            // This packet requires _addonCount from CMSG_AUTH_SESSION to be parsed.
            if (_addonCount == -1)
            {
                packet.WriteLine("CMSG_AUTH_SESSION was not received - cannot successfully parse this packet.");
                packet.ReadToEnd();
                return;
            }

            for (var i = 0; i < _addonCount; i++)
            {
                packet.ReadByte("Addon State", i);

                var sendCrc = packet.ReadBoolean("Use CRC", i);

                if (sendCrc)
                {
                    var usePublicKey = packet.ReadBoolean("Use Public Key", i);

                    if (usePublicKey)
                    {
                        var pubKey = packet.ReadChars(256);
                        packet.Write("[{0}] Public Key: ", i);

                        foreach (var t in pubKey)
                            packet.Write(t.ToString(CultureInfo.InvariantCulture));
                    }

                    packet.ReadInt32("Unk Int32", i);
                }

                if (packet.ReadBoolean("Use URL File", i))
                    packet.ReadCString("Addon URL File", i);
            }

            if (ClientVersion.AddedInVersion(ClientVersionBuild.V3_0_8_9464))
            {
                var bannedCount = packet.ReadInt32("Banned Addons Count");

                for (var i = 0; i < bannedCount; i++)
                {
                    packet.ReadInt32("ID", i);

                    var unkStr2 = packet.ReadBytes(16);
                    packet.WriteLine("[{0}] Unk Hash 1: {1}", i, Utilities.ByteArrayToHexString(unkStr2));

                    var unkStr3 = packet.ReadBytes(16);
                    packet.WriteLine("[{0}] Unk Hash 2: {1}", i, Utilities.ByteArrayToHexString(unkStr3));

                    packet.ReadInt32("Unk Int32 3", i);

                    if (ClientVersion.AddedInVersion(ClientVersionBuild.V3_3_3a_11723))
                        packet.ReadInt32("Unk Int32 4", i);
                }
            }
        }
开发者ID:skypeak,项目名称:WowPacketParser_SkyFire,代码行数:57,代码来源:AddonHandler.cs

示例5: HandleServerAddonsList

        public static void HandleServerAddonsList(Packet packet)
        {
            for (var i = 0; i < _addonCount; i++)
            {
                packet.ReadByte("Addon State");

                var sendCrc = packet.ReadBoolean("Use CRC");

                if (sendCrc)
                {
                    var usePublicKey = packet.ReadBoolean("Use Public Key");

                    if (usePublicKey)
                    {
                        var pubKey = packet.ReadChars(256);
                        packet.Writer.Write("Public Key: ");

                        foreach (var t in pubKey)
                            packet.Writer.Write(t);
                    }

                    packet.ReadInt32("Unk Int32");
                }

                var unkByte2 = packet.ReadBoolean("Use URL File");

                if (!unkByte2)
                    continue;

                packet.ReadCString("Addon URL File");
            }

            if (ClientVersion.AddedInVersion(ClientVersionBuild.V3_0_8_9464))
            {
                var bannedCount = packet.ReadInt32("Banned Addons Count");

                for (var i = 0; i < bannedCount; i++)
                {
                    packet.ReadInt32("ID");

                    var unkStr2 = packet.ReadBytes(16);
                    packet.Writer.WriteLine("Unk Hash 1: " + Utilities.ByteArrayToHexString(unkStr2));

                    var unkStr3 = packet.ReadBytes(16);
                    packet.Writer.WriteLine("Unk Hash 2: " + Utilities.ByteArrayToHexString(unkStr3));

                    packet.ReadInt32("Unk Int32 3");

                    if (ClientVersion.AddedInVersion(ClientVersionBuild.V3_3_3a_11723))
                        packet.ReadInt32("Unk Int32 4");
                }
            }
        }
开发者ID:CarlosX,项目名称:WowPacketParser,代码行数:53,代码来源:AddonHandler.cs

示例6: HandleServerAddonInfo

        public static void HandleServerAddonInfo(Packet packet)
        {
            var AddonsCount = packet.ReadBits("Addons Count", 23);
            uint[,] AddonsInfo = new uint[AddonsCount, 4];

            for (var i = 0; i < AddonsCount; ++i)
            {
                AddonsInfo[i, 0] = packet.ReadBit("Use CRC", i);
                AddonsInfo[i, 2] = packet.ReadBit("Has URL", i);
                AddonsInfo[i, 1] = packet.ReadBit("Has Public Key", i);

                if (AddonsInfo[i, 2] == 1)
                    AddonsInfo[i, 3] = packet.ReadBits(8);
                else
                    AddonsInfo[i, 3] = 0;
            }

            var BannedAddonsCount = packet.ReadBits("Banned Addons Count",18);

            for (var i = 0; i < AddonsCount; ++i)
            {
                if (AddonsInfo[i, 1] == 1)
                    packet.ReadBytes(256); // the bytes order isn't 1,2,3,4.. they are mangled.

                if (AddonsInfo[i, 0] == 1)
                {
                    packet.ReadUInt32("CRC Summ", i);
                    packet.ReadByte("Unk Byte1", i);
                }

                packet.ReadByte("Addon State", i);

                if (AddonsInfo[i, 2] == 1 && AddonsInfo[i, 3] > 0)
                    packet.ReadWoWString("URL path", AddonsInfo[i, 3], i);
            }

            for (var i = 0; i < BannedAddonsCount; ++i)
            {
                var NameMD5 = new byte[16];
                var VersionMD5 = new byte[16];

                for (uint j = 0; j < 16; j += 4)
                {
                    Array.Copy(packet.ReadBytes(4), 0, NameMD5, j, 4);
                    Array.Copy(packet.ReadBytes(4), 0, VersionMD5, j, 4);
                }

                packet.ReadUInt32("ID", i);
                packet.ReadUInt32("Timestamp", i);
                packet.ReadUInt32("Banned", i);
            }
        }
开发者ID:Nihilianth,项目名称:WowPacketParser,代码行数:52,代码来源:AddonHandler.cs

示例7: HandleDBReply

        public static void HandleDBReply(Packet packet)
        {
            var type = packet.ReadUInt32E<DB2Hash>("TableHash");
            var entry = packet.ReadInt32("RecordID");
            var timeStamp = packet.ReadUInt32();
            packet.AddValue("Timestamp", Utilities.GetDateTimeFromUnixTime(timeStamp));
            var allow = packet.ReadBit("Allow");

            var size = packet.ReadInt32("Size");
            var data = packet.ReadBytes(size);
            var db2File = new Packet(data, packet.Opcode, packet.Time, packet.Direction, packet.Number, packet.Writer,
                packet.FileName);

            if (entry < 0 || !allow)
            {
                packet.WriteLine("Row {0} has been removed.", -entry);
                HotfixStoreMgr.RemoveRecord(type, entry);
                Storage.AddHotfixData(entry, type, true, timeStamp);
            }
            else
            {
                packet.AddSniffData(StoreNameType.None, entry, type.ToString());
                HotfixStoreMgr.AddRecord(type, entry, db2File);
                Storage.AddHotfixData(entry, type, false, timeStamp);
                db2File.ClosePacket(false);
            }
        }
开发者ID:TrinityCore,项目名称:WowPacketParser,代码行数:27,代码来源:HotfixHandler.cs

示例8: HandleBotDetected

 public static void HandleBotDetected(Packet packet)
 {
     packet.ReadBoolean("Glider 1 Detected");
     packet.ReadBoolean("Glider 2 Detected");
     packet.ReadBoolean("Inner Space Detected");
     packet.ReadBytes(20); // Hash
 }
开发者ID:Nihilianth,项目名称:WowPacketParser,代码行数:7,代码来源:WardenHandler.cs

示例9: HandleVoiceRosterUpdate

        public static void HandleVoiceRosterUpdate(Packet packet)
        {
            packet.ReadGuid("Group GUID");
            packet.ReadInt16("Channel ID");
            packet.ReadByte("Channel Type"); // 0: channel, 2: party
            packet.ReadCString("Channel Name");
            packet.WriteLine("Encryption Key: " + Utilities.ByteArrayToHexString(packet.ReadBytes(16)));
            packet.WriteLine("IP: " + packet.ReadIPAddress());
            packet.ReadInt16("Voice Server Port");

            var count = packet.ReadByte("Player Count");

            packet.ReadGuid("Leader GUID");

            var leaderFlags1 = packet.ReadByte();
            packet.WriteLine("Leader Flags 1: 0x" + leaderFlags1.ToString("X2"));

            var leaderFlags2 = packet.ReadByte();
            packet.WriteLine("Leader Flags 2: 0x" + leaderFlags2.ToString("X2"));

            for (var i = 0; i < count - 1; i++)
            {
                packet.ReadGuid("Player GUID");
                packet.ReadByte("Index");
                var flags1 = packet.ReadByte();
                packet.WriteLine("Flags 1: 0x" + flags1.ToString("X2"));
                var flags2 = packet.ReadByte();
                packet.WriteLine("Flags 2: 0x" + flags2.ToString("X2"));
            }
        }
开发者ID:Nihilianth,项目名称:WowPacketParser,代码行数:30,代码来源:VoiceChatHandler.cs

示例10: HandleVoiceRosterUpdate

        public static void HandleVoiceRosterUpdate(Packet packet)
        {
            packet.ReadGuid("Group GUID");
            packet.ReadInt16("Channel ID");
            packet.ReadByte("Channel Type"); // 0: channel, 2: party
            packet.ReadCString("Channel Name");
            packet.ReadBytes("Encryption Key", 16);
            packet.ReadIPAddress("IP");
            packet.ReadInt16("Voice Server Port");

            var count = packet.ReadByte("Player Count");

            packet.ReadGuid("Leader GUID");

            var leaderFlags1 = packet.ReadByte();
            packet.AddValue("Leader Flags 1", "0x" + leaderFlags1.ToString("X2"));

            var leaderFlags2 = packet.ReadByte();
            packet.AddValue("Leader Flags 2", "0x" + leaderFlags2.ToString("X2"));

            for (var i = 0; i < count - 1; i++)
            {
                packet.ReadGuid("Player GUID");
                packet.ReadByte("Index");
                var flags1 = packet.ReadByte();
                packet.AddValue("Flags 1", "0x" + flags1.ToString("X2"));
                var flags2 = packet.ReadByte();
                packet.AddValue("Flags 2", "0x" + flags2.ToString("X2"));
            }
        }
开发者ID:Oboltys,项目名称:WowPacketParser,代码行数:30,代码来源:VoiceChatHandler.cs

示例11: HandleServerAddonsList

        public static void HandleServerAddonsList(Packet packet)
        {
            // This packet requires _addonCount from CMSG_AUTH_SESSION to be parsed.
            if (_addonCount == -1)
            {
                packet.AddValue("Error", "CMSG_AUTH_SESSION was not received - cannot successfully parse this packet.");
                packet.ReadToEnd();
                return;
            }

            for (var i = 0; i < _addonCount; i++)
            {
                packet.ReadByte("Addon State", i);

                var sendCrc = packet.ReadBool("Use CRC", i);

                if (sendCrc)
                {
                    var usePublicKey = packet.ReadBool("Use Public Key", i);

                    if (usePublicKey)
                        packet.ReadBytes("Name MD5", 256);

                    packet.ReadInt32("Unk Int32", i);
                }

                if (packet.ReadBool("Use URL File", i))
                    packet.ReadCString("Addon URL File", i);
            }

            if (ClientVersion.AddedInVersion(ClientVersionBuild.V3_0_8_9464))
            {
                var bannedCount = packet.ReadInt32("Banned Addons Count");

                for (var i = 0; i < bannedCount; i++)
                {
                    packet.ReadInt32("ID", i);
                    packet.ReadBytes("Name MD5", 16);
                    packet.ReadBytes("Version MD5", 16);
                    packet.ReadTime("Time", i);

                    if (ClientVersion.AddedInVersion(ClientVersionBuild.V3_3_3a_11723))
                        packet.ReadInt32("Is banned", i);
                }
            }
        }
开发者ID:cyberbrest,项目名称:WowPacketParser,代码行数:46,代码来源:AddonHandler.cs

示例12: HandleServerWardenData

        public static void HandleServerWardenData(Packet packet)
        {
            var Size = packet.ReadInt32();
            byte[] WardenDataBuffer = packet.ReadBytes(Size);

            Packet WardenData = new Packet(WardenDataBuffer, packet.Opcode, packet.Time, packet.Direction, packet.Number, packet.Writer, packet.FileName);

            CoreParsers.WardenHandler.HandleServerWardenData(WardenData);
        }
开发者ID:Nihilianth,项目名称:WowPacketParser,代码行数:9,代码来源:WardenHandler.cs

示例13: HandleClientWardenData547

        public static void HandleClientWardenData547(Packet packet)
        {
            var Size = packet.ReadInt32();
            byte[] WardenDataBuffer = packet.ReadBytes(Size);

            Packet WardenData = new Packet(WardenDataBuffer, packet.Opcode, packet.Time, packet.Direction, packet.Number, packet.Writer, packet.FileName);

            HandleClientWardenData(WardenData);
        }
开发者ID:Walkum,项目名称:WowPacketParser_Skyfire,代码行数:9,代码来源:WardenHandler.cs

示例14: HandleAuthSession434

        public static void HandleAuthSession434(Packet packet)
        {
            var sha = new byte[20];
            packet.ReadUInt32("UInt32 1");
            packet.ReadUInt32("UInt32 2");
            packet.ReadByte("Unk Byte");
            sha[10] = packet.ReadByte();
            sha[18] = packet.ReadByte();
            sha[12] = packet.ReadByte();
            sha[5] = packet.ReadByte();
            packet.ReadInt64("Int64");
            sha[15] = packet.ReadByte();
            sha[9] = packet.ReadByte();
            sha[19] = packet.ReadByte();
            sha[4] = packet.ReadByte();
            sha[7] = packet.ReadByte();
            sha[16] = packet.ReadByte();
            sha[3] = packet.ReadByte();
            packet.ReadEnum<ClientVersionBuild>("Client Build", TypeCode.Int16);
            sha[8] = packet.ReadByte();
            packet.ReadUInt32("UInt32 3");
            packet.ReadByte("Unk Byte");
            sha[17] = packet.ReadByte();
            sha[6] = packet.ReadByte();
            sha[0] = packet.ReadByte();
            sha[1] = packet.ReadByte();
            sha[11] = packet.ReadByte();
            packet.ReadUInt32("Client seed");
            sha[2] = packet.ReadByte();
            packet.ReadUInt32("UInt32 4");
            sha[14] = packet.ReadByte();
            sha[13] = packet.ReadByte();

            using (var addons = new Packet(packet.ReadBytes(packet.ReadInt32()), packet.Opcode, packet.Time, packet.Direction, packet.Number, packet.Writer, packet.FileName))
            {
                var pkt2 = addons;
                CoreParsers.AddonHandler.ReadClientAddonsList(ref pkt2);
            }

            packet.ReadBit("Unk bit");
            var size = (int)packet.ReadBits(12);
            packet.WriteLine("Account name: {0}", Encoding.UTF8.GetString(packet.ReadBytes(size)));
            packet.WriteLine("Proof SHA-1 Hash: " + Utilities.ByteArrayToHexString(sha));
        }
开发者ID:Nihilianth,项目名称:WowPacketParser,代码行数:44,代码来源:SessionHandler.cs

示例15: HandleServerAddonsList

        public static void HandleServerAddonsList(Packet packet)
        {
            var bits20 = (int)packet.ReadBits(23);

            var bit3 = new bool[bits20];
            var usePublicKey = new bool[bits20];
            var bits0 = new uint[bits20];
            var bit1 = new bool[bits20];

            for (var i = 0; i < bits20; i++)
            {
                bit3[i] = packet.ReadBit();
                usePublicKey[i] = packet.ReadBit();

                if (bit3[i])
                    bits0[i] = packet.ReadBits(8);

                bit1[i] = packet.ReadBit();
            }

            var bits10 = (int)packet.ReadBits(18);

            for (var i = 0; i < bits20; i++)
            {
                if (bit3[i])
                    packet.ReadWoWString("Addon URL File", bits0[i], i);

                if (usePublicKey[i])
                {
                    var pubKey = packet.ReadBytes(256);
                    packet.WriteLine("[{0}] Name MD5: {1}", i, Utilities.ByteArrayToHexString(pubKey));
                }

                if (bit1[i])
                {
                    packet.ReadByte("Byte24", i);
                    packet.ReadInt32("Int24", i);
                }

                packet.ReadByte("Addon State", i);
            }

            for (var i = 0; i < bits10; i++)
            {
                packet.ReadInt32("Int14", i);
                packet.ReadInt32("IntED", i);

                for (var j = 0; j < 4; j++)
                {
                    packet.ReadInt32("IntED", i, j);
                    packet.ReadInt32("Int14", i, j);
                }

                packet.ReadInt32("IntED", i);
            }
        }
开发者ID:usernel,项目名称:WowPacketParser,代码行数:56,代码来源:AddonHandler.cs


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