form1.cs

来自「银行家算法 具有详细的说明文档 可供学生朋友使用和学习」· CS 代码 · 共 2,196 行 · 第 1/5 页

CS
2,196
字号
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.IO;
using System.Runtime.Serialization;
using System.Runtime.Serialization.Formatters.Binary;

namespace FileSystem
{
	/// <summary>
	/// Form1 的摘要说明。
	/// </summary>
	public class Form1 : System.Windows.Forms.Form
	{
		private System.Windows.Forms.TreeView treeView1;
		private System.Windows.Forms.MainMenu mainMenu1;
		private System.Windows.Forms.ListView listView1;
		private System.Windows.Forms.ColumnHeader columnHeader1;
		private System.Windows.Forms.ColumnHeader columnHeader2;
		private System.Windows.Forms.ColumnHeader columnHeader3;
		private System.Windows.Forms.ColumnHeader columnHeader4;
		private System.Windows.Forms.MenuItem menuItem4;
		private System.Windows.Forms.MenuItem menuItem8;
		private System.Windows.Forms.MenuItem menuItem13;
		private System.Windows.Forms.MenuItem menuItem17;
		private System.Windows.Forms.MenuItem menuItem25;
		private System.Windows.Forms.MenuItem menuItem29;
		private System.Windows.Forms.MenuItem menuItem33;
		private System.ComponentModel.IContainer components;
		private System.Windows.Forms.MenuItem menuUser;
		private System.Windows.Forms.MenuItem menuLogin;
		private System.Windows.Forms.MenuItem menuLogout;
		private System.Windows.Forms.MenuItem menuRegister;
		private System.Windows.Forms.MenuItem menuDelUser;
		private System.Windows.Forms.MenuItem menuEditPassWord;
		private System.Windows.Forms.MenuItem menuExit;
		private System.Windows.Forms.MenuItem menuFile;
		private System.Windows.Forms.MenuItem menuNewFile;
		private System.Windows.Forms.MenuItem menuDelFile;
		private System.Windows.Forms.MenuItem menuRenameFile;
		private System.Windows.Forms.MenuItem menuReadFile;
		private System.Windows.Forms.MenuItem menuCutFile;
		private System.Windows.Forms.MenuItem menuCopyFile;
		private System.Windows.Forms.MenuItem menuFileAttribute;
		private System.Windows.Forms.MenuItem menuFolder;
		private System.Windows.Forms.MenuItem menuNewFolder;
		private System.Windows.Forms.MenuItem menuDelFolder;
		private System.Windows.Forms.MenuItem menuRenameFolder;
		private System.Windows.Forms.MenuItem menuCutFolder;
		private System.Windows.Forms.MenuItem menuCopyFolder;
		private System.Windows.Forms.MenuItem menuShared;
		private System.Windows.Forms.MenuItem menuSearch;
		private System.Windows.Forms.MenuItem menuItem1;
		private System.Windows.Forms.MenuItem menuFolderAttribute;
		private UserCollection UserList;
		private string G_UserName;
		private string G_PassWord;
		private int G_UserIndex;
		private System.Windows.Forms.MenuItem menuEditFile;
		private System.Windows.Forms.MenuItem menuExecuteFile;
		private FolderInfo G_Folder;
		private FolderInfo G_SourceFolder;
		private FileInfo G_SourceFile;
		private System.Windows.Forms.MenuItem menuExample;
		private System.Windows.Forms.MenuItem menuInputExample;
		private System.Windows.Forms.MenuItem menuOutputExample;
		private mySorter sorter;
		private System.Windows.Forms.ImageList imageList3;
		private System.Windows.Forms.ImageList imgListSmall;
		private System.Windows.Forms.ImageList imgListLarge;
		private System.Windows.Forms.MenuItem menuPasteFile;
		private System.Windows.Forms.MenuItem menuPasteFolder;
		private System.Windows.Forms.MenuItem menuLargeIcon;
		private System.Windows.Forms.MenuItem menuSmallIcon;
		private System.Windows.Forms.MenuItem menuList;
		private System.Windows.Forms.MenuItem menuDetails;
		private System.Windows.Forms.MenuItem menuView;
		private bool G_Shared;
		private bool IsCopy;
		private System.Windows.Forms.MenuItem menuSearchFile;
		private System.Windows.Forms.MenuItem menuSearchFolder;
		private System.Windows.Forms.ImageList imgFileBar;
		private System.Windows.Forms.Panel panel1;
		private FolderInfo G_ParentFolder;
		private System.Windows.Forms.Button btnNewFile;
		private System.Windows.Forms.Label label1;
		private System.Windows.Forms.TextBox tbAdr;
		private System.Windows.Forms.Button btnGo;
		private System.Windows.Forms.Button button1;
		private System.Windows.Forms.Button btnDeleteFolder;
		private System.Windows.Forms.Button btnLogout;
		private System.Windows.Forms.Button btnNewFolder;
		private string G_SourcePath;

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

