protected virtual string ParseCommand( IKCommand node, KParameterList pars = null ) { // Getting the command's text... string str = node.CommandText( iterable: false ); // Avoiding spurious "OUTPUT XXX" statements // If there are parameters to transform, but cannot store them, it is an error if( node.Parameters.Count != 0 && pars == null ) throw new InvalidOperationException( "Cannot parse IKCommand because the receiving parameters collection is null." ); // Transforming the parameters using names compatible with this command string and context foreach( var parameter in node.Parameters ) { KParameter neo = pars.Insert( parameter.Value ); str = str.Replace( parameter.Name, neo.Name ); } return str; }
protected virtual string ParseConstant( object node, KParameterList pars = null ) { if( node == null ) return ParseNull(); if( pars != null ) { // If we have a list of parameters to store it, let's parametrize it var par = pars.Insert( node ); return par.Name; } return node.ToString(); // Last resort case }