Files
Work/aladin/prodinfo.hpp
2024-08-07 09:12:07 -04:00

89 lines
1.9 KiB
C++

#ifndef _ALADIN_PRODUCTINFO_HPP_
#define _ALADIN_PRODUCTINFO_HPP_
#ifndef _COMMON_REGKEY_HPP_
#include <common/regkey.hpp>
#endif
#ifndef _COMMON_STRING_HPP_
#include <common/string.hpp>
#endif
#ifndef _ALADIN_RESOURCE_HPP_
#include <aladin/resource.hpp>
#endif
class ProductInfo
{
public:
ProductInfo(void);
virtual ~ProductInfo();
void refresh(void);
const String &strProductName(void)const;
const String &strRegisteredOwner(void)const;
const String &strProductID(void)const;
const String &strVersion(void)const;
private:
String mStrProductName;
String mStrRegisteredOwner;
String mStrProductID;
String mStrVersion;
};
inline
ProductInfo::ProductInfo(void)
{
refresh();
}
inline
ProductInfo::~ProductInfo()
{
}
inline
void ProductInfo::refresh(void)
{
RegKey regKey(RegKey::LocalMachine);
if(!regKey.openKey(String(STRING_CURRENTVERSIONKEYNAME)))return;
regKey.queryValue(String(STRING_PRODUCTNAME),mStrProductName);
if(!mStrProductName.isNull())
{
regKey.queryValue(String(STRING_REGISTEREDOWNER),mStrRegisteredOwner);
regKey.queryValue(String(STRING_PRODUCTID),mStrProductID);
regKey.queryValue(String(STRING_VERSIONNUMBER),mStrVersion);
}
else
{
RegKey regKey(RegKey::LocalMachine);
if(!regKey.openKey(String(STRING_CURRENTVERSIONNTKEYNAME)))return;
regKey.queryValue(String(STRING_PRODUCTNAME),mStrProductName);
regKey.queryValue(String(STRING_REGISTEREDOWNER),mStrRegisteredOwner);
regKey.queryValue(String(STRING_PRODUCTID),mStrProductID);
regKey.queryValue(String(STRING_VERSIONNUMBER),mStrVersion);
}
}
inline
const String &ProductInfo::strProductName(void)const
{
return mStrProductName;
}
inline
const String &ProductInfo::strRegisteredOwner(void)const
{
return mStrRegisteredOwner;
}
inline
const String &ProductInfo::strProductID(void)const
{
return mStrProductID;
}
inline
const String &ProductInfo::strVersion(void)const
{
return mStrVersion;
}
#endif