/// <summary> /// Checks all types in executing assmebly and registers packets. /// </summary> public static void RegisterPackets() { // Load tables LoadTables("Data\\PacketTables.xml"); // Load packets Type[] types = Assembly.GetExecutingAssembly().GetTypes(); foreach (Type type in types) { UltimaPacketAttribute[] attrs = (UltimaPacketAttribute[])type.GetCustomAttributes(typeof(UltimaPacketAttribute), false); if (attrs.Length == 1) { UltimaPacketAttribute ultimaPacket = attrs[0]; if (ultimaPacket.Ids == null || ultimaPacket.Ids.Length == 0) { throw new SpyException("Packet {0} must have at least one ID", type); } PacketTable.RegisterPacket(type, ultimaPacket, 0); } else if (attrs.Length > 1) { throw new SpyException("Class {0} has too many UltimaPacket attributes", type); } } DefaultDefinition = new UltimaPacketDefinition(typeof(UltimaPacket), null); }