Layout GetLayoutByKey(string key) { var keyParts = key.Split(new [] { ':' }, StringSplitOptions.RemoveEmptyEntries); var portalId = int.Parse(keyParts [0]); var layoutName = keyParts [1]; var layoutFile = LayoutHelper.GetLayoutFileName(layoutName, portalId); if (File.Exists(layoutFile)) { try { return(MarkupParser.ParseLayout(File.ReadAllText(layoutFile))); } catch (Exception ex) { // TODO: Log layout loading error throw new Exception(string.Format("Cannot find layout file \"{0}.xml\"", Path.GetFileNameWithoutExtension(layoutFile)), ex); } } return(null); }
public static bool IsValid(string layoutMarkup) { return(IsValidXml("<root>" + layoutMarkup + "</root>") && HasValidPanes(MarkupParser.ParseLayout(layoutMarkup))); }