示例#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);
 }
示例#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);
 }
示例#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);
     }
 }