public static bool Batchcompleted(FileDownloaderContext fileDownloaderContext, string projectId) { try { //Check DB KitsuneKrawlerStats statsDetails = MongoHelper.GetCrawlStatsDetails(projectId); if (statsDetails.StopCrawl) { fileDownloaderContext.Configuration.IsStopDownloadEnabled = true; } return(true); } catch (Exception ex) { return(false); } }
public static IRestResponse Download(KeyValuePair <string, AssetDetails> resourceObject, FileDownloaderContext context) { try { Uri uri = null; string url = resourceObject.Value.LinkUrl; if (String.IsNullOrEmpty(url)) { if (Uri.TryCreate(url, UriKind.Absolute, out uri)) { var result = HttpRequest.HttpRequestWithReadAndWriteTimeOut(uri, context.Configuration.ReadAndWriteTimeOut, context.Configuration.UserAgentString); return(result); } else { throw new Exception("Error Creating Url"); } } else { throw new Exception("uri was null"); } } catch (Exception ex) { throw ex; } }
public FileDownloader(Uri uri) { Context = new FileDownloaderContext(uri); }