AnsiEscapeSequenceResponse.cs 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  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
  5. /// <see cref="AnsiEscapeSequenceRequest"/>.
  6. /// </summary>
  7. public class AnsiEscapeSequenceResponse
  8. {
  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. /// <summary>
  18. /// The value expected in the response after the CSI e.g.
  19. /// <see>
  20. /// <cref>EscSeqUtils.CSI_ReportTerminalSizeInChars.Value</cref>
  21. /// </see>
  22. /// should result in a response of the form <c>ESC [ 8 ; height ; width t</c>. In this case,
  23. /// <see cref="ExpectedResponseValue"/>
  24. /// will be <c>"8"</c>.
  25. /// </summary>
  26. public string? ExpectedResponseValue { get; init; }
  27. /// <summary>
  28. /// Gets the Response string received from e.g. see
  29. /// <see>
  30. /// <cref>EscSeqUtils.CSI_SendDeviceAttributes.Request</cref>
  31. /// </see>
  32. /// .
  33. /// </summary>
  34. public required string? Response { get; init; }
  35. /// <summary>
  36. /// <para>
  37. /// Gets the terminator that uniquely identifies the response received from
  38. /// the console. e.g. for
  39. /// <see>
  40. /// <cref>EscSeqUtils.CSI_SendDeviceAttributes.Request</cref>
  41. /// </see>
  42. /// the terminator is
  43. /// <see>
  44. /// <cref>EscSeqUtils.CSI_SendDeviceAttributes.Terminator</cref>
  45. /// </see>
  46. /// .
  47. /// </para>
  48. /// <para>
  49. /// After sending a request, the first response with matching terminator will be matched
  50. /// to the oldest outstanding request.
  51. /// </para>
  52. /// </summary>
  53. public required string Terminator { get; init; }
  54. /// <summary>
  55. /// Gets if the request has a valid response.
  56. /// </summary>
  57. public bool Valid { get; internal set; }
  58. }