Example #1
0
 public BlogConfig()
 {
     BlogOwnerSettings  = new BlogOwnerSettings();
     ContentSettings    = new ContentSettings();
     GeneralSettings    = new GeneralSettings();
     EmailConfiguration = new EmailConfiguration();
     FeedSettings       = new FeedSettings();
     WatermarkSettings  = new WatermarkSettings();
 }
Example #2
0
 public BlogConfig()
 {
     // Set default values in case of blow up
     DisharmonyWords    = string.Empty;
     MetaKeyword        = string.Empty;
     MetaAuthor         = string.Empty;
     SiteTitle          = string.Empty;
     EnableComments     = true;
     EmailConfiguration = new EmailConfiguration();
     FeedSettings       = new FeedSettings();
     WatermarkSettings  = new WatermarkSettings();
 }
Example #3
0
        public BlogConfig(
            ILogger <BlogConfig> logger,
            IConfiguration configuration)
        {
            _configuration = configuration;
            _logger        = logger;

            BlogOwnerSettings = new BlogOwnerSettings();
            ContentSettings   = new ContentSettings();
            GeneralSettings   = new GeneralSettings();
            EmailSettings     = new EmailSettings();
            FeedSettings      = new FeedSettings();
            WatermarkSettings = new WatermarkSettings();

            Initialize();
        }
Example #4
0
        public BlogConfig(
            ILogger <BlogConfig> logger,
            IConfiguration configuration)
        {
            _configuration = configuration;
            _logger        = logger;

            ContentSettings      = new ContentSettings();
            GeneralSettings      = new GeneralSettings();
            NotificationSettings = new NotificationSettings();
            FeedSettings         = new FeedSettings();
            WatermarkSettings    = new WatermarkSettings();
            FriendLinksSettings  = new FriendLinksSettings();
            AdvancedSettings     = new AdvancedSettings();

            Initialize();
        }
Example #5
0
        private void Initialize()
        {
            if (!_hasInitialized)
            {
                var cfgDic = GetAllConfigurations();

                var jsonOptions = new JsonSerializerOptions {
                    PropertyNameCaseInsensitive = true
                };

                BlogOwnerSettings = JsonSerializer.Deserialize <BlogOwnerSettings>(cfgDic[nameof(BlogOwnerSettings)], jsonOptions);
                GeneralSettings   = JsonSerializer.Deserialize <GeneralSettings>(cfgDic[nameof(GeneralSettings)], jsonOptions);
                ContentSettings   = JsonSerializer.Deserialize <ContentSettings>(cfgDic[nameof(ContentSettings)], jsonOptions);
                EmailSettings     = JsonSerializer.Deserialize <EmailSettings>(cfgDic[nameof(EmailSettings)], jsonOptions);
                FeedSettings      = JsonSerializer.Deserialize <FeedSettings>(cfgDic[nameof(FeedSettings)], jsonOptions);
                WatermarkSettings = JsonSerializer.Deserialize <WatermarkSettings>(cfgDic[nameof(WatermarkSettings)], jsonOptions);

                _hasInitialized = true;
            }
        }
Example #6
0
        private void Initialize()
        {
            if (!_hasInitialized)
            {
                var cfgDic = GetAllConfigurations();

                BlogOwnerSettings = JsonConvert.DeserializeObject <BlogOwnerSettings>(cfgDic[nameof(BlogOwnerSettings)]);
                GeneralSettings   = JsonConvert.DeserializeObject <GeneralSettings>(cfgDic[nameof(GeneralSettings)]);
                ContentSettings   = JsonConvert.DeserializeObject <ContentSettings>(cfgDic[nameof(ContentSettings)]);

                EmailSettings = JsonConvert.DeserializeObject <EmailSettings>(cfgDic[nameof(EmailSettings)]);
                if (!string.IsNullOrWhiteSpace(EmailSettings.SmtpPassword))
                {
                    EmailSettings.SmtpClearPassword = DecryptPassword(EmailSettings.SmtpPassword);
                }

                FeedSettings      = JsonConvert.DeserializeObject <FeedSettings>(cfgDic[nameof(FeedSettings)]);
                WatermarkSettings = JsonConvert.DeserializeObject <WatermarkSettings>(cfgDic[nameof(WatermarkSettings)]);

                _hasInitialized = true;
            }
        }
Example #7
0
        public void GetConfiguration(BlogConfigurationService blogConfigurationService)
        {
            if (!_hasInitialized)
            {
                var cfgDic = blogConfigurationService.GetAllConfigurations();
                DisharmonyWords     = cfgDic[nameof(DisharmonyWords)];
                MetaKeyword         = cfgDic[nameof(MetaKeyword)];
                MetaAuthor          = cfgDic[nameof(MetaAuthor)];
                SiteTitle           = cfgDic[nameof(SiteTitle)];
                BloggerAvatarBase64 = cfgDic[nameof(BloggerAvatarBase64)];
                EnableComments      = bool.Parse(cfgDic[nameof(EnableComments)]);

                EmailConfiguration = JsonConvert.DeserializeObject <EmailConfiguration>(cfgDic[nameof(EmailConfiguration)]);
                EmailConfiguration.SmtpPassword =
                    blogConfigurationService.DecryptPassword(EmailConfiguration.SmtpPassword);

                FeedSettings      = JsonConvert.DeserializeObject <FeedSettings>(cfgDic[nameof(FeedSettings)]);
                WatermarkSettings = JsonConvert.DeserializeObject <WatermarkSettings>(cfgDic[nameof(WatermarkSettings)]);

                _hasInitialized = true;
            }
        }
 public Response SaveWatermarkConfiguration(WatermarkSettings watermarkSettings)
 {
     return(SaveObjectConfiguration(watermarkSettings));
 }