Ejemplo n.º 1
0
        private void button20_Click(object sender, EventArgs e)//URL二次解码
        {
            Encoding encoding = Encoding.ASCII;

            int t = comboBox4.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;
            }
            richTextBox5.Text = MyUrl.Decode(MyUrl.Decode(richTextBox6.Text, encoding), encoding);
        }
Ejemplo n.º 2
0
        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;
        }