コード例 #1
0
        private bool FileExists(string path)
        {
            if (string.IsNullOrEmpty(path))
            {
                return(false);
            }
            if (path[0] != '~' && path[0] != '/')
            {
                return(false);
            }

            return(_resourceLocator.FileExists(path));
        }
コード例 #2
0
        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));
        }
コード例 #3
0
ファイル: ViewFileReader.cs プロジェクト: zerioxen/cofoundry
        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);
        }