Exemplo n.º 1
0
        /// <summary>
        /// 获取正则表达式配置文档
        /// </summary>
        /// <returns>XML文档</returns>
        internal static XmlDocument GetRegexServiceDoc()
        {
            XmlDocument xmlDoc = null;

            //从Cache里取出RegexService.xml文档对象
            xmlDoc = CacheService.GetCache(
                CacheService.REGEXCONFIG_DOCUMENT_CACHENAME) as XmlDocument;

            if (xmlDoc == null)
            {
                string strRegexServicePath = ConfigService.GetRegexConfigPath();

                //判断RegexService.xml是否存在
                if (!File.Exists(strRegexServicePath))
                {
                    throw new RegexServiceFileNotExistException();
                }

                xmlDoc = XMLService.GetXml(strRegexServicePath);

                //写入缓存并与文件相关连
                CacheService.Insert(
                    CacheService.REGEXCONFIG_DOCUMENT_CACHENAME,
                    xmlDoc, strRegexServicePath);
            }

            return(xmlDoc);
        }
Exemplo n.º 2
0
        /// <summary>
        /// 获取应用程序配置文档
        /// </summary>
        /// <returns>XML文档</returns>
        public static XmlDocument GetAppConfigDoc()
        {
            XmlDocument xmlDoc = null;

            //从Cache里取出AppConfig.xml文档对象
            xmlDoc = CacheService.GetCache(
                CacheService.APPCONFIG_DOCUMENT_CACHENAME) as XmlDocument;

            if (xmlDoc == null)
            {
                string strAppConfigPath = GetAppConfigPath();

                //判断AppConfig.xml是否存在
                if (!File.Exists(strAppConfigPath))
                {
                    throw new AppConfigFileNotExistException();
                }

                xmlDoc = XMLService.GetXml(strAppConfigPath);

                //写入缓存并与文件相关连
                CacheService.Insert(
                    CacheService.APPCONFIG_DOCUMENT_CACHENAME,
                    xmlDoc, strAppConfigPath);
            }

            return(xmlDoc);
        }
Exemplo n.º 3
0
        /// <summary>
        /// 获取正则表达式
        /// </summary>
        /// <param name="xPath">正则表达式</param>
        /// <returns>正则表达式</returns>
        internal static string GetPattern(string xPath)
        {
            XmlDocument xmlDoc = GetRegexServiceDoc();

            XmlNode node = XMLService.GetSingleNode(xmlDoc, xPath);

            return(node.InnerText.Trim());
        }
Exemplo n.º 4
0
        /// <summary>
        /// 获取AppConfig.xml配置文件里的项目编号
        /// </summary>
        /// <returns></returns>
        public static string GetProjectCode()
        {
            XmlDocument xmlDoc = GetAppConfigDoc();

            XmlNode node = XMLService.GetSingleNode(xmlDoc,
                                                    XPATH_APPCONFIG_PROJECTINFO_PROJECTCODE);

            return(node.InnerText.Trim());
        }
Exemplo n.º 5
0
        /// <summary>
        /// 获取验证VerifyCode的正则表达式
        /// </summary>
        /// <returns></returns>
        private static string GetVerifyCodeRegex()
        {
            XmlDocument xmlDoc = GetRegexServiceDoc();

            XmlNode node = XMLService.GetSingleNode(xmlDoc,
                                                    XPATH_APPCONFIG_VERIFYCODE);

            return(node.InnerText.Trim());
        }
Exemplo n.º 6
0
        /// <summary>
        /// 获取验证SpNumber的正则表达式
        /// </summary>
        /// <returns></returns>
        private static string GetSpNumberRegex()
        {
            XmlDocument xmlDoc = GetRegexServiceDoc();

            XmlNode node = XMLService.GetSingleNode(xmlDoc,
                                                    XPATH_APPCONFIG_SPNUMBER);

            return(node.InnerText.Trim());
        }
Exemplo n.º 7
0
        /// <summary>
        /// 获取验证LetterNumberUnderline的正则表达式
        /// </summary>
        /// <returns></returns>
        private static string GetLetterNumberUnderlineRegex()
        {
            XmlDocument xmlDoc = GetRegexServiceDoc();

            XmlNode node = XMLService.GetSingleNode(xmlDoc,
                                                    XPATH_APPCONFIG_LETTERNUMBERUNDERLINE);

            return(node.InnerText.Trim());
        }
Exemplo n.º 8
0
        /// <summary>
        /// 获取验证Chinese的正则表达式
        /// </summary>
        /// <returns></returns>
        private static string GetChineseRegex()
        {
            XmlDocument xmlDoc = GetRegexServiceDoc();

            XmlNode node = XMLService.GetSingleNode(xmlDoc,
                                                    XPATH_APPCONFIG_CHINESE);

            return(node.InnerText.Trim());
        }
