Beispiel #1
0
        public static void SaveSiteConfig(SiteConfig siteconfig, string configfilepath)
        {
            List <SiteConfig> siteList = GetSiteList();

            FPCache.Remove("FP_SITELIST");
            if (siteList.Count == 0)
            {
                siteList.Add(siteconfig);
            }
            else
            {
                bool flag = false;
                for (int i = 0; i < siteList.Count; i++)
                {
                    if (siteList[i].sitepath.ToLower() == siteconfig.sitepath.ToLower())
                    {
                        siteList[i] = siteconfig;
                        flag        = true;
                        break;
                    }
                }
                if (!flag)
                {
                    siteList.Add(siteconfig);
                }
            }
            FPCache.Insert("FP_SITELIST", siteList);
            FPSerializer.Save(siteconfig, configfilepath);
        }
Beispiel #2
0
        public static void SaveViewConfig(List <ViewConfig> viewlist)
        {
            string mapPath = FPFile.GetMapPath(WebConfig.WebPath + "config/view.config");

            FPXml.SaveXml(viewlist, mapPath);
            FPCache.Remove("FP_VIEWLIST");
        }
Beispiel #3
0
        public static List <SiteConfig> GetSiteList()
        {
            object            obj  = FPCache.Get("FP_SITELIST");
            List <SiteConfig> list = new List <SiteConfig>();

            if (obj != null)
            {
                return(obj as List <SiteConfig>);
            }
            return(new List <SiteConfig>());
        }
Beispiel #4
0
        public static List <ViewConfig> GetViewList()
        {
            object            obj  = FPCache.Get("FP_VIEWLIST");
            List <ViewConfig> list = new List <ViewConfig>();

            if (obj != null)
            {
                list = (obj as List <ViewConfig>);
            }
            else
            {
                string mapPath = FPFile.GetMapPath(WebConfig.WebPath + "config/view.config");
                list = FPXml.LoadList <ViewConfig>(mapPath);
                FPCache.Insert("FP_VIEWLIST", list, mapPath);
            }
            return(list);
        }
Beispiel #5
0
        public static SiteConfig GetSiteInfo(string sitepath)
        {
            List <SiteConfig> list = GetSiteList().FindAll((SiteConfig item) => item.sitepath.ToLower() == sitepath.ToLower());

            if (list.Count > 0)
            {
                return(list[0]);
            }
            SiteConfig siteConfig = LoadSiteConfig(sitepath);

            if (siteConfig.guid != "")
            {
                FPCache.Remove("FP_SITELIST");
                list.Add(siteConfig);
                FPCache.Insert("FP_SITELIST", list);
            }
            return(siteConfig);
        }
Beispiel #6
0
        public static void SaveViewConfig(ViewConfig viewconfig)
        {
            bool flag = false;
            List <ViewConfig> viewList = GetViewList();

            for (int i = 0; i < viewList.Count; i++)
            {
                if (viewList[i].path.ToLower() == viewconfig.path.ToLower())
                {
                    viewList[i].include = viewconfig.include;
                    flag = true;
                }
            }
            if (!flag)
            {
                viewList.Add(viewconfig);
            }
            string mapPath = FPFile.GetMapPath(WebConfig.WebPath + "config/view.config");

            FPXml.SaveXml(viewList, mapPath);
            FPCache.Remove("FP_VIEWLIST");
        }
Beispiel #7
0
        // Token: 0x06000055 RID: 85 RVA: 0x000038E8 File Offset: 0x00001AE8
        public static SiteConfig GetSiteInfo(string sitepath)
        {
            SiteConfig siteConfig = FPCache.Get <SiteConfig>("FP_SITECONFIG_" + sitepath);

            lock (SiteConfigs.lockHelper)
            {
                if (siteConfig == null)
                {
                    string mapPath;
                    if (sitepath == "")
                    {
                        mapPath = FPUtils.GetMapPath(WebConfig.WebPath + "site.config");
                    }
                    else if (File.Exists(FPUtils.GetMapPath(WebConfig.WebPath + "sites/" + sitepath + "/site.config")))
                    {
                        mapPath = FPUtils.GetMapPath(WebConfig.WebPath + "sites/" + sitepath + "/site.config");
                    }
                    else if (File.Exists(FPUtils.GetMapPath(WebConfig.WebPath + sitepath + "/site.config")))
                    {
                        mapPath = FPUtils.GetMapPath(WebConfig.WebPath + sitepath + "/site.config");
                    }
                    else
                    {
                        mapPath = FPUtils.GetMapPath(WebConfig.WebPath + "site.config");
                    }
                    if (!File.Exists(mapPath))
                    {
                        FPSerializer.Save <SiteConfig>(mapPath);
                    }
                    FPCache.Insert("FP_SITECONFIG_" + sitepath, SiteConfigs.LoadConfig(mapPath), mapPath);
                    siteConfig = FPCache.Get <SiteConfig>("FP_SITECONFIG_" + sitepath);
                }
            }
            siteConfig.sitepath = sitepath;
            return(siteConfig);
        }
Beispiel #8
0
        // Token: 0x06000024 RID: 36 RVA: 0x00003260 File Offset: 0x00001460
        public static T Get <T>(string key)
        {
            object obj = FPCache.Get(key);

            return((obj == null) ? default(T) : ((T)((object)obj)));
        }
Beispiel #9
0
 // Token: 0x06000057 RID: 87 RVA: 0x00003A84 File Offset: 0x00001C84
 public static bool SaveConfig(SiteConfig siteconfig, string configfilepath)
 {
     FPCache.Remove("FP_SITECONFIG_" + siteconfig.sitepath);
     return(FPSerializer.Save <SiteConfig>(siteconfig, configfilepath));
 }