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

◆ GetRetryConditionLength()

static int System.Net.Http.Headers.RetryConditionHeaderValue.GetRetryConditionLength ( string input,
int startIndex,
out object parsedValue )
inlinestaticpackage

Definition at line 93 of file RetryConditionHeaderValue.cs.

94 {
95 parsedValue = null;
96 if (string.IsNullOrEmpty(input) || startIndex >= input.Length)
97 {
98 return 0;
99 }
100 int num = startIndex;
101 DateTimeOffset result = DateTimeOffset.MinValue;
102 int result2 = -1;
103 char c = input[num];
104 if (c >= '0' && c <= '9')
105 {
106 int offset = num;
107 int numberLength = HttpRuleParser.GetNumberLength(input, num, allowDecimal: false);
108 if (numberLength == 0 || numberLength > 10)
109 {
110 return 0;
111 }
112 num += numberLength;
113 num += HttpRuleParser.GetWhitespaceLength(input, num);
114 if (num != input.Length)
115 {
116 return 0;
117 }
118 if (!HeaderUtilities.TryParseInt32(input, offset, numberLength, out result2))
119 {
120 return 0;
121 }
122 }
123 else
124 {
125 if (!HttpDateParser.TryParse(input.AsSpan(num), out result))
126 {
127 return 0;
128 }
129 num = input.Length;
130 }
131 if (result2 == -1)
132 {
133 parsedValue = new RetryConditionHeaderValue(result);
134 }
135 else
136 {
137 parsedValue = new RetryConditionHeaderValue(new TimeSpan(0, 0, result2));
138 }
139 return num - startIndex;
140 }

References System.Net.Http.Headers.RetryConditionHeaderValue.RetryConditionHeaderValue(), System.Net.Http.HttpRuleParser.GetNumberLength(), System.Net.Http.HttpRuleParser.GetWhitespaceLength(), System.input, System.DateTimeOffset.MinValue, System.offset, System.startIndex, System.Net.HttpDateParser.TryParse(), and System.Net.Http.Headers.HeaderUtilities.TryParseInt32().