public static DataTable GetAllTemplateList(string templatePath) { DirectoryInfo directoryInfo = new DirectoryInfo(templatePath); DataTable allTemplateList = Discuz.Data.Templates.GetAllTemplateList(); allTemplateList.Columns.Add("valid", typeof(Int16)); string text = ","; foreach (DataRow dataRow in allTemplateList.Rows) { TemplateAboutInfo templateAboutInfo = Templates.GetTemplateAboutInfo(templatePath + dataRow["directory"].ToString()); dataRow["valid"] = 1; AdminTemplates.SetTemplateDataRow(dataRow, templateAboutInfo); text = text + dataRow["directory"].ToString() + ","; } int num = TypeConverter.ObjectToInt(Discuz.Data.Templates.GetValidTemplateList().Compute("Max(templateid)", "")) + 1; DirectoryInfo[] directories = directoryInfo.GetDirectories(); for (int i = 0; i < directories.Length; i++) { DirectoryInfo directoryInfo2 = directories[i]; if (directoryInfo2 != null && text.IndexOf("," + directoryInfo2 + ",") < 0) { TemplateAboutInfo templateAboutInfo2 = Templates.GetTemplateAboutInfo(directoryInfo2.FullName); DataRow dataRow2 = allTemplateList.NewRow(); dataRow2["templateid"] = num++; dataRow2["directory"] = directoryInfo2.Name; dataRow2["valid"] = 0; AdminTemplates.SetTemplateDataRow(dataRow2, templateAboutInfo2); allTemplateList.Rows.Add(dataRow2); } } allTemplateList.AcceptChanges(); return(allTemplateList); }
public static int GetTemplateWidth(string templatePath) { var cacheService = XCache.Current; string text = cacheService.RetrieveObject("/Forum/TemplateWidth/" + templatePath) as string; if (text == null) { text = Templates.GetTemplateAboutInfo(Utils.GetMapPath(BaseConfigs.GetForumPath + "templates/" + templatePath + "/")).width; XCache.Add("/Forum/TemplateWidth/" + templatePath, text); } return(TypeConverter.StrToInt(text)); }