The sample app builds a higher-level editor surface around HexViewControl.
The single-file sample wires these pieces together:
MemoryMappedLineReader for raw file accessByteOverlay and ByteOverlayLineReader for edit projectionHexFormatter for layout and text formattingSelectionService for range operationsNavigationService for history, bookmarks, and next-change navigationEditJournal for undo and redoHexSearchService for address, byte pattern, wildcard, and text searchSaveService for save-as and patch exportprivate void OpenFile(FileStream stream, string path)
{
_lineReader1?.Dispose();
_lineReader1 = new MemoryMappedLineReader(stream);
_overlay1 = new ByteOverlay(_lineReader1);
_overlayReader1 = new ByteOverlayLineReader(_overlay1);
_journal1 = new EditJournal();
_selection1 = new SelectionService(_overlay1);
_navigation1 = new NavigationService(_overlay1);
_hexFormatter1 = new HexFormatter(_overlay1.Length);
HexViewControl1.LineReader = _overlayReader1;
HexViewControl1.HexFormatter = _hexFormatter1;
HexViewControl1.ByteWriteAction = OverwriteByteFromEditor;
HexViewControl1.EditedOffsetsProvider =
(start, end) => _overlay1.GetOverwriteEdits().Keys.Where(k => k >= start && k <= end);
HexViewControl1.InvalidateScrollable();
}
This composition keeps responsibilities separate: