From 4e7d46588f4e8a24217f97544406b293b941ef6b Mon Sep 17 00:00:00 2001 From: Cristian Petruta Date: Thu, 27 Jun 2019 21:44:48 -0700 Subject: [PATCH] Show more accurate information about size and count of files to be downloaded. --- src/sync-tool/ContentSync.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/sync-tool/ContentSync.cs b/src/sync-tool/ContentSync.cs index d5715e2..18df0ae 100644 --- a/src/sync-tool/ContentSync.cs +++ b/src/sync-tool/ContentSync.cs @@ -88,8 +88,11 @@ namespace Microsoft.UpdateServices.Tools.UpdateRepo localRepo.RepositoryOperationProgress += LocalRepo_RepositoryOperationProgress; - var totalDownloadSize = updatesToDownload.Sum(u => (u as IUpdateWithFiles).Files.Sum(f => (long)f.Size)); - var totalFilesToDownload = updatesToDownload.Sum(u => (u as IUpdateWithFiles).Files.Count); + var uniqueFiles = updatesToDownload.SelectMany(u => (u as IUpdateWithFiles).Files).GroupBy(f => f.DownloadUrl); + + + var totalDownloadSize = uniqueFiles.Sum(f => (long)f.First().Size); + var totalFilesToDownload = uniqueFiles.Count(); Console.Write($"Downloading {totalDownloadSize} bytes in {totalFilesToDownload} files. Continue? (y/n)"); var response = Console.ReadKey(); if (response.Key == ConsoleKey.Y)