示例#1
0
        public static HiConfiguration GetConfig()
        {
            HiConfiguration configuration = HiCache.Get("FileCache-Configuragion") as HiConfiguration;

            if (configuration == null)
            {
                HttpContext current  = HttpContext.Current;
                string      filename = null;
                if (current != null)
                {
                    try
                    {
                        filename = current.Request.MapPath("~/config/Hishop.config");
                    }
                    catch
                    {
                        filename = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"config\Hishop.config");
                    }
                }
                else
                {
                    filename = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"config\Hishop.config");
                }
                XmlDocument doc = new XmlDocument();
                doc.Load(filename);
                configuration = new HiConfiguration(doc);
                HiCache.Max("FileCache-Configuragion", configuration, new CacheDependency(filename));
            }
            return(configuration);
        }
        internal static MessageTemplate GetTemplate(string messageType)
        {
            messageType = messageType.ToLower();
            SiteSettings siteSettings = HiContext.Current.SiteSettings;
            string       string_;

            if (siteSettings.IsDistributorSettings)
            {
                string_ = string.Format("Message-{0}-{1}", siteSettings.UserId.Value.ToString(System.Globalization.CultureInfo.InvariantCulture), messageType);
            }
            else
            {
                string_ = string.Format("Message-{0}", messageType);
            }
            MessageTemplate messageTemplate = HiCache.Get(string_) as MessageTemplate;

            if (messageTemplate == null)
            {
                messageTemplate = (siteSettings.IsDistributorSettings ? MessageTemplateHelper.GetDistributorMessageTemplate(messageType, siteSettings.UserId.Value) : MessageTemplateHelper.GetMessageTemplate(messageType));
                if (messageTemplate != null)
                {
                    HiCache.Max(string_, messageTemplate);
                }
            }
            return(messageTemplate);
        }
示例#3
0
        public static SiteSettings GetMasterSettings(bool cacheable)
        {
            if (!cacheable)
            {
                HiCache.Remove("FileCache-MasterSettings");
            }

            XmlDocument document = HiCache.Get("FileCache-MasterSettings") 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-MasterSettings", document, new CacheDependency(masterSettingsFilename));
                }
            }

            return(SiteSettings.FromXml(document));
        }
示例#4
0
        public static Navigation GetNavigation()
        {
            Navigation navigation = HiCache.Get("FileCache-AdminNavigation") as Navigation;

            if (navigation == null)
            {
                string      str;
                HttpContext current = HttpContext.Current;
                if (current != null)
                {
                    try
                    {
                        str = current.Request.MapPath("~/Admin/MenuNew.xml");
                    }
                    catch
                    {
                        str = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"Admin\MenuNew.xml");
                    }
                }
                else
                {
                    str = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"Admin\MenuNew.xml");
                }
                XmlDocument doc = new XmlDocument();
                doc.Load(str);
                navigation = new Navigation(doc);
                HiCache.Max("FileCache-AdminNavigation", navigation, new CacheDependency(str));
            }
            return(navigation);
        }
        internal static MessageTemplate GetTemplate(string messageType)
        {
            string str;

            messageType = messageType.ToLower();
            SiteSettings siteSettings = HiContext.Current.SiteSettings;

            if (siteSettings.IsDistributorSettings)
            {
                str = string.Format("Message-{0}-{1}", siteSettings.UserId.Value.ToString(CultureInfo.InvariantCulture), messageType);
            }
            else
            {
                str = string.Format("Message-{0}", messageType);
            }
            MessageTemplate template = HiCache.Get(str) as MessageTemplate;

            if (template == null)
            {
                template = siteSettings.IsDistributorSettings ? GetDistributorMessageTemplate(messageType, siteSettings.UserId.Value) : GetMessageTemplate(messageType);
                if (template != null)
                {
                    HiCache.Max(str, template);
                }
            }
            return(template);
        }
