示例#1
0
        public FolderModel GetFolderInfo(string path)
        {
            string absolutePath = Path.Combine(_rootPath, path);

            if (Directory.Exists(absolutePath) == false)
            {
                return(null);
            }

            var folderInfo = new FolderModel()
            {
                Path         = path,
                ChildFolders = Directory.EnumerateDirectories(absolutePath)
                               .Select(s => ToRelativePath(s))
                               .Where(s => !string.Equals(s, _previewFolderPath, StringComparison.OrdinalIgnoreCase))
                               .ToList(),
                Files = Directory.EnumerateFiles(absolutePath)
                        .Select(s => new FileModel(ToRelativePath(s)))
                        .ToList()
            };

            folderInfo.CleanupPaths();

            return(folderInfo);
        }