Exemplo n.º 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);
        }
Exemplo n.º 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");
        }
Exemplo n.º 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>());
        }
Exemplo n.º 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);
        }
Exemplo n.º 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);
        }
Exemplo n.º 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");
        }
Exemplo n.º 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);
        }
Exemplo n.º 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)));
        }
Exemplo n.º 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));
 }