📄 form1.cs
字号:
/**********************************************************************
010310915 李剑
完成时间:2004-10-11 约20小时
修改时间:2004-10-11
验收时间:2004-10-11
分数:85
优点:多用户,多级目录等
缺点:块操作有小BUG,多用户功能不全
*********************************************************************/
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.IO;
namespace file
{
/// <summary>
/// Form1 的摘要说明。
/// </summary>
public class Form1 : System.Windows.Forms.Form
{
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.Container components = null;
private System.Windows.Forms.Button format;
int now=0;//用于记录当前目录
/// <summary>
/// //////////////////////////////数组结构
/// </summary>
//目录
public int[,] dir=new int[200,41];//第一个放上级目录地址,前20个放目录地址,后20个放文件地址
public string[] dirname=new string[200];
// public int[] dup=new int[200];
// 文件
public int[,] file=new int[200,51];//第一个放上级目录地址
public string[] fname=new string[200];
public string[] users=new string[200];
// public int[] fdup=new int[200];
//块
public char[,] block=new char[10000,1024];
public bool[] bfup=new bool[10000];//块所属文件的地址//即块表
public int[] here=new int[20];//当前目录的栈
int nh=0;//栈内号
int openfile=-2;//已打开的文件 -2表示没有打开任何文件
string user="";
// public char[]
private System.Windows.Forms.Button open;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.TextBox indir;
private System.Windows.Forms.Button b_indir;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.TextBox infile;
private System.Windows.Forms.Button fopen;
private System.Windows.Forms.RichTextBox show;
private System.Windows.Forms.Button up_dir;
private System.Windows.Forms.Button save;
private System.Windows.Forms.RichTextBox show_dir;
private System.Windows.Forms.TabControl tabControl1;
private System.Windows.Forms.TabPage tabPage1;
private System.Windows.Forms.TabPage tabPage2;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.TextBox add_dir;
private System.Windows.Forms.Button b_adddir;
private System.Windows.Forms.TabPage tabPage3;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.TextBox del_dir;
private System.Windows.Forms.Label snd;
private System.Windows.Forms.Button exit;
private System.Windows.Forms.TabControl tabControl2;
private System.Windows.Forms.TabPage tabPage4;
private System.Windows.Forms.TabPage tabPage5;
private System.Windows.Forms.TabPage tabPage6;
private System.Windows.Forms.Label label5;
private System.Windows.Forms.TextBox newfile;
private System.Windows.Forms.Button newf;
private System.Windows.Forms.Label label6;
private System.Windows.Forms.TextBox delfile;
private System.Windows.Forms.Button delf;
private System.Windows.Forms.Label nowfile;
private System.Windows.Forms.TextBox id;
private System.Windows.Forms.Button pass;
private System.Windows.Forms.Button b_deldir;
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.format = new System.Windows.Forms.Button();
this.open = new System.Windows.Forms.Button();
this.show_dir = new System.Windows.Forms.RichTextBox();
this.label1 = new System.Windows.Forms.Label();
this.indir = new System.Windows.Forms.TextBox();
this.b_indir = new System.Windows.Forms.Button();
this.label2 = new System.Windows.Forms.Label();
this.infile = new System.Windows.Forms.TextBox();
this.fopen = new System.Windows.Forms.Button();
this.show = new System.Windows.Forms.RichTextBox();
this.up_dir = new System.Windows.Forms.Button();
this.save = new System.Windows.Forms.Button();
this.tabControl1 = new System.Windows.Forms.TabControl();
this.tabPage1 = new System.Windows.Forms.TabPage();
this.tabPage2 = new System.Windows.Forms.TabPage();
this.b_adddir = new System.Windows.Forms.Button();
this.add_dir = new System.Windows.Forms.TextBox();
this.label3 = new System.Windows.Forms.Label();
this.tabPage3 = new System.Windows.Forms.TabPage();
this.b_deldir = new System.Windows.Forms.Button();
this.del_dir = new System.Windows.Forms.TextBox();
this.label4 = new System.Windows.Forms.Label();
this.snd = new System.Windows.Forms.Label();
this.exit = new System.Windows.Forms.Button();
this.tabControl2 = new System.Windows.Forms.TabControl();
this.tabPage4 = new System.Windows.Forms.TabPage();
this.tabPage5 = new System.Windows.Forms.TabPage();
this.newf = new System.Windows.Forms.Button();
this.newfile = new System.Windows.Forms.TextBox();
this.label5 = new System.Windows.Forms.Label();
this.tabPage6 = new System.Windows.Forms.TabPage();
this.delf = new System.Windows.Forms.Button();
this.delfile = new System.Windows.Forms.TextBox();
this.label6 = new System.Windows.Forms.Label();
this.nowfile = new System.Windows.Forms.Label();
this.id = new System.Windows.Forms.TextBox();
this.pass = new System.Windows.Forms.Button();
this.tabControl1.SuspendLayout();
this.tabPage1.SuspendLayout();
this.tabPage2.SuspendLayout();
this.tabPage3.SuspendLayout();
this.tabControl2.SuspendLayout();
this.tabPage4.SuspendLayout();
this.tabPage5.SuspendLayout();
this.tabPage6.SuspendLayout();
this.SuspendLayout();
//
// format
//
this.format.Location = new System.Drawing.Point(360, 8);
this.format.Name = "format";
this.format.TabIndex = 0;
this.format.Text = "格式化";
this.format.Click += new System.EventHandler(this.format_Click);
//
// open
//
this.open.Location = new System.Drawing.Point(448, 8);
this.open.Name = "open";
this.open.TabIndex = 1;
this.open.Text = "打开";
this.open.Click += new System.EventHandler(this.open_Click);
//
// show_dir
//
this.show_dir.Location = new System.Drawing.Point(16, 232);
this.show_dir.Name = "show_dir";
this.show_dir.ReadOnly = true;
this.show_dir.Size = new System.Drawing.Size(328, 272);
this.show_dir.TabIndex = 2;
this.show_dir.Text = "";
//
// label1
//
this.label1.Location = new System.Drawing.Point(8, 16);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(128, 23);
this.label1.TabIndex = 3;
this.label1.Text = "输入要进入的子目录:";
//
// indir
//
this.indir.Location = new System.Drawing.Point(136, 16);
this.indir.Name = "indir";
this.indir.TabIndex = 4;
this.indir.Text = "";
//
// b_indir
//
this.b_indir.Location = new System.Drawing.Point(264, 16);
this.b_indir.Name = "b_indir";
this.b_indir.TabIndex = 5;
this.b_indir.Text = "进入子目录";
this.b_indir.Click += new System.EventHandler(this.b_indir_Click);
//
// label2
//
this.label2.Location = new System.Drawing.Point(16, 24);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(104, 16);
this.label2.TabIndex = 6;
this.label2.Text = "输入要打开的文件:";
//
// infile
//
this.infile.Location = new System.Drawing.Point(128, 24);
this.infile.Name = "infile";
this.infile.Size = new System.Drawing.Size(136, 21);
this.infile.TabIndex = 7;
this.infile.Text = "";
//
// fopen
//
this.fopen.Location = new System.Drawing.Point(96, 72);
this.fopen.Name = "fopen";
this.fopen.Size = new System.Drawing.Size(80, 23);
this.fopen.TabIndex = 8;
this.fopen.Text = "打开文件";
this.fopen.Click += new System.EventHandler(this.fopen_Click);
//
// show
//
this.show.Location = new System.Drawing.Point(392, 232);
this.show.Name = "show";
this.show.Size = new System.Drawing.Size(312, 272);
this.show.TabIndex = 9;
this.show.Text = "";
//
// up_dir
//
this.up_dir.Location = new System.Drawing.Point(264, 192);
this.up_dir.Name = "up_dir";
this.up_dir.TabIndex = 10;
this.up_dir.Text = "返回上级目录";
this.up_dir.Click += new System.EventHandler(this.up_dir_Click);
//
// save
//
this.save.Location = new System.Drawing.Point(216, 72);
this.save.Name = "save";
this.save.TabIndex = 11;
this.save.Text = "保存文件";
this.save.Click += new System.EventHandler(this.save_Click);
//
// tabControl1
//
this.tabControl1.Controls.Add(this.tabPage1);
this.tabControl1.Controls.Add(this.tabPage2);
this.tabControl1.Controls.Add(this.tabPage3);
this.tabControl1.Location = new System.Drawing.Point(8, 80);
this.tabControl1.Name = "tabControl1";
this.tabControl1.SelectedIndex = 0;
this.tabControl1.Size = new System.Drawing.Size(360, 80);
this.tabControl1.TabIndex = 12;
//
// tabPage1
//
this.tabPage1.Controls.Add(this.indir);
this.tabPage1.Controls.Add(this.label1);
this.tabPage1.Controls.Add(this.b_indir);
this.tabPage1.Location = new System.Drawing.Point(4, 21);
this.tabPage1.Name = "tabPage1";
this.tabPage1.Size = new System.Drawing.Size(352, 55);
this.tabPage1.TabIndex = 0;
this.tabPage1.Text = "进入子目录";
//
// tabPage2
//
this.tabPage2.Controls.Add(this.b_adddir);
this.tabPage2.Controls.Add(this.add_dir);
this.tabPage2.Controls.Add(this.label3);
this.tabPage2.Location = new System.Drawing.Point(4, 21);
this.tabPage2.Name = "tabPage2";
this.tabPage2.Size = new System.Drawing.Size(352, 55);
this.tabPage2.TabIndex = 1;
this.tabPage2.Text = "新建目录";
//
// b_adddir
//
this.b_adddir.Location = new System.Drawing.Point(248, 16);
this.b_adddir.Name = "b_adddir";
this.b_adddir.TabIndex = 2;
this.b_adddir.Text = "新建";
this.b_adddir.Click += new System.EventHandler(this.b_adddir_Click);
//
// add_dir
//
this.add_dir.Location = new System.Drawing.Point(80, 16);
this.add_dir.Name = "add_dir";
this.add_dir.Size = new System.Drawing.Size(128, 21);
this.add_dir.TabIndex = 1;
this.add_dir.Text = "";
//
// label3
//
this.label3.Location = new System.Drawing.Point(8, 16);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(64, 16);
this.label3.TabIndex = 0;
this.label3.Text = "目录名:";
//
// tabPage3
//
this.tabPage3.Controls.Add(this.b_deldir);
this.tabPage3.Controls.Add(this.del_dir);
this.tabPage3.Controls.Add(this.label4);
this.tabPage3.Location = new System.Drawing.Point(4, 21);
this.tabPage3.Name = "tabPage3";
this.tabPage3.Size = new System.Drawing.Size(352, 55);
this.tabPage3.TabIndex = 2;
this.tabPage3.Text = "删除目录";
//
// b_deldir
//
this.b_deldir.Location = new System.Drawing.Point(224, 16);
this.b_deldir.Name = "b_deldir";
this.b_deldir.TabIndex = 2;
this.b_deldir.Text = "删除";
this.b_deldir.Click += new System.EventHandler(this.b_deldir_Click);
//
// del_dir
//
this.del_dir.Location = new System.Drawing.Point(80, 16);
this.del_dir.Name = "del_dir";
this.del_dir.Size = new System.Drawing.Size(112, 21);
this.del_dir.TabIndex = 1;
this.del_dir.Text = "";
//
// label4
//
this.label4.Location = new System.Drawing.Point(8, 16);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(56, 24);
this.label4.TabIndex = 0;
this.label4.Text = "目录名:";
//
// snd
//
this.snd.Location = new System.Drawing.Point(16, 176);
this.snd.Name = "snd";
this.snd.Size = new System.Drawing.Size(232, 23);
this.snd.TabIndex = 13;
this.snd.Text = "当前目录:";
//
// exit
//
this.exit.Location = new System.Drawing.Point(544, 8);
this.exit.Name = "exit";
this.exit.TabIndex = 14;
this.exit.Text = "保存并退出";
this.exit.Click += new System.EventHandler(this.exit_Click);
//
// tabControl2
//
this.tabControl2.Controls.Add(this.tabPage4);
this.tabControl2.Controls.Add(this.tabPage5);
this.tabControl2.Controls.Add(this.tabPage6);
this.tabControl2.Location = new System.Drawing.Point(392, 56);
this.tabControl2.Name = "tabControl2";
this.tabControl2.SelectedIndex = 0;
this.tabControl2.Size = new System.Drawing.Size(336, 136);
this.tabControl2.TabIndex = 15;
//
// tabPage4
//
this.tabPage4.Controls.Add(this.label2);
this.tabPage4.Controls.Add(this.infile);
this.tabPage4.Controls.Add(this.fopen);
this.tabPage4.Controls.Add(this.save);
this.tabPage4.Location = new System.Drawing.Point(4, 21);
this.tabPage4.Name = "tabPage4";
this.tabPage4.Size = new System.Drawing.Size(328, 111);
this.tabPage4.TabIndex = 0;
this.tabPage4.Text = "打开文件";
//
// tabPage5
//
this.tabPage5.Controls.Add(this.newf);
this.tabPage5.Controls.Add(this.newfile);
this.tabPage5.Controls.Add(this.label5);
this.tabPage5.Location = new System.Drawing.Point(4, 21);
this.tabPage5.Name = "tabPage5";
this.tabPage5.Size = new System.Drawing.Size(328, 111);
this.tabPage5.TabIndex = 1;
this.tabPage5.Text = "新建文件";
//
// newf
//
this.newf.Location = new System.Drawing.Point(96, 64);
this.newf.Name = "newf";
this.newf.TabIndex = 2;
this.newf.Text = "新建";
this.newf.Click += new System.EventHandler(this.newf_Click);
//
// newfile
//
this.newfile.Location = new System.Drawing.Point(104, 24);
this.newfile.Name = "newfile";
this.newfile.TabIndex = 1;
this.newfile.Text = "";
//
// label5
//
this.label5.Location = new System.Drawing.Point(24, 24);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(64, 23);
this.label5.TabIndex = 0;
this.label5.Text = "文件名:";
//
// tabPage6
//
this.tabPage6.Controls.Add(this.delf);
this.tabPage6.Controls.Add(this.delfile);
this.tabPage6.Controls.Add(this.label6);
this.tabPage6.Location = new System.Drawing.Point(4, 21);
this.tabPage6.Name = "tabPage6";
this.tabPage6.Size = new System.Drawing.Size(328, 111);
this.tabPage6.TabIndex = 2;
this.tabPage6.Text = "删除文件";
//
// delf
//
this.delf.Location = new System.Drawing.Point(128, 72);
this.delf.Name = "delf";
this.delf.TabIndex = 2;
this.delf.Text = "删除";
this.delf.Click += new System.EventHandler(this.delf_Click);
//
// delfile
//
this.delfile.Location = new System.Drawing.Point(104, 32);
this.delfile.Name = "delfile";
this.delfile.Size = new System.Drawing.Size(120, 21);
this.delfile.TabIndex = 1;
this.delfile.Text = "";
//
// label6
//
this.label6.Location = new System.Drawing.Point(16, 32);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(56, 16);
this.label6.TabIndex = 0;
this.label6.Text = "文件名:";
//
// nowfile
//
this.nowfile.Location = new System.Drawing.Point(416, 200);
this.nowfile.Name = "nowfile";
this.nowfile.Size = new System.Drawing.Size(200, 23);
this.nowfile.TabIndex = 16;
this.nowfile.Text = "打开的文件是:";
//
// id
//
this.id.Location = new System.Drawing.Point(96, 16);
this.id.Name = "id";
this.id.TabIndex = 17;
this.id.Text = "";
//
// pass
//
this.pass.Location = new System.Drawing.Point(232, 16);
this.pass.Name = "pass";
this.pass.TabIndex = 18;
this.pass.Text = "登录";
this.pass.Click += new System.EventHandler(this.pass_Click);
//
// Form1
//
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.ClientSize = new System.Drawing.Size(752, 534);
this.Controls.Add(this.pass);
this.Controls.Add(this.id);
this.Controls.Add(this.nowfile);
this.Controls.Add(this.tabControl2);
this.Controls.Add(this.exit);
this.Controls.Add(this.snd);
this.Controls.Add(this.tabControl1);
this.Controls.Add(this.up_dir);
this.Controls.Add(this.show);
this.Controls.Add(this.show_dir);
this.Controls.Add(this.open);
this.Controls.Add(this.format);
this.Name = "Form1";
this.Text = "Form1";
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -