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);
        }
        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);
        }
        protected bool EditLongHexValue(TagNode tag)
        {
            if (FormRegistry.EditByteArray != null)
            {
                TagNodeLongArray latag    = tag.ToTagLongArray();
                byte[]           byteData = new byte[latag.Length * 8];
                for (int i = 0; i < latag.Length; i++)
                {
                    byte[] buf = BitConverter.GetBytes(latag.Data[i]);
                    Array.Copy(buf, 0, byteData, 8 * i, 8);
                }

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

                if (FormRegistry.EditByteArray(data))
                {
                    latag.Data = new long[data.Data.Length / 8];
                    for (int i = 0; i < latag.Length; i++)
                    {
                        latag.Data[i] = BitConverter.ToInt64(data.Data, i * 8);
                    }

                    IsDataModified = true;
                    return(true);
                }
            }

            return(false);
        }
Exemple #4
0
 public static bool EditByteArrayHandler(ByteArrayFormData data)
 {
     HexEditor form = new HexEditor(data.NodeName, data.Data, data.BytesPerElement);
     if (form.ShowDialog() == DialogResult.OK && form.Modified) {
         Array.Copy(form.Data, data.Data, data.Data.Length);
         return true;
     }
     else
         return false;
 }
Exemple #5
0
        public static bool EditByteArrayHandler(ByteArrayFormData data)
        {
            var 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);
            }
            return(false);
        }
Exemple #6
0
        public static bool EditByteArrayHandler(ByteArrayFormData data)
        {
            NSAlert.WithMessage("Not supported.", "OK", null, null, "Array editing is currently not supported in the Mac version of NBTExplorer.").RunModal();
            return(false);

            /*HexEditor form = new HexEditor(data.NodeName, data.Data, data.BytesPerElement);
             * if (form.ShowDialog() == DialogResult.OK && form.Modified) {
             *      Array.Copy(form.Data, data.Data, data.Data.Length);
             *      return true;
             * }
             * else
             *      return false;*/
        }
		public static bool EditByteArrayHandler (ByteArrayFormData data)
		{
			NSAlert.WithMessage("Not supported.", "OK", null, null, "Array editing is currently not supported in the Mac version of NBTExplorer.").RunModal();
			return false;

			/*HexEditor form = new HexEditor(data.NodeName, data.Data, data.BytesPerElement);
			if (form.ShowDialog() == DialogResult.OK && form.Modified) {
				Array.Copy(form.Data, data.Data, data.Data.Length);
				return true;
			}
			else
				return false;*/
		}
        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)) {
                    for (int i = 0; i < iatag.Length; i++) {
                        iatag.Data[i] = BitConverter.ToInt32(data.Data, i * 4);
                    }

                    IsDataModified = true;
                    return true;
                }
            }

            return false;
        }
        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)) {
                    Array.Copy(data.Data, tag.ToTagByteArray().Data, tag.ToTagByteArray().Length);
                    IsDataModified = true;
                    return true;
                }
            }

            return false;
        }