Example #1
0
 public static bool EditByteArrayHandler (ByteArrayFormData data)
 {
     HexEditor form = new HexEditor(data.NodeName, data.Data, data.BytesPerElement);
     if (form.ShowDialog() == DialogResult.OK && form.Modified) {
         data.Data = new byte[form.Data.Length];
         Array.Copy(form.Data, data.Data, data.Data.Length);
         return true;
     }
     else
         return false;
 }
Example #2
0
        protected bool EditIntHexValue (TagNode tag)
        {
            if (FormRegistry.EditByteArray != null) {
                TagNodeIntArray iatag = tag.ToTagIntArray();
                byte[] byteData = new byte[iatag.Length * 4];
                for (int i = 0; i < iatag.Length; i++) {
                    byte[] buf = BitConverter.GetBytes(iatag.Data[i]);
                    Array.Copy(buf, 0, byteData, 4 * i, 4);
                }

                ByteArrayFormData data = new ByteArrayFormData() {
                    NodeName = NodeName,
                    BytesPerElement = 4,
                    Data = byteData,
                };

                if (FormRegistry.EditByteArray(data)) {
                    iatag.Data = new int[data.Data.Length / 4];
                    for (int i = 0; i < iatag.Length; i++) {
                        iatag.Data[i] = BitConverter.ToInt32(data.Data, i * 4);
                    }

                    IsDataModified = true;
                    return true;
                }
            }

            return false;
        }
Example #3
0
        protected bool EditByteHexValue (TagNode tag)
        {
            if (FormRegistry.EditByteArray != null) {
                byte[] byteData = new byte[tag.ToTagByteArray().Length];
                Array.Copy(tag.ToTagByteArray().Data, byteData, byteData.Length);

                ByteArrayFormData data = new ByteArrayFormData() {
                    NodeName = NodeName,
                    BytesPerElement = 1,
                    Data = byteData,
                };

                if (FormRegistry.EditByteArray(data)) {
                    tag.ToTagByteArray().Data = data.Data;
                    //Array.Copy(data.Data, tag.ToTagByteArray().Data, tag.ToTagByteArray().Length);
                    IsDataModified = true;
                    return true;
                }
            }

            return false;
        }