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


C# ICruiseRequest类代码示例

本文整理汇总了C#中ICruiseRequest的典型用法代码示例。如果您正苦于以下问题:C# ICruiseRequest类的具体用法?C# ICruiseRequest怎么用?C# ICruiseRequest使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: GenerateAuditHistory

        private IResponse GenerateAuditHistory(ICruiseRequest request)
        {
            var velocityContext = new Hashtable();
            var links = new List<IAbsoluteLink>();
            links.Add(new ServerLink(request.UrlBuilder, request.ServerSpecifier, "Server", ActionName));

            ProjectStatusListAndExceptions projects = farmService.GetProjectStatusListAndCaptureExceptions(request.ServerSpecifier, request.RetrieveSessionToken());
            foreach (ProjectStatusOnServer projectStatusOnServer in projects.StatusAndServerList)
            {
                DefaultProjectSpecifier projectSpecifier = new DefaultProjectSpecifier(projectStatusOnServer.ServerSpecifier, projectStatusOnServer.ProjectStatus.Name);
                links.Add(new ProjectLink(request.UrlBuilder, projectSpecifier, projectSpecifier.ProjectName, ServerAuditHistoryServerPlugin.ActionName));
            }
            velocityContext["projectLinks"] = links;
            string sessionToken = request.RetrieveSessionToken(sessionRetriever);
            if (!string.IsNullOrEmpty(request.ProjectName))
            {
                velocityContext["currentProject"] = request.ProjectName;
                AuditFilterBase filter = AuditFilters.ByProject(request.ProjectName);
                velocityContext["auditHistory"] = farmService.ReadAuditRecords(request.ServerSpecifier, sessionToken, 0, 100, filter);
            }
            else
            {
                velocityContext["auditHistory"] = new ServerLink(request.UrlBuilder, request.ServerSpecifier, string.Empty, DiagnosticsActionName);
                velocityContext["auditHistory"] = farmService.ReadAuditRecords(request.ServerSpecifier, sessionToken, 0, 100);
            }

            return viewGenerator.GenerateView(@"AuditHistory.vm", velocityContext);
        }
开发者ID:kascomp,项目名称:CruiseControl.NET,代码行数:28,代码来源:ServerAuditHistoryServerPlugin.cs

示例2: Execute

        public IResponse Execute(ICruiseRequest request)
        {
            Hashtable velocityContext = new Hashtable();
            ArrayList links = new ArrayList();
            links.Add(new ServerLink(urlBuilder, request.ServerSpecifier, "Server Log", ActionName));

            ProjectStatusListAndExceptions projects = farmService.GetProjectStatusListAndCaptureExceptions(request.ServerSpecifier,
                request.RetrieveSessionToken());
            foreach (ProjectStatusOnServer projectStatusOnServer in projects.StatusAndServerList)
            {
                DefaultProjectSpecifier projectSpecifier = new DefaultProjectSpecifier(projectStatusOnServer.ServerSpecifier, projectStatusOnServer.ProjectStatus.Name);
                links.Add(new ProjectLink(urlBuilder, projectSpecifier, projectSpecifier.ProjectName, ServerLogProjectPlugin.ActionName));
            }
            velocityContext["projectLinks"] = links;
            if (string.IsNullOrEmpty(request.ProjectName))
            {
                velocityContext["log"] = HttpUtility.HtmlEncode(farmService.GetServerLog(request.ServerSpecifier, request.RetrieveSessionToken()));
            }
            else
            {
                velocityContext["currentProject"] = request.ProjectSpecifier.ProjectName;
                velocityContext["log"] = HttpUtility.HtmlEncode(farmService.GetServerLog(request.ProjectSpecifier, request.RetrieveSessionToken()));
            }

            return viewGenerator.GenerateView(@"ServerLog.vm", velocityContext);
        }
开发者ID:derrills1,项目名称:ccnet_gitmode,代码行数:26,代码来源:ServerLogServerPlugin.cs

示例3: Execute

        public IResponse Execute(ICruiseRequest request)
        {
            var velocityContext = new Hashtable();
            this.translations = Translations.RetrieveCurrent();

            var projectStatus = farmService.GetProjectStatusListAndCaptureExceptions(request.RetrieveSessionToken());
            var urlBuilder = request.UrlBuilder;
            var category = request.Request.GetText("Category");

            var gridRows = this.projectGrid.GenerateProjectGridRows(projectStatus.StatusAndServerList, BaseActionName, 
                                                                    ProjectGridSortColumn.Category, true, 
                                                                    category, urlBuilder,this.translations);

            var categories = new SortedDictionary<string, CategoryInformation>();
           
            foreach (var row in gridRows)
            {
                var rowCategory = row.Category;
                CategoryInformation categoryRows;
                if (!categories.TryGetValue(rowCategory, out categoryRows))
                {
                    categoryRows = new CategoryInformation(rowCategory);
                    categories.Add(rowCategory, categoryRows);                    
                }

                categoryRows.AddRow(row);                
            }

            velocityContext["categories"] = categories.Values;          

            return viewGenerator.GenerateView("CategorizedFarmReport.vm", velocityContext);
        }
