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

◆ UrlDecode() [2/3]

static string System.Web.Util.HttpEncoder.UrlDecode ( byte[] bytes,
int offset,
int count,
Encoding encoding )
inlinestaticpackage

Definition at line 335 of file HttpEncoder.cs.

336 {
338 {
339 return null;
340 }
341 UrlDecoder urlDecoder = new UrlDecoder(count, encoding);
342 for (int i = 0; i < count; i++)
343 {
344 int num = offset + i;
345 byte b = bytes[num];
346 switch (b)
347 {
348 case 43:
349 b = 32;
350 break;
351 case 37:
352 if (i >= count - 2)
353 {
354 break;
355 }
356 if (bytes[num + 1] == 117 && i < count - 5)
357 {
358 int num2 = System.HexConverter.FromChar(bytes[num + 2]);
359 int num3 = System.HexConverter.FromChar(bytes[num + 3]);
360 int num4 = System.HexConverter.FromChar(bytes[num + 4]);
361 int num5 = System.HexConverter.FromChar(bytes[num + 5]);
362 if ((num2 | num3 | num4 | num5) != 255)
363 {
364 char ch = (char)((num2 << 12) | (num3 << 8) | (num4 << 4) | num5);
365 i += 5;
366 urlDecoder.AddChar(ch);
367 continue;
368 }
369 }
370 else
371 {
372 int num6 = System.HexConverter.FromChar(bytes[num + 1]);
373 int num7 = System.HexConverter.FromChar(bytes[num + 2]);
374 if ((num6 | num7) != 255)
375 {
376 b = (byte)((num6 << 4) | num7);
377 i += 2;
378 }
379 }
380 break;
381 }
382 urlDecoder.AddByte(b);
383 }
384 return Utf16StringValidator.ValidateString(urlDecoder.GetString());
385 }
static int FromChar(int c)
static bool ValidateUrlEncodingParameters([NotNullWhen(true)] byte[] bytes, int offset, int count)

References System.Web.Util.HttpEncoder.UrlDecoder.AddByte(), System.Web.Util.HttpEncoder.UrlDecoder.AddChar(), System.bytes, System.ch, System.count, System.HexConverter.FromChar(), System.Web.Util.HttpEncoder.UrlDecoder.GetString(), System.offset, System.Web.Util.Utf16StringValidator.ValidateString(), and System.Web.Util.HttpEncoder.ValidateUrlEncodingParameters().