/// <remarks> /// Updated for client build 15354. /// </remarks> public static WowOpcodes MakeUncompressed(this WowOpcodes opcode) { if (!opcode.IsCompressedOpcode()) { throw new InvalidOperationException(); } return((WowOpcodes)((uint)opcode & 0x7FFF)); }
internal void Analyze(WowOpcodes opcode) { ui_tbError.Text = string.Empty; var builder = new StringBuilder(); builder.AppendLine("Name: " + opcode); builder.AppendFormatLine("Values: {0} 0x{0:X4}", (uint)opcode); builder.AppendLine(Enum.IsDefined(typeof(WowOpcodes), (uint)opcode) ? "Found in enum." : "Not found in enum."); builder.AppendLine(); if (opcode.IsJamOpcode()) builder.AppendFormatLine("JAM opcode: {0} 0x{0:X2}", opcode.CondenseJamOpcode()); if (opcode.IsAuthOpcode()) builder.AppendFormatLine("Auth opcode: {0} 0x{0:X2}", opcode.CondenseAuthOpcode()); else if (opcode.IsRegularOpcode()) { var cond = opcode.CondenseOpcode(); builder.AppendFormatLine("Condensed opcode: {0} 0x{0:X3}", cond); //if (CondensedOpcodes.Storage.ContainsKey(cond)) // builder.AppendLine("Cond Name: " + CondensedOpcodes.Storage[cond]); //else // builder.AppendLine("Cond Name not found."); } var info = OpcodeInfoPlugin.OpcodeInfos.FirstOrDefault(x => x.Opcode == (uint)opcode); if (info != null) { builder.AppendLine(); builder.AppendLine("Opcode Info Found:"); if (info.Index != 0) builder.AppendLine(" Index: " + info.Index); if (info.Constructor != 0) builder.AppendLine(" Constructor: 0x" + info.Constructor.ToString("X6")); if (info.Handler != 0) builder.AppendLine(" Handler: 0x" + info.Handler.ToString("X6")); if (info.Destructor != 0) builder.AppendLine(" Destructor: 0x" + info.Destructor.ToString("X6")); if (!string.IsNullOrEmpty(info.Comment)) builder.AppendLine(" Comment: " + info.Comment); if (info.Senders != null && info.Senders.Length > 0) { builder.AppendLine(" Senders:"); foreach (var sender in info.Senders) { if (string.IsNullOrEmpty(sender.Name)) builder.AppendFormatLine(" Function at 0x{0:X6} (code at 0x{1:X6})", sender.Function, sender.Address); else builder.AppendFormatLine(" '{2}' at 0x{0:X6} (code at 0x{1:X6})", sender.Function, sender.Address, sender.Name); } } } builder.AppendLine(); //string desc = opcode.GetDescription(); //if (desc != string.Empty) //{ // builder.AppendLine(); // builder.Append(desc); //} if (opcode.IsCompressedOpcode()) { builder.AppendLine("Compressed Packet, uncompressed version:"); Analyze(opcode.MakeUncompressed()); builder.AppendLine(ui_tbResult.Text.PadMultiline(2)); } ui_tbResult.Text = builder.ToString(); }
internal void Analyze(WowOpcodes opcode) { ui_tbError.Text = string.Empty; var builder = new StringBuilder(); builder.AppendLine("Name: " + opcode); builder.AppendFormatLine("Values: {0} 0x{0:X4}", (uint)opcode); builder.AppendLine(Enum.IsDefined(typeof(WowOpcodes), (uint)opcode) ? "Found in enum." : "Not found in enum."); builder.AppendLine(); if (opcode.IsJamOpcode()) { builder.AppendFormatLine("JAM opcode: {0} 0x{0:X2}", opcode.CondenseJamOpcode()); } if (opcode.IsAuthOpcode()) { builder.AppendFormatLine("Auth opcode: {0} 0x{0:X2}", opcode.CondenseAuthOpcode()); } else if (opcode.IsRegularOpcode()) { var cond = opcode.CondenseOpcode(); builder.AppendFormatLine("Condensed opcode: {0} 0x{0:X3}", cond); //if (CondensedOpcodes.Storage.ContainsKey(cond)) // builder.AppendLine("Cond Name: " + CondensedOpcodes.Storage[cond]); //else // builder.AppendLine("Cond Name not found."); } var info = OpcodeInfoPlugin.OpcodeInfos.FirstOrDefault(x => x.Opcode == (uint)opcode); if (info != null) { builder.AppendLine(); builder.AppendLine("Opcode Info Found:"); if (info.Index != 0) { builder.AppendLine(" Index: " + info.Index); } if (info.Constructor != 0) { builder.AppendLine(" Constructor: 0x" + info.Constructor.ToString("X6")); } if (info.Handler != 0) { builder.AppendLine(" Handler: 0x" + info.Handler.ToString("X6")); } if (info.Destructor != 0) { builder.AppendLine(" Destructor: 0x" + info.Destructor.ToString("X6")); } if (!string.IsNullOrEmpty(info.Comment)) { builder.AppendLine(" Comment: " + info.Comment); } if (info.Senders != null && info.Senders.Length > 0) { builder.AppendLine(" Senders:"); foreach (var sender in info.Senders) { if (string.IsNullOrEmpty(sender.Name)) { builder.AppendFormatLine(" Function at 0x{0:X6} (code at 0x{1:X6})", sender.Function, sender.Address); } else { builder.AppendFormatLine(" '{2}' at 0x{0:X6} (code at 0x{1:X6})", sender.Function, sender.Address, sender.Name); } } } } builder.AppendLine(); //string desc = opcode.GetDescription(); //if (desc != string.Empty) //{ // builder.AppendLine(); // builder.Append(desc); //} if (opcode.IsCompressedOpcode()) { builder.AppendLine("Compressed Packet, uncompressed version:"); Analyze(opcode.MakeUncompressed()); builder.AppendLine(ui_tbResult.Text.PadMultiline(2)); } ui_tbResult.Text = builder.ToString(); }