Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ IncrementalRead() [1/2]

int System.Xml.XmlTextReaderImpl.IncrementalRead ( )
inlineprivate

Definition at line 7360 of file XmlTextReaderImpl.cs.

7361 {
7362 int num = 0;
7363 int num3;
7364 while (true)
7365 {
7367 if (num2 > 0)
7368 {
7369 try
7370 {
7372 }
7373 catch (XmlException e)
7374 {
7376 return 0;
7377 }
7378 if (num3 < num2)
7379 {
7382 return num3;
7383 }
7388 {
7389 break;
7390 }
7391 }
7392 int outStartPos = 0;
7393 int outEndPos = 0;
7394 while (true)
7395 {
7396 switch (_incReadState)
7397 {
7398 case IncrementalReadState.PI:
7400 {
7401 _ps.charPos -= 2;
7402 _incReadState = IncrementalReadState.Text;
7403 }
7404 break;
7405 case IncrementalReadState.Comment:
7406 if (ParseCDataOrComment(XmlNodeType.Comment, out outStartPos, out outEndPos))
7407 {
7408 _ps.charPos -= 3;
7409 _incReadState = IncrementalReadState.Text;
7410 }
7411 break;
7412 case IncrementalReadState.CDATA:
7413 if (ParseCDataOrComment(XmlNodeType.CDATA, out outStartPos, out outEndPos))
7414 {
7415 _ps.charPos -= 3;
7416 _incReadState = IncrementalReadState.Text;
7417 }
7418 break;
7419 case IncrementalReadState.EndElement:
7420 _parsingFunction = ParsingFunction.PopElementContext;
7421 _nextParsingFunction = ((_index <= 0 && _fragmentType == XmlNodeType.Document) ? ParsingFunction.DocumentContent : ParsingFunction.ElementContent);
7423 _incReadState = IncrementalReadState.End;
7424 goto case IncrementalReadState.End;
7425 case IncrementalReadState.End:
7426 return num;
7427 case IncrementalReadState.ReadData:
7428 if (ReadData() == 0)
7429 {
7431 }
7432 _incReadState = IncrementalReadState.Text;
7435 goto default;
7436 default:
7437 {
7438 char[] chars = _ps.chars;
7441 while (true)
7442 {
7444 if (_incReadState == IncrementalReadState.Attributes)
7445 {
7446 char c;
7447 while (XmlCharType.IsAttributeValueChar(c = chars[outEndPos]) && c != '/')
7448 {
7449 outEndPos++;
7450 }
7451 }
7452 else
7453 {
7454 char c;
7455 while (XmlCharType.IsAttributeValueChar(c = chars[outEndPos]))
7456 {
7457 outEndPos++;
7458 }
7459 }
7460 if (chars[outEndPos] == '&' || chars[outEndPos] == '\t')
7461 {
7462 outEndPos++;
7463 continue;
7464 }
7465 if (outEndPos - outStartPos <= 0)
7466 {
7467 char c2 = chars[outEndPos];
7468 if ((uint)c2 <= 34u)
7469 {
7470 if (c2 == '\n')
7471 {
7472 outEndPos++;
7474 continue;
7475 }
7476 if (c2 == '\r')
7477 {
7478 if (chars[outEndPos + 1] == '\n')
7479 {
7480 outEndPos += 2;
7481 }
7482 else
7483 {
7484 if (outEndPos + 1 >= _ps.charsUsed)
7485 {
7486 goto IL_0662;
7487 }
7488 outEndPos++;
7489 }
7491 continue;
7492 }
7493 if (c2 == '"')
7494 {
7495 goto IL_0600;
7496 }
7497 }
7498 else if ((uint)c2 <= 47u)
7499 {
7500 if (c2 == '\'')
7501 {
7502 goto IL_0600;
7503 }
7504 if (c2 == '/')
7505 {
7506 if (_incReadState == IncrementalReadState.Attributes)
7507 {
7508 if (_ps.charsUsed - outEndPos < 2)
7509 {
7510 goto IL_0662;
7511 }
7512 if (chars[outEndPos + 1] == '>')
7513 {
7514 _incReadState = IncrementalReadState.Text;
7515 _incReadDepth--;
7516 }
7517 }
7518 outEndPos++;
7519 continue;
7520 }
7521 }
7522 else
7523 {
7524 if (c2 == '<')
7525 {
7526 if (_incReadState != 0)
7527 {
7528 outEndPos++;
7529 continue;
7530 }
7531 if (_ps.charsUsed - outEndPos < 2)
7532 {
7533 goto IL_0662;
7534 }
7535 char c3 = chars[outEndPos + 1];
7536 if (c3 != '!')
7537 {
7538 switch (c3)
7539 {
7540 case '?':
7541 outEndPos += 2;
7542 _incReadState = IncrementalReadState.PI;
7543 break;
7544 case '/':
7545 {
7546 int colonPos2;
7548 if (XmlConvert.StrEqual(chars, _ps.charPos + 2, num5 - _ps.charPos - 2, _curNode.GetNameWPrefix(_nameTable)) && (_ps.chars[num5] == '>' || XmlCharType.IsWhiteSpace(_ps.chars[num5])))
7549 {
7550 if (--_incReadDepth > 0)
7551 {
7552 outEndPos = num5 + 1;
7553 continue;
7554 }
7555 _ps.charPos = num5;
7556 if (XmlCharType.IsWhiteSpace(_ps.chars[num5]))
7557 {
7558 EatWhitespaces(null);
7559 }
7560 if (_ps.chars[_ps.charPos] != '>')
7561 {
7563 }
7564 goto end_IL_00bb;
7565 }
7566 outEndPos = num5;
7568 chars = _ps.chars;
7569 continue;
7570 }
7571 default:
7572 {
7573 int colonPos;
7574 int num4 = ParseQName(isQName: true, 1, out colonPos);
7575 if (XmlConvert.StrEqual(_ps.chars, _ps.charPos + 1, num4 - _ps.charPos - 1, _curNode.localName) && (_ps.chars[num4] == '>' || _ps.chars[num4] == '/' || XmlCharType.IsWhiteSpace(_ps.chars[num4])))
7576 {
7577 _incReadDepth++;
7578 _incReadState = IncrementalReadState.Attributes;
7579 outEndPos = num4;
7580 break;
7581 }
7582 outEndPos = num4;
7584 chars = _ps.chars;
7585 continue;
7586 }
7587 }
7588 }
7589 else
7590 {
7591 if (_ps.charsUsed - outEndPos < 4)
7592 {
7593 goto IL_0662;
7594 }
7595 if (chars[outEndPos + 2] == '-' && chars[outEndPos + 3] == '-')
7596 {
7597 outEndPos += 4;
7598 _incReadState = IncrementalReadState.Comment;
7599 }
7600 else
7601 {
7602 if (_ps.charsUsed - outEndPos < 9)
7603 {
7604 goto IL_0662;
7605 }
7606 if (!XmlConvert.StrEqual(chars, outEndPos + 2, 7, "[CDATA["))
7607 {
7608 continue;
7609 }
7610 outEndPos += 9;
7611 _incReadState = IncrementalReadState.CDATA;
7612 }
7613 }
7614 goto IL_0669;
7615 }
7616 if (c2 == '>')
7617 {
7618 if (_incReadState == IncrementalReadState.Attributes)
7619 {
7620 _incReadState = IncrementalReadState.Text;
7621 }
7622 outEndPos++;
7623 continue;
7624 }
7625 }
7626 if (outEndPos != _ps.charsUsed)
7627 {
7628 outEndPos++;
7629 continue;
7630 }
7631 goto IL_0662;
7632 }
7633 goto IL_0669;
7634 IL_0669:
7636 break;
7637 IL_0662:
7638 _incReadState = IncrementalReadState.ReadData;
7639 goto IL_0669;
7640 IL_0600:
7641 switch (_incReadState)
7642 {
7643 case IncrementalReadState.AttributeValue:
7645 {
7646 _incReadState = IncrementalReadState.Attributes;
7647 }
7648 break;
7649 case IncrementalReadState.Attributes:
7651 _incReadState = IncrementalReadState.AttributeValue;
7652 break;
7653 }
7654 outEndPos++;
7655 }
7656 break;
7657 }
7658 }
7659 int num6 = outEndPos - outStartPos;
7660 if (num6 > 0)
7661 {
7662 int num7;
7663 try
7664 {
7666 }
7667 catch (XmlException e2)
7668 {
7670 return 0;
7671 }
7672 num += num7;
7674 {
7678 return num;
7679 }
7680 }
7681 continue;
7683 break;
7684 }
7685 _ps.charPos++;
7686 _incReadState = IncrementalReadState.EndElement;
7687 }
7688 return num3;
7689 }
int Decode(char[] chars, int startPos, int len)
void ParseCDataOrComment(XmlNodeType type)
bool ParsePIValue(out int outStartPos, out int outEndPos)
void ReThrow(Exception e, int lineNo, int linePos)
int EatWhitespaces(StringBuilder sb)
void ThrowUnexpectedToken(int pos, string expectedToken)
int ParseQName(out int colonPos)
IncrementalReadDecoder _incReadDecoder
IncrementalReadState _incReadState
void Set(int lineNo, int linePos)
Definition LineInfo.cs:15

