abbaye / WpfHexEditorControl

Wpf Hexeditor is a powerful and fully customisable user control for editing file or stream as hexadecimal, decimal and binary. Can be used in Wpf or WinForm application
https://www.nuget.org/packages/WPFHexaEditor/
Apache License 2.0
812 stars 135 forks source link

Add support for a base offset that is added to all displayed offsets #128

Closed zcanann closed 1 year ago

zcanann commented 1 year ago

I'm using this project for a memory editor, which means I pass a MemoryStream which comes from a virtual page of memory. For example, a memory page might be loaded into address 0x00500000 and have 4096 (0x1000) bytes. I would want the first offset in the hex editor to say 0x00500000, and the last to be 0x00501000.

This pull request adds support for that, by adding a base offset to all offsets before the display strings are created.

Example using a long base address: image

Example dynamically changing OffsetBase property: https://user-images.githubusercontent.com/5906208/205606514-af665c68-6f31-4f57-88fd-98e24a43f40b.mp4

zcanann commented 1 year ago

Also I'm open to suggestions for other names, if OffsetBase is not preferred

abbaye commented 1 year ago

Hello mister

Thanks for this very nice contribution.

Kind regards