当前位置: 首页>>代码示例>>C#>>正文


C# IRequest.GetText方法代码示例

本文整理汇总了C#中IRequest.GetText方法的典型用法代码示例。如果您正苦于以下问题:C# IRequest.GetText方法的具体用法?C# IRequest.GetText怎么用?C# IRequest.GetText使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IRequest的用法示例。


在下文中一共展示了IRequest.GetText方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: PerformLogin

 private string PerformLogin(IRequest request)
 {
     try
     {
         LoginRequest credentials = Deserialise(request.GetText("credentials"));
         string sessionToken = farmService.Login(request.GetText("server"), credentials);
         return GenerateResult("success", string.Format("<session>{0}</session>", sessionToken));
     }
     catch
     {
         return GenerateResult("failure", "Login failure");
     }
 }
开发者ID:derrills1,项目名称:ccnet_gitmode,代码行数:13,代码来源:XmlServerSecurityAction.cs

示例2: PerformLogout

 private string PerformLogout(IRequest request)
 {
     try
     {
         string sessionToken = request.GetText("sessionToken");
         farmService.Logout(request.GetText("server"), sessionToken);
         return GenerateResult("success", string.Empty);
     }
     catch
     {
         return GenerateResult("failure", "Login failure");
     }
 }
开发者ID:derrills1,项目名称:ccnet_gitmode,代码行数:13,代码来源:XmlServerSecurityAction.cs

示例3: ForceBuildIfNecessary

 private string ForceBuildIfNecessary(IRequest request)
 {
     if (request.FindParameterStartingWith("forcebuild") != string.Empty)
     {
         string forceBuildProject = request.GetText("forceBuildProject");
         bool forceWasAllowed = false;
         forceWasAllowed = farmService.ForceBuild(
             new DefaultProjectSpecifier(
                 new DefaultServerSpecifier(request.GetText("forceBuildServer")),
                 forceBuildProject));
         if (forceWasAllowed)
         {
             return string.Format("Build successfully forced for {0}", forceBuildProject);
         }
         else
         {
             return string.Format("Build was not allowed to be forced for {0}", forceBuildProject);
         }
     }
     else
     {
         return "";
     }
 }
开发者ID:vardars,项目名称:ci-factory,代码行数:24,代码来源:VelocityProjectGridAction.cs

示例4: Execute

        public IResponse Execute(IRequest request)
        {
            string action = request.GetText("action");
            string result = null;

            switch (action.ToLower())
            {
                case "login":
                    result = PerformLogin(request);
                    break;
                case "logout":
                    result = PerformLogout(request);
                    break;
                default:
                    result = GenerateResult("failure", "Unknown action");
                    break;
            }
            return new XmlFragmentResponse(result);
        }
开发者ID:derrills1,项目名称:ccnet_gitmode,代码行数:19,代码来源:XmlServerSecurityAction.cs

示例5: SelectedProject

 private static string SelectedProject(IRequest request)
 {
     return request.GetText("projectName");
 }
开发者ID:alexanderyaremchuk,项目名称:CruiseControl.NET,代码行数:4,代码来源:CategorizedFarmReportFarmPlugin.cs

示例6: ProjectSpecifier

 private DefaultProjectSpecifier ProjectSpecifier(IRequest request)
 {
     return new DefaultProjectSpecifier(
         farmService.GetServerConfiguration(request.GetText("serverName")), SelectedProject(request));
 }
开发者ID:alexanderyaremchuk,项目名称:CruiseControl.NET,代码行数:5,代码来源:CategorizedFarmReportFarmPlugin.cs

