StringRequestInfo.cs 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. namespace SuperSocket.SocketBase.Protocol
  6. {
  7. /// <summary>
  8. /// String type request information
  9. /// </summary>
  10. public class StringRequestInfo : RequestInfo<string>
  11. {
  12. /// <summary>
  13. /// Initializes a new instance of the <see cref="StringRequestInfo"/> class.
  14. /// </summary>
  15. /// <param name="key">The key.</param>
  16. /// <param name="body">The body.</param>
  17. /// <param name="parameters">The parameters.</param>
  18. public StringRequestInfo(string key, string body, string[] parameters)
  19. : base(key, body)
  20. {
  21. Parameters = parameters;
  22. }
  23. /// <summary>
  24. /// Gets the parameters.
  25. /// </summary>
  26. public string[] Parameters { get; private set; }
  27. /// <summary>
  28. /// Gets the first param.
  29. /// </summary>
  30. /// <returns></returns>
  31. public string GetFirstParam()
  32. {
  33. if(Parameters.Length > 0)
  34. return Parameters[0];
  35. return string.Empty;
  36. }
  37. /// <summary>
  38. /// Gets the <see cref="System.String"/> at the specified index.
  39. /// </summary>
  40. public string this[int index]
  41. {
  42. get { return Parameters[index]; }
  43. }
  44. }
  45. }