Example #1
0
        public Entities.SiteSettings GetSiteSettings()
        {
            if (_siteSettings == null)
            {
                var    fileSystem   = _serviceProvider.GetService <IFile>();
                String settingsPath = System.IO.Path.Combine(_rootDataPath, _settingsFilename);
                _siteSettings = fileSystem.ReadAllText(settingsPath).ParseSettings();
                if (_siteSettings == null)
                {
                    throw new Exceptions.SettingNotFoundException(typeof(SiteSettings).Name);
                }

                if (string.IsNullOrWhiteSpace(_siteSettings.Title))
                {
                    throw new Exceptions.SettingNotFoundException(nameof(_siteSettings.Title));
                }

                if (_siteSettings.PostsPerPage == 0)
                {
                    _siteSettings.PostsPerPage = _defaultPostsPerPage;
                }

                if (_siteSettings.PostsPerFeed == 0)
                {
                    _siteSettings.PostsPerFeed = _defaultPostsPerFeed;
                }
            }

            return(_siteSettings);
        }
Example #2
0
 private void LoadSiteSettings()
 {
     // TODO: Implement if ever needed. The current data from WP that I have doesn't have any visible way to get this information.
     _siteSettings = new Entities.SiteSettings()
     {
         Title        = "Site Title",
         Description  = "A Description of the Site",
         PostsPerFeed = 10,
         PostsPerPage = 10,
         Theme        = "ThemeName"
     };
 }
Example #3
0
 public void SaveSiteSettings(Entities.SiteSettings settings) => throw new NotImplementedException();