Пример #1
0
        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();
        }
Пример #2
0
        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();
            }
        }
Пример #3
0
 void WriteData(byte[] data) => doc.Write(offset, data, 0, data.Length);