/// <summary> /// Returns the profile associated with the key, or null if no such profile exists. /// </summary> /// <param name="key">The name of the registry key to define the profile under.</param> /// <returns></returns> public DestinationProfile loadProfile(String key) { SettingsPersisterHelper settings = getProfileSettings(key); if (settings.GetNames().Length == 0) { return(null); } DestinationProfile profile = new DestinationProfile(); profile.Id = key; profile.Name = settings.GetString(PROFILE_NAME_KEY, ""); profile.WebsiteURL = settings.GetString(PROFILE_WEBSITE_URL_KEY, ""); profile.FtpServer = settings.GetString(PROFILE_FTP_SERVER_KEY, ""); profile.UserName = settings.GetString(PROFILE_FTP_USER_KEY, ""); profile.FtpPublishPath = settings.GetString(PROFILE_FTP_PUBLISH_DIR_KEY, ""); profile.LocalPublishPath = settings.GetString(PROFILE_PUBLISH_DIR_KEY, ""); profile.Type = (DestinationProfile.DestType)settings.GetInt32(PROFILE_DESTINATION_TYPE_KEY, 0); //load the decrypted password try { profile.Password = settings.GetEncryptedString(PROFILE_FTP_PASSWORD_KEY); } catch (Exception e) { Trace.Fail("Failed to decrypt password: " + e); } return(profile); }