PageRenderTime 43ms CodeModel.GetById 11ms RepoModel.GetById 0ms app.codeStats 0ms

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

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