/// <summary> /// Gets the config files. /// Config files are found in: /// < project > < ItemGroup > < None > /// Then: /// get name from the atribute "Include", /// get CopyToOutputDirectory from child element "CopyToOutputDirectory" /// </summary> /// <param name="doc"></param> /// <param name="mgr"></param> /// <returns></returns> private List <ProjectConfigFile> GetConfigs(XmlDocument doc, XmlNamespaceManager mgr) { XmlNodeList nodes; XmlNode node; List <ProjectConfigFile> files; ProjectConfigFile file; string filename; int index; files = new List <ProjectConfigFile>(); nodes = doc.SelectNodes("/x:Project/x:ItemGroup/x:None", mgr); foreach (XmlNode child in nodes) { file = new ProjectConfigFile(); filename = child.Attributes["Include"].InnerText; index = -1; if (filename.Contains(Path.DirectorySeparatorChar.ToString())) { index = filename.LastIndexOf(Path.DirectorySeparatorChar); } file.Name = filename.Substring(index + 1); file.Location = filename.Substring(0, index + 1); node = child.SelectSingleNode("./x:CopyToOutputDirectory", mgr); if (node != null) { file.CopyToOutputDirectory = true; } files.Add(file); } return(files); }
/// <summary> /// Gets the config files. /// Config files are found in: /// < project > < ItemGroup > < None > /// Then: /// get name from the atribute "Include", /// get CopyToOutputDirectory from child element "CopyToOutputDirectory" /// </summary> /// <param name = "doc"></param> /// <param name = "mgr"></param> /// <returns></returns> private List<ProjectConfigFile> GetConfigs(XmlDocument doc, XmlNamespaceManager mgr) { XmlNodeList nodes; XmlNode node; List<ProjectConfigFile> files; ProjectConfigFile file; string filename; int index; files = new List<ProjectConfigFile>(); nodes = doc.SelectNodes("/x:Project/x:ItemGroup/x:None", mgr); foreach (XmlNode child in nodes) { file = new ProjectConfigFile(); filename = child.Attributes["Include"].InnerText; index = -1; if (filename.Contains(Path.DirectorySeparatorChar.ToString())) { index = filename.LastIndexOf(Path.DirectorySeparatorChar); } file.Name = filename.Substring(index + 1); file.Location = filename.Substring(0, index + 1); node = child.SelectSingleNode("./x:CopyToOutputDirectory", mgr); if (node != null) { file.CopyToOutputDirectory = true; } files.Add(file); } return files; }