private void button1_Click(object sender, EventArgs e) { richTextBox1.Clear(); try { if (txtInput.Text != "" & txtKhoaX.TextLength == 19 & txtKhoaY.TextLength == 22 & txtKhoaZ.TextLength == 23) { A51 a = new A51(); string p = a.encrypt(File.ReadAllText(txtInput.Text), txtKhoaX.Text + txtKhoaY.Text + txtKhoaZ.Text); try { richTextBox1.Text = p; MessageBox.Show("Thực hiện thành công"); } catch (Exception ex) { MessageBox.Show(ex.Message); } } else { if (txtInput.Text == "") { MessageBox.Show("Chưa chọn file !!"); } if (txtKhoaX.TextLength != 19 || txtKhoaY.TextLength != 22 || txtKhoaZ.TextLength != 23) { MessageBox.Show("Khóa chưa đúng"); } } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void phamaa51btn_Click(object sender, EventArgs e) { richTextBox1.Clear(); A51 a = new A51(); string p = a.decrypt(File.ReadAllText(txtInput.Text), txtKhoaX.Text + txtKhoaY.Text + txtKhoaZ.Text); richTextBox1.Text = p; }