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::CAvailableApplicationInfo(const ATL::CStringW& sFileNameParam)
|
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)
|
m_IsInstalled(FALSE), m_HasLanguageInfo(FALSE), m_HasInstalledVersion(FALSE)
|
||||||
{
|
{
|
||||||
RetrieveGeneralInfo();
|
RetrieveGeneralInfo();
|
||||||
|
@ -153,7 +153,8 @@ VOID CAvailableApplicationInfo::RetrieveSize()
|
||||||
GetString(L"Size", m_szSize);
|
GetString(L"Size", m_szSize);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_SizeBytes = iSizeBytes;
|
||||||
StrFormatByteSizeW(iSizeBytes, m_szSize.GetBuffer(MAX_PATH), MAX_PATH);
|
StrFormatByteSizeW(iSizeBytes, m_szSize.GetBuffer(MAX_PATH), MAX_PATH);
|
||||||
m_szSize.ReleaseBuffer();
|
m_szSize.ReleaseBuffer();
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,6 +37,7 @@ struct CAvailableApplicationInfo
|
||||||
ATL::CStringW m_szUrlDownload;
|
ATL::CStringW m_szUrlDownload;
|
||||||
ATL::CStringW m_szCDPath;
|
ATL::CStringW m_szCDPath;
|
||||||
ATL::CSimpleArray<LCID> m_LanguageLCIDs;
|
ATL::CSimpleArray<LCID> m_LanguageLCIDs;
|
||||||
|
ULONG m_SizeBytes;
|
||||||
|
|
||||||
// Caching mechanism related entries
|
// Caching mechanism related entries
|
||||||
ATL::CStringW m_sFileName;
|
ATL::CStringW m_sFileName;
|
||||||
|
|
|
@ -73,13 +73,17 @@ struct DownloadInfo
|
||||||
{
|
{
|
||||||
DownloadInfo() {}
|
DownloadInfo() {}
|
||||||
DownloadInfo(const CAvailableApplicationInfo& AppInfo)
|
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 szUrl;
|
||||||
ATL::CStringW szName;
|
ATL::CStringW szName;
|
||||||
ATL::CStringW szSHA1;
|
ATL::CStringW szSHA1;
|
||||||
|
ULONG SizeInBytes;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct DownloadParam
|
struct DownloadParam
|
||||||
|
@ -669,8 +673,7 @@ DWORD WINAPI CDownloadManager::ThreadFunc(LPVOID param)
|
||||||
// query content length
|
// query content length
|
||||||
HttpQueryInfoW(hFile, HTTP_QUERY_CONTENT_LENGTH | HTTP_QUERY_FLAG_NUMBER, &dwContentLen, &dwStatusLen, NULL);
|
HttpQueryInfoW(hFile, HTTP_QUERY_CONTENT_LENGTH | HTTP_QUERY_FLAG_NUMBER, &dwContentLen, &dwStatusLen, NULL);
|
||||||
}
|
}
|
||||||
|
else if (urlComponents.nScheme == INTERNET_SCHEME_FTP)
|
||||||
if (urlComponents.nScheme == INTERNET_SCHEME_FTP)
|
|
||||||
{
|
{
|
||||||
// force passive mode on FTP
|
// force passive mode on FTP
|
||||||
hFile = InternetOpenUrlW(hOpen, InfoArray[iAppId].szUrl.GetString(), NULL, 0,
|
hFile = InternetOpenUrlW(hOpen, InfoArray[iAppId].szUrl.GetString(), NULL, 0,
|
||||||
|
@ -687,8 +690,16 @@ DWORD WINAPI CDownloadManager::ThreadFunc(LPVOID param)
|
||||||
|
|
||||||
if (!dwContentLen)
|
if (!dwContentLen)
|
||||||
{
|
{
|
||||||
// content-length is not known, enable marquee mode
|
// Someone was nice enough to add this, let's use it
|
||||||
ProgressBar.SetMarquee(TRUE);
|
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.lpszScheme);
|
||||||
|
|
Loading…
Reference in a new issue