public void Load(string szFileName) { m_Models.Clear(); try { XmlTextReader xtr = new XmlTextReader(szFileName); while (xtr.Read()) { if ((xtr.NodeType == XmlNodeType.Element) && ((xtr.LocalName.ToLower() == XML_TOKEN.TAG_ADD_XML.ToLower()) || (xtr.LocalName.ToLower() == XML_TOKEN.TAG_ADD_ELU.ToLower()))) { ModelData.FileType file_type; if (xtr.LocalName.ToLower() == XML_TOKEN.TAG_ADD_XML.ToLower()) { file_type = ModelData.FileType.FT_XML; } else { file_type = ModelData.FileType.FT_ELU; } if (xtr.AttributeCount > 0) { string name = ""; string filename = ""; for (int i = 0; i < xtr.AttributeCount; i++) { xtr.MoveToAttribute(i); if (xtr.Name.ToLower() == XML_TOKEN.ATTR_NAME.ToLower()) { name = xtr.Value; } else if (xtr.Name.ToLower() == XML_TOKEN.ATTR_FILENAME.ToLower()) { filename = xtr.Value; } } if ((name != "") && (filename != "")) { ModelData new_data = new ModelData(); new_data.m_szName = name; new_data.m_szPath = filename; new_data.m_nFileType = file_type; new_data.SetupCategory(); new_data.Load(); // xml을 읽는다. m_Models.Add(name, new_data); } } xtr.Read(); } } //while xtr.Close(); } catch (Exception e) //catch(FileNotFoundException e) { } }
public ModelData FindModelData(string szName) { ModelData node = (ModelData)m_Models[szName]; return(node); }