private void ValidateStart(ref ReadOnlySpan <byte> propertyName, byte token) { if (JsonWriterHelper.IndexOfAnyEscape(propertyName) != -1) { JsonThrowHelper.ThrowJsonWriterException("Property name must be properly escaped."); //TODO: Fix message } if (!_inObject) { Debug.Assert(_tokenType != JsonTokenType.StartObject); JsonThrowHelper.ThrowJsonWriterException(token); //TODO: Add resouce message } UpdateBitStackOnStart(token); }
private void WriteCommentWithEncodingValue(ReadOnlySpan <byte> value) { //TODO: Add ReadOnlySpan<char> overload to this check if (JsonWriterHelper.IndexOfAnyEscape(value) != -1) { value = JsonWriterHelper.EscapeStringValue(value); } if (_writerOptions.Formatted) { WriteCommentFormattedWithEncodingValue(ref value); } else { WriteCommentFastWithEncodingValue(ref value); } }
public void WriteComment(ReadOnlySpan <byte> utf8Text) { JsonWriterHelper.ValidateValue(ref utf8Text); if (JsonWriterHelper.IndexOfAnyEscape(utf8Text) != -1) { //TODO: Add escaping. utf8Text = JsonWriterHelper.EscapeStringValue(utf8Text); } if (_writerOptions.Formatted) { WriteCommentFormatted(ref utf8Text); } else { WriteCommentFast(ref utf8Text); } }
private void WriteValueWithEncodingValue(ReadOnlySpan <byte> value) { //TODO: Add ReadOnlySpan<char> overload to this check if (JsonWriterHelper.IndexOfAnyEscape(value) != -1) { value = JsonWriterHelper.EscapeStringValue(value); } if (_writerOptions.SlowPath) { WriteValueSlowWithEncodingValue(ref value); } else { WriteValueFastWithEncodingValue(ref value); } _currentDepth |= 1 << 31; _tokenType = JsonTokenType.String; }
public void WriteValue(ReadOnlySpan <byte> utf8Text) { JsonWriterHelper.ValidateValue(ref utf8Text); if (JsonWriterHelper.IndexOfAnyEscape(utf8Text) != -1) { //TODO: Add escaping. utf8Text = JsonWriterHelper.EscapeStringValue(utf8Text); } if (_writerOptions.SlowPath) { WriteValueSlow(ref utf8Text); } else { WriteValueFast(ref utf8Text); } _currentDepth |= 1 << 31; _tokenType = JsonTokenType.String; }