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

📄 cipherform.cs

📁 此工程实现了对文件
💻 CS
📖 第 1 页 / 共 2 页
字号:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using WindowsApplication1.cipher;
using System.Text;
using  System.IO;


namespace WindowsApplication1
{
	/// <summary>
	/// Form1 的摘要说明。
	/// </summary>
	public class CipherForm : System.Windows.Forms.Form
	{
		private System.Windows.Forms.TabControl cipher;
		private System.Windows.Forms.TabPage cipherText;
		private System.Windows.Forms.TabPage cipherFile;
		private System.Windows.Forms.Label label1;
		private System.Windows.Forms.GroupBox plainText;
		private System.Windows.Forms.GroupBox cipheredText;
		private System.Windows.Forms.GroupBox groupBox4;
		private System.Windows.Forms.TextBox palinTextBox;
		private System.Windows.Forms.TextBox ciphertextBox;
		private System.Windows.Forms.TextBox textBox4;
		private System.Windows.Forms.Button encryptButton;
		private System.Windows.Forms.Button dectyptButton;


        //define by ken
		Aes aes;

		String key;
		private System.Windows.Forms.TextBox keyTextBox;
		private System.Windows.Forms.Label label2;
		private System.Windows.Forms.Label label3;
		private System.Windows.Forms.GroupBox groupBox1;
		private System.Windows.Forms.Button button1;
		private System.Windows.Forms.OpenFileDialog openFileDialog1;
		private System.Windows.Forms.TextBox inputTextBox;
		private System.Windows.Forms.TextBox outputTextBox;
		private System.Windows.Forms.Button button2;
		private System.Windows.Forms.SaveFileDialog saveFileDialog1;
		private System.Windows.Forms.Button enButton;
		private System.Windows.Forms.Button deButton;
		private System.Windows.Forms.Label label4;
		private System.Windows.Forms.TextBox fileKeyTextBox;
		private System.Windows.Forms.TabPage FormatTabPage;
		private System.Windows.Forms.Label label5;
		private System.Windows.Forms.TextBox cpuTextBox;
		private System.Windows.Forms.Button cpuButton;
		private System.Windows.Forms.Label label6;
		private System.Windows.Forms.TextBox formatTextBox;
		private System.Windows.Forms.Button fInputButton;
		private System.Windows.Forms.Label label7;
		private System.Windows.Forms.TextBox formatOTextBox;
		private System.Windows.Forms.Button fOutputButton;
		private System.Windows.Forms.Button button3;
		private System.Windows.Forms.OpenFileDialog openFileDialog2;
		private System.Windows.Forms.Label Input;
		private System.Windows.Forms.TextBox openTextBox;
		private System.Windows.Forms.Button inputlable;
		private System.Windows.Forms.Button openButton;


		/// <summary>
		/// 必需的设计器变量。
		/// </summary>
		private System.ComponentModel.Container components = null;

		public CipherForm()
		{
			//
			// Windows 窗体设计器支持所必需的
			//
			InitializeComponent();

			//
			// TODO: 在 InitializeComponent 调用后添加任何构造函数代码
			//
			aes = new Aes();
		}

		/// <summary>
		/// 清理所有正在使用的资源。
		/// </summary>
		protected override void Dispose( bool disposing )
		{
			if( disposing )
			{
				if (components != null) 
				{
					components.Dispose();
				}
			}
			base.Dispose( disposing );
		}

