示例#1
0
文件: Connection.cs 项目: Stewa91/123
        public static void HandleConnectionClosing(BattlenetPacket packet)
        {
            var packets = packet.Read <int>(0, 6);

            for (var i = 0; i < packets; ++i)
            {
                packet.ReadFourCC("Command", i);
                packet.Read <uint>("Time", 0, 32, i);
                packet.Read <ushort>("Size", 0, 16, i);
                packet.ReadFourCC("Layer", 0, 16, i);
                packet.Read <ushort>("Offset", 0, 16, i);
            }

            packet.Read <ClosingReason>("Reason", 0, 4);
            packet.ReadByteArray("BadData", 0, 8);

            if (packet.ReadBoolean())
            {
                packet.Read <ushort>("Command", 0, 6);
                if (packet.ReadBoolean())
                {
                    packet.Read <ushort>("Channel", 0, 4);
                }
            }

            packet.Read <uint>("Now", 0, 32);
        }
示例#2
0
文件: WoWRealm.cs 项目: Stewa91/123
        public static void HandleListUpdate(BattlenetPacket packet)
        {
            if (packet.ReadBoolean())
            {
                packet.Read <uint>("Category", 0, 32);
                packet.ReadSingle("Population");
                packet.Read <byte>("StateFlags", 0, 8);
                packet.ReadSkip(19);
                packet.Read <uint>("Type", int.MinValue, 32);
                packet.ReadString("Name", 0, 10);
                if (packet.ReadBoolean())
                {
                    packet.ReadString("Version", 0, 5, "PrivilegedData");
                    packet.Read <uint>("ConfigId", 0, 32, "PrivilegedData");

                    var ip   = packet.ReadBytes(4);
                    var port = packet.ReadBytes(2);

                    Array.Reverse(port);

                    packet.Stream.AddValue("Address", new IPEndPoint(new IPAddress(ip), BitConverter.ToUInt16(port, 0)), "PrivilegedData");
                }

                packet.Read <RealmInfoFlags>("InfoFlags", 0, 8);
            }

            packet.Read <byte>("Region", 0, 8);
            packet.ReadSkip(12);
            packet.Read <byte>("Site", 0, 8);
            packet.Read <uint>("Realm", 0, 32);
        }
示例#3
0
        public static void HandleFieldSpecAnnounce(BattlenetPacket packet)
        {
            _fields.Clear();

            var fields = packet.Read <int>(0, 7);

            for (var i = 0; i < fields; ++i)
            {
                var field = new FieldInfo();

                packet.ReadBoolean("Writable", i, "Spec");
                packet.ReadBoolean("ServerOnly", i, "Spec");
                packet.ReadBoolean("Ephemeral", i, "Spec");
                field.VariableLength = packet.ReadBoolean("Variable", i, "Spec", "Size");
                if (!field.VariableLength)
                {
                    field.FixedLength = packet.Read <ushort>("Fixed", 0, 16, i, "Spec", "Size");
                }

                field.FieldType = packet.Read <PresenceFieldType>("Id", 0, 8, i, "Spec");
                packet.ReadBoolean("ClientOnly", i, "Spec");
                var handle = packet.Read <uint>("Handle", 0, 32, i);

                _fields.Add(handle, field);
            }
        }
示例#4
0
        public static void HandleUpdateNotify(BattlenetPacket packet)
        {
            packet.ReadSkip(6);
            packet.Read<uint>("IdMaster", 0, 32);
            packet.ReadSkip(6);
            var count = packet.Read<int>(0, 4);
            for (var i = 0; i < count; ++i)
                packet.Read<uint>("Handle", 0, 32, "Update", "HandlesCleared", i);

            count = packet.Read<int>(0, 4);
            var varSizes = new Queue<ushort>();
            for (var i = 0; i < count; ++i)
                varSizes.Enqueue(packet.Read<ushort>(0, 16));

            count = packet.Read<int>(0, 4);
            var handles = new List<uint>();
            for (var i = 0; i < count; ++i)
                handles.Add(packet.Read<uint>(0, 32));

            var data = packet.ReadBytes(packet.Read<int>(0, 11));
            HandleUpdateNotifyFields(packet.Stream, handles, data, varSizes);

            if (packet.ReadBoolean())
            {
                packet.Read<uint>("Target", 0, 32, "Level0");
                packet.ReadBoolean("IsLastPacket", "Level0");
            }

            packet.ReadBoolean("ServerOnly");
            packet.Read<byte>("Online", 0, 8);
            packet.Read<uint>("IdLocal", 0, 32);
        }
