public CreateFileNode ( ProjectElement item ) : FileNode | ||
item | ProjectElement | msbuild item |
Результат | FileNode |
private static void AddNonMemberFileItems(ProjectNode project, IEnumerable<string> fileList) { ErrorHelper.ThrowIsNull(fileList, "fileList"); foreach (string fileKey in fileList) { HierarchyNode parentNode = project; string[] pathItems = fileKey.Split(new[] { Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar }); if (StringComparer.OrdinalIgnoreCase.Equals(fileKey, project.ProjectFile)) continue; NemerleFolderNode topFolderNode = null; foreach (string fileOrDir in pathItems) { string childNodeId = Path.Combine(parentNode.VirtualNodeName, fileOrDir); FileInfo fileOrDirInfo = new FileInfo(Path.Combine(project.ProjectFolder, childNodeId)); if ((fileOrDirInfo.Attributes & FileAttributes.Hidden) == FileAttributes.Hidden) break; HierarchyNode childNode = parentNode.FindChild(childNodeId); if (childNode == null) { if (topFolderNode == null) { topFolderNode = parentNode as NemerleFolderNode; if (topFolderNode != null && (!topFolderNode.IsNonMemberItem) && topFolderNode.IsExpanded) topFolderNode = null; } ProjectElement element = new ProjectElement(project, null, true); element.Rename(childNodeId); element.SetMetadata(ProjectFileConstants.Name, childNodeId); childNode = project.CreateFileNode(element); parentNode.AddChild(childNode); break; } parentNode = childNode; } if (topFolderNode != null) topFolderNode.CollapseFolder(); } }