forked from rainmeter/rainmeter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathUpdateCheck.h
49 lines (35 loc) · 1.26 KB
/
UpdateCheck.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
/* Copyright (C) 2017 Rainmeter Project Developers
*
* This Source Code Form is subject to the terms of the GNU General Public
* License; either version 2 of the License, or (at your option) any later
* version. If a copy of the GPL was not distributed with this file, You can
* obtain one at <https://www.gnu.org/licenses/gpl-2.0.html>. */
#ifndef __UPDATE_CHECK_H__
#define __UPDATE_CHECK_H__
#define JSON_NOEXCEPTION
#include "json/json.hpp"
using nlohmann::json;
class Updater
{
public:
static Updater& GetInstance();
void CheckForUpdates(bool download);
void GetLanguageStatus();
static bool VerifyInstaller(const std::wstring& path, const std::wstring& filename,
const std::wstring& sha256, bool writeToDataFile);
private:
Updater();
~Updater();
Updater(const Updater& other) = delete;
Updater& operator=(Updater other) = delete;
static void GetStatus(void* pParam);
static bool DownloadStatusFile(std::string& data);
static void CheckVersion(json& status, bool downloadNewVersion);
static bool DownloadNewVersion(json& status);
json m_Status;
bool m_DownloadInstaller;
static LPCWSTR s_UpdateURL;
};
// Convenience function.
inline Updater& GetUpdater() { return Updater::GetInstance(); }
#endif