CmisSync.CmisTree.LocalFolderLoader.CreateNodesFromLocalFolder C# (CSharp) Method

CreateNodesFromLocalFolder() public static method

Loads all sub folder from the given path
public static CreateNodesFromLocalFolder ( string path, Node parent ) : List
path string
parent Node Parent Node for the new list of Nodes
return List
        public static List<Node> CreateNodesFromLocalFolder(string path, Node parent)
        {
            string[] subdirs = Directory.GetDirectories(path);
            List<Node> results = new List<Node>();
            foreach (string subdir in subdirs)
            {
                Folder f = new Folder()
                {
                    Name = new DirectoryInfo(subdir).Name,
                    Parent = parent,
                    LocationType = Node.NodeLocationType.LOCAL
                };
                if(f.Parent.Path.EndsWith("/"))
                    f.Path = f.Parent.Path + f.Name ;
                else
                    f.Path = f.Parent.Path + "/" + f.Name ;
                f.IsIllegalFileNameInPath = CmisSync.Lib.Utils.IsInvalidFolderName(f.Name, ConfigManager.CurrentConfig.IgnoreFolderNames);
                List<Node> children = CreateNodesFromLocalFolder(subdir, f);
                foreach (Node child in children)
                    f.Children.Add(child);
                results.Add(f);
            }
            return results;
        }