Skip to content

Commit

Permalink
Added error handling when downloading and saving images.
Browse files Browse the repository at this point in the history
  • Loading branch information
BlythMeister committed Sep 9, 2014
1 parent 582edf1 commit 91371ed
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions src/BingWallpaper/BingInteractionAndParsing.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,22 @@ internal static void GetBingImages()
foreach (XmlNode xmlNode in xmlNodeList)
{
ConsoleWriter.WriteLine(1, "Image for: '{0}' on {1}-{2} using index {3}", country, xmlNode.SelectSingleNode("startdate").InnerText, xmlNode.SelectSingleNode("enddate").InnerText, currentIndex);
if (DownloadAndSaveImage(xmlNode))
try
{
countryImages++;
if (DownloadAndSaveImage(xmlNode))
{
countryImages++;
}
else
{
countryDuplicateImages++;
}
}
else
catch (Exception ex)
{
countryDuplicateImages++;
ConsoleWriter.WriteLine("There was an error getting image", ex);
}

}

currentIndex += 1;
Expand Down

0 comments on commit 91371ed

Please sign in to comment.