RetrResponse.cs 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. using System;
  2. namespace Ant.Service.Utilities
  3. {
  4. /// <summary>
  5. /// This class represents a RETR response message resulting
  6. /// from a Pop3 RETR command execution against a Pop3 Server.
  7. /// </summary>
  8. internal sealed class RetrResponse : Pop3Response
  9. {
  10. private string[] _messageLines;
  11. /// <summary>
  12. /// Gets the message lines.
  13. /// </summary>
  14. /// <value>The Pop3 message lines.</value>
  15. public string[] MessageLines
  16. {
  17. get { return _messageLines; }
  18. }
  19. private long _octects;
  20. public long Octets
  21. {
  22. get
  23. {
  24. return _octects;
  25. }
  26. }
  27. /// <summary>
  28. /// Initializes a new instance of the <see cref="RetrResponse"/> class.
  29. /// </summary>
  30. /// <param name="response">The response.</param>
  31. /// <param name="messageLines">The message lines.</param>
  32. public RetrResponse(Pop3Response response, string[] messageLines)
  33. : base(response.ResponseContents, response.HostMessage, response.StatusIndicator)
  34. {
  35. if (messageLines == null)
  36. {
  37. throw new ArgumentNullException("messageLines");
  38. }
  39. string[] values = response.HostMessage.Split(' ');
  40. if (values.Length == 2)
  41. {
  42. _octects = Convert.ToInt64(values[1]);
  43. }
  44. _messageLines = messageLines;
  45. }
  46. }
  47. }