コード例 #1
0
        public DiscoveryResult ScanFolder(string path)
        {
            var root = new DiscoveryResult(path);

            RecursiveScan(root);
            return(root);
        }
コード例 #2
0
        private DiscoveryResult RecursiveScan(DiscoveryResult parent)
        {
            var path        = parent.Path;
            var directories = Directory.GetDirectories(path)
                              .Where(filePath => AccessUtility.HasAccess(filePath))
                              .ToList().Select(filePath => new DiscoveryResult(filePath));

            foreach (var directory in directories)
            {
                RecursiveScan(directory);
                parent.AddChild(directory);
            }
            var files = Directory.GetFiles(path).ToList()
                        .Where(filePath => AccessUtility.HasAccess(filePath))
                        .Where(file =>
                               VideoFile.Extensions.Contains(Path.GetExtension(file), new ExtensionComparer())
                               )

                        .Select(filePath => new DiscoveryResult(filePath));

            foreach (var file in files)
            {
                parent.AddChild(file);
            }

            return(parent);
        }
コード例 #3
0
ファイル: DiscoveryResult.cs プロジェクト: judedaryl/dionysus
 public void AddChild(DiscoveryResult child)
 {
     Children.Add(child);
 }