Exemple #1
0
        /// <summary>
        /// 系統管理員賬戶密碼 寫入臨時文件 (密碼已加密)
        /// </summary>
        public static void WriteAdminInfoToTempAdminTxt()
        {
            try
            {
                var temp = GetUVncTempAdminTxt();
                if (string.IsNullOrWhiteSpace(temp))
                {
                    return;
                }

                var    passdes = DESEncryptHelper.Encrypt(AdminPasswd);
                string txt     = AdminUser + "," + passdes + Environment.NewLine;
                File.WriteAllText(temp, txt);
            }
            catch (Exception)
            {
                return;
            }
        }
Exemple #2
0
        /// <summary>
        /// 從當前用戶 temp 文件夾裡 獲取 保存的臨時加密的 管理員賬戶密碼,
        /// </summary>
        private static void LoadAdminPasswdInUserTempFile()
        {
            try
            {
                var temp = GetUVncTempAdminTxt();
                if (!File.Exists(temp))
                {
                    return;
                }

                var txt = File.ReadAllText(temp);
                if (!string.IsNullOrWhiteSpace(txt))
                {
                    var strs = txt.Split(',');
                    AdminUser   = strs[0].Trim();
                    AdminPasswd = DESEncryptHelper.Decrypt(strs[1].Trim());
                    return;
                }
            }
            catch (Exception)
            {
                return;
            }
        }