/// <summary>
        /// Harvest a performance category.
        /// </summary>
        /// <param name="category">The name of the performance category.</param>
        /// <returns>A harvested file.</returns>
        public Util.PerformanceCategory HarvestPerformanceCategory(string category)
        {
            if (null == category)
            {
                throw new ArgumentNullException("category");
            }

            if (PerformanceCounterCategory.Exists(category))
            {
                Util.PerformanceCategory perfCategory = new Util.PerformanceCategory();

                // Get the performance counter category and set the appropriate WiX attributes
                PerformanceCounterCategory pcc = PerformanceCounterCategory.GetCategories().Single(c => string.Equals(c.CategoryName, category));
                perfCategory.Id   = this.Core.CreateIdentifierFromFilename(pcc.CategoryName);
                perfCategory.Name = pcc.CategoryName;
                perfCategory.Help = pcc.CategoryHelp;
                if (PerformanceCounterCategoryType.MultiInstance == pcc.CategoryType)
                {
                    perfCategory.MultiInstance = Util.YesNoType.yes;
                }

                // If it's multi-instance, check if there are any instances and get counters from there; else we get
                // the counters straight up. For multi-instance, GetCounters() fails if there are any instances. If there
                // are no instances, then GetCounters(instance) can't be called since there is no instance. Instances
                // will exist for each counter even if only one of the counters was "intialized."
                string[]             instances    = pcc.GetInstanceNames();
                bool                 hasInstances = instances.Length > 0;
                PerformanceCounter[] counters     = hasInstances
                    ? pcc.GetCounters(instances.First())
                    : pcc.GetCounters();

                foreach (PerformanceCounter counter in counters)
                {
                    Util.PerformanceCounter perfCounter = new Util.PerformanceCounter();

                    // Get the performance counter and set the appropriate WiX attributes
                    perfCounter.Name = counter.CounterName;
                    perfCounter.Type = this.CounterTypeToWix(counter.CounterType);
                    perfCounter.Help = counter.CounterHelp;

                    perfCategory.AddChild(perfCounter);
                }

                return(perfCategory);
            }
            else
            {
                throw new WixException(HarvesterErrors.PerformanceCategoryNotFound(category));
            }
        }
        /// <summary>
        /// Harvest a performance category.
        /// </summary>
        /// <param name="argument">The name of the performance category.</param>
        /// <returns>A harvested performance category.</returns>
        public override Wix.Fragment[] Harvest(string argument)
        {
            if (null == argument)
            {
                throw new ArgumentNullException("argument");
            }

            Util.PerformanceCategory perf = this.HarvestPerformanceCategory(argument);

            Wix.Component component = new Wix.Component();
            component.Id      = this.Core.CreateIdentifierFromFilename(argument);
            component.KeyPath = Wix.YesNoType.yes;
            component.AddChild(perf);

            Wix.Directory directory = new Wix.Directory();
            directory.Id = "TARGETDIR";
            //directory.Name = directory.Id;
            directory.AddChild(component);

            Wix.Fragment fragment = new Wix.Fragment();
            fragment.AddChild(directory);

            return(new Wix.Fragment[] { fragment });
        }