Terraria v1.4.4.9
Terraria source code documentation
All Classes Namespaces Files Functions Variables Enumerations Enumerator Properties Events Macros

◆ GetKnownContentType()

static string System.Net.Http.Headers.HeaderDescriptor.GetKnownContentType ( ReadOnlySpan< byte > contentTypeValue)
inlinestaticpackage

Definition at line 151 of file HeaderDescriptor.cs.

152 {
153 string text = null;
154 switch (contentTypeValue.Length)
155 {
156 case 8:
157 switch (contentTypeValue[7] | 0x20)
158 {
159 case 108:
160 text = "text/xml";
161 break;
162 case 115:
163 text = "text/css";
164 break;
165 case 118:
166 text = "text/csv";
167 break;
168 }
169 break;
170 case 9:
171 switch (contentTypeValue[6] | 0x20)
172 {
173 case 103:
174 text = "image/gif";
175 break;
176 case 112:
177 text = "image/png";
178 break;
179 case 116:
180 text = "text/html";
181 break;
182 }
183 break;
184 case 10:
185 switch (contentTypeValue[0] | 0x20)
186 {
187 case 116:
188 text = "text/plain";
189 break;
190 case 105:
191 text = "image/jpeg";
192 break;
193 }
194 break;
195 case 15:
196 switch (contentTypeValue[12] | 0x20)
197 {
198 case 112:
199 text = "application/pdf";
200 break;
201 case 120:
202 text = "application/xml";
203 break;
204 case 122:
205 text = "application/zip";
206 break;
207 }
208 break;
209 case 16:
210 switch (contentTypeValue[12] | 0x20)
211 {
212 case 103:
213 text = "application/grpc";
214 break;
215 case 106:
216 text = "application/json";
217 break;
218 }
219 break;
220 case 19:
221 text = "multipart/form-data";
222 break;
223 case 22:
224 text = "application/javascript";
225 break;
226 case 24:
227 switch (contentTypeValue[0] | 0x20)
228 {
229 case 97:
230 text = "application/octet-stream";
231 break;
232 case 116:
233 text = "text/html; charset=utf-8";
234 break;
235 }
236 break;
237 case 25:
238 text = "text/plain; charset=utf-8";
239 break;
240 case 31:
241 text = "application/json; charset=utf-8";
242 break;
243 case 33:
244 text = "application/x-www-form-urlencoded";
245 break;
246 }
247 if (text == null || !ByteArrayHelpers.EqualsOrdinalAsciiIgnoreCase(text, contentTypeValue))
248 {
249 return null;
250 }
251 return text;
252 }

References System.ByteArrayHelpers.EqualsOrdinalAsciiIgnoreCase(), System.ReadOnlySpan< T >.Length, and System.text.

Referenced by System.Net.Http.Headers.HeaderDescriptor.GetHeaderValue().