@ -15,7 +15,6 @@ namespace NzbDrone.Common
void Install ( string serviceName ) ;
void UnInstall ( string serviceName ) ;
void Run ( ServiceBase service ) ;
ServiceController GetService ( string serviceName ) ;
void Stop ( string serviceName ) ;
void Start ( string serviceName ) ;
}
@ -26,7 +25,7 @@ namespace NzbDrone.Common
private static readonly Logger Logger = LogManager . GetCurrentClassLogger ( ) ;
public virtual bool ServiceExist ( string name )
public bool ServiceExist ( string name )
{
Logger . Debug ( "Checking if service {0} exists." , name ) ;
return
@ -34,7 +33,7 @@ namespace NzbDrone.Common
s = > String . Equals ( s . ServiceName , name , StringComparison . InvariantCultureIgnoreCase ) ) ;
}
public virtual bool IsServiceRunning ( string name )
public bool IsServiceRunning ( string name )
{
Logger . Debug ( "Checking if '{0}' service is running" , name ) ;
@ -42,13 +41,13 @@ namespace NzbDrone.Common
. SingleOrDefault ( s = > String . Equals ( s . ServiceName , name , StringComparison . InvariantCultureIgnoreCase ) ) ;
return service ! = null & & (
service . Status ! = ServiceControllerStatus . Stopped | |
service . Status = = ServiceControllerStatus . StopPending | |
service . Status = = ServiceControllerStatus . Paused | |
service . Status ! = ServiceControllerStatus . Stopped | |
service . Status = = ServiceControllerStatus . StopPending | |
service . Status = = ServiceControllerStatus . Paused | |
service . Status = = ServiceControllerStatus . PausePending ) ;
}
public v irtual v oid Install ( string serviceName )
public v oid Install ( string serviceName )
{
Logger . Info ( "Installing service '{0}'" , serviceName ) ;
@ -77,7 +76,7 @@ namespace NzbDrone.Common
Logger . Info ( "Service Has installed successfully." ) ;
}
public v irtual v oid UnInstall ( string serviceName )
public v oid UnInstall ( string serviceName )
{
Logger . Info ( "Uninstalling {0} service" , serviceName ) ;
@ -93,17 +92,17 @@ namespace NzbDrone.Common
Logger . Info ( "{0} successfully uninstalled" , serviceName ) ;
}
public v irtual v oid Run ( ServiceBase service )
public v oid Run ( ServiceBase service )
{
ServiceBase . Run ( service ) ;
}
public virtual ServiceController GetService ( string serviceName )
public ServiceController GetService ( string serviceName )
{
return ServiceController . GetServices ( ) . FirstOrDefault ( c = > String . Equals ( c . ServiceName , serviceName , StringComparison . InvariantCultureIgnoreCase ) ) ;
}
public v irtual v oid Stop ( string serviceName )
public v oid Stop ( string serviceName )
{
Logger . Info ( "Stopping {0} Service..." , serviceName ) ;
var service = GetService ( serviceName ) ;
@ -136,7 +135,7 @@ namespace NzbDrone.Common
}
}
public v irtual v oid Start ( string serviceName )
public v oid Start ( string serviceName )
{
Logger . Info ( "Starting {0} Service..." , serviceName ) ;
var service = GetService ( serviceName ) ;