📄 post.cs
字号:
}
/// <summary>
/// Defines the parent of the current post
/// </summary>
public abstract Section Section
{
get;
set;
}
// *********************************************************************
//
// ForumID
//
/// <summary>
/// Specifies the ID of the Forumt the post belongs to.
/// </summary>
//
// ********************************************************************/
public int SectionID {
get { return forumID; }
set {
if (value < 0)
forumID = 0;
else
forumID = value;
}
}
// *********************************************************************
//
// PostLevel
//
/// <summary>
/// Specifies the level of the post.
/// </summary>
/// <remarks>
/// Each reply-level has an incrementing PostLevel. That is, the first message in
/// a thread has a PostLevel of 0, while any replies to the first message in a thread have a
/// PostLevel of 1, and any replies to any posts with a PostLevel of 1, have a PostLevel of 2,
/// and so on...
/// </remarks>
//
// ********************************************************************/
public int PostLevel {
get { return postLevel; }
set {
if (value < 0)
postLevel = 0;
else
postLevel = value;
}
}
// *********************************************************************
//
// SortOrder
//
/// <summary>
/// Specifies the SortOrder of the posts.
/// </summary>
/// <remarks>
/// The property is used to sort the posts in descending order, starting with the
/// most recent post.
/// </remarks>
//
// ********************************************************************/
public int SortOrder {
get { return sortOrder; }
set {
if (value < 0)
sortOrder = 0;
else
sortOrder = value;
}
}
// *********************************************************************
//
// Replies
//
/// <summary>
/// Specifies how many replies have been made to this post.
/// </summary>
/// <remarks>
/// This property is only populated when viewing all of the posts for a particular
/// forum, and only contains a valid value when the user is viewing the forum posts in Flat or Mixed
/// mode.
/// </remarks>
//
// ********************************************************************/
public int Replies {
get { return replies; }
set {
if (value < 0)
replies = 0;
else
replies = value;
}
}
// *********************************************************************
//
// Username
//
/// <summary>
/// Returns the Username of the user who made the post.
/// </summary>
//
// ********************************************************************/
public String Username {
get { return username; }
set { username = value; }
}
// *********************************************************************
//
// Subject
//
/// <summary>
/// Returns the subject of the post.
/// </summary>
//
// ********************************************************************/
public String Subject {
get {
return subject;
}
set {
subject = value;
}
}
// *********************************************************************
//
// Body
//
/// <summary>
/// Returns the body of the post.
/// </summary>
/// <remarks>
/// The body of the post is stored in a raw format in the database.
/// </remarks>
//
// ********************************************************************/
public String Body {
get {
return body;
}
set {
body = value;
}
}
public string EditNotes {
get {
return editNotes;
}
set {
editNotes = value;
}
}
// *********************************************************************
//
// FormattedBody
//
/// <summary>
/// Returns a pre-formatted version of the body of the post.
/// </summary>
/// <remarks>
/// The FormattedBody of the post is stored in a pre-formatted HTML.
/// </remarks>
//
// ********************************************************************/
public String FormattedBody {
get {
return formattedBody;
}
set {
formattedBody = value;
}
}
// *********************************************************************
//
// PostDate
//
/// <summary>
/// Specifies the date/time the post was made, relative to the database's timezone.
/// </summary>
//
// ********************************************************************/
public DateTime PostDate
{
get {
return postDate;
}
set {
postDate = value;
}
}
// *********************************************************************
//
// ThreadDate
//
/// <summary>
/// Specifies the date/time of the most recent post in the thread, relative to the database's
/// time zone.
/// </summary>
//
// ********************************************************************/
public DateTime ThreadDate {
get {
return threadDate;
}
set {
threadDate = value;
}
}
// *********************************************************************
//
// IsApproved
//
/// <summary>
/// Indicates if the post has been approved or not. Non-approved posts are posts that are
/// still awaiting moderation.
/// </summary>
//
// ********************************************************************/
public bool IsApproved {
get {
return approved;
}
set {
approved = value;
}
}
/// <summary>
/// Acts as a bag for different post attributes values.
/// This should not be used directly. It's scope is to be used by
/// other properties as mask to determine if their values are set.
/// </summary>
public int PostConfiguration {
get { return postConfiguration; }
set { postConfiguration = value; }
}
/// <summary>
/// Specifies if this post should be seen as anonymous by
/// the user who posted it.
/// </summary>
public bool IsAnonymousPost {
get {
// We have to use integral types
return IsPostConfigurationValueSet( (int) CSC.PostConfiguration.IsAnonymousPost );
}
set {
if (value == true)
SetPostConfigurationValueValue( (int) CSC.PostConfiguration.IsAnonymousPost, false );
else {
SetPostConfigurationValueValue( (int) CSC.PostConfiguration.IsAnonymousPost, true );
}
}
}
#region Helpers
/// <summary>
/// Set or erase provided <see cref="PostConfiguration"/> value from PostSetting mask.
/// </summary>
private void SetPostConfigurationValueValue (int theValue, bool erase) {
if (erase) {
if (IsPostConfigurationValueSet( theValue ))
this.postConfiguration ^= theValue; // erase the value through XOR
}
else {
this.postConfiguration |= theValue; // set the value
}
}
/// <summary>
/// Check if provided value is set in the mask.
/// </summary>
private bool IsPostConfigurationValueSet (int theValue) {
return ( (this.postConfiguration & theValue) == theValue ) ? true : false;
}
#endregion
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -