示例#1
0
        public static List <SiteConfig> GetMapSiteList()
        {
            List <SiteConfig> list    = new List <SiteConfig>();
            string            mapPath = FPFile.GetMapPath(WebConfig.WebPath + "sites");

            if (Directory.Exists(mapPath))
            {
                DirectoryInfo[] directories = new DirectoryInfo(mapPath).GetDirectories();
                foreach (DirectoryInfo directoryInfo in directories)
                {
                    if (File.Exists(directoryInfo.FullName + "\\site.config") && directoryInfo.Name.ToLower() != "app" && directoryInfo.Name.ToLower() != "plugins")
                    {
                        SiteConfig siteConfig = FPSerializer.Load <SiteConfig>(directoryInfo.FullName + "\\site.config");
                        siteConfig.sitepath = directoryInfo.Name;
                        string mapPath2 = FPFile.GetMapPath(WebConfig.WebPath + directoryInfo.Name);
                        if (Directory.Exists(mapPath2))
                        {
                            siteConfig.size = FPFile.FormatBytesStr(FPFile.GetDirSize(mapPath2));
                        }
                        else
                        {
                            siteConfig.size = FPFile.FormatBytesStr(FPFile.GetDirSize(directoryInfo.FullName));
                        }
                        list.Add(siteConfig);
                    }
                }
            }
            return(list);
        }
示例#2
0
        public static SiteConfig LoadSiteConfig(string sitepath)
        {
            SiteConfig siteConfig = new SiteConfig();

            if (sitepath.ToLower() == "app")
            {
                siteConfig.name     = "系统应用";
                siteConfig.sitepath = "app";
                siteConfig.version  = "1.0.0";
                siteConfig.urltype  = 0;
            }
            else if (sitepath.ToLower() == "plugins")
            {
                siteConfig.name     = "系统插件";
                siteConfig.sitepath = "plugins";
                siteConfig.version  = "1.0.0";
                siteConfig.urltype  = 0;
            }
            else if (File.Exists(FPFile.GetMapPath(WebConfig.WebPath + "sites/" + sitepath + "/site.config")))
            {
                siteConfig = FPSerializer.Load <SiteConfig>(FPFile.GetMapPath(WebConfig.WebPath + "sites/" + sitepath + "/site.config"));
            }
            else if (File.Exists(FPFile.GetMapPath(WebConfig.WebPath + sitepath + "/site.config")))
            {
                siteConfig = FPSerializer.Load <SiteConfig>(FPFile.GetMapPath(WebConfig.WebPath + sitepath + "/site.config"));
            }
            else if (File.Exists(FPFile.GetMapPath(WebConfig.WebPath + "/site.config")))
            {
                siteConfig = FPSerializer.Load <SiteConfig>(FPFile.GetMapPath(WebConfig.WebPath + "/site.config"));
            }
            return(siteConfig);
        }
示例#3
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);
        }
示例#4
0
        public static SiteConfig GetMapSiteConfig(string sitepath)
        {
            SiteConfig result  = new SiteConfig();
            string     mapPath = FPFile.GetMapPath(WebConfig.WebPath + "sites/" + sitepath + "/site.config");

            if (File.Exists(mapPath))
            {
                result = FPSerializer.Load <SiteConfig>(mapPath);
            }
            return(result);
        }
示例#5
0
        public static List <SiteConfig> GetSysSiteList()
        {
            List <SiteConfig> list    = new List <SiteConfig>();
            string            mapPath = FPFile.GetMapPath(WebConfig.WebPath);

            if (Directory.Exists(mapPath))
            {
                DirectoryInfo[] directories = new DirectoryInfo(mapPath).GetDirectories();
                foreach (DirectoryInfo directoryInfo in directories)
                {
                    if (File.Exists(directoryInfo.FullName + "\\site.config"))
                    {
                        SiteConfig siteConfig = FPSerializer.Load <SiteConfig>(directoryInfo.FullName + "\\site.config");
                        siteConfig.sitepath = directoryInfo.Name;
                        list.Add(siteConfig);
                    }
                }
            }
            return(list);
        }
示例#6
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);
        }
示例#7
0
        // Token: 0x0600000B RID: 11 RVA: 0x000026D8 File Offset: 0x000008D8
        public static bool Save <T>(string filename) where T : new()
        {
            T obj = (default(T) == null) ? Activator.CreateInstance <T>() : default(T);

            return(FPSerializer.Save <T>(obj, filename));
        }
示例#8
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));
 }
示例#9
0
 // Token: 0x06000056 RID: 86 RVA: 0x00003A6C File Offset: 0x00001C6C
 public static SiteConfig LoadConfig(string configfilepath)
 {
     return(FPSerializer.Load <SiteConfig>(configfilepath));
 }