/*
* FeedExpress
* (C) Copyright 2003 Jeppe Cramon
*
* This software is provided "as is" without warranty of any kind,
* either expressed or implied. The entire risk as to the
* quality and performance of the software is with you. Should the
* software prove defective, you assume the cost of all necessary
* servicing, repair, or correction. In no event shall the author,
* copyright holder, or any other party who may redistribute the
* software be liable to you for damages, including any general,
* special, incidental, or consequential damages arising out of
* the use or inability to use the software (including, but not
* limited to, loss of data, data being rendered inaccurate, loss of
* business profits, loss of business information, business
* interruptions, loss sustained by you or third parties, or a
* failure of the software to operate with any other software) even
* if the author, copyright holder, or other party has been advised
* of the possibility of such damages.
*/
namespace FeedExpress {
[Serializable]
public class FeedEntry : ICacheable {
private string mTitle;
private string mLink;
private string mDescription;
private string mSubject;
private DateTime mPublicationDate;
private RssGuid mRssGuid;
private string mCreator;
private bool mIsRead;
[NonSerialized] Subscription mSubscription;
public FeedEntry() {
...
}
public FeedEntry(Subscription subscription) : this() {
mSubscription = subscription;
}
public Subscription subscription {
get { return mSubscription; }
set { mSubscription = value; }
}
/// <summary>
/// Application specific meta data. Not part of Equals or GetHashCode
/// </summary>
public bool isRead {
get { return mIsRead; }
set { mIsRead = value; }
}
public string title {
get { return mTitle; }
set { mTitle = value; }
}
public string link {
get { return mLink; }
set { mLink = value; }
}
public string description {
get { return mDescription; }
set { mDescription = value; }
}
public string subject {
get { return mSubject; }
set { mSubject = value; }
}
public string creator {
get { return mCreator; }
set { mCreator = value; }
}
public DateTime publicationDate {
get { return mPublicationDate; }
set { mPublicationDate = value; }
}
public RssGuid rssGuid {
get { return mRssGuid; }
set { mRssGuid = value; }
}
public string cacheKey {
get { return mLink; }
}
public override string ToString() {
...
}
public override bool Equals(object obj) {
...
}
public override int GetHashCode() {
...
}
/// <summary>
/// Represents an RSS Guid
/// </summary>
[Serializable]
public class RssGuid {
private bool mIsPermaLink;
private string mGuid;
public RssGuid() {
}
public RssGuid(string guid, bool isPermaLink) {
mGuid = guid;
mIsPermaLink = isPermaLink;
}
public bool isPermaLink {
get { return mIsPermaLink; }
set { mIsPermaLink = value; }
}
public string guid {
get { return mGuid; }
set { mGuid = value; }
}
public override string ToString() {
return "Guid (isPermaLink="+isPermaLink+"): " + guid;
}
public override bool Equals(object obj) {
if (obj is RssGuid) {
RssGuid other = (RssGuid)obj;
if (other.guid == this.guid &&
other.isPermaLink == this.isPermaLink) {
return true;
}
}
return false;
}
public override int GetHashCode() {
int result = 17;
result = 37*result + guid.GetHashCode();
if (isPermaLink) {
result = 37*result + 1;
}
return result;
}
}
}
}
Close Window