public void XMLFormat_Equals_Test2() { XMLFormat xml = new XMLFormat(new XMLFormatInitializerTest2()); XMLFormat xml2 = new XMLFormat(); xml2.SetRoot("deo"); xml2.Append(0, new XMLFormat.DirNode { id = 36, name = "sek" }); xml2.Append(0, new XMLFormat.FileNode { id = 121, name = "try" }); xml2.Append(36, new XMLFormat.DirNode { id = 99, name = "uig" }); xml2.Append(36, new XMLFormat.FileNode { id = 2092, name = "qvg" }); xml2.Append(99, new XMLFormat.FileNode { id = 370, name = "xoj" }); Boolean isEqual = xml.Equals(xml2); Assert.True(isEqual); }
public void Init(AFormat format) { XMLFormat xml = (XMLFormat)format; xml.SetRoot("site"); xml.Append(0, new XMLFormat.FileNode { id = 12, name = "news" }); }
public AFormat Transform(AFormat aFormat) { find = (FindFormat)aFormat; xml = new XMLFormat(); xml.SetRoot(find.GetPath(0)); var root = (DirNode)xml.GetNode(0); FindSubNodesAndAppend(root, 1, root.name); return(xml); }
public void XMLFormatInitializerTest1() { XMLFormat xml = new XMLFormat(new XMLFormatInitializerTest1()); XMLFormat xml2 = new XMLFormat(); xml2.SetRoot("site"); xml2.Append(0, new XMLFormat.FileNode { id = 12, name = "news" }); Boolean isEqual = xml.Equals(xml2); Assert.True(isEqual); }
public void XMLFormat_Append_Test1() { XMLFormat xml = new XMLFormat(); xml.SetRoot("a"); xml.Append(0, new XMLFormat.FileNode() { name = "b", id = 1 }); var node = xml.GetNode(1); Assert.True(node.name == "b"); }
public void Init(AFormat format) { XMLFormat xml = (XMLFormat)format; xml.SetRoot("deo"); xml.Append(0, new XMLFormat.DirNode { id = 36, name = "sek" }); xml.Append(0, new XMLFormat.FileNode { id = 121, name = "try" }); xml.Append(36, new XMLFormat.DirNode { id = 99, name = "uig" }); xml.Append(36, new XMLFormat.FileNode { id = 2092, name = "qvg" }); xml.Append(99, new XMLFormat.FileNode { id = 370, name = "xoj" }); }
private void ProcessDirectory(XMLFormat xml, Int32 currDirId) { String line, type, name; Int32 id; do { line = Console.ReadLine(); if (line == null || line.EndsWith("</dir>")) { return; } var tuple = GetTypeNameIdTupleFromLine(line); type = tuple.Item1; name = tuple.Item2; id = tuple.Item3; if (id == 0) { xml.SetRoot(name); ProcessDirectory(xml, 0); } else { if (type == "dir") { xml.Append(currDirId, new DirNode { id = id, name = name }); ProcessDirectory(xml, id); } else if (type == "file") { xml.Append(currDirId, new FileNode { id = id, name = name }); } } } while(line != null); }