BaconographyWP8.PlatformServices.ImagesService.IsImage C# (CSharp) Method

IsImage() public method

public IsImage ( string url ) : bool
url string
return bool
        public bool IsImage(string url)
        {
            try
            {
                var uri = new Uri(url);

                string filename = Path.GetFileName(uri.LocalPath);

                if (filename.EndsWith(".jpg") || url.EndsWith(".png") || url.EndsWith(".jpeg") || filename.EndsWith(".gif"))
                    return true;
            }
            catch
            {
                //ignore failure here, we're going to return false anyway
            }
            return false;
        }