protected bool InvokeParser( string line, AxiomCollection<MethodInfo> parsers )
{
string[] splitCmd = StringConverter.Split( line, new char[] { ' ', '\t' }, 2 );
// find attribute parser
if ( parsers.ContainsKey( splitCmd[ 0 ] ) )
{
string cmd = string.Empty;
if ( splitCmd.Length >= 2 )
{
cmd = splitCmd[ 1 ];
}
//MaterialAttributeParserHandler handler = (MaterialAttributeParserHandler)parsers[ splitCmd[ 0 ] ];
MethodInfo handler = (MethodInfo)parsers[ splitCmd[ 0 ] ];
// Use parser, make sure we have 2 params before using splitCmd[1]
// MONO: Does not like mangling the above and below lines into a single line (frankly, i don't blame it, but csc takes it).
// i.e. (((MaterialAttributeParserHandler)parsers[splitCmd[0]]))(cmd, scriptContext);
//return handler( cmd, scriptContext );
return (bool)handler.Invoke( null, new object[] { cmd, scriptContext } );
}
else
{
// BAD command, BAD!!
LogParseError( scriptContext, "Unrecognized command: {0}", splitCmd[ 0 ] );
return false;
}
}