From 9b7099d98b87f3a3cf5448c4ee9015e7e2a27684 Mon Sep 17 00:00:00 2001 From: Star Rauchenberger Date: Fri, 7 Mar 2025 00:28:08 -0500 Subject: Added auto-updater --- src/updater.h | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 src/updater.h (limited to 'src/updater.h') diff --git a/src/updater.h b/src/updater.h new file mode 100644 index 0000000..2d2f746 --- /dev/null +++ b/src/updater.h @@ -0,0 +1,47 @@ +#ifndef UPDATER_H_809E7381 +#define UPDATER_H_809E7381 + +#include +#include +#include + +#include + +#ifndef WX_PRECOMP +#include +#endif + +class wxWebRequest; +class wxWebRequestEvent; + +class Updater : public wxEvtHandler { + public: + explicit Updater(wxFrame* parent); + + void Cleanup(); + + void CheckForUpdates(bool invisible); + + private: + enum class UpdateState { + GetVersionInvisible, + GetVersionManual, + GetPackage, + }; + + void OnWebRequestState(wxWebRequestEvent& event); + + void ProcessVersionFile(std::string data); + + void InstallUpdate(std::string url, std::string checksum, + std::vector files, + std::vector deletedFiles); + + bool DownloadWithProgress(wxWebRequest& request); + + wxFrame* parent_; + UpdateState update_state_ = UpdateState::GetVersionInvisible; + std::string package_path_; +}; + +#endif /* end of include guard: UPDATER_H_809E7381 */ -- cgit 1.4.1