예제 #1
0
        /// <summary>
        /// Called whenever a packet is received from a game client
        /// </summary>
        /// <param name="client"></param>
        /// <param name="stream"></param>
        public void PacketReceived(AuthServer server, PacketStream packet)
        {
            byte[] data = packet.ToArray();
            ConsoleUtils.HexDump(data, "Received from AuthServer");

            // Is it a known packet ID
            if (!PacketsDb.ContainsKey(packet.GetId()))
            {
                ConsoleUtils.ShowWarning("Unknown packet Id: {0}", packet.GetId());
                return;
            }

            // Calls this packet parsing function
            Task.Factory.StartNew(() => { PacketsDb[packet.GetId()].Invoke(server, data); });
        }