mirror of
https://github.com/reactos/reactos.git
synced 2025-08-03 17:05:44 +00:00
[RAPPS] Introduce 'SizeBytes' DB entry and use it for display
This will allow us to reduce the DB size a little by avoiding duplication for each and every entry. Original patch by JIRA user "swyter" CORE-10310
This commit is contained in:
parent
da6a46c6ac
commit
627739aed9
6 changed files with 35 additions and 10 deletions
|
@ -38,7 +38,7 @@ VOID CAvailableApplicationInfo::RetrieveGeneralInfo()
|
||||||
{
|
{
|
||||||
m_Parser = new CConfigParser(m_sFileName);
|
m_Parser = new CConfigParser(m_sFileName);
|
||||||
|
|
||||||
m_Category = m_Parser->GetInt(L"Category");
|
m_Parser->GetInt(L"Category", m_Category);
|
||||||
|
|
||||||
if (!GetString(L"Name", m_szName)
|
if (!GetString(L"Name", m_szName)
|
||||||
|| !GetString(L"URLDownload", m_szUrlDownload))
|
|| !GetString(L"URLDownload", m_szUrlDownload))
|
||||||
|
@ -51,15 +51,16 @@ VOID CAvailableApplicationInfo::RetrieveGeneralInfo()
|
||||||
GetString(L"Version", m_szVersion);
|
GetString(L"Version", m_szVersion);
|
||||||
GetString(L"License", m_szLicense);
|
GetString(L"License", m_szLicense);
|
||||||
GetString(L"Description", m_szDesc);
|
GetString(L"Description", m_szDesc);
|
||||||
GetString(L"Size", m_szSize);
|
|
||||||
GetString(L"URLSite", m_szUrlSite);
|
GetString(L"URLSite", m_szUrlSite);
|
||||||
GetString(L"CDPath", m_szCDPath);
|
GetString(L"CDPath", m_szCDPath);
|
||||||
GetString(L"Language", m_szRegName);
|
GetString(L"Language", m_szRegName);
|
||||||
GetString(L"SHA1", m_szSHA1);
|
GetString(L"SHA1", m_szSHA1);
|
||||||
|
|
||||||
|
RetrieveSize();
|
||||||
RetrieveLicenseType();
|
RetrieveLicenseType();
|
||||||
RetrieveLanguages();
|
RetrieveLanguages();
|
||||||
RetrieveInstalledStatus();
|
RetrieveInstalledStatus();
|
||||||
|
|
||||||
if (m_IsInstalled)
|
if (m_IsInstalled)
|
||||||
{
|
{
|
||||||
RetrieveInstalledVersion();
|
RetrieveInstalledVersion();
|
||||||
|
@ -128,7 +129,9 @@ VOID CAvailableApplicationInfo::RetrieveLanguages()
|
||||||
|
|
||||||
VOID CAvailableApplicationInfo::RetrieveLicenseType()
|
VOID CAvailableApplicationInfo::RetrieveLicenseType()
|
||||||
{
|
{
|
||||||
INT IntBuffer = m_Parser->GetInt(L"LicenseType");
|
INT IntBuffer;
|
||||||
|
|
||||||
|
m_Parser->GetInt(L"LicenseType", IntBuffer);
|
||||||
|
|
||||||
if (IsLicenseType(IntBuffer))
|
if (IsLicenseType(IntBuffer))
|
||||||
{
|
{
|
||||||
|
@ -140,6 +143,21 @@ VOID CAvailableApplicationInfo::RetrieveLicenseType()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
VOID CAvailableApplicationInfo::RetrieveSize()
|
||||||
|
{
|
||||||
|
INT iSizeBytes;
|
||||||
|
|
||||||
|
if (!m_Parser->GetInt(L"SizeBytes", iSizeBytes))
|
||||||
|
{
|
||||||
|
// fall back to "Size" string
|
||||||
|
GetString(L"Size", m_szSize);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
StrFormatByteSizeW(iSizeBytes, m_szSize.GetBuffer(MAX_PATH), MAX_PATH);
|
||||||
|
m_szSize.ReleaseBuffer();
|
||||||
|
}
|
||||||
|
|
||||||
BOOL CAvailableApplicationInfo::FindInLanguages(LCID what) const
|
BOOL CAvailableApplicationInfo::FindInLanguages(LCID what) const
|
||||||
{
|
{
|
||||||
if (!m_HasLanguageInfo)
|
if (!m_HasLanguageInfo)
|
||||||
|
|
|
@ -75,6 +75,7 @@ private:
|
||||||
VOID RetrieveInstalledVersion();
|
VOID RetrieveInstalledVersion();
|
||||||
VOID RetrieveLanguages();
|
VOID RetrieveLanguages();
|
||||||
VOID RetrieveLicenseType();
|
VOID RetrieveLicenseType();
|
||||||
|
VOID RetrieveSize();
|
||||||
inline BOOL FindInLanguages(LCID what) const;
|
inline BOOL FindInLanguages(LCID what) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -41,6 +41,6 @@ class CConfigParser
|
||||||
public:
|
public:
|
||||||
CConfigParser(const ATL::CStringW& FileName = "");
|
CConfigParser(const ATL::CStringW& FileName = "");
|
||||||
|
|
||||||
UINT GetString(const ATL::CStringW& KeyName, ATL::CStringW& ResultString);
|
BOOL GetString(const ATL::CStringW& KeyName, ATL::CStringW& ResultString);
|
||||||
UINT GetInt(const ATL::CStringW& KeyName);
|
BOOL GetInt(const ATL::CStringW& KeyName, INT& iResult);
|
||||||
};
|
};
|
||||||
|
|
|
@ -154,6 +154,9 @@
|
||||||
#define IDS_AINFO_URLDOWNLOAD 355
|
#define IDS_AINFO_URLDOWNLOAD 355
|
||||||
#define IDS_AINFO_AVAILABLEVERSION 356
|
#define IDS_AINFO_AVAILABLEVERSION 356
|
||||||
#define IDS_AINFO_LANGUAGES 357
|
#define IDS_AINFO_LANGUAGES 357
|
||||||
|
#define IDS_AINFO_KILOBYTE_EXT 358
|
||||||
|
#define IDS_AINFO_MEGABYTE_EXT 359
|
||||||
|
#define IDS_AINFO_GIGABYTE_EXT 360
|
||||||
|
|
||||||
|
|
||||||
/* Names of categories */
|
/* Names of categories */
|
||||||
|
|
|
@ -129,7 +129,7 @@ BOOL ShowInstalledAppInfo(INT Index)
|
||||||
GET_INFO(L"UninstallString", IDS_INFO_UNINSTALLSTR, CFE_BOLD, 0);
|
GET_INFO(L"UninstallString", IDS_INFO_UNINSTALLSTR, CFE_BOLD, 0);
|
||||||
GET_INFO(L"InstallSource", IDS_INFO_INSTALLSRC, CFE_BOLD, 0);
|
GET_INFO(L"InstallSource", IDS_INFO_INSTALLSRC, CFE_BOLD, 0);
|
||||||
GET_INFO(L"ModifyPath", IDS_INFO_MODIFYPATH, CFE_BOLD, 0);
|
GET_INFO(L"ModifyPath", IDS_INFO_MODIFYPATH, CFE_BOLD, 0);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -354,7 +354,7 @@ VOID CConfigParser::CacheINILocale()
|
||||||
m_szCachedINISectionLocaleNeutral = m_szCachedINISectionLocale + m_szLocaleID.Right(2);
|
m_szCachedINISectionLocaleNeutral = m_szCachedINISectionLocale + m_szLocaleID.Right(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
UINT CConfigParser::GetString(const ATL::CStringW& KeyName, ATL::CStringW& ResultString)
|
BOOL CConfigParser::GetString(const ATL::CStringW& KeyName, ATL::CStringW& ResultString)
|
||||||
{
|
{
|
||||||
DWORD dwResult;
|
DWORD dwResult;
|
||||||
|
|
||||||
|
@ -392,10 +392,12 @@ UINT CConfigParser::GetString(const ATL::CStringW& KeyName, ATL::CStringW& Resul
|
||||||
return (dwResult != 0 ? TRUE : FALSE);
|
return (dwResult != 0 ? TRUE : FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
UINT CConfigParser::GetInt(const ATL::CStringW& KeyName)
|
BOOL CConfigParser::GetInt(const ATL::CStringW& KeyName, INT& iResult)
|
||||||
{
|
{
|
||||||
ATL::CStringW Buffer;
|
ATL::CStringW Buffer;
|
||||||
|
|
||||||
|
iResult = 0;
|
||||||
|
|
||||||
// grab the text version of our entry
|
// grab the text version of our entry
|
||||||
if (!GetString(KeyName, Buffer))
|
if (!GetString(KeyName, Buffer))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -404,8 +406,9 @@ UINT CConfigParser::GetInt(const ATL::CStringW& KeyName)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
// convert it to an actual integer
|
// convert it to an actual integer
|
||||||
INT result = StrToIntW(Buffer.GetString());
|
iResult = StrToIntW(Buffer.GetString());
|
||||||
|
|
||||||
return (UINT) (result <= 0) ? 0 : result;
|
// we only care about values > 0
|
||||||
|
return (iResult > 0);
|
||||||
}
|
}
|
||||||
// CConfigParser
|
// CConfigParser
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue