예제 #1
0
 private bool Download(TumblrBlog blog, string fileLocation, string url)
 {
     Monitor.Enter(blog);
     if (blog.Links.Contains(url))
     {
         Monitor.Exit(blog);
         return(false);
     }
     else
     {
         Monitor.Exit(blog);
         try
         {
             using (var stream = ThrottledStream.ReadFromURLIntoStream(url, (shellService.Settings.Bandwidth / shellService.Settings.ParallelImages), shellService.Settings.TimeOut))
                 ThrottledStream.SaveStreamToDisk(stream, fileLocation);
             return(true);
         }
         catch (Exception)
         {
             return(false);
         }
     }
 }