using System; using System.Collections.Generic; using System.Text; using System.Reflection; using System.Xml; using System.IO; namespace HDUSearch ...{ public class IndexConfig ...{ GetValue#region GetValue public string GetValue(string key) ...{ string assemblyFilePath = Assembly.GetExecutingAssembly().Location; string assemblyDirPath = Path.GetDirectoryName(assemblyFilePath); XmlDocument xmlDoc = new XmlDocument(); xmlDoc.Load(assemblyDirPath + "\Index.config"); XmlNodeList nodeList = xmlDoc.SelectSingleNode("/configuration/appSettings").ChildNodes; //获取appSettings节点的所有子节点 foreach (XmlNode xn in nodeList) //遍历所有子节点 ...{ XmlElement xe = (XmlElement)xn; //将子节点类型转换为XmlElement类型 if (xe.GetAttribute("key").IndexOf(key) != -1) ...{ return xe.GetAttribute("value"); break; } } return ""; } #endregion } } |
欢迎访问最专业的网吧论坛,无盘论坛,网吧经营,网咖管理,网吧专业论坛
https://bbs.txwb.com
关注天下网吧微信/下载天下网吧APP/天下网吧小程序,一起来超精彩
|
本文来源:来自网络 作者:佚名