private static IEnumerable<SyncPath> GetAllRelativeFilePaths(this DirectoryInfo dirInfo, string rootPath, bool isRoot = true)
        {
            var paths = new List<SyncPath>();
            if(!isRoot)
            {
                var path = new SyncPath(dirInfo.FullName, rootPath, dirInfo.Attributes.ToString(), true);
                paths.Add(path);
            }

            paths.AddRange(dirInfo.GetFiles().Select(file => new SyncPath(file.FullName, rootPath, file.Attributes.ToString())));
            paths.AddRange(dirInfo.GetDirectories().SelectMany(dir => GetAllRelativeFilePaths(dir, rootPath, false)));
            return paths;
        }
Esempio n. 2
0
        private static IEnumerable <SyncPath> GetAllRelativeFilePaths(this DirectoryInfo dirInfo, string rootPath, bool isRoot = true)
        {
            var paths = new List <SyncPath>();

            if (!isRoot)
            {
                var path = new SyncPath(dirInfo.FullName, rootPath, dirInfo.Attributes.ToString(), true);
                paths.Add(path);
            }

            paths.AddRange(dirInfo.GetFiles().Select(file => new SyncPath(file.FullName, rootPath, file.Attributes.ToString())));
            paths.AddRange(dirInfo.GetDirectories().SelectMany(dir => GetAllRelativeFilePaths(dir, rootPath, false)));
            return(paths);
        }
Esempio n. 3
0
        private static IEnumerable <SyncPath> GetAllRelativeFilePaths(SyncDirDirectory syncDir, string rootPath, bool isRoot)
        {
            var paths = new List <SyncPath>();

            if (!isRoot)
            {
                var path = new SyncPath(syncDir.FullPath, rootPath, syncDir.Attributes)
                {
                    IsDirectory = true
                };
                paths.Add(path);
            }

            paths.AddRange(syncDir.Files.Select(file => new SyncPath(file.FullPath, rootPath, file.Attributes)));
            paths.AddRange(syncDir.Directories.SelectMany(dir => GetAllRelativeFilePaths(dir, rootPath, false)));
            return(paths);
        }