{
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)
|| !GetString(L"URLDownload", m_szUrlDownload))
GetString(L"Version", m_szVersion);
GetString(L"License", m_szLicense);
GetString(L"Description", m_szDesc);
- GetString(L"Size", m_szSize);
GetString(L"URLSite", m_szUrlSite);
GetString(L"CDPath", m_szCDPath);
GetString(L"Language", m_szRegName);
GetString(L"SHA1", m_szSHA1);
+ RetrieveSize();
RetrieveLicenseType();
RetrieveLanguages();
RetrieveInstalledStatus();
+
if (m_IsInstalled)
{
RetrieveInstalledVersion();
VOID CAvailableApplicationInfo::RetrieveLicenseType()
{
- INT IntBuffer = m_Parser->GetInt(L"LicenseType");
+ INT IntBuffer;
+
+ m_Parser->GetInt(L"LicenseType", IntBuffer);
if (IsLicenseType(IntBuffer))
{
}
}
+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
{
if (!m_HasLanguageInfo)
VOID RetrieveInstalledVersion();
VOID RetrieveLanguages();
VOID RetrieveLicenseType();
+ VOID RetrieveSize();
inline BOOL FindInLanguages(LCID what) const;
};
public:
CConfigParser(const ATL::CStringW& FileName = "");
- UINT GetString(const ATL::CStringW& KeyName, ATL::CStringW& ResultString);
- UINT GetInt(const ATL::CStringW& KeyName);
+ BOOL GetString(const ATL::CStringW& KeyName, ATL::CStringW& ResultString);
+ BOOL GetInt(const ATL::CStringW& KeyName, INT& iResult);
};
#define IDS_AINFO_URLDOWNLOAD 355
#define IDS_AINFO_AVAILABLEVERSION 356
#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 */
GET_INFO(L"UninstallString", IDS_INFO_UNINSTALLSTR, CFE_BOLD, 0);
GET_INFO(L"InstallSource", IDS_INFO_INSTALLSRC, CFE_BOLD, 0);
GET_INFO(L"ModifyPath", IDS_INFO_MODIFYPATH, CFE_BOLD, 0);
-
+
return TRUE;
}
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;
return (dwResult != 0 ? TRUE : FALSE);
}
-UINT CConfigParser::GetInt(const ATL::CStringW& KeyName)
+BOOL CConfigParser::GetInt(const ATL::CStringW& KeyName, INT& iResult)
{
ATL::CStringW Buffer;
+ iResult = 0;
+
// grab the text version of our entry
if (!GetString(KeyName, Buffer))
return FALSE;
return FALSE;
// 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