AnsiEscapeSequenceResponse.cs 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. #nullable enable
  2. namespace Terminal.Gui;
  3. /// <summary>
  4. /// Describes a response received from the console as a result of a request being sent via <see cref="AnsiEscapeSequenceRequest"/>.
  5. /// </summary>
  6. public class AnsiEscapeSequenceResponse
  7. {
  8. // QUESTION: Should this be nullable to indicate there was no error, or is string.Empty sufficient?
  9. /// <summary>
  10. /// Gets the error string received from e.g. see
  11. /// <see>
  12. /// <cref>EscSeqUtils.CSI_SendDeviceAttributes.Request</cref>
  13. /// </see>
  14. /// .
  15. /// </summary>
  16. public required string Error { get; init; }
  17. // QUESTION: Does string.Empty indicate no response recevied? If not, perhaps make this property nullable?
  18. /// <summary>
  19. /// Gets the Response string received from e.g. see
  20. /// <see>
  21. /// <cref>EscSeqUtils.CSI_SendDeviceAttributes.Request</cref>
  22. /// </see>
  23. /// .
  24. /// </summary>
  25. public required string? Response { get; init; }
  26. // QUESTION: Does string.Empty indicate no terminator expected? If not, perhaps make this property nullable?
  27. /// <summary>
  28. /// <para>
  29. /// Gets the terminator that uniquely identifies the response received from
  30. /// the console. e.g. for
  31. /// <see>
  32. /// <cref>EscSeqUtils.CSI_SendDeviceAttributes.Request</cref>
  33. /// </see>
  34. /// the terminator is
  35. /// <see>
  36. /// <cref>EscSeqUtils.CSI_SendDeviceAttributes.Terminator</cref>
  37. /// </see>
  38. /// .
  39. /// </para>
  40. /// <para>
  41. /// After sending a request, the first response with matching terminator will be matched
  42. /// to the oldest outstanding request.
  43. /// </para>
  44. /// </summary>
  45. public required string Terminator { get; init; }
  46. /// <summary>
  47. /// The value expected in the response after the CSI e.g.
  48. /// <see>
  49. /// <cref>EscSeqUtils.CSI_ReportTerminalSizeInChars.Value</cref>
  50. /// </see>
  51. /// should result in a response of the form <c>ESC [ 8 ; height ; width t</c>. In this case, <see cref="ExpectedResponseValue"/>
  52. /// will be <c>"8"</c>.
  53. /// </summary>
  54. public string? ExpectedResponseValue { get; init; }
  55. }