52 lines
1.2 KiB
C++
52 lines
1.2 KiB
C++
#ifndef __HGVERSION_H__
|
||
#define __HGVERSION_H__
|
||
|
||
#include <string>
|
||
#include <list>
|
||
|
||
struct ServerConfig
|
||
{
|
||
// 是否上传崩溃日志
|
||
bool postCrashInfo;
|
||
// 是否上传用户使用习惯
|
||
bool postUserHabits;
|
||
};
|
||
|
||
struct VersionInfo
|
||
{
|
||
std::string version;
|
||
std::string desc;
|
||
std::string bugInfo;
|
||
std::string url;
|
||
unsigned long long size;
|
||
std::string md5;
|
||
};
|
||
|
||
/* http下载进度回调
|
||
* 返回值: 如果需要停止下载,返回非0;否则返回0
|
||
*/
|
||
typedef int (*HttpDownloadFunc)(long long totalSize, long long nowSize, void *param);
|
||
|
||
// 获取服务器配置
|
||
bool GetServerConfig(ServerConfig &cfg);
|
||
|
||
// 上传崩溃日志
|
||
bool PostCrashInfo(const char* crashFilePath);
|
||
|
||
// 上传用户使用习惯
|
||
bool PostUserHabits(const std::list<std::string>& habits);
|
||
|
||
// 获取当前版本号
|
||
std::string GetCurrVersion();
|
||
|
||
// 获取服务器上所有版本的信息
|
||
bool GetVersionInfoList(std::list<VersionInfo> &versionList);
|
||
|
||
// 比较版本号, 负数表示version1<version2, 0表示相等,正数表示version1>version2
|
||
int CompareVersion(const std::string& version1, const std::string& version2);
|
||
|
||
// 下载HTTP文件
|
||
bool HttpDownload(const char* url, const char* saveFilePath, HttpDownloadFunc func, void *param);
|
||
|
||
#endif /* __HGVERSION_H__ */
|