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

◆ IsValid()

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

Definition at line 40 of file DomainNameHelper.cs.

41 {
42 char* ptr = name + pos;
43 char* ptr2 = ptr;
44 char* ptr3;
45 for (ptr3 = name + returnedEnd; ptr2 < ptr3; ptr2++)
46 {
47 char c = *ptr2;
48 if (c > '\u007f')
49 {
50 return false;
51 }
52 if (c < 'a' && (c == '/' || c == '\\' || (notImplicitFile && (c == ':' || c == '?' || c == '#'))))
53 {
54 ptr3 = ptr2;
55 break;
56 }
57 }
58 if (ptr3 == ptr)
59 {
60 return false;
61 }
62 do
63 {
64 for (ptr2 = ptr; ptr2 < ptr3 && *ptr2 != '.'; ptr2++)
65 {
66 }
67 if (ptr == ptr2 || ptr2 - ptr > 63 || !IsASCIILetterOrDigit(*(ptr++), ref notCanonical))
68 {
69 return false;
70 }
71 while (ptr < ptr2)
72 {
73 if (!IsValidDomainLabelCharacter(*(ptr++), ref notCanonical))
74 {
75 return false;
76 }
77 }
78 ptr++;
79 }
80 while (ptr < ptr3);
81 returnedEnd = (int)(ptr3 - name);
82 return true;
83 }
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().