Hidistro.Core/CustomerServiceManager.cs

(开头部分) 2KB

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

namespace Hidistro.Core
{
    using Hidistro.Core.Entities;
    using System;
    using System.IO;
    using System.Web;
    using System.Web.Caching;
    using System.Xml;

    public class CustomerServiceManager
    {
        private const string MasterSettingsCacheKey = "FileCache-CustomerServiceSettings";

        public static CustomerServiceSettings GetMasterSettings(bool cacheable)
        {
            if (!cacheable)
            {
                HiCache.Remove("FileCache-CustomerServiceSettings");
            }
            XmlDocument document = HiCache.Get("FileCache-CustomerServiceSettings") as XmlDocument;
            if (document == null)
            {
                string masterSettingsFilename = GetMasterSettingsFilename();
                if (!File.Exists(masterSettingsFilename))
                {
                    return null;
                }
                document = new XmlDocument();
                document.Load(masterSettingsFilename);
                if (cacheable)
                {
                    HiCache.Max("FileCache-CustomerServiceSettings", document, new CacheDependency(masterSettingsFilename));
                }
            }
            return CustomerServiceSettings.FromXml(document);
        }

        private static string GetMasterSettingsFilename()
        {
            HttpContext current = HttpContext.Current;
            return ((current != null) ? current.Request.MapPath("~/config/CustomerService.config") : Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"config\CustomerService.config"));
        }

        public static void Save(CustomerServiceSettings settings)
        {
            SaveMasterSettings(settings);
            HiCache.Remove("FileCache-CustomerServiceSettings");
        }

        private static void SaveMasterSettings(CustomerServiceSettings settings)
        {
            string masterSettingsFilename = GetMasterSettingsFilename();
            XmlDocument doc = new XmlDocument();
            if (File.Exists(masterSettingsFilename))
            {
                doc.Load(masterSettingsFilename);
            }
            settings.WriteToXml(doc);
            doc.Save(masterSettingsFilename);
        }
后面还有 3 行代码,购买后查看完整代码

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

AI 解读 AI

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

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