private void button14_Click(object sender, EventArgs e)//Base64解密 { Encoding encoding = Encoding.UTF8; int t = comboBox1.SelectedIndex; switch (t) { case 0: encoding = Encoding.UTF8; break; case 1: encoding = Encoding.GetEncoding("GB2312"); break; case 2: encoding = Encoding.GetEncoding("GBK"); break; case 3: encoding = Encoding.ASCII; break; case 4: encoding = Encoding.Unicode; break; case 5: encoding = Encoding.UTF7; break; case 6: encoding = Encoding.UTF32; break; case 7: encoding = Encoding.BigEndianUnicode; break; default: encoding = Encoding.UTF8; break; } string decode_Num = textBox14.Text; int num = 1; int.TryParse(decode_Num, out num); if (num < 1) { num = 1; } bool url_decode_flag = checkBox1.Checked; string Base64_Ciphertext = richTextBox14.Text; for (int i = 0; i < num; i++) { if (url_decode_flag) { Base64_Ciphertext = MyUrl.Decode(Base64_Ciphertext, encoding); } Base64_Ciphertext = MyBase64.DecodeBase64(Base64_Ciphertext, encoding); } richTextBox13.Text = Base64_Ciphertext; }
private void button15_Click(object sender, EventArgs e)//Base64加密 { Encoding encoding = Encoding.UTF8; int t = comboBox1.SelectedIndex; switch (t) { case 0: encoding = Encoding.UTF8; break; case 1: encoding = Encoding.GetEncoding("GB2312"); break; case 2: encoding = Encoding.GetEncoding("GBK"); break; case 3: encoding = Encoding.ASCII; break; case 4: encoding = Encoding.Unicode; break; case 5: encoding = Encoding.UTF7; break; case 6: encoding = Encoding.UTF32; break; case 7: encoding = Encoding.BigEndianUnicode; break; default: encoding = Encoding.UTF8; break; } string decode_Num = textBox14.Text; int num = 1; int.TryParse(decode_Num, out num); if (num < 1) { num = 1; } string Base64_Message = richTextBox13.Text; for (int i = 0; i < num; i++) { Base64_Message = MyBase64.EncodeBase64(Base64_Message, encoding); } richTextBox14.Text = Base64_Message; }