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

◆ UrlDecodeInternal() [2/2]

static string System.Net.WebUtility.UrlDecodeInternal ( string value,
Encoding encoding )
inlinestaticprivate

Definition at line 748 of file WebUtility.cs.

749 {
750 if (string.IsNullOrEmpty(value))
751 {
752 return value;
753 }
754 int length = value.Length;
755 UrlDecoder urlDecoder = new UrlDecoder(length, encoding);
756 bool flag = false;
757 bool flag2 = false;
758 for (int i = 0; i < length; i++)
759 {
760 char c = value[i];
761 switch (c)
762 {
763 case '+':
764 flag2 = true;
765 c = ' ';
766 break;
767 case '%':
768 if (i < length - 2)
769 {
770 int num = HexConverter.FromChar(value[i + 1]);
771 int num2 = HexConverter.FromChar(value[i + 2]);
772 if ((num | num2) != 255)
773 {
774 byte b = (byte)((num << 4) | num2);
775 i += 2;
776 urlDecoder.AddByte(b);
777 flag = true;
778 continue;
779 }
780 }
781 break;
782 }
783 if ((c & 0xFF80) == 0)
784 {
785 urlDecoder.AddByte((byte)c);
786 }
787 else
788 {
789 urlDecoder.AddChar(c);
790 }
791 }
792 if (!flag)
793 {
794 if (flag2)
795 {
796 return value.Replace('+', ' ');
797 }
798 return value;
799 }
800 return urlDecoder.GetString();
801 }

References System.HexConverter.FromChar(), System.length, and System.value.

Referenced by System.Net.WebUtility.UrlDecode(), and System.Net.WebUtility.UrlDecodeToBytes().