References System.Xml.XmlTextReaderImpl._curNode, System.Xml.XmlTextReaderImpl._fragmentType, System.Xml.XmlTextReaderImpl._incReadDecoder, System.Xml.XmlTextReaderImpl._incReadDepth, System.Xml.XmlTextReaderImpl._incReadLeftEndPos, System.Xml.XmlTextReaderImpl._incReadLeftStartPos, System.Xml.XmlTextReaderImpl._incReadLineInfo, System.Xml.XmlTextReaderImpl._incReadState, System.Xml.XmlTextReaderImpl._index, System.Xml.XmlTextReaderImpl._nameTable, System.Xml.XmlTextReaderImpl._nextParsingFunction, System.Xml.XmlTextReaderImpl._outerReader, System.Xml.XmlTextReaderImpl._parsingFunction, System.Xml.XmlTextReaderImpl._ps, System.Xml.XmlTextReaderImpl.ParsingState.charPos, System.chars, System.Xml.XmlTextReaderImpl.ParsingState.chars, System.Xml.XmlTextReaderImpl.ParsingState.charsUsed, System.Xml.IncrementalReadDecoder.Decode(), System.Xml.Dictionary, System.Xml.XmlTextReaderImpl.EatWhitespaces(), System.Xml.XmlTextReaderImpl.NodeData.GetNameWPrefix(), System.Xml.XmlCharType.IsAttributeValueChar(), System.Xml.IncrementalReadDecoder.IsFull, System.Xml.XmlCharType.IsWhiteSpace(), System.Xml.LineInfo.lineNo, System.Xml.XmlTextReaderImpl.ParsingState.LineNo, System.Xml.LineInfo.linePos, System.Xml.XmlTextReaderImpl.ParsingState.LinePos, System.Xml.XmlTextReaderImpl.NodeData.localName, System.Xml.XmlTextReaderImpl.OnNewLine(), System.Xml.XmlTextReaderImpl.ParseCDataOrComment(), System.Xml.XmlTextReaderImpl.ParsePIValue(), System.Xml.XmlTextReaderImpl.ParseQName(), System.Xml.XmlTextReaderImpl.NodeData.quoteChar, System.Xml.XmlReader.Read(), System.Xml.XmlTextReaderImpl.ReadData(), System.Xml.XmlTextReaderImpl.ReThrow(), System.Xml.LineInfo.Set(), System.Xml.XmlConvert.StrEqual(), System.Xml.XmlTextReaderImpl.ThrowUnclosedElements(), and System.Xml.XmlTextReaderImpl.ThrowUnexpectedToken().

Referenced by System.Xml.XmlTextReaderImpl.FinishIncrementalRead(), System.Xml.XmlTextReaderImpl.IncrementalRead(), System.Xml.XmlTextReaderImpl.ReadBase64(), System.Xml.XmlTextReaderImpl.ReadBinHex(), and System.Xml.XmlTextReaderImpl.ReadChars().