public string GetCommandLine(Model.Server server, string host) { if (server.CurrentPlayers == server.MaximumPlayers) { return("Sorry, the game is already started."); } return(CommandLineUtils.GetClientLaunchCommand(host, server.Port, server.Mod.CommandLine)); }
public string AddServer(string serverName, string ip1, string ip2, string ip3, string area, string status, string reMark) { if (Session[Util.ProjectConfig.ADMINUSER] == null) { return(""); } string guid = ((Guid.NewGuid().ToString()).Substring(0, 13)).Replace("-", ""); bool ID = BLL.ServerManager.SelectGuId(guid); string subDomain = guid; for (var i = 0; ID.Equals(true); i++) { if (ID) { string guids = ((Guid.NewGuid().ToString()).Substring(0, 12)).Replace("-", ""); ID = BLL.ServerManager.SelectGuId(guids); subDomain = guids; } } Model.Server server = new Model.Server(); server.ServerName = serverName; server.Ip1 = ip1; server.Ip2 = ip2; server.Ip3 = ip3; server.SubDomain = subDomain; server.OnlineNumber = 0; server.Area = area; server.Status = status; server.AddDate = DateTime.Now; server.UpdateDate = DateTime.Now; server.ReMark = reMark; string jsonStr = ""; bool reval = BLL.ServerManager.AddServer(server); if (reval) { jsonStr = ObjectToJson.ObjectsToJson <Server>(server); } else { jsonStr = "none"; } return(jsonStr); }