Esempio n. 1
0
        //-------------------------------------------------------------------------

        // Returns stats provider for the specified tag, use null for all stats.

        public IBuildStatsProvider GetStats(string tag = null)
        {
            if (tag == null)
            {
                tag = "All";
            }

            BuildTag tagOb = BuildTag.GetTag(tag, false);

            if (tagOb == null)
            {
                return(null);
            }

            if (Stats.ContainsKey(tagOb))
            {
                return(Stats[tagOb]);
            }

            return(null);
        }
Esempio n. 2
0
        //-------------------------------------------------------------------------

        public void AddBuild(
            DateTime start,
            DateTime?end,
            string[] tags)
        {
            // Create new stats object.
            BuildStats stats = new BuildStats(start, end);

            // Include these stats under the 'all' tag.
            stats.AddTag(AllBuilds);

            // Add the tags to the stats object.
            foreach (string t in tags)
            {
                // 'All' is reserved.
                if (t.ToLower() == "all")
                {
                    throw new Exception("The tag 'all' is reserved for internal use.");
                }

                // Add the tag to the stats.
                BuildTag tag = BuildTag.GetTag(t);
                stats.AddTag(tag);
            }

            // Add build to the relevant tags' build collection.
            foreach (BuildTag tag in stats.GetTags())
            {
                if (Stats.ContainsKey(tag) == false)
                {
                    Stats.Add(tag, new BuildStatsCollection());
                }

                Stats[tag].AddStats(stats);
            }
        }