Ejemplo n.º 1
0
        /// <summary>
        /// This is ran when an invalid header is found when parsing.
        /// </summary>
        public void InvalidHeaderWhenParsing(string message)
        {
            // Create EventArgs to pass around information about what happened.
            var args = new ErrorEncounteredEventArgs(ABSaveError.InvalidHeaderWhenParsing, 0, message);

            // Now, handle the error.
            HandleError(args, ABSaveError.InvalidHeaderWhenParsing, new InvalidHeaderWhenParsing(args.ToString()));
        }
Ejemplo n.º 2
0
        /// <summary>
        /// This is ran when too many constructors were found when attempting to create an object.
        /// </summary>
        public void TooManyConstructorsWithDifferentCase(Type type, int location)
        {
            // Create EventArgs to pass around information about what happened.
            var args = new ErrorEncounteredEventArgs(ABSaveError.TooManyConstructorsWithDifferentCase, location, "When creating an instance of an object, there were too many constructors with matching names to the fields/properties (when ignoring case)... As a result, ABSave cannot determine which constructor to use. This is with the type '" + type.ToString() + "'.");

            // Now, handle the error.
            HandleError(args, ABSaveError.TooManyConstructorsWithDifferentCase, new TooManyConstructorsWithDifferentCase(args.ToString()));
        }
Ejemplo n.º 3
0
        /// <summary>
        /// This is ran when an "Infer Type" is passed when serializing.
        /// </summary>
        public void InferTypeWhenSerializing()
        {
            // Create EventArgs to pass around information about what happened.
            var args = new ErrorEncounteredEventArgs(ABSaveError.InferTypeWhenSerializing, 0);

            // Now, handle the error.
            HandleError(args, ABSaveError.InferTypeWhenSerializing, new InferABSaveTypeWhenSerializing(args.ToString()));
        }
Ejemplo n.º 4
0
        /// <summary>
        /// This is ran when there is a missing name for a value.
        /// </summary>
        /// <param name="location"></param>
        public void MissingNameToValueWhenParsing(int location)
        {
            // Create EventArgs to pass around information about what happened.
            var args = new ErrorEncounteredEventArgs(ABSaveError.MissingNameToValueWhenParsing, location, "A value has been found without a matching name.");

            // Now, handle the error.
            HandleError(args, ABSaveError.MissingNameToValueWhenParsing, new MissingNameToValueWhenParsing(args.ToString()));
        }
Ejemplo n.º 5
0
        /// <summary>
        /// This is ran when there are more "Next Item" tokens than actual items.
        /// </summary>
        public void MoreNextItemTokensThanItems(int location)
        {
            // Create EventArgs to pass around information about what happened.
            var args = new ErrorEncounteredEventArgs(ABSaveError.MoreNextItemTokensThanItems, location, "There were more 'next item' tokens than there were fields/properties on an object.");

            // Now, handle the error.
            HandleError(args, ABSaveError.MoreNextItemTokensThanItems, new MoreNextItemTokensThanActualItems(args.ToString()));
        }
Ejemplo n.º 6
0
        /// <summary>
        /// This is ran when there is an unexpected token when parsing.
        /// </summary>
        public void UnexpectedTokenWhenParsing(int location, string message)
        {
            // Create EventArgs to pass around information about what happened.
            var args = new ErrorEncounteredEventArgs(ABSaveError.UnexpectedTokenWhenParsing, location, message);

            // Now, handle the error.
            HandleError(args, ABSaveError.UnexpectedTokenWhenParsing, new UnexpectedTokenWhenParsing(args.ToString()));
        }
Ejemplo n.º 7
0
        /// <summary>
        /// This is ran when a valid constructor can not be found when creating an instance of an object.
        /// </summary>
        public void InvalidConstructorsForCreatingObject(Type type, int location)
        {
            // Create EventArgs to pass around information about what happened.
            var args = new ErrorEncounteredEventArgs(ABSaveError.InvalidConstructorsForCreatingObject, location, "A valid constructor cannot be found for the type: " + type.ToString());

            // Now, handle the error.
            HandleError(args, ABSaveError.InvalidConstructorsForCreatingObject, new InvalidConstructorsWhenCreatingObject(args.ToString()));
        }