Update: drop Qt dependency, rewrite as pure Win32 using v142 toolset. Replace Update.ui/qrc and miniz-based Zip with Api/Crypto/Http/Json/Unzip/UpdateWindow modules. CrownClient/CrownServer: update Verify and main sources, retarget x64 configs to v142 (VS2019) with SDK 10.0.19041.0, fix VMProtect SDK paths.
36 lines
779 B
C++
36 lines
779 B
C++
#pragma once
|
|
|
|
#include <windows.h>
|
|
|
|
#include <functional>
|
|
#include <string>
|
|
|
|
namespace updater {
|
|
|
|
struct HttpResult {
|
|
long status = 0;
|
|
std::string body;
|
|
};
|
|
|
|
class Http {
|
|
public:
|
|
using ProgressFunc = std::function<bool(unsigned long long received,
|
|
unsigned long long total)>;
|
|
|
|
static bool Get(const std::wstring& url, HttpResult& out, std::wstring& err);
|
|
|
|
static bool Download(const std::wstring& url,
|
|
const std::wstring& savePath,
|
|
ProgressFunc progress,
|
|
std::wstring& err);
|
|
|
|
static void SetTimeoutSec(int sec) { timeoutSec_ = sec; }
|
|
|
|
static int TimeoutMs() { return timeoutSec_ * 1000; }
|
|
|
|
private:
|
|
static int timeoutSec_;
|
|
};
|
|
|
|
}
|