/// <summary> /// Gets the children collection of the <see cref="FileEntry"/> by the <see cref="parentEntry"/>. /// </summary> /// <param name='parententry'>The parent <see cref="FileEntry"/> object or null.</param> /// <returns>The children collection of the <see cref="FileEntry"/>.</returns> public List<FileEntry> GetChildren(FileEntry parentEntry) { var pathes = parentEntry == null ? MgrAccessor.DiskUtils.GetFileEntries(null) : MgrAccessor.DiskUtils.GetFileEntries(parentEntry.Path); var coll = new List<FileEntry>(); foreach (var path in pathes) { var type = _GetTypeByPath(path); var name = MgrAccessor.DiskUtils.GetFileNameWithoutExtension(path); var size = MgrAccessor.DiskUtils.GetFileSize(path); var entry = new FileEntry { FeType = type, Path = path, Name = name, Size = size }; coll.Add(entry); } return coll.OrderBy(x => x.FeType).ToList(); }
public FileEntryTableVC(FileEntry fileEntry) : base(null, null) { _OpenedFileEntry = fileEntry; }
/// <summary> /// Renames the <see cref="entry"/> name for the <see cref="newName"/>. /// </summary> /// <param name='entry'>The <see cref="FileEntry"/>.</param> /// <param name='newName'>The new name.</param> /// <returns><value>true</value> if the operation success, otherwise <value>false</value>.</returns> public bool Rename(FileEntry entry, string newName) { string newPath; var success = MgrAccessor.DiskUtils.RenameFileSystemInfo(entry.Path, newName, out newPath); if (success) { entry.Path = newPath; entry.Name = MgrAccessor.DiskUtils.GetFileNameWithoutExtension(newPath); return true; } return false; }
/// <summary> /// Deletes the <see cref="entry"/>. /// </summary> /// <param name='entry'>The <see cref="FileEntry"/>.</param> /// <returns><value>true</value> if the operation success, otherwise <value>false</value>.</returns> public bool Delete(FileEntry entry) { var success = MgrAccessor.DiskUtils.DeleteFileSystemInfo(entry.Path); return success; }