Example #1
0
        //创建文本文件的操作
        private void 文本文件ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            //初始化文本文件名
            //string file_name = nameCheck("New file", ".txt");
            string file_name = "New file.txt";
            string fatherPath;

            //为文本文件创建自己的FCB,并设置其文件类型为文本文件
            FCB new_fcb = new FCB(file_name, FCB.FileType.txt);

            //将文件加到当前目录的子目录中
            current_catalog_fcb.addSonItem(new_fcb);

            //得到当前目录的路径
            File father = catalog.getFile(current_catalog_fcb);

            fatherPath = (father == null) ? "root" : father.path;

            //创建文件
            File new_file = new File(new_fcb, fatherPath);

            filestore.Push(new_file);

            //建立内存指针分别于FCB和文件之间的映射关系
            catalog.map(new_fcb, new_file);

            //更新右侧文件列表
            UpdateListView();
        }
        //新建文件
        private void 文件ToolStripMenuItem1_Click(object sender, EventArgs e)
        {
            string file_name = nameCheck("New text", ".txt");
            string fatherPath;
            //新建FCB
            FCB new_fcb = new FCB(file_name, FCB.FileType.txt);

            current_directory.addSonItem(new_fcb);

            //建立文件路径
            File father = directory.getFile(current_directory);

            fatherPath = (father == null) ? "root" : father.path;

            //新建文件
            File new_file = new File(new_fcb, fatherPath);

            directory.map(new_fcb, new_file);

            UpdateListView(current_directory);
        }
Example #3
0
        private void 文件ToolStripMenuItem1_Click(object sender, EventArgs e)
        {
            string file_name = nameCheck("New text", ".txt");
            string fatherPath;
            //Add new FCB
            FCB new_fcb = new FCB(file_name, FCB.FileType.txt);

            current_catalog.addSonItem(new_fcb);

            //Add new File
            //Build new file path
            File father = catalog.getFile(current_catalog);

            fatherPath = (father == null) ? "root" : father.path;

            File new_file = new File(new_fcb, fatherPath);

            catalog.map(new_fcb, new_file);

            UpdateListView(current_catalog);
        }