示例#1
0
        public static void Uninstall(Type type)
        {
            ChoGuard.ArgumentNotNull(type, "type");

            ChoPerformanceCounterInstallerBuilder builder   = new ChoPerformanceCounterInstallerBuilder(type);
            PerformanceCounterInstaller           installer = builder.CreateInstaller();

            if (PerformanceCounterCategory.Exists(installer.CategoryName))
            {
                PerformanceCounterCategory.Delete(installer.CategoryName);
            }
        }
示例#2
0
        public static bool Install(Type[] types, bool forceCreate)
        {
            ChoGuard.ArgumentNotNull(types, "types");

            ChoPerformanceCounterInstallerBuilder builder   = new ChoPerformanceCounterInstallerBuilder(types);
            PerformanceCounterInstaller           installer = builder.CreateInstaller();

            if (PerformanceCounterCategory.Exists(installer.CategoryName))
            {
                if (forceCreate)
                {
                    PerformanceCounterCategory.Delete(installer.CategoryName);
                }
                else
                {
                    return(false);
                }
            }

            PerformanceCounterCategory.Create(installer.CategoryName, installer.CategoryHelp, installer.CategoryType, installer.Counters);
            return(true);
        }