示例#6
0
 private static System.Xml.XmlDocument GetMenuDocument()
 {
     System.Web.HttpContext context = Hidistro.Membership.Context.HiContext.Current.Context;
     Hidistro.Membership.Context.SiteSettings siteSettings = Hidistro.Membership.Context.SettingsManager.GetSiteSettings(Hidistro.Membership.Context.HiContext.Current.User.UserId);
     System.Xml.XmlDocument xmlDocument;
     if (siteSettings == null)
     {
         xmlDocument = (HiCache.Get("FileCache-ShopadminMenu-NoSite") as System.Xml.XmlDocument);
     }
     else
     {
         xmlDocument = (HiCache.Get("FileCache-ShopadminMenu") as System.Xml.XmlDocument);
     }
     if (xmlDocument == null)
     {
         if (siteSettings == null)
         {
             string filename = context.Request.MapPath("~/Shopadmin/Menu_NoSite.config");
             xmlDocument = new System.Xml.XmlDocument();
             xmlDocument.Load(filename);
             HiCache.Max("FileCache-ShopadminMenu-NoSite", xmlDocument, new System.Web.Caching.CacheDependency(filename));
         }
         else
         {
             string filename = context.Request.MapPath("~/Shopadmin/Menu.config");
             xmlDocument = new System.Xml.XmlDocument();
             xmlDocument.Load(filename);
             HiCache.Max("FileCache-ShopadminMenu", xmlDocument, new System.Web.Caching.CacheDependency(filename));
         }
     }
     return(xmlDocument);
 }
示例#7
0
        public static SiteSettings GetMasterSettings(bool cacheable)
        {
            if (!cacheable)
            {
                HiCache.Remove("FileCache-MasterSettings");
            }
            XmlDocument  xmlDocument = HiCache.Get("FileCache-MasterSettings") as XmlDocument;
            SiteSettings result;

            if (xmlDocument == null)
            {
                string masterSettingsFilename = SettingsManager.GetMasterSettingsFilename();
                if (!System.IO.File.Exists(masterSettingsFilename))
                {
                    result = null;
                    return(result);
                }
                xmlDocument = new XmlDocument();
                xmlDocument.Load(masterSettingsFilename);
                if (cacheable)
                {
                    HiCache.Max("FileCache-MasterSettings", xmlDocument, new CacheDependency(masterSettingsFilename));
                }
            }
            result = SiteSettings.FromXml(xmlDocument);
            return(result);
        }
示例#8
0
        private static XmlDocument GetMenuDocument()
        {
            XmlDocument  document;
            HttpContext  context      = HiContext.Current.Context;
            SiteSettings siteSettings = SettingsManager.GetSiteSettings(HiContext.Current.User.UserId);

            if (siteSettings == null)
            {
                document = HiCache.Get("FileCache-ShopadminMenu-NoSite") as XmlDocument;
            }
            else
            {
                document = HiCache.Get("FileCache-ShopadminMenu") as XmlDocument;
            }
            if (document == null)
            {
                string str;
                if (siteSettings == null)
                {
                    str      = context.Request.MapPath("~/Shopadmin/Menu_NoSite.config");
                    document = new XmlDocument();
                    document.Load(str);
                    HiCache.Max("FileCache-ShopadminMenu-NoSite", document, new CacheDependency(str));
                    return(document);
                }
                str      = context.Request.MapPath("~/Shopadmin/Menu.config");
                document = new XmlDocument();
                document.Load(str);
                HiCache.Max("FileCache-ShopadminMenu", document, new CacheDependency(str));
            }
            return(document);
        }
