private void DownloadMissingFiles(IEnumerable <string> chunkHashes) { var filesToDownload = _cacheManager.GetFilenamesNotInCache(chunkHashes); if (filesToDownload.Length == 0) { GitBinConsole.WriteLineNoPrefix(" All chunks already present in cache\n"); } else { if (filesToDownload.Length == 1) { GitBinConsole.WriteLineNoPrefix(" Downloading 1 chunk..."); } else { GitBinConsole.WriteLineNoPrefix(" Downloading {0} chunks...", filesToDownload.Length); } for (int i = 0; i < filesToDownload.Length; i++) { using (new RemoteProgressPrinter(i + 1, filesToDownload.Length, _remote)) { var file = filesToDownload[i]; _remote.DownloadFile(_cacheManager.GetPathForFile(file), file); } } } }
private void DownloadFile(string[] filesToDownload, int indexToDownload) { var filename = filesToDownload[indexToDownload]; var fullPath = _cacheManager.GetPathForFile(filename); try { _remote.DownloadFile(fullPath, filename); } catch (ಠ_ಠ) { File.Delete(fullPath); throw; } }