Esempio n. 1
0
 public void Rename(FileObject file, string newName)
 {
     if (file.Name == newName) return;
     string path = CombineName(file.Directory, newName, file.Extension);
     while (File.Exists(path))
     {
         string rndtx = Path.GetRandomFileName();
         path = CombineName(file.Directory, 
             string.Format("{0}_{1}", newName, rndtx), file.Extension);
     }
     File.Move(file.Path, path);
     File.Delete(file.Path);
 }
Esempio n. 2
0
 public void Rename(FileObject file, string newName)
 {
     if (file.Name == newName) return;
     string path = CombineName(file.Directory, newName, file.Extension);
     while (File.Exists(path))
     {
         string rndtx = Path.GetRandomFileName();
         path = CombineName(file.Directory,
             string.Format("{0}_{1}", newName, rndtx), file.Extension);
     }
     File.Move(file.Path, path);
     File.Delete(file.Path);
 }
Esempio n. 3
0
 /// <summary>
 /// fill the items to file list box
 /// </summary>
 private void SetFileItems(FileObject[] collection)
 {
     FileListBox.Items.Clear();
     if (collection != null)
     {
         FileListBox.Items.AddRange(collection);
     }
 }