Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
HttpHeaderValueCollection.cs
Go to the documentation of this file.
3
5
7{
8 private readonly HeaderDescriptor _descriptor;
9
10 private readonly HttpHeaders _store;
11
12 private readonly T _specialValue;
13
15
16 public int Count => GetCount();
17
18 public bool IsReadOnly => false;
19
20 internal bool IsSpecialValueSet
21 {
22 get
23 {
24 if (_specialValue == null)
25 {
26 return false;
27 }
29 }
30 }
31
33 : this(descriptor, store, (T)null, (Action<HttpHeaderValueCollection<T>, T>)null)
34 {
35 }
36
38 : this(descriptor, store, (T)null, validator)
39 {
40 }
41
46
48 {
49 _store = store;
50 _descriptor = descriptor;
52 _validator = validator;
53 }
54
55 public void Add(T item)
56 {
59 }
60
61 public void ParseAdd(string? input)
62 {
64 }
65
66 public bool TryParseAdd(string? input)
67 {
69 }
70
71 public void Clear()
72 {
74 }
75
76 public bool Contains(T item)
77 {
80 }
81
82 public void CopyTo(T[] array, int arrayIndex)
83 {
84 if (array == null)
85 {
86 throw new ArgumentNullException("array");
87 }
89 {
90 throw new ArgumentOutOfRangeException("arrayIndex");
91 }
93 if (parsedValues == null)
94 {
95 return;
96 }
98 {
99 if (arrayIndex == array.Length)
100 {
102 }
104 }
105 else
106 {
108 }
109 }
110
111 public bool Remove(T item)
112 {
115 }
116
118 {
120 if (parsedValues != null)
121 {
122 return Iterate(parsedValues);
123 }
124 return ((IEnumerable<T>)Array.Empty<T>()).GetEnumerator();
125 static IEnumerator<T> Iterate(object storeValue)
126 {
128 {
129 foreach (object item in list)
130 {
131 yield return (T)item;
132 }
133 }
134 else
135 {
136 yield return (T)storeValue;
137 }
138 }
139 }
140
145
146 public override string ToString()
147 {
149 }
150
158
163
164 private void CheckValue(T item)
165 {
166 if (item == null)
167 {
168 throw new ArgumentNullException("item");
169 }
170 if (_validator != null)
171 {
172 _validator(this, item);
173 }
174 }
175
176 private int GetCount()
177 {
179 if (parsedValues == null)
180 {
181 return 0;
182 }
184 {
185 return 1;
186 }
187 return list.Count;
188 }
189}
void CopyTo(KeyValuePair< TKey, TValue >[] array, int index)
HttpHeaderValueCollection(HeaderDescriptor descriptor, HttpHeaders store, T specialValue)
HttpHeaderValueCollection(HeaderDescriptor descriptor, HttpHeaders store, Action< HttpHeaderValueCollection< T >, T > validator)
HttpHeaderValueCollection(HeaderDescriptor descriptor, HttpHeaders store)
HttpHeaderValueCollection(HeaderDescriptor descriptor, HttpHeaders store, T specialValue, Action< HttpHeaderValueCollection< T >, T > validator)
readonly Action< HttpHeaderValueCollection< T >, T > _validator
bool TryParseAndAddValue(HeaderDescriptor descriptor, string value)
string GetHeaderString(HeaderDescriptor descriptor)
bool RemoveParsedValue(HeaderDescriptor descriptor, object value)
bool ContainsParsedValue(HeaderDescriptor descriptor, object value)
void AddParsedValue(HeaderDescriptor descriptor, object value)
void Add(string name, string? value)
object GetParsedValues(HeaderDescriptor descriptor)
static string net_http_copyto_array_too_small
Definition SR.cs:18
Definition SR.cs:7
new IEnumerator< T > GetEnumerator()