public void ReloadModifiedPageAndTemplates(MarkdownPage markdownPage) { var lastWriteTime = File.GetLastWriteTime(markdownPage.FilePath); if (lastWriteTime > markdownPage.LastModified) { markdownPage.Reload(); } MarkdownTemplate template; if (markdownPage.DirectiveTemplatePath != null && this.PageTemplates.TryGetValue(markdownPage.DirectiveTemplatePath, out template)) { lastWriteTime = File.GetLastWriteTime(markdownPage.DirectiveTemplatePath); if (lastWriteTime > template.LastModified) { ReloadTemplate(template); } } if (markdownPage.TemplatePath != null && this.PageTemplates.TryGetValue(markdownPage.TemplatePath, out template)) { lastWriteTime = File.GetLastWriteTime(markdownPage.TemplatePath); if (lastWriteTime > template.LastModified) { ReloadTemplate(template); } } }
private MarkdownPage ReloadIfNeeded(MarkdownPage markdownPage) { if (markdownPage == null || !WatchForModifiedPages) { return(markdownPage); } if (markdownPage.FilePath != null) { var latestPage = GetLatestPage(markdownPage); if (latestPage == null) { return(markdownPage); } if (latestPage.LastModified > markdownPage.LastModified) { markdownPage.Reload(GetPageContents(latestPage), latestPage.LastModified); } } return(markdownPage); }