Esempio n. 1
0
 public SiteTemplateManager(IPathManager pathManager, IDatabaseManager databaseManager, CacheUtils caching)
 {
     _pathManager     = pathManager;
     _databaseManager = databaseManager;
     _caching         = caching;
     _rootPath        = _pathManager.GetSiteTemplatesPath(string.Empty);
     DirectoryUtils.CreateDirectoryIfNotExists(_rootPath);
 }
Esempio n. 2
0
        public static async Task ExportSiteToSiteTemplateAsync(IPathManager pathManager, IDatabaseManager databaseManager, CacheUtils caching, Site site, string siteTemplateDir)
        {
            var exportObject = new ExportObject(pathManager, databaseManager, caching, site);

            var siteTemplatePath = pathManager.GetSiteTemplatesPath(siteTemplateDir);

            //导出模板
            var templateFilePath = pathManager.GetSiteTemplateMetadataPath(siteTemplatePath, DirectoryUtils.SiteFiles.SiteTemplates.FileTemplate);
            await exportObject.ExportTemplatesAsync(templateFilePath);

            //导出辅助表及样式
            var tableDirectoryPath = pathManager.GetSiteTemplateMetadataPath(siteTemplatePath, DirectoryUtils.SiteFiles.SiteTemplates.Table);
            await exportObject.ExportTablesAndStylesAsync(tableDirectoryPath);

            //导出站点属性以及站点属性表单
            var configurationFilePath = pathManager.GetSiteTemplateMetadataPath(siteTemplatePath, DirectoryUtils.SiteFiles.SiteTemplates.FileConfiguration);
            await exportObject.ExportConfigurationAsync(configurationFilePath);

            //导出关联字段
            var relatedFieldDirectoryPath = pathManager.GetSiteTemplateMetadataPath(siteTemplatePath, DirectoryUtils.SiteFiles.SiteTemplates.RelatedField);
            await exportObject.ExportRelatedFieldAsync(relatedFieldDirectoryPath);
        }