private bool IsServiceEnabled(string serviceName) { if (String.IsNullOrWhiteSpace(serviceName)) { throw new ArgumentNullException(nameof(serviceName)); } using (var service = new ServiceEditor(serviceName)) { return(service.IsServiceEnabled()); } }
public bool IsServiceEnabled(string serviceName) { if (string.IsNullOrWhiteSpace(serviceName)) { throw new ArgumentNullException(nameof(serviceName)); } var serviceDllPath = GetServiceDllPath(serviceName); using (var service = new ServiceEditor(serviceName)) { return(service.IsServiceEnabled() && (String.IsNullOrEmpty(serviceDllPath) || File.Exists(serviceDllPath))); } }