Example #1
0
 /// <summary>
 /// Constructs a new <see cref="SchemaNodeList"/> with additional options.
 /// </summary>
 /// <param name="name">The name of the corresponding <see cref="TagNodeList"/>.</param>
 /// <param name="type">The type of items contained in the corresponding <see cref="TagNodeList"/>.</param>
 /// <param name="length">The number of items contained in the corresponding <see cref="TagNodeList"/>.</param>
 /// <param name="subschema">A <see cref="SchemaNode"/> representing a schema to verify against items contained in the corresponding <see cref="TagNodeList"/>.</param>
 /// <param name="options">One or more option flags modifying the processing of this node.</param>
 public SchemaNodeList(string name, TagType type, int length, SchemaNode subschema, SchemaOptions options)
     : base(name, options)
 {
     _type      = type;
     _length    = length;
     _subschema = subschema;
 }
Example #2
0
        private bool Verify(TagNode parent, TagNode tag, SchemaNode schema)
        {
            if (tag == null)
            {
                return(OnMissingTag(new TagEventArgs(schema.Name)));
            }

            SchemaNodeScaler scaler = schema as SchemaNodeScaler;

            if (scaler != null)
            {
                return(VerifyScaler(tag, scaler));
            }

            SchemaNodeString str = schema as SchemaNodeString;

            if (str != null)
            {
                return(VerifyString(tag, str));
            }

            SchemaNodeArray array = schema as SchemaNodeArray;

            if (array != null)
            {
                return(VerifyArray(tag, array));
            }

            SchemaNodeIntArray intarray = schema as SchemaNodeIntArray;

            if (intarray != null)
            {
                return(VerifyIntArray(tag, intarray));
            }

            SchemaNodeShortArray shortarray = schema as SchemaNodeShortArray;

            if (shortarray != null)
            {
                return(VerifyShortArray(tag, shortarray));
            }

            SchemaNodeList list = schema as SchemaNodeList;

            if (list != null)
            {
                return(VerifyList(tag, list));
            }

            SchemaNodeCompound compound = schema as SchemaNodeCompound;

            if (compound != null)
            {
                return(VerifyCompound(tag, compound));
            }

            return(OnInvalidTagType(new TagEventArgs(schema.Name, tag)));
        }
Example #3
0
        private bool Verify(TagNode parent, TagNode tag, SchemaNode schema)
        {
            if (tag == null)
            {
                return(OnMissingTag(new TagEventArgs(schema.Name)));
            }

            return(schema.Verify(this, tag));
        }
Example #4
0
 /// <summary>
 /// Constructs a new <see cref="NbtVerifier"/> object for a given NBT tree and schema.
 /// </summary>
 /// <param name="root">A <see cref="TagNode"/> representing the root of an NBT tree.</param>
 /// <param name="schema">A <see cref="SchemaNode"/> representing the root of a schema definition for the NBT tree.</param>
 public NbtVerifier(TagNode root, SchemaNode schema)
 {
     _root = root;
     _schema = schema;
 }
Example #5
0
 /// <summary>
 /// Constructs a new event argument set.
 /// </summary>
 /// <param name="schema">The <see cref="SchemaNode"/> corresponding to the <see cref="TagNode"/> involved in this event.</param>
 /// <param name="tag">The <see cref="TagNode"/> involved in this event.</param>
 public TagEventArgs(SchemaNode schema, TagNode tag)
     : base()
 {
     _tag = tag;
     _schema = schema;
 }
