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);
     }
 }
コード例 #2
0
 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;
     }
 }
コード例 #3
0
 public FileDownloader(Uri uri)
 {
     Context = new FileDownloaderContext(uri);
 }