public FotkiService(string user)
        {
            link_service_document += user + "/";

                        request_manager = new RequestManager ();
                        request_manager.RequestProgressChanged +=
                                WhenRequestProgressChanged;
                        try {
                                string service_document =
                                request_manager.GetString (link_service_document);
                                ParseServiceDocument (service_document);
                        } catch (WebException exception) {
                                HttpWebResponse response = (HttpWebResponse) exception.Response;
                                if (response != null) {
                                        HttpStatusCode status_code = response.StatusCode;

                                        string response_text;
                                        using (StreamReader reader = new StreamReader (response.GetResponseStream ())) {
                                                response_text = reader.ReadToEnd ();
                                        }

                                        if (status_code == HttpStatusCode.NotFound)
                                                throw new UserNotFoundException (response_text);
                                }

                                throw new ConnectionFailedException (exception.Message);
                        }
        }
 public FotkiService(string user, string password)
     : this(user)
 {
     request_manager = new RequestManager (user, password);
                 request_manager.RequestProgressChanged +=
                         WhenRequestProgressChanged;
 }
        static void Main(string[] args)
        {
            string link_service_document =
                                "http://api-fotki.yandex.ru/api/users/";
                        RequestManager request_manager = new RequestManager ();

                        foreach (string user in args) {
                                string user_service_document = link_service_document + user + "/";

                                try {
                                        string photo_collection_content;
                                        string service_document =
                                                request_manager.GetString (user_service_document);
                                        string photo_collection_url = GetPhotoCollectionUrl (service_document);
                                        Console.WriteLine ("Photo collection URL: {0}", photo_collection_url);
                                        uint page_cnt = 0;

                                        Console.WriteLine ("Start downloading photo collection from " + user + "...");
                                        DateTime date_start = DateTime.Now;
                                        do {
                                                photo_collection_content = request_manager.GetString (photo_collection_url);
                                                page_cnt++;
                                                //trying to get next page url
                                                Console.Write ("\rDownload {0} page", page_cnt);
                                                photo_collection_url = GetNextPageUrl (photo_collection_content);
                                        } while (!String.IsNullOrEmpty (photo_collection_url));
                                        Console.WriteLine ();
                                        DateTime date_end = DateTime.Now;

                                        TimeSpan time_span = date_end.Subtract (date_start);
                                        Console.WriteLine ("Time of getting {0} pages: {1}", page_cnt, time_span);

                                } catch (WebException exception) {
                                        HttpWebResponse response = (HttpWebResponse) exception.Response;
                                        if (response != null) {
                                                HttpStatusCode status_code = response.StatusCode;

                                                string response_text;
                                                StreamReader reader;
                                                using (reader = new StreamReader (response.GetResponseStream ())) {
                                                        response_text = reader.ReadToEnd ();
                                                }

                                                if (status_code == HttpStatusCode.NotFound)
                                                        throw new UserNotFoundException (response_text);
                                        }

                                        throw new ConnectionFailedException (exception.Message);
                                }

                        }
        }