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

◆ NormalizeServiceName()

static string System.Security.Authentication.ExtendedProtection.ServiceNameCollection.NormalizeServiceName ( string inputServiceName)
inlinestaticprivate

Definition at line 119 of file ServiceNameCollection.cs.

120 {
121 if (string.IsNullOrWhiteSpace(inputServiceName))
122 {
123 return inputServiceName;
124 }
125 int num = inputServiceName.IndexOf('/');
126 if (num < 0)
127 {
128 return inputServiceName;
129 }
130 string text = inputServiceName.Substring(0, num + 1);
131 string text2 = inputServiceName.Substring(num + 1);
132 if (string.IsNullOrWhiteSpace(text2))
133 {
134 return inputServiceName;
135 }
136 string text3 = text2;
137 string text4 = string.Empty;
138 string text5 = string.Empty;
139 UriHostNameType uriHostNameType = Uri.CheckHostName(text2);
140 if (uriHostNameType == UriHostNameType.Unknown)
141 {
142 string text6 = text2;
143 int num2 = text2.IndexOf('/');
144 if (num2 >= 0)
145 {
146 text6 = text2.Substring(0, num2);
147 text5 = text2.Substring(num2);
148 text3 = text6;
149 }
150 int num3 = text6.LastIndexOf(':');
151 if (num3 >= 0)
152 {
153 text3 = text6.Substring(0, num3);
154 text4 = text6.Substring(num3 + 1);
155 if (!ushort.TryParse(text4, NumberStyles.Integer, CultureInfo.InvariantCulture, out var _))
156 {
157 return inputServiceName;
158 }
159 text4 = text6.Substring(num3);
160 }
161 uriHostNameType = Uri.CheckHostName(text3);
162 }
164 {
165 return inputServiceName;
166 }
167 if (!Uri.TryCreate("http://" + text3, UriKind.Absolute, out Uri result2))
168 {
169 return inputServiceName;
170 }
171 string components = result2.GetComponents(UriComponents.NormalizedHost, UriFormat.SafeUnescaped);
172 string text7 = text + components + text4 + text5;
173 if (string.Equals(inputServiceName, text7, StringComparison.OrdinalIgnoreCase))
174 {
175 return inputServiceName;
176 }
177 return text7;
178 }
static CultureInfo InvariantCulture
UriKind
Definition UriKind.cs:4
UriFormat
Definition UriFormat.cs:4

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

Referenced by System.Security.Authentication.ExtendedProtection.ServiceNameCollection.AddIfNew(), and System.Security.Authentication.ExtendedProtection.ServiceNameCollection.Contains().