diff --git a/MSIPackaging/Properties/AssemblyInfo.cs b/MSIPackaging/Properties/AssemblyInfo.cs index 816d128..910b7b1 100644 --- a/MSIPackaging/Properties/AssemblyInfo.cs +++ b/MSIPackaging/Properties/AssemblyInfo.cs @@ -32,5 +32,5 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.4.1.0")] -[assembly: AssemblyFileVersion("1.4.1.0")] +[assembly: AssemblyVersion("1.4.2.0")] +[assembly: AssemblyFileVersion("1.4.2.0")] diff --git a/MSIPackaging/Script.cs b/MSIPackaging/Script.cs index 4e7480d..a82a5c8 100644 --- a/MSIPackaging/Script.cs +++ b/MSIPackaging/Script.cs @@ -37,7 +37,7 @@ static public void Main(string[] args) } ); project.GUID = new Guid("bb0a8e11-24a8-4d7e-a7d6-6fc5bd8166d2"); - project.Version = Version.Parse("1.4.1"); + project.Version = Version.Parse("1.4.2"); project.LicenceFile = path + @"\MSIPackaging\Resources\gpl-3.0.rtf"; project.BannerImage = path + @"\MSIPackaging\Resources\banner.png"; project.BackgroundImage = path + @"\MSIPackaging\Resources\background.png"; diff --git a/WinCertes/CertesWrapper.cs b/WinCertes/CertesWrapper.cs index 5153706..b0e02dc 100644 --- a/WinCertes/CertesWrapper.cs +++ b/WinCertes/CertesWrapper.cs @@ -51,10 +51,10 @@ private void InitCertes() /// /// The ACME service URI (endin in /directory). If null, defaults to Let's encrypt /// The email address to be registered within the ACME account. If null, no email will be used - public CertesWrapper(int extra = -1, string serviceUri = null, string accountEmail = null) + public CertesWrapper(IConfig config, string serviceUri = null, string accountEmail = null) { _settings = new CertesSettings(); - _config = new RegistryConfig(extra); + _config = config; // Let's initialize the password PfxPassword = Guid.NewGuid().ToString("N").Substring(0, 16); diff --git a/WinCertes/Config/IConfig.cs b/WinCertes/Config/IConfig.cs index b41f0cd..2c036d4 100644 --- a/WinCertes/Config/IConfig.cs +++ b/WinCertes/Config/IConfig.cs @@ -3,7 +3,7 @@ /// /// Interface to Configuration Engine /// - interface IConfig + public interface IConfig { /// /// Deletes parameter from configuration diff --git a/WinCertes/Config/RegistryConfig.cs b/WinCertes/Config/RegistryConfig.cs index 0f4ad67..d1497e7 100644 --- a/WinCertes/Config/RegistryConfig.cs +++ b/WinCertes/Config/RegistryConfig.cs @@ -9,12 +9,12 @@ namespace WinCertes /// /// Configuration class, managing WinCertes configuration into Windows Registry /// - class RegistryConfig : IConfig + public class RegistryConfig : IConfig { private static readonly ILogger _logger = LogManager.GetLogger("WinCertes.WinCertesOptions"); - private static string _registryKey = @"HKEY_LOCAL_MACHINE\SOFTWARE\WinCertes"; - private static string _subKey = @"Software\WinCertes"; + private string _registryKey = @"HKEY_LOCAL_MACHINE\SOFTWARE\WinCertes"; + private string _subKey = @"Software\WinCertes"; /// /// Class constructor. if extra = false, builds the base config. if extra = true, builds the extra certificate config. @@ -225,6 +225,11 @@ public void DeleteAllParameters() { Registry.LocalMachine.OpenSubKey(_subKey, true).DeleteSubKeyTree("extra"); } + for (int i = 2; i < 10; i++) + { + if (Registry.LocalMachine.OpenSubKey("SOFTWARE").OpenSubKey("WinCertes").OpenSubKey("extra" + i) != null) + Registry.LocalMachine.OpenSubKey(_subKey, true).DeleteSubKeyTree("extra" + i); + } foreach (string key in Registry.LocalMachine.OpenSubKey(_subKey).GetValueNames()) { DeleteParameter(key); diff --git a/WinCertes/Program.cs b/WinCertes/Program.cs index 3fc2d47..eca715c 100644 --- a/WinCertes/Program.cs +++ b/WinCertes/Program.cs @@ -300,10 +300,10 @@ private static void RegisterCertificateIntoConfiguration(X509Certificate2 certif /// /// the ACME service URI /// the email account used to register - private static void InitCertesWrapper(int extra, string serviceUri, string email) + private static void InitCertesWrapper(IConfig config, string serviceUri, string email) { // We get the CertesWrapper object, that will do most of the job. - _certesWrapper = new CertesWrapper(extra, serviceUri, email); + _certesWrapper = new CertesWrapper(config, serviceUri, email); // If local computer's account isn't registered on the ACME service, we'll do it. if (!_certesWrapper.IsAccountRegistered()) @@ -354,7 +354,7 @@ static int Main(string[] args) // Initialization and renewal/revocation handling try { - InitCertesWrapper(_extra, _winCertesOptions.ServiceUri, _winCertesOptions.Email); + InitCertesWrapper(_config, _winCertesOptions.ServiceUri, _winCertesOptions.Email); } catch (Exception e) { _logger.Error(e.Message); return ERROR; } if (_winCertesOptions.Revoke > -1) { RevokeCert(_domains, _winCertesOptions.Revoke); return 0; } diff --git a/WinCertes/Properties/AssemblyInfo.cs b/WinCertes/Properties/AssemblyInfo.cs index 80f24da..295afee 100644 --- a/WinCertes/Properties/AssemblyInfo.cs +++ b/WinCertes/Properties/AssemblyInfo.cs @@ -32,5 +32,5 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.4.1.0")] -[assembly: AssemblyFileVersion("1.4.1.0")] +[assembly: AssemblyVersion("1.4.2.0")] +[assembly: AssemblyFileVersion("1.4.2.0")]