protected void UpdateValue() { if (disable_UpdateValue) { return; } if (DataFieldVM.HasError) { return; } var newData = GetDataAsByteArray(); Debug.Assert(newData != null && (ulong)newData.Length == endOffset - startOffset + 1); var origData = doc.ReadBytes(startOffset, newData.Length); if (Equals(newData, origData)) { return; } var undoDoc = doc as IUndoHexDocument; Debug.Assert(undoDoc != null); if (undoDoc != null) { undoDoc.WriteUndo(startOffset, newData, string.Format(dnSpy_AsmEditor_Resources.HexField_UndoMessage_Write_Parent_Field, parentName, Name)); } else { doc.Write(startOffset, newData); } OnUpdateValue(); }
void WriteData(byte[] data, HexBoxPosition caretPos) { doc.Write(offset, data, 0, data.Length); var hexBox = (HexBox)hexBoxWeakRef.Target; if (hexBox != null) { hexBox.CaretPosition = caretPos; hexBox.BringCaretIntoView(); } }
void WriteData(byte[] data) => doc.Write(offset, data, 0, data.Length);