Logo Search packages:      
Sourcecode: f-spot version File versions  Download package

Stream FlickrNet::Flickr::DoDownloadPicture ( string  url  )  [inline, private]

Download a picture (or anything else actually).

Parameters:
url 
Returns:

Definition at line 323 of file Flickr.cs.

References HttpTimeout, and Proxy.

Referenced by DownloadPicture().

            {
                  HttpWebRequest req = null;
                  HttpWebResponse res = null;

                  try
                  {
                        req = (HttpWebRequest)HttpWebRequest.Create(url);
                        req.UserAgent = UserAgent;
                        req.Proxy = Proxy;
                        req.Timeout = HttpTimeout;
                        req.KeepAlive = false;
                        res = (HttpWebResponse)req.GetResponse();
                  }
                  catch(WebException ex)
                  {
                        if( ex.Status == WebExceptionStatus.ProtocolError )
                        {
                              HttpWebResponse res2 = (HttpWebResponse)ex.Response;
                              if( res2 != null )
                              {
                                    throw new FlickrException((int)res2.StatusCode, res2.StatusDescription);
                              }
                        }
                        else if( ex.Status == WebExceptionStatus.Timeout )
                        {
                              throw new FlickrException(301, "Request time-out");
                        }
                        throw new FlickrException(9999, "Picture download failed (" + ex.Message + ")");
                  }

                  return res.GetResponseStream();
            }


Generated by  Doxygen 1.6.0   Back to index