using System.IO; using System.Xml; namespace WX.CRM.CRMServices.SMS.InterfaceModel { public class YiZhengConfig { public YiZhengConfig() { //加载配置 string filename = System.AppDomain.CurrentDomain.BaseDirectory + "XML\\SmsAccountConfig.xml"; try { if (File.Exists(filename)) { XmlDocument xDoc = new XmlDocument(); xDoc.Load(filename); XmlNode xNode; xNode = xDoc.SelectSingleNode(string.Format("//root//{0}", "YZSmsConfig")); if (xNode.Name == "YZSmsConfig") { XmlNodeList node = xNode.ChildNodes; foreach (XmlNode cn in node) { XmlElement temp = (XmlElement)cn; switch (temp.GetAttribute("key")) { case "account": this.account = temp.GetAttribute("value"); break; case "pwd": this.pwd = temp.GetAttribute("value"); break; case "url": this.url = temp.GetAttribute("value"); break; } } } } } catch { throw; } } public string account { get; set; } public string pwd { get; set; } public string url { get; set; } } }