示例#1
0
        private void ToolStripMenuItemEdit_Click(object sender, EventArgs e)
        {
            int index = listBox1.SelectedIndex;

            if (index < 0)
            {
                return;
            }
            EncryptionForm form = new EncryptionForm();

            form.comboBox1.SelectedIndex = encryptionlist.EnList[listBox1.SelectedIndex].index;
            form.textBox1.Text           = encryptionlist.EnList[listBox1.SelectedIndex].getkeyString();
            if (form.ShowDialog() == DialogResult.OK)
            {
                switch (form.comboBox1.SelectedIndex)
                {
                case 0:
                    encryptionlist.ReplaceEncryption(index, new KaisaEnCryption(Convert.ToInt32(form.a)));
                    break;

                case 1:
                    encryptionlist.ReplaceEncryption(index, new WeiyiEnCryption(form.b));
                    break;

                case 2:
                    encryptionlist.ReplaceEncryption(index, new FenceEnCryption(form.c));
                    break;

                case 3:
                    encryptionlist.ReplaceEncryption(index, new ReverseEnCryption());
                    break;
                }
            }
        }
示例#2
0
        private void ToolStripMenuItemIns_Click(object sender, EventArgs e)
        {
            if (listBox1.SelectedIndex == -1)
            {
                return;
            }
            int            index = listBox1.SelectedIndex;
            EncryptionForm form  = new EncryptionForm();

            if (form.ShowDialog() == DialogResult.OK)
            {
                switch (form.comboBox1.SelectedIndex)
                {
                case 0:
                    encryptionlist.InsertEncryption(index, new KaisaEnCryption(Convert.ToInt32(form.a)));
                    break;

                case 1:
                    encryptionlist.InsertEncryption(index, new WeiyiEnCryption(form.b));
                    break;

                case 2:
                    encryptionlist.InsertEncryption(index, new FenceEnCryption(form.c));
                    break;

                case 3:
                    encryptionlist.InsertEncryption(index, new ReverseEnCryption());
                    break;
                }
            }
            listBox1.SelectedIndex = index;
        }