public MarkdownOwinMiddleware(AppFunc next, MarkdownOwinOptions options) { if (next == null) throw new ArgumentNullException(nameof(next)); if (options == null) throw new ArgumentNullException(nameof(options)); _next = next; var sitemap = ServerContext.Create(options); var engine = new RenderingEngine(); _server = new Server(sitemap, engine); }
public static ServerContext Create(MarkdownOwinOptions options) { if (options == null) throw new ArgumentNullException(nameof(options)); var rootDirectoryPath = Path.Combine(AppDomain.CurrentDomain.SetupInformation.ApplicationBase, options.RootDirectory); if (!Directory.Exists(rootDirectoryPath)) throw new ArgumentException("The specified root directory does not exist in the expected location: " + rootDirectoryPath); var rootRequestPath = NormalizeConfiguredRootRequestPath(options.RootRequestPath); var scanResult = ScanRootDirectoryForRoutes(rootDirectoryPath, rootRequestPath); var context = CreateContext(scanResult, options.Http404Behavior, options.RootRequestPath); return context; }
public MarkdownOwinMiddleware(AppFunc next, MarkdownOwinOptions options) { if (next == null) { throw new ArgumentNullException(nameof(next)); } if (options == null) { throw new ArgumentNullException(nameof(options)); } _next = next; var sitemap = ServerContext.Create(options); var engine = new RenderingEngine(); _server = new Server(sitemap, engine); }
public static ServerContext Create(MarkdownOwinOptions options) { if (options == null) { throw new ArgumentNullException(nameof(options)); } var rootDirectoryPath = Path.Combine(AppDomain.CurrentDomain.SetupInformation.ApplicationBase, options.RootDirectory); if (!Directory.Exists(rootDirectoryPath)) { throw new ArgumentException("The specified root directory does not exist in the expected location: " + rootDirectoryPath); } var rootRequestPath = NormalizeConfiguredRootRequestPath(options.RootRequestPath); var scanResult = ScanRootDirectoryForRoutes(rootDirectoryPath, rootRequestPath); var context = CreateContext(scanResult, options.Http404Behavior, options.RootRequestPath); return(context); }