コード例 #1
0
        public override bool Equals(object obj)
        {
            if (!(obj is ByteArrayTag))
            {
                return(false);
            }
            ByteArrayTag tag = (ByteArrayTag)obj;

            if (this.Name != tag.Name)
            {
                return(false);
            }
            if (this.Data.Length != tag.Data.Length)
            {
                return(false);
            }
            for (int i = 0; i < this.Data.Length; ++i)
            {
                if (this.Data[i] != tag.Data[i])
                {
                    return(false);
                }
            }
            return(true);
        }
コード例 #2
0
        internal override void Read(NBTStream stream)
        {
            this.ListTagType = (NBTTagType)stream.ReadByte();
            int len = stream.ReadInt();

            for (int i = 0; i < len; ++i)
            {
                Tag tag = null;
                switch (this.ListTagType)
                {
                case NBTTagType.BYTE:
                    tag = new ByteTag(0);
                    break;

                case NBTTagType.SHORT:
                    tag = new ShortTag(0);
                    break;

                case NBTTagType.INT:
                    tag = new IntTag(0);
                    break;

                case NBTTagType.LONG:
                    tag = new LongTag(0);
                    break;

                case NBTTagType.FLOAT:
                    tag = new FloatTag(0);
                    break;

                case NBTTagType.DOUBLE:
                    tag = new DoubleTag(0);
                    break;

                case NBTTagType.BYTE_ARRAY:
                    tag = new ByteArrayTag(new byte[0]);
                    break;

                case NBTTagType.STRING:
                    tag = new StringTag("");
                    break;

                case NBTTagType.LIST:
                    tag = new ListTag(NBTTagType.LIST);
                    break;

                case NBTTagType.COMPOUND:
                    tag = new CompoundTag();
                    break;

                case NBTTagType.INT_ARRAY:
                    tag = new IntArrayTag(new int[0]);
                    break;

                case NBTTagType.LONG_ARRAY:
                    tag = new LongArrayTag(new long[0]);
                    break;

                default:
                    throw new NotSupportedException();
                }

                tag.Read(stream);
                this.list.Add(tag);
            }
        }