public static string GetTemplateHtml(TemplateInfo templateInfo) { var directoryPath = GetTemplatesDirectoryPath(); var htmlPath = ApplicationUtils.PathCombine(directoryPath, templateInfo.Name, templateInfo.Main); var html = CacheUtils.Get <string>(htmlPath); if (html != null) { return(html); } html = ApplicationUtils.ReadText(htmlPath); CacheUtils.InsertHours(htmlPath, html, 1); return(html); }
private static TemplateInfo GetTemplateInfo(string templatesDirectoryPath, string name) { TemplateInfo templateInfo; var configPath = ApplicationUtils.PathCombine(templatesDirectoryPath, name, "config.json"); if (ApplicationUtils.IsFileExists(configPath)) { templateInfo = ApplicationUtils.JsonDeserialize <TemplateInfo>(ApplicationUtils.ReadText(configPath)); templateInfo.Name = name; } else { templateInfo = new TemplateInfo { Name = name }; } return(templateInfo); }