Exemple #1
0
 private Option <GitreeStorageFileNode> VisitFolder(GitreeStorageFolderNode folder)
 {
     if (folder.GetDocuments().SingleOrDefault() is GitreeStorageFileNode doc)
     {
         return(doc.Some());
     }
     folder.GetFolders().ForEach(FoldersToVisit.Enqueue);
     return(default);
Exemple #2
0
            public IEnumerable <GitreeStorageFileNode> GetRootDocuments(SourceFolder sourceFolder)
            {
                var initialDir    = Info.GetDirectoryInfoFor(sourceFolder);
                var initialFolder = new GitreeStorageFolderNode(initialDir, null, Workspace);

                FoldersToVisit.Enqueue(initialFolder);
                return(GetCore().Values());

                IEnumerable <Option <GitreeStorageFileNode> > GetCore()
                {
                    while (FoldersToVisit.Count > 0)
                    {
                        var folder = FoldersToVisit.Dequeue();
                        yield return(VisitFolder(folder));
                    }
                }
            }