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

◆ TryGetValue() [8/15]

bool System.Text.Json.JsonDocument.TryGetValue ( int index,
out Guid value )
inlinepackage

Definition at line 774 of file JsonDocument.cs.

775 {
777 DbRow dbRow = _parsedData.Get(index);
778 CheckExpectedType(JsonTokenType.String, dbRow.TokenType);
779 ReadOnlySpan<byte> source = _utf8Json.Span.Slice(dbRow.Location, dbRow.SizeOrLength);
780 if (source.Length > 216)
781 {
782 value = default(Guid);
783 return false;
784 }
785 if (dbRow.HasComplexChildren)
786 {
787 return JsonReaderHelper.TryGetEscapedGuid(source, out value);
788 }
789 if (source.Length == 36 && Utf8Parser.TryParse(source, out Guid value2, out int _, 'D'))
790 {
791 value = value2;
792 return true;
793 }
794 value = default(Guid);
795 return false;
796 }
static bool TryParse(ReadOnlySpan< byte > source, out bool value, out int bytesConsumed, char standardFormat='\0')
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.source, System.ReadOnlyMemory< T >.Span, System.Text.Json.JsonReaderHelper.TryGetEscapedGuid(), System.Buffers.Text.Utf8Parser.TryParse(), and System.value.