DeleCommand.cs 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. using System;
  2. //using System.Net.Sockets;
  3. using System.IO;
  4. namespace Ant.Service.Utilities
  5. {
  6. /// <summary>
  7. /// This class represents the Pop3 DELE command.
  8. /// </summary>
  9. internal sealed class DeleCommand : Pop3Command<Pop3Response>
  10. {
  11. int _messageId = int.MinValue;
  12. /// <summary>
  13. /// Initializes a new instance of the <see cref="DeleCommand"/> class.
  14. /// </summary>
  15. /// <param name="stream">The stream.</param>
  16. /// <param name="messageId">The message id.</param>
  17. public DeleCommand(Stream stream, int messageId)
  18. : base(stream, false, Pop3State.Transaction)
  19. {
  20. if (messageId < 0)
  21. {
  22. throw new ArgumentOutOfRangeException("_messageId");
  23. }
  24. _messageId = messageId;
  25. }
  26. /// <summary>
  27. /// Creates the DELE request message.
  28. /// </summary>
  29. /// <returns>
  30. /// The byte[] containing the DELE request message.
  31. /// </returns>
  32. protected override byte[] CreateRequestMessage()
  33. {
  34. return GetRequestMessage(string.Concat(Pop3Commands.Dele, _messageId.ToString(), Pop3Commands.Crlf));
  35. }
  36. }
  37. }