Esempio n. 1
0
        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="fileinfo"></param>
        public static void Delete(FATInfo fileinfo)
        {
            var info = myFileSystem.GetFileInfoA(Data.DriveName, fileinfo.Location, Data.Volume.Cluster);
            var res  = myFileSystem.DeleteFile(Data.DriveName, Data.Volume, info);

            res = myFileSystem.DeleteInDir(Data.DriveName, Data.Volume, info.Location, Data.current);
        }
Esempio n. 2
0
 /// <summary>
 /// 重命名
 /// </summary>
 /// <param name="fileinfo"></param>
 /// <param name="name"></param>
 public static void ChangeName(FATInfo fileinfo, string name)
 {
     if (fileinfo.Type == 0) //目录型
     {
         var info = myFileSystem.GetFileInfo(Data.DriveName, fileinfo.Location, Data.Volume.Cluster) as DirectInfo;
         info.Name = name;
         myFileSystem.SetFileInfo(Data.DriveName, info);
         return;
     }
     else //实体文件型
     {
         var info = myFileSystem.GetFileInfoA(Data.DriveName, fileinfo.Location, Data.Volume.Cluster);
         info.Name = name;
         myFileSystem.SetFileInfo(Data.DriveName, info);
         return;
     }
 }
Esempio n. 3
0
        /// <summary>
        /// 导出
        /// </summary>
        /// <param name="fileinfo"></param>
        public static void Export(FATInfo fileinfo)
        {
            var info = myFileSystem.GetFileInfoA(Data.DriveName, fileinfo.Location, Data.Volume.Cluster);
            var res  = myFileSystem.ReadFile(Data.DriveName, Data.Volume, info);

            //保存
            var saveFileDialog = new SaveFileDialog();

            saveFileDialog.Filter           = "|*." + info.Extension;
            saveFileDialog.FileName         = info.Name + "." + info.Extension;
            saveFileDialog.RestoreDirectory = true;
            if (saveFileDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                Stream       fs     = saveFileDialog.OpenFile();
                BinaryWriter writer = new BinaryWriter(fs);
                writer.Write(res.ToArray());
                writer.Close();
            }
            return;
        }