code_app/app/scanner/VersionDll.h

55 lines
2.7 KiB
C++

#ifndef VERSIONDLL_H
#define VERSIONDLL_H
#include "version/HGVersion.h"
#include "base/HGDll.h"
class VersionDll
{
public:
VersionDll();
~VersionDll();
HGResult Load();
HGResult Free();
HGBool IsValid();
HGResult GetServerConfig(HGServerConfig *config);
HGResult GetVersionList(const HGChar* appName, HGVersionInfo **info, HGUInt *count);
HGResult HttpDownload(const HGChar *url, const HGChar *saveFilePath, HGHttpDownloadFunc func, HGPointer param);
HGResult ReleaseVersionList(HGVersionInfo* info, HGUInt count);
HGResult GetCurrVersion(const HGChar* appName, HGChar* version, HGUInt maxLen);
HGResult CompareVersion(const HGChar* version1, const HGChar* version2, HGInt* result);
HGResult PostCrashInfo(const HGChar* appName, const HGChar* desc, const HGChar* crashFilePath, const HGChar* exceptionAddr);
HGResult PostUserFeedback(const HGChar* appName, const HGChar* desc, const HGChar* feedback, const HGChar* contact);
private:
typedef HGResult (HGAPI *HGVersion_CreateMgr)(HGVersionMgr *mgr);
typedef HGResult (HGAPI *HGVersion_DestroyMgr)(HGVersionMgr mgr);
typedef HGResult (HGAPI *HGVersion_GetServerConfig)(HGVersionMgr mgr, HGServerConfig *config);
typedef HGResult (HGAPI *HGVersion_GetVersionList)(HGVersionMgr mgr, const HGChar* appName, HGVersionInfo **info, HGUInt *count);
typedef HGResult (HGAPI *HGVersion_PostCrashInfo)(HGVersionMgr mgr, const HGChar* appName, const HGChar* desc, const HGChar* crashFilePath, const HGChar* exceptionAddr);
typedef HGResult (HGAPI *HGVersion_PostUserFeedback)(HGVersionMgr mgr, const HGChar* appName, const HGChar* desc, const HGChar* feedback, const HGChar* contact);
typedef HGResult (HGAPI *HGVersion_HttpDownload)(HGVersionMgr mgr, const HGChar *url, const HGChar *saveFilePath, HGHttpDownloadFunc func, HGPointer param);
typedef HGResult (HGAPI *HGVersion_ReleaseVersionList)(HGVersionInfo* info, HGUInt count);
typedef HGResult (HGAPI *HGVersion_GetCurrVersion)(const HGChar* appName, HGChar* version, HGUInt maxLen);
typedef HGResult (HGAPI *HGVersion_CompareVersion)(const HGChar* version1, const HGChar* version2, HGInt* result);
private:
HGDll m_dll;
HGVersion_CreateMgr m_funcCreateMgr;
HGVersion_DestroyMgr m_funcDestroyMgr;
HGVersion_GetServerConfig m_funcGetServerConfig;
HGVersion_GetVersionList m_funcGetVersionList;
HGVersion_PostCrashInfo m_funcPostCrashInfo;
HGVersion_PostUserFeedback m_funcPostUserFeedback;
HGVersion_HttpDownload m_funcHttpDownload;
HGVersion_ReleaseVersionList m_funcReleaseVersionList;
HGVersion_GetCurrVersion m_funcGetCurrVersion;
HGVersion_CompareVersion m_funcCompareVersion;
HGVersionMgr m_mgr;
};
#endif /* VERSIONDLL_H */