JuSNS.Config/EmailConfig.cs

(开头部分) 4KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

using System.Text.RegularExpressions;
using System.Web;
using System.Xml;

namespace JuSNS.Config
{
    /// <summary>
    /// 邮件相关的配置
    /// </summary>
    public class EmailConfig
    {
        #region 私有变量
        static private readonly string configpath = HttpContext.Current.Request.ApplicationPath + "/config/email/email.config";
        static private string _mode;
        static private string _host;
        static private int _port;
        static private string _from;
        static private string _username;
        static private string _password;
        static private bool _enablessl;
        #endregion
        /// <summary>
        /// 静态构造函数
        /// </summary>
        static EmailConfig()
        {
            Reload();
        }
        /// <summary>
        /// 重新读取Config文件,重新取值
        /// </summary>
        static public void Reload()
        {
            string filepath = HttpContext.Current.Server.MapPath(configpath);
            XmlDocument xml = new XmlDocument();
            xml.Load(filepath);
            XmlNode rootpor = xml.SelectSingleNode("email/setting");
            _mode = rootpor.Attributes["current"].Value;
            foreach (XmlNode n in rootpor.ChildNodes)
            {
                if (n.NodeType != XmlNodeType.Comment && n.Name.ToLower() == "parameter")
                {
                    _host = n.Attributes["host"].Value;
                    _port = int.Parse(n.Attributes["port"].Value);
                    _from = n.Attributes["from"].Value;
                    _username = n.Attributes["username"].Value;
                    _password = n.Attributes["password"].Value;
                    if (n.Attributes["enablessl"].Value.ToLower() == "true")
                        _enablessl = true;
                    else
                        _enablessl = false;
                }
            }
        }
        /// <summary>
        /// 邮件组件方式
        /// </summary>
        static public string mode
        {
            get { return _mode; }
后面还有 81 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。