| 86 | extern Settings S; |
| 87 | |
| 88 | class Config |
| 89 | { |
| 90 | public: |
| 91 | static void Save() |
| 92 | { |
| 93 | // if file doesn't exist, create new one with {} so it can be parsed |
| 94 | if (!std::filesystem::exists(S.settingsFile)) |
| 95 | { |
| 96 | std::ofstream file(S.settingsFile); |
| 97 | file << "{}"; |
| 98 | file.close(); |
| 99 | } |
| 100 | |
| 101 | Json::Value root; |
| 102 | JSONCPP_STRING err; |
| 103 | |
| 104 | std::ifstream iFile(S.settingsFile); |
| 105 | |
| 106 | if (iFile.good()) |
| 107 | { |
| 108 | if (Json::CharReaderBuilder builder; parseFromStream(builder, iFile, &root, &err)) |
| 109 | { |
| 110 | root["autoRename"] = S.autoRename; |
| 111 | root["leaguePath"] = S.leaguePath; |
| 112 | root["debugger"] = S.debugger; |
| 113 | root["window"]["width"] = S.Window.width; |
| 114 | root["window"]["height"] = S.Window.height; |
| 115 | root["fontScale"] = S.fontScale; |
| 116 | root["loginTab"]["language"] = S.loginTab.language; |
| 117 | root["loginTab"]["leagueArgs"] = S.loginTab.leagueArgs; |
| 118 | root["streamProof"] = S.streamProof; |
| 119 | root["noAdmin"] = S.noAdmin; |
| 120 | root["checkPrerelease"] = S.checkPrerelease; |
| 121 | |
| 122 | root["infoTab"]["playerName"] = S.infoTab.playerName; |
| 123 | |
| 124 | root["customTab"]["method"] = S.customTab.method; |
| 125 | root["customTab"]["urlText"] = S.customTab.urlText; |
| 126 | root["customTab"]["requestText"] = S.customTab.requestText; |
| 127 | root["customTab"]["port"] = S.customTab.port; |
| 128 | root["customTab"]["header"] = S.customTab.header; |
| 129 | root["invokeTab"]["destination"] = S.invokeTab.destination; |
| 130 | root["invokeTab"]["method"] = S.invokeTab.method; |
| 131 | root["invokeTab"]["args"] = S.invokeTab.args; |
| 132 | |
| 133 | root["gameTab"]["indexFirstRole"] = S.gameTab.indexFirstRole; |
| 134 | root["gameTab"]["indexSecondRole"] = S.gameTab.indexSecondRole; |
| 135 | root["gameTab"]["indexMultiSearch"] = S.gameTab.indexMultiSearch; |
| 136 | root["gameTab"]["autoAcceptEnabled"] = S.gameTab.autoAcceptEnabled; |
| 137 | root["gameTab"]["instalockEnabled"] = S.gameTab.instalockEnabled; |
| 138 | root["gameTab"]["autoBanEnabled"] = S.gameTab.autoBanEnabled; |
| 139 | root["gameTab"]["instalockDelay"] = S.gameTab.instalockDelay; |
| 140 | root["gameTab"]["instalockId"] = S.gameTab.instalockId; |
| 141 | root["gameTab"]["instantMessage"] = S.gameTab.instantMessage; |
| 142 | root["gameTab"]["instantMessageDelay"] = S.gameTab.instantMessageDelay; |
| 143 | root["gameTab"]["instantMessageTimes"] = S.gameTab.instantMessageTimes; |
| 144 | root["gameTab"]["instantMessageDelayTimes"] = S.gameTab.instantMessageDelayTimes; |
| 145 | root["gameTab"]["autoBanId"] = S.gameTab.autoBanId; |
nothing calls this directly
no outgoing calls
no test coverage detected