public void PasteHex()
{
if (!CanPaste()) return;
byte[] buffer = null;
IDataObject da = Clipboard.GetDataObject();
if (da.GetDataPresent(typeof(string)))
{
string hexString = (string)da.GetData(typeof(string));
buffer = ConvertHexToBytes(hexString);
if (buffer == null)
return;
}
else
{
return;
}
if (_selectionLength > 0)
_byteProvider.DeleteBytes(_bytePos, _selectionLength);
_byteProvider.InsertBytes(_bytePos, buffer);
SetPosition(_bytePos + buffer.Length, 0);
ReleaseSelection();
ScrollByteIntoView();
UpdateCaret();
Invalidate();
}