Exemplo n.º 1
0
 public void SendRSALogin(RSACryptoServiceProvider rsa, string key)
 {
     GSPacketIn pkg = new GSPacketIn((byte)eFightPackageType.LOGIN);
     pkg.Write(rsa.Encrypt(Encoding.UTF8.GetBytes(key), false));
     SendTCP(pkg);
 }
Exemplo n.º 2
0
 internal void SendGameWindPic(byte windId, byte[] windpic)
 {
     GSPacketIn pkg = new GSPacketIn((byte)ePackageType.GAME_CMD);
     pkg.WriteByte((byte)eTankCmdType.WIND_PIC);
     pkg.WriteByte(windId);
     pkg.Write(windpic);
     SendToAll(pkg);
 }
Exemplo n.º 3
0
        /// <summary>
        /// 发送监听端口和IP
        /// </summary>
        /// <param name="ip"></param>
        /// <param name="port"></param>
        public void SendListenIPPort(IPAddress ip, int port)
        {
            GSPacketIn pkg = new GSPacketIn((byte)eChatServerPacket.IP_PORT);
            pkg.Write(ip.GetAddressBytes());
            pkg.WriteInt(port);

            SendTCP(pkg);
        }
Exemplo n.º 4
0
 /// <summary>
 /// 发送RSA密钥
 /// </summary>
 /// <param name="m"></param>
 /// <param name="e"></param>
 public void SendRSAKey(byte[] m, byte[] e)
 {
     GSPacketIn pkg = new GSPacketIn((byte)eFightPackageType.RSAKey);
     pkg.Write(m);
     pkg.Write(e);
     SendTCP(pkg);
 }
Exemplo n.º 5
0
        public void SendCheckCode()
        {
            if (m_gameClient.Player == null || m_gameClient.Player.PlayerCharacter.CheckCount < GameProperties.CHECK_MAX_FAILED_COUNT)
                return;

            if (m_gameClient.Player.PlayerCharacter.CheckError == 0)
            {
                m_gameClient.Player.PlayerCharacter.CheckCount += 10000;
            }

            GSPacketIn pkg = new GSPacketIn((byte)ePackageType.CHECK_CODE, m_gameClient.Player.PlayerCharacter.ID, 10240);
            // pkg.WriteBoolean(true);
            if (m_gameClient.Player.PlayerCharacter.CheckError < 1)
            {
                pkg.WriteByte(0);
            }
            else
            {
                pkg.WriteByte(2);
            }
            pkg.WriteBoolean(true);
            m_gameClient.Player.PlayerCharacter.CheckCode = CheckCode.GenerateCheckCode();
            pkg.Write(CheckCode.CreateImage(m_gameClient.Player.PlayerCharacter.CheckCode));

            //string[] codes = CheckCode.GenerateCheckCode(4);
            //int index = ThreadSafeRandom.NextStatic(codes.Length);
            //m_gameClient.Player.PlayerCharacter.CheckIndex = index + 1;
            //for (int i = 0; i < codes.Length; i++)
            //{
            //    pkg.WriteString(codes[i]);
            //}

            //pkg.Write(CheckCode.CreateCheckCodeImage(codes[index]));
            SendTCP(pkg);
        }