开发者ID:RubenWillems,项目名称:CruiseControl.NET,代码行数:32,代码来源:CategorizedFarmReportFarmPlugin.cs

示例4: Execute

 public IResponse Execute(ICruiseRequest cruiseRequest)
 {
     string fileName = cruiseRequest.Request.GetText("file").Replace("/", "\\");
     if (fileName.EndsWith(".html", StringComparison.InvariantCultureIgnoreCase) ||
         fileName.EndsWith(".htm", StringComparison.InvariantCultureIgnoreCase))
     {
         var htmlData = LoadHtmlFile(cruiseRequest, fileName);
         var prefixPos = fileName.LastIndexOf("\\");
         var prefix = prefixPos >= 0 ? fileName.Substring(0, prefixPos + 1) : string.Empty;
         MatchEvaluator evaluator = (match) =>
         {
             var splitPos = match.Value.IndexOf("=\"");
             var newValue = match.Value.Substring(0, splitPos + 2) +
                 "RetrieveBuildFile.aspx?file=" +
                 prefix +
                 match.Value.Substring(splitPos + 2);
             return newValue;
         };
         htmlData = linkFinder.Replace(htmlData, evaluator);
         return new HtmlFragmentResponse(htmlData);
     }
     else
     {
         // Retrieve the file transfer object
         var fileTransfer = farmService.RetrieveFileTransfer(cruiseRequest.BuildSpecifier, fileName, cruiseRequest.RetrieveSessionToken());
         if (fileTransfer != null)
         {
             return new FileTransferResponse(fileTransfer, fileName);
         }
         else
         {
             return new HtmlFragmentResponse("<div>Unable to find file</div>");
         }
     }
 }
开发者ID:derrills1,项目名称:ccnet_gitmode,代码行数:35,代码来源:BuildFileDownload.cs

示例5: Execute

	    public IResponse Execute(ICruiseRequest cruiseRequest)
		{
			if (xslFileName == null)
			{
				throw new ApplicationException("XSL File Name has not been set for XSL Report Action");
			}
			Hashtable xsltArgs = new Hashtable();
            if (cruiseRequest.Request.ApplicationPath == "/")
            {
                xsltArgs["applicationPath"] = string.Empty;
            }
            else
            {
                xsltArgs["applicationPath"] = cruiseRequest.Request.ApplicationPath;
            }

            // Add the input parameters
            if (Parameters != null)
            {
                foreach (var parameter in Parameters)
                {
                    xsltArgs.Add(parameter.Name, parameter.Value);
                }
            }

			return new HtmlFragmentResponse(buildLogTransformer.Transform(cruiseRequest.BuildSpecifier, new string[] {xslFileName}, xsltArgs, cruiseRequest.RetrieveSessionToken()));
		}
开发者ID:kascomp,项目名称:CruiseControl.NET,代码行数:27,代码来源:XslReportBuildAction.cs

示例6: Execute

        public IResponse Execute(ICruiseRequest request)
        {
            Hashtable velocityContext = new Hashtable();
            ArrayList links = new ArrayList();
            links.Add(new ServerLink(request.UrlBuilder, request.ServerSpecifier, "Server Security Configuration", ActionName));

            ProjectStatusListAndExceptions projects = farmService.GetProjectStatusListAndCaptureExceptions(request.ServerSpecifier, request.RetrieveSessionToken());
            foreach (ProjectStatusOnServer projectStatusOnServer in projects.StatusAndServerList)
            {
                DefaultProjectSpecifier projectSpecifier = new DefaultProjectSpecifier(projectStatusOnServer.ServerSpecifier, projectStatusOnServer.ProjectStatus.Name);
                links.Add(new ProjectLink(request.UrlBuilder, projectSpecifier, projectSpecifier.ProjectName, ServerSecurityConfigurationServerPlugin.ActionName));
            }
            velocityContext["projectLinks"] = links;
            string sessionToken = request.RetrieveSessionToken(sessionRetriever);
            string securityConfig = farmService.GetServerSecurity(request.ServerSpecifier, sessionToken);
            XmlDocument document = new XmlDocument();
            document.LoadXml(securityConfig);
            if (string.IsNullOrEmpty(request.ProjectName))
            {
                securityConfig = document.SelectSingleNode("/security/manager").OuterXml;
            }
            else
            {
                velocityContext["currentProject"] = request.ProjectSpecifier.ProjectName;
                string xpath = string.Format("/security/projects/projectSecurity[name='{0}']/authorisation", request.ProjectSpecifier.ProjectName);
                securityConfig = document.SelectSingleNode(xpath).OuterXml;
            }
            string xmlData = FormatXml(securityConfig);
            velocityContext["log"] = xmlData;

            return viewGenerator.GenerateView(@"SecurityConfiguration.vm", velocityContext);
        }
