コード例 #1
0
ファイル: SessionAccount.cs プロジェクト: branan/PlasmaDotNet
        private void ILogin()
        {
            pnCli2Auth_AcctLoginRequest req = new pnCli2Auth_AcctLoginRequest();
            req.Read(fStream);

            if (fAcctGuid == Guid.Empty) {
                // This is the first time we need the vault connection,
                // so let's establish it here.
                if (IConnectToVault()) {
                    fVaultCli.AcctLogin(req.fAccount, req.fHash, req.fChallenge, fChallenge,
                        new pnCallback(new pnVaultAcctLoggedIn(IOnAcctLoggedIn), req.fTransID));
                } else {
                    pnAuth2Cli_AcctLoginReply reply = new pnAuth2Cli_AcctLoginReply();
                    reply.fResult = ENetError.kNetErrInternalError;
                    reply.fTransID = req.fTransID;
                    reply.Send(fStream);
                }
            } else {
                // A special kind of stupid... time to get what you deserve.
                KickOff(ENetError.kNetErrDisconnected);
            }
        }
コード例 #2
0
ファイル: AuthClient.cs プロジェクト: Hoikas/PlasmaDotNet
        private void ILogin(string user, string pass, pnCallback cb)
        {
            pnCli2Auth_AcctLoginRequest req = new pnCli2Auth_AcctLoginRequest();
            req.fAccount = user;
            req.fChallenge = BitConverter.ToUInt32(OpenSSL.RNG.Random(4), 0);
            req.fHash = pnHelpers.HashLogin(user, pass, req.fChallenge, fSrvChg.HasValue ? fSrvChg.Value : 0);
            switch (Environment.OSVersion.Platform) {
                case PlatformID.MacOSX:
                    req.fOS = "mac";
                    break;
                case PlatformID.Unix:
                    req.fOS = "nix";
                    break;
                case PlatformID.Win32NT:
                case PlatformID.Win32S:
                case PlatformID.Win32Windows:
                case PlatformID.WinCE:
                    req.fOS = "win";
                    break;
                case PlatformID.Xbox:
                    req.fOS = "xbox";
                    break;
                default:
                    req.fOS = "unknown";
                    break;
            }
            req.fTransID = GetTransID();

            lock (fStream) {
                if (cb != null)
                    fCallbacks.Add(req.fTransID, cb);
                req.Send(fStream);
            }
        }