Show / Hide Table of Contents

Class HexView

An Hex viewer an editor view over a System.IO.Stream

Inheritance
System.Object
Responder
View
HexView
Inherited Members
Responder.CanFocus
Responder.MouseEvent(MouseEvent)
View.Add(View)
View.Add(View[])
View.AddRune(Int32, Int32, Rune)
View.Bounds
View.ChildNeedsDisplay()
View.Clear()
View.Clear(Rect)
View.ClearNeedsDisplay()
View.ClipToBounds()
View.ColorScheme
View.DrawFrame(Rect, Int32, Boolean)
View.DrawHotString(ustring, Boolean, ColorScheme)
View.DrawHotString(ustring, Attribute, Attribute)
View.Driver
View.EnsureFocus()
View.Focused
View.FocusFirst()
View.FocusLast()
View.FocusNext()
View.FocusPrev()
View.GetEnumerator()
View.HasFocus
View.Height
View.Id
View.LayoutStyle
View.LayoutSubviews()
View.MostFocused
View.Move(Int32, Int32)
View.ProcessColdKey(KeyEvent)
View.ProcessHotKey(KeyEvent)
View.Remove(View)
View.RemoveAll()
View.ScreenToView(Int32, Int32)
View.SetClip(Rect)
View.SetFocus(View)
View.SetNeedsDisplay()
View.SetNeedsDisplay(Rect)
View.Subviews
View.SuperView
View.ToString()
View.WantMousePositionReports
View.Width
View.X
View.Y
Namespace: Terminal.Gui
Assembly: Terminal.Gui.dll
Syntax
public class HexView : Terminal.Gui.View
Remarks

This provides a hex editor on top of a seekable stream with the left side showing an hex dump of the values in the stream and the right side showing the contents (filterd to non-control sequence ascii characters).

Users can switch from one side to the other by using the tab key.

If you want to enable editing, set the AllowsEdits property, once that is done, the user can make changes to the hexadecimal values of the stream. Any changes done are tracked in the Edits property which is a sorted dictionary indicating the position where the change was made and the new value. A convenience ApplyEdits method can be used to c apply the methods to the underlying stream.

It is possible to control the first byte shown by setting the DisplayStart property to the offset that you want to start viewing.

Constructors

HexView(Stream)

Creates and instance of the HexView that will render a seekable stream in hex on the allocated view region.

Declaration
public HexView (System.IO.Stream source);
Parameters
Type Name Description
System.IO.Stream source

Source stream, this stream should support seeking, or this will raise an exceotion.

Properties

AllowEdits

Gets or sets a value indicating whether this HexView allow editing of the contents of the underlying stream.

Declaration
public bool AllowEdits { get; set; }
Property Value
Type Description
System.Boolean

true if allow edits; otherwise, false.

DisplayStart

Configures the initial offset to be displayed at the top

Declaration
public long DisplayStart { get; set; }
Property Value
Type Description
System.Int64

The display start.

Edits

Gets a list of the edits done to the buffer which is a sorted dictionary with the positions where the edit took place and the value that was set.

Declaration
public System.Collections.Generic.IReadOnlyDictionary<long,byte> Edits { get; }
Property Value
Type Description
System.Collections.Generic.IReadOnlyDictionary<System.Int64,System.Byte>

The edits.

Frame

Declaration
public override Terminal.Gui.Rect Frame { get; set; }
Property Value
Type Description
Rect

To be added.

Source

The source stream to display on the hex view, the stream should support seeking.

Declaration
public System.IO.Stream Source { get; set; }
Property Value
Type Description
System.IO.Stream

The source.

Methods

ApplyEdits()

This method applies the edits to the stream and resets the contents of the Edits property

Declaration
public void ApplyEdits ();

PositionCursor()

Positions the cursor based for the hex view

Declaration
public override void PositionCursor ();

ProcessKey(KeyEvent)

Declaration
public override bool ProcessKey (Terminal.Gui.KeyEvent keyEvent);
Parameters
Type Name Description
KeyEvent keyEvent

To be added.

Returns
Type Description
System.Boolean

To be added.

Redraw(Rect)

Declaration
public override void Redraw (Terminal.Gui.Rect region);
Parameters
Type Name Description
Rect region

To be added.

Back to top Copyright © 2015-2017 Microsoft
Generated by DocFX