Bloom.web.UrlLookup.TryLookupUrl C# (CSharp) Method

TryLookupUrl() private static method

private static TryLookupUrl ( UrlType urlType, string &url ) : bool
urlType UrlType
url string
return bool
        private static bool TryLookupUrl(UrlType urlType, out string url)
        {
            url = null;
            // Once the internet has been found missing, don't bother trying it again for the duration of the program.
            if (!_internetAvailable)
                return false;
            try
            {
                using (var s3Client = new BloomS3Client(null))
                {
                    s3Client.Timeout = TimeSpan.FromMilliseconds(2500.0);
                    s3Client.ReadWriteTimeout = TimeSpan.FromMilliseconds(3000.0);
                    s3Client.MaxErrorRetry = 1;
                    var jsonContent = s3Client.DownloadFile(BloomS3Client.BloomDesktopFiles, kUrlLookupFileName);
                    Urls urls = JsonConvert.DeserializeObject<Urls>(jsonContent);
                    url = urls.GetUrlById(urlType.ToJsonPropertyString());
                    if (!string.IsNullOrWhiteSpace(url))
                        return true;
                    Logger.WriteEvent("Unable to look up URL type " + urlType);
                }
            }
            catch (Exception e)
            {
                _internetAvailable = false;
                Logger.WriteEvent("Exception while attempting look up of URL type " + urlType + ": " + e);
            }
            return false;
        }