示例#5
0
 public static void HandleAuthorizedLicenses(BattlenetPacket packet)
 {
     packet.ReadBoolean("Persistent");
     var licenses = packet.Read<int>(0, 9);
     for (var i = 0; i < licenses; ++i)
     {
         if (packet.ReadBoolean())
             packet.Read<int>("Expiration", int.MinValue, 32);
         packet.Read<uint>("Id", 0, 32);
     }
 }
示例#6
0
        public static void HandleResumeResponse(BattlenetPacket packet)
        {
            if (packet.ReadBoolean())
            {
                if (packet.ReadBoolean()) // has module
                {
                    packet.ReadFixedLengthString("Type", 4, "Strings");
                    packet.ReadFourCC("Region", "Strings");
                    var id       = Convert.ToHexString(packet.ReadBytes("ModuleId", 32, "Strings"));
                    var dataSize = packet.Read <int>("Data size", 0, 10);
                    var data     = packet.ReadBytes(dataSize);
                    var module   = new BattlenetModuleHandler(packet);

                    if (!module.HandleData(id, data).HasValue)
                    {
                        packet.Stream.AddValue("Data", data, "Strings");
                    }
                }

                var errorType = packet.Read <byte>(2, 0);
                if (errorType == 1)
                {
                    packet.Read <ushort>("Error", 0, 16);
                    packet.Read <uint>("Failure", 0, 32);
                }
            }
            else
            {
                var modules = packet.Read <byte>(0, 3);
                var module  = new BattlenetModuleHandler(packet);
                for (var i = 0; i < modules; ++i)
                {
                    packet.ReadFixedLengthString("Type", 4, "FinalRequest", i);
                    packet.ReadFourCC("Region", "FinalRequest", i);
                    var id       = Convert.ToHexString(packet.ReadBytes("ModuleId", 32, "FinalRequest", i));
                    var dataSize = packet.Read <int>("Data size", 0, 10, i);
                    var data     = packet.ReadBytes(dataSize);

                    if (!module.HandleData(id, data, i).HasValue)
                    {
                        packet.Stream.AddValue("Data", data, "FinalRequest", i);
                    }
                }

                packet.Read <uint>("PingTimeout", int.MinValue, 32);

                if (packet.ReadBoolean())
                {
                    Connection.ReadRegulatorInfo(packet, "RegulatorRules");
                }
            }
        }
示例#7
0
        public static void HandleAuthorizedLicenses(BattlenetPacket packet)
        {
            packet.ReadBoolean("Persistent");
            var licenses = packet.Read <int>(0, 9);

            for (var i = 0; i < licenses; ++i)
            {
                if (packet.ReadBoolean())
                {
                    packet.Read <int>("Expiration", int.MinValue, 32);
                }
                packet.Read <uint>("Id", 0, 32);
            }
        }
示例#8
0
文件: WoWRealm.cs 项目: Stewa91/123
        public static void HandleJoinResponse(BattlenetPacket packet)
        {
            if (packet.ReadBoolean())
            {
                packet.Read <WowAuthResult>("Failure", 0, 8);
                return;
            }

            packet.Read <uint>("ServerSalt", 0, 32);
            var count = packet.Read <uint>(0, 5);

            for (var i = 0; i < count; ++i)
            {
                var ip   = packet.ReadBytes(4);
                var port = packet.ReadBytes(2);

                Array.Reverse(port);

                packet.Stream.AddValue("Address", new IPEndPoint(new IPAddress(ip), BitConverter.ToUInt16(port, 0)), "v4", i);
            }

            count = packet.Read <uint>(0, 5);
            for (var i = 0; i < count; ++i)
            {
                var ip   = packet.ReadBytes(16);
                var port = packet.ReadBytes(2);

                Array.Reverse(port);

                packet.Stream.AddValue("Address", new IPEndPoint(new IPAddress(ip), BitConverter.ToUInt16(port, 0)), "v6", i);
            }
        }
示例#9
0
 public static void HandlePatch(BattlenetPacket packet)
 {
     packet.ReadFourCC("ProgramId");
     packet.ReadFourCC("Component");
     packet.ReadString("Instructions", 0, 8);
     packet.ReadBoolean("More");
 }
