예제 #1
0
        private FolderResult GetFolderResult(string targetPath)
        {
            var result = new FolderResult();

            var dir = VirtualFiles.GetDirectory(targetPath);

            foreach (var subDir in dir.Directories)
            {
                if (ExcludeDirectories.Contains(subDir.Name))
                {
                    continue;
                }

                result.Folders.Add(new Folder
                {
                    Name         = subDir.Name,
                    ModifiedDate = subDir.LastModified,
                    FileCount    = subDir.GetFiles().Count(),
                });
            }

            foreach (var fileInfo in dir.GetFiles())
            {
                result.Files.Add(new File
                {
                    Name          = fileInfo.Name,
                    Extension     = fileInfo.Extension,
                    FileSizeBytes = fileInfo.Length,
                    ModifiedDate  = fileInfo.LastModified,
                    IsTextFile    = TextFileExtensions.Contains(fileInfo.Extension),
                });
            }

            return(result);
        }
예제 #2
0
        private FolderResult GetFolderResult(string targetPath)
        {
            var result = new FolderResult();

            var dir = VirtualFiles.GetDirectory(targetPath);
            foreach (var subDir in dir.Directories)
            {
                if (ExcludeDirectories.Contains(subDir.Name)) continue;

                result.Folders.Add(new Folder
                {
                    Name = subDir.Name,
                    ModifiedDate = subDir.LastModified,
                    FileCount = subDir.GetFiles().Count(),
                });
            }

            foreach (var fileInfo in dir.GetFiles())
            {
                result.Files.Add(new File
                {
                    Name = fileInfo.Name,
                    Extension = fileInfo.Extension,
                    FileSizeBytes = fileInfo.Length,
                    ModifiedDate = fileInfo.LastModified,
                    IsTextFile = TextFileExtensions.Contains(fileInfo.Extension),
                });
            }

            return result;
        }