Beispiel #1
0
        /// <summary>
        /// Set encrypted param value
        /// </summary>
        /// <param name="paramName">param name</param>
        /// <param name="decryptedString">param value</param>
        public static void SetEncryptedParam(string paramName, string decryptedString)
        {
            var encyptedString = "";

            if (!string.IsNullOrEmpty(paramName))
            {
                // Encrypt
                encyptedString = PasswordUtility.EncryptData(decryptedString, DataProtectionScope.LocalMachine);
            }

            MediaPortalSettings.SetValue(Prefix, paramName, encyptedString);
        }
Beispiel #2
0
        /// <summary>
        /// Get encrypted param as string
        /// </summary>
        /// <param name="paramName">param name</param>
        /// <param name="defaultValue">default value</param>
        /// <returns>param value as string</returns>
        public static string GetEncriptedParamAsString(string paramName, string defaultValue)
        {
            var encriptedString = MediaPortalSettings.GetValueAsString(Prefix, paramName, defaultValue);

            // Decrypt
            string decryptedString = null;

            try
            {
                if (!string.IsNullOrEmpty(encriptedString))
                {
                    decryptedString = PasswordUtility.DecryptData(encriptedString, DataProtectionScope.LocalMachine);
                }
            }
            catch (Exception)
            {
                ;
            }

            return(decryptedString);
        }