//--------------------------------------------------------------------- private bool ReadVariable(InputVariable var, bool optional) { if (var == null) { throw new System.ArgumentNullException(); } if (VariableNameMatches(var.Name, optional)) { // Read the variable's value StringReader strReader = new StringReader(textAfterName); try { var.ReadValue(strReader); } catch (InputVariableException exc) { throw new LineReaderException(reader, exc); } TextReader.SkipWhitespace(strReader); string textAfterValue = strReader.ReadToEnd(); if (textAfterValue.Length == 0) { return(true); } string message = string.Format("Extra text after the value for \"{0}\"", var.Name); throw ExtraTextException(message, textAfterValue); } return(false); }
//--------------------------------------------------------------------- /// <summary> /// Reads the value of an input variable from the current line. /// </summary> /// <exception cref="InputValueException"> /// </exception> /// <remarks> /// This method is used for reading column values from a table. The /// current line is a row in the table. /// </remarks> protected void ReadValue(InputVariable var, StringReader currentLine) { Require.ArgumentNotNull(var); Require.ArgumentNotNull(currentLine); var.ReadValue(currentLine); SetCurrentVar(var); }