Class HexView
Implements
Inherited Members
Namespace: Terminal.Gui
Assembly: Terminal.Gui.dll
Syntax
public class HexView : View, IDisposable, ISupportInitializeNotification, ISupportInitialize
Remarks
HexView provides a hex editor on top of a seekable System.IO.Stream with the left side showing an hex dump of the values in the System.IO.Stream and the right side showing the contents (filtered to non-control sequence ASCII characters).
Users can switch from one side to the other by using the tab key.
To enable editing, set AllowEdits to true. When AllowEdits is true the user can make changes to the hexadecimal values of the System.IO.Stream. Any changes are tracked in the Edits property (a System.Collections.Generic.SortedDictionary`2) indicating the position where the changes were made and the new values. A convenience method, ApplyEdits() will apply the edits to the System.IO.Stream.
Control the first byte shown by setting the DisplayStart property to an offset in the stream.
Constructors
HexView()
Declaration
public HexView()
HexView(Stream)
Declaration
public HexView(Stream source)
Parameters
Type | Name | Description |
---|---|---|
System.IO.Stream | source | The System.IO.Stream to view and edit as hex, this System.IO.Stream must support seeking, or an exception will be thrown. |
Properties
AllowEdits
Declaration
public bool AllowEdits { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | true if allow edits; otherwise, false . |
DesiredCursorVisibility
Declaration
public CursorVisibility DesiredCursorVisibility { get; set; }
Property Value
Type | Description |
---|---|
CursorVisibility |
DisplayStart
Declaration
public long DisplayStart { get; set; }
Property Value
Type | Description |
---|---|
System.Int64 | The display start. |
Edits
Declaration
public IReadOnlyDictionary<long, byte> Edits { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.IReadOnlyDictionary<System.Int64, System.Byte> | The edits. |
Frame
Declaration
public override Rect Frame { get; set; }
Property Value
Type | Description |
---|---|
Rect | The frame. |
Overrides
Remarks
Change the Frame when using the Absolute layout style to move or resize views.
Altering the Frame of a view will trigger the redrawing of the view as well as the redrawing of the affected regions of the SuperView.
Source
Declaration
public Stream Source { get; set; }
Property Value
Type | Description |
---|---|
System.IO.Stream | The source. |
Methods
ApplyEdits()
Declaration
public void ApplyEdits()
PositionCursor()
Declaration
public override void PositionCursor()
Overrides
ProcessKey(KeyEvent)
Declaration
public override bool ProcessKey(KeyEvent keyEvent)
Parameters
Type | Name | Description |
---|---|---|
KeyEvent | keyEvent | Contains the details about the key that produced the event. |
Returns
Type | Description |
---|---|
System.Boolean |
Overrides
Remarks
Views can override this method if they are interested in processing the given keystroke. If they consume the keystroke, they must return true to stop the keystroke from being processed by other widgets or consumed by the widget engine. If they return false, the keystroke will be passed using the ProcessColdKey method to other views to process.
The View implementation does nothing but return false, so it is not necessary to call base.ProcessKey if you derive directly from View, but you should if you derive other View subclasses.
Redraw(Rect)
Declaration
public override void Redraw(Rect bounds)
Parameters
Type | Name | Description |
---|---|---|
Rect | bounds | The bounds (view-relative region) to redraw. |
Overrides
Remarks
Always use Bounds (view-relative) when calling Redraw(Rect), NOT Frame (superview-relative).
Views should set the color that they want to use on entry, as otherwise this will inherit the last color that was set globally on the driver.
Overrides of Redraw(Rect) must ensure they do not set Driver.Clip
to a clip region
larger than the region
parameter.