开发者ID:derrills1,项目名称:ccnet_gitmode,代码行数:32,代码来源:ServerSecurityConfigurationServerPlugin.cs

示例7: LoadHtmlFile

 /// <summary>
 /// Loads the HTML file.
 /// </summary>
 /// <returns></returns>
 private string LoadHtmlFile(ICruiseRequest cruiseRequest, string fileName)
 {
     try
     {
         // Retrieve the file transfer object
         var fileTransfer = farmService.RetrieveFileTransfer(cruiseRequest.BuildSpecifier, fileName, cruiseRequest.RetrieveSessionToken());
         if (fileTransfer != null)
         {
             // Transfer the file across and load it into a string
             var stream = new MemoryStream();
             fileTransfer.Download(stream);
             stream.Seek(0, SeekOrigin.Begin);
             var reader = new StreamReader(stream);
             string htmlData = reader.ReadToEnd();
             return htmlData;
         }
         else
         {
             return "<div>Unable to find file</div>";
         }
     }
     catch (Exception error)
     {
         return "<div>An error occurred while retrieving the file: " + error.Message + "</div>";
     }
 }
开发者ID:kascomp,项目名称:CruiseControl.NET,代码行数:30,代码来源:BuildFileDownload.cs

示例8: Setup

		public void Setup()
		{
            ProjectStatusOnServer server = new ProjectStatusOnServer(new ProjectStatus("myProject", IntegrationStatus.Success, DateTime.Now),
                new DefaultServerSpecifier("myServer"));
            ProjectStatusListAndExceptions statusList = new ProjectStatusListAndExceptions(
                new ProjectStatusOnServer[] {
                    server
                }, new CruiseServerException[] {
                });

			farmServiceMock = new DynamicMock(typeof(IFarmService));
            farmServiceMock.SetupResult("GetProjectStatusListAndCaptureExceptions", statusList, typeof(IServerSpecifier), typeof(string));
			viewGeneratorMock = new DynamicMock(typeof(IVelocityViewGenerator));
			linkFactoryMock = new DynamicMock(typeof(ILinkFactory));
            ServerLocation serverConfig = new ServerLocation();
            serverConfig.ServerName = "myServer";
            configuration.Servers = new ServerLocation[] {
                serverConfig
            };
            var urlBuilderMock = new DynamicMock(typeof(ICruiseUrlBuilder));
            urlBuilderMock.SetupResult("BuildProjectUrl", string.Empty, typeof(string), typeof(IProjectSpecifier));

			plugin = new ProjectReportProjectPlugin((IFarmService) farmServiceMock.MockInstance,
				(IVelocityViewGenerator) viewGeneratorMock.MockInstance,
				(ILinkFactory) linkFactoryMock.MockInstance,
                configuration,
                (ICruiseUrlBuilder)urlBuilderMock.MockInstance);

			cruiseRequestMock = new DynamicMock(typeof(ICruiseRequest));
			cruiseRequest = (ICruiseRequest ) cruiseRequestMock.MockInstance;

		}
开发者ID:kascomp,项目名称:CruiseControl.NET,代码行数:32,代码来源:ProjectReportProjectPluginTest.cs

示例9: SetUp

		public void SetUp()
		{
			mockFarmService = new DynamicMock(typeof (IFarmService));
			reportAction = new ForceBuildXmlAction((IFarmService) mockFarmService.MockInstance);
			cruiseRequestMock = new DynamicMock(typeof (ICruiseRequest));
			cruiseRequest = (ICruiseRequest) cruiseRequestMock.MockInstance;
		}
开发者ID:kyght,项目名称:CruiseControl.NET,代码行数:7,代码来源:ForceBuildXmlActionTest.cs

示例10: Execute

        public IResponse Execute(ICruiseRequest cruiseRequest)
        {
            Hashtable velocityContext = new Hashtable();
            velocityContext["message"] = string.Empty;
            velocityContext["error"] = string.Empty;
            string oldPassword = cruiseRequest.Request.GetText("oldPassword");
            string newPassword1 = cruiseRequest.Request.GetText("newPassword1");
            string newPassword2 = cruiseRequest.Request.GetText("newPassword2");
            if (!string.IsNullOrEmpty(oldPassword) &&
                !string.IsNullOrEmpty(newPassword1))
            {
                try
                {
                    if (newPassword1 != newPassword2) throw new CruiseControlException("New passwords do not match");
					string sessionToken = cruiseRequest.RetrieveSessionToken();
                    farmService.ChangePassword(cruiseRequest.ServerName, sessionToken, oldPassword, newPassword1);
                    velocityContext["message"] = "Password has been changed";
                }
                catch (Exception error)
                {
                    velocityContext["error"] = error.Message;
                }
            }
            return viewGenerator.GenerateView("ChangePasswordAction.vm", velocityContext);
        }
