/// <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 = new PerformanceCounterCategory(category); perfCategory.Id = CompilerCore.GetIdentifierFromName(pcc.CategoryName); perfCategory.Name = pcc.CategoryName; perfCategory.Help = pcc.CategoryHelp; if (PerformanceCounterCategoryType.MultiInstance == pcc.CategoryType) { perfCategory.MultiInstance = Util.YesNoType.yes; } foreach (InstanceDataCollection counter in pcc.ReadCategory().Values) { Util.PerformanceCounter perfCounter = new Util.PerformanceCounter(); // Get the performance counter and set the appropriate WiX attributes PerformanceCounter pc = new PerformanceCounter(pcc.CategoryName, counter.CounterName); perfCounter.Name = pc.CounterName; perfCounter.Type = CounterTypeToWix(pc.CounterType); perfCounter.Help = pc.CounterHelp; perfCategory.AddChild(perfCounter); } return(perfCategory); } else { throw new WixException(UtilErrors.PerformanceCategoryNotFound(category)); } }
/// <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 = new PerformanceCounterCategory(category); perfCategory.Id = CompilerCore.GetIdentifierFromName(pcc.CategoryName); perfCategory.Name = pcc.CategoryName; perfCategory.Help = pcc.CategoryHelp; if (PerformanceCounterCategoryType.MultiInstance == pcc.CategoryType) { perfCategory.MultiInstance = Util.YesNoType.yes; } foreach (InstanceDataCollection counter in pcc.ReadCategory().Values) { Util.PerformanceCounter perfCounter = new Util.PerformanceCounter(); // Get the performance counter and set the appropriate WiX attributes PerformanceCounter pc = new PerformanceCounter(pcc.CategoryName, counter.CounterName); perfCounter.Name = pc.CounterName; perfCounter.Type = CounterTypeToWix(pc.CounterType); perfCounter.Help = pc.CounterHelp; perfCategory.AddChild(perfCounter); } return perfCategory; } else { throw new WixException(UtilErrors.PerformanceCategoryNotFound(category)); } }