示例#10
0
        public static void HandleJoinResponse(BattlenetPacket packet)
        {
            if (packet.ReadBoolean())
            {
                packet.Read<WowAuthResult>("Failure", 0, 8);
                return;
            }

            packet.Read<uint>("ServerSalt", 0, 32);
            var count = packet.Read<uint>(0, 5);
            for (var i = 0; i < count; ++i)
            {
                var ip = packet.ReadBytes(4);
                var port = packet.ReadBytes(2);

                Array.Reverse(port);

                packet.Stream.AddValue("Address", new IPEndPoint(new IPAddress(ip), BitConverter.ToUInt16(port, 0)), "v4", i);
            }

            count = packet.Read<uint>(0, 5);
            for (var i = 0; i < count; ++i)
            {
                var ip = packet.ReadBytes(16);
                var port = packet.ReadBytes(2);

                Array.Reverse(port);

                packet.Stream.AddValue("Address", new IPEndPoint(new IPAddress(ip), BitConverter.ToUInt16(port, 0)), "v6", i);
            }
        }
示例#11
0
文件: Connection.cs 项目: Stewa91/123
 public static void ReadRegulatorInfo(BattlenetPacket packet, string fieldName)
 {
     if (packet.ReadBoolean())
     {
         packet.Read <uint>("Threshold", 0, 32, fieldName);
         packet.Read <uint>("Rate", 0, 32, fieldName);
     }
 }
示例#12
0
 public static void HandleLogonRequest(BattlenetPacket packet)
 {
     ReadRequestCommon(packet, "Common");
     if (packet.ReadBoolean())
     {
         packet.ReadString("Account", 3, 9);
     }
 }
示例#13
0
 public static void HandleGenerateSingleSignOnTokenRequest2(BattlenetPacket packet)
 {
     packet.Read <uint>("Token", 0, 32);
     if (packet.ReadBoolean())
     {
         packet.ReadFourCC("TargetProgram");
     }
 }
示例#14
0
        public static void HandleLogonRequest3(BattlenetPacket packet)
        {
            ReadRequestCommon(packet, "Common");
            if (packet.ReadBoolean())
                packet.ReadString("Account", 3, 9);

            packet.Read<ulong>("Compatibility", 0, 64);
        }
示例#15
0
        public static void HandleLogonRequest3(BattlenetPacket packet)
        {
            ReadRequestCommon(packet, "Common");
            if (packet.ReadBoolean())
            {
                packet.ReadString("Account", 3, 9);
            }

            packet.Read <ulong>("Compatibility", 0, 64);
        }
示例#16
0
        public static void HandleUpdateNotify(BattlenetPacket packet)
        {
            packet.ReadSkip(6);
            packet.Read <uint>("IdMaster", 0, 32);
            packet.ReadSkip(6);
            var count = packet.Read <int>(0, 4);

            for (var i = 0; i < count; ++i)
            {
                packet.Read <uint>("Handle", 0, 32, "Update", "HandlesCleared", i);
            }

            count = packet.Read <int>(0, 4);
            var varSizes = new Queue <ushort>();

            for (var i = 0; i < count; ++i)
            {
                varSizes.Enqueue(packet.Read <ushort>(0, 16));
            }

            count = packet.Read <int>(0, 4);
            var handles = new List <uint>();

            for (var i = 0; i < count; ++i)
            {
                handles.Add(packet.Read <uint>(0, 32));
            }

            var data = packet.ReadBytes(packet.Read <int>(0, 11));

            HandleUpdateNotifyFields(packet.Stream, handles, data, varSizes);

            if (packet.ReadBoolean())
            {
                packet.Read <uint>("Target", 0, 32, "Level0");
                packet.ReadBoolean("IsLastPacket", "Level0");
            }

            packet.ReadBoolean("ServerOnly");
            packet.Read <byte>("Online", 0, 8);
            packet.Read <uint>("IdLocal", 0, 32);
        }
示例#17
0
 public static void HandleGenerateSingleSignOnTokenResponse2(BattlenetPacket packet)
 {
     packet.Read<uint>("Token", 0, 32);
     if (!packet.ReadBoolean())
     {
         packet.ReadByteArray("SsoToken", 0, 9);
         packet.ReadByteArray("SsoId", 0, 10);
     }
     else
         packet.Read<uint>("Error", 0, 16);
 }
