using CompressorXN.Untils; using CompressorXN_Common; using Custom.Utils.Framework; using System; using System.Windows.Forms; namespace CompressorXN { public partial class FrmModifyPwd : Form { public FrmModifyPwd() { InitializeComponent(); } private void btn_Confirm_Click(object sender, EventArgs e) { string oldPwd = txt_OldPwd.Text; if (string.IsNullOrEmpty(oldPwd)) { new FrmDialog("请输入原密码!").ShowDialog(); return; } string secretKey = DesHelper.EncryptStringToBytes_Aes(oldPwd); string unlockPwd = IniHelper.Read("UnlockPwd", "UserPwd", "", GlobalVar.IniFilePath); if (secretKey != unlockPwd) { new FrmDialog("原密码输入错误!").ShowDialog(); return; } string newPwd = txt_NewPwd.Text; if (string.IsNullOrEmpty(newPwd)) { new FrmDialog("请输入新密码!").ShowDialog(); return; } string confirmPwd = txt_ConfirmPwd.Text; if (newPwd != confirmPwd) { new FrmDialog("新密码与确认密码不一致!").ShowDialog(); return; } string newSecretKey = DesHelper.EncryptStringToBytes_Aes(newPwd); int row = IniHelper.Write("UnlockPwd", "UserPwd", newSecretKey, GlobalVar.IniFilePath); if (row != 0) { new FrmDialog("操作成功!").ShowDialog(); } else { new FrmDialog("操作失败!").ShowDialog(); } } } }