⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 form1.cs

📁 文字加密解密软件
💻 CS
字号:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Security.Cryptography;
using System.IO;
using System.Globalization;
namespace Encrypt
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {

            String text = this.richTextBox1.Text;
            if (text.Trim().Length == 0)
            {
                MessageBox.Show("请输入要加密或解密的字符!", "系统提示");
                return;
            }
            try
            {
                String temp = Convert.ToBase64String(System.Text.Encoding.Default.GetBytes(text)).Replace("+", "%2B");
                temp = temp.Insert(1, "Q");
                temp.Substring(0, 1);
                this.richTextBox2.Text = temp;
            }
            catch (Exception ex)
            {

                MessageBox.Show("解密失败,请确认你输入的加密字符是否正确!", "系统提示");
            }

        }
        private void button2_Click(object sender, EventArgs e)
        {
            String text = this.richTextBox1.Text;
            if (text.Trim().Length == 0)
            {
                MessageBox.Show("请输入要加密或解密的字符!", "系统提示");
                return;
            }
            try
            {
                text = text.Remove(1, 1);
                this.richTextBox2.Text = System.Text.Encoding.Default.GetString(Convert.FromBase64String(text.Replace("%2B", "+")));
            }
            catch (Exception ex)
            {
                MessageBox.Show("解密失败,请确认你输入的解密字符是否正确!", "系统提示");
            }

        }

        private void button3_Click(object sender, EventArgs e)
        {
            AboutBox1 about = new AboutBox1();
            about.ShowDialog();
        }

        

        
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -