Beispiel #1
0
        public void Get(string parameters, string apiversion)
        {
            _disconnect = false;

            string response = GetResponse(parameters, apiversion);

            if (response != string.Empty)
            {
                SuccessParser success = new SuccessParser(response);
                if (!success.Success)
                {
                    //Not logged in
                    if (success.ErrorCode == "10")
                    {
                        response = string.Empty;

                        if (Login())
                        {
                            response = GetResponse(parameters, apiversion);
                            success  = new SuccessParser(response);
                        }
                    }
                    if (success.ErrorCode != string.Empty)
                    {
                        _errorcode = success.ErrorCode;
                        _errormsg  = success.ErrorMessage;
                        _error     = true;
                    }
                }

                if (response != string.Empty)
                {
                    _response = response;
                    _version  = success.Version;
                    if (OnResponse != null)
                    {
                        OnResponse(this, new EventArgs());
                    }
                }
            }
            else
            {
                _errorcode = "1";
                _errormsg  = "Unable to Connect to AIM Server";
            }
        }
Beispiel #2
0
        private bool Login()
        {
            Boolean result = false;
            String  url    = "&method=login&username="******"&password="******"3");

            SuccessParser success = new SuccessParser(response);

            if (success.Success)
            {
                LoginParser login = new LoginParser(response);

                if (login.Success)
                {
                    if (_token != login.Token)
                    {
                        if (OnTokenChanged != null)
                        {
                            OnTokenChanged(this, new EventArgs());
                        }
                    }
                    _token = login.Token;
                    result = true;
                }
            }
            else
            {
                _errorcode = success.ErrorCode;
                _errormsg  = success.ErrorMessage;
                _error     = true;
                if (OnError != null)
                {
                    OnError(this, new EventArgs());
                }
            }

            return(result);
        }