internal void ErrorParsingNode(VRMLReaderError error, Exception reason, X3DNode node, string fieldName, X3DNode value, int line)
		{
			if(error==VRMLReaderError.UnexpectedNodeType)
			{
				if(errorHandling.UnexpectedNodeType!=ErrorWarnIgnore.Ignore)
				{
					string msg="Error parsing node: Unexpected type while parsing node: '"+node.GetNodeName()+"' field: '"+fieldName+"'";
					if(value!=null) msg+=" found: '"+value.GetNodeName()+"'";
					msg+=" in line: "+line;
					WriteWarning(msg);
				}
				if(errorHandling.UnexpectedNodeType!=ErrorWarnIgnore.Error) return;
			}
			else if(error==VRMLReaderError.UnknownFieldInNode)
			{
				if(errorHandling.UnknownFieldInNode!=ErrorWarnIgnore.Ignore)
				{
					string msg="Error parsing node: Unknown field while parsing node: '"+node.GetNodeName()+"' field: '"+fieldName+"' in line: "+line;
					WriteWarning(msg);
				}
				if(errorHandling.UnknownFieldInNode!=ErrorWarnIgnore.Error) return;
			}
			else if(error==VRMLReaderError.SFImageInvalid)
			{
				string msg="Error parsing node: Could not parse SFImage value while parsing node: '"+node.GetNodeName()+"' field: '"+fieldName+"' in line: "+line;
				WriteWarning(msg);
			}
			
			throw new VRMLReaderException(error, reason, line);
		}