示例#9
0
        public static void Check(out bool isValid, out bool expired, out int siteQty)
        {
            siteQty = 0;
            isValid = false;
            expired = true;
            HiContext    current        = HiContext.Current;
            XmlDocument  xmlDocument    = HiCache.Get("FileCache_CommercialLicenser") as XmlDocument;
            SiteSettings masterSettings = SettingsManager.GetMasterSettings(true);

            if (xmlDocument == null)
            {
                string text = (current.Context != null) ? current.Context.Request.MapPath("~/config/Certificates.cer") : System.IO.Path.Combine(System.AppDomain.CurrentDomain.BaseDirectory, "config\\Certificates.cer");
                if (!System.IO.File.Exists(text))
                {
                    return;
                }
                xmlDocument = new XmlDocument();
                xmlDocument.LoadXml(System.IO.File.ReadAllText(text));
                HiCache.Max("FileCache_CommercialLicenser", xmlDocument, new CacheDependency(text));
            }
            XmlNode xmlNode  = xmlDocument.DocumentElement.SelectSingleNode("//Host");
            XmlNode xmlNode2 = xmlDocument.DocumentElement.SelectSingleNode("//LicenseDate");
            XmlNode xmlNode3 = xmlDocument.DocumentElement.SelectSingleNode("//Expires");
            XmlNode xmlNode4 = xmlDocument.DocumentElement.SelectSingleNode("//SiteQty");
            XmlNode xmlNode5 = xmlDocument.DocumentElement.SelectSingleNode("//Signature");
            //if (string.Compare(xmlNode.InnerText, masterSettings.SiteUrl, true, System.Globalization.CultureInfo.InvariantCulture) == 0)
            //{

            //}

            string s = string.Format(System.Globalization.CultureInfo.InvariantCulture, "Host={0}&Expires={1}&SiteQty={2}&LicenseDate={3}", new object[]
            {
                masterSettings.SiteUrl,
                xmlNode3.InnerText,
                xmlNode4.InnerText,
                xmlNode2.InnerText
            });

            using (System.Security.Cryptography.RSACryptoServiceProvider rSACryptoServiceProvider = new System.Security.Cryptography.RSACryptoServiceProvider())
            {
                rSACryptoServiceProvider.FromXmlString(LicenseHelper.GetPublicKey());
                System.Security.Cryptography.RSAPKCS1SignatureDeformatter rSAPKCS1SignatureDeformatter = new System.Security.Cryptography.RSAPKCS1SignatureDeformatter(rSACryptoServiceProvider);
                rSAPKCS1SignatureDeformatter.SetHashAlgorithm("SHA1");
                byte[] rgbSignature = System.Convert.FromBase64String(xmlNode5.InnerText);
                byte[] rgbHash      = new System.Security.Cryptography.SHA1Managed().ComputeHash(System.Text.Encoding.UTF8.GetBytes(s));
                isValid = rSAPKCS1SignatureDeformatter.VerifySignature(rgbHash, rgbSignature);
                isValid = true;
            }
            expired = (System.DateTime.Now > System.DateTime.Parse(xmlNode3.InnerText));
            if (isValid && !expired)
            {
                int.TryParse(xmlNode4.InnerText, out siteQty);
            }
        }
示例#10
0
        /// <summary>
        /// 加载省市区配置文件
        /// </summary>
        /// <param name="Path">文件地址</param>
        /// <returns></returns>
        public static XmlDocument GetRegionDocument(string Path)
        {
            XmlDocument xmlDocument = HiCache.Get("FileCache-Regions") as XmlDocument;

            if (xmlDocument == null)
            {
                xmlDocument = new XmlDocument();
                xmlDocument.Load(Path);
                HiCache.Max("FileCache-Regions", xmlDocument, new CacheDependency(Path));
            }
            return(xmlDocument);
        }
示例#11
0
        private static XmlDocument GetMenuDocument()
        {
            XmlDocument document = HiCache.Get("FileCache-AdminMenu") as XmlDocument;

            if (document == null)
            {
                string filename = HiContext.Current.Context.Request.MapPath("~/" + HiContext.Current.Config.AdminFolder + "/Menu.config");
                document = new XmlDocument();
                document.Load(filename);
                HiCache.Max("FileCache-AdminMenu", document, new CacheDependency(filename));
            }
            return(document);
        }
示例#12
0
        private static XmlDocument GetRegionDocument()
        {
            XmlDocument document = HiCache.Get("FileCache-Regions") as XmlDocument;

            if (document == null)
            {
                string filename = HttpContext.Current.Request.MapPath(Globals.ApplicationPath + "/config/region.config");
                document = new XmlDocument();
                document.Load(filename);
                HiCache.Max("FileCache-Regions", document, new CacheDependency(filename));
            }
            return(document);
        }
示例#13
0
        public static SiteUrls Instance()
        {
            SiteUrls siteUrls = HiCache.Get("FileCache-SiteUrls") as SiteUrls;

            if (siteUrls == null)
            {
                string       siteUrlsFilename = SiteUrls.GetSiteUrlsFilename();
                SiteUrlsData data             = new SiteUrlsData(siteUrlsFilename);
                siteUrls = new SiteUrls(data);
                CacheDependency cacheDependency_ = new CacheDependency(siteUrlsFilename);
                HiCache.Max("FileCache-SiteUrls", siteUrls, cacheDependency_);
            }
            return(siteUrls);
        }
示例#14
0
        public static SiteUrls Instance()
        {
            SiteUrls urls = HiCache.Get("FileCache-SiteUrls") as SiteUrls;

            if (urls == null)
            {
                string       siteUrlsFilename = GetSiteUrlsFilename();
                SiteUrlsData data             = new SiteUrlsData(siteUrlsFilename);
                urls = new SiteUrls(data);
                CacheDependency dep = new CacheDependency(siteUrlsFilename);
                HiCache.Max("FileCache-SiteUrls", urls, dep);
            }
            return(urls);
        }
