Exemplo n.º 1
0
        public void Get(string remotename, System.IO.Stream stream)
        {
            var url = JoinUrls(SimpleStorageEndPoint, m_container, Library.Utility.Uri.UrlPathEncode(m_prefix + remotename));

            try
            {
                using (var resp = m_helper.GetResponse(url))
                    using (var rs = AsyncHttpRequest.TrySetTimeout(resp.GetResponseStream()))
                        Library.Utility.Utility.CopyStream(rs, stream);
            }
            catch (WebException wex)
            {
                if (wex.Response is HttpWebResponse && ((HttpWebResponse)wex.Response).StatusCode == HttpStatusCode.NotFound)
                {
                    throw new FileMissingException();
                }
                else
                {
                    throw;
                }
            }
        }