Example #1
0
        public void ReceiveNetworkPacket(G2ReceivedPacket packet)
        {
            // Search request
            if (packet.Root.Name == NetworkPacket.SearchRequest)
            {
                Searches.ReceiveRequest(packet);
            }

            // Search ack
            else if (packet.Root.Name == NetworkPacket.SearchAck)
            {
                Searches.ReceiveAck(packet);
            }

            // Ping
            else if (packet.Root.Name == NetworkPacket.Ping)
            {
                Receive_Ping(packet);
            }

            // Pong
            else if (packet.Root.Name == NetworkPacket.Pong)
            {
                Receive_Pong(packet);
            }

            // Store
            else if (packet.Root.Name == NetworkPacket.StoreRequest)
            {
                Store.Receive_StoreReq(packet);
            }

            // Proxy request
            else if (packet.Root.Name == NetworkPacket.ProxyRequest)
            {
                Receive_ProxyRequest(packet);
            }

            // Proxy ack
            else if (packet.Root.Name == NetworkPacket.ProxyAck)
            {
                Receive_ProxyAck(packet);
            }

            // Bye
            else if (packet.Root.Name == NetworkPacket.Bye && packet.ReceivedTcp)
            {
                TcpControl.Receive_Bye(packet);
            }

            // Crawl Request
            else if (packet.Root.Name == NetworkPacket.CrawlRequest)
            {
                Receive_CrawlRequest(packet);
            }

            // Crawl Ack
            else if (packet.Root.Name == NetworkPacket.CrawlAck)
            {
                Receive_CrawlAck(packet);
            }

            // unknown packet
            else
            {
                UpdateLog("Exception", "Uknown packet type " + packet.Root.Name.ToString());
            }
        }