示例#18
0
 public static void HandleGenerateSingleSignOnTokenResponse2(BattlenetPacket packet)
 {
     packet.Read <uint>("Token", 0, 32);
     if (!packet.ReadBoolean())
     {
         packet.ReadByteArray("SsoToken", 0, 9);
         packet.ReadByteArray("SsoId", 0, 10);
     }
     else
     {
         packet.Read <uint>("Error", 0, 16);
     }
 }
示例#19
0
        public static void HandleFieldSpecAnnounce(BattlenetPacket packet)
        {
            _fields.Clear();

            var fields = packet.Read<int>(0, 7);
            for (var i = 0; i < fields; ++i)
            {
                var field = new FieldInfo();

                packet.ReadBoolean("Writable", i, "Spec");
                packet.ReadBoolean("ServerOnly", i, "Spec");
                packet.ReadBoolean("Ephemeral", i, "Spec");
                field.VariableLength = packet.ReadBoolean("Variable", i, "Spec", "Size");
                if (!field.VariableLength)
                    field.FixedLength = packet.Read<ushort>("Fixed", 0, 16, i, "Spec", "Size");

                field.FieldType = packet.Read<PresenceFieldType>("Id", 0, 8, i, "Spec");
                packet.ReadBoolean("ClientOnly", i, "Spec");
                var handle = packet.Read<uint>("Handle", 0, 32, i);

                _fields.Add(handle, field);
            }
        }
示例#20
0
        public static void HandleConnectionClosing(BattlenetPacket packet)
        {
            var packets = packet.Read<int>(0, 6);
            for (var i = 0; i < packets; ++i)
            {
                packet.ReadFourCC("Command", i);
                packet.Read<uint>("Time", 0, 32, i);
                packet.Read<ushort>("Size", 0, 16, i);
                packet.ReadFourCC("Layer", 0, 16, i);
                packet.Read<ushort>("Offset", 0, 16, i);
            }

            packet.Read<ClosingReason>("Reason", 0, 4);
            packet.ReadByteArray("BadData", 0, 8);

            if (packet.ReadBoolean())
            {
                packet.Read<ushort>("Command", 0, 6);
                if (packet.ReadBoolean())
                    packet.Read<ushort>("Channel", 0, 4);
            }

            packet.Read<uint>("Now", 0, 32);
        }
示例#21
0
 public static void HandleGetStreamItemsRequest(BattlenetPacket packet)
 {
     packet.ReadSkip(31);
     packet.Read<uint>("Token", 0, 32);
     packet.Read<uint>("ReferenceTime", int.MinValue, 32);
     packet.Read<StreamDirection>("Direction", 0, 1);
     packet.Read<byte>("MaxItems", 0, 6);
     packet.ReadFourCC("Locale");
     if (packet.ReadBoolean())
     {
         packet.ReadFourCC("ItemName");
         packet.ReadFourCC("Channel");
     }
     else
         packet.Read<ushort>("Index", 0, 16);
 }
示例#22
0
文件: Cache.cs 项目: Stewa91/123
 public static void HandleGetStreamItemsRequest(BattlenetPacket packet)
 {
     packet.ReadSkip(31);
     packet.Read <uint>("Token", 0, 32);
     packet.Read <uint>("ReferenceTime", int.MinValue, 32);
     packet.Read <StreamDirection>("Direction", 0, 1);
     packet.Read <byte>("MaxItems", 0, 6);
     packet.ReadFourCC("Locale");
     if (packet.ReadBoolean())
     {
         packet.ReadFourCC("ItemName");
         packet.ReadFourCC("Channel");
     }
     else
     {
         packet.Read <ushort>("Index", 0, 16);
     }
 }
示例#23
0
        public static void HandleListSubscribeResponse(BattlenetPacket packet)
        {
            if (packet.ReadBoolean())
            {
                packet.Read<WowAuthResult>("Failure", 0, 8);
                return;
            }

            var charNumberCount = packet.Read<int>(0, 7);
            for (var i = 0; i < charNumberCount; ++i)
            {
                packet.Read<byte>("Region", 0, 8, "ToonCountEntry", i);
                packet.ReadSkip(12);
                packet.Read<byte>("Site", 0, 8, "ToonCountEntry", i);
                packet.Read<uint>("Realm", 0, 32, "ToonCountEntry", i);
                packet.Read<short>("Count", 0, 16, "ToonCountEntry", i);
            }
        }