示例#15
0
        public static bool CheckCopyright()
        {
            HiContext   current  = HiContext.Current;
            XmlDocument document = HiCache.Get("Hishop_SiteLicense") as XmlDocument;

            if (document == null)
            {
                string path = null;
                if (current.Context != null)
                {
                    path = current.Context.Request.MapPath("~/config/Hishop.lic");
                }
                else
                {
                    path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Hishop.lic");
                }
                if (!File.Exists(path))
                {
                    return(false);
                }
                document = new XmlDocument();
                document.LoadXml(File.ReadAllText(path));
                HiCache.Max("Hishop_SiteLicense", document, new CacheDependency(path));
            }
            XmlNode node  = document.DocumentElement.SelectSingleNode("//Host");
            XmlNode node2 = document.DocumentElement.SelectSingleNode("//LicenseDate");
            XmlNode node3 = document.DocumentElement.SelectSingleNode("//ExpiresDate");
            XmlNode node4 = document.DocumentElement.SelectSingleNode("//Signature");

            if (string.Compare(node.InnerText, current.SiteSettings.SiteUrl, true, CultureInfo.InvariantCulture) != 0)
            {
                return(false);
            }
            string s    = string.Format(CultureInfo.InvariantCulture, "Host={0}&LicenseDate={1}&ExpiresDate={2}&Key={3}", new object[] { current.SiteSettings.SiteUrl, node2.InnerText, node3.InnerText, Hidistro.Membership.Context.LicenseHelper.GetSiteHash() });
            bool   flag = false;

            using (RSACryptoServiceProvider provider = new RSACryptoServiceProvider())
            {
                provider.FromXmlString(Hidistro.Membership.Context.LicenseHelper.GetPublicKey());
                RSAPKCS1SignatureDeformatter deformatter = new RSAPKCS1SignatureDeformatter(provider);
                deformatter.SetHashAlgorithm("SHA1");
                byte[] rgbSignature = Convert.FromBase64String(node4.InnerText);
                byte[] rgbHash      = new SHA1Managed().ComputeHash(Encoding.UTF8.GetBytes(s));
                flag = deformatter.VerifySignature(rgbHash, rgbSignature);
            }
            return(flag && (DateTime.Now < DateTime.Parse(node3.InnerText)));
        }
示例#16
0
        internal static EcShop.Entities.Store.MessageTemplate GetTemplate(string messageType)
        {
            messageType = messageType.ToLower();
            SiteSettings siteSettings = HiContext.Current.SiteSettings;
            string       key          = string.Format("Message-{0}", messageType);

            EcShop.Entities.Store.MessageTemplate messageTemplate = HiCache.Get(key) as EcShop.Entities.Store.MessageTemplate;
            if (messageTemplate == null)
            {
                messageTemplate = MessageTemplateHelper.GetMessageTemplate(messageType);
                if (messageTemplate != null)
                {
                    HiCache.Max(key, messageTemplate);
                }
            }
            return(messageTemplate);
        }
示例#17
0
        internal static MessageTemplate GetTemplate(string messageType)
        {
            messageType = messageType.ToLower();
            SiteSettings    masterSettings  = SettingsManager.GetMasterSettings(false);
            string          key             = string.Format("Message-{0}", messageType);
            MessageTemplate messageTemplate = HiCache.Get(key) as MessageTemplate;

            if (messageTemplate == null)
            {
                messageTemplate = GetMessageTemplate(messageType);
                if (messageTemplate != null)
                {
                    HiCache.Max(key, messageTemplate);
                }
            }
            return(messageTemplate);
        }
示例#18
0
        public static XmlDocument GetProductSubjectDocument()
        {
            string key = "ProductSubjectFileCache-Admin";

            if (HiContext.Current.SiteSettings.UserId.HasValue)
            {
                key = string.Format("ProductSubjectFileCache-{0}", HiContext.Current.SiteSettings.UserId.Value);
            }
            XmlDocument document = HiCache.Get(key) as XmlDocument;

            if (document == null)
            {
                string filename = HiContext.Current.Context.Request.MapPath(HiContext.Current.GetSkinPath() + "/ProductSubjects.xml");
                document = new XmlDocument();
                document.Load(filename);
                HiCache.Max(key, document, new CacheDependency(filename));
            }
            return(document);
        }
