using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.IO;
using System.Security;
using System.Security.Cryptography;
namespace Lock_UnLock
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private byte[] sKey;
private byte[] sIV;
public string key = "";
private void button5_Click(object sender, EventArgs e)
{
Application.Exit();
}
private void Form1_Load(object sender, EventArgs e)
{
this.textBox1.ReadOnly = true;
this.textBox2.ReadOnly = true;
this.radioButton1.Checked = true;
this.label4.Text = DateTime.Now.ToLongDateString();
this.textBox3.Text = "安全密匙用於解密文件!";
this.textBox3.Focus();
int len = textBox3.Text.Length;
this.textBox3.SelectionStart = 0;
this.textBox3.SelectionLength = len;
}
private void button1_Click(object sender, EventArgs e)
{
this.openFileDialog1.ShowDialog();
string filename = openFileDialog1.FileName;
int i = filename.LastIndexOf(".");
if (i != -1)
{
string filetype = filename.Substring(filename.LastIndexOf("."));
if (this.radioButton1.Checked)
{
filename = filename.Replace("(解密文件)", "");
textBox2.Text = filename.Substring(0, filename.LastIndexOf(".")) + "(加密文件)" + filetype;
}
else
{
filename = filename.Replace("(加密文件)", "");
textBox2.Text = filename.Substring(0, filename.LastIndexOf(".")) + "(解密文件)" + filetype;
}
}
if (filename != "")
{
textBox1.Text = openFileDialog1.FileName;
}
}
private void button2_Click(object sender, EventArgs e)
{
this.saveFileDialog1.ShowDialog();
if (saveFileDialog1.FileName != "")
{
this.textBox2.Text = saveFileDialog1.FileName;
}
}
private void radioButton1_CheckedChanged(object sender, EventArgs e)
{
if (radioButton1.Checked == true)
{
this.button4.Enabled = false;
this.button3.Enabled = true;
}
}
private void radioButton2_CheckedChanged(object sender, EventArgs e)
{
if (radioButton2.Checked == true)
{
this.button3.Enabled = false;
this.button4.Enabled = true;
}
}
"加密方法
"解密方法
"加密
"解密
}
}