示例7: SaveServer

        /// <summary>
        /// Save the server details
        /// </summary>
        /// <param name="request"></param>
        /// <param name="velocityContext"></param>
        private void SaveServer(IRequest request, Hashtable velocityContext)
        {
            // Retrieve the details
            string newName = request.GetText("newName");
            string oldName = request.GetText("oldName");
            string serverUri = request.GetText("serverUri");
            bool serverForceBuild = request.GetChecked("serverForceBuild");
            bool serverStartStop = request.GetChecked("serverStartStop");
            bool backwardsCompatible = request.GetChecked("serverBackwardsCompatible");

            // Validate the details
            if (string.IsNullOrEmpty(newName))
            {
                velocityContext["Error"] = this.translations.Translate("Name is a compulsory value");
                return;
            }
            if (string.IsNullOrEmpty(serverUri))
            {
                velocityContext["Error"] = this.translations.Translate("URI is a compulsory value");
                return;
            }

            // Find the server
            XmlDocument configFile = LoadConfig();
            XmlElement serverEl = configFile.SelectSingleNode(
                string.Format(
                    "/dashboard/remoteServices/servers/server[@name='{0}']",
                    oldName)) as XmlElement;
            ServerLocation location = null;
            if (serverEl == null)
            {
                // If the element wasn't found, start a new one
                serverEl = configFile.CreateElement("server");
                configFile.SelectSingleNode("/dashboard/remoteServices/servers")
                    .AppendChild(serverEl);

                // Add the new server
                location = new ServerLocation();
                ServerLocation[] locations = new ServerLocation[servicesConfiguration.Servers.Length + 1];
                servicesConfiguration.Servers.CopyTo(locations, 0);
                locations[servicesConfiguration.Servers.Length] = location;
                servicesConfiguration.Servers = locations;
            }
            else
            {
                // Get the existing server config
                foreach (ServerLocation locationToCheck in servicesConfiguration.Servers)
                {
                    if (locationToCheck.Name == oldName)
                    {
                        location = locationToCheck;
                        break;
                    }
                }
            }

            // Set all the properties
            serverEl.SetAttribute("name", newName);
            serverEl.SetAttribute("url", serverUri);
            serverEl.SetAttribute("allowForceBuild", serverForceBuild ? "true" : "false");
            serverEl.SetAttribute("allowStartStopBuild", serverStartStop ? "true" : "false");
            serverEl.SetAttribute("backwardsCompatible", backwardsCompatible ? "true" : "false");
            SaveConfig(configFile);
            if (location != null)
            {
                location.Name = newName;
                location.Url = serverUri;
                location.AllowForceBuild = serverForceBuild;
                location.AllowStartStopBuild = serverStartStop;
                location.BackwardCompatible = backwardsCompatible;
            }

            velocityContext["Result"] = this.translations.Translate("Server has been saved");
            CachingDashboardConfigurationLoader.ClearCache();
        }
开发者ID:derrills1,项目名称:ccnet_gitmode,代码行数:80,代码来源:AdministerAction.cs

示例8: DeleteServer

        /// <summary>
        /// Deletes a server.
        /// </summary>
        /// <param name="request"></param>
        /// <param name="velocityContext"></param>
        private void DeleteServer(IRequest request, Hashtable velocityContext)
        {
            // Retrieve the details
            string serverName = request.GetText("ServerName");

            // Validate the details
            if (string.IsNullOrEmpty(serverName))
            {
                velocityContext["Error"] = this.translations.Translate("Server name has not been set");
                return;
            }

            // Find the server
            XmlDocument configFile = LoadConfig();
            XmlElement serverEl = configFile.SelectSingleNode(
                string.Format(
                    "/dashboard/remoteServices/servers/server[@name='{0}']",
                    serverName)) as XmlElement;
            ServerLocation location = null;
            if (serverEl != null)
            {
                // Get and remove the existing server config
                foreach (ServerLocation locationToCheck in servicesConfiguration.Servers)
                {
                    if (locationToCheck.Name == serverName)
                    {
                        location = locationToCheck;
                        break;
                    }
                }
                if (location != null)
                {
                    List<ServerLocation> locations = new List<ServerLocation>(servicesConfiguration.Servers);
                    locations.Remove(location);
                    servicesConfiguration.Servers = locations.ToArray();
                }

                // Remove it from the config file
                serverEl.ParentNode.RemoveChild(serverEl);
                SaveConfig(configFile);

                velocityContext["Result"] = this.translations.Translate("Server has been deleted");
                CachingDashboardConfigurationLoader.ClearCache();
            }
            else
            {
                velocityContext["Error"] = this.translations.Translate("Unable to find server");
                return;
            }
        }
开发者ID:derrills1,项目名称:ccnet_gitmode,代码行数:55,代码来源:AdministerAction.cs

示例9: GetSortColumn

 private ProjectGridSortColumn GetSortColumn(IRequest request)
 {
     string columnName = request.GetText("SortColumn");
     if (columnName == string.Empty)
     {
         columnName = "Name";
     }
     try
     {
         return (ProjectGridSortColumn) Enum.Parse(typeof(ProjectGridSortColumn), columnName);
     }
     catch (Exception)
     {
         throw new CruiseControlException(string.Format("Error attempting to calculate column to sort. Specified column name was [{0}]", columnName));
     }
 }
开发者ID:vardars,项目名称:ci-factory,代码行数:16,代码来源:VelocityProjectGridAction.cs

示例10: ForceBuildIfNecessary

        private string ForceBuildIfNecessary(IRequest request)
        {
            // Attempt to find a session token
            string sessionToken = request.GetText("sessionToken");
            if (string.IsNullOrEmpty(sessionToken) && (sessionRetriever != null))
            {
                sessionToken = sessionRetriever.RetrieveSessionToken(request);
            }

            Dictionary<string, string> parameters = new Dictionary<string, string>();
            foreach (string parameterName in HttpContext.Current.Request.Form.AllKeys)
            {
                if (parameterName.StartsWith("param_"))
                {
                    parameters.Add(parameterName.Substring(6), HttpContext.Current.Request.Form[parameterName]);
                }
            }

            // Make the actual call
            if (request.FindParameterStartingWith("StopBuild") != string.Empty)
            {
                farmService.Stop(ProjectSpecifier(request), sessionToken);
                return this.translations.Translate("Stopping project {0}", SelectedProject(request));
            }
            else if (request.FindParameterStartingWith("StartBuild") != string.Empty)
            {
                farmService.Start(ProjectSpecifier(request), sessionToken);
                return this.translations.Translate("Starting project {0}", SelectedProject(request));
            }
            else if (request.FindParameterStartingWith("ForceBuild") != string.Empty)
            {
                farmService.ForceBuild(ProjectSpecifier(request), sessionToken, parameters);
                return this.translations.Translate("Build successfully forced for {0}", SelectedProject(request));
            }
            else if (request.FindParameterStartingWith("AbortBuild") != string.Empty)
            {
                farmService.AbortBuild(ProjectSpecifier(request), sessionToken);
                return this.translations.Translate("Abort successfully forced for {0}", SelectedProject(request));
            }
            else
            {
                return string.Empty;
            }
        }
开发者ID:derrills1,项目名称:ccnet_gitmode,代码行数:44,代码来源:VelocityProjectGridAction.cs

示例11: GetSortColumn

		private ProjectGridSortColumn GetSortColumn(IRequest request)
		{
			string columnName = request.GetText("SortColumn");
            if (string.IsNullOrEmpty(columnName))
            {
                return sortColumn;
            }
            else
            {
                try
                {
                    return (ProjectGridSortColumn)Enum.Parse(typeof(ProjectGridSortColumn), columnName);
                }
                catch (Exception)
                {
                    throw new CruiseControlException(string.Format(System.Globalization.CultureInfo.CurrentCulture,"Error attempting to calculate column to sort. Specified column name was [{0}]", columnName));
                }
            }
		}
开发者ID:kascomp,项目名称:CruiseControl.NET,代码行数:19,代码来源:VelocityProjectGridAction.cs


注:本文中的IRequest.GetText方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。