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

◆ NormalizeServiceName()

static string System.Net.ServiceNameStore.NormalizeServiceName ( string inputServiceName)
inlinestaticprivate

Definition at line 33 of file ServiceNameStore.cs.

34 {
35 if (string.IsNullOrWhiteSpace(inputServiceName))
36 {
37 return inputServiceName;
38 }
39 int num = inputServiceName.IndexOf('/');
40 if (num < 0)
41 {
42 return inputServiceName;
43 }
44 string text = inputServiceName.Substring(0, num + 1);
45 string text2 = inputServiceName.Substring(num + 1);
46 if (string.IsNullOrWhiteSpace(text2))
47 {
48 return inputServiceName;
49 }
50 string text3 = text2;
51 string text4 = string.Empty;
52 string text5 = string.Empty;
53 UriHostNameType uriHostNameType = Uri.CheckHostName(text2);
54 if (uriHostNameType == UriHostNameType.Unknown)
55 {
56 string text6 = text2;
57 int num2 = text2.IndexOf('/');
58 if (num2 >= 0)
59 {
60 text6 = text2.Substring(0, num2);
61 text5 = text2.Substring(num2);
62 text3 = text6;
63 }
64 int num3 = text6.LastIndexOf(':');
65 if (num3 >= 0)
66 {
67 text3 = text6.Substring(0, num3);
68 text4 = text6.Substring(num3 + 1);
69 if (!ushort.TryParse(text4, NumberStyles.Integer, CultureInfo.InvariantCulture, out var _))
70 {
71 return inputServiceName;
72 }
73 text4 = text6.Substring(num3);
74 }
75 uriHostNameType = Uri.CheckHostName(text3);
76 }
78 {
79 return inputServiceName;
80 }
81 if (!Uri.TryCreate(Uri.UriSchemeHttp + Uri.SchemeDelimiter + text3, UriKind.Absolute, out Uri result2))
82 {
83 return inputServiceName;
84 }
85 string components = result2.GetComponents(UriComponents.NormalizedHost, UriFormat.SafeUnescaped);
86 string text7 = text + components + text4 + text5;
87 if (inputServiceName.Equals(text7, StringComparison.OrdinalIgnoreCase))
88 {
89 return inputServiceName;
90 }
91 return text7;
92 }
static CultureInfo InvariantCulture
UriKind
Definition UriKind.cs:4
UriFormat
Definition UriFormat.cs:4

References System.Uri.CheckHostName(), System.Globalization.CultureInfo.InvariantCulture, System.Uri.SchemeDelimiter, System.text, System.Uri.TryCreate(), and System.Uri.UriSchemeHttp.

Referenced by System.Net.ServiceNameStore.AddSingleServiceName(), and System.Net.ServiceNameStore.Remove().