Beispiel #1
0
        private void NewFolder_Button_Click(object sender, RoutedEventArgs e)
        {
            FolderAdd folderAddWindow = new FolderAdd();

            folderAddWindow.ShowDialog();

            string name = folderAddWindow._newFolderName;

            //窗口直接关闭的情况
            if (name == null)
            {
                return;
            }

            //命名含有非法字符检测
            if (name.Contains(" ") || name == "")
            {
                System.Windows.MessageBox.Show("含有非法字符");
                return;
            }

            //重名检测
            if (FindFCBName(name) != null)
            {
                System.Windows.MessageBox.Show("“" + name + "”已存在");
                return;
            }

            string newFolderName = folderAddWindow._newFolderName;
            FCB    newFolder     = new FCB(Type.Folder, newFolderName, 1, ++FCBID);

            newFolder.father = currentDirectory;
            currentDirectory.folderSon.Add(newFolder);
            UpdateAncestorSize(newFolder, newFolder.size);

            disk.AddNewFCB(newFolder);

            UpdateCurrentDir();
            UpdateFCBList();
        }
Beispiel #2
0
        private void Format_Button_Click(object sender, RoutedEventArgs e)
        {
            Recursion_Delete(rootFolder);
            disk = null;
            GC.Collect();

            FCBID = 0;
            disk  = new FAT(blockNum);

            rootFolder = new FCB(Type.Folder, "root", 1, ++FCBID);
            disk.AddNewFCB(rootFolder);

            Init();
        }
Beispiel #3
0
        private FCB currentDirectory = null;                    //当前所在目录地址

        //private ContextMenu rightClickMenu;                   //右键菜单

        //private FCB operatingFolder = null;                   //当前正在操作的文件夹

        //private FCB currentFile = null;                       //当前正在操作的文件

        public FolderShow(int _blockNum)
        {
            InitializeComponent();

            blockNum = _blockNum;

            FCBID = 0;
            disk  = new FAT(blockNum);

            rootFolder = new FCB(Type.Folder, "root", 1, ++FCBID);
            disk.AddNewFCB(rootFolder);

            Init();
        }