private Entry BindEntry(string referencePath) { if (this.entries.ContainsKey(referencePath)) { return(this.entries[referencePath]); } IViewFile viewSource = this.ViewFolder.GetViewSource(referencePath); Entry entry = new Entry { ViewPath = referencePath, ViewFile = viewSource, LastModified = viewSource.LastModified }; this.entries.Add(referencePath, entry); this.pending.Add(referencePath); return(entry); }
public static SourceContext CreateSourceContext(string viewPath, IViewFolder viewFolder) { SourceContext context; IViewFile viewSource = viewFolder.GetViewSource(viewPath); if (viewSource == null) { throw new FileNotFoundException("View file not found", viewPath); } using (Stream stream = viewSource.OpenViewStream()) { string fileName = viewPath; if (stream is FileStream) { fileName = ((FileStream)stream).Name; } using (TextReader reader = new StreamReader(stream)) { context = new SourceContext(reader.ReadToEnd(), viewSource.LastModified, fileName); } } return(context); }