C# Class DevUtils.Service.ServiceUtils

The ServiceUtils type provides an implementation of the IServiceUtils interface that provides utility methods for managing Windows services.

Base project reference: https://github.com/cjaehnen/OpenLib.Utils

Inheritance: IServiceUtils
显示文件 Open project: jornfilho/.net-Dev-Utils Class Usage Examples

Private Properties

Property Type Description
CreateProcessInfo System.Diagnostics.ProcessStartInfo

Public Methods

Method Description
ChangeServiceState ( string host, string serviceName, WindowsServiceAction action ) : bool

Changes the state of the specified Windows service using the specified action.

GetServiceState ( string host, string serviceName ) : WindowsServiceState

Gets the state of the specified Windows service on the specified host.

ServiceUtils ( ) : System

Creates a new instance of the ServiceUtils class.

ServiceUtils ( IProcessUtils processUtils ) : System

Creates a new instance of the ServiceUtils class.

Private Methods

Method Description
CreateProcessInfo ( string processArgs ) : ProcessStartInfo

Creates a ProcessStartInfo object using the specified process arguments.

Method Details

ChangeServiceState() public method

Changes the state of the specified Windows service using the specified action.
public ChangeServiceState ( string host, string serviceName, WindowsServiceAction action ) : bool
host string The name of the host to connect to where the Windows service resides.
serviceName string The name of the Windows service.
action WindowsServiceAction The action in which to perform on the Windows service.
return bool

GetServiceState() public method

Gets the state of the specified Windows service on the specified host.
public GetServiceState ( string host, string serviceName ) : WindowsServiceState
host string The name of the host to connect to where the Windows service resides.
serviceName string The name of the Windows service.
return WindowsServiceState

ServiceUtils() public method

Creates a new instance of the ServiceUtils class.
public ServiceUtils ( ) : System
return System

ServiceUtils() public method

Creates a new instance of the ServiceUtils class.
public ServiceUtils ( IProcessUtils processUtils ) : System
processUtils IProcessUtils A reference to the IProcessUtils for managing processes.
return System