Exemplo n.º 1
0
        public bool GetVersionData(string email)
        {
            string url = _ServerApiProvider.CreateVersionUrl(email,
                                                             CurrentContext.GetInstance().VersionData.CurrentVersion.ToString());

            string response = WebProcessor.MakeGetRequest(url);
            Dictionary <double, int> versionData = _ServerApiProvider.AnalizeVersionResponse(response);

            if (versionData == null)
            {
                return(false);
            }

            CurrentContext.GetInstance().VersionData.NewestVersion = versionData.Keys.First();
            CurrentContext.GetInstance().VersionData.MandatoryUpdate = versionData.Values.First();
            return(true);
        }
Exemplo n.º 2
0
        public LoginState Login(string login, string password)
        {
            if (_ServerApiProvider == null)
            {
                _ServerApiProvider = ServerApiFactory.CreateServerApiProvider();
            }

            CurrentContext.GetInstance().LoginData = LoginDataFactory.CreateLoginData();
            string url      = _ServerApiProvider.CreateLoginUrl(login, password);
            string response = WebProcessor.MakeGetRequest(url);

            LogController.GetInstance().LogData(LogController.
                                                GetInstance().LogFormat.GetNetworkLine(string.Format("server reply \"{0}\"", response)));
            LoginState result = _ServerApiProvider.AnalizeLoginSuccess(response);

            if (result == LoginState.LOGGED)
            {
                CurrentContext.GetInstance().LoginData.Login = login;
                CurrentContext.GetInstance().LoginData.Password = password;
            }
            return(result);
        }