using CodeHollow.FeedReader; using MudBlazor; using SharpRss.Models; using ToolQit; namespace WebSharpRSS.Models { public class GuideItemModel { public GuideItemModel(CategoryModel catModel) { CategoryModel = catModel; Feeds = CategoryModel.Feeds.Where(x => !x.IsFaulted && x.Base != null).Select(x => new GuideItemModel(x)).ToHashSet(); Title = CategoryModel.Name; Icon = Icons.Material.Filled.RssFeed; } public GuideItemModel(FeedModel feedModel) { if (feedModel.IsFaulted) return; FeedModel = feedModel; Feed = FeedModel.Base; Title = Feed.Title; string faviconAdress = Feed.Link.Remove(Feed.Link.IndexOf("http"), Feed.Link.IndexOf("://") + 3); FaviconUrl = string.Format(Caretaker.Settings["Paths"].GetString("FaviconResolveUrl"), faviconAdress); } public readonly CategoryModel? CategoryModel; public readonly FeedModel? FeedModel; public string Title { get; set; } = string.Empty; public bool IsSelected { get; set; } public string? Icon { get; set; } public string? FaviconUrl { get; set; } // Category public bool IsExpanded { get; set; } public HashSet? Feeds { get; set; } // Feed public Feed? Feed { get; set; } } }