Biz.Services.DownloadService.MediaDownload C# (CSharp) Method

MediaDownload() public method

public MediaDownload ( Uri url, string path ) : void
url System.Uri
path string
return void
        public void MediaDownload(Uri url, string path)
        {
            if (url.ToString().EndsWith(".mp4"))
            {
                string f4vRemotePath = url.ToString().Replace(".mp4", ".f4v");
                url = new Uri(f4vRemotePath);
            }

            HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
            try
            {
                using (var responseForMedia = request.GetResponse())
                {
                    using (Stream st = responseForMedia.GetResponseStream())
                    {
                        WriteToFile(st, path);
                    }
                }
            }
            catch (WebException ex)
            {
                Logger.Write(path.ToString() + "\r\n" + ex);
            }
        }