示例#24
0
文件: WoWRealm.cs 项目: Stewa91/123
        public static void HandleListSubscribeResponse(BattlenetPacket packet)
        {
            if (packet.ReadBoolean())
            {
                packet.Read <WowAuthResult>("Failure", 0, 8);
                return;
            }

            var charNumberCount = packet.Read <int>(0, 7);

            for (var i = 0; i < charNumberCount; ++i)
            {
                packet.Read <byte>("Region", 0, 8, "ToonCountEntry", i);
                packet.ReadSkip(12);
                packet.Read <byte>("Site", 0, 8, "ToonCountEntry", i);
                packet.Read <uint>("Realm", 0, 32, "ToonCountEntry", i);
                packet.Read <short>("Count", 0, 16, "ToonCountEntry", i);
            }
        }
示例#25
0
 public static void HandleLogonRequest(BattlenetPacket packet)
 {
     ReadRequestCommon(packet, "Common");
     if (packet.ReadBoolean())
         packet.ReadString("Account", 3, 9);
 }
示例#26
0
文件: Profile.cs 项目: Stewa91/123
        public static void HandleReadRequest(BattlenetPacket packet)
        {
            packet.ReadSkip(21);
            packet.Read <ulong>("Id", 0, 64, "RecordAddress");
            packet.Read <uint>("Label", 0, 32, "RecordAddress");
            packet.Read <uint>("RequestId", 0, 32);
            if (packet.ReadBoolean())
            {
                var profiles = packet.Read <int>(0, 4);
                for (var i = 0; i < profiles; ++i)
                {
                    packet.Read <ulong>("ProfileId", 0, 64, "Specification", "Reader");
                }
            }

            var selection = packet.Read <int>(0, 3);

            switch (selection)
            {
            case 0:
                packet.ReadByteArray("PrefixPath", 0, 6, "All");
                break;

            case 1:
                packet.ReadByteArray("PrefixPath", 0, 6, "Slice");
                if (packet.ReadBoolean())
                {
                    packet.Read <ulong>("SliceStart", long.MinValue, 64, "Slice");
                }
                if (packet.ReadBoolean())
                {
                    packet.Read <ulong>("SliceEnd", long.MinValue, 64, "Slice");
                }
                if (packet.ReadBoolean())
                {
                    packet.Read <uint>("RowLimit", 0, 32, "Slice");
                }
                if (packet.ReadBoolean())
                {
                    packet.ReadBoolean("SingleDepth", "Slice");
                }
                break;

            case 2:
                packet.ReadByteArray("PrefixPath", 0, 6, "Random");
                var indices = packet.Read <int>(0, 7);
                for (var i = 0; i < indices; ++i)
                {
                    packet.Read <ulong>("Index", 0, 64, "Random", "Indices");
                }
                break;

            case 3:
                var paths = packet.Read <int>(0, 5);
                for (var i = 0; i < paths; ++i)
                {
                    packet.ReadByteArray("PrefixPath", 0, 6, "MultiPath", "Paths");
                }
                break;

            case 4:
                packet.ReadByteArray("PrefixPath", 0, 6, "Range");
                if (packet.ReadBoolean())
                {
                    packet.Read <ulong>("RangeStart", long.MinValue, 64, "Range");
                }
                if (packet.ReadBoolean())
                {
                    packet.Read <ulong>("RangeEnd", long.MinValue, 64, "Range");
                }
                if (packet.ReadBoolean())
                {
                    packet.Read <uint>("RowLimit", 0, 32, "Range");
                }
                if (packet.ReadBoolean())
                {
                    packet.ReadBoolean("SingleDepth", "Range");
                }
                break;
            }
        }
