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

◆ GetString()

string System.Text.Json.JsonDocument.GetString ( int index,
JsonTokenType expectedType )
inlinepackage

Definition at line 458 of file JsonDocument.cs.

459 {
461 int num;
462 string result;
463 (num, result) = _lastIndexAndString;
464 if (num == index)
465 {
466 return result;
467 }
468 DbRow dbRow = _parsedData.Get(index);
469 JsonTokenType tokenType = dbRow.TokenType;
470 if (tokenType == JsonTokenType.Null)
471 {
472 return null;
473 }
475 ReadOnlySpan<byte> readOnlySpan = _utf8Json.Span.Slice(dbRow.Location, dbRow.SizeOrLength);
476 if (dbRow.HasComplexChildren)
477 {
478 int idx = readOnlySpan.IndexOf<byte>(92);
479 result = JsonReaderHelper.GetUnescapedString(readOnlySpan, idx);
480 }
481 else
482 {
483 result = JsonReaderHelper.TranscodeHelper(readOnlySpan);
484 }
485 _lastIndexAndString = (index, result);
486 return result;
487 }
void CheckExpectedType(JsonTokenType expected, JsonTokenType actual)
ReadOnlyMemory< byte > _utf8Json
unsafe ReadOnlySpan< T > Span

References System.Text.Json.JsonDocument._lastIndexAndString, System.Text.Json.JsonDocument._parsedData, System.Text.Json.JsonDocument._utf8Json, System.Text.Json.JsonDocument.CheckExpectedType(), System.Text.Json.JsonDocument.CheckNotDisposed(), System.Text.Json.Dictionary, System.Text.Json.JsonDocument.MetadataDb.Get(), System.Text.Json.JsonReaderHelper.GetUnescapedString(), System.index, System.ReadOnlyMemory< T >.Span, System.Text.Json.JsonDocument.DbRow.TokenType, and System.Text.Json.JsonReaderHelper.TranscodeHelper().

Referenced by System.Text.Json.JsonDocument.GetNameOfPropertyValue(), and System.Text.Json.JsonElement.GetString().