public void OnMapPong(byte result)
 {
     Packets.Server.CPReturn p1 = new SagaGateway.Packets.Server.CPReturn();
     p1.SetValue(result);
     this.netIO.SendPacket(p1, true);
     //this.netIO.Disconnect();
 }
 public void OnLoginPong()
 {
     Packets.Server.CPReturn p = new SagaGateway.Packets.Server.CPReturn();
     p.SetValue(1);
     this.netIO.SendPacket(p, true);
     //this.netIO.Disconnect();
 }
        public void OnCPCommand(Packets.Client.CP.CPCommand p)
        {
            string command = p.GetCommand();
               Logger.ShowInfo("CP Command received:" + command, null);
               int times = 5;
               switch (command)
               {

               case  "GET_LOGIN_INFO":
                   while (this.LogingSession == null && times > 0)
                   {
                       System.Threading.Thread.Sleep(1000);
                       times--;
                   }
                   if (this.LogingSession == null)
                   {
                       Packets.Server.CPReturn p2 = new SagaGateway.Packets.Server.CPReturn();
                       p2.SetValue(0);
                       try
                       {
                           this.netIO.SendPacket(p2, true);
                       }
                       catch (Exception)
                       { }
                       //this.netIO.Disconnect();
                       return;
                   }
                   if (this.LogingSession.state == ControlPanelLoginSession.SESSION_STATE.LOGIN)
                       this.LogingSession.LoginPing();
                   else
                   {
                       Packets.Server.CPReturn p2 = new SagaGateway.Packets.Server.CPReturn();
                       p2.SetValue(0);
                       this.netIO.SendPacket(p2, true);
                       //this.netIO.Disconnect();
                   }
                   break;
               case "GET_MAP_INFO":
                   while (this.LogingSession == null && times > 0)
                   {
                       System.Threading.Thread.Sleep(1000);
                       times--;
                   }
                   if (this.LogingSession == null)
                   {
                       Packets.Server.CPReturn p2 = new SagaGateway.Packets.Server.CPReturn();
                       p2.SetValue(0);
                       try
                       {
                           this.netIO.SendPacket(p2, true);
                       }
                       catch (Exception)
                       { }
                       //this.netIO.Disconnect();
                       return;
                   }
                   if (this.LogingSession.state == ControlPanelLoginSession.SESSION_STATE.LOGIN)
                       this.LogingSession.MapPing();
                   else
                   {
                       Packets.Server.CPReturn p2 = new SagaGateway.Packets.Server.CPReturn();
                       p2.SetValue(0);
                       this.netIO.SendPacket(p2, true);
                       //this.netIO.Disconnect();
                   }
                   break;
               }
        }
 public void OnMapPong(byte result)
 {
     Packets.Server.CPReturn p1 = new SagaGateway.Packets.Server.CPReturn();
        p1.SetValue(result);
        this.netIO.SendPacket(p1, true);
        //this.netIO.Disconnect();
 }
 public void OnLoginPong()
 {
     Packets.Server.CPReturn p = new SagaGateway.Packets.Server.CPReturn();
        p.SetValue(1);
        this.netIO.SendPacket(p, true);
        //this.netIO.Disconnect();
 }
        public void OnCPCommand(Packets.Client.CP.CPCommand p)
        {
            string command = p.GetCommand();

            Logger.ShowInfo("CP Command received:" + command, null);
            int times = 5;

            switch (command)
            {
            case  "GET_LOGIN_INFO":
                while (this.LogingSession == null && times > 0)
                {
                    System.Threading.Thread.Sleep(1000);
                    times--;
                }
                if (this.LogingSession == null)
                {
                    Packets.Server.CPReturn p2 = new SagaGateway.Packets.Server.CPReturn();
                    p2.SetValue(0);
                    try
                    {
                        this.netIO.SendPacket(p2, true);
                    }
                    catch (Exception)
                    { }
                    //this.netIO.Disconnect();
                    return;
                }
                if (this.LogingSession.state == ControlPanelLoginSession.SESSION_STATE.LOGIN)
                {
                    this.LogingSession.LoginPing();
                }
                else
                {
                    Packets.Server.CPReturn p2 = new SagaGateway.Packets.Server.CPReturn();
                    p2.SetValue(0);
                    this.netIO.SendPacket(p2, true);
                    //this.netIO.Disconnect();
                }
                break;

            case "GET_MAP_INFO":
                while (this.LogingSession == null && times > 0)
                {
                    System.Threading.Thread.Sleep(1000);
                    times--;
                }
                if (this.LogingSession == null)
                {
                    Packets.Server.CPReturn p2 = new SagaGateway.Packets.Server.CPReturn();
                    p2.SetValue(0);
                    try
                    {
                        this.netIO.SendPacket(p2, true);
                    }
                    catch (Exception)
                    { }
                    //this.netIO.Disconnect();
                    return;
                }
                if (this.LogingSession.state == ControlPanelLoginSession.SESSION_STATE.LOGIN)
                {
                    this.LogingSession.MapPing();
                }
                else
                {
                    Packets.Server.CPReturn p2 = new SagaGateway.Packets.Server.CPReturn();
                    p2.SetValue(0);
                    this.netIO.SendPacket(p2, true);
                    //this.netIO.Disconnect();
                }
                break;
            }
        }