		#region Windows 窗体设计器生成的代码
		/// <summary>
		/// 设计器支持所需的方法 - 不要使用代码编辑器修改
		/// 此方法的内容。
		/// </summary>
		private void InitializeComponent()
		{
			this.cipher = new System.Windows.Forms.TabControl();
			this.cipherText = new System.Windows.Forms.TabPage();
			this.dectyptButton = new System.Windows.Forms.Button();
			this.encryptButton = new System.Windows.Forms.Button();
			this.groupBox4 = new System.Windows.Forms.GroupBox();
			this.textBox4 = new System.Windows.Forms.TextBox();
			this.cipheredText = new System.Windows.Forms.GroupBox();
			this.ciphertextBox = new System.Windows.Forms.TextBox();
			this.plainText = new System.Windows.Forms.GroupBox();
			this.palinTextBox = new System.Windows.Forms.TextBox();
			this.keyTextBox = new System.Windows.Forms.TextBox();
			this.label1 = new System.Windows.Forms.Label();
			this.cipherFile = new System.Windows.Forms.TabPage();
			this.groupBox1 = new System.Windows.Forms.GroupBox();
			this.fileKeyTextBox = new System.Windows.Forms.TextBox();
			this.label4 = new System.Windows.Forms.Label();
			this.deButton = new System.Windows.Forms.Button();
			this.enButton = new System.Windows.Forms.Button();
			this.button2 = new System.Windows.Forms.Button();
			this.button1 = new System.Windows.Forms.Button();
			this.label2 = new System.Windows.Forms.Label();
			this.inputTextBox = new System.Windows.Forms.TextBox();
			this.label3 = new System.Windows.Forms.Label();
			this.outputTextBox = new System.Windows.Forms.TextBox();
			this.FormatTabPage = new System.Windows.Forms.TabPage();
			this.openButton = new System.Windows.Forms.Button();
			this.inputlable = new System.Windows.Forms.Button();
			this.openTextBox = new System.Windows.Forms.TextBox();
			this.Input = new System.Windows.Forms.Label();
			this.button3 = new System.Windows.Forms.Button();
			this.fOutputButton = new System.Windows.Forms.Button();
			this.formatOTextBox = new System.Windows.Forms.TextBox();
			this.label7 = new System.Windows.Forms.Label();
			this.fInputButton = new System.Windows.Forms.Button();
			this.formatTextBox = new System.Windows.Forms.TextBox();
			this.label6 = new System.Windows.Forms.Label();
			this.cpuButton = new System.Windows.Forms.Button();
			this.cpuTextBox = new System.Windows.Forms.TextBox();
			this.label5 = new System.Windows.Forms.Label();
			this.openFileDialog1 = new System.Windows.Forms.OpenFileDialog();
			this.saveFileDialog1 = new System.Windows.Forms.SaveFileDialog();
			this.openFileDialog2 = new System.Windows.Forms.OpenFileDialog();
			this.cipher.SuspendLayout();
			this.cipherText.SuspendLayout();
			this.groupBox4.SuspendLayout();
			this.cipheredText.SuspendLayout();
			this.plainText.SuspendLayout();
			this.cipherFile.SuspendLayout();
			this.groupBox1.SuspendLayout();
			this.FormatTabPage.SuspendLayout();
			this.SuspendLayout();
			// 
			// cipher
			// 
			this.cipher.Controls.Add(this.cipherText);
			this.cipher.Controls.Add(this.cipherFile);
			this.cipher.Controls.Add(this.FormatTabPage);
			this.cipher.Location = new System.Drawing.Point(0, 0);
			this.cipher.Name = "cipher";
			this.cipher.SelectedIndex = 0;
			this.cipher.Size = new System.Drawing.Size(632, 496);
			this.cipher.TabIndex = 0;
			// 
			// cipherText
			// 
			this.cipherText.Controls.Add(this.dectyptButton);
			this.cipherText.Controls.Add(this.encryptButton);
			this.cipherText.Controls.Add(this.groupBox4);
			this.cipherText.Controls.Add(this.cipheredText);
			this.cipherText.Controls.Add(this.plainText);
			this.cipherText.Controls.Add(this.keyTextBox);
			this.cipherText.Controls.Add(this.label1);
			this.cipherText.Location = new System.Drawing.Point(4, 21);
			this.cipherText.Name = "cipherText";
			this.cipherText.Size = new System.Drawing.Size(624, 471);
			this.cipherText.TabIndex = 0;
			this.cipherText.Text = "CipherText";
			this.cipherText.Click += new System.EventHandler(this.cipherText_Click);
			// 
			// dectyptButton
			// 
			this.dectyptButton.Location = new System.Drawing.Point(504, 64);
			this.dectyptButton.Name = "dectyptButton";
			this.dectyptButton.TabIndex = 11;
			this.dectyptButton.Text = "Dectypt";
			this.dectyptButton.Click += new System.EventHandler(this.dectyptButton_Click);
			// 
			// encryptButton
			// 
			this.encryptButton.Location = new System.Drawing.Point(368, 64);
			this.encryptButton.Name = "encryptButton";
			this.encryptButton.TabIndex = 10;
			this.encryptButton.Text = "Encrypt";
			this.encryptButton.Click += new System.EventHandler(this.encryptButton_Click);
			// 
			// groupBox4
			// 
			this.groupBox4.Controls.Add(this.textBox4);
			this.groupBox4.Location = new System.Drawing.Point(8, 312);
			this.groupBox4.Name = "groupBox4";
			this.groupBox4.Size = new System.Drawing.Size(584, 136);
			this.groupBox4.TabIndex = 9;
			this.groupBox4.TabStop = false;
			this.groupBox4.Text = "Recover Plaintext";
			// 
			// textBox4
			// 
			this.textBox4.Location = new System.Drawing.Point(8, 16);
			this.textBox4.Multiline = true;
			this.textBox4.Name = "textBox4";
			this.textBox4.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
			this.textBox4.Size = new System.Drawing.Size(568, 112);
			this.textBox4.TabIndex = 0;
			this.textBox4.Text = "";
			this.textBox4.TextChanged += new System.EventHandler(this.textBox4_TextChanged);
			// 
			// cipheredText
			// 
			this.cipheredText.Controls.Add(this.ciphertextBox);
			this.cipheredText.Location = new System.Drawing.Point(8, 224);
			this.cipheredText.Name = "cipheredText";
			this.cipheredText.Size = new System.Drawing.Size(584, 80);
			this.cipheredText.TabIndex = 8;
			this.cipheredText.TabStop = false;
			this.cipheredText.Text = "CipherText";
			// 
			// ciphertextBox
			// 
			this.ciphertextBox.Location = new System.Drawing.Point(8, 16);
			this.ciphertextBox.Multiline = true;
			this.ciphertextBox.Name = "ciphertextBox";
			this.ciphertextBox.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
			this.ciphertextBox.Size = new System.Drawing.Size(568, 56);
			this.ciphertextBox.TabIndex = 0;
			this.ciphertextBox.Text = "";
			// 
			// plainText
			// 
			this.plainText.Controls.Add(this.palinTextBox);
			this.plainText.Location = new System.Drawing.Point(8, 96);
			this.plainText.Name = "plainText";
			this.plainText.Size = new System.Drawing.Size(584, 120);
			this.plainText.TabIndex = 7;
			this.plainText.TabStop = false;
			this.plainText.Text = "PlainText";
			// 
			// palinTextBox
			// 
			this.palinTextBox.Location = new System.Drawing.Point(8, 16);
			this.palinTextBox.Multiline = true;
			this.palinTextBox.Name = "palinTextBox";
			this.palinTextBox.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
			this.palinTextBox.Size = new System.Drawing.Size(568, 96);
			this.palinTextBox.TabIndex = 0;
			this.palinTextBox.Text = "";
			// 
			// keyTextBox
			// 
			this.keyTextBox.Location = new System.Drawing.Point(112, 16);
			this.keyTextBox.Name = "keyTextBox";
			this.keyTextBox.Size = new System.Drawing.Size(472, 21);
			this.keyTextBox.TabIndex = 1;
			this.keyTextBox.Text = "";
			// 
			// label1
			// 
			this.label1.Location = new System.Drawing.Point(16, 16);
			this.label1.Name = "label1";
			this.label1.Size = new System.Drawing.Size(72, 24);
			this.label1.TabIndex = 0;
			this.label1.Text = "Key :";
			this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
			this.label1.Click += new System.EventHandler(this.label1_Click);
			// 
			// cipherFile
			// 
			this.cipherFile.Controls.Add(this.groupBox1);
			this.cipherFile.Location = new System.Drawing.Point(4, 21);
			this.cipherFile.Name = "cipherFile";
			this.cipherFile.Size = new System.Drawing.Size(624, 471);
			this.cipherFile.TabIndex = 1;
			this.cipherFile.Text = "CipherFile";
			this.cipherFile.Click += new System.EventHandler(this.CipherFile_Click);
			// 
			// groupBox1
			// 
			this.groupBox1.Controls.Add(this.fileKeyTextBox);
			this.groupBox1.Controls.Add(this.label4);
			this.groupBox1.Controls.Add(this.deButton);
			this.groupBox1.Controls.Add(this.enButton);
			this.groupBox1.Controls.Add(this.button2);
			this.groupBox1.Controls.Add(this.button1);
			this.groupBox1.Controls.Add(this.label2);
			this.groupBox1.Controls.Add(this.inputTextBox);
			this.groupBox1.Controls.Add(this.label3);
			this.groupBox1.Controls.Add(this.outputTextBox);
			this.groupBox1.Location = new System.Drawing.Point(16, 24);
			this.groupBox1.Name = "groupBox1";
			this.groupBox1.Size = new System.Drawing.Size(592, 208);
			this.groupBox1.TabIndex = 8;
			this.groupBox1.TabStop = false;
			this.groupBox1.Text = "File";
			// 
			// fileKeyTextBox
			// 
			this.fileKeyTextBox.Location = new System.Drawing.Point(168, 104);
			this.fileKeyTextBox.Name = "fileKeyTextBox";
			this.fileKeyTextBox.Size = new System.Drawing.Size(288, 21);
			this.fileKeyTextBox.TabIndex = 9;
			this.fileKeyTextBox.Text = "";
			// 
			// label4
			// 
			this.label4.Location = new System.Drawing.Point(56, 104);
			this.label4.Name = "label4";
			this.label4.TabIndex = 8;
			this.label4.Text = "Key";
			// 
			// deButton
			// 
			this.deButton.Location = new System.Drawing.Point(352, 144);
			this.deButton.Name = "deButton";
			this.deButton.TabIndex = 7;
			this.deButton.Text = "Decrypt";
			this.deButton.Click += new System.EventHandler(this.deButton_Click);
			// 
			// enButton
			// 
			this.enButton.Location = new System.Drawing.Point(152, 144);
			this.enButton.Name = "enButton";
			this.enButton.TabIndex = 6;
			this.enButton.Text = "Encrypt";
			this.enButton.Click += new System.EventHandler(this.enButton_Click);
			// 
			// button2
			// 
			this.button2.Location = new System.Drawing.Point(472, 64);
			this.button2.Name = "button2";
			this.button2.Size = new System.Drawing.Size(88, 23);
			this.button2.TabIndex = 5;
			this.button2.Text = "Choose Output";
			this.button2.Click += new System.EventHandler(this.button2_Click);
			// 
			// button1
			// 
			this.button1.Location = new System.Drawing.Point(472, 32);
			this.button1.Name = "button1";
			this.button1.Size = new System.Drawing.Size(88, 23);
			this.button1.TabIndex = 4;
			this.button1.Text = "Choose Input";
			this.button1.Click += new System.EventHandler(this.button1_Click);
			// 
			// label2
			// 
			this.label2.Location = new System.Drawing.Point(56, 32);
			this.label2.Name = "label2";
			this.label2.TabIndex = 0;
			this.label2.Text = "Input File";
			// 
			// inputTextBox
			// 
			this.inputTextBox.Location = new System.Drawing.Point(168, 32);
			this.inputTextBox.Name = "inputTextBox";
			this.inputTextBox.Size = new System.Drawing.Size(288, 21);
			this.inputTextBox.TabIndex = 2;
			this.inputTextBox.Text = "";
			// 
			// label3
			// 
			this.label3.Location = new System.Drawing.Point(56, 64);
			this.label3.Name = "label3";
			this.label3.TabIndex = 1;
			this.label3.Text = "Output File";
			// 
			// outputTextBox
			// 

⌨️ 快捷键说明

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