SharpRSS/SharpRss/Models/SyndicationModel.cs
2023-06-17 14:04:26 +02:00

48 lines
1.7 KiB
C#

using System;
using ToolQit;
using ToolQit.Extensions;
namespace SharpRss.Models
{
public class SyndicationModel
{
public CategoryModel? Category { get; set; }
// DB props
public string EncodedUrl { get; set; } = string.Empty;
public string? Title { get; set; } = string.Empty;
public string? CategoryId { get; set; } = string.Empty;
public string? SyndicationType { get; set; } = string.Empty;
public string? Version { get; set; } = string.Empty;
public string? Description { get; set; } = string.Empty;
public string? Language { get; set; } = string.Empty;
public string? Copyright { get; set; } = string.Empty;
public DateTimeOffset LastUpdated { get; set; } = DateTimeOffset.Now;
public DateTimeOffset? PublicationDate { get; set; }
public DateTimeOffset? SynUpdatedDate { get; set; }
public string[]? Categories { get; set; }
public int ItemCount { get; set; }
private string _imageUrl = string.Empty;
public string ImageUrl
{
get
{
if (_imageUrl.IsNullEmptyWhiteSpace())
_imageUrl = string.Format(Caretaker.Settings["Paths"].GetString("FaviconResolveUrl"), new Uri(SyndicationManager.DecodeUrlFromBase64(EncodedUrl)).Host);
return _imageUrl;
}
set
{
if (!value.IsNullEmptyWhiteSpace())
_imageUrl = value;
}
}
public override bool Equals(object obj)
{
if (obj is SyndicationModel objModel)
return EncodedUrl.Equals(objModel.EncodedUrl);
return false;
}
}
}