示例#27
0
        public static void HandleReadRequest(BattlenetPacket packet)
        {
            packet.ReadSkip(21);
            packet.Read<ulong>("Id", 0, 64, "RecordAddress");
            packet.Read<uint>("Label", 0, 32, "RecordAddress");
            packet.Read<uint>("RequestId", 0, 32);
            if (packet.ReadBoolean())
            {
                var profiles = packet.Read<int>(0, 4);
                for (var i = 0; i < profiles; ++i)
                    packet.Read<ulong>("ProfileId", 0, 64, "Specification", "Reader");
            }

            var selection = packet.Read<int>(0, 3);
            switch (selection)
            {
                case 0:
                    packet.ReadByteArray("PrefixPath", 0, 6, "All");
                    break;
                case 1:
                    packet.ReadByteArray("PrefixPath", 0, 6, "Slice");
                    if (packet.ReadBoolean())
                        packet.Read<ulong>("SliceStart", long.MinValue, 64, "Slice");
                    if (packet.ReadBoolean())
                        packet.Read<ulong>("SliceEnd", long.MinValue, 64, "Slice");
                    if (packet.ReadBoolean())
                        packet.Read<uint>("RowLimit", 0, 32, "Slice");
                    if (packet.ReadBoolean())
                        packet.ReadBoolean("SingleDepth", "Slice");
                    break;
                case 2:
                    packet.ReadByteArray("PrefixPath", 0, 6, "Random");
                    var indices = packet.Read<int>(0, 7);
                    for (var i = 0; i < indices; ++i)
                        packet.Read<ulong>("Index", 0, 64, "Random", "Indices");
                    break;
                case 3:
                    var paths = packet.Read<int>(0, 5);
                    for (var i = 0; i < paths; ++i)
                        packet.ReadByteArray("PrefixPath", 0, 6, "MultiPath", "Paths");
                    break;
                case 4:
                    packet.ReadByteArray("PrefixPath", 0, 6, "Range");
                    if (packet.ReadBoolean())
                        packet.Read<ulong>("RangeStart", long.MinValue, 64, "Range");
                    if (packet.ReadBoolean())
                        packet.Read<ulong>("RangeEnd", long.MinValue, 64, "Range");
                    if (packet.ReadBoolean())
                        packet.Read<uint>("RowLimit", 0, 32, "Range");
                    if (packet.ReadBoolean())
                        packet.ReadBoolean("SingleDepth", "Range");
                    break;
            }
        }
示例#28
0
        public static void HandleListUpdate(BattlenetPacket packet)
        {
            if (packet.ReadBoolean())
            {
                packet.Read<uint>("Category", 0, 32);
                packet.ReadSingle("Population");
                packet.Read<byte>("StateFlags", 0, 8);
                packet.ReadSkip(19);
                packet.Read<uint>("Type", int.MinValue, 32);
                packet.ReadString("Name", 0, 10);
                if (packet.ReadBoolean())
                {
                    packet.ReadString("Version", 0, 5, "PrivilegedData");
                    packet.Read<uint>("ConfigId", 0, 32, "PrivilegedData");

                    var ip = packet.ReadBytes(4);
                    var port = packet.ReadBytes(2);

                    Array.Reverse(port);

                    packet.Stream.AddValue("Address", new IPEndPoint(new IPAddress(ip), BitConverter.ToUInt16(port, 0)), "PrivilegedData");
                }

                packet.Read<RealmInfoFlags>("InfoFlags", 0, 8);
            }

            packet.Read<byte>("Region", 0, 8);
            packet.ReadSkip(12);
            packet.Read<byte>("Site", 0, 8);
            packet.Read<uint>("Realm", 0, 32);
        }
示例#29
0
        public static void HandleLogonResponse3(BattlenetPacket packet)
        {
            if (packet.ReadBoolean())
            {
                if (packet.ReadBoolean()) // has module
                {
                    packet.ReadFixedLengthString("Type", 4, "Strings");
                    packet.ReadFourCC("Region", "Strings");
                    var id       = Utilities.ByteArrayToHexString(packet.ReadBytes("ModuleId", 32, "Strings"));
                    var dataSize = packet.Read <int>("Data size", 0, 10);
                    var data     = packet.ReadBytes(dataSize);
                    var module   = new BattlenetModuleHandler(packet);

                    if (!module.HandleData(id, data).HasValue)
                    {
                        packet.Stream.AddValue("Data", data, "Strings");
                    }
                }

                var errorType = packet.Read <byte>(2, 0);
                if (errorType == 1)
                {
                    packet.Read <ushort>("Error", 0, 16);
                    packet.Read <uint>("Failure", 0, 32);
                }
            }
            else
            {
                var modules = packet.Read <byte>(0, 3);
                var module  = new BattlenetModuleHandler(packet);
                for (var i = 0; i < modules; ++i)
                {
                    packet.ReadFixedLengthString("Type", 4, "FinalRequest", i);
                    packet.ReadFourCC("Region", "FinalRequest", i);
                    var id       = Utilities.ByteArrayToHexString(packet.ReadBytes("ModuleId", 32, "FinalRequest", i));
                    var dataSize = packet.Read <int>("Data size", 0, 10, i);
                    var data     = packet.ReadBytes(dataSize);

                    if (!module.HandleData(id, data, i).HasValue)
                    {
                        packet.Stream.AddValue("Data", data, "FinalRequest", i);
                    }
                }

                packet.Read <uint>("PingTimeout", int.MinValue, 32);

                if (packet.ReadBoolean())
                {
                    Connection.ReadRegulatorInfo(packet, "RegulatorRules");
                }

                packet.ReadString("GivenName", 0, 8);
                packet.ReadString("Surname", 0, 8);

                packet.Read <uint>("AccountId", 0, 32);
                packet.Read <byte>("Region", 0, 8);
                packet.Read <AccountFlags>("Flags", 0, 64);

                packet.Read <byte>("GameAccountRegion", 0, 8);
                packet.ReadString("GameAccountName", 1, 5);
                packet.Read <GameAccountFlags>("GameAccountFlags", 0, 64);

                packet.Read <uint>("LogonFailures", 0, 32);
                if (packet.ReadBoolean())
                {
                    packet.ReadByteArray("Raf", 0, 10);
                }
            }
        }
