KingNET.PageLib/Helper/ConfigHelper.cs

(开头部分) 3KB

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

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml;
using KingNET.PageLib.Cache;

namespace KingNET.PageLib.Helper
{
    public class ConfigHelper
    {
        public static string ConfigPath
        {
            get
            {
                string resultValue = System.Configuration.ConfigurationManager.AppSettings["ConfigPath"];
                if (string.IsNullOrEmpty(resultValue))
                {
                    resultValue = AppDomain.CurrentDomain.BaseDirectory;
                }
                return resultValue;
            }
        }
        public static XmlDocument GetXmlDoc(string configName)
        {
            string cacheKey = "/ConfigPath/" + configName;
            object obj = KingNETCache.GetCacheService().RetrieveSingleObject(cacheKey);
            if (obj == null)
            {
                string configPath = ConfigPath + configName + ".xml";
                if (FileExtentionsHelper.FileExists(configPath))
                {
                    XmlDocument xmlDoc = new XmlDocument();
                    xmlDoc.Load(configPath);
                    KingNETCache.GetCacheService().AddSingleObject(cacheKey, xmlDoc, configPath);
                    return xmlDoc;
                }
                return null;
            }
            else
                return (XmlDocument)obj;

        }

        public static string SelectSingleNode(string configName, string singleNode)
        {
            XmlDocument xmlDoc = GetXmlDoc(configName);
            if (xmlDoc == null)
            {
                return "";
            }
            string value = "";
            try
            {
                value = xmlDoc.SelectSingleNode("//" + configName + "ConfigInfo/" + singleNode).InnerText;
            }
            catch
            {
            }
            return value;
后面还有 33 行代码,解锁后查看完整代码

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

AI 解读 AI

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

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