public PacketBase createPacket(NetworkClient client, ushort typeID, byte[] buffer, int index, int count) { PacketBase packet = null; switch (typeID) { case CS_Initiate.TypeID: packet = new CS_Initiate(typeID, buffer, index, count); break; case CS_Version.TypeID: packet = new CS_Version(typeID, buffer, index, count); break; case CS_ZoneList.TypeID: packet = new CS_ZoneList(typeID, buffer, index, count); break; case CS_AckZoneList.TypeID: packet = new CS_AckZoneList(typeID, buffer, index, count); break; default: //Undefined packet type //TODO: Type 7 packet = new PacketDummy(typeID, buffer, index, count); break; } return(packet); }
/// <summary> /// Called when a client clicks "Refresh Zone List" /// </summary> /// <param name="pkt"></param> /// <param name="client"></param> public static void Handle_CS_ZoneList(CS_ZoneList pkt, DirectoryClient client) { //Update the zone list first.. //Program.server.grabZones(); // Begin sending the zone list packets client.ZoneListToken = pkt.Token; // Send the first packet List <SC_ZoneList> packets = Program.server.ZoneStream.Packets; if (packets.Count != 0) { client.send(packets[0]); } }