private bool FileExists(string path) { if (string.IsNullOrEmpty(path)) { return(false); } if (path[0] != '~' && path[0] != '/') { return(false); } return(_resourceLocator.FileExists(path)); }
protected bool FileExists(string path) { if (string.IsNullOrEmpty(path)) { return(false); } // check well formatted path if (path[0] != '~' && path[0] != '/') { return(false); } return(_resourceLocator.FileExists(path)); }
public string Read(string viewPath) { if (!_resourceLocator.FileExists(viewPath)) { throw new InvalidOperationException(string.Format("Could not find template {0}", viewPath)); } var file = _resourceLocator.GetFile(viewPath); string template = null; using (var stream = file.Open()) using (var reader = new StreamReader(stream, Encoding.UTF8)) { template = reader.ReadToEnd(); } return(template); }