public override Task<bool> ReadAsync()
{
switch (_validationState)
{
case ValidatingReaderState.Read:
Task<bool> readTask = _coreReader.ReadAsync();
return ReadAsync_Read(readTask);
case ValidatingReaderState.ParseInlineSchema:
return ProcessInlineSchemaAsync().ReturnTrueTaskWhenFinishAsync();
case ValidatingReaderState.OnAttribute:
case ValidatingReaderState.OnDefaultAttribute:
case ValidatingReaderState.ClearAttributes:
case ValidatingReaderState.OnReadAttributeValue:
ClearAttributesInfo();
if (_inlineSchemaParser != null)
{
_validationState = ValidatingReaderState.ParseInlineSchema;
goto case ValidatingReaderState.ParseInlineSchema;
}
else
{
_validationState = ValidatingReaderState.Read;
goto case ValidatingReaderState.Read;
}
case ValidatingReaderState.ReadAhead: //Will enter here on calling Skip()
ClearAttributesInfo();
Task task = ProcessReaderEventAsync();
return ReadAsync_ReadAhead(task);
case ValidatingReaderState.OnReadBinaryContent:
_validationState = _savedState;
return _readBinaryHelper.FinishAsync().CallBoolTaskFuncWhenFinishAsync(thisRef => thisRef.ReadAsync(), this);
case ValidatingReaderState.Init:
_validationState = ValidatingReaderState.Read;
if (_coreReader.ReadState == ReadState.Interactive)
{ //If the underlying reader is already positioned on a ndoe, process it
return ProcessReaderEventAsync().ReturnTrueTaskWhenFinishAsync();
}
else
{
goto case ValidatingReaderState.Read;
}
case ValidatingReaderState.ReaderClosed:
case ValidatingReaderState.EOF:
return AsyncHelper.DoneTaskFalse;
default:
return AsyncHelper.DoneTaskFalse;
}
}