本文整理汇总了C#中WowPacketParser.Misc.Packet.ClosePacket方法的典型用法代码示例。如果您正苦于以下问题:C# Packet.ClosePacket方法的具体用法?C# Packet.ClosePacket怎么用?C# Packet.ClosePacket使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WowPacketParser.Misc.Packet
的用法示例。
在下文中一共展示了Packet.ClosePacket方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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);
}
}
示例2: HandleAuthSession
public static void HandleAuthSession(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.ReadInt16E<ClientVersionBuild>("Client Build");
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();
var addons = new Packet(packet.ReadBytes(packet.ReadInt32()), packet.Opcode, packet.Time, packet.Direction,
packet.Number, packet.Writer, packet.FileName);
CoreParsers.AddonHandler.ReadClientAddonsList(addons);
addons.ClosePacket(false);
packet.ReadBit("Unk bit");
var size = (int)packet.ReadBits(12);
packet.ReadBytesString("Account name", size);
packet.AddValue("Proof SHA-1 Hash", Utilities.ByteArrayToHexString(sha));
}
示例3: TestAsHex
public void TestAsHex()
{
var bytes = new byte[] {0xB, 0xA, 0xD, 0xC, 0x0, 0xD, 0xE, 66, 65, 68, 67, 79, 68, 69, 0, 0, 0x42};
var packet = new Packet(bytes, 1, new DateTime(2012, 1, 1), Direction.ClientToServer, 1, "Test");
packet.AsHex();
var actual = packet.Writer.ToString();
var expected =
"|-------------------------------------------------|---------------------------------|" + Environment.NewLine +
"| 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F | 0 1 2 3 4 5 6 7 8 9 A B C D E F |" + Environment.NewLine +
"|-------------------------------------------------|---------------------------------|" + Environment.NewLine +
"| 0B 0A 0D 0C 00 0D 0E 42 41 44 43 4F 44 45 00 00 | . . . . . . . B A D C O D E . . |" + Environment.NewLine +
"| 42 | B |" + Environment.NewLine +
"|-------------------------------------------------|---------------------------------|" + Environment.NewLine;
Assert.AreEqual(expected, actual);
packet.ClosePacket();
}
示例4: TestAddByStatus
public void TestAddByStatus()
{
var packet1 = new Packet(new byte[] { 1, 2 }, 1, DateTime.Now, Direction.ClientToServer, 1, "test.bin");
var packet2 = new Packet(new byte[] { 1, 2 }, 1, DateTime.Now, Direction.ClientToServer, 2, "test.bin");
var packet3 = new Packet(new byte[] { 1, 2 }, 1, DateTime.Now, Direction.ClientToServer, 3, "test.bin");
packet1.Status = ParsedStatus.Success;
packet2.Status = ParsedStatus.NotParsed;
var stats = new Statistics();
stats.AddByStatus(packet1.Status);
stats.AddByStatus(packet2.Status);
stats.AddByStatus(packet3.Status);
packet1.ClosePacket();
packet2.ClosePacket();
packet3.ClosePacket();
Assert.AreEqual(1, stats.SucessPacketCount);
Assert.AreEqual(0, stats.WithErrorsPacketCount);
Assert.AreEqual(1, stats.NotParsedPacketCount);
Assert.AreEqual(2, stats.CalculatedTotalPacketCount);
}
示例5: HandleNpcTextUpdate
public static void HandleNpcTextUpdate(Packet packet)
{
var npcText = new NpcTextMop();
var size = packet.ReadInt32("Size");
var data = packet.ReadBytes(size);
var pkt = new Packet(data, packet.Opcode, packet.Time, packet.Direction, packet.Number, packet.Writer, packet.FileName);
npcText.Probabilities = new float[8];
npcText.BroadcastTextId = new uint[8];
for (var i = 0; i < 8; ++i)
npcText.Probabilities[i] = pkt.ReadSingle("Probability", i);
for (var i = 0; i < 8; ++i)
npcText.BroadcastTextId[i] = pkt.ReadUInt32("Broadcast Text Id", i);
pkt.ClosePacket(false);
var entry = packet.ReadEntry("Entry");
if (entry.Value) // Can be masked
return;
var hasData = packet.ReadBit();
if (!hasData)
return; // nothing to do
packet.AddSniffData(StoreNameType.NpcText, entry.Key, "QUERY_RESPONSE");
Storage.NpcTextsMop.Add((uint)entry.Key, npcText, packet.TimeSpan);
}
示例6: HandleDBReply
//.........这里部分代码省略.........
item.AreaID = db2File.ReadUInt32<AreaId>("Area");
item.MapID = db2File.ReadInt32<MapId>("Map ID");
item.TotemCategory = db2File.ReadInt32E<TotemCategory>("Totem Category");
item.ItemSocketColors = new ItemSocketColor?[3];
for (int i = 0; i < 3; i++)
item.ItemSocketColors[i] = db2File.ReadInt32E<ItemSocketColor>("Socket Color", i);
item.SocketContent = new uint?[3];
for (int i = 0; i < 3; i++)
item.SocketContent[i] = db2File.ReadUInt32("Socket Item", i);
item.SocketBonus = db2File.ReadInt32("Socket Bonus");
item.GemProperties = db2File.ReadInt32("Gem Properties");
item.ArmorDamageModifier = db2File.ReadSingle("Armor Damage Modifier");
item.Duration = db2File.ReadUInt32("Duration");
item.ItemLimitCategory = db2File.ReadInt32("Limit Category");
item.HolidayID = db2File.ReadInt32E<Holiday>("Holiday");
item.StatScalingFactor = db2File.ReadSingle("Stat Scaling Factor");
item.CurrencySubstitutionID = db2File.ReadUInt32("Currency Substitution Id");
item.CurrencySubstitutionCount = db2File.ReadUInt32("Currency Substitution Count");
Storage.ObjectNames.Add(new ObjectName {ObjectType = ObjectType.Item, ID = (int)entry, Name = item.Name},
packet.TimeSpan);
packet.AddSniffData(StoreNameType.Item, (int) entry, "DB_REPLY");
break;
}
case DB2Hash.KeyChain:
{
db2File.ReadUInt32("Key Chain Id");
db2File.ReadBytes("Key", 32);
break;
}
case DB2Hash.SceneScript: // lua ftw!
{
db2File.ReadUInt32("Scene Script Id");
if (db2File.ReadUInt16() > 0)
db2File.ReadCString("Name");
if (db2File.ReadUInt16() > 0)
db2File.ReadCString("Script");
db2File.ReadUInt32("Previous Scene Script Part");
db2File.ReadUInt32("Next Scene Script Part");
break;
}
case DB2Hash.Vignette:
{
db2File.ReadUInt32("Vignette Entry");
if (db2File.ReadUInt16() > 0)
db2File.ReadCString("Name");
db2File.ReadUInt32("Icon");
db2File.ReadUInt32("Flag"); // not 100% sure (8 & 32 as values only) - todo verify with more data
db2File.ReadSingle("Unk Float 1");
db2File.ReadSingle("Unk Float 2");
break;
}
case DB2Hash.WbAccessControlList:
{
db2File.ReadUInt32("Id");
if (db2File.ReadUInt16() > 0)
db2File.ReadCString("Address");
db2File.ReadUInt32("Unk MoP 1");
db2File.ReadUInt32("Unk MoP 2");
db2File.ReadUInt32("Unk MoP 3");
db2File.ReadUInt32("Unk MoP 4"); // flags?
break;
}
default:
{
db2File.AddValue("Unknown DB2 file type", string.Format("{0} (0x{0:x})", type));
for (var i = 0;; ++i)
{
if (db2File.Length - 4 >= db2File.Position)
{
var blockVal = db2File.ReadUpdateField();
string key = "Block Value " + i;
string value = blockVal.UInt32Value + "/" + blockVal.SingleValue;
packet.AddValue(key, value);
}
else
{
var left = db2File.Length - db2File.Position;
for (var j = 0; j < left; ++j)
{
string key = "Byte Value " + i;
var value = db2File.ReadByte();
packet.AddValue(key, value);
}
break;
}
}
break;
}
}
db2File.ClosePacket(false);
}
示例7: HandleAuthSession624
public static void HandleAuthSession624(Packet packet)
{
packet.ReadInt16E<ClientVersionBuild>("Build");
packet.ReadByte("BuildType");
packet.ReadUInt32("RegionID");
packet.ReadUInt32("BattlegroupID");
packet.ReadUInt32("RealmID");
packet.ReadBytes("LocalChallenge", 16);
packet.ReadBytes("Digest", 24);
packet.ReadUInt64("DosResponse");
var addonSize = packet.ReadInt32();
if (addonSize > 0)
{
var addons = new Packet(packet.ReadBytes(addonSize), packet.Opcode, packet.Time, packet.Direction,
packet.Number, packet.Writer, packet.FileName);
CoreParsers.AddonHandler.ReadClientAddonsList(addons);
addons.ClosePacket(false);
}
var realmJoinTicketSize = packet.ReadInt32();
packet.ReadBytes("RealmJoinTicket", realmJoinTicketSize);
packet.ReadBit("UseIPv6");
}
示例8: HandleAuthSession
public static void HandleAuthSession(Packet packet)
{
var sha = new byte[20];
packet.ReadUInt32("Grunt ServerId");
packet.ReadInt16E<ClientVersionBuild>("Client Build");
packet.ReadUInt32("Region");
packet.ReadUInt32("Battlegroup");
packet.ReadUInt32("RealmIndex");
packet.ReadByte("Login Server Type");
packet.ReadByte("Unk");
packet.ReadUInt32("Client Seed");
packet.ReadUInt64("DosResponse");
for (uint i = 0; i < 20; ++i)
sha[i] = packet.ReadByte();
var accountNameLength = packet.ReadBits("Account Name Length", 11);
packet.ResetBitReader();
packet.ReadWoWString("Account Name", accountNameLength);
packet.ReadBit("UseIPv6");
var addonSize = packet.ReadInt32("Addons Size");
if (addonSize > 0)
{
var addons = new Packet(packet.ReadBytes(addonSize), packet.Opcode, packet.Time, packet.Direction,
packet.Number, packet.Writer, packet.FileName);
CoreParsers.AddonHandler.ReadClientAddonsList(addons);
addons.ClosePacket(false);
}
packet.AddValue("Proof SHA-1 Hash", Utilities.ByteArrayToHexString(sha));
}
示例9: HandlePartyMemberStats
//.........这里部分代码省略.........
}
if (updateFlags.HasFlag(GroupUpdateFlag548.Auras)) // 0x1000
{
updateFlagPacket.ReadByte("unkByte");
var mask = updateFlagPacket.ReadUInt64("Aura Mask");
var count = updateFlagPacket.ReadInt32("AuraCount");
for (var i = 0; i < count; ++i)
{
if (mask == 0) // bad packet
break;
if ((mask & (1ul << i)) == 0)
continue;
updateFlagPacket.ReadUInt32<SpellId>("Spell Id", i);
var flags = updateFlagPacket.ReadByteE<AuraFlagMoP>("Aura Flags", i);
var unk = updateFlagPacket.ReadUInt32("unk", i);
if (flags.HasFlag(AuraFlagMoP.Scalable))
{
var cnt = updateFlagPacket.ReadByte("Scalings");
for (int j = 0; j < cnt; j++)
updateFlagPacket.ReadSingle("Scale", i, j);
}
}
}
if (updateFlags.HasFlag(GroupUpdateFlag548.PetGuid)) // 0x2000
updateFlagPacket.ReadGuid("Pet GUID");
if (updateFlags.HasFlag(GroupUpdateFlag548.PetName)) // 0x4000
updateFlagPacket.ReadCString("Pet Name");
if (updateFlags.HasFlag(GroupUpdateFlag548.PetModelId)) // 0x8000
updateFlagPacket.ReadInt16("Pet Modelid");
if (updateFlags.HasFlag(GroupUpdateFlag548.PetCurrentHealth)) // 0x10000
updateFlagPacket.ReadInt32("Pet Current Health");
if (updateFlags.HasFlag(GroupUpdateFlag548.PetMaxHealth)) // 0x20000
updateFlagPacket.ReadInt32("Pet Max Health");
if (updateFlags.HasFlag(GroupUpdateFlag548.PetPowerType)) // 0x40000
updateFlagPacket.ReadByteE<PowerType>("Pet Power type");
if (updateFlags.HasFlag(GroupUpdateFlag548.PetCurrentPower)) // 0x80000
updateFlagPacket.ReadInt16("Pet Current Power");
if (updateFlags.HasFlag(GroupUpdateFlag548.PetMaxPower)) // 0x100000
updateFlagPacket.ReadInt16("Pet Max Power");
if (updateFlags.HasFlag(GroupUpdateFlag548.Unk200000)) // 0x200000
updateFlagPacket.ReadInt16("Unk200000");
if (updateFlags.HasFlag(GroupUpdateFlag548.PetAuras)) // 0x400000
{
updateFlagPacket.ReadByte("unkByte");
var mask = updateFlagPacket.ReadUInt64("Aura Mask");
var count = updateFlagPacket.ReadInt32("AuraCount");
for (var i = 0; i < count; ++i)
{
if ((mask & (1ul << i)) == 0)
continue;
updateFlagPacket.ReadUInt32<SpellId>("Spell Id", i);
var flags = updateFlagPacket.ReadByteE<AuraFlagMoP>("Aura Flags", i);
updateFlagPacket.ReadUInt32("unk", i);
if (flags.HasFlag(AuraFlagMoP.Scalable))
{
var cnt = updateFlagPacket.ReadByte("Scalings", i);
for (int j = 0; j < cnt; j++)
updateFlagPacket.ReadSingle("Scale", i, j);
}
}
}
if (updateFlags.HasFlag(GroupUpdateFlag548.VehicleSeat)) // 0x800000
updateFlagPacket.ReadInt32("Vehicle Seat");
if (updateFlags.HasFlag(GroupUpdateFlag548.Phase)) // 0x1000000
{
updateFlagPacket.ReadInt32("Unk Int32");
var count = updateFlagPacket.ReadBits("Phase Count", 23);
for (var i = 0; i < count; ++i)
updateFlagPacket.ReadUInt16("Phase Id");
}
if (updateFlags.HasFlag(GroupUpdateFlag548.Unk2000000)) // 0x2000000
updateFlagPacket.ReadInt16("Unk2000000");
if (updateFlags.HasFlag(GroupUpdateFlag548.Unk4000000)) // 0x4000000
updateFlagPacket.ReadInt32("Unk4000000");
updateFlagPacket.ClosePacket(false);
}
示例10: HandleDBReply
public static void HandleDBReply(Packet packet)
{
var entry = packet.ReadInt32("Entry");
var type = packet.ReadUInt32E<DB2Hash>("DB2 File");
packet.ReadTime("Hotfix date");
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)
{
packet.WriteLine("Row {0} has been removed.", -entry);
HotfixStoreMgr.RemoveRecord(type, entry);
}
else
{
packet.AddSniffData(StoreNameType.None, entry, type.ToString());
HotfixStoreMgr.AddRecord(type, entry, db2File);
db2File.ClosePacket(false);
}
}
示例11: HandleDBReply
//.........这里部分代码省略.........
item.TriggeredSpellCharges = new int[5];
for (var i = 0; i < 5; i++)
item.TriggeredSpellCharges[i] = db2File.ReadInt32("Triggered Spell Charges", i);
item.TriggeredSpellCooldowns = new int[5];
for (var i = 0; i < 5; i++)
item.TriggeredSpellCooldowns[i] = db2File.ReadInt32("Triggered Spell Cooldown", i);
item.TriggeredSpellCategories = new uint[5];
for (var i = 0; i < 5; i++)
item.TriggeredSpellCategories[i] = db2File.ReadUInt32("Triggered Spell Category", i);
item.TriggeredSpellCategoryCooldowns = new int[5];
for (var i = 0; i < 5; i++)
item.TriggeredSpellCategoryCooldowns[i] = db2File.ReadInt32("Triggered Spell Category Cooldown", i);
item.Bonding = db2File.ReadInt32E<ItemBonding>("Bonding");
if (db2File.ReadUInt16() > 0)
item.Name = db2File.ReadCString("Name", 0);
for (var i = 1; i < 4; ++i)
if (db2File.ReadUInt16() > 0)
db2File.ReadCString("Name", i);
if (db2File.ReadUInt16() > 0)
item.Description = db2File.ReadCString("Description");
item.PageText = db2File.ReadUInt32("Page Text");
item.Language = db2File.ReadInt32E<Language>("Language");
item.PageMaterial = db2File.ReadInt32E<PageMaterial>("Page Material");
item.StartQuestId = (uint)db2File.ReadInt32<QuestId>("Start Quest");
item.LockId = db2File.ReadUInt32("Lock ID");
item.Material = db2File.ReadInt32E<Material>("Material");
item.SheathType = db2File.ReadInt32E<SheathType>("Sheath Type");
item.RandomPropery = db2File.ReadInt32("Random Property");
item.RandomSuffix = db2File.ReadUInt32("Random Suffix");
item.ItemSet = db2File.ReadUInt32("Item Set");
item.AreaId = db2File.ReadUInt32<AreaId>("Area");
var map = db2File.ReadInt32<MapId>("Map ID");
item.MapId = map;
item.BagFamily = db2File.ReadInt32E<BagFamilyMask>("Bag Family");
item.TotemCategory = db2File.ReadInt32E<TotemCategory>("Totem Category");
item.ItemSocketColors = new ItemSocketColor[3];
for (var i = 0; i < 3; i++)
item.ItemSocketColors[i] = db2File.ReadInt32E<ItemSocketColor>("Socket Color", i);
item.SocketContent = new uint[3];
for (var i = 0; i < 3; i++)
item.SocketContent[i] = db2File.ReadUInt32("Socket Item", i);
item.SocketBonus = db2File.ReadInt32("Socket Bonus");
item.GemProperties = db2File.ReadInt32("Gem Properties");
item.ArmorDamageModifier = db2File.ReadSingle("Armor Damage Modifier");
item.Duration = db2File.ReadUInt32("Duration");
item.ItemLimitCategory = db2File.ReadInt32("Limit Category");
item.HolidayId = db2File.ReadInt32E<Holiday>("Holiday");
item.StatScalingFactor = db2File.ReadSingle("Stat Scaling Factor");
item.CurrencySubstitutionId = db2File.ReadUInt32("Currency Substitution Id");
item.CurrencySubstitutionCount = db2File.ReadUInt32("Currency Substitution Count");
Storage.ObjectNames.Add(entry, new ObjectName { ObjectType = ObjectType.Item, Name = item.Name }, packet.TimeSpan);
packet.AddSniffData(StoreNameType.Item, (int)entry, "DB_REPLY");
break;
}
case DB2Hash.KeyChain:
{
db2File.ReadUInt32("Key Chain Id");
db2File.ReadBytes("Key", 32);
break;
}
default:
{
db2File.AddValue("Unknown DB2 file type", string.Format(": {0} (0x{0:x})", type));
for (var i = 0; ; ++i)
{
if (db2File.Length - 4 >= db2File.Position)
{
var blockVal = db2File.ReadUpdateField();
string value = blockVal.UInt32Value + "/" + blockVal.SingleValue;
packet.AddValue("Block Value " + i, value);
}
else
{
var left = db2File.Length - db2File.Position;
for (var j = 0; j < left; ++j)
{
var value = db2File.ReadByte();
packet.AddValue("Byte Value " + i, value);
}
break;
}
}
break;
}
}
db2File.ClosePacket(false);
}
示例12: TryRead
public bool TryRead(out Packet packet)
{
try
{
packet = PacketReader.Read(_packetNum, FileName);
if (packet == null)
return false; // continue
if (_packetNum++ == 0)
{
// determine build version based on date of first packet if not specified otherwise
if (ClientVersion.IsUndefined())
ClientVersion.SetVersion(packet.Time);
}
// check for filters
var opcodeName = Opcodes.GetOpcodeName(packet.Opcode, packet.Direction);
var add = true;
if (Settings.Filters.Length > 0)
add = opcodeName.MatchesFilters(Settings.Filters);
// check for ignore filters
if (add && Settings.IgnoreFilters.Length > 0)
add = !opcodeName.MatchesFilters(Settings.IgnoreFilters);
if (add)
{
if (Settings.FilterPacketsNum > 0 && _count++ == Settings.FilterPacketsNum)
return true; // break
return false; // continue
}
packet.ClosePacket();
packet = null;
return false;
}
catch (Exception ex)
{
Trace.WriteLine(ex.Data);
Trace.WriteLine(ex.GetType());
Trace.WriteLine(ex.Message);
Trace.WriteLine(ex.StackTrace);
}
packet = null;
return false;
}
示例13: HandleDBReply
//.........这里部分代码省略.........
(map != 0 ? StoreGetters.GetName(StoreNameType.Map, map) : map + " (No map)"));
item.BagFamily = db2File.ReadEnum<BagFamilyMask>("Bag Family", TypeCode.Int32);
item.TotemCategory = db2File.ReadEnum<TotemCategory>("Totem Category", TypeCode.Int32);
item.ItemSocketColors = new ItemSocketColor[3];
for (var i = 0; i < 3; i++)
item.ItemSocketColors[i] = db2File.ReadEnum<ItemSocketColor>("Socket Color", TypeCode.Int32, i);
item.SocketContent = new uint[3];
for (var i = 0; i < 3; i++)
item.SocketContent[i] = db2File.ReadUInt32("Socket Item", i);
item.SocketBonus = db2File.ReadInt32("Socket Bonus");
item.GemProperties = db2File.ReadInt32("Gem Properties");
item.ArmorDamageModifier = db2File.ReadSingle("Armor Damage Modifier");
item.Duration = db2File.ReadUInt32("Duration");
item.ItemLimitCategory = db2File.ReadInt32("Limit Category");
item.HolidayId = db2File.ReadEnum<Holiday>("Holiday", TypeCode.Int32);
item.StatScalingFactor = db2File.ReadSingle("Stat Scaling Factor");
item.CurrencySubstitutionId = db2File.ReadUInt32("Currency Substitution Id");
item.CurrencySubstitutionCount = db2File.ReadUInt32("Currency Substitution Count");
Storage.ObjectNames.Add(entry, new ObjectName {ObjectType = ObjectType.Item, Name = item.Name},
packet.TimeSpan);
packet.AddSniffData(StoreNameType.Item, (int) entry, "DB_REPLY");
break;
}
case DB2Hash.KeyChain:
{
db2File.ReadUInt32("Key Chain Id");
db2File.WriteLine("Key: {0}", Utilities.ByteArrayToHexString(db2File.ReadBytes(32)));
break;
}
case DB2Hash.SceneScript: // lua ftw!
{
db2File.ReadUInt32("Scene Script Id");
if (db2File.ReadUInt16() > 0)
db2File.ReadCString("Name");
if (db2File.ReadUInt16() > 0)
db2File.ReadCString("Script");
db2File.ReadUInt32("Previous Scene Script Part");
db2File.ReadUInt32("Next Scene Script Part");
break;
}
case DB2Hash.Vignette:
{
db2File.ReadUInt32("Vignette Entry");
if (db2File.ReadUInt16() > 0)
db2File.ReadCString("Name");
db2File.ReadUInt32("Icon");
db2File.ReadUInt32("Flag"); // not 100% sure (8 & 32 as values only) - todo verify with more data
db2File.ReadSingle("Unk Float 1");
db2File.ReadSingle("Unk Float 2");
break;
}
case DB2Hash.WbAccessControlList:
{
db2File.ReadUInt32("Id");
if (db2File.ReadUInt16() > 0)
db2File.ReadCString("Address");
db2File.ReadUInt32("Unk MoP 1");
db2File.ReadUInt32("Unk MoP 2");
db2File.ReadUInt32("Unk MoP 3");
db2File.ReadUInt32("Unk MoP 4"); // flags?
break;
}
default:
{
db2File.WriteLine("Unknown DB2 file type: {0} (0x{0:x})", type);
for (var i = 0;; ++i)
{
if (db2File.Length - 4 >= db2File.Position)
{
var blockVal = db2File.ReadUpdateField();
string key = "Block Value " + i;
string value = blockVal.UInt32Value + "/" + blockVal.SingleValue;
packet.WriteLine(key + ": " + value);
}
else
{
var left = db2File.Length - db2File.Position;
for (var j = 0; j < left; ++j)
{
string key = "Byte Value " + i;
var value = db2File.ReadByte();
packet.WriteLine(key + ": " + value);
}
break;
}
}
break;
}
}
db2File.ClosePacket();
}
示例14: HandleAuthSession505
public static void HandleAuthSession505(Packet packet)
{
var sha = new byte[20];
packet.ReadUInt32("UInt32 2");//18
sha[2] = packet.ReadByte();//24
sha[15] = packet.ReadByte();//37
sha[12] = packet.ReadByte();//34
sha[11] = packet.ReadByte();//33
sha[10] = packet.ReadByte();//32
sha[9] = packet.ReadByte();//31
packet.ReadByte("Unk Byte");//20
packet.ReadUInt32("Client seed");//14
sha[16] = packet.ReadByte();//38
sha[5] = packet.ReadByte();//27
packet.ReadEnum<ClientVersionBuild>("Client Build", TypeCode.Int16);//34
packet.ReadUInt32("UInt32 4");//16
sha[18] = packet.ReadByte();//40
sha[0] = packet.ReadByte();//22
sha[13] = packet.ReadByte();//35
sha[3] = packet.ReadByte();//25
sha[14] = packet.ReadByte();//36
packet.ReadByte("Unk Byte");//21
sha[8] = packet.ReadByte();//30
sha[7] = packet.ReadByte();//29
packet.ReadUInt32("UInt32 3");//15
sha[4] = packet.ReadByte();//26
packet.ReadInt64("Int64");//12,13
sha[17] = packet.ReadByte();//39
sha[19] = packet.ReadByte();//41
packet.ReadUInt32("UInt32 1");//4
sha[6] = packet.ReadByte();//28
sha[1] = packet.ReadByte();//23
var addons = new Packet(packet.ReadBytes(packet.ReadInt32()), packet.Opcode, packet.Time, packet.Direction,
packet.Number, packet.Writer, packet.FileName);
AddonHandler.ReadClientAddonsList(ref addons);
addons.ClosePacket(false);
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));
}
示例15: HandleAuthSession432
public static void HandleAuthSession432(Packet packet)
{
var sha = new byte[20];
packet.ReadInt32("Int32");
sha[12] = packet.ReadByte();
packet.ReadInt32("Int32");
packet.ReadInt32("Int32");
sha[0] = packet.ReadByte();
sha[2] = packet.ReadByte();
sha[18] = packet.ReadByte();
sha[7] = packet.ReadByte();
sha[9] = packet.ReadByte();
sha[19] = packet.ReadByte();
sha[17] = packet.ReadByte();
sha[6] = packet.ReadByte();
sha[11] = packet.ReadByte();
packet.ReadEnum<ClientVersionBuild>("Client Build", TypeCode.Int16);
sha[15] = packet.ReadByte();
packet.ReadInt64("Int64");
packet.ReadByte("Unk Byte");
packet.ReadByte("Unk Byte");
sha[3] = packet.ReadByte();
sha[10] = packet.ReadByte();
packet.ReadUInt32("Client Seed");
sha[16] = packet.ReadByte();
sha[4] = packet.ReadByte();
packet.ReadInt32("Int32");
sha[14] = packet.ReadByte();
sha[8] = packet.ReadByte();
sha[5] = packet.ReadByte();
sha[1] = packet.ReadByte();
sha[13] = packet.ReadByte();
var pkt = new Packet(packet.ReadBytes(packet.ReadInt32()), packet.Opcode, packet.Time, packet.Direction,
packet.Number, packet.Writer, packet.FileName);
AddonHandler.ReadClientAddonsList(ref pkt);
pkt.ClosePacket(false);
var highBits = packet.ReadByte() << 5;
var lowBits = packet.ReadByte() >> 3;
var size = lowBits | highBits;
packet.WriteLine("Size: " + size);
packet.WriteLine("Account name: {0}", Encoding.UTF8.GetString(packet.ReadBytes(size)));
packet.WriteLine("Proof SHA-1 Hash: " + Utilities.ByteArrayToHexString(sha));
}