public BlogSettingsViewModel() { BookmarkTitle = "Blog Settings"; Settings = Context.BlogSettings.FirstOrDefault(); // Set some initial values if none are found. if (Settings == null) { SettingsUtils.SetDefaultBlogSettings(); Settings = Context.BlogSettings.FirstOrDefault(); } }
public JsonResult SaveBlogSettings(BlogSettings entity) { var result = new JsonResult() { Data = new { success = false, message = "There was an error processing your request." } }; var success = 0; var blogSettings = Context.BlogSettings.FirstOrDefault(); if (blogSettings != null) { blogSettings.BlogTitle = entity.BlogTitle; blogSettings.DisableAllCommentsGlobal = entity.DisableAllCommentsGlobal; blogSettings.DisqusShortName = entity.DisqusShortName; blogSettings.FacebookAppId = entity.FacebookAppId; blogSettings.MaxBlogsOnHomepageBeforeLoad = entity.MaxBlogsOnHomepageBeforeLoad; blogSettings.MaxArchives = entity.MaxArchives; blogSettings.ShowDisqusComents = entity.ShowDisqusComents; blogSettings.ShowFacebookComments = entity.ShowFacebookComments; blogSettings.ShowFacebookLikeButton = entity.ShowFacebookLikeButton; success = Context.SaveChanges(); } if (success > 0) { result.Data = new { success = true, message = "Settings saved successfully." }; } return result; }
public static BlogSettings ToEntity(this BlogSettingsModel model, BlogSettings destination) { return(Mapper.Map(model, destination)); }
public BlogPostListViewModel(BlogPostList blogPostList, BlogSettings blogSettings, HttpRequest request, Tag tag) : this(blogPostList, blogSettings, request) { TagTitle = tag.Title; Description = tag.Description; }
public BlogMonthsViewComponent(IBlogModelFactory blogModelFactory, BlogSettings blogSettings) { this._blogModelFactory = blogModelFactory; this._blogSettings = blogSettings; }
public static BlogSettingsModel ToModel(this BlogSettings entity) { return(entity.MapTo <BlogSettings, BlogSettingsModel>()); }
public GetBlogPostTagListHandler(IBlogService blogService, ICacheBase cacheBase, IWorkContext workContext, BlogSettings blogSettings) { _blogService = blogService; _cacheBase = cacheBase; _workContext = workContext; _blogSettings = blogSettings; }
public BlogCategoriesViewComponent(IMediator mediator, BlogSettings blogSettings) { _mediator = mediator; _blogSettings = blogSettings; }
public CommonModelFactory(ICategoryService categoryService, IProductService productService, IManufacturerService manufacturerService, ITopicService topicService, ILanguageService languageService, ICurrencyService currencyService, ILocalizationService localizationService, IWorkContext workContext, IStoreContext storeContext, ISitemapGenerator sitemapGenerator, IThemeContext themeContext, IThemeProvider themeProvider, IForumService forumService, IGenericAttributeService genericAttributeService, IWebHelper webHelper, IPermissionService permissionService, ICacheManager cacheManager, IPageHeadBuilder pageHeadBuilder, IPictureService pictureService, HttpContextBase httpContext, CatalogSettings catalogSettings, StoreInformationSettings storeInformationSettings, CommonSettings commonSettings, BlogSettings blogSettings, NewsSettings newsSettings, ForumSettings forumSettings, LocalizationSettings localizationSettings, CaptchaSettings captchaSettings, VendorSettings vendorSettings) { this._categoryService = categoryService; this._productService = productService; this._manufacturerService = manufacturerService; this._topicService = topicService; this._languageService = languageService; this._currencyService = currencyService; this._localizationService = localizationService; this._workContext = workContext; this._storeContext = storeContext; this._sitemapGenerator = sitemapGenerator; this._themeContext = themeContext; this._themeProvider = themeProvider; this._forumservice = forumService; this._genericAttributeService = genericAttributeService; this._webHelper = webHelper; this._permissionService = permissionService; this._cacheManager = cacheManager; this._pageHeadBuilder = pageHeadBuilder; this._pictureService = pictureService; this._httpContext = httpContext; this._catalogSettings = catalogSettings; this._storeInformationSettings = storeInformationSettings; this._commonSettings = commonSettings; this._blogSettings = blogSettings; this._newsSettings = newsSettings; this._forumSettings = forumSettings; this._localizationSettings = localizationSettings; this._captchaSettings = captchaSettings; this._vendorSettings = vendorSettings; }
public ActionResult BlogListing() { var model = new BlogListingModel(); model.Initialize(RenderingContext.Current.Rendering); model.dataSourceItem = Context.Database.GetItem(RenderingContext.Current.Rendering.DataSource); BlogSettings settingsItem = DataManager.GetBlogSettingsItem(model.dataSourceItem != null ? model.dataSourceItem : Context.Item); string categoryID = string.Empty; string authorID = string.Empty; string tagID = string.Empty; string searchText = string.Empty; string urlCategoryName = DataManager.GetUrlValByPattern(Request.Url.PathAndQuery, XBSettings.XBCategoryUrlPattern); if (!String.IsNullOrEmpty(urlCategoryName)) { Category categoryItem = CategoryManager.GetCategoryByName(Context.Item, urlCategoryName); if (categoryItem != null) { categoryID = categoryItem.InnerItem.ID.ToString(); if (settingsItem.DisplayFilterMessage) { model.SearchHeading = settingsItem.CategoryFilterTitle + categoryItem.CategoryName; } } } string urlAuthorName = DataManager.GetUrlValByPattern(Request.Url.PathAndQuery, XBSettings.XBAuthorUrlPattern); if (!String.IsNullOrEmpty(urlAuthorName)) { Author authorItem = AuthorManager.GetAuthorByName(Context.Item, urlAuthorName); if (authorItem != null) { authorID = authorItem.InnerItem.ID.ToString(); if (settingsItem.DisplayFilterMessage) { model.SearchHeading = settingsItem.AuthorFilterTitle + authorItem.FullName; } } } string urlTagName = DataManager.GetUrlValByPattern(Request.Url.PathAndQuery, XBSettings.XBTagsUrlPattern); if (!String.IsNullOrEmpty(urlTagName)) { Tag tagItem = TagManager.GetTagByName(Context.Item, urlTagName); if (tagItem != null) { tagID = tagItem.InnerItem.ID.ToString(); if (settingsItem.DisplayFilterMessage) { model.SearchHeading = settingsItem.TagFilterTitle + tagItem.TagName; } } } string urlSearchName = DataManager.GetUrlValByPattern(Request.Url.PathAndQuery, XBSettings.XBSearchURLPattern); if (!String.IsNullOrEmpty(urlSearchName)) { searchText = urlSearchName; if (settingsItem.DisplayFilterMessage) { model.SearchHeading = settingsItem.SearchFilterTitle + searchText; } } //Get search results int currentPage = 1; int maximumRows = 5; int startRowIndex = 1; bool rowResult = Int32.TryParse(settingsItem.PageSize, out maximumRows); model.MaximumRows = maximumRows; if (!rowResult) { model.MaximumRows = 5; } if (!String.IsNullOrEmpty(Request.QueryString[XBSettings.XBPageQS])) { model.PageResult = Int32.TryParse(Request.QueryString[XBSettings.XBPageQS], out currentPage); } if (!model.PageResult) { currentPage = 1; } startRowIndex = (currentPage - 1) * maximumRows; model.CurrentPage = currentPage; model.BlogPosts = BlogManager.GetBlogPosts(Sitecore.Context.Item, categoryID, authorID, tagID, searchText, startRowIndex, maximumRows); model.TotalRows = BlogManager.GetBlogsCount(Sitecore.Context.Item, categoryID, authorID, tagID, searchText); if (!string.IsNullOrEmpty(model.SearchHeading)) { model.SearchHeading = model.TotalRows.ToString() + " " + model.SearchHeading; } return(View("~/Areas/XBlog/Views/XBlog/BlogListing.cshtml", model)); }
public BlogTagsViewComponent(BlogSettings blogSettings, IBlogModelFactory blogModelFactory, ICustomerBlogFactory customerBlogFactory) { this._blogSettings = blogSettings; _customerBlogFactory = customerBlogFactory; }
public InsertBlogCommentCommandHandler(IBlogService blogService, IWorkContext workContext, IStoreContext storeContext, ICustomerService customerService, ICustomerActivityService customerActivityService, IWorkflowMessageService workflowMessageService, ILocalizationService localizationService, LocalizationSettings localizationSettings, BlogSettings blogSettings) { _blogService = blogService; _workContext = workContext; _storeContext = storeContext; _customerService = customerService; _customerActivityService = customerActivityService; _workflowMessageService = workflowMessageService; _localizationService = localizationService; _localizationSettings = localizationSettings; _blogSettings = blogSettings; }
public HomePageBlogViewComponent(IBlogViewModelService blogViewModelService, BlogSettings blogSettings) { _blogViewModelService = blogViewModelService; _blogSettings = blogSettings; }
public static BlogSettings ToEntity(this BlogSettingsModel model, BlogSettings entity) { MapperFactory.Map(model, entity); return(entity); }
public HomePageBlogViewComponent(IBlogWebService blogWebService, BlogSettings blogSettings) { this._blogWebService = blogWebService; this._blogSettings = blogSettings; }
public CustomerBlogFactory(IBlogService blogService, ICustomerService customerService, UserManager <ApplicationUser> userManager, IUrlRecordService urlRecordService, BlogSettings blogSettings, IStoreContext storeContext, IPictureService pictureService, INewsCounterService newsCounterService) { _blogservice = blogService; _customerService = customerService; _userManager = userManager; _urlRecordService = urlRecordService; this._blogSettings = blogSettings; _storeContext = storeContext; _pictureService = pictureService; _newsCounterService = newsCounterService; }
public FakeComponent(EmailSettings emailSettings, AkismetSettings akismetSettings, BlogSettings blogSettings) { EmailSettings = emailSettings; AkismetSettings = akismetSettings; BlogSettings = blogSettings; }
public ImagesController(IBlogStore blogStore, IOptions <BlogSettings> blogSettings) : base(blogStore) { this.blogSettings = blogSettings.Value; }
public HomePageBlogViewComponent(IMediator mediator, BlogSettings blogSettings) { _mediator = mediator; _blogSettings = blogSettings; }
public CommonModelFactory(BlogSettings blogSettings, CaptchaSettings captchaSettings, CatalogSettings catalogSettings, CommonSettings commonSettings, CustomerSettings customerSettings, DisplayDefaultFooterItemSettings displayDefaultFooterItemSettings, ForumSettings forumSettings, IActionContextAccessor actionContextAccessor, ICompareProductsService compareProductsService, ICategoryService categoryService, ICurrencyService currencyService, ICustomerService customerService, IForumService forumService, IGenericAttributeService genericAttributeService, IHostingEnvironment hostingEnvironment, ILanguageService languageService, ILocalizationService localizationService, IManufacturerService manufacturerService, INopFileProvider fileProvider, IPageHeadBuilder pageHeadBuilder, IPermissionService permissionService, IPictureService pictureService, IProductService productService, IProductTagService productTagService, ISitemapGenerator sitemapGenerator, IStaticCacheManager cacheManager, IStoreContext storeContext, IThemeContext themeContext, IThemeProvider themeProvider, ITopicService topicService, IUrlHelperFactory urlHelperFactory, IUrlRecordService urlRecordService, IWebHelper webHelper, IWorkContext workContext, LocalizationSettings localizationSettings, NewsSettings newsSettings, StoreInformationSettings storeInformationSettings, VendorSettings vendorSettings) { this._blogSettings = blogSettings; this._captchaSettings = captchaSettings; this._compareProductsService = compareProductsService; this._catalogSettings = catalogSettings; this._commonSettings = commonSettings; this._customerSettings = customerSettings; this._displayDefaultFooterItemSettings = displayDefaultFooterItemSettings; this._forumSettings = forumSettings; this._actionContextAccessor = actionContextAccessor; this._categoryService = categoryService; this._currencyService = currencyService; this._customerService = customerService; this._forumService = forumService; this._genericAttributeService = genericAttributeService; this._hostingEnvironment = hostingEnvironment; this._languageService = languageService; this._localizationService = localizationService; this._manufacturerService = manufacturerService; this._fileProvider = fileProvider; this._pageHeadBuilder = pageHeadBuilder; this._permissionService = permissionService; this._pictureService = pictureService; this._productService = productService; this._productTagService = productTagService; this._sitemapGenerator = sitemapGenerator; this._cacheManager = cacheManager; this._storeContext = storeContext; this._themeContext = themeContext; this._themeProvider = themeProvider; this._topicService = topicService; this._urlHelperFactory = urlHelperFactory; this._urlRecordService = urlRecordService; this._webHelper = webHelper; this._workContext = workContext; this._localizationSettings = localizationSettings; this._newsSettings = newsSettings; this._storeInformationSettings = storeInformationSettings; this._vendorSettings = vendorSettings; }
void IBlogCategorySettings.UpdateCategories(BlogPostCategory[] categories) { using (BlogSettings blogSettings = BlogSettings.ForBlogId(_targetBlog.Id)) blogSettings.Categories = categories; }
public CommonController( ICommonServices services, ITopicService topicService, Lazy <ILanguageService> languageService, Lazy <ICurrencyService> currencyService, IThemeContext themeContext, Lazy <IThemeRegistry> themeRegistry, Lazy <IForumService> forumService, Lazy <IGenericAttributeService> genericAttributeService, Lazy <IMobileDeviceHelper> mobileDeviceHelper, Lazy <ICompareProductsService> compareProductsService, Lazy <IUrlRecordService> urlRecordService, StoreInformationSettings storeInfoSettings, CustomerSettings customerSettings, PrivacySettings privacySettings, TaxSettings taxSettings, CatalogSettings catalogSettings, ShoppingCartSettings shoppingCartSettings, EmailAccountSettings emailAccountSettings, CommonSettings commonSettings, NewsSettings newsSettings, BlogSettings blogSettings, ForumSettings forumSettings, LocalizationSettings localizationSettings, Lazy <SecuritySettings> securitySettings, Lazy <SocialSettings> socialSettings, Lazy <MediaSettings> mediaSettings, IOrderTotalCalculationService orderTotalCalculationService, IPriceFormatter priceFormatter, ThemeSettings themeSettings, IPageAssetsBuilder pageAssetsBuilder, Lazy <IPictureService> pictureService, Lazy <IManufacturerService> manufacturerService, Lazy <IProductService> productService, Lazy <IShoppingCartService> shoppingCartService, IBreadcrumb breadcrumb) { _services = services; _topicService = topicService; _languageService = languageService; _currencyService = currencyService; _themeContext = themeContext; _themeRegistry = themeRegistry; _forumservice = forumService; _genericAttributeService = genericAttributeService; _compareProductsService = compareProductsService; _urlRecordService = urlRecordService; _storeInfoSettings = storeInfoSettings; _customerSettings = customerSettings; _privacySettings = privacySettings; _taxSettings = taxSettings; _catalogSettings = catalogSettings; _shoppingCartSettings = shoppingCartSettings; _commonSettings = commonSettings; _newsSettings = newsSettings; _blogSettings = blogSettings; _forumSettings = forumSettings; _localizationSettings = localizationSettings; _securitySettings = securitySettings; _socialSettings = socialSettings; _mediaSettings = mediaSettings; _orderTotalCalculationService = orderTotalCalculationService; _priceFormatter = priceFormatter; _themeSettings = themeSettings; _pageAssetsBuilder = pageAssetsBuilder; _pictureService = pictureService; _manufacturerService = manufacturerService; _productService = productService; _shoppingCartService = shoppingCartService; _breadcrumb = breadcrumb; }
public SiteController(IBlogService blogService, IConfiguration configuration, BlogSettings blogSettings) { BlogService = blogService; Configuration = configuration; BlogSettings = blogSettings; BaseAddress = Configuration.GetBaseAddress().TrimEnd('/'); }
public BlogTagsViewComponent(IBlogViewModelService blogViewModelService, BlogSettings blogSettings) { this._blogViewModelService = blogViewModelService; this._blogSettings = blogSettings; }
public static BlogSettings ToEntity(this BlogSettingsModel model, BlogSettings destination) { return(model.MapTo(destination)); }
public BlogTagsViewComponent(BlogSettings blogSettings, IBlogModelFactory blogModelFactory) { _blogSettings = blogSettings; _blogModelFactory = blogModelFactory; }
public BlogPostListViewModel(BlogPostList blogPostList, BlogSettings blogSettings, HttpRequest request, Category cat) : this(blogPostList, blogSettings, request) { CategoryTitle = cat.Title; Description = cat.Description; }
public static IList <BlogPost> GetBlogRelatedValues(BlogPost currentItem) { Dictionary <string, int> blogItems = new Dictionary <string, int>(); IList <BlogPost> blogList = new List <BlogPost>(); try { Item repositorySearchItem = XBlogHelper.General.DataManager.GetBlogHomeItem(currentItem.InnerItem); BlogSettings settingsItem = XBlogHelper.General.DataManager.GetBlogSettingsItem(currentItem.InnerItem); ISearchIndex index = ContentSearchManager.GetIndex(new SitecoreIndexableItem(repositorySearchItem)); using (IProviderSearchContext context = index.CreateSearchContext()) { // look at the pipe seperated list. break them out and loop through. Build dictionary based on Ids // create as blog post item // could even pass a max item as a dictionary definition Expression <Func <SearchResultItem, bool> > predicate = PredicateBuilder.True <SearchResultItem>(); predicate = predicate.And(item => item.TemplateName == BlogPost.BlogPostTemplate && item.Paths.Contains(repositorySearchItem.ID)); IEnumerable <BlogPost> resultList = context.GetQueryable <SearchResultItem>().Where(predicate).OrderBy(t => t.Name).CreateAs <BlogPost>(); foreach (BlogPost item in resultList) { if (item.ItemId != currentItem.ItemId) { string itemID = item.ItemId.ToString(); blogItems.Add(itemID, 0); foreach (Author author in item.Authors) { foreach (Author currentAuthor in currentItem.Authors) { if (currentAuthor.ItemId == author.ItemId) { blogItems[itemID] = blogItems[itemID] + XBSettings.RelatedAuthorValue; } } } foreach (Category category in item.Categories) { foreach (Category currenCategory in currentItem.Categories) { if (currenCategory.ItemId == category.ItemId) { blogItems[itemID] = blogItems[itemID] + XBSettings.RelatedCategoryValue; } } } foreach (Tag tag in item.Tags) { foreach (Tag currentTag in currentItem.Tags) { if (currentTag.ItemId == tag.ItemId) { blogItems[itemID] = blogItems[itemID] + XBSettings.RelatedTagValue; } } } } } } // order the count descending then build list based on this order. var items = from pair in blogItems orderby pair.Value descending select pair; Sitecore.Data.Database current = Sitecore.Context.Database; foreach (KeyValuePair <string, int> pair in items) { if (Sitecore.Data.ID.IsID(pair.Key)) { BlogPost thisItem = current.GetItem(Sitecore.Data.ID.Parse(pair.Key)).CreateAs <BlogPost>(); if (!blogList.Contains(thisItem)) { blogList.Add(thisItem); } } } } catch (Exception ex) { Log.Error("XBlog GetAuthorCount error", ex, new object()); } return(blogList); }
public static BlogSettingsModel ToModel(this BlogSettings entity) { return(Mapper.Map <BlogSettings, BlogSettingsModel>(entity)); }
public CommonModelFactory(BlogSettings blogSettings, CaptchaSettings captchaSettings, CatalogSettings catalogSettings, CommonSettings commonSettings, CustomerSettings customerSettings, DisplayDefaultFooterItemSettings displayDefaultFooterItemSettings, ForumSettings forumSettings, IActionContextAccessor actionContextAccessor, IBlogService blogService, ICategoryService categoryService, ICurrencyService currencyService, ICustomerService customerService, IForumService forumService, IGenericAttributeService genericAttributeService, IHttpContextAccessor httpContextAccessor, ILanguageService languageService, ILocalizationService localizationService, IManufacturerService manufacturerService, INewsService newsService, IQNetFileProvider fileProvider, IPageHeadBuilder pageHeadBuilder, IPermissionService permissionService, IPictureService pictureService, IProductService productService, IProductTagService productTagService, IShoppingCartService shoppingCartService, ISitemapGenerator sitemapGenerator, IStaticCacheManager cacheManager, IStoreContext storeContext, IThemeContext themeContext, IThemeProvider themeProvider, ITopicService topicService, IUrlHelperFactory urlHelperFactory, IUrlRecordService urlRecordService, IWebHelper webHelper, IWorkContext workContext, LocalizationSettings localizationSettings, MediaSettings mediaSettings, NewsSettings newsSettings, SitemapSettings sitemapSettings, SitemapXmlSettings sitemapXmlSettings, StoreInformationSettings storeInformationSettings, VendorSettings vendorSettings) { _blogSettings = blogSettings; _captchaSettings = captchaSettings; _catalogSettings = catalogSettings; _commonSettings = commonSettings; _customerSettings = customerSettings; _displayDefaultFooterItemSettings = displayDefaultFooterItemSettings; _forumSettings = forumSettings; _actionContextAccessor = actionContextAccessor; _blogService = blogService; _categoryService = categoryService; _currencyService = currencyService; _customerService = customerService; _forumService = forumService; _genericAttributeService = genericAttributeService; _httpContextAccessor = httpContextAccessor; _languageService = languageService; _localizationService = localizationService; _manufacturerService = manufacturerService; _newsService = newsService; _fileProvider = fileProvider; _pageHeadBuilder = pageHeadBuilder; _permissionService = permissionService; _pictureService = pictureService; _productService = productService; _productTagService = productTagService; _shoppingCartService = shoppingCartService; _sitemapGenerator = sitemapGenerator; _cacheManager = cacheManager; _storeContext = storeContext; _themeContext = themeContext; _themeProvider = themeProvider; _topicService = topicService; _urlHelperFactory = urlHelperFactory; _urlRecordService = urlRecordService; _webHelper = webHelper; _workContext = workContext; _mediaSettings = mediaSettings; _localizationSettings = localizationSettings; _newsSettings = newsSettings; _sitemapSettings = sitemapSettings; _sitemapXmlSettings = sitemapXmlSettings; _storeInformationSettings = storeInformationSettings; _vendorSettings = vendorSettings; }
public BlogRssHeaderLinkViewComponent(BlogSettings blogSettings) { this._blogSettings = blogSettings; }
public BlogMonthsViewComponent(BlogSettings blogSettings, IBlogModelFactory blogModelFactory) { this._blogSettings = blogSettings; this._blogModelFactory = blogModelFactory; }
public CommonController(ICategoryService categoryService, IProductService productService, IManufacturerService manufacturerService, ITopicService topicService, ILanguageService languageService, ICurrencyService currencyService, ILocalizationService localizationService, IWorkContext workContext, IStoreContext storeContext, IQueuedEmailService queuedEmailService, IEmailAccountService emailAccountService, ISitemapGenerator sitemapGenerator, IThemeContext themeContext, IThemeProvider themeProvider, IForumService forumService, IGenericAttributeService genericAttributeService, IWebHelper webHelper, IPermissionService permissionService, ICacheManager cacheManager, ICustomerActivityService customerActivityService, IVendorService vendorService, CustomerSettings customerSettings, TaxSettings taxSettings, CatalogSettings catalogSettings, StoreInformationSettings storeInformationSettings, EmailAccountSettings emailAccountSettings, CommonSettings commonSettings, BlogSettings blogSettings, NewsSettings newsSettings, ForumSettings forumSettings, LocalizationSettings localizationSettings, CaptchaSettings captchaSettings, VendorSettings vendorSettings) { this._categoryService = categoryService; this._productService = productService; this._manufacturerService = manufacturerService; this._topicService = topicService; this._languageService = languageService; this._currencyService = currencyService; this._localizationService = localizationService; this._workContext = workContext; this._storeContext = storeContext; this._queuedEmailService = queuedEmailService; this._emailAccountService = emailAccountService; this._sitemapGenerator = sitemapGenerator; this._themeContext = themeContext; this._themeProvider = themeProvider; this._forumservice = forumService; this._genericAttributeService = genericAttributeService; this._webHelper = webHelper; this._permissionService = permissionService; this._cacheManager = cacheManager; this._customerActivityService = customerActivityService; this._vendorService = vendorService; this._customerSettings = customerSettings; this._taxSettings = taxSettings; this._catalogSettings = catalogSettings; this._storeInformationSettings = storeInformationSettings; this._emailAccountSettings = emailAccountSettings; this._commonSettings = commonSettings; this._blogSettings = blogSettings; this._newsSettings = newsSettings; this._forumSettings = forumSettings; this._localizationSettings = localizationSettings; this._captchaSettings = captchaSettings; this._vendorSettings = vendorSettings; }
/// <summary> /// 根据目录字符串获取指定帐户中指定的目录信息 /// </summary> /// <param name="settings">帐户信息</param> /// <param name="categoryStr">目录名称</param> /// <returns>不存在指定名称的目录时返回null</returns> public BlogPostCategory GetAccountCategoryByString(BlogSettings settings, string categoryStr) { foreach (BlogPostCategory item in settings.Categories) { if (item.ToString().Equals(categoryStr)) { return item; } } return null; }