示例#1
0
        public static TemplatePluginsInfo ReadTemplatePlugins(string path)
        {
            List <TemplatePluginsInfo> list = ReadTemplatePluginsList();
            TemplatePluginsInfo        info = new TemplatePluginsInfo();

            foreach (TemplatePluginsInfo info2 in list)
            {
                if (info2.Path == path)
                {
                    return(info2);
                }
            }
            return(info);
        }
示例#2
0
        /// <summary>
        /// 读取一条模板插件
        /// </summary>
        /// <returns></returns>
        public static TemplatePluginsInfo ReadTemplatePlugins(string path)
        {
            List <TemplatePluginsInfo> templatePluginsList = ReadTemplatePluginsList();
            TemplatePluginsInfo        templatePlugins     = new TemplatePluginsInfo();

            foreach (TemplatePluginsInfo temp in templatePluginsList)
            {
                if (temp.Path == path)
                {
                    templatePlugins = temp;
                    break;
                }
            }
            return(templatePlugins);
        }
示例#3
0
        public static void RefreshTemplateCache()
        {
            List <TemplatePluginsInfo> cacheValue = new List <TemplatePluginsInfo>();
            List <FileInfo>            list2      = FileHelper.ListDirectory(path, "|.xml|");

            foreach (FileInfo info in list2)
            {
                using (XmlHelper helper = new XmlHelper(info.FullName))
                {
                    TemplatePluginsInfo item = new TemplatePluginsInfo();
                    item.Path          = helper.ReadAttribute("Template/Path", "Value");
                    item.Name          = helper.ReadAttribute("Template/Name", "Value");
                    item.Photo         = helper.ReadAttribute("Template/Photo", "Value");
                    item.DisCreateFile = helper.ReadAttribute("Template/DisCreateFile", "Value");
                    item.CopyRight     = helper.ReadAttribute("Template/CopyRight", "Value");
                    item.PublishDate   = helper.ReadAttribute("Template/PublishDate", "Value");
                    cacheValue.Add(item);
                }
            }
            CacheHelper.Write(templateCacheKey, cacheValue);
        }
示例#4
0
        /// <summary>
        /// 刷新模板缓存
        /// </summary>
        /// <returns></returns>
        public static void RefreshTemplateCache()
        {
            List <TemplatePluginsInfo> templatePluginsList = new List <TemplatePluginsInfo>();
            List <FileInfo>            fileList            = FileHelper.ListDirectory(path, "|.xml|");

            foreach (FileInfo file in fileList)
            {
                using (XmlHelper xh = new XmlHelper(file.FullName))
                {
                    TemplatePluginsInfo templatePlugins = new TemplatePluginsInfo();
                    templatePlugins.Path          = xh.ReadAttribute("Template/Path", "Value");
                    templatePlugins.Name          = xh.ReadAttribute("Template/Name", "Value");
                    templatePlugins.Photo         = xh.ReadAttribute("Template/Photo", "Value");
                    templatePlugins.DisCreateFile = xh.ReadAttribute("Template/DisCreateFile", "Value");
                    templatePlugins.CopyRight     = xh.ReadAttribute("Template/CopyRight", "Value");
                    templatePlugins.PublishDate   = xh.ReadAttribute("Template/PublishDate", "Value");
                    templatePluginsList.Add(templatePlugins);
                }
            }
            CacheHelper.Write(templateCacheKey, templatePluginsList);
        }