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

◆ ParsePIValueAsync()

async Task<(int, int, bool)> System.Xml.XmlTextReaderImpl.ParsePIValueAsync ( )
inlineprivate

Definition at line 11798 of file XmlTextReaderImpl.cs.

11799 {
11800 if (_ps.charsUsed - _ps.charPos < 2 && await ReadDataAsync().ConfigureAwait(continueOnCapturedContext: false) == 0)
11801 {
11803 }
11804 int num = _ps.charPos;
11805 char[] chars = _ps.chars;
11806 int num2 = 0;
11807 int num3 = -1;
11808 int item;
11809 int charPos;
11810 while (true)
11811 {
11812 char c;
11813 if (XmlCharType.IsTextChar(c = chars[num]) && c != '?')
11814 {
11815 num++;
11816 continue;
11817 }
11818 switch (chars[num])
11819 {
11820 case '?':
11821 if (chars[num + 1] == '>')
11822 {
11823 if (num2 > 0)
11824 {
11825 ShiftBuffer(num3 + num2, num3, num - num3 - num2);
11826 item = num - num2;
11827 }
11828 else
11829 {
11830 item = num;
11831 }
11832 charPos = _ps.charPos;
11833 _ps.charPos = num + 2;
11834 return (charPos, item, true);
11835 }
11836 if (num + 1 != _ps.charsUsed)
11837 {
11838 num++;
11839 continue;
11840 }
11841 break;
11842 case '\n':
11843 num++;
11844 OnNewLine(num);
11845 continue;
11846 case '\r':
11847 if (chars[num + 1] == '\n')
11848 {
11849 if (!_ps.eolNormalized && _parsingMode == ParsingMode.Full)
11850 {
11851 if (num - _ps.charPos > 0)
11852 {
11853 if (num2 == 0)
11854 {
11855 num2 = 1;
11856 num3 = num;
11857 }
11858 else
11859 {
11860 ShiftBuffer(num3 + num2, num3, num - num3 - num2);
11861 num3 = num - num2;
11862 num2++;
11863 }
11864 }
11865 else
11866 {
11867 _ps.charPos++;
11868 }
11869 }
11870 num += 2;
11871 }
11872 else
11873 {
11874 if (num + 1 >= _ps.charsUsed && !_ps.isEof)
11875 {
11876 break;
11877 }
11878 if (!_ps.eolNormalized)
11879 {
11880 chars[num] = '\n';
11881 }
11882 num++;
11883 }
11884 OnNewLine(num);
11885 continue;
11886 case '\t':
11887 case '&':
11888 case '<':
11889 case ']':
11890 num++;
11891 continue;
11892 default:
11893 {
11894 if (num == _ps.charsUsed)
11895 {
11896 break;
11897 }
11898 char ch = chars[num];
11899 if (XmlCharType.IsHighSurrogate(ch))
11900 {
11901 if (num + 1 == _ps.charsUsed)
11902 {
11903 break;
11904 }
11905 num++;
11906 if (XmlCharType.IsLowSurrogate(chars[num]))
11907 {
11908 num++;
11909 continue;
11910 }
11911 }
11913 continue;
11914 }
11915 }
11916 break;
11917 }
11918 if (num2 > 0)
11919 {
11920 ShiftBuffer(num3 + num2, num3, num - num3 - num2);
11921 item = num - num2;
11922 }
11923 else
11924 {
11925 item = num;
11926 }
11927 charPos = _ps.charPos;
11928 _ps.charPos = num;
11929 return (charPos, item, false);
11930 }
static string Xml_UnexpectedEOF
Definition SR.cs:36
Definition SR.cs:7
void ThrowInvalidChar(char[] data, int length, int invCharPos)
void Throw(int pos, string res, string arg)
void ShiftBuffer(int sourcePos, int destPos, int count)

References System.Xml.XmlTextReaderImpl._parsingMode, System.Xml.XmlTextReaderImpl._ps, System.ch, System.Xml.XmlTextReaderImpl.ParsingState.charPos, System.chars, System.Xml.XmlTextReaderImpl.ParsingState.chars, System.Xml.XmlTextReaderImpl.ParsingState.charsUsed, System.Xml.Dictionary, System.Xml.XmlTextReaderImpl.ParsingState.eolNormalized, System.Xml.XmlTextReaderImpl.ParsingState.isEof, System.Xml.XmlCharType.IsHighSurrogate(), System.Xml.XmlCharType.IsLowSurrogate(), System.Xml.XmlCharType.IsTextChar(), System.item, System.Xml.XmlTextReaderImpl.OnNewLine(), System.Xml.XmlTextReaderImpl.ReadDataAsync(), System.Xml.XmlTextReaderImpl.ShiftBuffer(), System.Xml.XmlTextReaderImpl.Throw(), System.Xml.XmlTextReaderImpl.ThrowInvalidChar(), and System.SR.Xml_UnexpectedEOF.

Referenced by System.Xml.XmlTextReaderImpl.ParsePIAsync().