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))); }
private bool VerifyArray(TagNode tag, SchemaNodeArray schema) { TagNodeByteArray atag = tag as TagNodeByteArray; if (atag == null) { if (!OnInvalidTagType(new TagEventArgs(schema, tag))) { return(false); } } if (schema.Length > 0 && atag.Length != schema.Length) { if (!OnInvalidTagValue(new TagEventArgs(schema, tag))) { return(false); } } return(true); }
private bool VerifyArray(TagNode tag, SchemaNodeArray schema) { TagNodeByteArray atag = tag as TagNodeByteArray; if (atag == null) { if (!OnInvalidTagType(new TagEventArgs(schema, tag))) { return false; } } if (schema.Length > 0 && atag.Length != schema.Length) { if (!OnInvalidTagValue(new TagEventArgs(schema, tag))) { return false; } } return true; }