Beispiel #1
0
    protected void DataGridResult_ItemCommand(object sender, DataGridCommandEventArgs e)
    {
        switch (((LinkButton)e.CommandSource).CommandName)
        {
        case "Download":
            GameServer server = TheAdminServer.GameServerManager.GetGameServer((int)ViewState[WebConfig.ParamServerId]);
            if (server != null)
            {
                if (!WebUtil.CheckPrivilege(TheAdminServer.GameServerManager.SecurityObject, OpType.EXECUTE, Session))
                {
                    LabelOpMsg.Text = StringDef.NotEnoughPrivilege;
                    return;
                }
                string   fileName = e.Item.Cells[4].Text;
                CheckBox check    = e.Item.Cells[3].FindControl("CheckBoxOverWrite") as CheckBox;
                if (check == null)
                {
                    return;
                }
                string path = ViewState["Path"] as string;
                if (path[path.Length - 1].ToString() != GameServer.FilePathDelimiter)
                {
                    path += GameServer.FilePathDelimiter;
                }
                server.AddFMTask(new FileDownloadTask(path + fileName, fileName, check.Checked));
                LabelOpMsg.Text = StringDef.OperationSucceed + StringDef.Colon + StringDef.AddToFileList;
            }
            break;

        default:
            break;
        }
    }