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

◆ WriteStringEscapePropertyOrValue() [3/4]

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

Definition at line 3554 of file Utf8JsonWriter.cs.

3555 {
3556 byte[] array = null;
3557 char[] array2 = null;
3558 if (firstEscapeIndexVal != -1)
3559 {
3560 int maxEscapedLength = JsonWriterHelper.GetMaxEscapedLength(utf8Value.Length, firstEscapeIndexVal);
3561 Span<byte> destination;
3562 if (maxEscapedLength > 256)
3563 {
3566 }
3567 else
3568 {
3569 byte* pointer = stackalloc byte[256];
3570 destination = new Span<byte>(pointer, 256);
3571 }
3572 JsonWriterHelper.EscapeString(utf8Value, destination, firstEscapeIndexVal, _options.Encoder, out var written);
3573 utf8Value = destination.Slice(0, written);
3574 }
3575 if (firstEscapeIndexProp != -1)
3576 {
3577 int maxEscapedLength2 = JsonWriterHelper.GetMaxEscapedLength(propertyName.Length, firstEscapeIndexProp);
3578 Span<char> destination2;
3579 if (maxEscapedLength2 > 128)
3580 {
3583 }
3584 else
3585 {
3586 char* pointer2 = stackalloc char[128];
3587 destination2 = new Span<char>(pointer2, 128);
3588 }
3589 JsonWriterHelper.EscapeString(propertyName, destination2, firstEscapeIndexProp, _options.Encoder, out var written2);
3591 }
3593 if (array != null)
3594 {
3596 }
3597 if (array2 != null)
3598 {
3600 }
3601 }
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, and System.Text.Json.Utf8JsonWriter.WriteStringByOptions().