public PageParser(string rootDirectory, string rootUri) { _rootDirectory = rootDirectory; _rootUri = rootUri.Trim('/'); _pageSource = new PageSource(rootUri, rootDirectory); PreFilters = new PreFilterCollection(); PostFilters = new PostFilterCollection(); MissingLinkStyle = "color: red"; DefaultCodeLanguage = "text"; }
private static PageReference GetWorkroomStartPageLink(IPageSource page) { if (page.CurrentPage.PageTypeName.Equals(WorkroomListPageTypeName, StringComparison.OrdinalIgnoreCase)) { return(page.CurrentPage.PageLink); } else { return(page.CurrentPage[_workroomStartProperty] as PageReference); } }
public T CurrentPage <T>(IPageSource page) where T : PageData { var cPage = page.CurrentPage; if (cPage == null) { return(null); } var typedPage = cPage as T; if (typedPage != null) { return(typedPage); } if (cPage.PageLink == PageReference.StartPage) { return(IoC.Get <T>()); } var msg = string.Format("Invalid PageType on page '{0}', a page of type '{1}' was expected, but got '{2}'.", cPage.PageLink, typeof(T).FullName, cPage.GetType().FullName); throw new InvalidOperationException(msg); }
public static T CurrentPage <T>(this IPageSource page) where T : PageData { return(IoC.Get <ICurrentPageResolver>().CurrentPage <T>(page)); }
public void SendPage(string aStatus, IPageSource aPageSource) { Dictionary<string, IEnumerable<string>> headers = new Dictionary<string, IEnumerable<string>>(DefaultResponseHeaders); headers["Content-Length"] = new[] { aPageSource.ContentLength.ToString() }; headers["Content-Type"] = new[] { aPageSource.ContentType }; iResult(aStatus, headers, aPageSource.Serve()); }