Ejemplo n.º 1
0
        private IEnumerable <LocalFile> getAllFiles(IEnumerable <string> currentRelativePath)
        {
            List <LocalFile> ret = new List <LocalFile>();

            string path = BuildPath(this.Path, currentRelativePath);

            string[] fullPaths = Directory.GetFiles(path);

            ItemLocation loc = ItemLocation.FromFolderTree(currentRelativePath);

            foreach (string fpath in fullPaths)
            {
                ret.Add(new LocalFile(loc.SetName(IOPath.GetFileName(fpath)), fpath));
            }

            //recursive call.
            foreach (var dir in Directory.GetDirectories(path))
            {
                ret.AddRange(getAllFiles(currentRelativePath.Concat(new[] { dir })));
            }

            return(ret);
        }