public bool MightHaveImagesFromUrl(string url)
{
try
{
var uri = new Uri(url);
string filename = Path.GetFileName(uri.LocalPath);
if (filename.EndsWith(".jpg") || url.EndsWith(".png") || url.EndsWith(".jpeg") || url.EndsWith(".gif"))
return true;
else
{
var targetHost = uri.DnsSafeHost.ToLower(); //make sure we can compare caseless
switch (targetHost)
{
case "imgur.com":
case "min.us":
case "www.quickmeme.com":
case "i.qkme.me":
case "quickmeme.com":
case "qkme.me":
case "memecrunch.com":
case "flickr.com":
return true;
}
}
}
catch
{
//ignore failure here, we're going to return false anyway
}
return false;
}