public IViewFile GetViewSource(string path) { var lang = ParseLanguagePath(path); if (lang == null) { return(_viewFolder.GetViewSource(path)); } var detected = PathVariations(lang).First(x => _viewFolder.HasView(x)); return(_viewFolder.GetViewSource(detected ?? lang.Path)); }
private static LocateResult Result(IViewFolder viewFolder, string path) { return(new LocateResult { Path = path, ViewFile = viewFolder.GetViewSource(path) }); }
private static LocateResult Result(IViewFolder viewFolder, string path) { return new LocateResult { Path = path, ViewFile = viewFolder.GetViewSource(path) }; }
private static string ReadContents(IViewFolder adapter, string path) { Assert.That(adapter.HasView(path), Is.True); var source = adapter.GetViewSource(path); var stream = source.OpenViewStream(); var reader = new StreamReader(stream); return(reader.ReadToEnd()); }
static string ReadToEnd(IViewFolder viewFolder, string path) { using (var stream = viewFolder.GetViewSource(path).OpenViewStream()) { using (var reader = new StreamReader(stream)) { return(reader.ReadToEnd()); } } }
public IViewFile GetViewSource(string path) { var adjusted = Adjust(path); if (adjusted == null) { throw new FileNotFoundException("File not found", path); } return(_viewFolder.GetViewSource(adjusted)); }
public override IEnumerable<Binding> GetBindings(IViewFolder viewFolder) { if (viewFolder.HasView("bindings.xml") == false) return new Binding[0]; var file = viewFolder.GetViewSource("bindings.xml"); using (var stream = file.OpenViewStream()) { using (var reader = new StreamReader(stream)) { return LoadStandardMarkup(reader); } } }
public override IEnumerable <Binding> GetBindings(IViewFolder viewFolder) { if (viewFolder.HasView("bindings.xml") == false) { return(new Binding[0]); } var file = viewFolder.GetViewSource("bindings.xml"); using (var stream = file.OpenViewStream()) { using (var reader = new StreamReader(stream)) { return(LoadStandardMarkup(reader)); } } }
protected SourceContext CreateSourceContext(string viewPath, IViewFolder viewFolder) { var viewSource = viewFolder.GetViewSource(viewPath); if (viewSource == null) throw new FileNotFoundException("View file not found", viewPath); using (var stream = viewSource.OpenViewStream()) { string fileName = viewPath; if (stream is FileStream) fileName = ((FileStream) stream).Name; using (TextReader reader = new StreamReader(stream)) { return new SourceContext(reader.ReadToEnd(), viewSource.LastModified, fileName); } } }
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); }
private static string ReadContents(IViewFolder adapter, string path) { Assert.That(adapter.HasView(path), Is.True); var source = adapter.GetViewSource(path); var stream = source.OpenViewStream(); var reader = new StreamReader(stream); return reader.ReadToEnd(); }
static string ReadToEnd(IViewFolder viewFolder, string path) { using (var stream = viewFolder.GetViewSource(path).OpenViewStream()) { using (var reader = new StreamReader(stream)) { return reader.ReadToEnd(); } } }
public IViewFile GetViewSource(string path) { return(_base.GetViewSource(Convert(path))); }