コード例 #1
0
        public IEnumerable <Domain.MenuItem> GetMenu(string dictaatName)
        {
            var path = _pathHelper.MenuConfigPath(dictaatName);
            IEnumerable <Domain.MenuItem> menu = null;
            string menuString = _file.TryReadFile(path);

            if (menuString != null)
            {
                menu = Newtonsoft.Json.JsonConvert.DeserializeObject <IEnumerable <Domain.MenuItem> >(menuString);
            }
            return(menu);
        }
コード例 #2
0
ファイル: MenuFactory.cs プロジェクト: Linksonder/Webdictaat
        public Menu GetMenu(string dictaatName)
        {
            var    path       = _pathHelper.MenuConfigPath(dictaatName);
            Menu   menu       = null;
            string menuString = _file.TryReadFile(path);

            if (menuString != null)
            {
                menu = Newtonsoft.Json.JsonConvert.DeserializeObject <Menu>(menuString);
            }
            return(menu);
        }
コード例 #3
0
        public ViewModels.DictaatPage GetDictaatPage(string dictaatName, string fileName)
        {
            string path    = _pathHelper.PagePath(dictaatName, fileName);
            string content = _file.TryReadFile(path);

            if (content == null)
            {
                //wellicht in de toekomst 404 terug sturen? File not found?
                throw new System.IO.FileNotFoundException();
            }

            return(new ViewModels.DictaatPage()
            {
                Name = fileName,
                Source = content
            });
        }
コード例 #4
0
        public String GetDictaatStyling(string dictaatName, string fileName = null)
        {
            string path = _pathHelper.StylePath(dictaatName, fileName);

            if (!_file.Exists(path))
            {
                _file.TryCreateFile(path);
            }

            string content = _file.TryReadFile(path);

            if (content == null)
            {
                //wellicht in de toekomst 404 terug sturen? File not found?
                throw new System.IO.FileNotFoundException();
            }

            return(content);
        }