コード例 #1
0
        public void ConnectToServer(string userName, string displayName, string passwordHash)
        {
            Login       = userName;
            DisplayName = displayName;

            _entered = false;

            if (ServerConnection.LoggedOn)
            {
                ServerConnection.Disconnect();
            }

            ServerConnection.Login         = userName;
            ServerConnection.DisplayName   = displayName;
            ServerConnection.Password      = passwordHash;
            ServerConnection.ClientVersion = ServerConnection.ProtocolVersion;
            ServerConnection.Register      = false;

            if (ServerConnection.Status != TcpConnectionStatus.Connected)
            {
                string addr;
                int    port;

                ParseAddress(Address, out addr, out port);
                _tryingGlobal   = true;
                _needToTryLocal = !string.IsNullOrEmpty(LocalAddress);

                ServerConnection.Connect(addr, port);
            }
            else
            {
                ServerConnection.Authenticate();
            }
        }