示例#30
0
 public static void HandlePatch(BattlenetPacket packet)
 {
     packet.ReadFourCC("ProgramId");
     packet.ReadFourCC("Component");
     packet.ReadString("Instructions", 0, 8);
     packet.ReadBoolean("More");
 }
示例#31
0
 public static void HandleGenerateSingleSignOnTokenRequest2(BattlenetPacket packet)
 {
     packet.Read<uint>("Token", 0, 32);
     if (packet.ReadBoolean())
         packet.ReadFourCC("TargetProgram");
 }
示例#32
0
        public static void HandleLogonResponse3(BattlenetPacket packet)
        {
            if (packet.ReadBoolean())
            {
                if (packet.ReadBoolean()) // has module
                {
                    packet.ReadFixedLengthString("Type", 4, "Strings");
                    packet.ReadFourCC("Region", "Strings");
                    var id = Utilities.ByteArrayToHexString(packet.ReadBytes("ModuleId", 32, "Strings"));
                    var dataSize = packet.Read<int>("Data size", 0, 10);
                    var data = packet.ReadBytes(dataSize);
                    var module = new BattlenetModuleHandler(packet);

                    if (!module.HandleData(id, data).HasValue)
                        packet.Stream.AddValue("Data", data, "Strings");
                }

                var errorType = packet.Read<byte>(2, 0);
                if (errorType == 1)
                {
                    packet.Read<ushort>("Error", 0, 16);
                    packet.Read<uint>("Failure", 0, 32);
                }
            }
            else
            {
                var modules = packet.Read<byte>(0, 3);
                var module = new BattlenetModuleHandler(packet);
                for (var i = 0; i < modules; ++i)
                {
                    packet.ReadFixedLengthString("Type", 4, "FinalRequest", i);
                    packet.ReadFourCC("Region", "FinalRequest", i);
                    var id = Utilities.ByteArrayToHexString(packet.ReadBytes("ModuleId", 32, "FinalRequest", i));
                    var dataSize = packet.Read<int>("Data size", 0, 10, i);
                    var data = packet.ReadBytes(dataSize);

                    if (!module.HandleData(id, data, i).HasValue)
                        packet.Stream.AddValue("Data", data, "FinalRequest", i);
                }

                packet.Read<uint>("PingTimeout", int.MinValue, 32);

                if (packet.ReadBoolean())
                    Connection.ReadRegulatorInfo(packet, "RegulatorRules");

                packet.ReadString("GivenName", 0, 8);
                packet.ReadString("Surname", 0, 8);

                packet.Read<uint>("AccountId", 0, 32);
                packet.Read<byte>("Region", 0, 8);
                packet.Read<AccountFlags>("Flags", 0, 64);

                packet.Read<byte>("GameAccountRegion", 0, 8);
                packet.ReadString("GameAccountName", 1, 5);
                packet.Read<GameAccountFlags>("GameAccountFlags", 0, 64);

                packet.Read<uint>("LogonFailures", 0, 32);
                if (packet.ReadBoolean())
                    packet.ReadByteArray("Raf", 0, 10);
            }
        }
示例#33
0
 public static void ReadRegulatorInfo(BattlenetPacket packet, string fieldName)
 {
     if (packet.ReadBoolean())
     {
         packet.Read<uint>("Threshold", 0, 32, fieldName);
         packet.Read<uint>("Rate", 0, 32, fieldName);
     }
 }