Example #1
0
 private bool IsServiceEnabled(string serviceName)
 {
     if (String.IsNullOrWhiteSpace(serviceName))
     {
         throw new ArgumentNullException(nameof(serviceName));
     }
     using (var service = new ServiceEditor(serviceName))
     {
         return(service.IsServiceEnabled());
     }
 }
Example #2
0
        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)));
            }
        }