public ValueType GetValueTypeFromConstKey(string szKey) { ConstIniNode node = (ConstIniNode)m_ConstItems[szKey]; if (node != null) { return(node.nValueType); } return(ValueType.VT_STRING); }
public string GetStringFromConstKey(string szKey) { ConstIniNode node = (ConstIniNode)m_ConstItems[szKey]; if (node != null) { return(node.szDesc); } return(""); }
public void Load(string szFileName) { m_Nodes.Clear(); try { string sKey;; //XmlTextReader xtr = new XmlTextReader(Application.StartupPath + @"\ini.xml"); XmlTextReader xtr = new XmlTextReader(szFileName); while (xtr.Read()) { if (xtr.NodeType == XmlNodeType.Element) { sKey = xtr.LocalName; if (xtr.AttributeCount > 0) { for (int i = 0; i < xtr.AttributeCount; i++) { xtr.MoveToAttribute(i); if (xtr.Name.ToLower() == XML_TOKEN.ATTR_VALUE.ToLower()) { ConstDataNode new_node = new ConstDataNode(); new_node.szKey = sKey; new_node.szValue = xtr.Value; ConstIniNode ini_node = (ConstIniNode)Global.ini_data.ConstItems[sKey]; if (ini_node != null) { new_node.nValueType = ini_node.nValueType; } m_Nodes.Add(new_node); } } } xtr.Read(); } } //while xtr.Close(); } catch (Exception e) { } }
public void Init() { m_ConstItems.Clear(); // const 구조 읽기 ---- try { string sKey; XmlTextReader xtr = new XmlTextReader(Application.StartupPath + @"\" + Global.szIniFileName); while (xtr.Read()) { if (xtr.NodeType == XmlNodeType.Element) { if (xtr.LocalName == "CONST_ITEM") { sKey = xtr.LocalName; ConstIniNode new_node = new ConstIniNode(); if (xtr.AttributeCount > 0) { for (int i = 0; i < xtr.AttributeCount; i++) { xtr.MoveToAttribute(i); if (xtr.Name == "key") { new_node.szKey = xtr.Value; } else if (xtr.Name == "type") { if (xtr.Value == "int") { new_node.nValueType = ValueType.VT_INTEGER; } else if (xtr.Value == "float") { new_node.nValueType = ValueType.VT_FLOAT; } else if (xtr.Value == "str") { new_node.nValueType = ValueType.VT_STRING; } else if (xtr.Value == "path") { new_node.nValueType = ValueType.VT_PATH; } else if (xtr.Value == "bool") { new_node.nValueType = ValueType.VT_BOOLEAN; } else if (xtr.Value == "vec") { new_node.nValueType = ValueType.VT_VECTOR; } else if (xtr.Value == "color") { new_node.nValueType = ValueType.VT_COLOR; } } else if (xtr.Name == "default") { new_node.szDefaultValue = xtr.Value; } else if (xtr.Name == "desc") { new_node.szDesc = xtr.Value; } } m_ConstItems.Add(new_node.szKey, new_node); } } xtr.Read(); } } //while xtr.Close(); } catch (FileNotFoundException e) { } }