示例#19
0
        private static XmlDocument GetCommentDocument()
        {
            string filename = HttpContext.Current.Request.MapPath(HiContext.Current.GetSkinPath() + "/config/Comments.xml");
            string string_  = "CommentFileCache-Admin";

            if (HiContext.Current.SiteSettings.UserId.HasValue)
            {
                string_ = string.Format("CommentFileCache-{0}", HiContext.Current.SiteSettings.UserId.Value);
            }
            XmlDocument xmlDocument = HiCache.Get(string_) as XmlDocument;

            if (xmlDocument == null)
            {
                HttpContext arg_8C_0 = HiContext.Current.Context;
                xmlDocument = new XmlDocument();
                xmlDocument.Load(filename);
                HiCache.Max(string_, xmlDocument, new CacheDependency(filename));
            }
            return(xmlDocument);
        }
示例#20
0
        public static XmlDocument GetArticleSubjectDocument()
        {
            string string_ = "ArticleSubjectFileCache-Admin";

            if (HiContext.Current.SiteSettings.UserId.HasValue)
            {
                string_ = string.Format("ArticleSubjectFileCache-{0}", HiContext.Current.SiteSettings.UserId.Value);
            }
            XmlDocument xmlDocument = HiCache.Get(string_) as XmlDocument;

            if (xmlDocument == null)
            {
                HttpContext context  = HiContext.Current.Context;
                string      filename = context.Request.MapPath(HiContext.Current.GetSkinPath() + "/ArticleSubjects.xml");
                xmlDocument = new XmlDocument();
                xmlDocument.Load(filename);
                HiCache.Max(string_, xmlDocument, new CacheDependency(filename));
            }
            return(xmlDocument);
        }
示例#21
0
        private static XmlDocument GetHeadMenuDocument()
        {
            string filename = HttpContext.Current.Request.MapPath(HiContext.Current.GetSkinPath() + "/config/HeaderMenu.xml");
            string key      = "HeadMenuCache-Admin";

            if (HiContext.Current.SiteSettings.UserId.HasValue)
            {
                key = string.Format("HeadMenuCache-{0}", HiContext.Current.SiteSettings.UserId.Value);
            }
            XmlDocument document = HiCache.Get(key) as XmlDocument;

            if (document == null)
            {
                HttpContext context = HiContext.Current.Context;
                document = new XmlDocument();
                document.Load(filename);
                HiCache.Max(key, document, new CacheDependency(filename));
            }
            return(document);
        }
示例#22
0
        private string GetBrandTypeMune()
        {
            string filename = HttpContext.Current.Request.MapPath(HiContext.Current.GetSkinPath() + "/config/AllBrandType.xml");
            string key      = "CommentFileCache-A";

            if (HiContext.Current.SiteSettings.UserId.HasValue)
            {
                key = string.Format("CommentFileCache-{0}", HiContext.Current.SiteSettings.UserId.Value);
            }
            XmlDocument xmlDocument = HiCache.Get(key) as XmlDocument;

            if (xmlDocument == null)
            {
                HttpContext context = HiContext.Current.Context;
                xmlDocument = new XmlDocument();
                xmlDocument.Load(filename);
                HiCache.Max(key, xmlDocument, new CacheDependency(filename));
            }
            XmlNodeList   childNodes    = xmlDocument.SelectSingleNode("root").ChildNodes;
            StringBuilder stringBuilder = new StringBuilder();

            foreach (XmlNode xmlNode in childNodes)
            {
                if (xmlNode.Attributes["Visible"].Value.ToLower() == "true")
                {
                    string[] array = xmlNode.Attributes["Where"].Value.Split(new char[]
                    {
                        ','
                    });
                    if (xmlNode.Attributes["Id"].Value == "1")
                    {
                        stringBuilder.AppendFormat("<li class=\"cur\" categoryId={0}>{1}</li>", array[0], xmlNode.Attributes["Title"].Value);
                    }
                    else
                    {
                        stringBuilder.AppendFormat("<li categoryId={0}>{1}</li>", array[0], xmlNode.Attributes["Title"].Value);
                    }
                }
            }
            return(stringBuilder.ToString());
        }
示例#23
0
        public static string GetPublicKey()
        {
            string str = HiCache.Get("Hishop_PublicKey") as string;

            if (string.IsNullOrEmpty(str))
            {
                string      path    = null;
                HttpContext current = HttpContext.Current;
                if (current != null)
                {
                    path = current.Request.MapPath("~/config/publickey.xml");
                }
                else
                {
                    path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "/config/publickey.xml");
                }
                str = File.ReadAllText(path);
                HiCache.Max("Hishop_PublicKey", str, new CacheDependency(path));
            }
            return(str);
        }
