//Take xmlDocument and file name to search the file and return the username. If not found then username will be empty public string matchAndReturnUsernameFromXML(XmlDocument xmlDoc, string fileName) { string username = ""; XmlNodeList xmlFileNodes = xmlDoc.GetElementsByTagName("Files"); foreach (XmlNode FilesNode in xmlFileNodes) { string atbFileName = FilesNode.SelectSingleNode("//FileName").Attributes[0].Value; string atbUserName = FilesNode.SelectSingleNode("//UserDetails").Attributes[0].Value; if (atbFileName == fileName) { username = atbUserName; } } return(username); }
private void WriteProject(TextWriter writer, string language, Guid projectGuid, string name, string location, FilesNode files) { if (!tools.ContainsKey(language)) { throw new UnknownLanguageException("Unknown .NET language: " + language); } ToolInfo toolInfo = tools[language]; writer.WriteLine(ProjectDeclarationBeginFormat, toolInfo.Guid, name, location, projectGuid.ToString("B").ToUpper()); if (files != null) { writer.WriteLine("\tProjectSection(SolutionItems) = preProject"); foreach (string file in files) { writer.WriteLine("\t\t{0} = {0}", file); } writer.WriteLine("\tEndProjectSection"); } writer.WriteLine(ProjectDeclarationEndFormat); }
public void Check_node_text() { var node = new FilesNode(); Assert.AreEqual("Files", node.Text); }