Example #6
0
        private bool Verify(TagNode parent, TagNode tag, SchemaNode schema)
        {
            if (tag == null) {
                return OnMissingTag(new TagEventArgs(schema.Name));
            }

            SchemaNodeScaler scaler = schema as SchemaNodeScaler;
            if (scaler != null) {
                return VerifyScaler(tag, scaler);
            }

            SchemaNodeString str = schema as SchemaNodeString;
            if (str != null) {
                return VerifyString(tag, str);
            }

            SchemaNodeArray array = schema as SchemaNodeArray;
            if (array != null) {
                return VerifyArray(tag, array);
            }

            SchemaNodeList list = schema as SchemaNodeList;
            if (list != null) {
                return VerifyList(tag, list);
            }

            SchemaNodeCompound compound = schema as SchemaNodeCompound;
            if (compound != null) {
                return VerifyCompound(tag, compound);
            }

            return OnInvalidTagType(new TagEventArgs(schema.Name, tag));
        }
Example #7
0
 /// <summary>
 /// Constructs a new event argument set.
 /// </summary>
 /// <param name="schema">The <see cref="SchemaNode"/> corresponding to the <see cref="TagNode"/> involved in this event.</param>
 /// <param name="tag">The <see cref="TagNode"/> involved in this event.</param>
 public TagEventArgs(SchemaNode schema, TagNode tag)
     : base()
 {
     _tag    = tag;
     _schema = schema;
 }
Example #8
0
 /// <summary>
 /// Constructs a new <see cref="NbtVerifier"/> object for a given NBT tree and schema.
 /// </summary>
 /// <param name="root">A <see cref="TagNode"/> representing the root of an NBT tree.</param>
 /// <param name="schema">A <see cref="SchemaNode"/> representing the root of a schema definition for the NBT tree.</param>
 public NbtVerifier(TagNode root, SchemaNode schema)
 {
     _root   = root;
     _schema = schema;
 }
Example #9
0
 /// <summary>
 /// Constructs a new <see cref="SchemaNodeList"/> representing a <see cref="TagNodeList"/> named <paramref name="name"/> containing items of type <paramref name="type"/> matching the given schema.
 /// </summary>
 /// <param name="name">The name of the corresponding <see cref="TagNodeList"/>.</param>
 /// <param name="type">The type of items contained in the corresponding <see cref="TagNodeList"/>.</param>
 /// <param name="subschema">A <see cref="SchemaNode"/> representing a schema to verify against items contained in the corresponding <see cref="TagNodeList"/>.</param>
 public SchemaNodeList(string name, TagType type, SchemaNode subschema)
     : base(name)
 {
     _type      = type;
     _subschema = subschema;
 }
Example #10
0
 /// <summary>
 /// Constructs a new <see cref="SchemaNodeList"/> with additional options.
 /// </summary>
 /// <param name="name">The name of the corresponding <see cref="TagNodeList"/>.</param>
 /// <param name="type">The type of items contained in the corresponding <see cref="TagNodeList"/>.</param>
 /// <param name="length">The number of items contained in the corresponding <see cref="TagNodeList"/>.</param>
 /// <param name="subschema">A <see cref="SchemaNode"/> representing a schema to verify against items contained in the corresponding <see cref="TagNodeList"/>.</param>
 /// <param name="options">One or more option flags modifying the processing of this node.</param>
 public SchemaNodeList (string name, TagType type, int length, SchemaNode subschema, SchemaOptions options)
     : base(name, options)
 {
     _type = type;
     _length = length;
     _subschema = subschema;
 }
Example #11
0
 /// <summary>
 /// Constructs a new <see cref="SchemaNodeList"/> representing a <see cref="TagNodeList"/> named <paramref name="name"/> containing items of type <paramref name="type"/> matching the given schema.
 /// </summary>
 /// <param name="name">The name of the corresponding <see cref="TagNodeList"/>.</param>
 /// <param name="type">The type of items contained in the corresponding <see cref="TagNodeList"/>.</param>
 /// <param name="subschema">A <see cref="SchemaNode"/> representing a schema to verify against items contained in the corresponding <see cref="TagNodeList"/>.</param>
 public SchemaNodeList (string name, TagType type, SchemaNode subschema)
     : base(name)
 {
     _type = type;
     _subschema = subschema;
 }