abbaye/WpfHexEditorControl

Ability to insert bytes everywhere

Mgamerz opened this issue ยท 14 comments

Expected Behavior

Using insert mode (Insert key) should allow me to insert bytes in at arbitrary points. I should be able to press backspace or delete to erase bytes, rather than reset to them to zero.

Actual Behavior

Insert doesn't seem to be possible, only appending. Deleting bytes, from what I can tell, just reset them to zero rather than actually wiping them.

Steps to Reproduce the Problem

Try to use insert or backspace/delete for bytes. It does not work.

For info : Alway use HexaEditor You should not use DrawedHexEditor because it's a alpha stage.

The actual version support delete (anywhere) and insert byte (EOF only).

When you delete the byte reset to zero and turn to red... the byte will be really deleted when you save change to you file/stream

Would there be a way to add bytes via insert? Or have a toggle that will hide deleted bytes, even if I have not committed the actual backing stream?

Not for now but soon :)

Project are made in me free time

Now you can insert byte at end of file.

When I have more time I will add the ability to insert byte anywhere

@Mgamerz I plan on making dialogs for this for now. Might be a workaround for you. Something like the following: https://www.sweetscape.com/010editor/manual/InsertBytes.htm

It's a good idea and a good solution for insert byte anywhere.

I think I can make a real-time insert bytes in control. (I just need more free time for me...)

Unfortunately, I just used Be.Hexbox in a hosted control, and for the most part have completed my project. It works, for the most part.

@abbaye I have not thoroughly examined the ByteProvider, but I'm thinking something like this:

Add a List called _insertions
Add a long called _insertionStart
When insert key is pressed, the UI enters insertion mode, _insertionStart is set to caret position offset.
When typing in insertion mode, add the bytes, not directly to the stream, but to the _insertion list.

When doing rendering:
Render everything from the start of the stream before the offset of _insertionStart , followed by everything in _insertions (up until _insertionStart + _insertion.Count()), finally everything in the stream at the offset _insertionStart. This will give the appearance that data is inserted in the UI.

When insertion is ended, we can update the stream by

  1. Resizing the stream length to length + _insertionCount (zero fill the end)
  2. Overwriting the stream at offset _insertionStart + _insertion.Count() with copied stream data at offset _insertionStart (not reading from _insertions, but the actual stream). This will create room for step3
  3. Seeking back to _insertionStart and writing _insertions data

Just an idea.

Hi vector-man.

Yes is a think like this. :)

I'm at the end of my University's session (ending ~17 April). After that I will can work on insert byte (everywhere)

Any progress on ADDING ONE BYTE??? :) It's ridiculous, heh... Standard editing function and so much awaiting.
One more note: control sources look overbloated for such simplistic task - edit hex bytes!
And sorry, but better you made "adding byte" function than waste time on... translation! If you edit HEX, you definitely KNOW english!

Hi @WrongBit

I know that inserting byte is a basic function ... but I build this control for fun and when I have free time in my real life (I have one ๐Ÿ˜…). Adding this bug-free feature takes a long time and I don't have much at the moment. I hope to be able to work on this function this winter.

For your information: Some features I added were added because they were quick to implement.

On the other hand, if you want to code the functionality and send a "pull resquest" ๐Ÿ˜€ I will be happy to add it later ...

PS: It is more interesting to contribute in a project than to send this type of message to a guy who gives his time for free. Your Github profile is empty, you should probably have some time to code the byte insertion. ๐Ÿ˜…๐Ÿ˜

kind regards...

Hey there. I think I'm going to take try at adding this feature soon. If I do, I'll send a pull request after I get it working well.

Thank you very much!

I want to work on this project but I'm working on the last 6 months over 70 by week. ๐Ÿ˜ตโ€๐Ÿ’ซ๐Ÿ˜…

Thank for you help