private void CheckInput(string input) { SetResultText("正在查询..."); if (chosenServer == SERVER_TYPE.JP) // 查询日服 { string result = GetWebRequest("https://api.matsurihi.me/mltd/v1/version/assets/" + input); if (isResultError(result)) { SetResultText("查询错误!\n不存在该版本号"); return; } JavaScriptSerializer js = new JavaScriptSerializer(); Res info = js.Deserialize <Res>(result); cacheVersionInfo = info; SetResultText("查询成功!" + "\n查询版本是:" + info.version + "\n更新时间是:" + info.updateTime); checkInputThread = null; } else if (chosenServer == SERVER_TYPE.CNT) // 查询繁中服 { string result = GetWebRequest("https://redive.estertion.win/db/mltd/" + input + ".json"); if (isResultError(result)) { SetResultText("查询错误!\n不存在该版本号"); return; } JavaScriptSerializer js = new JavaScriptSerializer(); Res_CNT info = js.Deserialize <Res_CNT>(result); if (info.asset_version == 0) { SetResultText("查询错误!\n不存在该版本号"); checkInputThread = null; return; } cacheVersionInfo = new Res(); cacheVersionInfo.indexName = info.asset_index_name; cacheVersionInfo.updateTime = info.update_time; cacheVersionInfo.version = info.asset_version; SetResultText("查询成功!" + "\n查询版本是:" + info.asset_version + "\n更新时间是:" + info.update_time); checkInputThread = null; } }
private void CheckLatest() { SetResultText("正在查询..."); string result = ""; if (chosenServer == SERVER_TYPE.JP) // 查询日服 { result = GetWebRequest("https://api.matsurihi.me/mltd/v1/version/latest"); if (isResultError(result)) { SetResultText("查询错误!"); return; } JavaScriptSerializer js = new JavaScriptSerializer(); LatestVersionInfo info = js.Deserialize <LatestVersionInfo>(result); cacheVersionInfo = info.res; SetResultText("更新成功!" + "\n现在的最新版本是:" + info.res.version + "\n更新时间是:" + info.res.updateTime); checkLatestThread = null; } else if (chosenServer == SERVER_TYPE.CNT) // 查询繁中服 { result = GetWebRequest("https://redive.estertion.win/db/mltd/current.json"); if (isResultError(result)) { SetResultText("查询错误!"); return; } JavaScriptSerializer js = new JavaScriptSerializer(); Res_CNT info = js.Deserialize <Res_CNT>(result); cacheVersionInfo = new Res(); cacheVersionInfo.indexName = info.asset_index_name; cacheVersionInfo.updateTime = info.update_time; cacheVersionInfo.version = info.asset_version; SetResultText("更新成功!" + "\n现在的最新版本是:" + info.asset_version + "\n更新时间是:" + info.update_time); checkLatestThread = null; } }