/// <summary> /// Gets the resource files. /// Resource files are found in: /// < project > < ItemGroup > < EmbeddedResource > /// Then: /// get name from the atribute "Include", /// get DependentUpon from child element "DependentUpon", /// get CopyToOutputDirectory from child element "CopyToOutputDirectory" /// </summary> /// <param name="doc"></param> /// <param name="mgr"></param> /// <returns></returns> private List <ProjectResourceFile> GetResources(XmlDocument doc, XmlNamespaceManager mgr) { XmlNodeList nodes; List <ProjectResourceFile> files; ProjectResourceFile file; XmlNode node; string filename; int index; files = new List <ProjectResourceFile>(); nodes = doc.SelectNodes("/x:Project/x:ItemGroup/x:EmbeddedResource", mgr); foreach (XmlNode child in nodes) { file = new ProjectResourceFile(); 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:DependentUpon", mgr); if (node != null) { file.DependentUpon = node.InnerText; } node = child.SelectSingleNode("./x:CopyToOutputDirectory", mgr); if (node != null) { file.CopyToOutputDirectory = true; } files.Add(file); } return(files); }
/// <summary> /// Gets the resource files. /// Resource files are found in: /// < project > < ItemGroup > < EmbeddedResource > /// Then: /// get name from the atribute "Include", /// get DependentUpon from child element "DependentUpon", /// get CopyToOutputDirectory from child element "CopyToOutputDirectory" /// </summary> /// <param name = "doc"></param> /// <param name = "mgr"></param> /// <returns></returns> private List<ProjectResourceFile> GetResources(XmlDocument doc, XmlNamespaceManager mgr) { XmlNodeList nodes; List<ProjectResourceFile> files; ProjectResourceFile file; XmlNode node; string filename; int index; files = new List<ProjectResourceFile>(); nodes = doc.SelectNodes("/x:Project/x:ItemGroup/x:EmbeddedResource", mgr); foreach (XmlNode child in nodes) { file = new ProjectResourceFile(); 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:DependentUpon", mgr); if (node != null) { file.DependentUpon = node.InnerText; } node = child.SelectSingleNode("./x:CopyToOutputDirectory", mgr); if (node != null) { file.CopyToOutputDirectory = true; } files.Add(file); } return files; }