public void ProcessSpecificPacketAsync(object state)
        {
            AsyncPacketProcess packetObject = (AsyncPacketProcess)state;

            try {
                packetObject.result = packetObject.Method(packetObject.ClientView, packetObject.Pack);
            } catch (Exception e) {
                // Make sure that we see any exception caused by the asynchronous operation.
                MainConsole.Instance.ErrorFormat(
                    "[Client]: Caught exception while processing {0} for {1}, {2} {3}",
                    packetObject.Pack, Name, e.Message, e.StackTrace);
            }
        }
        /// <summary>
        ///     Try to process a packet using registered packet handlers
        /// </summary>
        /// <param name="packet"></param>
        /// <returns>True if a handler was found which successfully processed the packet.</returns>
        bool ProcessPacketMethod(Packet packet)
        {
            bool            result = false;
            PacketProcessor pprocessor;

            bool localHandler;

            lock (m_packetHandlers) {
                localHandler = m_packetHandlers.TryGetValue(packet.Type, out pprocessor);
            }
            if (localHandler)
            {
                //there is a local handler for this packet type
                if (pprocessor.Async)
                {
                    object obj = new AsyncPacketProcess(this, pprocessor.method, packet);
                    m_udpServer.FireAndForget(ProcessSpecificPacketAsync, obj);
                    result = true;
                }
                else
                {
                    result = pprocessor.method(this, packet);
                }
                return(result);
            }

            //there is not a local handler so see if there is a Global handler
            PacketMethod method = null;
            bool         found;

            lock (PacketHandlers) {
                found = PacketHandlers.TryGetValue(packet.Type, out method);
            }
            if (found)
            {
                result = method(this, packet);
            }
            return(result);
        }