diff --git a/UmaUmaChecker/src/Config/Config.cpp b/UmaUmaChecker/src/Config/Config.cpp index 8d2af46..60d3397 100644 --- a/UmaUmaChecker/src/Config/Config.cpp +++ b/UmaUmaChecker/src/Config/Config.cpp @@ -47,6 +47,8 @@ bool Config::Load() Theme = config.value("Theme", 0); CaptureMode = (::CaptureMode)config.value("CaptureMode", 0); Language = utility::from_u8string(config.value("Language", "System")); + UpdateUrl = utility::from_u8string(config.value("UpdateUrl", "https://raw.githubusercontent.com/Cilda/UmaUmaChecker/master/UmaUmaChecker/Library/")); + if (UpdateUrl.back() != '/') UpdateUrl += L"/"; } catch (json::exception& ex) { return false; @@ -83,6 +85,7 @@ void Config::Save() config["Theme"] = Theme; config["CaptureMode"] = (int)CaptureMode; config["Language"] = std::filesystem::path(Language.begin(), Language.end()).u8string(); + config["UpdateUrl"] = std::filesystem::path(UpdateUrl.begin(), UpdateUrl.end()).u8string(); std::ofstream output(utility::GetExeDirectory() + L"\\config.json"); output << std::setw(4) << config << std::endl; diff --git a/UmaUmaChecker/src/Config/Config.h b/UmaUmaChecker/src/Config/Config.h index ff0f14c..856fa84 100644 --- a/UmaUmaChecker/src/Config/Config.h +++ b/UmaUmaChecker/src/Config/Config.h @@ -36,5 +36,6 @@ class Config int OcrPoolSize; int Theme; CaptureMode CaptureMode; + std::wstring UpdateUrl; }; diff --git a/UmaUmaChecker/src/Update/UpdateManager.cpp b/UmaUmaChecker/src/Update/UpdateManager.cpp index 0327e41..a562c05 100644 --- a/UmaUmaChecker/src/Update/UpdateManager.cpp +++ b/UmaUmaChecker/src/Update/UpdateManager.cpp @@ -60,12 +60,13 @@ void UpdateManager::GetUpdates(wxWindow* parent, bool bHideDontShowCheck) bool UpdateManager::UpdateEvents() { + auto config = Config::GetInstance(); std::vector urls{ - wxT("https://raw.githubusercontent.com/Cilda/UmaUmaChecker/master/UmaUmaChecker/Library/Chara.json"), - wxT("https://raw.githubusercontent.com/Cilda/UmaUmaChecker/master/UmaUmaChecker/Library/Events.json"), - wxT("https://raw.githubusercontent.com/Cilda/UmaUmaChecker/master/UmaUmaChecker/Library/ReplaceText.json"), - wxT("https://raw.githubusercontent.com/Cilda/UmaUmaChecker/master/UmaUmaChecker/Library/ScenarioEvents.json"), - wxT("https://raw.githubusercontent.com/Cilda/UmaUmaChecker/master/UmaUmaChecker/Library/Skills.json"), + config->UpdateUrl + wxT("Chara.json"), + config->UpdateUrl + wxT("Events.json"), + config->UpdateUrl + wxT("ReplaceText.json"), + config->UpdateUrl + wxT("ScenarioEvents.json"), + config->UpdateUrl + wxT("Skills.json"), }; int UpdatedCount = 0; @@ -186,6 +187,9 @@ bool UpdateManager::UpdateFile(const wxString& url) case wxWebRequest::State_Active: IsActive = true; break; + case wxWebRequest::State_Failed: + IsActive = false; + break; } if (!IsActive) {