Exemple #1
0
        public static bool ModifyTag(IconSource source, NbtTag existing, EditPurpose purpose)
        {
            if (purpose == EditPurpose.Create)
            {
                throw new ArgumentException("Use CreateTag to create tags");
            }
            var  parent   = existing.Parent;
            bool has_name = parent is NbtCompound;

            var window = new EditHexWindow(source, existing, parent, has_name, purpose);

            return(window.ShowDialog() == DialogResult.OK); // window modifies the tag by itself
        }
Exemple #2
0
        public static NbtTag CreateTag(IconSource source, NbtTagType type, NbtContainerTag parent, bool bypass_window = false)
        {
            bool has_name = parent is NbtCompound;
            var  tag      = NbtUtil.CreateTag(type);

            if (bypass_window)
            {
                tag.Name = NbtUtil.GetAutomaticName(tag, parent);
                return(tag);
            }
            var window = new EditHexWindow(source, tag, parent, has_name, EditPurpose.Create);

            return(window.ShowDialog() == DialogResult.OK ? tag : null);
        }