Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
ServiceNameCollection.cs
Go to the documentation of this file.
5
7
9{
11 {
12 if (items == null)
13 {
14 throw new ArgumentNullException("items");
15 }
16 AddIfNew(items, expectStrings: true);
17 }
18
20 : this(list, 1)
21 {
23 }
24
30
32 {
33 foreach (string item in list)
34 {
35 base.InnerList.Add(item);
36 }
37 }
38
39 public bool Contains(string? searchServiceName)
40 {
42 foreach (string inner in base.InnerList)
43 {
44 if (string.Equals(inner, b, StringComparison.OrdinalIgnoreCase))
45 {
46 return true;
47 }
48 }
49 return false;
50 }
51
53 {
54 return new ServiceNameCollection(base.InnerList, serviceName);
55 }
56
61
63 {
65 {
67 return;
68 }
70 {
72 return;
73 }
74 foreach (object serviceName in serviceNames)
75 {
77 }
78 }
79
81 {
82 foreach (string serviceName in serviceNames)
83 {
85 }
86 }
87
89 {
90 foreach (string serviceName in serviceNames)
91 {
93 }
94 }
95
96 private void AddIfNew(string serviceName)
97 {
98 if (string.IsNullOrEmpty(serviceName))
99 {
101 }
103 if (!Contains(serviceName))
104 {
105 base.InnerList.Add(serviceName);
106 }
107 }
108
110 {
112 {
113 return 1;
114 }
115 return collection2.Count;
116 }
117
118 [return: NotNullIfNotNull("inputServiceName")]
119 private static string NormalizeServiceName(string inputServiceName)
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;
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 }
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 }
179}
void Add(TKey key, TValue value)
static CultureInfo InvariantCulture
static string security_ServiceNameCollection_EmptyServiceName
Definition SR.cs:110
Definition SR.cs:7
static bool TryCreate([NotNullWhen(true)] string? uriString, UriKind uriKind, [NotNullWhen(true)] out Uri? result)
Definition Uri.cs:3793
static unsafe UriHostNameType CheckHostName(string? name)
Definition Uri.cs:963
UriKind
Definition UriKind.cs:4
UriFormat
Definition UriFormat.cs:4