Exemple #2
0
 internal void ErrorParsingField(VRMLReaderError error, Exception reason)
 {
     WriteWarning(VRMLReaderException.VRMLReaderErrorToMessageString(error, line));
     if (reason != null)
     {
         WriteWarning("Reason: " + reason.ToString());
     }
     throw new VRMLReaderException(error, reason, line);
 }
		internal static string VRMLReaderErrorToMessageString(VRMLReaderError message, int line)
		{
			switch(message)
			{
				case VRMLReaderError.UnexpectedEndOfStream: return string.Format("Error: Unexpected end of stream/file.");
				case VRMLReaderError.IllegalCharacterInStream: return string.Format("Error: Illegal character found in stream/file in line: {0}", line);
				case VRMLReaderError.PROTOAlreadyDefined: return string.Format("Error: (EXTERN)PROTO definition already defined in line: {0}", line);
				case VRMLReaderError.MultipleISStatementForField: return string.Format("Error: Multiple IS statement for field in line: {0}", line);
				case VRMLReaderError.UnexpectedNodeType: return string.Format("Error: Node of unexpected type in line: {0}", line);
				case VRMLReaderError.UnknownFieldInNode: return string.Format("Error: Unknown field node in line: {0}", line);
				case VRMLReaderError.ProtoFound: return string.Format("Error: (EXTERN)PROTO node used in line: {0}", line);

				case VRMLReaderError.SFBoolInvalid: return string.Format("Error parsing SFBool field in line: {0}", line);
				case VRMLReaderError.SFColorInvalid: return string.Format("Error parsing SFColor field in line: {0}", line);
				case VRMLReaderError.SFColorRGBAInvalid: return string.Format("Error parsing SFColorRGBA field in line: {0}", line);
				case VRMLReaderError.SFFloatInvalid: return string.Format("Error parsing SFFloat/SFDouble field in line: {0}", line);
				case VRMLReaderError.SFImageInvalid: return string.Format("Error parsing SFImage field in line: {0}", line);
				case VRMLReaderError.SFInt32Invalid: return string.Format("Error parsing SFInt32 field in line: {0}", line);
				case VRMLReaderError.SFMatrix3fInvalid: return string.Format("Error parsing SFMatrix3(f/d) field in line: {0}", line);
				case VRMLReaderError.SFMatrix4fInvalid: return string.Format("Error parsing SFMatrix4(f/d) field in line: {0}", line);
				case VRMLReaderError.SFNodeInvalid: return string.Format("Error parsing SFNode field in line: {0}", line);
				case VRMLReaderError.SFRotationInvalid: return string.Format("Error parsing SFRotation field in line: {0}", line);
				case VRMLReaderError.SFStringInvalid: return string.Format("Error parsing SFString field in line: {0}", line);
				case VRMLReaderError.SFTimeInvalid: return string.Format("Error parsing SFTime field in line: {0}", line);
				case VRMLReaderError.SFVec2fInvalid: return string.Format("Error parsing SFVec2(f/d) field in line: {0}", line);
				case VRMLReaderError.SFVec3fInvalid: return string.Format("Error parsing SFVec3(f/d) field in line: {0}", line);
				case VRMLReaderError.SFVec4fInvalid: return string.Format("Error parsing SFVec4(f/d) field in line: {0}", line);
				case VRMLReaderError.MFBoolInvalid: return string.Format("Error parsing MFBool field in line: {0}", line);
				case VRMLReaderError.MFColorInvalid: return string.Format("Error parsing MFColor field in line: {0}", line);
				case VRMLReaderError.MFColorRGBAInvalid: return string.Format("Error parsing MFColorRGBA field in line: {0}", line);
				case VRMLReaderError.MFFloatInvalid: return string.Format("Error parsing MFFloat/MFDouble field in line: {0}", line);
				case VRMLReaderError.MFImageInvalid: return string.Format("Error parsing MFImage field in line: {0}", line);
				case VRMLReaderError.MFInt32Invalid: return string.Format("Error parsing MFInt32 field in line: {0}", line);
				case VRMLReaderError.MFMatrix3fInvalid: return string.Format("Error parsing MFMatrix3(f/d) field in line: {0}", line);
				case VRMLReaderError.MFMatrix4fInvalid: return string.Format("Error parsing MFMatrix4(f/d) field in line: {0}", line);
				case VRMLReaderError.MFNodeInvalid: return string.Format("Error parsing MFNode field in line: {0}", line);
				case VRMLReaderError.MFRotationInvalid: return string.Format("Error parsing MFRotation field in line: {0}", line);
				case VRMLReaderError.MFStringInvalid: return string.Format("Error parsing MFString field in line: {0}", line);
				case VRMLReaderError.MFTimeInvalid: return string.Format("Error parsing MFTime field in line: {0}", line);
				case VRMLReaderError.MFVec2fInvalid: return string.Format("Error parsing MFVec2(f/d) field in line: {0}", line);
				case VRMLReaderError.MFVec3fInvalid: return string.Format("Error parsing MFVec3(f/d) field in line: {0}", line);
				case VRMLReaderError.MFVec4fInvalid: return string.Format("Error parsing MFVec4(f/d) field in line: {0}", line);

				case VRMLReaderError.USENameNotDefined: return string.Format("Error: Name in USE statement is not defined in line: {0}", line);
				case VRMLReaderError.RouteSourceNameNotDefined: return string.Format("Error: Source name of ROUTE statement is not defined in line: {0}", line);
				case VRMLReaderError.RouteTargetNameNotDefined: return string.Format("Error: Target name of ROUTE statement is not defined in line: {0}", line);
				case VRMLReaderError.RedundantISStatement: return string.Format("Error: Redundant IS statement for field in line: {0}", line);
				case VRMLReaderError.ImproperInitializationOfMFNode: return string.Format("Error: Improper initialization of MFNode in line: {0}", line);
			}

			return string.Format("Error: Unknown error while reading VRML stream/file in line: {0}", line);
		}
Exemple #4
0
        internal void ErrorParsing(VRMLReaderError error, string nodeTypeId)
        {
            if (error == VRMLReaderError.ProtoFound)
            {
                WriteWarning("Error: (EXTERN)PROTO node used: '" + nodeTypeId + "' in line: " + line);
            }
            else if (error == VRMLReaderError.UnexpectedNodeType)
            {
                WriteWarning("Error: Node of unexpected type: '" + nodeTypeId + "' in line: " + line);
            }

            throw new VRMLReaderException(error, line);
        }
