Ejemplo n.º 1
0
 public async Task DownloadAndScheduleProcessFile(string bundleId, string url, string filename)
 {
     bundleRepo.SetBundleStatus(bundleId, BundleStatus.Downloading);
     try {
         using (TempDirectoryHandle tempDir = await downloadService.Download(bundleId, url, filename)) {
             // this class should only do downloading.
             // unf. i could not find a good way to *not* make this call from with DownloadService
             // hangfire supports continuations, but not parameterized. i found no way to pass the result (TempFileHandle) over to the continuation
             await ProcessDirRecursive(bundleId, tempDir.Dir);
         }
         bundleRepo.SetBundleStatus(bundleId, BundleStatus.Finished);
     } catch (Exception e) {
         bundleRepo.SetBundleStatus(bundleId, BundleStatus.Failed, e.ToString());
     }
 }
Ejemplo n.º 2
0
        public async Task DownloadAndScheduleProcessFileAsync(string bundleId, string url, string filename)
        {
            bundleRepo.SetBundleStatus(bundleId, BundleStatus.Downloading);
            try {
                using (TempDirectoryHandle tempDir = await downloadService.Download(bundleId, url, filename)) {
                    if (settings.Value.DuplicationDetectionEnabled && !SetHashAndCheckIfDuplicated(bundleId, new FileInfo(Path.Combine(tempDir.Dir.FullName, filename))))
                    {
                        // duplication detected
                        return;
                    }

                    // this class should only do downloading.
                    // unf. i could not find a good way to *not* make this call from with DownloadService
                    // hangfire supports continuations, but not parameterized. i found no way to pass the result (TempFileHandle) over to the continuation
                    await ProcessDirRecursive(bundleId, tempDir.Dir);
                }
                bundleRepo.SetBundleStatus(bundleId, BundleStatus.Finished);
            } catch (Exception e) {
                bundleRepo.SetBundleStatus(bundleId, BundleStatus.Failed, e.ToString());
            }
        }
Ejemplo n.º 3
0
 public async Task DownloadAndScheduleProcessFileAsync(string bundleId, string url, string filename)
 {
     bundleRepo.SetBundleStatus(bundleId, BundleStatus.Downloading);
     try {
         using (TempFileHandle tempFile = await downloadService.Download(bundleId, url, filename)) {
             await ProcessFileAsync(bundleId, filename, tempFile);
         }
     } catch (Exception e) {
         bundleRepo.SetBundleStatus(bundleId, BundleStatus.Failed, e.ToString());
     }
 }