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

◆ Translate() [2/2]

IdentityReferenceCollection System.Security.Principal.IdentityReferenceCollection.Translate ( Type targetType,
bool forceSuccess )
inline

Definition at line 98 of file IdentityReferenceCollection.cs.

99 {
100 if (targetType == null)
101 {
102 throw new ArgumentNullException("targetType");
103 }
104 if (!targetType.IsSubclassOf(typeof(IdentityReference)))
105 {
107 }
108 if (Identities.Count == 0)
109 {
110 return new IdentityReferenceCollection();
111 }
112 int num = 0;
113 int num2 = 0;
114 for (int i = 0; i < Identities.Count; i++)
115 {
116 Type type = Identities[i].GetType();
117 if (type == targetType)
118 {
119 continue;
120 }
121 if (type == typeof(SecurityIdentifier))
122 {
123 num++;
124 continue;
125 }
126 if (type == typeof(NTAccount))
127 {
128 num2++;
129 continue;
130 }
131 throw new NotSupportedException();
132 }
133 bool flag = false;
136 if (num == Count)
137 {
138 flag = true;
140 }
141 else if (num > 0)
142 {
144 }
145 if (num2 == Count)
146 {
147 flag = true;
149 }
150 else if (num2 > 0)
151 {
153 }
155 if (!flag)
156 {
158 for (int j = 0; j < Identities.Count; j++)
159 {
160 IdentityReference identityReference = this[j];
161 Type type2 = identityReference.GetType();
162 if (type2 == targetType)
163 {
164 continue;
165 }
166 if (type2 == typeof(SecurityIdentifier))
167 {
169 continue;
170 }
171 if (type2 == typeof(NTAccount))
172 {
174 continue;
175 }
176 throw new NotSupportedException();
177 }
178 }
179 bool someFailed = false;
182 if (num > 0)
183 {
185 if (flag && !(forceSuccess && someFailed))
186 {
188 }
189 }
190 if (num2 > 0)
191 {
193 if (flag && !(forceSuccess && someFailed))
194 {
196 }
197 }
199 {
202 {
203 foreach (IdentityReference item in identityReferenceCollection4)
204 {
205 if (item.GetType() != targetType)
206 {
208 }
209 }
210 }
212 {
213 foreach (IdentityReference item2 in identityReferenceCollection5)
214 {
215 if (item2.GetType() != targetType)
216 {
218 }
219 }
220 }
221 throw new IdentityNotMappedException(System.SR.IdentityReference_IdentityNotMapped, identityReferenceCollection3);
222 }
223 if (!flag)
224 {
225 num = 0;
226 num2 = 0;
228 for (int k = 0; k < Identities.Count; k++)
229 {
230 IdentityReference identityReference2 = this[k];
231 Type type3 = identityReference2.GetType();
232 if (type3 == targetType)
233 {
235 continue;
236 }
237 if (type3 == typeof(SecurityIdentifier))
238 {
240 continue;
241 }
242 if (type3 == typeof(NTAccount))
243 {
245 continue;
246 }
247 throw new NotSupportedException();
248 }
249 }
251 }
void Add(TKey key, TValue value)
static string IdentityReference_IdentityNotMapped
Definition SR.cs:44
static string IdentityReference_MustBeIdentityReference
Definition SR.cs:50
Definition SR.cs:7

References System.Security.Principal.IdentityReferenceCollection.IdentityReferenceCollection(), System.Collections.Generic.Dictionary< TKey, TValue >.Add(), System.Collections.Generic.Dictionary< TKey, TValue >.Count, System.Security.Principal.IdentityReferenceCollection.Count, System.Security.Principal.IdentityReferenceCollection.Identities, System.SR.IdentityReference_IdentityNotMapped, System.SR.IdentityReference_MustBeIdentityReference, System.item, System.Security.Principal.NTAccount.Translate(), System.Security.Principal.SecurityIdentifier.Translate(), and System.type.