/// <summary> /// Reading ctor /// </summary> public XmlTree(ResReader reader) : base(reader, ChunkTypes.RES_XML_TYPE) { strings = new StringPool(reader); resourceMap = new ResourceMap(reader); while (true) { var tag = reader.PeekChunkType(); Node node; switch (tag) { case ChunkTypes.RES_XML_START_NAMESPACE_TYPE: node = new StartNamespace(reader, this); break; case ChunkTypes.RES_XML_START_ELEMENT_TYPE: node = new StartElement(reader, this); break; case ChunkTypes.RES_XML_CDATA_TYPE: node = new CData(reader, this); break; case ChunkTypes.RES_XML_END_ELEMENT_TYPE: node = new EndElement(reader, this); break; case ChunkTypes.RES_XML_END_NAMESPACE_TYPE: node = new EndNamespace(reader, this); break; default: throw new IOException(string.Format("Unexpected tag: 0x{0:X}", (int)tag)); } nodes.Add(node); if (tag == ChunkTypes.RES_XML_END_NAMESPACE_TYPE) { break; } } }
/// <summary> /// Reading ctor /// </summary> public XmlTree(ResReader reader) : base(reader, ChunkTypes.RES_XML_TYPE) { strings = new StringPool(reader); resourceMap = new ResourceMap(reader); while (true) { var tag = reader.PeekChunkType(); Node node; switch (tag) { case ChunkTypes.RES_XML_START_NAMESPACE_TYPE: node = new StartNamespace(reader, this); break; case ChunkTypes.RES_XML_START_ELEMENT_TYPE: node = new StartElement(reader, this); break; case ChunkTypes.RES_XML_CDATA_TYPE: node = new CData(reader, this); break; case ChunkTypes.RES_XML_END_ELEMENT_TYPE: node = new EndElement(reader, this); break; case ChunkTypes.RES_XML_END_NAMESPACE_TYPE: node = new EndNamespace(reader, this); break; default: throw new IOException(string.Format("Unexpected tag: 0x{0:X}", (int)tag)); } nodes.Add(node); if (tag == ChunkTypes.RES_XML_END_NAMESPACE_TYPE) break; } }