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

◆ GetHostViaCustomSyntax()

unsafe void System.Uri.GetHostViaCustomSyntax ( )
inlineprivate

Definition at line 1751 of file Uri.cs.

1752 {
1753 if (_info.Host != null)
1754 {
1755 return;
1756 }
1757 string text = _syntax.InternalGetComponents(this, UriComponents.Host, UriFormat.UriEscaped);
1758 if (_info.Host == null)
1759 {
1760 if (text.Length >= 65520)
1761 {
1762 throw GetException(ParsingError.SizeLimit);
1763 }
1765 Flags flags = (Flags)((ulong)_flags & 0xFFFFFFFFFFF8FFFFuL);
1766 fixed (char* pString = text)
1767 {
1768 string newHost = null;
1769 if (CheckAuthorityHelper(pString, 0, text.Length, ref err, ref flags, _syntax, ref newHost) != text.Length)
1770 {
1771 flags = (Flags)((ulong)flags & 0xFFFFFFFFFFF8FFFFuL);
1772 flags |= Flags.HostTypeMask;
1773 }
1774 }
1775 if (err != 0 || (flags & Flags.HostTypeMask) == Flags.HostTypeMask)
1776 {
1777 _flags = (Flags)(((ulong)_flags & 0xFFFFFFFFFFF8FFFFuL) | 0x50000);
1778 }
1779 else
1780 {
1781 text = CreateHostStringHelper(text, 0, text.Length, ref flags, ref _info.ScopeId);
1782 for (int i = 0; i < text.Length; i++)
1783 {
1784 if (_info.Offset.Host + i >= _info.Offset.End || text[i] != _string[_info.Offset.Host + i])
1785 {
1786 _flags |= Flags.HostNotCanonical | Flags.E_HostNotCanonical;
1787 break;
1788 }
1789 }
1790 _flags = (Flags)(((ulong)_flags & 0xFFFFFFFFFFF8FFFFuL) | (ulong)(flags & Flags.HostTypeMask));
1791 }
1792 }
1793 string text2 = _syntax.InternalGetComponents(this, UriComponents.StrongPort, UriFormat.UriEscaped);
1794 int num = 0;
1795 if (string.IsNullOrEmpty(text2))
1796 {
1797 _flags &= ~Flags.NotDefaultPort;
1798 _flags |= Flags.PortNotCanonical | Flags.E_PortNotCanonical;
1800 }
1801 else
1802 {
1803 for (int j = 0; j < text2.Length; j++)
1804 {
1805 int num2 = text2[j] - 48;
1806 if (num2 < 0 || num2 > 9 || (num = num * 10 + num2) > 65535)
1807 {
1808 throw new UriFormatException(System.SR.Format(System.SR.net_uri_PortOutOfRange, _syntax.GetType(), text2));
1809 }
1810 }
1811 if (num != _info.Offset.PortValue)
1812 {
1813 if (num == _syntax.DefaultPort)
1814 {
1815 _flags &= ~Flags.NotDefaultPort;
1816 }
1817 else
1818 {
1819 _flags |= Flags.NotDefaultPort;
1820 }
1821 _flags |= Flags.PortNotCanonical | Flags.E_PortNotCanonical;
1822 _info.Offset.PortValue = (ushort)num;
1823 }
1824 }
1825 _info.Host = text;
1826 }
static string Format(string resourceFormat, object p1)
Definition SR.cs:118
static string net_uri_PortOutOfRange
Definition SR.cs:46
Definition SR.cs:7
string InternalGetComponents(Uri thisUri, UriComponents uriComponents, UriFormat uriFormat)
Definition UriParser.cs:336
string Host
Definition Uri.cs:85
string ScopeId
Definition Uri.cs:91
Offset Offset
Definition Uri.cs:81
UriParser _syntax
Definition Uri.cs:193
Flags _flags
Definition Uri.cs:195
static string CreateHostStringHelper(string str, int idx, int end, ref Flags flags, ref string scopeId)
Definition Uri.cs:1713
static UriFormatException GetException(ParsingError err)
Definition Uri.cs:873
unsafe int CheckAuthorityHelper(char *pString, int idx, int length, ref ParsingError err, ref Flags flags, UriParser syntax, ref string newHost)
Definition Uri.cs:2698
string _string
Definition Uri.cs:189
UriInfo _info
Definition Uri.cs:197
UriFormat
Definition UriFormat.cs:4
ushort PortValue
Definition Uri.cs:117
ushort End
Definition Uri.cs:125
ushort Host
Definition Uri.cs:115

References System.Uri._flags, System.Uri._info, System.Uri._string, System.Uri._syntax, System.Uri.CheckAuthorityHelper(), System.Uri.CreateHostStringHelper(), System.UriParser.DefaultPort, System.Runtime.Serialization.Dictionary, System.Uri.Offset.End, System.SR.Format(), System.Uri.GetException(), System.Uri.UriInfo.Host, System.Uri.Offset.Host, System.UriParser.InternalGetComponents(), System.SR.net_uri_PortOutOfRange, System.Uri.UriInfo.Offset, System.Uri.Offset.PortValue, System.Uri.UriInfo.ScopeId, and System.text.

Referenced by System.Uri.CreateHostString().