PassCommand.cs 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. using System;
  2. using System.IO;
  3. namespace Ant.Service.Utilities
  4. {
  5. /// <summary>
  6. /// This class represents the Pop3 PASS command.
  7. /// </summary>
  8. internal sealed class PassCommand : Pop3Command<Pop3Response>
  9. {
  10. private string _password;
  11. /// <summary>
  12. /// Initializes a new instance of the <see cref="PassCommand"/> class.
  13. /// </summary>
  14. /// <param name="stream">The stream.</param>
  15. /// <param name="password">The password.</param>
  16. public PassCommand(Stream stream, string password)
  17. : base(stream, false, Pop3State.Authorization)
  18. {
  19. if (string.IsNullOrEmpty(password))
  20. {
  21. throw new ArgumentNullException("password");
  22. }
  23. _password = password;
  24. }
  25. /// <summary>
  26. /// Creates the PASS request message.
  27. /// </summary>
  28. /// <returns>
  29. /// The byte[] containing the PASS request message.
  30. /// </returns>
  31. protected override byte[] CreateRequestMessage()
  32. {
  33. return GetRequestMessage(Pop3Commands.Pass, _password, Pop3Commands.Crlf);
  34. }
  35. }
  36. }