/// <summary> /// Get all the files included in the project. /// </summary> void GetProjectItem(ProjectItem item, List <ProjectFileItem> files) { // Gets the files associated with a ProjectItem. // Most project items consist of only one file, but some can have more than // one, as with forms in Visual Basic that are saved as both .frm (text) and // .frx (binary) files. // See http://msdn.microsoft.com/en-us/library/envdte.projectitem.filecount.aspx for (short i = 0; i < item.FileCount; i++) { if (File.Exists(item.FileNames[i])) { ProjectFileItem fileItem = new ProjectFileItem(); fileItem.Fileinfo = new FileInfo(item.FileNames[i]); if (fileItem.FullName.StartsWith(this.ProjectFolder.FullName, StringComparison.OrdinalIgnoreCase)) { fileItem.IsUnderProjectFolder = true; fileItem.NeedCopy = true; } files.Add(fileItem); } } // Get the files of sub node under this node. foreach (ProjectItem subItem in item.ProjectItems) { GetProjectItem(subItem, files); } }
/// <summary> /// 获取包含在项目中的所有文件 /// </summary> void GetProjectItem(ProjectItem item, List <ProjectFileItem> files) { // 获取与一个项目项相关的文件。 // 大部分的工程项目包括只有一个文件,但有些的可能不止一个, // 在Visual Basic中有两种文件形式保存.FRM(文本)和.frx(二进制)文件。 // 敬请查看 http://msdn.microsoft.com/en-us/library/envdte.projectitem.filecount.aspx for (short i = 0; i < item.FileCount; i++) { if (File.Exists(item.FileNames[i])) { ProjectFileItem fileItem = new ProjectFileItem(); fileItem.Fileinfo = new FileInfo(item.FileNames[i]); if (fileItem.FullName.StartsWith(this.ProjectFolder.FullName, StringComparison.OrdinalIgnoreCase)) { fileItem.IsUnderProjectFolder = true; fileItem.NeedCopy = true; } files.Add(fileItem); } } // 获取此节点下的子节点的文件。 foreach (ProjectItem subItem in item.ProjectItems) { GetProjectItem(subItem, files); } }
/// <summary> /// 获取包含在项目中的所有文件 /// </summary> void GetProjectItem(ProjectItem item, List<ProjectFileItem> files) { // 获取与一个项目项相关的文件。 // 大部分的工程项目包括只有一个文件,但有些的可能不止一个, // 在Visual Basic中有两种文件形式保存.FRM(文本)和.frx(二进制)文件。 // 敬请查看 http://msdn.microsoft.com/en-us/library/envdte.projectitem.filecount.aspx for (short i = 0; i < item.FileCount; i++) { if (File.Exists(item.FileNames[i])) { ProjectFileItem fileItem = new ProjectFileItem(); fileItem.Fileinfo = new FileInfo(item.FileNames[i]); if (fileItem.FullName.StartsWith(this.ProjectFolder.FullName, StringComparison.OrdinalIgnoreCase)) { fileItem.IsUnderProjectFolder = true; fileItem.NeedCopy = true; } files.Add(fileItem); } } // 获取此节点下的子节点的文件。 foreach (ProjectItem subItem in item.ProjectItems) { GetProjectItem(subItem, files); } }