protected override void OnGmPageLoad() { if (string.IsNullOrEmpty(Request.Form["svr_id"])) { return; } STServerInfo serverInfo = new STServerInfo(); serverInfo.svrID = Request.Form["svr_id"]; serverInfo.id = CUtils.idatoi(serverInfo.svrID); serverInfo.section = int.Parse(Request.Form["svr_section"]); serverInfo.sectionName = Request.Form["svr_section_name"]; serverInfo.name = Request.Form["svr_name"]; serverInfo.ip = Request.Form["svr_ip"]; serverInfo.authGMHttp = Request.Form["auth_gm_http"]; serverInfo.recommend = (Request.Form["svr_recommend"] == "on") ? true : false; serverInfo.status = int.Parse(Request.Form["svr_status"]); serverInfo.param = Request.Form["svr_param"]; serverInfo.gamedb = JsonConvert.DeserializeObject <STDBInfo>(Request.Form["gamedb"]); serverInfo.codedb = JsonConvert.DeserializeObject <STDBInfo>(Request.Form["codedb"]); serverInfo.logdb = JsonConvert.DeserializeObject <STDBInfo>(Request.Form["logdb"]); serverInfo.authdb = JsonConvert.DeserializeObject <STDBInfo>(Request.Form["authdb"]); gmt.Server.AddServerInfo(serverInfo.id, serverInfo); Response.Write("{\"error\":0}"); Response.End(); }
public static string ModifyServerStatus(List <uint> ids, bool bIsRecommend, int nListStatus) { List <uint> modifyIds = new List <uint>(); foreach (var id in ids) { STServerInfo st = gmt.Server.GetServerInfo(id); if (null == st) { continue; } st.recommend = bIsRecommend; st.status = nListStatus; } return("{\"error\":0}"); }
public static string StopServer(List <uint> ids) { string msg = ""; List <uint> idsSuccess = new List <uint>(); foreach (var id in ids) { STServerInfo server = gmt.Server.GetServerInfo(id); if (AGmPage.ExecuteGmCommand(server, "0", Encoding.UTF8.GetBytes("SDN()"), Encoding.UTF8.GetBytes(""), false, text => { msg += server.svrID + ": " + text; })) { idsSuccess.Add(id); } } return(string.Format("{{\"ids\":{0}, \"msg\": \"{1}\"}}", JsonConvert.SerializeObject(idsSuccess), msg)); }