예제 #1
0
        public string Login(IPEndPoint addr, string login, string password)
        {
            var msgError = Connect(addr);

            if (msgError != null)
            {
                return(msgError);
            }

            var logMsg = "Login: "******"Chat " + logMsg);
            My = null;
            var pass = new CryptoProvider().GetHash(password);

            if (!_sessionClient.Login(login, pass, null))
            {
                logMsg = "Login fail: " + _sessionClient.ErrorMessage;
                Loger.Log("Chat " + logMsg);

                return(_sessionClient.ErrorMessage);
            }

            InitConnected();

            _modelUpdateTime.Time  = DateTime.MinValue;
            _modelUpdateTime.Value = 0;
            return(null);
        }
예제 #2
0
        public bool ConnectAndLogin()
        {
            var t = _sessionClient.Connect(Chanel2Server.IP, Chanel2Server.Port);

            if (!t)
            {
                return(false);
            }

            var pass = new CryptoProvider().GetHash(Chanel2Server.Token);

            lock (_sessionClient)
            {
                if (!_sessionClient.Login("Discord", pass))
                {
                    return(false);
                }

                updateClientData();
            }

            return(true);
        }