// Navigation methods

        public void Refresh()
        {
            try
            {
                DirectoryInfo[] dirs  = Root.Path.GetDirectories();
                FileInfo[]      files = Root.Path.GetFiles();
                TryRefresh(dirs, files);
            }
            catch (IOException e)
            {
                Prompter.HandleError(e);
            }

            catch (UnauthorizedAccessException e)
            {
                Prompter.HandleError(e);
            }
        }
示例#2
0
 public void Move(ICollection <FileSystemInfo> items, DirectoryInfo destination)
 {
     foreach (FileSystemInfo item in items)
     {
         try
         {
             File.Move(item.FullName, destination.FullName + "\\" + item.Name);
         }
         catch (IOException e)
         {
             Prompter.HandleError(e);
         }
     }
     OnResponse();
 }
 public void Decompress(ICollection <FileSystemInfo> sources, DirectoryInfo rootDirInfo)
 {
     try
     {
         RootDirInfo = rootDirInfo;
         SentSources = sources;
         ArchiverForm af = new ArchiverForm
                               (OnDecompressInputResponse,
                               SentSources.ElementAt(0).Name);
         af.Show();
     }
     catch (IOException e)
     {
         Prompter.HandleError(e);
     }
 }
 public void OnDecompressInputResponse(string input, string password)
 {
     if (password != "")
     {
         Archiver.SetEncryption(password);
     }
     try
     {
         Archiver.DecompressItem(SentSources.ElementAt(0), RootDirInfo + "\\" + input);
     }
     catch (IOException e)
     {
         Prompter.HandleError(e);
     }
     Archiver.DisableEncryption();
     OnResponse();
 }
 public void Archive(ICollection <FileSystemInfo> sources, DirectoryInfo rootDirInfo)
 {
     try
     {
         RootDirInfo = rootDirInfo;
         SentSources = sources;
         ArchiverForm af = new ArchiverForm
                               (OnArchiveNameInputResponse,
                               SentSources.ElementAt(0).Name + ".zip");
         af.Show();
     }
     catch (UnauthorizedAccessException e)
     {
         Prompter.HandleError(e);
     }
     catch (IOException e)
     {
         Prompter.HandleError(e);
     }
 }