Пример #1
0
 public void Add(DirectoryViewModel directoryViewModel, int atIndex = -1)
 {
     if (atIndex == -1)
     {
         FavoriteDirectories.Add(directoryViewModel);
     }
     else
     {
         FavoriteDirectories.Insert(atIndex, directoryViewModel);
     }
 }
Пример #2
0
 private static IEnumerable <FileSystemItemViewModel> GetVisibleChildren(DirectoryInfo info)
 {
     try {
         //var children = Directory.EnumerateFileSystemEntries(path.Value);
         var children       = info.EnumerateFileSystemInfos();
         var childrenToShow = Settings.Default.ShowHiddenFiles
                                 ? children
                                 : children.Where(i => !i.IsReallyHidden());
         return(childrenToShow.Select(c => c is FileInfo
                                 ? new FileViewModel(c.FullName.ToNormalizedPath()) as FileSystemItemViewModel
                                 : DirectoryViewModel.Get(c.FullName.ToNormalizedPath())));
     } catch (UnauthorizedAccessException) {
         Log.Error($"Unauthorized access to {info.FullName.ToNormalizedPath()}");
         return(Enumerable.Empty <FileSystemItemViewModel>());
     }
 }