Exemple #5
0
        internal void ErrorParsingNode(VRMLReaderError error, Exception reason, X3DNode node, string fieldName, X3DNode value, int line)
        {
            if (error == VRMLReaderError.UnexpectedNodeType)
            {
                if (errorHandling.UnexpectedNodeType != ErrorWarnIgnore.Ignore)
                {
                    string msg = "Error parsing node: Unexpected type while parsing node: '" + node.GetNodeName() + "' field: '" + fieldName + "'";
                    if (value != null)
                    {
                        msg += " found: '" + value.GetNodeName() + "'";
                    }
                    msg += " in line: " + line;
                    WriteWarning(msg);
                }
                if (errorHandling.UnexpectedNodeType != ErrorWarnIgnore.Error)
                {
                    return;
                }
            }
            else if (error == VRMLReaderError.UnknownFieldInNode)
            {
                if (errorHandling.UnknownFieldInNode != ErrorWarnIgnore.Ignore)
                {
                    string msg = "Error parsing node: Unknown field while parsing node: '" + node.GetNodeName() + "' field: '" + fieldName + "' in line: " + line;
                    WriteWarning(msg);
                }
                if (errorHandling.UnknownFieldInNode != ErrorWarnIgnore.Error)
                {
                    return;
                }
            }
            else if (error == VRMLReaderError.SFImageInvalid)
            {
                string msg = "Error parsing node: Could not parse SFImage value while parsing node: '" + node.GetNodeName() + "' field: '" + fieldName + "' in line: " + line;
                WriteWarning(msg);
            }

            throw new VRMLReaderException(error, reason, line);
        }
		internal VRMLReaderException(VRMLReaderError message, int line)
			: base(VRMLReaderErrorToMessageString(message, line))
		{
			this.message=message;
			this.line=line;
		}
Exemple #7
0
 internal void ErrorParsingNode(VRMLReaderError error, X3DNode node, string fieldName, X3DNode value, int line)
 {
     ErrorParsingNode(error, null, node, fieldName, value, line);
 }
		internal void ErrorParsing(VRMLReaderError error, int line)
		{
			if(error==VRMLReaderError.RedundantISStatement)
			{
				if(errorHandling.RedundantISStatement!=ErrorWarnIgnore.Ignore)
					WriteWarning("Warning: Redundant IS statement for field in line: "+line);
				if(errorHandling.RedundantISStatement!=ErrorWarnIgnore.Error) return;
			}
			else if(error==VRMLReaderError.ImproperInitializationOfMFNode)
			{
				if(errorHandling.ImproperInitializationOfMFNode!=ErrorWarnIgnore.Ignore)
				WriteWarning("Warning: Improper initialization of MFNode in line: "+line);
				if(errorHandling.ImproperInitializationOfMFNode!=ErrorWarnIgnore.Error) return;
			}
			else if(error==VRMLReaderError.MultipleISStatementForField)
			{
				if(errorHandling.MultipleISStatementForField!=ErrorWarnIgnore.Ignore)
				WriteWarning("Warning: Multiple IS statement for field in line: "+line);
				if(errorHandling.MultipleISStatementForField!=ErrorWarnIgnore.Error) return;
			}
			else if(error==VRMLReaderError.RouteSourceNameNotDefined)
			{
				if(errorHandling.RouteSourceNameNotDefined!=ErrorWarnIgnore.Ignore)
				WriteWarning("Warning: Source name of ROUTE statement is not defined in line: "+line);
				if(errorHandling.RouteSourceNameNotDefined!=ErrorWarnIgnore.Error) return;
			}
			else if(error==VRMLReaderError.RouteTargetNameNotDefined)
			{
				if(errorHandling.RouteTargetNameNotDefined!=ErrorWarnIgnore.Ignore)
				WriteWarning("Warning: Target name of ROUTE statement is not defined in line: "+line);
				if(errorHandling.RouteTargetNameNotDefined!=ErrorWarnIgnore.Error) return;
			}
			else if(error==VRMLReaderError.USENameNotDefined)
			{
				if(errorHandling.USENameNotDefined!=ErrorWarnIgnore.Ignore)
				WriteWarning("Warning: Name in USE statement is not defined in line: "+line);
				if(errorHandling.USENameNotDefined!=ErrorWarnIgnore.Error) return;
			}
			else if(error==VRMLReaderError.PROTOAlreadyDefined)
			{
				if(errorHandling.PROTOAlreadyDefined!=ErrorWarnIgnore.Ignore)
				WriteWarning("Warning: (EXTERN)PROTO definition already defined in line: "+line);
				if(errorHandling.PROTOAlreadyDefined!=ErrorWarnIgnore.Error) return;
			}
			else if(error==VRMLReaderError.UnexpectedNodeType)
			{
				if(errorHandling.UnexpectedNodeType!=ErrorWarnIgnore.Ignore)
				WriteWarning("Warning: Node of unexpected type in line: "+line);
				if(errorHandling.UnexpectedNodeType!=ErrorWarnIgnore.Error) return;
			}

			throw new VRMLReaderException(error, line);
		}
