using System; using System.IO; using System.Xml; namespace WX.CRM.CRMServices.SMS.InterfaceModel { public class TbTxtConfig { string _appkey = ""; string _appSecret = ""; string _url = ""; string _sinName = ""; public TbTxtConfig() { 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}", "TbTxtConfig")); if (xNode.Name == "TbTxtConfig") { XmlNodeList node = xNode.ChildNodes; foreach (XmlNode cn in node) { XmlElement temp = (XmlElement)cn; switch (temp.GetAttribute("key")) { case "appkey": this._appSecret = temp.GetAttribute("value"); break; case "appSecret": this._appSecret = temp.GetAttribute("value"); break; case "url": this._url = temp.GetAttribute("value"); break; case "sinName": this._sinName = temp.GetAttribute("value"); break; } } } } } catch { throw new Exception("【淘宝接品】TbTxtConfig:加载配置错误!"); } } public string appkey { get { return _appkey; } set { _appkey = value; } } public string appSecret { get { return _appSecret; } set { _appSecret = value; } } public string url { get { return _url; } set { _url = value; } } public string sinName { get { return _sinName; } set { _sinName = value; } } } }