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

◆ TrySetOptionalTokenList()

static bool System.Net.Http.Headers.CacheControlHeaderValue.TrySetOptionalTokenList ( NameValueHeaderValue nameValue,
ref bool boolField,
ref ObjectCollection< string > destination )
inlinestaticprivate

Definition at line 543 of file CacheControlHeaderValue.cs.

544 {
545 if (nameValue.Value == null)
546 {
547 boolField = true;
548 return true;
549 }
550 string value = nameValue.Value;
551 if (value.Length < 3 || value[0] != '"' || value[value.Length - 1] != '"')
552 {
553 return false;
554 }
555 int num = 1;
556 int num2 = value.Length - 1;
557 bool separatorFound = false;
558 int num3 = ((destination != null) ? destination.Count : 0);
559 while (num < num2)
560 {
561 num = HeaderUtilities.GetNextNonEmptyOrWhitespaceIndex(value, num, skipEmptyValues: true, out separatorFound);
562 if (num == num2)
563 {
564 break;
565 }
566 int tokenLength = HttpRuleParser.GetTokenLength(value, num);
567 if (tokenLength == 0)
568 {
569 return false;
570 }
571 if (destination == null)
572 {
574 }
575 destination.Add(value.Substring(num, tokenLength));
576 num += tokenLength;
577 }
578 if (destination != null && destination.Count > num3)
579 {
580 boolField = true;
581 return true;
582 }
583 return false;
584 }

References System.destination, System.Net.Http.Headers.HeaderUtilities.GetNextNonEmptyOrWhitespaceIndex(), System.Net.Http.HttpRuleParser.GetTokenLength(), System.Net.Http.Headers.CacheControlHeaderValue.s_checkIsValidToken, and System.value.

Referenced by System.Net.Http.Headers.CacheControlHeaderValue.TrySetCacheControlValues().