开发者ID:kascomp,项目名称:CruiseControl.NET,代码行数:25,代码来源:ChangePasswordSecurityAction.cs

示例11: Execute

        public IResponse Execute(ICruiseRequest request)
        {
            Hashtable velocityContext = new Hashtable();
            velocityContext["log"] = farmService.GetServerLog(request.ServerSpecifier);

            return viewGenerator.GenerateView(@"ServerLog.vm", velocityContext);
        }
开发者ID:vardars,项目名称:ci-factory,代码行数:7,代码来源:ServerLogServerPlugin.cs

示例12: Execute

 public IResponse Execute(ICruiseRequest cruiseRequest)
 {
     Hashtable velocityContext = new Hashtable();
     string userName = cruiseRequest.Request.GetText("userName");
     string template = @"UserNameLogin.vm";
     if (!string.IsNullOrEmpty(userName))
     {
         try
         {
             LoginRequest credentials = new LoginRequest(userName);
             string password = cruiseRequest.Request.GetText("password");
             if (!string.IsNullOrEmpty(password)) credentials.AddCredential(LoginRequest.PasswordCredential, password);
             string sessionToken = farmService.Login(cruiseRequest.ServerName, credentials);
             if (string.IsNullOrEmpty(sessionToken)) throw new CruiseControlException("Login failed!");
             storer.StoreSessionToken(sessionToken);
             template = "LoggedIn.vm";
         }
         catch (Exception error)
         {
             velocityContext["errorMessage"] = error.Message;
         }
     }
     velocityContext["hidePassword"] = hidePassword;
     return viewGenerator.GenerateView(template, velocityContext);
 }
开发者ID:alexanderyaremchuk,项目名称:CruiseControl.NET,代码行数:25,代码来源:UserNameSecurityAction.cs

示例13: Execute

		public IResponse Execute(ICruiseRequest cruiseRequest)
		{
			DirectoryInfo cctrayPath = new DirectoryInfo(physicalApplicationPathProvider.GetFullPathFor("cctray"));
			if (cctrayPath.Exists)
			{
				FileInfo[] files = cctrayPath.GetFiles("*CCTray*.*");
				if (files.Length == 1)
				{
					return new RedirectResponse("cctray/" + files[0].Name);
				}
                else if (files.Length > 1)
                {
                    StringBuilder installerList = new StringBuilder();
                    installerList.Append(@"<h3>Multiple CCTray installers available</h3>");
                    installerList.Append(@"<p>Choose one of the following CCTray installers:");
                    installerList.Append(@"<ul>");
                    for (int i = 0; i < files.Length; i++)
                    {
                        installerList.Append(@"<li>");
						installerList.Append(@"<a href=""cctray/");
                        installerList.Append(files[i].Name);
                        installerList.Append(@""">");
                        installerList.Append(files[i].Name);
                        installerList.Append(@"</a>");
                        installerList.Append(@"</li>");
                    }
                    installerList.Append(@"</ul>");
                    installerList.Append(@"</p>");
                    return new HtmlFragmentResponse(installerList.ToString());
                }
			}
			return new HtmlFragmentResponse("<h3>Unable to locate CCTray installer at path: " + cctrayPath + "</h3>");
		}
开发者ID:kascomp,项目名称:CruiseControl.NET,代码行数:33,代码来源:CCTrayDownloadAction.cs

示例14: Setup

		public void Setup()
		{
			viewBuilderMock = new DynamicMock(typeof(IDeleteProjectViewBuilder));
			showDeleteProjectAction = new ShowDeleteProjectAction((IDeleteProjectViewBuilder) viewBuilderMock.MockInstance);

			cruiseRequestMock = new DynamicMock(typeof(ICruiseRequest));
			cruiseRequest = (ICruiseRequest) cruiseRequestMock.MockInstance;
		}
开发者ID:kascomp,项目名称:CruiseControl.NET,代码行数:8,代码来源:ShowDeleteProjectActionTest.cs

示例15: Execute

		public IResponse Execute(ICruiseRequest request)
		{
            request.Request.RefreshInterval = RefreshInterval;

            this.projectGridAction.DefaultSortColumn = sortColumn;
            this.projectGridAction.SuccessIndicatorBarLocation = this.SuccessIndicatorBarLocation;
            return projectGridAction.Execute(ACTION_NAME, request.ServerSpecifier, request);
		}
开发者ID:kascomp,项目名称:CruiseControl.NET,代码行数:8,代码来源:ServerReportServerPlugin.cs


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