コード例 #1
0
        /// <summary>
        /// This method saves the current settings back to the app.config file.
        /// </summary>
        public void SaveLoginInformation(string applicationUserName, string applicationPassword, bool savePassword)
        {
            // first check if save password is true or not
            if (!savePassword)
            {
                // set password to null
                applicationPassword = null;
            }

            // Encrypt Each Property
            string encryptedPassword     = CryptographyHelper.EncryptString(applicationPassword);
            string encryptedUserName     = CryptographyHelper.EncryptString(applicationUserName);
            string encryptedSavePassword = CryptographyHelper.EncryptString(savePassword.ToString());

            // Save Login Information
            this.UpdateKey("ApplicationPassword", encryptedPassword);
            this.UpdateKey("ApplicationUserName", encryptedUserName);
            this.UpdateKey("SavePassword", encryptedSavePassword);
        }