TG.WXCRM.V4/CRMServices/PkgSms/InterfaceModel/HuiZhiConfig.cs

126 lines
3.9 KiB
C#
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using System.IO;
using System.Xml;
namespace WX.CRM.CRMServices.SMS.InterfaceModel
{
public class HuiZhiConfig
{
string _Assembly = "";
string _Url = "";
string _UserName = "";
string _Pwd = "";
string _Rstype = "xml";
int _Pfex = 0;
public HuiZhiConfig()
{
//加载配置
string filename = System.AppDomain.CurrentDomain.BaseDirectory + "XML\\SmsAccountConfig.xml";
try
{
if (File.Exists(filename))
{
//XElement root = XElement.Load(filename);
//var objects = from obj in root.Elements("HuiZhiConfig") select obj;
//object Define = objects.ToDictionary(
// k => k.Attribute("key").Value,
// v => v.Attribute("value").Value
//);
XmlDocument xDoc = new XmlDocument();
xDoc.Load(filename);
XmlNode xNode;
xNode = xDoc.SelectSingleNode(string.Format("//root//{0}", "HuiZhiConfig"));
if (xNode.Name == "HuiZhiConfig")
{
XmlNodeList node = xNode.ChildNodes;
foreach (XmlNode cn in node)
{
XmlElement temp = (XmlElement)cn;
switch (temp.GetAttribute("key"))
{
case "Assembly":
this._Assembly = temp.GetAttribute("value");
break;
case "Url":
this._Url = temp.GetAttribute("value");
break;
case "UserName":
this._UserName = temp.GetAttribute("value");
break;
case "Pwd":
this._Pwd = temp.GetAttribute("value");
break;
case "Rstype":
this._Rstype = temp.GetAttribute("value");
break;
case "Pfex":
int.TryParse(temp.GetAttribute("value"), out this._Pfex);
break;
}
}
}
}
}
catch
{
throw;
}
}
/// <summary>
/// 程序集
/// </summary>
public string Assembly
{
get { return _Assembly; }
set { _Assembly = value; }
}
/// <summary>
/// 提交url
/// </summary>
public string Url
{
get { return _Url; }
set { _Url = value; }
}
/// <summary>
/// 用户名
/// </summary>
public string UserName
{
get { return _UserName; }
set { _UserName = value; }
}
/// <summary>
/// 密码
/// </summary>
public string Pwd
{
get { return _Pwd; }
set { _Pwd = value; }
}
/// <summary>
/// 返回类型,text或xml
/// </summary>
public string Rstype
{
get { return string.Format("{0}", _Rstype).ToLower(); }
set { _Rstype = value; }
}
/// <summary>
/// 短信发送时遇到违禁词时处理开关01二个参数值(1自动处理禁发字符此时短信长度会发一变化)
/// </summary>
public int Pfex
{
get { return _Pfex; }
set { _Pfex = value; }
}
}
}