Esempio n. 1
0
 private async Task DeleteFeedFolder()
 {
     if (FileSystemOperations.DirectoryExists(FeedFolder))
     {
         await FileSystemOperations.DeleteDirectory(FeedFolder);
     }
 }
Esempio n. 2
0
        public async Task Execute(string url, string destination, string artifactName = null)
        {
            var finalDir = Path.Combine(destination, artifactName ?? Path.GetFileNameWithoutExtension(GetFileName(url)));

            if (FileSystemOperations.DirectoryExists(finalDir))
            {
                Log.Warning("{Url} already downloaded. Skipping download.", url);
                return;
            }

            using (var stream = await downloader.GetStream(url, progress))
            {
                await extractor.Extract(stream, finalDir, progress);
            }
        }
Esempio n. 3
0
        public async Task Execute(string url, string destination)
        {
            if (FileSystemOperations.DirectoryExists(destination))
            {
                Log.Warning("{Url} already downloaded. Skipping download.", url);
                return;
            }

            FileSystemOperations.EnsureDirectoryExists(Path.GetDirectoryName(destination));
            using (var stream = await downloader.GetStream(url, progress))
                using (var file = FileSystemOperations.OpenForWrite(destination))
                {
                    stream.Position = 0;
                    await stream.CopyToAsync(file);
                }
        }