HexViewEventArgs.cs 1.7 KB

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