예제 #1
0
        public void Login(string user, string pass, pnCallback cb = null)
        {
            // Logging in is a two step process:
            // First, we must register with the server and get a server challenge
            // Then, we actually login.
            // We will make it easy on the programmer and silently register the client :)
            if (fSrvChg.HasValue || !user.Contains('@'))
                ILogin(user, pass, cb);
            else {
                // Unfortunately, RegisterRequests have no TransID, so we can't save our
                // params using the normal way... So, we must use this ugly HACK.
                fEvilTemporaryHack = new LoginData(user, pass, cb);

                // Back to the regularly scheduled programming
                pnCli2Auth_ClientRegisterRequest req = new pnCli2Auth_ClientRegisterRequest();
                req.fBuildID = fConnHdr.fBuildID;
                lock (fStream) req.Send(fStream);
            }
        }
예제 #2
0
        private void IRegisterClient()
        {
            pnCli2Auth_ClientRegisterRequest req = new pnCli2Auth_ClientRegisterRequest();
            req.Read(fStream);

            // Double check the BuildID
            // This is mostly to ensure some dummy isn't trying to troll us
            // with some unproven netcode that really sucks.
            int? buildID = pngIni.Ini.GetInteger("Client.BuildID");
            if (buildID.HasValue)
                if (buildID != req.fBuildID) {
                    KickOff(ENetError.kNetErrOldBuildId);
                    return;
                }

            pnAuth2Cli_ClientRegisterReply reply = new pnAuth2Cli_ClientRegisterReply();
            reply.fChallenge = fChallenge;
            reply.Send(fStream);
        }