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

◆ GetWarningLength()

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

Definition at line 124 of file WarningHeaderValue.cs.

125 {
126 parsedValue = null;
127 if (string.IsNullOrEmpty(input) || startIndex >= input.Length)
128 {
129 return 0;
130 }
131 int current = startIndex;
132 if (!TryReadCode(input, ref current, out var code))
133 {
134 return 0;
135 }
136 if (!TryReadAgent(input, current, ref current, out var agent))
137 {
138 return 0;
139 }
140 int length = 0;
141 int startIndex2 = current;
142 if (HttpRuleParser.GetQuotedStringLength(input, current, out length) != 0)
143 {
144 return 0;
145 }
146 string text = input.Substring(startIndex2, length);
147 current += length;
148 DateTimeOffset? date = null;
149 if (!TryReadDate(input, ref current, out date))
150 {
151 return 0;
152 }
153 parsedValue = ((!date.HasValue) ? new WarningHeaderValue(code, agent, text) : new WarningHeaderValue(code, agent, text, date.Value));
154 return current - startIndex;
155 }
static bool TryReadCode(string input, ref int current, out int code)
static bool TryReadDate(string input, ref int current, out DateTimeOffset? date)
WarningHeaderValue(int code, string agent, string text)
static bool TryReadAgent(string input, int startIndex, ref int current, [NotNullWhen(true)] out string agent)

References System.Net.Http.Headers.WarningHeaderValue.WarningHeaderValue(), System.Net.Http.HttpRuleParser.GetQuotedStringLength(), System.input, System.length, System.startIndex, System.text, System.Net.Http.Headers.WarningHeaderValue.TryReadAgent(), System.Net.Http.Headers.WarningHeaderValue.TryReadCode(), and System.Net.Http.Headers.WarningHeaderValue.TryReadDate().