private static void PrepareInstallerConfig(Session session) { var dbManagerInstallerDoc = XDocument.Parse(Properties.Resources.AVR_Db_Installation_Settings); SetSetting(dbManagerInstallerDoc, "server_name", session[InstallerProperties.DbServer]); SetSetting(dbManagerInstallerDoc, "database_name", session[InstallerProperties.SqlDatabase]); var adminCryptor = new Utils.CryptorWrapper(session); adminCryptor.EncryptAccountDetails(InstallerProperties.AdminDbUser, InstallerProperties.AdminDbPassword); session[InstallerProperties.EncryptedAdminDbUser] = adminCryptor.ResultUser; session[InstallerProperties.EncryptedAdminDbPassword] = adminCryptor.ResultPassword; SetSetting(dbManagerInstallerDoc, "{user_name}", adminCryptor.ResultUser); SetSetting(dbManagerInstallerDoc, "{user_name_password}", adminCryptor.ResultPassword); SetSetting(dbManagerInstallerDoc, "avr_server_name", session[InstallerProperties.AvrDbServer]); SetSetting(dbManagerInstallerDoc, "avr_database_name", session[InstallerProperties.AvrDatabase]); var avrAdminCryptor = new Utils.CryptorWrapper(session); avrAdminCryptor.EncryptAccountDetails(InstallerProperties.AdminAvrUser, InstallerProperties.AdminAvrPassword); session[InstallerProperties.EncryptedAdminAvrUser] = avrAdminCryptor.ResultUser; session[InstallerProperties.EncryptedAdminAvrPassword] = avrAdminCryptor.ResultPassword; SetSetting(dbManagerInstallerDoc, "{avr_server_user_name}", avrAdminCryptor.ResultUser); SetSetting(dbManagerInstallerDoc, "{avr_server_user_name_password}", avrAdminCryptor.ResultPassword); SetSetting(dbManagerInstallerDoc, "avr_backup_file", session[InstallerProperties.AvrBackup]); var avrDbInstallationSettingsConfig = Path.Combine(session[InstallerProperties.DbManagerFolder], AVRDbInstallationSettingsConfig); session.Log("Saving database installation config {0}", avrDbInstallationSettingsConfig); session[InstallerProperties.AVRDbInstallationSettingsConfig] = avrDbInstallationSettingsConfig; dbManagerInstallerDoc.Save(avrDbInstallationSettingsConfig); }
private static void PrepareDbManagerExeConfig(Session session) { var dbManagerExeConfig = Path.Combine(session[InstallerProperties.DbManagerFolder], DbManagerExeConfig); var dbManagerConfigDoc = XDocument.Load(dbManagerExeConfig); var avrCryptor = new Utils.CryptorWrapper(session); avrCryptor.EncryptAccountDetails(InstallerProperties.AvrUser, InstallerProperties.AvrPassword); AddSetting(dbManagerConfigDoc, "/configuration/appSettings", "AvrDbSQLAccountName", avrCryptor.ResultUser); AddSetting(dbManagerConfigDoc, "/configuration/appSettings", "AvrDbSQLAccountPass", avrCryptor.ResultPassword); session.Log("Saving \"{0}\"", dbManagerExeConfig); dbManagerConfigDoc.Save(dbManagerExeConfig); }