private void DeleteEventType(IElement eventType) { // Get the configuration for this source. ManagementObject config = WmiUtil.GetObject(_scope, GetPath(eventType)); if (config != null) { DeleteEventType(config); } }
private void DeleteSource(Source source) { // Get the configuration for this source. ManagementObject config = WmiUtil.GetObject(_scope, GetPath(source)); if (config != null) { DeleteSource(config); } }
private void DeleteNamespace(Namespace ns) { // Get the configuration for this source. ManagementObject config = WmiUtil.GetObject(_scope, GetPath(ns)); if (config != null) { DeleteNamespace(config); } }
private void UpdateEventType(EventType eventType) { // Try to get an existing source. ManagementObject config = WmiUtil.GetObject(_scope, GetPath(eventType)); if (config == null) { // Not found, so create a new instance. config = CreateInstance(Constants.Wmi.EventType.Class); WmiUtil.SetPropertyValue(config, Constants.Wmi.NameProperty, eventType.Name); } // Update the rest of the properties and save. WmiUtil.SetPropertyValue(config, Constants.Wmi.EventType.IsEnabledProperty, eventType.IsEnabled); config.Put(); }
private void UpdateSource(Source source) { // Try to get an existing source. ManagementObject config = WmiUtil.GetObject(_scope, GetPath(source)); if (config == null) { // Not found, so create a new instance. config = CreateInstance(Constants.Wmi.Source.Class); WmiUtil.SetPropertyValue(config, Constants.Wmi.ParentProperty, source.Parent == null ? string.Empty : source.Parent.FullName); WmiUtil.SetPropertyValue(config, Constants.Wmi.NameProperty, source.Name); } // Update the rest of the properties and save. string enabledEvents = JoinString(source.EnabledEvents, Constants.Module.ListSeparator); WmiUtil.SetPropertyValue(config, Constants.Wmi.Source.EnabledEventsProperty, enabledEvents); config.Put(); }