Exemple #9
0
        internal void ErrorParsing(VRMLReaderError error, int line)
        {
            if (error == VRMLReaderError.RedundantISStatement)
            {
                if (errorHandling.RedundantISStatement != ErrorWarnIgnore.Ignore)
                {
                    WriteWarning("Warning: Redundant IS statement for field in line: " + line);
                }
                if (errorHandling.RedundantISStatement != ErrorWarnIgnore.Error)
                {
                    return;
                }
            }
            else if (error == VRMLReaderError.ImproperInitializationOfMFNode)
            {
                if (errorHandling.ImproperInitializationOfMFNode != ErrorWarnIgnore.Ignore)
                {
                    WriteWarning("Warning: Improper initialization of MFNode in line: " + line);
                }
                if (errorHandling.ImproperInitializationOfMFNode != ErrorWarnIgnore.Error)
                {
                    return;
                }
            }
            else if (error == VRMLReaderError.MultipleISStatementForField)
            {
                if (errorHandling.MultipleISStatementForField != ErrorWarnIgnore.Ignore)
                {
                    WriteWarning("Warning: Multiple IS statement for field in line: " + line);
                }
                if (errorHandling.MultipleISStatementForField != ErrorWarnIgnore.Error)
                {
                    return;
                }
            }
            else if (error == VRMLReaderError.RouteSourceNameNotDefined)
            {
                if (errorHandling.RouteSourceNameNotDefined != ErrorWarnIgnore.Ignore)
                {
                    WriteWarning("Warning: Source name of ROUTE statement is not defined in line: " + line);
                }
                if (errorHandling.RouteSourceNameNotDefined != ErrorWarnIgnore.Error)
                {
                    return;
                }
            }
            else if (error == VRMLReaderError.RouteTargetNameNotDefined)
            {
                if (errorHandling.RouteTargetNameNotDefined != ErrorWarnIgnore.Ignore)
                {
                    WriteWarning("Warning: Target name of ROUTE statement is not defined in line: " + line);
                }
                if (errorHandling.RouteTargetNameNotDefined != ErrorWarnIgnore.Error)
                {
                    return;
                }
            }
            else if (error == VRMLReaderError.USENameNotDefined)
            {
                if (errorHandling.USENameNotDefined != ErrorWarnIgnore.Ignore)
                {
                    WriteWarning("Warning: Name in USE statement is not defined in line: " + line);
                }
                if (errorHandling.USENameNotDefined != ErrorWarnIgnore.Error)
                {
                    return;
                }
            }
            else if (error == VRMLReaderError.PROTOAlreadyDefined)
            {
                if (errorHandling.PROTOAlreadyDefined != ErrorWarnIgnore.Ignore)
                {
                    WriteWarning("Warning: (EXTERN)PROTO definition already defined in line: " + line);
                }
                if (errorHandling.PROTOAlreadyDefined != ErrorWarnIgnore.Error)
                {
                    return;
                }
            }
            else if (error == VRMLReaderError.UnexpectedNodeType)
            {
                if (errorHandling.UnexpectedNodeType != ErrorWarnIgnore.Ignore)
                {
                    WriteWarning("Warning: Node of unexpected type in line: " + line);
                }
                if (errorHandling.UnexpectedNodeType != ErrorWarnIgnore.Error)
                {
                    return;
                }
            }

            throw new VRMLReaderException(error, line);
        }
