Hex Editor in c#






2.73/5 (17 votes)
Sep 20, 2005

96915

8313
This is a hex editor in c#
Introduction
The project I am submitting is a Hex Editor, and an accompanying ASCII linked window.
The Editor is derived from a RichTextBox, as is the Linked window. You set up each of them as you would a RichTextBox, and add the following code in the Forms Constructor (as you can see). The Hex Editor is independent of the Linked window, and does not require it to operate.
public Form1() { // // Required for Windows Form Designer support // InitializeComponent(); // // TODO: Add any constructor code after .. // m_edtHex.InitializeComponent(); m_edtASCII.InitializeComponent(); m_edtHex.LinkDisplay(m_edtASCII); m_edtHex.LoadData(m_abyData); }
The Hex Editor is comprised of a base class, HexEditBase. This is the class that is derived from the rich text box. All of the common operations are preformed here. HexEditBox and LinkedBox are derived from HexEditBase.
As you can see from the above sample the Hex Editor requires a buffer to operate on
You can get the modified buffer using the function ArrayData which will return the buffer that the editor is working with. public byte[] ArrayData This is an example of the hex editor and associated Linked window. There are several context sensitive menus available when you right click on each of the windows; Good luck and I hope that this code helps you – enjoy /*
** Use this function if you already have the data you wish to edit
*/
public void LoadData(byte[] abyData);
/*
** Use this function if just need to edit hex of some size
*/
public void NewData(int iSize);