public async IAsyncEnumerable GetChildrenAsync()

in Core/src/Impl/Storages/FileSystemStorage.cs [195:234]


    public async IAsyncEnumerable<ChildrenItem> GetChildrenAsync(ChildrenMode mode, SymbolStoragePath? prefixDir = null)
    {
      await Task.Yield();
      using (await myRwLock.AcquireReadLockAsync())
      {
        var stack = new Stack<string>();
        if (prefixDir != null)
        {
          var prefixDiskPath = SymbolPathToDiskPath(prefixDir.Value);
          if (!Directory.Exists(prefixDiskPath))
            yield break;
          stack.Push(prefixDiskPath);
        }
        else
        {
          stack.Push(myRootDir);
        }

        while (stack.Count > 0)
        {
          var dir = stack.Pop();
          foreach (var path in Directory.EnumerateFileSystemEntries(dir))
          {
            var file = new FileInfo(path);
            if ((file.Attributes & FileAttributes.Directory) == 0)
            {
              yield return new ChildrenItem
              {
                FileName = DiskPathToSymbolPath(path),
                Size = (mode & ChildrenMode.WithSize) != 0 ? file.Length : null
              };
            }
            else
            {
              stack.Push(path);
            }
          }
        }
      }
    }