Esempio n. 1
0
 private void listViewRemote_KeyDown(object sender, KeyEventArgs e)
 {
     try
     {
         if (e.KeyCode == Keys.Delete)
         {
             if (listViewRemote.SelectedItems != null)
             {
                 foreach (ListViewItem lvi in listViewRemote.SelectedItems)
                 {
                     if (MessageBox.Show("Do you really want to delete " + lvi.Text + " ?", "NFS Client", MessageBoxButtons.YesNo) == DialogResult.Yes)
                     {
                         if (lvi.ImageIndex == 0)
                         {
                             nfsClient.DeleteFile(nfsClient.Combine(lvi.Text, RemoteFolder));
                         }
                         else
                         {
                             nfsClient.DeleteDirectory(nfsClient.Combine(lvi.Text, RemoteFolder));
                         }
                     }
                 }
                 RefreshRemote();
             }
         }
         else if (e.KeyCode == Keys.F5)
         {
             RefreshRemote();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString(), "NFS Client");
     }
 }
Esempio n. 2
0
        public int DeleteDirectory(string filename, DokanFileInfo info)
        {
            int ret = DokanNet.DOKAN_SUCCESS;

            filename = CleanFileName(filename);

            try
            {
                Debug("DeleteDirectory {0}", filename);
                string Directory = nfsClient.GetDirectoryName(filename);
                string FileName  = nfsClient.GetFileName(filename);
                string FullPath  = nfsClient.Combine(FileName, Directory);

                nfsClient.DeleteDirectory(FullPath);
            }
            catch (Exception ex)
            {
                ret = DokanNet.DOKAN_ERROR;
                Debug("DeleteDirectory file {0} exception {1}", filename, ex.Message);
            }

            return(ret);
        }