// 设置一个字符串 // parameters: // strPath 参数路径 // strName 参数名 // strValue 要设置的字符串,如果为null,表示删除这个事项 public void SetString(string strPathParam, string strName, string strValue) { string strPath = GetSectionPath(strPathParam); string[] aPath = strPath.Split(new char[] { '/' }); XmlNode node = DomUtil.CreateNode(dom, aPath); if (node == null) { throw (new Exception("SetString() error ...")); } DomUtil.SetAttr(node, strName, strValue); var handler = this.AppInfoChanged; if (handler != null) { AppInfoChangedEventArgs e = new AppInfoChangedEventArgs { Path = strPathParam, Name = strName, Value = strValue }; handler(this, e); } }
// 设置一个字符串 // parameters: // strPath 参数路径 // strName 参数名 // strValue 要设置的字符串,如果为null,表示删除这个事项 public void SetString(string strPath, string strName, string strValue) { strPath = GetSectionPath(strPath); string[] aPath = strPath.Split(new char[] { '/' }); XmlNode node = DomUtil.CreateNode(dom, aPath); if (node == null) { throw (new Exception("SetString() error ...")); } DomUtil.SetAttr(node, strName, strValue); }
// 写入一个整数值 // parameters: // strPath 参数路径 // strName 参数名 // nValue 要写入的整数值 public void SetInt(string strPath, string strName, int nValue) { #if NO strPath = GetSectionPath(strPath); string[] aPath = strPath.Split(new char[] { '/' }); XmlNode node = DomUtil.CreateNode(dom, aPath); if (node == null) { throw (new Exception("SetInt() set error ...")); } DomUtil.SetAttr(node, strName, Convert.ToString(nValue)); #endif SetString(strPath, strName, Convert.ToString(nValue)); }
// 写入一个布尔值 // parameters: // strPath 参数路径 // strName 参数名 // bValue 要写入的布尔值 public void SetBoolean(string strPath, string strName, bool bValue) { #if NO strPath = GetSectionPath(strPath); string[] aPath = strPath.Split(new char[] { '/' }); XmlNode node = DomUtil.CreateNode(dom, aPath); if (node == null) { throw (new Exception("SetInt() set error ...")); } DomUtil.SetAttr(node, strName, (bValue == true ? "true" : "false")); #endif SetString(strPath, strName, (bValue == true ? "true" : "false")); }