コード例 #1
0
        public void GetXml(XmlNode xmlNode, SubFolder subFolder)
        {
            XmlNode folderNode = CommonXml.GetNode(xmlNode, "folder", EmptyNodeHandling.ForceCreateNew);

            CommonXml.SetAttributeValue(folderNode, "name", Name);

            foreach (FileInfo fileInfo in _directoryInfo.GetFiles())
            {
                XmlNode fileNode = CommonXml.GetNode(folderNode, "file", EmptyNodeHandling.ForceCreateNew);
                CommonXml.SetAttributeValue(fileNode, "name", fileInfo.Name);
                CommonXml.SetAttributeValue(fileNode, "extension", fileInfo.Extension);

                GetFileAttributes(fileNode, fileInfo.Name);
            }

            if (subFolder == SubFolder.IncludeSubfolders)
            {
                foreach (DirectoryInfo directoryInfo in _directoryInfo.GetDirectories())
                {
                    if (Filter(directoryInfo.Name))
                    {
                        FolderElement folderElement = new FolderElement(directoryInfo.FullName);

                        folderElement.GetXml(folderNode, SubFolder.IncludeSubfolders);
                    }
                }
            }
        }
コード例 #2
0
        public FolderElement GetFolder(String folder)
        {
            String path = Path.Combine(_rootFilesPath, folder);

            FolderElement folderElement = Directory.Exists(path)
                ? new FolderElement(path)
                : null;

            return(folderElement);
        }
コード例 #3
0
 public FileTree(Process process)
 {
     _process       = process;
     _rootFilesPath = Path.Combine(_process.Root, _process.Settings["filetree/filesPath"]);
     RootFolder     = new FolderElement(_rootFilesPath);
 }