Bespoke.DynamicDnsUpdater.WindowsServiceInstallerCustomActions.CustomActions.UpdateAppConfig C# (CSharp) Метод

UpdateAppConfig() приватный Метод

private UpdateAppConfig ( Microsoft.Deployment.WindowsInstaller.Session session ) : ActionResult
session Microsoft.Deployment.WindowsInstaller.Session
Результат ActionResult
        public static ActionResult UpdateAppConfig(Session session)
        {
            //We only update the app config when its destination path has been provided
            //as well as the DNS-O-Matic settings
            if (!string.IsNullOrWhiteSpace(session.CustomActionData["INSTALLDIR"]))
            {
                var dnsClientType = GetDnsClientType(session);

                string targetDir = session.CustomActionData["INSTALLDIR"];

                const string applicationName = "Bespoke.DynamicDnsUpdater.WindowsService.exe";
                var exePath = System.IO.Path.Combine(targetDir, applicationName);

                //var exePath = targetDir + @"\" + applicationName;
                var config = ConfigurationManager.OpenExeConfiguration(exePath);

                //Parameters are passed from the Installer
                //otherwise we'll assume the values are already in the config file.

                SetDnsClientTypeId(session, config);

                SetHostnames(session, config);

                if (dnsClientType == DynamicDnsUpdaterClientType.Route53)
                {
                    SetAccessKeyId(session, config, dnsClientType);
                    SetSecretAccessKey(session, config, dnsClientType);
                }
                else
                {
                    SetUsername(session, dnsClientType, config);
                    SetPassword(session, config, dnsClientType);
                }

                config.Save(ConfigurationSaveMode.Modified);
            }

            return ActionResult.Success;
        }