//
        public void stick_click()
        {
            if (CategoryManage.IsCut)
            {
                //删除
                CategoryManage.delete(CategoryManage.Create, CategoryManage.cut_file.Path);

                CategoryManage.cut_file.Path = CategoryManage.CurrentFile.Path + "/" + CategoryManage.cut_file.Name;
                CategoryManage.cut_file.Date = DateTime.Now.ToString();
                CategoryManage.listFiles.Add(CategoryManage.cut_file);
                CategoryManage.IsCut = false;
                CategoryManage.Update();
            }
            else if (CategoryManage.IsCopy)
            {
                //复制
                if (CategoryManage.copy_file != null)
                {
                    string str   = DiskManage.getStrContent(CategoryManage.copy_file.Disk_start, CategoryManage.copy_file.Size);
                    int    size  = 0;
                    int    start = DiskManage.saveContent(str, ref size);
                    CategoryManage.copy_file.Disk_start = start;
                    CategoryManage.copy_file.Size       = size;
                    CategoryManage.copy_file.Date       = DateTime.Now.ToString();

                    CategoryManage.listFiles.Add(CategoryManage.copy_file);
                    CategoryManage.Update();
                }
            }

            this.DialogResult = true;
        }
        //粘贴
        private void Click_Stick(object sender, RoutedEventArgs e)
        {
            //剪切
            if (CategoryManage.IsCut)
            {
                //删除
                CategoryManage.delete(CategoryManage.Create, CategoryManage.cut_file.Path);
                CategoryManage.cut_file.Path = CategoryManage.CurrentFile.Path + "/" + CategoryManage.cut_file.Name;
                CategoryManage.cut_file.Date = DateTime.Now.ToString();
                CategoryManage.listFiles.Add(CategoryManage.cut_file);
                CategoryManage.IsCut = false;
                CategoryManage.Update();
            }
            //复制
            else if (CategoryManage.IsCopy)
            {
                if (CategoryManage.copy_file != null)
                {
                    string str   = DiskManage.getStrContent(CategoryManage.copy_file.Disk_start, CategoryManage.copy_file.Size);
                    int    size  = 0;
                    int    start = DiskManage.saveContent(str, ref size);
                    CategoryManage.copy_file.Disk_start = start;
                    CategoryManage.copy_file.Size       = size;

                    CategoryManage.copy_file.Path = CategoryManage.CurrentFile.Path + "/" + CategoryManage.copy_file.Name;
                    CategoryManage.copy_file.Date = DateTime.Now.ToString();

                    CategoryManage.listFiles.Add(CategoryManage.copy_file);
                    CategoryManage.Update();
                }
            }
        }
Esempio n. 3
0
        public void save_MenuItem_Click(object sender, RoutedEventArgs e)
        {
            int size = 0;

            DiskManage.deleteFile(CategoryManage.selectedFile.Disk_start);  //删除原本磁盘
            int start = DiskManage.saveContent(text_content.Text, ref size);

            CategoryManage.selectedFile.Disk_start       = start;
            CategoryManage.selectedFile.Size             = size;
            CategoryManage.selectedFile.Occupation_space = (int)Math.Ceiling(Convert.ToDouble(size / 512.0)) * 512;
            CategoryManage.selectedFile.Date             = DateTime.Now.ToString();
            CategoryManage.Update();
        }