bool DownloadManager::GetFileAndVerifyAssociatedSha1(ConfigurationFileActionDownload configuration, wstring file, ProgressStatus progress, void *data) { DownloadInet inetacccess; Sha1Sum sha1_computed(file), sha1_read; wstring url, sha1_url; bool bRslt; for (unsigned index = 0; index < configuration.GetUrls().size(); index++) { url = configuration.GetUrls().at(index); sha1_url = configuration.GetSha1Urls().at(index); bRslt = inetacccess.GetFile((wchar_t *)url.c_str(), (wchar_t *)file.c_str(), progress, data); g_log.Log(L"DownloadManager::GetFileAndVerifyAssociatedSha1 '%s' is %u", (wchar_t *) url.c_str(), (wchar_t *) bRslt); if (bRslt == false) continue; // If cannot get the sha1 file, we cannot verify the download and report it as incorrect if (_getAssociatedFileSha1Sum(sha1_url, (wchar_t *)file.c_str(), sha1_read) == false) continue; sha1_computed.ComputeforFile(); if (sha1_computed == sha1_read) return true; } return false; }
bool DownloadManager::GetFileAndVerifyAssociatedSha1(ConfigurationFileActionDownload configuration, wstring file, Sha1Sum sha1_read, ProgressStatus progress, void *data) { DownloadInet inetacccess; Sha1Sum sha1_computed(file); wstring url; bool bRslt; for (unsigned index = 0; index < configuration.GetUrls().size(); index++) { url = configuration.GetUrls().at(index); bRslt = inetacccess.GetFile((wchar_t *)url.c_str(), (wchar_t *)file.c_str(), progress, data); g_log.Log(L"DownloadManager::GetFileAndVerifyAssociatedSha1 '%s' is %u", (wchar_t *) url.c_str(), (wchar_t *) bRslt); if (bRslt == false) continue; sha1_computed.ComputeforFile(); if (sha1_computed == sha1_read) return true; } return false; }