using System.IO; using System.Xml; namespace CRM.Core.CoreService.PkgSms.InterfaceModel { public class QYXSConfig { string _userid = ""; string _account = ""; string _pwd = ""; string _url = ""; public QYXSConfig() { //加载配置 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}", "QYXS")); if (xNode.Name == "QYXS") { XmlNodeList node = xNode.ChildNodes; foreach (XmlNode cn in node) { XmlElement temp = (XmlElement)cn; switch (temp.GetAttribute("key")) { case "userid": this._userid = temp.GetAttribute("value"); break; 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 userid { get { return _userid; } set { _userid = value; } } public string account { get { return _account; } set { _account = value; } } public string pwd { get { return _pwd; } set { _pwd = value; } } public string url { get { return _url; } set { _url = value; } } } }