			//
			// TODO: 在 InitializeComponent 调用后添加任何构造函数代码
			//
		}

		/// <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.components = new System.ComponentModel.Container();
			System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(Form1));
			this.treeView1 = new System.Windows.Forms.TreeView();
			this.imageList3 = new System.Windows.Forms.ImageList(this.components);
			this.mainMenu1 = new System.Windows.Forms.MainMenu();
			this.menuUser = new System.Windows.Forms.MenuItem();
			this.menuLogin = new System.Windows.Forms.MenuItem();
			this.menuLogout = new System.Windows.Forms.MenuItem();
			this.menuItem4 = new System.Windows.Forms.MenuItem();
			this.menuRegister = new System.Windows.Forms.MenuItem();
			this.menuDelUser = new System.Windows.Forms.MenuItem();
			this.menuEditPassWord = new System.Windows.Forms.MenuItem();
			this.menuItem8 = new System.Windows.Forms.MenuItem();
			this.menuExit = new System.Windows.Forms.MenuItem();
			this.menuFile = new System.Windows.Forms.MenuItem();
			this.menuNewFile = new System.Windows.Forms.MenuItem();
			this.menuDelFile = new System.Windows.Forms.MenuItem();
			this.menuItem13 = new System.Windows.Forms.MenuItem();
			this.menuRenameFile = new System.Windows.Forms.MenuItem();
			this.menuReadFile = new System.Windows.Forms.MenuItem();
			this.menuEditFile = new System.Windows.Forms.MenuItem();
			this.menuExecuteFile = new System.Windows.Forms.MenuItem();
			this.menuItem17 = new System.Windows.Forms.MenuItem();
			this.menuCutFile = new System.Windows.Forms.MenuItem();
			this.menuCopyFile = new System.Windows.Forms.MenuItem();
			this.menuPasteFile = new System.Windows.Forms.MenuItem();
			this.menuItem29 = new System.Windows.Forms.MenuItem();
			this.menuFileAttribute = new System.Windows.Forms.MenuItem();
			this.menuFolder = new System.Windows.Forms.MenuItem();
			this.menuNewFolder = new System.Windows.Forms.MenuItem();
			this.menuDelFolder = new System.Windows.Forms.MenuItem();
			this.menuRenameFolder = new System.Windows.Forms.MenuItem();
			this.menuItem33 = new System.Windows.Forms.MenuItem();
			this.menuCutFolder = new System.Windows.Forms.MenuItem();
			this.menuCopyFolder = new System.Windows.Forms.MenuItem();
			this.menuPasteFolder = new System.Windows.Forms.MenuItem();
			this.menuItem25 = new System.Windows.Forms.MenuItem();
			this.menuShared = new System.Windows.Forms.MenuItem();
			this.menuItem1 = new System.Windows.Forms.MenuItem();
			this.menuFolderAttribute = new System.Windows.Forms.MenuItem();
			this.menuView = new System.Windows.Forms.MenuItem();
			this.menuLargeIcon = new System.Windows.Forms.MenuItem();
			this.menuSmallIcon = new System.Windows.Forms.MenuItem();
			this.menuList = new System.Windows.Forms.MenuItem();
			this.menuDetails = new System.Windows.Forms.MenuItem();
			this.menuSearch = new System.Windows.Forms.MenuItem();
			this.menuSearchFile = new System.Windows.Forms.MenuItem();
			this.menuSearchFolder = new System.Windows.Forms.MenuItem();
			this.menuExample = new System.Windows.Forms.MenuItem();
			this.menuInputExample = new System.Windows.Forms.MenuItem();
			this.menuOutputExample = new System.Windows.Forms.MenuItem();
			this.listView1 = new System.Windows.Forms.ListView();
			this.columnHeader1 = new System.Windows.Forms.ColumnHeader();
			this.columnHeader2 = new System.Windows.Forms.ColumnHeader();
			this.columnHeader3 = new System.Windows.Forms.ColumnHeader();
			this.columnHeader4 = new System.Windows.Forms.ColumnHeader();
			this.imgListLarge = new System.Windows.Forms.ImageList(this.components);
			this.imgListSmall = new System.Windows.Forms.ImageList(this.components);
			this.imgFileBar = new System.Windows.Forms.ImageList(this.components);
			this.panel1 = new System.Windows.Forms.Panel();
			this.btnNewFile = new System.Windows.Forms.Button();
			this.button1 = new System.Windows.Forms.Button();
			this.btnNewFolder = new System.Windows.Forms.Button();
			this.btnDeleteFolder = new System.Windows.Forms.Button();
			this.btnLogout = new System.Windows.Forms.Button();
			this.label1 = new System.Windows.Forms.Label();
			this.tbAdr = new System.Windows.Forms.TextBox();
			this.btnGo = new System.Windows.Forms.Button();
			this.panel1.SuspendLayout();
			this.SuspendLayout();
			// 
			// treeView1
			// 
			this.treeView1.FullRowSelect = true;
			this.treeView1.ImageList = this.imageList3;
			this.treeView1.Location = new System.Drawing.Point(0, 80);
			this.treeView1.Name = "treeView1";
			this.treeView1.SelectedImageIndex = 3;
			this.treeView1.Size = new System.Drawing.Size(232, 384);
			this.treeView1.TabIndex = 0;
			this.treeView1.BeforeSelect += new System.Windows.Forms.TreeViewCancelEventHandler(this.treeView1_BeforeSelect);
			// 
			// imageList3
			// 
			this.imageList3.ColorDepth = System.Windows.Forms.ColorDepth.Depth32Bit;
			this.imageList3.ImageSize = new System.Drawing.Size(24, 24);
			this.imageList3.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("imageList3.ImageStream")));
			this.imageList3.TransparentColor = System.Drawing.Color.Transparent;
			// 
			// mainMenu1
			// 
			this.mainMenu1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
																					  this.menuUser,
																					  this.menuFile,
																					  this.menuFolder,
																					  this.menuView,
																					  this.menuSearch,
																					  this.menuExample});
			// 
			// menuUser
			// 
			this.menuUser.Index = 0;
			this.menuUser.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
																					 this.menuLogin,
																					 this.menuLogout,
																					 this.menuItem4,
																					 this.menuRegister,
																					 this.menuDelUser,
																					 this.menuEditPassWord,
																					 this.menuItem8,
																					 this.menuExit});
			this.menuUser.Text = "用户";
			// 
			// menuLogin
			// 
			this.menuLogin.Index = 0;
			this.menuLogin.Text = "登陆";
			this.menuLogin.Click += new System.EventHandler(this.menuLogin_Click);
			// 
			// menuLogout
			// 
			this.menuLogout.Index = 1;
			this.menuLogout.Text = "注销";
			this.menuLogout.Click += new System.EventHandler(this.menuLogout_Click);
			// 
			// menuItem4
			// 
			this.menuItem4.Index = 2;
			this.menuItem4.Text = "-";
			// 
			// menuRegister
			// 
			this.menuRegister.Index = 3;
			this.menuRegister.Text = "注册";
			this.menuRegister.Click += new System.EventHandler(this.menuRegister_Click);
			// 
			// menuDelUser
			// 
			this.menuDelUser.Index = 4;
			this.menuDelUser.Text = "删除";
			this.menuDelUser.Click += new System.EventHandler(this.menuDelUser_Click);
			// 
			// menuEditPassWord
			// 
			this.menuEditPassWord.Index = 5;
			this.menuEditPassWord.Text = "修改密码";
			this.menuEditPassWord.Click += new System.EventHandler(this.menuEditPassWord_Click);
			// 
			// menuItem8
			// 
			this.menuItem8.Index = 6;
			this.menuItem8.Text = "-";
			// 
			// menuExit
			// 
			this.menuExit.Index = 7;
			this.menuExit.Text = "退出";
			this.menuExit.Click += new System.EventHandler(this.menuItem9_Click);
			// 
			// menuFile
			// 
			this.menuFile.Index = 1;
			this.menuFile.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
																					 this.menuNewFile,
																					 this.menuDelFile,
																					 this.menuItem13,
																					 this.menuRenameFile,
																					 this.menuReadFile,
																					 this.menuEditFile,
																					 this.menuExecuteFile,
																					 this.menuItem17,
																					 this.menuCutFile,
																					 this.menuCopyFile,
																					 this.menuPasteFile,
																					 this.menuItem29,
																					 this.menuFileAttribute});
			this.menuFile.Text = "文件";
			// 
			// menuNewFile
			// 
			this.menuNewFile.Index = 0;
			this.menuNewFile.Text = "新建文件";
			this.menuNewFile.Click += new System.EventHandler(this.menuNewFile_Click);
			// 
			// menuDelFile
			// 
			this.menuDelFile.Index = 1;
			this.menuDelFile.Text = "删除文件";
			this.menuDelFile.Click += new System.EventHandler(this.menuDelFile_Click);
			// 
			// menuItem13
			// 
			this.menuItem13.Index = 2;
			this.menuItem13.Text = "-";
			// 
			// menuRenameFile
			// 
			this.menuRenameFile.Index = 3;
			this.menuRenameFile.Text = "重命名";
			this.menuRenameFile.Click += new System.EventHandler(this.menuRenameFile_Click);
			// 
			// menuReadFile
			// 
			this.menuReadFile.Index = 4;
			this.menuReadFile.Text = "读文件";
			this.menuReadFile.Click += new System.EventHandler(this.menuReadFile_Click);
			// 
			// menuEditFile
			// 
			this.menuEditFile.Index = 5;
			this.menuEditFile.Text = "编辑文件";
			this.menuEditFile.Click += new System.EventHandler(this.menuEditFile_Click);
			// 
			// menuExecuteFile
			// 
			this.menuExecuteFile.Index = 6;
			this.menuExecuteFile.Text = "执行文件";
			this.menuExecuteFile.Click += new System.EventHandler(this.menuExecuteFile_Click);
			// 
			// menuItem17
			// 
			this.menuItem17.Index = 7;
			this.menuItem17.Text = "-";
			// 
			// menuCutFile
			// 
			this.menuCutFile.Index = 8;
			this.menuCutFile.Text = "剪切文件";
			this.menuCutFile.Click += new System.EventHandler(this.menuCutFile_Click);
			// 
			// menuCopyFile
			// 
			this.menuCopyFile.Index = 9;
			this.menuCopyFile.Text = "复制文件";
			this.menuCopyFile.Click += new System.EventHandler(this.menuCopyFile_Click);
			// 
			// menuPasteFile
			// 
			this.menuPasteFile.Index = 10;
			this.menuPasteFile.Text = "粘贴文件";
			this.menuPasteFile.Click += new System.EventHandler(this.menuPasteFile_Click);
			// 
			// menuItem29
			// 
			this.menuItem29.Index = 11;
			this.menuItem29.Text = "-";
			// 
			// menuFileAttribute
			// 
			this.menuFileAttribute.Index = 12;
			this.menuFileAttribute.Text = "查看属性";
			this.menuFileAttribute.Click += new System.EventHandler(this.menuFileAttribute_Click);
			// 
			// menuFolder
			// 
			this.menuFolder.Index = 2;
			this.menuFolder.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
																					   this.menuNewFolder,
																					   this.menuDelFolder,
																					   this.menuRenameFolder,
																					   this.menuItem33,
																					   this.menuCutFolder,
																					   this.menuCopyFolder,
																					   this.menuPasteFolder,
																					   this.menuItem25,
																					   this.menuShared,
																					   this.menuItem1,
																					   this.menuFolderAttribute});
			this.menuFolder.Text = "文件夹";
			// 
			// menuNewFolder
			// 
			this.menuNewFolder.Index = 0;
			this.menuNewFolder.Text = "新建文件夹";
			this.menuNewFolder.Click += new System.EventHandler(this.menuNewFolder_Click);
			// 
			// menuDelFolder
			// 
			this.menuDelFolder.Index = 1;
			this.menuDelFolder.Text = "删除文件夹";
			this.menuDelFolder.Click += new System.EventHandler(this.menuDelFolder_Click);
			// 
			// menuRenameFolder
			// 
			this.menuRenameFolder.Index = 2;
			this.menuRenameFolder.Text = "重命名";
			this.menuRenameFolder.Click += new System.EventHandler(this.menuRenameFolder_Click);
			// 
			// menuItem33
			// 
			this.menuItem33.Index = 3;
			this.menuItem33.Text = "-";
			// 
			// menuCutFolder
			// 
			this.menuCutFolder.Index = 4;
			this.menuCutFolder.Text = "剪切文件夹";
			this.menuCutFolder.Click += new System.EventHandler(this.menuCutFolder_Click);
			// 
			// menuCopyFolder
			// 
			this.menuCopyFolder.Index = 5;
			this.menuCopyFolder.Text = "复制文件夹";
			this.menuCopyFolder.Click += new System.EventHandler(this.menuCopyFolder_Click);
			// 
			// menuPasteFolder
			// 
			this.menuPasteFolder.Index = 6;
			this.menuPasteFolder.Text = "粘贴文件夹";

⌨️ 快捷键说明

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