PageRenderTime 34ms CodeModel.GetById 29ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 0ms

/BlogEngine/DotNetSlave.BusinessLogic/Ping/TrackbackMessage.cs

#
C# | 96 lines | 41 code | 14 blank | 41 comment | 2 complexity | 5a5a3201fe55658c51c9ca2e2a55ec03 MD5 | raw file
 1namespace BlogEngine.Core.Ping
 2{
 3    using System;
 4    using System.Globalization;
 5
 6    /// <summary>
 7    /// The trackback message.
 8    /// </summary>
 9    public class TrackbackMessage
10    {
11        #region Constructors and Destructors
12
13        /// <summary>
14        /// Initializes a new instance of the <see cref="TrackbackMessage"/> class.
15        /// </summary>
16        /// <param name="item">
17        /// The publishable item.
18        /// </param>
19        /// <param name="urlToNotifyTrackback">
20        /// The URL to notify trackback.
21        /// </param>
22        /// <param name="itemUrl">
23        /// The item Url.
24        /// </param>
25        public TrackbackMessage(IPublishable item, Uri urlToNotifyTrackback, Uri itemUrl)
26        {
27            if (item == null)
28            {
29                throw new ArgumentNullException("item");
30            }
31
32            this.Title = item.Title;
33            this.PostUrl = itemUrl;
34            this.Excerpt = item.Title;
35            this.BlogName = BlogSettings.Instance.Name;
36            this.UrlToNotifyTrackback = urlToNotifyTrackback;
37        }
38
39        #endregion
40
41        #region Properties
42
43        /// <summary>
44        ///     Gets or sets the name of the blog.
45        /// </summary>
46        /// <value>The name of the blog.</value>
47        public string BlogName { get; set; }
48
49        /// <summary>
50        ///     Gets or sets the excerpt.
51        /// </summary>
52        /// <value>The excerpt.</value>
53        public string Excerpt { get; set; }
54
55        /// <summary>
56        ///     Gets or sets the post URL.
57        /// </summary>
58        /// <value>The post URL.</value>
59        public Uri PostUrl { get; set; }
60
61        /// <summary>
62        ///     Gets or sets the title.
63        /// </summary>
64        /// <value>The title.</value>
65        public string Title { get; set; }
66
67        /// <summary>
68        ///     Gets or sets the URL to notify trackback.
69        /// </summary>
70        /// <value>The URL to notify trackback.</value>
71        public Uri UrlToNotifyTrackback { get; set; }
72
73        #endregion
74
75        #region Public Methods
76
77        /// <summary>
78        /// Returns a <see cref="T:System.String"></see> that represents the current <see cref="T:System.Object"></see>.
79        /// </summary>
80        /// <returns>
81        /// A <see cref="T:System.String"></see> that represents the current <see cref="T:System.Object"></see>.
82        /// </returns>
83        public override string ToString()
84        {
85            return string.Format(
86                CultureInfo.InvariantCulture, 
87                "title={0}&url={1}&excerpt={2}&blog_name={3}", 
88                this.Title, 
89                this.PostUrl, 
90                this.Excerpt, 
91                this.BlogName);
92        }
93
94        #endregion
95    }
96}