Exemplo n.º 9
0
        /// <summary>
        /// 获取验证IP地址的正则表达式
        /// </summary>
        /// <returns></returns>
        private static string GetIpAddressRegex()
        {
            XmlDocument xmlDoc = GetRegexServiceDoc();

            XmlNode node = XMLService.GetSingleNode(xmlDoc,
                                                    XPATH_APPCONFIG_IPADDRESS);

            return(node.InnerText.Trim());
        }
Exemplo n.º 10
0
        /// <summary>
        /// 获取验证中国身份证的正则表达式
        /// </summary>
        /// <returns></returns>
        private static string GetChinaIDCardRegex()
        {
            XmlDocument xmlDoc = GetRegexServiceDoc();

            XmlNode node = XMLService.GetSingleNode(xmlDoc,
                                                    XPATH_REGEXCONFIG_CHINAIDCARD);

            return(node.InnerText.Trim());
        }
Exemplo n.º 11
0
        /// <summary>
        /// 获取验证139邮箱密码的正则表达式
        /// </summary>
        /// <returns></returns>
        private static string GetMailPasswordRegex()
        {
            XmlDocument xmlDoc = GetRegexServiceDoc();

            XmlNode node = XMLService.GetSingleNode(xmlDoc,
                                                    XPATH_REGEXCONFIG_MAILPASSWORD);

            return(node.InnerText.Trim());
        }
Exemplo n.º 12
0
        /// <summary>
        /// 获取验证139邮箱别名或手机号码的正则表达式
        /// </summary>
        /// <returns></returns>
        private static string GetMobile139AliasRegex()
        {
            XmlDocument xmlDoc = GetRegexServiceDoc();

            XmlNode node = XMLService.GetSingleNode(xmlDoc,
                                                    XPATH_REGEXCONFIG_MOBILE139ALIAS);

            return(node.InnerText.Trim());
        }
Exemplo n.º 13
0
        //获取应用程序日志相关的配置
        #region 获取AppConfig.xml配置文件里的日志配置文件的路径
        /// <summary>
        /// 获取AppConfig.xml配置文件里的日志配置文件的路径
        /// </summary>
        /// <returns></returns>
        public static string GetLogConfigPath()
        {
            XmlDocument xmlDoc = GetAppConfigDoc();

            XmlNode pathNode = XMLService.GetSingleNode(xmlDoc,
                                                        XPATH_APPCONFIG_PROJECTLOG_PATH);

            XmlNode versionNode = XMLService.GetSingleNode(xmlDoc,
                                                           XPATH_APPCONFIG_PROJECTLOG_VERSION);

            string strLogConfigPath = string.Format(pathNode.InnerText.Trim(), versionNode.InnerText.Trim());

            return(strLogConfigPath);
        }
Exemplo n.º 14
0
        //获取MemCached相关的配置
        #region 获取AppConfig.xml配置文件里的MemCached配置文件的路径
        /// <summary>
        /// 获取AppConfig.xml配置文件里的MemCached配置文件的路径
        /// </summary>
        /// <returns></returns>
        public static string GetMemCachedConfigPath()
        {
            XmlDocument xmlDoc = GetAppConfigDoc();

            //获取路径
            XmlNode pathNode = XMLService.GetSingleNode(xmlDoc,
                                                        XPATH_APPCONFIG_MEMCACHEDCONFIG_PATH);

            //获取版本
            XmlNode versionNode = XMLService.GetSingleNode(xmlDoc,
                                                           XPATH_APPCONFIG_MEMCACHEDCONFIG_VERSION);

            string strMemCachedConfigPath = string.Format(pathNode.InnerText.Trim(), versionNode.InnerText.Trim());

            return(strMemCachedConfigPath);
        }
Exemplo n.º 15
0
        //获取过滤关键字相关的配置
        #region 获取AppConfig.xml配置文件里的过滤关键字配置文件的路径
        /// <summary>
        /// 获取AppConfig.xml配置文件里的过滤关键字配置文件的路径
        /// </summary>
        /// <returns></returns>
        public static string GetFilterWordsConfigPath()
        {
            XmlDocument xmlDoc = GetAppConfigDoc();

            //获取路径
            XmlNode pathNode = XMLService.GetSingleNode(xmlDoc,
                                                        XPATH_APPCONFIG_FILTERWORDSCONFIG_PATH);

            //获取版本
            XmlNode versionNode = XMLService.GetSingleNode(xmlDoc,
                                                           XPATH_APPCONFIG_FILTERWORDSCONFIG_VERSION);

            string strFilterWordsConfigPath = string.Format(pathNode.InnerText.Trim(), versionNode.InnerText.Trim());

            return(strFilterWordsConfigPath);
        }