mirror of
https://github.com/hmaxnl/SharpRSS.git
synced 2024-09-20 01:54:20 +02:00
43 lines
1.4 KiB
C#
43 lines
1.4 KiB
C#
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<GuideItemModel>? Feeds { get; set; }
|
|
// Feed
|
|
public Feed? Feed { get; set; }
|
|
}
|
|
} |