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

◆ TextEquals() [1/2]

bool System.Text.Json.JsonDocument.TextEquals ( int index,
ReadOnlySpan< byte > otherUtf8Text,
bool isPropertyName,
bool shouldUnescape )
inlinepackage

Definition at line 515 of file JsonDocument.cs.

516 {
518 int index2 = (isPropertyName ? (index - 12) : index);
519 DbRow dbRow = _parsedData.Get(index2);
520 CheckExpectedType(isPropertyName ? JsonTokenType.PropertyName : JsonTokenType.String, dbRow.TokenType);
521 ReadOnlySpan<byte> span = _utf8Json.Span.Slice(dbRow.Location, dbRow.SizeOrLength);
522 if (otherUtf8Text.Length > span.Length || (!shouldUnescape && otherUtf8Text.Length != span.Length))
523 {
524 return false;
525 }
526 if (dbRow.HasComplexChildren && shouldUnescape)
527 {
528 if (otherUtf8Text.Length < span.Length / 6)
529 {
530 return false;
531 }
532 int num = span.IndexOf<byte>(92);
533 if (!otherUtf8Text.StartsWith(span.Slice(0, num)))
534 {
535 return false;
536 }
537 return JsonReaderHelper.UnescapeAndCompare(span.Slice(num), otherUtf8Text.Slice(num));
538 }
539 return span.SequenceEqual(otherUtf8Text);
540 }
void CheckExpectedType(JsonTokenType expected, JsonTokenType actual)
ReadOnlyMemory< byte > _utf8Json
unsafe ReadOnlySpan< T > Span

References 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.index, System.index2, System.ReadOnlyMemory< T >.Span, and System.Text.Json.JsonReaderHelper.UnescapeAndCompare().