コード例 #1
0
        private void onAuthSessionTokenReq(PacketIn packet)
        {
            PacketOut Out = new PacketOut((byte)Opcodes.SMSG_AuthSessionTokenReply);


            AuthSessionTokenReq.Builder authReq = AuthSessionTokenReq.CreateBuilder();
            authReq.MergeFrom(packet.ToArray());

            string session = Encoding.ASCII.GetString(authReq.SessionToken.ToByteArray());

            Log.Trace(session);

            AuthSessionTokenReply.Builder authReply = AuthSessionTokenReply.CreateBuilder();
            authReply.SetResultCode(AuthSessionTokenReply.Types.ResultCode.RES_SUCCESS);


            Out.Write(authReply.Build().ToByteArray());
            SendTCPCuted(Out);
        }
コード例 #2
0
        public static void CMSG_AuthSessionTokenReq(BaseClient client, PacketIn packet)
        {
            Log.Debug("LServ", "CMSG_AuthSessionTokenReq");
            Client cclient = (Client)client;

            PacketOut Out = new PacketOut((byte)Opcodes.SMSG_AuthSessionTokenReply);


            AuthSessionTokenReq.Builder authReq = AuthSessionTokenReq.CreateBuilder();
            authReq.MergeFrom(packet.ToArray());

            string session = Encoding.ASCII.GetString(authReq.SessionToken.ToByteArray());

            Log.Debug("AuthSession", "session " + session);
            cclient.Username = "";                                  //username is not important anymore in 1.4.8
            cclient.Token    = session;



            AuthSessionTokenReply.Builder authReply = AuthSessionTokenReply.CreateBuilder();
            authReply.SetResultCode(AuthSessionTokenReply.Types.ResultCode.RES_SUCCESS);


            Out.Write(authReply.Build().ToByteArray());

            cclient.SendTCPCuted(Out);


            /*   //TODO: need auth check
             *
             *  if (Result != AuthResult.AUTH_SUCCESS)
             *      cclient.Disconnect();
             *  else
             *  {
             *      cclient.Username = Username;
             *      cclient.Token = Token;
             *  }*/
        }