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"); } } }
public static void HandleGetStreamItemsResponse(BattlenetPacket packet) { packet.Read<ushort>("Offset", 0, 16); packet.Read<ushort>("TotalNumItems", 0, 16); packet.Read<uint>("Token", 0, 32); var items = packet.Read<byte>(0, 6); for (var i = 0; i < items; ++i) { packet.ReadFixedLengthString("Type", 4, "Items", i); packet.ReadFourCC("Region", "Items", i); packet.ReadBytes("ModuleId", 32, "Items", i); packet.ReadSkip(27); packet.Read<uint>("PublicationTime", 0, 32, "Items", i); } }
public static void HandleGetStreamItemsResponse(BattlenetPacket packet) { packet.Read <ushort>("Offset", 0, 16); packet.Read <ushort>("TotalNumItems", 0, 16); packet.Read <uint>("Token", 0, 32); var items = packet.Read <byte>(0, 6); for (var i = 0; i < items; ++i) { packet.ReadFixedLengthString("Type", 4, "Items", i); packet.ReadFourCC("Region", "Items", i); packet.ReadBytes("ModuleId", 32, "Items", i); packet.ReadSkip(27); packet.Read <uint>("PublicationTime", 0, 32, "Items", i); } }
public static void HandleProofRequest(BattlenetPacket packet) { var modules = packet.Read <byte>(0, 3); var module = new BattlenetModuleHandler(packet); for (var i = 0; i < modules; ++i) { packet.ReadFixedLengthString("Type", 4, i); packet.ReadFourCC("Region", i); var id = Convert.ToHexString(packet.ReadBytes("ModuleId", 32, i)); var dataSize = packet.Read <int>("Data size", 0, 10, i); var data = packet.ReadBytes(dataSize); var result = module.HandleData(id, data, i); if (!result.HasValue) { packet.Stream.AddValue("Data", data, i); } else if (!result.Value) { ModulesWaitingForData.Add(id); } } }
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); } }
public static void HandleProofRequest(BattlenetPacket packet) { var modules = packet.Read<byte>(0, 3); var module = new BattlenetModuleHandler(packet); for (var i = 0; i < modules; ++i) { packet.ReadFixedLengthString("Type", 4, i); packet.ReadFourCC("Region", i); var id = Utilities.ByteArrayToHexString(packet.ReadBytes("ModuleId", 32, i)); var dataSize = packet.Read<int>("Data size", 0, 10, i); var data = packet.ReadBytes(dataSize); var result = module.HandleData(id, data, i); if (!result.HasValue) packet.Stream.AddValue("Data", data, i); else if (!result.Value) ModulesWaitingForData.Add(id); } }
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); } } }