/// <summary>
        /// Авторизация
        /// </summary>

        public String AuthLoginPassword(String username, String password)
        {
            UserName = username;
            PasOrKey = password;

            WebClient client = new WebClient();

            client.Credentials = new NetworkCredential(UserName, PasOrKey);

            String credentials = Convert.ToBase64String(Encoding.ASCII.GetBytes(UserName + ":" + PasOrKey));

            client.Headers[HttpRequestHeader.Authorization] = "Basic " + credentials;

            try
            {
                var response = client.DownloadString(urlFileWithPassword);

                typeAuth = typeAuthorization.LoginAndPassword;

                return(response);
            }
            catch (WebException ex)
            {
                if (ex.Status == WebExceptionStatus.ProtocolError)
                {
                    var response = ex.Response as HttpWebResponse;
                    if (response != null)
                    {
                        return(response.StatusCode.ToString());
                    }
                }

                return(ex.Status.ToString());
            }
        }
        public String AuthLoginKey(String username, String apiKey)
        {
            this.UserName = username;
            this.PasOrKey = apiKey;

            WebClient client = new WebClient();

            try
            {
                var response = client.DownloadString(urlFileWithKey + "?username="******"&api_key=" + PasOrKey);

                typeAuth = typeAuthorization.LoginAndAPiKey;

                return(response);
            }
            catch (WebException ex)
            {
                return(GetHttpStatusCode(ex));
            }
        }