public static void CreateLayoutControls(string TemplateName, PresetInfo PresetObj) { string templatePath = TemplateName.ToLower().Equals("default") ? Utils.GetTemplatePath_Default(TemplateName) : Utils.GetTemplatePath(TemplateName); string presetPath = TemplateName.ToLower().Equals("default") ? Utils.GetPresetPath_DefaultTemplate(TemplateName) : Utils.GetPresetPath(TemplateName); ModulePaneGenerator mg = new ModulePaneGenerator(); string filePath = templatePath + "/layouts/" + PresetObj.ActiveLayout.Replace(".xml", "") + ".xml"; XmlParser parser = new XmlParser(); try { List<XmlTag> lstXmlTag = parser.GetXmlTags(filePath, "layout/section"); List<XmlTag> lstWrappers = parser.GetXmlTags(filePath, "layout/wrappers"); string html = mg.GenerateHTML(lstXmlTag, lstWrappers, 2); string controlclass = Path.GetFileNameWithoutExtension(filePath); string controlname = string.Format("{0}.ascx", controlclass); if (!File.Exists(templatePath + "/" + controlname)) { FileStream fs = null; using (fs = File.Create(templatePath + "/" + controlname)) { } } else { File.Delete(templatePath + "/" + controlname); FileStream fs = null; using (fs = File.Create(templatePath + "/" + controlname)) { } } using (StreamWriter sw = new StreamWriter(templatePath + "/" + controlname)) { sw.Write("<%@ Control Language=\"C#\" ClassName=" + controlclass + " %>"); sw.Write(html); } } catch (Exception) { throw; } }
public static void CreateLayoutControls(string TemplateName, PresetInfo PresetObj) { string templatePath = Utils.GetTemplatePath(TemplateName); string presetPath = Utils.GetPresetPath(TemplateName); LayoutControlGenerator lg = new LayoutControlGenerator(); XmlParser parser = new XmlParser(); PresetInfo presetdetails = PresetHelper.LoadPresetDetails(presetPath + "/" + PresetObj.PresetName.Replace(".xml", "") + ".xml"); List<XmlTag> lstXmlTag = parser.GetXmlTags(templatePath + "/layouts/default/" + presetdetails.ActiveLayout.Replace(".xml", "") + ".xml", "layout/section"); string html = lg.GenerateHTML(lstXmlTag); string controlname = PresetObj.ActiveLayout + ".ascx"; if (!File.Exists(templatePath + "/" + controlname)) { FileStream fs = null; using (fs = File.Create(templatePath + "/" + controlname)) { } } else { File.Delete(templatePath + "/" + controlname); FileStream fs = null; using (fs = File.Create(templatePath + "/" + controlname)) { } } using (StreamWriter sw = new StreamWriter(templatePath + "/" + controlname)) { sw.Write("<%@ Control Language=\"C#\" ClassName=" + PresetObj.PresetName + " %>"); sw.Write(html); } }
public static string GenerateWireFrame(string FilePath, string TemplateName) { try { //Check For Default Layout BlockParser.CheckFilePath(FilePath.ToLower()); List<XmlTag> lstXmlTags = new List<XmlTag>(); XmlParser parser = new XmlParser(); string templatePath = Decide.IsTemplateDefault(TemplateName.Trim()) ? Utils.GetTemplatePath_Default(TemplateName) : Utils.GetTemplatePath(TemplateName); string filePath = FilePath.ToLower().Equals("core") ? string.Format("{0}/Layouts/standard/All.xml", Utils.GetTemplatePath_Default("Default")) : string.Format("{0}/layouts/{1}.xml", templatePath, FilePath); lstXmlTags = parser.GetXmlTags(filePath, "layout/section"); List<XmlTag> lstWrappers = parser.GetXmlTags(filePath, "layout/wrappers"); ModulePaneGenerator wg = new ModulePaneGenerator(); return (wg.GenerateHTML(lstXmlTags, lstWrappers, 0)); } catch (Exception) { if (FilePath.ToLower().Equals("core")) return ("<div class='sfMessage sfErrormsg'>Invalid XML document<input type='button' class='sfResetCore' id='btnReset' value='Reset Core'/></div>"); else return ("<div class='sfMessage sfErrormsg'>Invalid XML document</div>"); } }
public static void CreateLayoutControls(string TemplateName, string filePath) { BlockParser.CheckFilePath(); string templatePath = Decide.IsTemplateDefault(TemplateName) ? Utils.GetTemplatePath_Default(TemplateName) : Utils.GetTemplatePath(TemplateName); string presetPath = Decide.IsTemplateDefault(TemplateName) ? Utils.GetPresetPath_DefaultTemplate(TemplateName) : Utils.GetPresetPath(TemplateName); ModulePaneGenerator mg = new ModulePaneGenerator(); XmlParser parser = new XmlParser(); try { List<XmlTag> lstXmlTag = parser.GetXmlTags(filePath, "layout/section"); List<XmlTag> lstWrappers = parser.GetXmlTags(filePath, "layout/wrappers"); string html = mg.GenerateHTML(lstXmlTag, lstWrappers, 2); //html = Utils.FormatHtmlOutput(html); string controlclass = Path.GetFileNameWithoutExtension(filePath); string controlname = string.Format("{0}.ascx", controlclass); if (!File.Exists(templatePath + "/" + controlname)) { FileStream fs = null; using (fs = File.Create(templatePath + "/" + controlname)) { } } else { File.Delete(templatePath + "/" + controlname); FileStream fs = null; using (fs = File.Create(templatePath + "/" + controlname)) { } } using (StreamWriter sw = new StreamWriter(templatePath + "/" + controlname)) { sw.Write("<%@ Control Language=\"C#\" ClassName=" + controlclass + " %>"); sw.Write(Environment.NewLine); sw.Write(html); } } catch (Exception) { throw; } }