Exemplo n.º 1
0
 private void button1_Click(object sender, EventArgs e)
 {
     //保存信息
     if (this.txtOperatePassword.Text.Trim() == "")
     {
         MessageBox.Show("请输入操作密码!", "天大天科", MessageBoxButtons.AbortRetryIgnore);
         return;
     }
     if (txtOperatePassword.Text == "tdtk")
     {
         //config配置
         AppConfig.SaveValue("Config", "IsConfigruation", "1");
         AppConfig.SaveValue("Config", "DBName", txtDBName.Text.Trim());
         AppConfig.SaveValue("Config", "DBServer", txtDBServer.Text.Trim());
         AppConfig.SaveValue("Config", "DBUserName", txtDBUserName.Text.Trim());
         AppConfig.SaveValue("Config", "DBPassWd", CryptDes.EncryptDES(txtPassWd.Text, "EncryDes"));
         //led配置
         AppConfig.SaveValue("LED", "ISConfigruation", "2");
         AppConfig.SaveValue("LED", "ComPort", comboBox1.Text);        //串口通讯: 计算机串口号
         AppConfig.SaveValue("LED", "Baudrate", txt_ComBaudRate.Text); //波特率串口通讯: 通讯速率
         AppConfig.SaveValue("LED", "LedWidth", txt_LedWidth.Text);    //区域宽
         AppConfig.SaveValue("LED", "LedHeight", txt_ledHeght.Text);   //区域高
         AppConfig.SaveValue("LED", "CharColor", txt_CharColor.Text);  //文字颜色
         AppConfig.SaveValue("LED", "Title", this.txtTitle.Text.Trim());
         AppConfig.SaveValue("LED", "X", this.txtX.Text.Trim());
         AppConfig.SaveValue("LED", "Y", this.txtY.Text.Trim());
         //AppConfig.SaveValue("LED","mDevID",textBox2.Text);//通讯设备编号
         MessageBox.Show("修改成功,更改后的配置将在系统重启后生效!", "循环报警系统", MessageBoxButtons.OK, MessageBoxIcon.Information); IsClosed = true; this.Close();
     }
     else
     {
         MessageBox.Show("您输入的密码不正确!", "天大天科", MessageBoxButtons.AbortRetryIgnore);
     }
 }
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (!Regex.IsMatch(this.txtKeyA.Text.Trim(), "[A-Za-z0-9]{6}"))
            {
                MessageBox.Show("A密码必须为六位的字母和数字的组合", "天大天科IC卡初始化系统", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            if (!Regex.IsMatch(this.txtKeyB.Text.Trim(), "[A-Za-z0-9]{6}"))
            {
                MessageBox.Show("B密码必须为六位的字母和数字的组合", "天大天科IC卡初始化系统", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            if (this.txtKeyA.Text.Trim() != this.txtKeyAAgain.Text.Trim())
            {
                MessageBox.Show("A密码与确认密码不一致", "天大天科IC卡初始化系统", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            if (this.txtKeyB.Text.Trim() != this.txtKeyBAgain.Text.Trim())
            {
                MessageBox.Show("B密码与确认密码不一致", "天大天科IC卡初始化系统", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            string strKeyA = CryptDes.ToHex(this.txtKeyA.Text.Trim(), "gb2312", false);;

            strKeyA = CryptDes.EncryptDES(strKeyA, "EncryDes");

            string strA = CryptDes.DecryptDES(strKeyA, "EncryDes");

            ini.IniWriteValue("Key", "KeyA", strKeyA);
            string strKeyB = CryptDes.ToHex(this.txtKeyB.Text.Trim(), "gb2312", false);

            strKeyB = CryptDes.EncryptDES(strKeyB, "EncryDes");
            ini.IniWriteValue("Key", "KeyB", strKeyB);
            MessageBox.Show("密码设置成功!", "天大天科IC卡初始化系统", MessageBoxButtons.OK, MessageBoxIcon.Information);
        }
Exemplo n.º 3
0
        private void button1_Click(object sender, EventArgs e)
        {
            string err = "";

            err = getErr();
            if (err != "")
            {
                MessageBox.Show(err);
                return;
            }
            AppConfig.SaveValue("Config", "IsConfigruation", "1");
            AppConfig.SaveValue("Config", "DBName", txtDBName.Text.Trim());
            AppConfig.SaveValue("Config", "DBServer", txtDBServer.Text.Trim());
            AppConfig.SaveValue("Config", "DBUserName", txtDBUserName.Text.Trim());
            AppConfig.SaveValue("Config", "DBPassWd", CryptDes.EncryptDES(txtPassWd.Text, "EncryDes"));
            AppConfig.SaveValue("LED", "CardType", comboBox2.Text);          //卡型号
            AppConfig.SaveValue("LED", "ComPort", comboBox1.Text);           //串口
            AppConfig.SaveValue("LED", "ComBaudRate", txt_ComBaudRate.Text); //波特率
            AppConfig.SaveValue("LED", "ComDelay", "1000");                  //延时
            AppConfig.SaveValue("LED", "LedNum", "0");
            AppConfig.SaveValue("LED", "LedWidth", txt_LedWidth.Text);       //屏宽
            AppConfig.SaveValue("LED", "LedHeight", txt_ledHeght.Text);      //屏高
            if (radioButton1.Checked)
            {
                AppConfig.SaveValue("LED", "LedColor", "1");//双色屏
            }
            if (radioButton2.Checked)
            {
                AppConfig.SaveValue("LED", "LedColor", "2");//单色屏
            }
            MessageBox.Show("修改成功,更改后的配置将在系统重启后生效!", "循环报警系统", MessageBoxButtons.OK, MessageBoxIcon.Information); this.Close();
        }