C# Класс 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

Наследование: IServiceUtils
Показать файл Открыть проект Примеры использования класса

Private Properties

Свойство Тип Описание
CreateProcessInfo System.Diagnostics.ProcessStartInfo

Открытые методы

Метод Описание
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.

Приватные методы

Метод Описание
CreateProcessInfo ( string processArgs ) : ProcessStartInfo

Creates a ProcessStartInfo object using the specified process arguments.

Описание методов

ChangeServiceState() публичный Метод

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.
Результат bool

GetServiceState() публичный Метод

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.
Результат WindowsServiceState

ServiceUtils() публичный Метод

Creates a new instance of the ServiceUtils class.
public ServiceUtils ( ) : System
Результат System

ServiceUtils() публичный Метод

Creates a new instance of the ServiceUtils class.
public ServiceUtils ( IProcessUtils processUtils ) : System
processUtils IProcessUtils A reference to the IProcessUtils for managing processes.
Результат System