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

◆ WriteStringEscapePropertyOrValue() [2/4]

unsafe void System.Text.Json.Utf8JsonWriter.WriteStringEscapePropertyOrValue ( ReadOnlySpan< byte > utf8PropertyName,
ReadOnlySpan< char > value,
int firstEscapeIndexProp,
int firstEscapeIndexVal )
inlineprivate

Definition at line 3603 of file Utf8JsonWriter.cs.

3604 {
3605 char[] array = null;
3606 byte[] array2 = null;
3607 if (firstEscapeIndexVal != -1)
3608 {
3609 int maxEscapedLength = JsonWriterHelper.GetMaxEscapedLength(value.Length, firstEscapeIndexVal);
3610 Span<char> destination;
3611 if (maxEscapedLength > 128)
3612 {
3615 }
3616 else
3617 {
3618 char* pointer = stackalloc char[128];
3619 destination = new Span<char>(pointer, 128);
3620 }
3621 JsonWriterHelper.EscapeString(value, destination, firstEscapeIndexVal, _options.Encoder, out var written);
3622 value = destination.Slice(0, written);
3623 }
3624 if (firstEscapeIndexProp != -1)
3625 {
3626 int maxEscapedLength2 = JsonWriterHelper.GetMaxEscapedLength(utf8PropertyName.Length, firstEscapeIndexProp);
3627 Span<byte> destination2;
3628 if (maxEscapedLength2 > 256)
3629 {
3632 }
3633 else
3634 {
3635 byte* pointer2 = stackalloc byte[256];
3636 destination2 = new Span<byte>(pointer2, 256);
3637 }
3640 }
3642 if (array != null)
3643 {
3645 }
3646 if (array2 != null)
3647 {
3649 }
3650 }
static ArrayPool< T > Shared
Definition ArrayPool.cs:7
void WriteStringByOptions(ReadOnlySpan< char > propertyName, DateTime value)

References System.Text.Json.Utf8JsonWriter._options, System.array, System.destination, System.Text.Json.Dictionary, System.Text.Json.JsonWriterOptions.Encoder, System.Text.Json.JsonWriterHelper.EscapeString(), System.Text.Json.JsonWriterHelper.GetMaxEscapedLength(), System.pointer, System.Buffers.ArrayPool< T >.Shared, System.value, and System.Text.Json.Utf8JsonWriter.WriteStringByOptions().