From bfcdf25f7212f451ca3dea0dde58457965b97e14 Mon Sep 17 00:00:00 2001 From: Kobus-Smit Date: Thu, 12 Mar 2015 12:55:50 +1100 Subject: [PATCH] Made Password writable in BeforeInstall I want to modify the Password in the BeforeInstall event. Just making it writable as suggested did not work because HostServiceInstaller is created with command line passed Password already and then only the BeforeInstall is called. So it is too late to just set the new Password in BeforeInstall? See https://groups.google.com/forum/#!topic/topshelf-discuss/4iBCSS0WW4c --- src/Topshelf/Configuration/Credentials.cs | 2 +- src/Topshelf/Hosts/InstallHost.cs | 1 + src/Topshelf/Runtime/InstallHostSettings.cs | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Topshelf/Configuration/Credentials.cs b/src/Topshelf/Configuration/Credentials.cs index a5817972..1cce673f 100644 --- a/src/Topshelf/Configuration/Credentials.cs +++ b/src/Topshelf/Configuration/Credentials.cs @@ -25,7 +25,7 @@ public Credentials(string username, string password, ServiceAccount account) } public string Username { get; private set; } - public string Password { get; private set; } + public string Password { get; set; } public ServiceAccount Account { get; private set; } } } \ No newline at end of file diff --git a/src/Topshelf/Hosts/InstallHost.cs b/src/Topshelf/Hosts/InstallHost.cs index 474e1ff4..4402cd62 100644 --- a/src/Topshelf/Hosts/InstallHost.cs +++ b/src/Topshelf/Hosts/InstallHost.cs @@ -192,6 +192,7 @@ public string Username public string Password { get { return _credentials.Password; } + set { _credentials.Password = value; } } public string[] Dependencies diff --git a/src/Topshelf/Runtime/InstallHostSettings.cs b/src/Topshelf/Runtime/InstallHostSettings.cs index d0e5ee41..550561ec 100644 --- a/src/Topshelf/Runtime/InstallHostSettings.cs +++ b/src/Topshelf/Runtime/InstallHostSettings.cs @@ -20,7 +20,7 @@ public interface InstallHostSettings : ServiceAccount Account { get; } string Username { get; } - string Password { get;} + string Password { get; set; } string[] Dependencies { get; }