Esempio n. 1
0
            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));
            }
Esempio n. 2
0
 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());
         }
     }
 }
Esempio n. 6
0
        public IViewFile GetViewSource(string path)
        {
            var adjusted = Adjust(path);

            if (adjusted == null)
            {
                throw new FileNotFoundException("File not found", path);
            }
            return(_viewFolder.GetViewSource(adjusted));
        }
Esempio n. 7
0
        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);
                }
            }
        }
Esempio n. 8
0
        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));
                }
            }
        }
Esempio n. 9
0
        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);
        }
Esempio n. 11
0
 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();
 }
Esempio n. 12
0
 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)));
 }