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

◆ ConsumeSignMultiSegment()

ConsumeNumberResult System.Text.Json.Utf8JsonReader.ConsumeSignMultiSegment ( ref ReadOnlySpan< byte > data,
ref int i,
in PartialStateForRollback rollBackState )
inlineprivate

Definition at line 3107 of file Utf8JsonReader.cs.

3108 {
3109 if (i >= data.Length)
3110 {
3111 if (IsLastSpan)
3112 {
3114 ThrowHelper.ThrowJsonReaderException(ref this, ExceptionResource.RequiredDigitNotFoundEndOfData, 0);
3115 }
3116 if (!GetNextSpan())
3117 {
3118 if (IsLastSpan)
3119 {
3121 ThrowHelper.ThrowJsonReaderException(ref this, ExceptionResource.RequiredDigitNotFoundEndOfData, 0);
3122 }
3123 return ConsumeNumberResult.NeedMoreData;
3124 }
3125 _totalConsumed += i;
3126 HasValueSequence = true;
3127 i = 0;
3128 data = _buffer;
3129 }
3130 byte b = data[i];
3131 if (b == 43 || b == 45)
3132 {
3133 i++;
3135 if (i >= data.Length)
3136 {
3137 if (IsLastSpan)
3138 {
3140 ThrowHelper.ThrowJsonReaderException(ref this, ExceptionResource.RequiredDigitNotFoundEndOfData, 0);
3141 }
3142 if (!GetNextSpan())
3143 {
3144 if (IsLastSpan)
3145 {
3147 ThrowHelper.ThrowJsonReaderException(ref this, ExceptionResource.RequiredDigitNotFoundEndOfData, 0);
3148 }
3149 return ConsumeNumberResult.NeedMoreData;
3150 }
3151 _totalConsumed += i;
3152 HasValueSequence = true;
3153 i = 0;
3154 data = _buffer;
3155 }
3156 b = data[i];
3157 }
3158 if (!JsonHelpers.IsDigit(b))
3159 {
3161 ThrowHelper.ThrowJsonReaderException(ref this, ExceptionResource.RequiredDigitNotFoundAfterSign, b);
3162 }
3163 return ConsumeNumberResult.OperationIncomplete;
3164 }
void RollBackState(in PartialStateForRollback state, bool isError=false)

References System.Text.Json.Utf8JsonReader._buffer, System.Text.Json.Utf8JsonReader._bytePositionInLine, System.Text.Json.Utf8JsonReader._totalConsumed, System.Text.Json.Dictionary, System.Text.Json.Utf8JsonReader.GetNextSpan(), System.Text.Json.Utf8JsonReader.HasValueSequence, System.Text.Json.JsonHelpers.IsDigit(), System.Text.Json.Utf8JsonReader.IsLastSpan, System.Text.Json.Utf8JsonReader.RollBackState(), and System.Text.Json.ThrowHelper.ThrowJsonReaderException().

Referenced by System.Text.Json.Utf8JsonReader.TryGetNumberMultiSegment().