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

◆ UrlDecode() [3/3]

static string System.Web.Util.HttpEncoder.UrlDecode ( string value,
Encoding encoding )
inlinestaticpackage

Definition at line 388 of file HttpEncoder.cs.

389 {
390 if (value == null)
391 {
392 return null;
393 }
394 int length = value.Length;
395 UrlDecoder urlDecoder = new UrlDecoder(length, encoding);
396 for (int i = 0; i < length; i++)
397 {
398 char c = value[i];
399 switch (c)
400 {
401 case '+':
402 c = ' ';
403 break;
404 case '%':
405 if (i >= length - 2)
406 {
407 break;
408 }
409 if (value[i + 1] == 'u' && i < length - 5)
410 {
411 int num = System.HexConverter.FromChar(value[i + 2]);
412 int num2 = System.HexConverter.FromChar(value[i + 3]);
413 int num3 = System.HexConverter.FromChar(value[i + 4]);
414 int num4 = System.HexConverter.FromChar(value[i + 5]);
415 if ((num | num2 | num3 | num4) != 255)
416 {
417 c = (char)((num << 12) | (num2 << 8) | (num3 << 4) | num4);
418 i += 5;
419 urlDecoder.AddChar(c);
420 continue;
421 }
422 }
423 else
424 {
425 int num5 = System.HexConverter.FromChar(value[i + 1]);
426 int num6 = System.HexConverter.FromChar(value[i + 2]);
427 if ((num5 | num6) != 255)
428 {
429 byte b = (byte)((num5 << 4) | num6);
430 i += 2;
431 urlDecoder.AddByte(b);
432 continue;
433 }
434 }
435 break;
436 }
437 if ((c & 0xFF80) == 0)
438 {
439 urlDecoder.AddByte((byte)c);
440 }
441 else
442 {
443 urlDecoder.AddChar(c);
444 }
445 }
446 return Utf16StringValidator.ValidateString(urlDecoder.GetString());
447 }
static int FromChar(int c)

References System.Web.Util.HttpEncoder.UrlDecoder.AddByte(), System.Web.Util.HttpEncoder.UrlDecoder.AddChar(), System.HexConverter.FromChar(), System.Web.Util.HttpEncoder.UrlDecoder.GetString(), System.length, System.Web.Util.Utf16StringValidator.ValidateString(), and System.value.