Beispiel #1
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;
            }
        }
Beispiel #2
0
        public void Initialize(BlogConfigurationService blogConfigurationService)
        {
            if (!_hasInitialized)
            {
                var cfgDic = blogConfigurationService.GetAllConfigurations();

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

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

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

                _hasInitialized = true;
            }
        }