Terraria
v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
HttpHeaderParser.cs
Go to the documentation of this file.
1
using
System.Collections
;
2
using
System.Diagnostics.CodeAnalysis
;
3
using
System.Globalization
;
4
5
namespace
System.Net.Http.Headers
;
6
7
internal
abstract
class
HttpHeaderParser
8
{
9
private
readonly
bool
_supportsMultipleValues
;
10
11
private
readonly
string
_separator
;
12
13
public
bool
SupportsMultipleValues
=>
_supportsMultipleValues
;
14
15
public
string
Separator
=>
_separator
;
16
17
public
virtual
IEqualityComparer
Comparer
=>
null
;
18
19
protected
HttpHeaderParser
(
bool
supportsMultipleValues)
20
{
21
_supportsMultipleValues
= supportsMultipleValues;
22
if
(supportsMultipleValues)
23
{
24
_separator
=
", "
;
25
}
26
}
27
28
protected
HttpHeaderParser
(
bool
supportsMultipleValues,
string
separator)
29
{
30
_supportsMultipleValues
= supportsMultipleValues;
31
_separator
= separator;
32
}
33
34
public
abstract
bool
TryParseValue
(
string
value
,
object
storeValue, ref
int
index
, [NotNullWhen(
true
)] out
object
parsedValue);
35
36
public
object
ParseValue
(
string
value
,
object
storeValue, ref
int
index
)
37
{
38
if
(!
TryParseValue
(
value
, storeValue, ref
index
, out var parsedValue))
39
{
40
throw
new
FormatException
(
System
.
SR
.
Format
(
CultureInfo
.
InvariantCulture
,
System
.
SR
.
net_http_headers_invalid_value
, (
value
==
null
) ?
"<null>"
:
value
.Substring(
index
)));
41
}
42
return
parsedValue;
43
}
44
45
public
virtual
string
ToString
(
object
value
)
46
{
47
return
value
.ToString();
48
}
49
}
System.Collections.Comparer
Definition
Comparer.cs:10
System.FormatException
Definition
FormatException.cs:9
System.Globalization.CultureInfo.InvariantCulture
static CultureInfo InvariantCulture
Definition
CultureInfo.cs:144
System.Globalization.CultureInfo
Definition
CultureInfo.cs:8
System.Net.Http.Headers.HttpHeaderParser.HttpHeaderParser
HttpHeaderParser(bool supportsMultipleValues)
Definition
HttpHeaderParser.cs:19
System.Net.Http.Headers.HttpHeaderParser.HttpHeaderParser
HttpHeaderParser(bool supportsMultipleValues, string separator)
Definition
HttpHeaderParser.cs:28
System.Net.Http.Headers.HttpHeaderParser.TryParseValue
bool TryParseValue(string value, object storeValue, ref int index, [NotNullWhen(true)] out object parsedValue)
System.Net.Http.Headers.HttpHeaderParser.ParseValue
object ParseValue(string value, object storeValue, ref int index)
Definition
HttpHeaderParser.cs:36
System.Net.Http.Headers.HttpHeaderParser._supportsMultipleValues
readonly bool _supportsMultipleValues
Definition
HttpHeaderParser.cs:9
System.Net.Http.Headers.HttpHeaderParser.Separator
string Separator
Definition
HttpHeaderParser.cs:15
System.Net.Http.Headers.HttpHeaderParser.SupportsMultipleValues
bool SupportsMultipleValues
Definition
HttpHeaderParser.cs:13
System.Net.Http.Headers.HttpHeaderParser.ToString
virtual string ToString(object value)
Definition
HttpHeaderParser.cs:45
System.Net.Http.Headers.HttpHeaderParser._separator
readonly string _separator
Definition
HttpHeaderParser.cs:11
System.Net.Http.Headers.HttpHeaderParser
Definition
HttpHeaderParser.cs:8
System.SR.Format
static string Format(string resourceFormat, object p1)
Definition
SR.cs:118
System.SR.net_http_headers_invalid_value
static string net_http_headers_invalid_value
Definition
SR.cs:26
System.SR
Definition
SR.cs:7
System.Collections.IEqualityComparer
Definition
IEqualityComparer.cs:4
System.Collections
Definition
BlockingCollection.cs:8
System.Diagnostics.CodeAnalysis
Definition
AllowNullAttribute.cs:1
System.Globalization
Definition
Calendar.cs:1
System.Net.Http.Headers
Definition
AltSvcHeaderParser.cs:4
System.ExceptionArgument.value
@ value
System.ExceptionArgument.index
@ index
System
Definition
BlockingCollection.cs:8
source
System.Net.Http
System.Net.Http.Headers
HttpHeaderParser.cs
Generated by
1.10.0