Exemple #10
0
 internal void ErrorParsing(VRMLReaderError error)
 {
     ErrorParsing(error, line);
 }
		internal void ErrorParsingNode(VRMLReaderError error, X3DNode node, string fieldName, X3DNode value, int line)
		{
			ErrorParsingNode(error, null, node, fieldName, value, line);
		}
		internal void ErrorParsingField(VRMLReaderError error, Exception reason)
		{
			WriteWarning(VRMLReaderException.VRMLReaderErrorToMessageString(error, line));
			if(reason!=null) WriteWarning("Reason: "+reason.ToString());
			throw new VRMLReaderException(error, reason, line);
		}
		internal void ErrorParsingField(VRMLReaderError error)
		{
			ErrorParsingField(error, null);
		}
		internal void ErrorParsing(VRMLReaderError error, string nodeTypeId)
		{
			if(error==VRMLReaderError.ProtoFound) WriteWarning("Error: (EXTERN)PROTO node used: '"+nodeTypeId+"' in line: "+line);
			else if(error==VRMLReaderError.UnexpectedNodeType) WriteWarning("Error: Node of unexpected type: '"+nodeTypeId+"' in line: "+line);

			throw new VRMLReaderException(error, line);
		}
        internal static string VRMLReaderErrorToMessageString(VRMLReaderError message, int line)
        {
            switch (message)
            {
            case VRMLReaderError.UnexpectedEndOfStream: return(string.Format("Error: Unexpected end of stream/file."));

            case VRMLReaderError.IllegalCharacterInStream: return(string.Format("Error: Illegal character found in stream/file in line: {0}", line));

            case VRMLReaderError.PROTOAlreadyDefined: return(string.Format("Error: (EXTERN)PROTO definition already defined in line: {0}", line));

            case VRMLReaderError.MultipleISStatementForField: return(string.Format("Error: Multiple IS statement for field in line: {0}", line));

            case VRMLReaderError.UnexpectedNodeType: return(string.Format("Error: Node of unexpected type in line: {0}", line));

            case VRMLReaderError.UnknownFieldInNode: return(string.Format("Error: Unknown field node in line: {0}", line));

            case VRMLReaderError.ProtoFound: return(string.Format("Error: (EXTERN)PROTO node used in line: {0}", line));

            case VRMLReaderError.SFBoolInvalid: return(string.Format("Error parsing SFBool field in line: {0}", line));

            case VRMLReaderError.SFColorInvalid: return(string.Format("Error parsing SFColor field in line: {0}", line));

            case VRMLReaderError.SFColorRGBAInvalid: return(string.Format("Error parsing SFColorRGBA field in line: {0}", line));

            case VRMLReaderError.SFFloatInvalid: return(string.Format("Error parsing SFFloat/SFDouble field in line: {0}", line));

            case VRMLReaderError.SFImageInvalid: return(string.Format("Error parsing SFImage field in line: {0}", line));

            case VRMLReaderError.SFInt32Invalid: return(string.Format("Error parsing SFInt32 field in line: {0}", line));

            case VRMLReaderError.SFMatrix3fInvalid: return(string.Format("Error parsing SFMatrix3(f/d) field in line: {0}", line));

            case VRMLReaderError.SFMatrix4fInvalid: return(string.Format("Error parsing SFMatrix4(f/d) field in line: {0}", line));

            case VRMLReaderError.SFNodeInvalid: return(string.Format("Error parsing SFNode field in line: {0}", line));

            case VRMLReaderError.SFRotationInvalid: return(string.Format("Error parsing SFRotation field in line: {0}", line));

            case VRMLReaderError.SFStringInvalid: return(string.Format("Error parsing SFString field in line: {0}", line));

            case VRMLReaderError.SFTimeInvalid: return(string.Format("Error parsing SFTime field in line: {0}", line));

            case VRMLReaderError.SFVec2fInvalid: return(string.Format("Error parsing SFVec2(f/d) field in line: {0}", line));

            case VRMLReaderError.SFVec3fInvalid: return(string.Format("Error parsing SFVec3(f/d) field in line: {0}", line));

            case VRMLReaderError.SFVec4fInvalid: return(string.Format("Error parsing SFVec4(f/d) field in line: {0}", line));

            case VRMLReaderError.MFBoolInvalid: return(string.Format("Error parsing MFBool field in line: {0}", line));

            case VRMLReaderError.MFColorInvalid: return(string.Format("Error parsing MFColor field in line: {0}", line));

            case VRMLReaderError.MFColorRGBAInvalid: return(string.Format("Error parsing MFColorRGBA field in line: {0}", line));

            case VRMLReaderError.MFFloatInvalid: return(string.Format("Error parsing MFFloat/MFDouble field in line: {0}", line));

            case VRMLReaderError.MFImageInvalid: return(string.Format("Error parsing MFImage field in line: {0}", line));

            case VRMLReaderError.MFInt32Invalid: return(string.Format("Error parsing MFInt32 field in line: {0}", line));

            case VRMLReaderError.MFMatrix3fInvalid: return(string.Format("Error parsing MFMatrix3(f/d) field in line: {0}", line));

            case VRMLReaderError.MFMatrix4fInvalid: return(string.Format("Error parsing MFMatrix4(f/d) field in line: {0}", line));

            case VRMLReaderError.MFNodeInvalid: return(string.Format("Error parsing MFNode field in line: {0}", line));

            case VRMLReaderError.MFRotationInvalid: return(string.Format("Error parsing MFRotation field in line: {0}", line));

            case VRMLReaderError.MFStringInvalid: return(string.Format("Error parsing MFString field in line: {0}", line));

            case VRMLReaderError.MFTimeInvalid: return(string.Format("Error parsing MFTime field in line: {0}", line));

            case VRMLReaderError.MFVec2fInvalid: return(string.Format("Error parsing MFVec2(f/d) field in line: {0}", line));

            case VRMLReaderError.MFVec3fInvalid: return(string.Format("Error parsing MFVec3(f/d) field in line: {0}", line));

            case VRMLReaderError.MFVec4fInvalid: return(string.Format("Error parsing MFVec4(f/d) field in line: {0}", line));

            case VRMLReaderError.USENameNotDefined: return(string.Format("Error: Name in USE statement is not defined in line: {0}", line));

            case VRMLReaderError.RouteSourceNameNotDefined: return(string.Format("Error: Source name of ROUTE statement is not defined in line: {0}", line));

            case VRMLReaderError.RouteTargetNameNotDefined: return(string.Format("Error: Target name of ROUTE statement is not defined in line: {0}", line));

            case VRMLReaderError.RedundantISStatement: return(string.Format("Error: Redundant IS statement for field in line: {0}", line));

            case VRMLReaderError.ImproperInitializationOfMFNode: return(string.Format("Error: Improper initialization of MFNode in line: {0}", line));
            }

            return(string.Format("Error: Unknown error while reading VRML stream/file in line: {0}", line));
        }
Exemple #16
0
 internal void ErrorParsingField(VRMLReaderError error)
 {
     ErrorParsingField(error, null);
 }
 internal VRMLReaderException(VRMLReaderError message, int line)
     : base(VRMLReaderErrorToMessageString(message, line))
 {
     this.message = message;
     this.line    = line;
 }
		internal void ErrorParsing(VRMLReaderError error)
		{
			ErrorParsing(error, line);
		}