示例#24
0
        internal static MessageTemplate GetFuwuTemplate(string messageType)
        {
            messageType = messageType.ToLower();
            SiteSettings    masterSettings      = SettingsManager.GetMasterSettings(false);
            string          key                 = string.Format("Message-{0}", "fuwu" + messageType);
            MessageTemplate fuwuMessageTemplate = HiCache.Get(key) as MessageTemplate;

            if (fuwuMessageTemplate == null)
            {
                if (string.IsNullOrEmpty(messageType))
                {
                    return(null);
                }
                fuwuMessageTemplate = new MessageTemplateDao().GetFuwuMessageTemplate(messageType);
                if (fuwuMessageTemplate != null)
                {
                    HiCache.Max(key, fuwuMessageTemplate);
                }
            }
            return(fuwuMessageTemplate);
        }
示例#25
0
        public static Navigation GetNavigation(bool isUserCache = true)
        {
            Navigation navigation;
            Navigation result;

            if (isUserCache)
            {
                navigation = (HiCache.Get("FileCache-AdminNavigation") as Navigation);
                if (navigation != null)
                {
                    result = navigation;
                    return(result);
                }
            }
            HttpContext current = HttpContext.Current;
            string      filename;

            if (current != null)
            {
                try
                {
                    filename = current.Request.MapPath("~/Admin/MenuNew.xml");
                }
                catch
                {
                    filename = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Admin\\MenuNew.xml");
                }
            }
            else
            {
                filename = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Admin\\MenuNew.xml");
            }
            XmlDocument xmlDocument = new XmlDocument();

            xmlDocument.Load(filename);
            navigation = new Navigation(xmlDocument);
            HiCache.Max("FileCache-AdminNavigation", navigation, new CacheDependency(filename));
            result = navigation;
            return(result);
        }
示例#26
0
        public static HiConfiguration GetConfig()
        {
            HiConfiguration hiConfiguration = HiCache.Get("FileCache-Configuragion") as HiConfiguration;

            if (hiConfiguration == null)
            {
                HttpContext current = HttpContext.Current;
                string      filename;
                if (current != null)
                {
                    filename = current.Request.MapPath("~/config/Hishop.config");
                }
                else
                {
                    filename = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "config\\Hishop.config");
                }
                XmlDocument xmlDocument = new XmlDocument();
                xmlDocument.Load(filename);
                hiConfiguration = new HiConfiguration(xmlDocument);
                HiCache.Max("FileCache-Configuragion", hiConfiguration, new CacheDependency(filename));
            }
            return(hiConfiguration);
        }
示例#27
0
        public static Navigation GetNavigation([Optional, DefaultParameterValue(true)] bool isUserCache)
        {
            Navigation navigation = null;
            string     str;

            if (isUserCache)
            {
                navigation = HiCache.Get("FileCache-AdminNavigation") as Navigation;
                if (navigation != null)
                {
                    return(navigation);
                }
            }
            HttpContext current = HttpContext.Current;

            if (current != null)
            {
                try
                {
                    str = current.Request.MapPath("~/Admin/MenuNew.xml");
                }
                catch
                {
                    str = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"Admin\MenuNew.xml");
                }
            }
            else
            {
                str = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"Admin\MenuNew.xml");
            }
            XmlDocument doc = new XmlDocument();

            doc.Load(str);
            navigation = new Navigation(doc);
            HiCache.Max("FileCache-AdminNavigation", navigation, new CacheDependency(str));
            return(navigation);
        }
示例#28
0
        public static SiteSettings GetMasterSettings(bool cacheable)
        {
            if (!cacheable)
            {
                HiCache.Remove("FileCache-MasterSettings");
            }
            XmlDocument xmlDocument = HiCache.Get("FileCache-MasterSettings") as XmlDocument;

            if (xmlDocument == null)
            {
                string text = SettingsManager.smethod_0();
                if (!System.IO.File.Exists(text))
                {
                    return(null);
                }
                xmlDocument = new XmlDocument();
                xmlDocument.Load(text);
                if (cacheable)
                {
                    HiCache.Max("FileCache-MasterSettings", xmlDocument, new CacheDependency(text));
                }
            }
            return(SiteSettings.FromXml(xmlDocument));
        }