예제 #1
0
 public async Task RefreshAsync(CancellationToken cancellationToken, int initialRealizedFileSystemTreeLevels = defaultInitializationDepth)
 {
     if (initialRealizedFileSystemTreeLevels < 1)
     {
         throw new ArgumentOutOfRangeException("Level count can't be smaller than 1");
     }
     InternalDrives.Clear();
     FileSystemMount.ChildFileSystemItems.Clear();
     InternalFileSystemRoot.Clear();
     await InitializeFileSystemTreeAsync(cancellationToken, initialRealizedFileSystemTreeLevels);
 }
예제 #2
0
 public async Task InitializeFileSystemTreeAsync(CancellationToken cancellationToken, int initialRealizedFileSystemTreeLevels = defaultInitializationDepth, bool isSortingEnabled = false)
 {
     if (initialRealizedFileSystemTreeLevels < 1)
     {
         throw new ArgumentOutOfRangeException("Level count can't be smaller than 1");
     }
     await Task.Run(() =>
     {
         foreach (DriveInfo drive in DriveInfo.GetDrives())
         {
             InternalDrives.Add(drive);
         }
         var rootItems = CreateFileSystemRootItems(InternalDrives, cancellationToken);
         foreach (IFileSystemItemModel rootItem in rootItems)
         {
             FileSystemMount.ChildFileSystemItems.Add(rootItem);
             InternalFileSystemRoot.Add(rootItem);
         }
         RealizeFromRoot(initialRealizedFileSystemTreeLevels, cancellationToken, isSortingEnabled);
     }, cancellationToken);
 }