Convert functions and properties to expression bodies when able (#7312)

Convert functions and properties to expression bodies when able
This commit is contained in:
Cory
2020-02-25 10:08:03 -06:00
committed by GitHub
parent 2f91d99e19
commit 889a8da4e5
136 changed files with 726 additions and 1512 deletions

View File

@@ -1,4 +1,4 @@
using System;
using System;
using System.Diagnostics;
using System.IO;
using System.Linq;
@@ -25,36 +25,19 @@ namespace Jackett.Server.Services
processService = new ProcessService(logger);
}
public bool ServiceExists()
{
return GetService(NAME) != null;
}
public bool ServiceExists() => GetService(NAME) != null;
public bool ServiceRunning()
{
var service = GetService(NAME);
if (service == null)
return false;
return service.Status == ServiceControllerStatus.Running;
}
public bool ServiceRunning() =>
GetService(NAME)?.Status == ServiceControllerStatus.Running;
public void Start()
{
public void Start() => GetService(NAME).Start();
var service = GetService(NAME);
service.Start();
}
public void Stop() => GetService(NAME).Stop();
public void Stop()
{
var service = GetService(NAME);
service.Stop();
}
public ServiceController GetService(string serviceName)
{
return ServiceController.GetServices().FirstOrDefault(c => string.Equals(c.ServiceName, serviceName, StringComparison.InvariantCultureIgnoreCase));
}
public ServiceController GetService(string serviceName) =>
ServiceController
.GetServices()
.FirstOrDefault(c => string.Equals(c.ServiceName, serviceName, StringComparison.InvariantCultureIgnoreCase));
public void Install()
{