/// <summary>Returns the specified information of this this <see cref="ITag"/></summary>
        /// <param name="InfoType">The info type to retrieve from this this <see cref="ITag"/></param>
        /// <returns>Returns the specified information of this this <see cref="ITag"/></returns>
        public override Object GetInformation(NBTTagInformation InfoType)
        {
            switch (InfoType)
            {
            case NBTTagInformation.Name:
                return(this._Name);

            case NBTTagInformation.Tag:
                return(this._Tags);

            case NBTTagInformation.ListSize:
                return(this._Tags.Count);

            case NBTTagInformation.Value:
                return(this._Value);

            case NBTTagInformation.ListSubtype:
            default:
                return(null);
            }
        }
        /// <summary>Sets the specified information of the tag</summary>
        public override void SetInformation(NBTTagInformation InfoType, Object Info)
        {
            switch (InfoType)
            {
            case NBTTagInformation.Name:
                this._Name = (String)Info;
                break;

            case NBTTagInformation.Tag:
                this._Tags.Add((ITag)Info);
                break;

            case NBTTagInformation.Value:
                this._Value = (TypeValue)Info;
                break;

            case NBTTagInformation.ListSize:
            case NBTTagInformation.ListSubtype:
            default:
                break;
            }
        }
Exemple #3
0
        /// <summary>Sets the specified information of this this <see cref="ITag"/> with the given value</summary>
        /// <param name="InfoType">The into type to store the information in</param>
        /// <param name="Info">The information to store</param>
        public override void SetInformation(NBTTagInformation InfoType, Object Info)
        {
            switch (InfoType)
            {
            case NBTTagInformation.Name:
                this._Name = (String)Info;
                break;

            case NBTTagInformation.Tag:
                this._Tags.Add((ITag)Info);
                break;

            case NBTTagInformation.ListSize:
                Int32 I = (Int32)Info;
                if (I > 0)
                {
                    this._Tags.AddRange(new ITag[I - this._Tags.Count]);
                }

                break;

            case NBTTagInformation.ListSubtype:
                this._SubType = (NBTTagType)Info;
                break;

            case NBTTagInformation.Value:
                if (Info is List <ITag> NewList)
                {
                    this._Tags = NewList;
                }

                break;

            default:
                break;
            }
        }