Ejemplo n.º 1
0
        /// <summary>
        /// Processes registered events for <see cref="MissingTag"/> whenever an expected <see cref="TagNode"/> is not found.
        /// </summary>
        /// <param name="e">Arguments for this event.</param>
        /// <returns>Status indicating whether this event can be ignored.</returns>
        protected virtual bool OnMissingTag(TagEventArgs e)
        {
            if (MissingTag != null) {
                foreach (VerifierEventHandler func in MissingTag.GetInvocationList()) {
                    TagEventCode code = func(e);
                    switch (code) {
                        case TagEventCode.FAIL:
                            return false;
                        case TagEventCode.PASS:
                            return true;
                    }
                }
            }

            return false;
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Logs an occurance of an invalid tag value error, and advances to the next event in the event chain.
        /// </summary>
        /// <param name="e">Data about the NBT node being verified.</param>
        /// <returns>A <see cref="TagEventCode"/> indicating whether event processing should pass, fail, or advance.</returns>
        public static TagEventCode InvalidTagValueHandler(TagEventArgs e)
        {
            Console.WriteLine("Invalid Tag Value Error: '{0}' of type '{1}' is set to invalid value '{2}'", e.TagName, e.Tag.GetTagType(), e.Tag.ToString());

            return TagEventCode.NEXT;
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Logs an occurance of a missing tag error, and advances to the next event in the event chain.
        /// </summary>
        /// <param name="e">Data about the NBT node being verified.</param>
        /// <returns>A <see cref="TagEventCode"/> indicating whether event processing should pass, fail, or advance.</returns>
        public static TagEventCode MissingTagHandler(TagEventArgs e)
        {
            Console.WriteLine("Missing Tag Error: '{0}'", e.TagName);

            return TagEventCode.NEXT;
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Logs an occurance of an invalid tag type error, and advances to the next event in the event chain.
        /// </summary>
        /// <param name="e">Data about the NBT node being verified.</param>
        /// <returns>A <see cref="TagEventCode"/> indicating whether event processing should pass, fail, or advance.</returns>
        public static TagEventCode InvalidTagTypeHandler(TagEventArgs e)
        {
            Console.WriteLine("Invalid Tag Type Error: '{0}' has type '{1}', expected '{2}'", e.TagName, e.Tag.GetTagType(), e.Schema.ToString());

            return TagEventCode.NEXT;
        }