Exemple #1
0
            public bool HasView(string path)
            {
                var lang = ParseLanguagePath(path);

                if (lang == null)
                {
                    return(_viewFolder.HasView(path));
                }

                return(PathVariations(lang).Any(x => _viewFolder.HasView(x)));
            }
        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());
        }
        public LocateResult LocateMasterFile(IViewFolder viewFolder, string masterName)
        {
            string str  = masterName + Constants.DotSpark;
            string path = Path.Combine(Constants.Layouts, str);

            if (viewFolder.HasView(path))
            {
                return(Result(viewFolder, path));
            }
            string str3 = Path.Combine(Constants.Shared, str);

            if (viewFolder.HasView(str3))
            {
                return(Result(viewFolder, str3));
            }
            return(new LocateResult {
                SearchedLocations = new string[] { path, str3 }
            });
        }
 public LocateResult LocateMasterFile(IViewFolder viewFolder, string masterName)
 {
     if (viewFolder.HasView("Layouts\\" + masterName + ".spark"))
     {
         return Result(viewFolder, "Layouts\\" + masterName + ".spark");
     }
     if (viewFolder.HasView("Shared\\" + masterName + ".spark"))
     {
         return Result(viewFolder, "Shared\\" + masterName + ".spark");
     }
     return new LocateResult
            {
                SearchedLocations = new[]
                                    {
                                        "Layouts\\" + masterName + ".spark",
                                        "Shared\\" + masterName + ".spark"
                                    }
            };
 }
 public LocateResult LocateMasterFile(IViewFolder viewFolder, string masterName)
 {
     if (viewFolder.HasView("Layouts\\" + masterName + ".spark"))
     {
         return(Result(viewFolder, "Layouts\\" + masterName + ".spark"));
     }
     if (viewFolder.HasView("Shared\\" + masterName + ".spark"))
     {
         return(Result(viewFolder, "Shared\\" + masterName + ".spark"));
     }
     return(new LocateResult
     {
         SearchedLocations = new[]
         {
             "Layouts\\" + masterName + ".spark",
             "Shared\\" + masterName + ".spark"
         }
     });
 }
Exemple #6
0
        public bool HasView(string path)
        {
            var adjusted = Adjust(path);

            if (adjusted == null)
            {
                return(false);
            }

            return(_viewFolder.HasView(adjusted));
        }
        public LocateResult LocateMasterFile(IViewFolder viewFolder, string masterName)
        {
            var masterFile = masterName + Constants.DotSpark;

            var layoutsMaster = Path.Combine(Constants.Layouts, masterFile);
            if (viewFolder.HasView(layoutsMaster))
            {
                return Result(viewFolder, layoutsMaster);
            }

            var sharedMaster = Path.Combine(Constants.Shared, masterFile);
            if (viewFolder.HasView(sharedMaster))
            {
                return Result(viewFolder, sharedMaster);
            }

            return new LocateResult
            {
                SearchedLocations = new[] { layoutsMaster, sharedMaster }
            };
        }
Exemple #8
0
        public LocateResult LocateMasterFile(IViewFolder viewFolder, string masterName)
        {
            var masterFile = masterName + Constants.DotSpark;

            var layoutsMaster = Path.Combine(Constants.Layouts, masterFile);

            if (viewFolder.HasView(layoutsMaster))
            {
                return(Result(viewFolder, layoutsMaster));
            }

            var sharedMaster = Path.Combine(Constants.Shared, masterFile);

            if (viewFolder.HasView(sharedMaster))
            {
                return(Result(viewFolder, sharedMaster));
            }

            return(new LocateResult
            {
                SearchedLocations = new[] { layoutsMaster, sharedMaster }
            });
        }
        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);
                }
            }
        }
Exemple #10
0
        private static string DetectLayout(string template, IViewFolder viewFolder)
        {
            var possibleLayouts = new[]
            {
                Configuration.Configure.Views.Layout ?? string.Empty,
                "layouts/application.spark",
                "views/layouts/application.spark",
                "views/application.spark",
                "views/application.spark",
                Path.Combine(Path.GetDirectoryName(template), "layouts/application.spark"),
                Path.Combine(Path.GetDirectoryName(template), "application.spark")
            };

            return(possibleLayouts.First(x => viewFolder.HasView(x)));
        }
Exemple #11
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));
                }
            }
        }
 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();
 }
 public bool HasView(string path)
 {
     return(_base.HasView(Convert(path)));
 }