protected void LinkButtonRoleAccountFreeze_Click(object sender, EventArgs e) { int num = 0; foreach (DataGridItem item in DataGridResult.Items) { CheckBox selection = (CheckBox)item.FindControl("CheckBoxSelect"); if (selection != null && selection.Checked) { //对选择的角色进行操作 string accountName = item.Cells[2].Text; FSEye.PaySysLib.OperationResult result = GMUtil.SetAccountFrozen(CurrentUser.Id, accountName, true); //如果不成功则不进行后面发GM指今操作 if (result != FSEye.PaySysLib.OperationResult.Success) { continue; } ++num; string gatewayInfo = GMUtil.GetGatewayByAccount(CurrentUser.Id, accountName); //如果Gateway信息不是Offline则得到其serverId然后对其上角色进行强制退出操作 if (gatewayInfo != null && !gatewayInfo.Equals("Offline", StringComparison.OrdinalIgnoreCase)) { GameServer server = GMUtil.GetAccountOnlineServer(CurrentUser.Id, accountName); if (server == null) { LabelOpMsg.Text = string.Format(StringDef.MsgCannotBeNone, StringDef.GameServer); return; } IList roleNameList = GMUtil.GetRoleNameByAccount(CurrentUser.Id, server, accountName, true); if (roleNameList.Count != 0) { foreach (string roleName in roleNameList) { server.DoPlugInAction(CurrentUser.Id, LordControl.PlugInGuid, LordControl.ActionKeyExecuteGMCommand, roleName, WebConfig.GMCommandKickPlayer); } } } } } LabelOpMsg.Text = StringDef.OperationSucceed + StringDef.Colon + StringDef.Unfreeze + StringDef.Role + StringDef.Account + num + StringDef.Unit; }
protected void ShowGMCommandResult(object sender, EventArgs e) { if (Session["ServersToGetResult"] == null) { return; } int totalTargetServer = (int)Session["ServersToGetResultTotalCount"]; ArrayList serversToGetResultArrayList = Session["ServersToGetResult"] as ArrayList; ArrayList newServersToGetResultArrayList = new ArrayList(); foreach (GameServer server in serversToGetResultArrayList) { string serverResult = GMUtil.GetGMCommandResult(server, CurrentUser.Id); if (serverResult != null) { ((HtmlTextArea)(resultMessagePanel.FindControl("resultMessageTextArea"))).Value += server.Name + ":\t" + serverResult + "\n\n"; } else { newServersToGetResultArrayList.Add(server); } } if (newServersToGetResultArrayList.Count == 0) { ShowGMCommandResultTimer.Enabled = false; } else { Session["ServersToGetResult"] = newServersToGetResultArrayList; } int receivedCount = (int)Session["ServersToGetResultTotalCount"] - newServersToGetResultArrayList.Count; Session["ResultReceivedCount"] = receivedCount; LabelResultReceivedMsg.Text = "结果返回: " + receivedCount.ToString() + "/" + totalTargetServer.ToString(); LabelResultReceivedMsg.Visible = true; }
protected void Button_Click(object sender, EventArgs e) { if (!WebUtil.CheckPrivilege(WebConfig.FunctionGameMasterGMCommand, OpType.EXECUTE, Session)) { Response.Redirect(WebConfig.PageNotEnoughPrivilege, true); } Button lb = sender as Button; if (lb != null) { string gmCmd = string.Empty; string playerName = string.Empty; bool isAccountName = false; bool isExecutedByGameServer = false; int templateIndex = int.Parse(lb.CommandName); GMCommandTemplate template = templateList[templateIndex]; gmCmd = template.cmd; if (template.PlayerNameTextBox != null) { playerName = template.PlayerNameTextBox.Text.Trim(); } isAccountName = template.isAccountName; if (playerName != String.Empty) { isExecutedByGameServer = true; } //只有存在参数时才需要进行对占位符的替换 if (template.ControlList.Count > 0) { string[] arguments = new string[template.ControlList.Count]; for (int i = 0; i < template.ControlList.Count; i++) { Type t = template.ControlList[i].GetType(); if (t == typeof(TextBox)) { arguments[i] = ((TextBox)(template.ControlList[i])).Text.Trim(); arguments[i] = arguments[i].Replace("\r\n", "\\r\\n"); } else if (t == typeof(DropDownList)) { DropDownList dropDownList = (DropDownList)template.ControlList[i]; if (dropDownList.SelectedIndex != -1) { arguments[i] = dropDownList.SelectedValue; } } } gmCmd = string.Format(gmCmd, arguments); } ArrayList serversToGetResultArrayList = new ArrayList(); try { if (serverGroupSelectionOptionRadioButtonList.SelectedValue == "DropDownList") { int serverId = serverGroupDropDownList.SelectedServer.Id; if (GMUtil.ExeGMCommand(CurrentUser.Id, serverId, playerName, isAccountName, gmCmd, isExecutedByGameServer, null, true)) { LabelOpMsg.Text = "GM指令发送成功"; serversToGetResultArrayList.Add(AdminServer.TheInstance.GameServerManager.GetGameServer(serverId)); } else { LabelOpMsg.Text = "GM指令发送失败"; return; } } else if (serverGroupSelectionOptionRadioButtonList.SelectedValue == "TreeView") { LabelOpMsg.Text = String.Empty; int totalTargetServer = 0; int successCount = 0; foreach (TreeNode checkedTreeNode in TreeViewServerGroup.CheckedNodes) { try { if (checkedTreeNode.Value.StartsWith("g")) { ServerGroup serverGroup = TheAdminServer.GameServerManager.GetGameServerGroup(int.Parse(checkedTreeNode.Value.Substring(1))); GameServer gameCenter = null; foreach (GameServer gameServer in serverGroup.List) { if (gameServer.Type == GameServer.ServerType.gamecenter) { gameCenter = gameServer; break; } } if (gameCenter != null) { totalTargetServer++; if (GMUtil.ExeGMCommand(CurrentUser.Id, gameCenter.Id, playerName, isAccountName, gmCmd, isExecutedByGameServer, null, true)) { serversToGetResultArrayList.Add(gameCenter); successCount++; } } } } catch (Exception exception) { Util.DebugLog(exception.ToString()); } } LabelOpMsg.Text = "发送指令: " + successCount.ToString() + "/" + totalTargetServer.ToString(); } } catch (Exception ex) { Util.DebugLog(ex.ToString()); } finally { LabelOpMsg.Visible = true; LabelResultReceivedMsg.Visible = false; if (serversToGetResultArrayList.Count != 0) { Session["ServersToGetResult"] = serversToGetResultArrayList; Session["ServersToGetResultTotalCount"] = serversToGetResultArrayList.Count; Session["ResultReceivedCount"] = 0; ((HtmlTextArea)(resultMessagePanel.FindControl("resultMessageTextArea"))).Value = string.Empty; if (ShowGMCommandResultTimer.Enabled == false) { ShowGMCommandResultTimer.Enabled = true; } } } } }
protected void LinkButtonGMCommand_Click(object sender, EventArgs e) { LinkButton lb = sender as LinkButton; if (lb != null) { switch (lb.ID.Substring(10)) { case "Talk": bool chatEnable; if (lb.Text.Equals(StringDef.ChatDisable, StringComparison.OrdinalIgnoreCase)) { chatEnable = false; } else { chatEnable = true; } if (GMUtil.SetRoleChatEnable(CurrentUser.Id, _server, _role.RoleName, chatEnable)) { if (chatEnable) { lb.Text = StringDef.ChatDisable; } else { lb.Text = StringDef.ChatEnable; } LabelOpMsg.Text = StringDef.OperationSucceed + StringDef.Colon + (chatEnable ? StringDef.ChatEnable : StringDef.ChatDisable); } else { LabelOpMsg.Text = StringDef.OperationFail + StringDef.Colon + (chatEnable ? StringDef.ChatEnable : StringDef.ChatDisable); } break; case "Freeze": bool freeze; if (lb.Text.Equals(StringDef.Freeze, StringComparison.OrdinalIgnoreCase)) { freeze = true; } else { freeze = false; } if (GMUtil.SetRoleFrozen(CurrentUser.Id, _server, _role.RoleName, freeze)) { if (freeze) { lb.Text = StringDef.Unfreeze; } else { lb.Text = StringDef.Freeze; } LabelOpMsg.Text = StringDef.OperationSucceed + StringDef.Colon + (freeze ? StringDef.Freeze : StringDef.Unfreeze); } else { LabelOpMsg.Text = StringDef.OperationFail + StringDef.Colon + (freeze ? StringDef.Freeze : StringDef.Unfreeze); } break; case "Save": if (_server.DoPlugInAction(CurrentUser.Id, LordControl.PlugInGuid, LordControl.ActionKeyExecuteGMCommand, _role.RoleName, WebConfig.GMCommandSave)) { LabelOpMsg.Text = StringDef.OperationSucceed + StringDef.Colon + StringDef.SaveByForce; } else { LabelOpMsg.Text = StringDef.OperationFail + StringDef.Colon + StringDef.SaveByForce; } break; case "Quit": if (_server.DoPlugInAction(CurrentUser.Id, LordControl.PlugInGuid, LordControl.ActionKeyExecuteGMCommand, _role.RoleName, WebConfig.GMCommandKickPlayer)) { LabelOpMsg.Text = StringDef.OperationSucceed + StringDef.Colon + StringDef.QuitByForce; } else { LabelOpMsg.Text = StringDef.OperationFail + StringDef.Colon + StringDef.QuitByForce; } break; } } }
protected void LinkButtonFreeze_Click(object sender, EventArgs e) { LinkButton lb = sender as LinkButton; if (lb == null) { return; } if (TextAccount.Text == null || TextAccount.Text.Length == 0) { return; } FSEye.PaySysLib.OperationResult result; switch (lb.CommandName) { case "Freeze": result = GMUtil.SetAccountFrozen(CurrentUser.Id, TextAccount.Text, true); if (result != FSEye.PaySysLib.OperationResult.Success) { LabelOpResult.Text = result.ToString(); } else { //更新状态信息 TextState.Text = TheAdminServer.PaySysAgent.GetAccountState(TextAccount.Text).ToString(); string gatewayInfo = TheAdminServer.PaySysAgent.GetGatewayByAccount(TextAccount.Text); TextGatewayInfo.Text = gatewayInfo; //如果Gateway信息不是Offline则得到其serverId然后对其上角色进行强制退出操作 if (!gatewayInfo.Equals("Offline", StringComparison.OrdinalIgnoreCase)) { GameServer server = GMUtil.GetAccountOnlineServer(CurrentUser.Id, TextAccount.Text); if (server != null) { IList roleNameList = GMUtil.GetRoleNameByAccount(CurrentUser.Id, server, TextAccount.Text, true); if (roleNameList.Count != 0) { foreach (string roleName in roleNameList) { server.DoPlugInAction(CurrentUser.Id, LordControl.PlugInGuid, LordControl.ActionKeyExecuteGMCommand, roleName, WebConfig.GMCommandKickPlayer); } } } } } break; case "UnFreeze": result = GMUtil.SetAccountFrozen(CurrentUser.Id, TextAccount.Text, false); if (result != FSEye.PaySysLib.OperationResult.Success) { LabelOpResult.Text = result.ToString(); } else { //更新状态信息 TextState.Text = TheAdminServer.PaySysAgent.GetAccountState(TextAccount.Text).ToString(); string gatewayInfo = TheAdminServer.PaySysAgent.GetGatewayByAccount(TextAccount.Text); TextGatewayInfo.Text = gatewayInfo; } break; } }
protected void LinkButton_Click(object sender, EventArgs e) { if (!WebUtil.CheckPrivilege(WebConfig.FunctionGameMasterGMCommandAdvanced, OpType.EXECUTE, Session)) { Response.Redirect(WebConfig.PageNotEnoughPrivilege, true); } LinkButton lb = sender as LinkButton; if (lb != null) { string gmCmd = string.Empty; string roleName = string.Empty; bool isAccountName = false; bool isExecutedByGameServer = false; switch (lb.CommandName) { case "Custom": if (GMTargetDropDownList.SelectedValue == "Player") { roleName = TextBoxCustomRoleName.Text.Trim(); if (roleOrAccountDropDownList.SelectedValue == "AccountName") { isAccountName = true; } if (roleName != String.Empty) { isExecutedByGameServer = true; } } string cmd = TextBoxCustomCommand.Text; if (cmd.Length == 0) { LabelOpMsg.Text = string.Format(StringDef.MsgCannotBeNone, StringDef.Command); } gmCmd = cmd; break; } ArrayList serversToGetResultArrayList = new ArrayList(); try { if (serverGroupSelectionOptionRadioButtonList.SelectedValue == "DropDownList") { int serverId = serverGroupDropDownList.SelectedServer.Id; if (GMUtil.ExeGMCommand(CurrentUser.Id, serverId, roleName, isAccountName, gmCmd, isExecutedByGameServer, null, true)) { LabelOpMsg.Text = "GM指令发送成功"; serversToGetResultArrayList.Add(AdminServer.TheInstance.GameServerManager.GetGameServer(serverId)); } else { LabelOpMsg.Text = "GM指令发送失败"; return; } } else if (serverGroupSelectionOptionRadioButtonList.SelectedValue == "TreeView") { LabelOpMsg.Text = String.Empty; int totalTargetServer = 0; int successCount = 0; foreach (TreeNode checkedTreeNode in TreeViewServerGroup.CheckedNodes) { try { if (checkedTreeNode.Value.StartsWith("g")) { ServerGroup serverGroup = TheAdminServer.GameServerManager.GetGameServerGroup(int.Parse(checkedTreeNode.Value.Substring(1))); GameServer gameCenter = null; foreach (GameServer gameServer in serverGroup.List) { if (gameServer.Type == GameServer.ServerType.gamecenter) { gameCenter = gameServer; break; } } if (gameCenter != null) { totalTargetServer++; if (GMUtil.ExeGMCommand(CurrentUser.Id, gameCenter.Id, roleName, isAccountName, gmCmd, isExecutedByGameServer, null, true)) { serversToGetResultArrayList.Add(gameCenter); successCount++; } } } } catch (Exception exception) { Util.DebugLog(exception.ToString()); } } LabelOpMsg.Text = "发送指令: " + successCount.ToString() + "/" + totalTargetServer.ToString(); } } catch (Exception ex) { Util.DebugLog(ex.ToString()); } finally { LabelOpMsg.Visible = true; LabelResultReceivedMsg.Visible = false; if (serversToGetResultArrayList.Count != 0) { Session["ServersToGetResult"] = serversToGetResultArrayList; Session["ServersToGetResultTotalCount"] = serversToGetResultArrayList.Count; Session["ResultReceivedCount"] = 0; ((HtmlTextArea)(resultMessagePanel.FindControl("resultMessageTextArea"))).Value = string.Empty; if (ShowGMCommandResultTimer.Enabled == false) { ShowGMCommandResultTimer.Enabled = true; } } } } }
protected void LinkButtonSendMail_Click(object sender, EventArgs e) { try { ArrayList paramList = new ArrayList(); GameServer server = ServerDropDownList.SelectedGameServer; if (server == null) { LabelOpMsg.Text = string.Format(StringDef.MsgCannotBeNone, StringDef.GameServer); return; } if (!server.IsConnected) { LabelOpMsg.Text = StringDef.NoConnectionAlert; return; } string receiver = TextBoxInputReceiver.Text.Trim(); if (receiver == string.Empty) { LabelOpMsg.Text = string.Format(StringDef.MsgCannotBeNone, StringDef.Receiver); return; } paramList.Add(receiver); string subject = TextBoxInputSubject.Text.Trim(); if (subject == string.Empty) { LabelOpMsg.Text = string.Format(StringDef.MsgCannotBeNone, StringDef.Subject); return; } paramList.Add(subject); string content = TextBoxInputContent.Text.Trim(); paramList.Add(content); int costMoney = int.Parse(TextBoxInputCostMoney.Text.Trim()); int postMoney = int.Parse(TextBoxInputPostMoney.Text.Trim()); paramList.Add(costMoney); paramList.Add(postMoney); //╬№ки¤Я╣п if (CheckBoxItem.Checked) { string itemCountText = TextBoxInputItemCount.Text.Trim(); if (itemCountText.Length == 0) { LabelOpMsg.Text = string.Format(StringDef.MsgCannotBeNone, StringDef.Count); return; } int itemCount = int.Parse(itemCountText); string[] itemIds = TextBoxItemId.Text.Trim().Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries); if (itemIds.Length != 4) { LabelOpMsg.Text = StringDef.ParameterInputError + StringDef.Colon + StringDef.ItemID; return; } paramList.Add(itemIds[0]); paramList.Add(itemIds[1]); paramList.Add(itemIds[2]); paramList.Add(itemIds[3]); paramList.Add(itemCount); } if (GMUtil.SendMail(CurrentUser.Id, server.Id, paramList.ToArray())) { LabelOpMsg.Text = StringDef.SendSuccess; } else { LabelOpMsg.Text = StringDef.SendFail; } } catch (FormatException) { LabelOpMsg.Text = StringDef.ParameterInputError; return; } catch (Exception ex) { LabelOpMsg.Text = ex.Message; return; } }