Search Results for

    Show / Hide Table of Contents

    Class HexView

    An hex viewer and editor View over a Stream
    Inheritance
    object
    Responder
    View
    HexView
    Implements
    IDisposable
    ISupportInitializeNotification
    ISupportInitialize
    Inherited Members
    View.Added
    View.Removed
    View.Enter
    View.Leave
    View.MouseEnter
    View.MouseLeave
    View.MouseClick
    View.CanFocusChanged
    View.EnabledChanged
    View.VisibleChanged
    View.HotKeyChanged
    View.HotKey
    View.HotKeySpecifier
    View.Shortcut
    View.ShortcutTag
    View.ShortcutAction
    View.Data
    View.Driver
    View.Subviews
    View.TabIndexes
    View.TabIndex
    View.TabStop
    View.CanFocus
    View.Id
    View.IsCurrentTop
    View.WantMousePositionReports
    View.WantContinuousButtonPressed
    View.LayoutStyle
    View.Bounds
    View.X
    View.Y
    View.Width
    View.Height
    View.ForceValidatePosDim
    View.GetMinWidthHeight(out Size)
    View.SetMinWidthHeight()
    View.TextFormatter
    View.SuperView
    View.UpdateTextFormatterText()
    View.ProcessResizeView()
    View.SetNeedsDisplay()
    View.ClearLayoutNeeded()
    View.SetNeedsDisplay(Rect)
    View.SetChildNeedsDisplay()
    View.Add(View)
    View.Add(params View[])
    View.RemoveAll()
    View.Remove(View)
    View.BringSubviewToFront(View)
    View.SendSubviewToBack(View)
    View.SendSubviewBackwards(View)
    View.BringSubviewForward(View)
    View.Clear()
    View.Clear(Rect)
    View.ScreenToView(int, int)
    View.ClipToBounds()
    View.SetClip(Rect)
    View.DrawFrame(Rect, int, bool)
    View.DrawHotString(ustring, Attribute, Attribute)
    View.DrawHotString(ustring, bool, ColorScheme)
    View.Move(int, int, bool)
    View.HasFocus
    View.OnAdded(View)
    View.OnRemoved(View)
    View.OnLeave(View)
    View.Focused
    View.MostFocused
    View.ColorScheme
    View.AddRune(int, int, Rune)
    View.ClearNeedsDisplay()
    View.DrawContent
    View.OnDrawContent(Rect)
    View.DrawContentComplete
    View.OnDrawContentComplete(Rect)
    View.SetFocus()
    View.KeyPress
    View.InvokeKeybindings(KeyEvent)
    View.AddKeyBinding(Key, params Command[])
    View.ReplaceKeyBinding(Key, Key)
    View.ContainsKeyBinding(Key)
    View.ClearKeybindings()
    View.ClearKeybinding(Key)
    View.ClearKeybinding(params Command[])
    View.AddCommand(Command, Func<bool?>)
    View.GetSupportedCommands()
    View.GetKeyFromCommand(params Command[])
    View.ProcessHotKey(KeyEvent)
    View.ProcessColdKey(KeyEvent)
    View.KeyDown
    View.OnKeyDown(KeyEvent)
    View.KeyUp
    View.OnKeyUp(KeyEvent)
    View.EnsureFocus()
    View.FocusFirst()
    View.FocusLast()
    View.FocusPrev()
    View.FocusNext()
    View.LayoutStarted
    View.LayoutComplete
    View.Initialized
    View.LayoutSubviews()
    View.Text
    View.AutoSize
    View.PreserveTrailingSpaces
    View.TextAlignment
    View.VerticalTextAlignment
    View.TextDirection
    View.IsInitialized
    View.IsAdded
    View.Enabled
    View.ClearOnVisibleFalse
    View.Visible
    View.Border
    View.IgnoreBorderPropertyOnRedraw
    View.ToString()
    View.GetAutoSize()
    View.GetHotKeySpecifierLength(bool)
    View.GetTextFormatterBoundsSize()
    View.GetBoundsTextFormatterSize()
    View.OnMouseEnter(MouseEvent)
    View.OnMouseLeave(MouseEvent)
    View.OnMouseEvent(MouseEvent)
    View.OnMouseClick(View.MouseEventArgs)
    View.OnCanFocusChanged()
    View.OnEnabledChanged()
    View.OnVisibleChanged()
    View.Dispose(bool)
    View.BeginInit()
    View.EndInit()
    View.SetWidth(int, out int)
    View.SetHeight(int, out int)
    View.GetCurrentWidth(out int)
    View.GetCurrentHeight(out int)
    View.GetNormalColor()
    View.GetFocusColor()
    View.GetHotNormalColor()
    View.GetTopSuperView()
    Responder.Dispose()
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    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 Stream with the left side showing an hex dump of the values in the 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 Stream. Any changes are tracked in the Edits property (a SortedDictionary<TKey, TValue>) indicating the position where the changes were made and the new values. A convenience method, ApplyEdits(Stream) will apply the edits to the Stream.

    Control the first byte shown by setting the DisplayStart property to an offset in the stream.

    Constructors

    | Edit this page View Source

    HexView()

    Initializes a HexView class using Computed layout.
    Declaration
    public HexView()
    | Edit this page View Source

    HexView(Stream)

    Initializes a HexView class using Computed layout.
    Declaration
    public HexView(Stream source)
    Parameters
    Type Name Description
    Stream source The Stream to view and edit as hex, this Stream must support seeking, or an exception will be thrown.

    Properties

    | Edit this page View Source

    AllowEdits

    Gets or sets whether this HexView allow editing of the Stream of the underlying Stream.
    Declaration
    public bool AllowEdits { get; set; }
    Property Value
    Type Description
    bool true if allow edits; otherwise, false.
    | Edit this page View Source

    BytesPerLine

    The bytes length per line.
    Declaration
    public int BytesPerLine { get; }
    Property Value
    Type Description
    int
    | Edit this page View Source

    CursorPosition

    Gets the current cursor position starting at one for both, line and column.
    Declaration
    public Point CursorPosition { get; }
    Property Value
    Type Description
    Point
    | Edit this page View Source

    DesiredCursorVisibility

    Get / Set the wished cursor when the field is focused
    Declaration
    public CursorVisibility DesiredCursorVisibility { get; set; }
    Property Value
    Type Description
    CursorVisibility
    | Edit this page View Source

    DisplayStart

    Sets or gets the offset into the Stream that will displayed at the top of the HexView
    Declaration
    public long DisplayStart { get; set; }
    Property Value
    Type Description
    long The display start.
    | Edit this page View Source

    Edits

    Gets a SortedDictionary<TKey, TValue> describing the edits done to the HexView. Each Key indicates an offset where an edit was made and the Value is the changed byte.
    Declaration
    public IReadOnlyDictionary<long, byte> Edits { get; }
    Property Value
    Type Description
    IReadOnlyDictionary<long, byte> The edits.
    | Edit this page View Source

    Frame

    Gets or sets the frame for the view. The frame is relative to the view's container (SuperView).
    Declaration
    public override Rect Frame { get; set; }
    Property Value
    Type Description
    Rect The frame.
    Overrides
    View.Frame
    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.

    | Edit this page View Source

    Position

    Gets the current character position starting at one, related to the Stream.
    Declaration
    public long Position { get; }
    Property Value
    Type Description
    long
    | Edit this page View Source

    Source

    Sets or gets the Stream the HexView is operating on; the stream must support seeking (CanSeek == true).
    Declaration
    public Stream Source { get; set; }
    Property Value
    Type Description
    Stream The source.

    Methods

    | Edit this page View Source

    ApplyEdits(Stream)

    This method applies and edits made to the Stream and resets the contents of the Edits property.
    Declaration
    public void ApplyEdits(Stream stream = null)
    Parameters
    Type Name Description
    Stream stream If provided also applies the changes to the passed Stream
    | Edit this page View Source

    DiscardEdits()

    This method discards the edits made to the Stream by resetting the contents of the Edits property.
    Declaration
    public void DiscardEdits()
    | Edit this page View Source

    MouseEvent(MouseEvent)

    Method invoked when a mouse event is generated
    Declaration
    public override bool MouseEvent(MouseEvent me)
    Parameters
    Type Name Description
    MouseEvent me
    Returns
    Type Description
    bool true, if the event was handled, false otherwise.
    Overrides
    Responder.MouseEvent(MouseEvent)
    | Edit this page View Source

    OnEdited(KeyValuePair<long, byte>)

    Method used to invoke the Edited event passing the KeyValuePair<TKey, TValue>.
    Declaration
    public virtual void OnEdited(KeyValuePair<long, byte> keyValuePair)
    Parameters
    Type Name Description
    KeyValuePair<long, byte> keyValuePair The key value pair.
    | Edit this page View Source

    OnEnter(View)

    Method invoked when a view gets focus.
    Declaration
    public override bool OnEnter(View view)
    Parameters
    Type Name Description
    View view The view that is losing focus.
    Returns
    Type Description
    bool true, if the event was handled, false otherwise.
    Overrides
    View.OnEnter(View)
    | Edit this page View Source

    OnPositionChanged()

    Method used to invoke the PositionChanged event passing the HexView.HexViewEventArgs arguments.
    Declaration
    public virtual void OnPositionChanged()
    | Edit this page View Source

    PositionCursor()

    Positions the cursor in the right position based on the currently focused view in the chain.
    Declaration
    public override void PositionCursor()
    Overrides
    View.PositionCursor()
    | Edit this page View Source

    ProcessKey(KeyEvent)

    If the view is focused, gives the view a chance to process the keystroke.
    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
    bool
    Overrides
    View.ProcessKey(KeyEvent)
    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.

    | Edit this page View Source

    Redraw(Rect)

    Redraws this view and its subviews; only redraws the views that have been flagged for a re-display.
    Declaration
    public override void Redraw(Rect bounds)
    Parameters
    Type Name Description
    Rect bounds The bounds (view-relative region) to redraw.
    Overrides
    View.Redraw(Rect)
    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 parameter, as this will cause the driver to clip the entire region.

    Events

    | Edit this page View Source

    Edited

    Event to be invoked when an edit is made on the Stream.
    Declaration
    public event Action<KeyValuePair<long, byte>> Edited
    Event Type
    Type Description
    Action<KeyValuePair<long, byte>>
    | Edit this page View Source

    PositionChanged

    Event to be invoked when the position and cursor position changes.
    Declaration
    public event Action<HexView.HexViewEventArgs> PositionChanged
    Event Type
    Type Description
    Action<HexView.HexViewEventArgs>

    Implements

    IDisposable
    ISupportInitializeNotification
    ISupportInitialize
    • Edit this page
    • View Source
    In this article
    Back to top Generated by DocFX