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

◆ IsValidByIri()

static unsafe bool System.DomainNameHelper.IsValidByIri ( char * name,
int pos,
ref int returnedEnd,
ref bool notCanonical,
bool notImplicitFile )
inlinestaticpackage

Definition at line 85 of file DomainNameHelper.cs.

86 {
87 char* ptr = name + pos;
88 char* ptr2 = ptr;
89 char* ptr3 = name + returnedEnd;
90 int num = 0;
91 for (; ptr2 < ptr3; ptr2++)
92 {
93 char c = *ptr2;
94 if (c == '/' || c == '\\' || (notImplicitFile && (c == ':' || c == '?' || c == '#')))
95 {
96 ptr3 = ptr2;
97 break;
98 }
99 }
100 if (ptr3 == ptr)
101 {
102 return false;
103 }
104 do
105 {
106 ptr2 = ptr;
107 num = 0;
108 bool flag = false;
109 for (; ptr2 < ptr3 && *ptr2 != '.' && *ptr2 != '。' && *ptr2 != '.' && *ptr2 != '。'; ptr2++)
110 {
111 num++;
112 if (*ptr2 > 'ÿ')
113 {
114 num++;
115 }
116 if (*ptr2 >= '\u00a0')
117 {
118 flag = true;
119 }
120 }
121 if (ptr == ptr2 || (flag ? (num + 4) : num) > 63 || (*(ptr++) < '\u00a0' && !IsASCIILetterOrDigit(*(ptr - 1), ref notCanonical)))
122 {
123 return false;
124 }
125 while (ptr < ptr2)
126 {
127 if (*(ptr++) < '\u00a0' && !IsValidDomainLabelCharacter(*(ptr - 1), ref notCanonical))
128 {
129 return false;
130 }
131 }
132 ptr++;
133 }
134 while (ptr < ptr3);
135 returnedEnd = (int)(ptr3 - name);
136 return true;
137 }
static bool IsValidDomainLabelCharacter(char character, ref bool notCanonical)
static bool IsASCIILetterOrDigit(char character, ref bool notCanonical)

References System.DomainNameHelper.IsASCIILetterOrDigit(), and System.DomainNameHelper.IsValidDomainLabelCharacter().

Referenced by System.Uri.CheckAuthorityHelper(), and System.Uri.CheckHostName().