ProjectBuild.cs :  » Build-Systems » CruiseControl.NET » ThoughtWorks » CruiseControl » Remote » Monitor » C# / CSharp Open Source

Home
C# / CSharp Open Source
1.2.6.4 mono .net core
2.2.6.4 mono core
3.Aspect Oriented Frameworks
4.Bloggers
5.Build Systems
6.Business Application
7.Charting Reporting Tools
8.Chat Servers
9.Code Coverage Tools
10.Content Management Systems CMS
11.CRM ERP
12.Database
13.Development
14.Email
15.Forum
16.Game
17.GIS
18.GUI
19.IDEs
20.Installers Generators
21.Inversion of Control Dependency Injection
22.Issue Tracking
23.Logging Tools
24.Message
25.Mobile
26.Network Clients
27.Network Servers
28.Office
29.PDF
30.Persistence Frameworks
31.Portals
32.Profilers
33.Project Management
34.RSS RDF
35.Rule Engines
36.Script
37.Search Engines
38.Sound Audio
39.Source Control
40.SQL Clients
41.Template Engines
42.Testing
43.UML
44.Web Frameworks
45.Web Service
46.Web Testing
47.Wiki Engines
48.Windows Presentation Foundation
49.Workflows
50.XML Parsers
C# / C Sharp
C# / C Sharp by API
C# / CSharp Tutorial
C# / CSharp Open Source » Build Systems » CruiseControl.NET 
CruiseControl.NET » ThoughtWorks » CruiseControl » Remote » Monitor » ProjectBuild.cs
using System;
using System.Collections.Generic;
using System.Text;
using System.Globalization;

namespace ThoughtWorks.CruiseControl.Remote.Monitor{
    /// <summary>
    /// Details on a build for a project.
    /// </summary>
    public class ProjectBuild
    {
        #region Private fields
        private readonly CruiseServerClientBase client;
        private readonly Project project;
        private readonly string name;
        private string log;
        #endregion

        #region Constructors
        /// <summary>
        /// Initialise a new project build entity.
        /// </summary>
        /// <param name="buildName">The name of the build.</param>
        /// <param name="project">The project this build belongs to.</param>
        /// <param name="client">The underlying client.</param>
        public ProjectBuild(string buildName, Project project, CruiseServerClientBase client)
        {
            this.name = buildName;
            this.project = project;
            this.client = client;

            // Parse the name for the details
            BuildDate = DateTime.ParseExact(name.Substring(3, 14), "yyyyMMddHHmmss", CultureInfo.InvariantCulture);
            IsSuccessful = (name.Substring(17, 1) == "L");
            if (IsSuccessful)
            {
                var startPos = name.IndexOf("build.", StringComparison.InvariantCultureIgnoreCase) + 6;
                var endPos = name.LastIndexOf('.');
                Label = name.Substring(startPos, endPos - startPos);
            }
        }
        #endregion

        #region Public properties
        #region Name
        /// <summary>
        /// The name of the build.
        /// </summary>
        public string Name
        {
            get { return name; }
        }
        #endregion

        #region Log
        /// <summary>
        /// The log for the build.
        /// </summary>
        /// <remarks>
        /// This property uses lazy loading to retrieve the log from the server.
        /// </remarks>
        public string Log
        {
            get
            {
                if (string.IsNullOrEmpty(log))
                {
                    client.ProcessSingleAction<object>(o =>
                    {
                        log = client.GetLog(project.Name, name);
                    }, null);
                }
                return log;
            }
        }
        #endregion

        #region BuildDate
        /// <summary>
        /// The date and time of the build.
        /// </summary>
        public DateTime BuildDate { get; private set; }
        #endregion

        #region Label
        /// <summary>
        /// The label of the build.
        /// </summary>
        public string Label { get; private set; }
        #endregion

        #region IsSuccessful
        /// <summary>
        /// Was the build successful or not.
        /// </summary>
        public bool IsSuccessful { get; private set; }
        #endregion
        #endregion
    }
}
www.java2v.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.