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

◆ GetRangeItemLength()

static int System.Net.Http.Headers.RangeItemHeaderValue.GetRangeItemLength ( string input,
int startIndex,
out RangeItemHeaderValue parsedValue )
inlinestaticpackage

Definition at line 142 of file RangeItemHeaderValue.cs.

143 {
144 parsedValue = null;
145 if (string.IsNullOrEmpty(input) || startIndex >= input.Length)
146 {
147 return 0;
148 }
149 int num = startIndex;
150 int offset = num;
151 int numberLength = HttpRuleParser.GetNumberLength(input, num, allowDecimal: false);
152 if (numberLength > 19)
153 {
154 return 0;
155 }
156 num += numberLength;
157 num += HttpRuleParser.GetWhitespaceLength(input, num);
158 if (num == input.Length || input[num] != '-')
159 {
160 return 0;
161 }
162 num++;
163 num += HttpRuleParser.GetWhitespaceLength(input, num);
164 int offset2 = num;
165 int num2 = 0;
166 if (num < input.Length)
167 {
168 num2 = HttpRuleParser.GetNumberLength(input, num, allowDecimal: false);
169 if (num2 > 19)
170 {
171 return 0;
172 }
173 num += num2;
174 num += HttpRuleParser.GetWhitespaceLength(input, num);
175 }
176 if (numberLength == 0 && num2 == 0)
177 {
178 return 0;
179 }
180 long result = 0L;
181 if (numberLength > 0 && !HeaderUtilities.TryParseInt64(input, offset, numberLength, out result))
182 {
183 return 0;
184 }
185 long result2 = 0L;
186 if (num2 > 0 && !HeaderUtilities.TryParseInt64(input, offset2, num2, out result2))
187 {
188 return 0;
189 }
190 if (numberLength > 0 && num2 > 0 && result > result2)
191 {
192 return 0;
193 }
194 parsedValue = new RangeItemHeaderValue((numberLength == 0) ? null : new long?(result), (num2 == 0) ? null : new long?(result2));
195 return num - startIndex;
196 }

References System.Net.Http.Headers.RangeItemHeaderValue.RangeItemHeaderValue(), System.Net.Http.HttpRuleParser.GetNumberLength(), System.Net.Http.HttpRuleParser.GetWhitespaceLength(), System.input, System.L, System.offset, System.startIndex, and System.Net.Http.Headers.HeaderUtilities.TryParseInt64().

Referenced by System.Net.Http.Headers.RangeItemHeaderValue.GetRangeItemListLength().