HexViewEventArgs.cs 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. #nullable disable
  2. //
  3. // HexView.cs: A hexadecimal viewer
  4. //
  5. // TODO:
  6. // - Support searching and highlighting of the search result
  7. // - Bug showing the last line
  8. //
  9. namespace Terminal.Gui.Views;
  10. /// <summary>Defines the event arguments for <see cref="HexView.PositionChanged"/> event.</summary>
  11. public class HexViewEventArgs : EventArgs
  12. {
  13. /// <summary>Initializes a new instance of <see cref="HexViewEventArgs"/></summary>
  14. /// <param name="address">The byte position in the steam.</param>
  15. /// <param name="position">The edit position.</param>
  16. /// <param name="lineLength">Line bytes length.</param>
  17. public HexViewEventArgs (long address, Point position, int lineLength)
  18. {
  19. Address = address;
  20. Position = position;
  21. BytesPerLine = lineLength;
  22. }
  23. /// <summary>The bytes length per line.</summary>
  24. public int BytesPerLine { get; private set; }
  25. /// <summary>Gets the current edit position.</summary>
  26. public Point Position { get; private set; }
  27. /// <summary>Gets the byte position in the <see cref="Stream"/>.</summary>
  28. public long Address { get; private set; }
  29. }
  30. /// <summary>Defines the event arguments for <see cref="HexView.Edited"/> event.</summary>
  31. public class HexViewEditEventArgs : EventArgs
  32. {
  33. /// <summary>Creates a new instance of the <see cref="HexViewEditEventArgs"/> class.</summary>
  34. /// <param name="address"></param>
  35. /// <param name="newValue"></param>
  36. public HexViewEditEventArgs (long address, byte newValue)
  37. {
  38. Address = address;
  39. NewValue = newValue;
  40. }
  41. /// <summary>Gets the new value for that <see cref="Address"/>.</summary>
  42. public byte NewValue { get; }
  43. /// <summary>Gets the address of the edit in the stream.</summary>
  44. public long Address { get; }
  45. }