using System.IO; using System.Xml; namespace CRM.Core.CoreService.PkgSms.InterfaceModel { public class AliYunSmsConfig { string _appkey = ""; string _appSecret = ""; string _endpoint = ""; string _sinName = ""; string _msgTempleteCode = ""; string _topicName = ""; public AliYunSmsConfig() { //加载配置 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}", "AliYunConfig")); if (xNode.Name == "AliYunConfig") { XmlNodeList node = xNode.ChildNodes; foreach (XmlNode cn in node) { XmlElement temp = (XmlElement)cn; switch (temp.GetAttribute("key")) { case "appKey": this._appkey = temp.GetAttribute("value"); break; case "appSecret": this._appSecret = temp.GetAttribute("value"); break; case "endpoint": this._endpoint = temp.GetAttribute("value"); break; case "sinName": this._sinName = temp.GetAttribute("value"); break; case "msgTempleteCode": this._msgTempleteCode = temp.GetAttribute("value"); break; case "topicName": this._topicName = temp.GetAttribute("value"); break; } } } } } catch { throw; } } public string appkey { get { return _appkey; } set { _appkey = value; } } public string appSecret { get { return _appSecret; } set { _appSecret = value; } } public string endpoint { get { return _endpoint; } set { _endpoint = value; } } public string sinName { get { return _sinName; } set { _sinName = value; } } public string msgTempleteCode { get { return _msgTempleteCode; } set { _msgTempleteCode = value; } } public string topicName { get { return _topicName; } set { _topicName = value; } } } }