mirror of
https://github.com/reactos/reactos.git
synced 2025-02-22 16:36:33 +00:00
[RAPPS] Use the provided SizeBytes for the progress,
when the host does not give a file size
This commit is contained in:
parent
bcd301d136
commit
4439b53800
3 changed files with 20 additions and 7 deletions
|
@ -19,7 +19,7 @@
|
|||
|
||||
// CAvailableApplicationInfo
|
||||
CAvailableApplicationInfo::CAvailableApplicationInfo(const ATL::CStringW& sFileNameParam)
|
||||
: m_IsSelected(FALSE), m_LicenseType(LICENSE_NONE), m_sFileName(sFileNameParam),
|
||||
: m_IsSelected(FALSE), m_LicenseType(LICENSE_NONE), m_SizeBytes(0), m_sFileName(sFileNameParam),
|
||||
m_IsInstalled(FALSE), m_HasLanguageInfo(FALSE), m_HasInstalledVersion(FALSE)
|
||||
{
|
||||
RetrieveGeneralInfo();
|
||||
|
@ -154,6 +154,7 @@ VOID CAvailableApplicationInfo::RetrieveSize()
|
|||
return;
|
||||
}
|
||||
|
||||
m_SizeBytes = iSizeBytes;
|
||||
StrFormatByteSizeW(iSizeBytes, m_szSize.GetBuffer(MAX_PATH), MAX_PATH);
|
||||
m_szSize.ReleaseBuffer();
|
||||
}
|
||||
|
|
|
@ -37,6 +37,7 @@ struct CAvailableApplicationInfo
|
|||
ATL::CStringW m_szUrlDownload;
|
||||
ATL::CStringW m_szCDPath;
|
||||
ATL::CSimpleArray<LCID> m_LanguageLCIDs;
|
||||
ULONG m_SizeBytes;
|
||||
|
||||
// Caching mechanism related entries
|
||||
ATL::CStringW m_sFileName;
|
||||
|
|
|
@ -73,13 +73,17 @@ struct DownloadInfo
|
|||
{
|
||||
DownloadInfo() {}
|
||||
DownloadInfo(const CAvailableApplicationInfo& AppInfo)
|
||||
:szUrl(AppInfo.m_szUrlDownload), szName(AppInfo.m_szName), szSHA1(AppInfo.m_szSHA1)
|
||||
: szUrl(AppInfo.m_szUrlDownload)
|
||||
, szName(AppInfo.m_szName)
|
||||
, szSHA1(AppInfo.m_szSHA1)
|
||||
, SizeInBytes(AppInfo.m_SizeBytes)
|
||||
{
|
||||
}
|
||||
|
||||
ATL::CStringW szUrl;
|
||||
ATL::CStringW szName;
|
||||
ATL::CStringW szSHA1;
|
||||
ULONG SizeInBytes;
|
||||
};
|
||||
|
||||
struct DownloadParam
|
||||
|
@ -669,8 +673,7 @@ DWORD WINAPI CDownloadManager::ThreadFunc(LPVOID param)
|
|||
// query content length
|
||||
HttpQueryInfoW(hFile, HTTP_QUERY_CONTENT_LENGTH | HTTP_QUERY_FLAG_NUMBER, &dwContentLen, &dwStatusLen, NULL);
|
||||
}
|
||||
|
||||
if (urlComponents.nScheme == INTERNET_SCHEME_FTP)
|
||||
else if (urlComponents.nScheme == INTERNET_SCHEME_FTP)
|
||||
{
|
||||
// force passive mode on FTP
|
||||
hFile = InternetOpenUrlW(hOpen, InfoArray[iAppId].szUrl.GetString(), NULL, 0,
|
||||
|
@ -686,10 +689,18 @@ DWORD WINAPI CDownloadManager::ThreadFunc(LPVOID param)
|
|||
}
|
||||
|
||||
if (!dwContentLen)
|
||||
{
|
||||
// Someone was nice enough to add this, let's use it
|
||||
if (InfoArray[iAppId].SizeInBytes)
|
||||
{
|
||||
dwContentLen = InfoArray[iAppId].SizeInBytes;
|
||||
}
|
||||
else
|
||||
{
|
||||
// content-length is not known, enable marquee mode
|
||||
ProgressBar.SetMarquee(TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
free(urlComponents.lpszScheme);
|
||||
free(urlComponents.lpszHostName);
|
||||
|
|
Loading…
Reference in a new issue