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

◆ ParseText() [2/2]

bool System.Xml.XmlTextReaderImpl.ParseText ( out int startPos,
out int endPos,
ref int outOrChars )
inlineprivate

Definition at line 5233 of file XmlTextReaderImpl.cs.

5234 {
5235 char[] chars = _ps.chars;
5237 int num = 0;
5238 int num2 = -1;
5239 int num3 = outOrChars;
5240 char c;
5241 while (true)
5242 {
5243 if (XmlCharType.IsTextChar(c = chars[charRefEndPos]))
5244 {
5245 num3 |= c;
5246 charRefEndPos++;
5247 continue;
5248 }
5249 switch (c)
5250 {
5251 case '\t':
5252 charRefEndPos++;
5253 continue;
5254 case '\n':
5255 charRefEndPos++;
5257 continue;
5258 case '\r':
5259 if (chars[charRefEndPos + 1] == '\n')
5260 {
5261 if (!_ps.eolNormalized && _parsingMode == ParsingMode.Full)
5262 {
5263 if (charRefEndPos - _ps.charPos > 0)
5264 {
5265 if (num == 0)
5266 {
5267 num = 1;
5269 }
5270 else
5271 {
5272 ShiftBuffer(num2 + num, num2, charRefEndPos - num2 - num);
5273 num2 = charRefEndPos - num;
5274 num++;
5275 }
5276 }
5277 else
5278 {
5279 _ps.charPos++;
5280 }
5281 }
5282 charRefEndPos += 2;
5283 }
5284 else
5285 {
5286 if (charRefEndPos + 1 >= _ps.charsUsed && !_ps.isEof)
5287 {
5288 goto IL_0350;
5289 }
5290 if (!_ps.eolNormalized)
5291 {
5292 chars[charRefEndPos] = '\n';
5293 }
5294 charRefEndPos++;
5295 }
5297 continue;
5298 case '&':
5299 {
5300 int num5;
5302 {
5303 if (num > 0)
5304 {
5305 ShiftBuffer(num2 + num, num2, charRefEndPos - num2 - num);
5306 }
5307 num2 = charRefEndPos - num;
5308 num += num5 - charRefEndPos - charCount;
5310 if (!XmlCharType.IsWhiteSpace(chars[num5 - charCount]) || (_v1Compat && entityType == EntityType.CharacterDec))
5311 {
5312 num3 |= 0xFF;
5313 }
5314 continue;
5315 }
5317 {
5318 break;
5319 }
5321 {
5322 case EntityType.Unexpanded:
5323 break;
5324 case EntityType.CharacterDec:
5325 if (!_v1Compat)
5326 {
5327 goto case EntityType.CharacterHex;
5328 }
5329 num3 |= 0xFF;
5330 goto IL_023f;
5331 case EntityType.CharacterHex:
5332 case EntityType.CharacterNamed:
5333 if (!XmlCharType.IsWhiteSpace(_ps.chars[charRefEndPos - 1]))
5334 {
5335 num3 |= 0xFF;
5336 }
5337 goto IL_023f;
5338 default:
5339 {
5341 goto IL_023f;
5342 }
5343 IL_023f:
5344 chars = _ps.chars;
5345 continue;
5346 }
5348 _parsingFunction = ParsingFunction.EntityReference;
5349 goto IL_040d;
5350 }
5351 case ']':
5352 if (_ps.charsUsed - charRefEndPos >= 3 || _ps.isEof)
5353 {
5354 if (chars[charRefEndPos + 1] == ']' && chars[charRefEndPos + 2] == '>')
5355 {
5357 }
5358 num3 |= 0x5D;
5359 charRefEndPos++;
5360 continue;
5361 }
5362 goto IL_0350;
5363 default:
5365 {
5366 char c2 = chars[charRefEndPos];
5367 if (XmlCharType.IsHighSurrogate(c2))
5368 {
5369 if (charRefEndPos + 1 == _ps.charsUsed)
5370 {
5371 goto IL_0350;
5372 }
5373 charRefEndPos++;
5374 if (XmlCharType.IsLowSurrogate(chars[charRefEndPos]))
5375 {
5376 charRefEndPos++;
5377 num3 |= c2;
5378 continue;
5379 }
5380 }
5381 int num4 = charRefEndPos - _ps.charPos;
5383 {
5384 chars = _ps.chars;
5386 break;
5387 }
5389 }
5390 goto IL_0350;
5391 case '<':
5392 break;
5393 IL_0350:
5395 {
5396 break;
5397 }
5398 if (ReadData() == 0)
5399 {
5400 if (_ps.charsUsed - _ps.charPos <= 0)
5401 {
5402 if (InEntity)
5403 {
5405 {
5406 goto IL_03f0;
5407 }
5409 _parsingFunction = ParsingFunction.ReportEndEntity;
5410 }
5411 goto IL_040d;
5412 }
5413 if (_ps.chars[_ps.charPos] != '\r' && _ps.chars[_ps.charPos] != ']')
5414 {
5416 }
5417 }
5418 goto IL_03f0;
5419 IL_03f0:
5421 chars = _ps.chars;
5422 continue;
5423 IL_040d:
5425 return true;
5426 }
5427 break;
5428 }
5429 if (_parsingMode == ParsingMode.Full && num > 0)
5430 {
5431 ShiftBuffer(num2 + num, num2, charRefEndPos - num2 - num);
5432 }
5434 endPos = charRefEndPos - num;
5436 outOrChars = num3;
5437 return c == '<';
5438 }
static string Xml_UnexpectedEOF1
Definition SR.cs:38
static string Xml_CDATAEndInText
Definition SR.cs:150
Definition SR.cs:7
void ThrowInvalidChar(char[] data, int length, int invCharPos)
EntityType HandleEntityReference(bool isInAttributeValue, EntityExpandType expandType, out int charRefEndPos)
bool HandleEntityEnd(bool checkEntityNesting)
void Throw(int pos, string res, string arg)
void ShiftBuffer(int sourcePos, int destPos, int count)
int ParseCharRefInline(int startPos, out int charCount, out EntityType entityType)

References System.Xml.XmlTextReaderImpl._nextParsingFunction, System.Xml.XmlTextReaderImpl._parsingFunction, System.Xml.XmlTextReaderImpl._parsingMode, System.Xml.XmlTextReaderImpl._ps, System.Xml.XmlTextReaderImpl._v1Compat, System.charCount, 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.HandleEntityEnd(), System.Xml.XmlTextReaderImpl.HandleEntityReference(), System.Xml.XmlTextReaderImpl.ParsingState.isEof, System.Xml.XmlCharType.IsHighSurrogate(), System.Xml.XmlCharType.IsLowSurrogate(), System.Xml.XmlCharType.IsTextChar(), System.Xml.XmlCharType.IsWhiteSpace(), System.Xml.XmlTextReaderImpl.OnNewLine(), System.Xml.XmlTextReaderImpl.ParseCharRefInline(), System.Xml.XmlTextReaderImpl.ReadData(), System.Xml.XmlTextReaderImpl.ShiftBuffer(), System.Xml.XmlTextReaderImpl.Throw(), System.Xml.XmlTextReaderImpl.ThrowInvalidChar(), System.SR.Xml_CDATAEndInText, System.SR.Xml_UnexpectedEOF1, and System.Xml.XmlTextReaderImpl.ZeroEndingStream().