From 701df80d4f9e624398431e8abeb712546aba4a2c Mon Sep 17 00:00:00 2001 From: PeterKottas Date: Thu, 29 Dec 2016 07:58:05 +0100 Subject: [PATCH] Added option api to change service description and display name via configurator --- .../HostConfigurator.cs | 21 ++++++++++++++++++- ...terKottas.DotNetCore.WindowsService.nuspec | 2 +- .../ServiceRunner.cs | 2 +- 3 files changed, 22 insertions(+), 3 deletions(-) diff --git a/Source/PeterKottas.DotNetCore.WindowsService/HostConfigurator.cs b/Source/PeterKottas.DotNetCore.WindowsService/HostConfigurator.cs index 9c339f4..8dde8ec 100644 --- a/Source/PeterKottas.DotNetCore.WindowsService/HostConfigurator.cs +++ b/Source/PeterKottas.DotNetCore.WindowsService/HostConfigurator.cs @@ -17,7 +17,26 @@ public HostConfigurator(HostConfiguration innerConfig) public void SetName(string serviceName) { - innerConfig.Name = serviceName; + if (string.IsNullOrEmpty(innerConfig.Name)) + { + innerConfig.Name = serviceName; + } + } + + public void SetDisplayName(string displayName) + { + if (string.IsNullOrEmpty(innerConfig.DisplayName)) + { + innerConfig.DisplayName = displayName; + } + } + + public void SetDescription(string description) + { + if (string.IsNullOrEmpty(innerConfig.Description)) + { + innerConfig.Description = description; + } } public string GetDefaultName() diff --git a/Source/PeterKottas.DotNetCore.WindowsService/PeterKottas.DotNetCore.WindowsService.nuspec b/Source/PeterKottas.DotNetCore.WindowsService/PeterKottas.DotNetCore.WindowsService.nuspec index dfcd948..fa7598a 100644 --- a/Source/PeterKottas.DotNetCore.WindowsService/PeterKottas.DotNetCore.WindowsService.nuspec +++ b/Source/PeterKottas.DotNetCore.WindowsService/PeterKottas.DotNetCore.WindowsService.nuspec @@ -3,7 +3,7 @@ PeterKottas.DotNetCore.WindowsService PeterKottas.DotNetCore.WindowsService - 1.0.2 + 1.0.3 Peter Kottas Easiest to use library that allows one to host .net core as windows services there is. .NET Core Windows service diff --git a/Source/PeterKottas.DotNetCore.WindowsService/ServiceRunner.cs b/Source/PeterKottas.DotNetCore.WindowsService/ServiceRunner.cs index bc7351d..a7be663 100644 --- a/Source/PeterKottas.DotNetCore.WindowsService/ServiceRunner.cs +++ b/Source/PeterKottas.DotNetCore.WindowsService/ServiceRunner.cs @@ -68,7 +68,7 @@ public static int Run(Action> runAction) config.AddParameter(new CmdArgParam() { Key = "action", - Description = "Installs the service. It's run like console application othrwise", + Description = "Installs the service. It's run like console application otherwise", Value = val => { switch (val)