using System; using System.IO; using System.Xml; namespace WX.CRM.CRMServices.SMS.InterfaceModel { public class TbTxtToVoiceConfig { string _appkey = ""; string _appSecret = ""; string _url = ""; string _calledShowNum = ""; public TbTxtToVoiceConfig() { 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}", "TbTxtToVoiceConfig")); if (xNode.Name == "TbTxtToVoiceConfig") { 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 "calledShowNum": this._calledShowNum = temp.GetAttribute("value"); break; } } } } } catch { throw new Exception("【淘宝接品】TbTxtToVoiceConfig:加载配置错误!"); } } 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 calledShowNum { get { return _calledShowNum; } set { _calledShowNum = value; } } } }