mirror of https://github.com/winsw/winsw
Make `<name>` and `<description>` optional
parent
1b2365a99a
commit
cd951e69df
|
@ -39,10 +39,16 @@ All options in other sections are optional
|
|||
|
||||
<!-- ID of the service. It should be unique accross the Windows system-->
|
||||
<id>myapp</id>
|
||||
|
||||
<!-- Display name of the service -->
|
||||
<!--
|
||||
<name>MyApp Service (powered by WinSW)</name>
|
||||
-->
|
||||
|
||||
<!-- Service description -->
|
||||
<!--
|
||||
<description>This service is a service created from a sample configuration</description>
|
||||
-->
|
||||
|
||||
<!-- Path to the executable, which should be started -->
|
||||
<executable>%BASE%\myExecutable.exe</executable>
|
||||
|
|
|
@ -36,10 +36,6 @@
|
|||
|
||||
<!-- ID of the service. It should be unique across the Windows system-->
|
||||
<id>myapp</id>
|
||||
<!-- Display name of the service -->
|
||||
<name>MyApp Service (powered by WinSW)</name>
|
||||
<!-- Service description -->
|
||||
<description>This service is a service created from a minimal configuration</description>
|
||||
|
||||
<!-- Path to the executable, which should be started -->
|
||||
<!-- CAUTION: Don't put arguments here. Use <arguments> instead. -->
|
||||
|
|
|
@ -14,9 +14,9 @@ namespace WinSW.Configuration
|
|||
{
|
||||
public string Id => throw new InvalidOperationException(nameof(this.Id) + " must be specified.");
|
||||
|
||||
public string Caption => throw new InvalidOperationException(nameof(this.Caption) + " must be specified.");
|
||||
public string Caption => string.Empty;
|
||||
|
||||
public string Description => throw new InvalidOperationException(nameof(this.Description) + " must be specified.");
|
||||
public string Description => string.Empty;
|
||||
|
||||
public string Executable => throw new InvalidOperationException(nameof(this.Executable) + " must be specified.");
|
||||
|
||||
|
|
|
@ -557,9 +557,9 @@ namespace WinSW
|
|||
|
||||
public string Id => this.SingleElement("id");
|
||||
|
||||
public string Caption => this.SingleElement("name");
|
||||
public string Caption => this.SingleElement("name", true) ?? Defaults.Caption;
|
||||
|
||||
public string Description => this.SingleElement("description");
|
||||
public string Description => this.SingleElement("description", true) ?? Defaults.Description;
|
||||
|
||||
/// <summary>
|
||||
/// Start mode of the Service
|
||||
|
|
|
@ -18,8 +18,6 @@ namespace WinSW.Tests.Configuration
|
|||
ServiceDescriptor desc = Load("complete");
|
||||
|
||||
Assert.Equal("myapp", desc.Id);
|
||||
Assert.Equal("MyApp Service (powered by WinSW)", desc.Caption);
|
||||
Assert.Equal("This service is a service created from a sample configuration", desc.Description);
|
||||
Assert.Equal("%BASE%\\myExecutable.exe", desc.Executable);
|
||||
|
||||
ServiceDescriptorAssert.AssertAllOptionalPropertiesAreDefault(desc);
|
||||
|
@ -31,8 +29,6 @@ namespace WinSW.Tests.Configuration
|
|||
ServiceDescriptor desc = Load("minimal");
|
||||
|
||||
Assert.Equal("myapp", desc.Id);
|
||||
Assert.Equal("MyApp Service (powered by WinSW)", desc.Caption);
|
||||
Assert.Equal("This service is a service created from a minimal configuration", desc.Description);
|
||||
Assert.Equal("%BASE%\\myExecutable.exe", desc.Executable);
|
||||
|
||||
ServiceDescriptorAssert.AssertAllOptionalPropertiesAreDefault(desc);
|
||||
|
|
|
@ -54,8 +54,6 @@ namespace WinSW.Tests.Util
|
|||
{
|
||||
var properties = AllProperties;
|
||||
properties.Remove("Id");
|
||||
properties.Remove("Caption");
|
||||
properties.Remove("Description");
|
||||
properties.Remove("Executable");
|
||||
return properties;
|
||||
}
|
||||
|
|
|
@ -378,7 +378,11 @@ namespace WinSW
|
|||
username,
|
||||
password);
|
||||
|
||||
sc.SetDescription(descriptor.Description);
|
||||
string description = descriptor.Description;
|
||||
if (description.Length != 0)
|
||||
{
|
||||
sc.SetDescription(description);
|
||||
}
|
||||
|
||||
SC_ACTION[] actions = descriptor.FailureActions;
|
||||
if (actions.Length > 0)
|
||||
|
|
Loading…
Reference in New Issue