nntppost.cs

来自「本系统是在asp版《在线文件管理器》的基础上设计制作」· CS 代码 · 共 122 行

CS
122
字号
//------------------------------------------------------------------------------
// <copyright company="Telligent Systems">
//     Copyright (c) Telligent Systems Corporation.  All rights reserved.
// </copyright> 
//------------------------------------------------------------------------------

using System;
using System.Collections;

namespace AspNetForums.Components {

    // *******************************************************
    // NntpPost
    /// <summary>
    /// Class used to model an NNTP message
    /// </summary>
    // *******************************************************
    public class NntpPost {

        Hashtable  headers;
        string     body;
        string     articleID;

        public NntpPost() {
            this.headers = new Hashtable();
        }

        public NntpPost(String articleID, Hashtable headers, string body) {

            this.articleID = articleID;
            this.headers = headers;
            this.body = body;

        }

        public Hashtable Headers {
            get {
                return headers;
            }
        }

        public String Body {
            get {
                return body; 
            }
            set {
                body = value;
            }
        }

        public String ArticleID {
            get {
                return articleID; 
            }
            set {
                articleID = value;
            }
        }

        public string[] ReferenceIDs {
            get {
                if ( headers["references"] != null)
                    return ((string) headers["references"]).Split(',');

                return new string[0];
            }
            set {
                headers["references"] = value;
            }
        }

        public String NntpUniqueID {
            get {
                return ((String)headers["message-id"]).Trim(); 
            }
            set {
                headers["message-id"] = value;
            }
        }

        public int PostID {
            get {
                return Int32.Parse(ArticleID.Substring(0, ArticleID.IndexOf(" "))); 
            }
        }

        public String PostDate {
            get {
                string messageDateUnformatted = ((String) Headers["date"]).Trim();
                int length = messageDateUnformatted.Length;

                // Parse the Message Date
                //
                string offSet = messageDateUnformatted.Substring((length - 5), 5);


                return messageDateUnformatted.Substring(0, (length - 5));
            }

        }

        public String From {
            get {
                return ((String) headers["from"]).Trim(); 
            }
            set {
                headers["from"] = value;
            }
        }


        public String Subject {
            get {
                return ((String) headers["subject"]).Trim(); 
            }
            set {
                headers["subject"] = value;
            }
        }
    }
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?