Terraria v1.4.4.9
Terraria source code documentation
All Classes Namespaces Files Functions Variables Enumerations Enumerator Properties Events Macros

◆ TryGetRangeLength()

static bool System.Net.Http.Headers.ContentRangeHeaderValue.TryGetRangeLength ( string input,
ref int current,
out int fromLength,
out int toStartIndex,
out int toLength )
inlinestaticprivate

Definition at line 243 of file ContentRangeHeaderValue.cs.

244 {
245 fromLength = 0;
246 toStartIndex = 0;
247 toLength = 0;
248 if (input[current] == '*')
249 {
250 current++;
251 }
252 else
253 {
254 fromLength = HttpRuleParser.GetNumberLength(input, current, allowDecimal: false);
255 if (fromLength == 0 || fromLength > 19)
256 {
257 return false;
258 }
259 current += fromLength;
260 current += HttpRuleParser.GetWhitespaceLength(input, current);
261 if (current == input.Length || input[current] != '-')
262 {
263 return false;
264 }
265 current++;
266 current += HttpRuleParser.GetWhitespaceLength(input, current);
267 if (current == input.Length)
268 {
269 return false;
270 }
271 toStartIndex = current;
272 toLength = HttpRuleParser.GetNumberLength(input, current, allowDecimal: false);
273 if (toLength == 0 || toLength > 19)
274 {
275 return false;
276 }
277 current += toLength;
278 }
279 current += HttpRuleParser.GetWhitespaceLength(input, current);
280 return true;
281 }

References System.Net.Http.HttpRuleParser.GetNumberLength(), System.Net.Http.HttpRuleParser.GetWhitespaceLength(), and System.input.

Referenced by System.Net.Http.Headers.ContentRangeHeaderValue.GetContentRangeLength().