コード例 #1
0
        public override bool Verify(NbtVerifier verifier, TagNode tag)
        {
            TagNodeString stag = tag as TagNodeString;

            if (stag == null)
            {
                if (!verifier.OnInvalidTagType(new TagEventArgs(this, tag)))
                {
                    return(false);
                }
            }
            if (Length > 0 && stag.Length > Length)
            {
                if (!verifier.OnInvalidTagValue(new TagEventArgs(this, tag)))
                {
                    return(false);
                }
            }
            if (Value != null && stag.Data != Value)
            {
                if (!verifier.OnInvalidTagValue(new TagEventArgs(this, tag)))
                {
                    return(false);
                }
            }

            return(true);
        }
コード例 #2
0
        public override bool Verify(NbtVerifier verifier, TagNode tag)
        {
            TagNodeList ltag = tag as TagNodeList;

            if (ltag == null)
            {
                if (!verifier.OnInvalidTagType(new TagEventArgs(this, tag)))
                {
                    return(false);
                }
            }
            if (ltag.Count > 0 && ltag.ValueType != Type)
            {
                if (!verifier.OnInvalidTagValue(new TagEventArgs(this, tag)))
                {
                    return(false);
                }
            }
            if (Length > 0 && ltag.Count != Length)
            {
                if (!verifier.OnInvalidTagValue(new TagEventArgs(this, tag)))
                {
                    return(false);
                }
            }

            // Patch up empty lists
            //if (schema.Length == 0) {
            //    tag = new NBT_List(schema.Type);
            //}

            bool pass = true;

            // If a subschema is set, test all items in list against it

            if (SubSchema != null)
            {
                foreach (TagNode v in ltag)
                {
                    pass = SubSchema.Verify(verifier, v) && pass;
                }
            }

            return(pass);
        }
コード例 #3
0
        public override bool Verify(NbtVerifier verifier, TagNode tag)
        {
            TagNodeShortArray atag = tag as TagNodeShortArray;

            if (atag == null)
            {
                if (!verifier.OnInvalidTagType(new TagEventArgs(this, tag)))
                {
                    return(false);
                }
            }
            if (Length > 0 && atag.Length != Length)
            {
                if (!verifier.OnInvalidTagValue(new TagEventArgs(this, tag)))
                {
                    return(false);
                }
            }

            return(true);
        }